static void
cc_ua_panel_init_hearing (CcUaPanel *self)
{
  CcUaPanelPrivate *priv = self->priv;
  GtkWidget *w;

  /* set the initial visual bell values */
  visual_bell_type_notify_cb (NULL, NULL, self);

  /* and listen */
  w = WID (priv->builder, "hearing_visual_alerts_switch");
  settings_on_off_editor_new (priv, priv->wm_settings, "visual-bell", w, visual_alerts_section);

  g_signal_connect (priv->wm_settings, "changed::visual-bell-type",
                    G_CALLBACK (visual_bell_type_notify_cb), self);
  g_signal_connect (WID (priv->builder, "hearing_flash_window_title_button"),
                    "toggled", G_CALLBACK (visual_bell_type_toggle_cb), self);

  /* test flash */
  g_signal_connect (WID (priv->builder, "hearing_test_flash_button"),
                    "clicked", G_CALLBACK (gdk_beep), NULL);

  g_signal_connect (WID (priv->builder, "hearing_sound_preferences_link"),
                    "activate-link",
                    G_CALLBACK (hearing_sound_preferences_clicked), self);
}
示例#2
0
static void
cc_ua_panel_init_hearing (CcUaPanel *self)
{
  CcUaPanelPrivate *priv = self->priv;
  GtkWidget *list;
  GtkWidget *dialog;

  list = WID ("list_hearing");
  add_section (list, self);

  add_separators (GTK_LIST_BOX (list));

  g_signal_connect_swapped (list, "row-activated",
                            G_CALLBACK (activate_row), self);

  /* set the initial visual bell values */
  visual_bell_type_notify_cb (NULL, NULL, self);

  /* and listen */
  g_settings_bind (priv->wm_settings, KEY_VISUAL_BELL_ENABLED,
                   WID ("visual_alerts_switch"), "active",
                   G_SETTINGS_BIND_DEFAULT);

  g_settings_bind_with_mapping (priv->wm_settings, KEY_VISUAL_BELL_ENABLED,
                                WID ("value_visual_alerts"),
                                "label", G_SETTINGS_BIND_GET,
                                on_off_label_mapping_get,
                                NULL, NULL, NULL);

  g_object_bind_property (WID ("visual_alerts_switch"), "active",
                          WID ("visual_alerts_window_radio"), "sensitive",
                          G_BINDING_SYNC_CREATE);
  g_object_bind_property (WID ("visual_alerts_switch"), "active",
                          WID ("visual_alerts_screen_radio"), "sensitive",
                          G_BINDING_SYNC_CREATE);

  g_signal_connect (priv->wm_settings, "changed::" KEY_VISUAL_BELL_TYPE,
                    G_CALLBACK (visual_bell_type_notify_cb), self);
  g_signal_connect (WID ("visual_alerts_window_radio"),
                    "toggled", G_CALLBACK (visual_bell_type_toggle_cb), self);

  dialog = WID ("visual_alerts_dialog");

  g_object_set_data (G_OBJECT (WID ("row_visual_alerts")), "dialog", dialog);

  g_signal_connect_swapped (WID ("visual_alerts_done"), "clicked",
                            G_CALLBACK (gtk_widget_hide), dialog);
  g_signal_connect (dialog, "delete-event",
                    G_CALLBACK (gtk_widget_hide_on_delete), NULL);

  g_signal_connect (WID ("visual_alerts_test_button"),
                    "clicked", G_CALLBACK (gdk_beep), NULL);
  g_signal_connect (WID ("heading_visual_alerts"), "mnemonic-activate",
                    G_CALLBACK (mnemonic_activate), self);
}
static void
cc_ua_panel_init_hearing (CcUaPanel *self)
{
  CcUaPanelPrivate *priv = self->priv;
  GtkWidget *w;
  GConfEntry *entry;
  guint id;

  gconf_client_add_dir (priv->client, "/apps/metacity/general",
                        GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);

  w = WID (priv->builder, "hearing_visual_alerts_switch");
  gconf_on_off_peditor_new (priv, "/apps/metacity/general/visual_bell",
                            w, visual_alerts_section);

  /* visual bell type */
  id = gconf_client_notify_add (priv->client,
                                "/apps/metacity/general/visual_bell_type",
                                (GConfClientNotifyFunc)
                                visual_bell_type_notify_cb,
                                self, NULL, NULL);
  priv->notify_list = g_slist_prepend (priv->notify_list, GINT_TO_POINTER (id));

  /* set the initial value */
  entry = gconf_client_get_entry (priv->client,
                                  "/apps/metacity/general/visual_bell_type",
                                  NULL, TRUE, NULL);
  if (entry == NULL)
    g_warning ("The following warning is because metacity's GConf settings aren't installed");
  visual_bell_type_notify_cb (priv->client, 0, entry, self);

  g_signal_connect (WID (priv->builder, "hearing_flash_window_title_button"),
                    "toggled", G_CALLBACK (visual_bell_type_toggle_cb), self);

  /* test flash */
  g_signal_connect (WID (priv->builder, "hearing_test_flash_button"),
                    "clicked", G_CALLBACK (gdk_beep), NULL);

  g_signal_connect (WID (priv->builder, "hearing_sound_preferences_link"),
                    "activate-link",
                    G_CALLBACK (hearing_sound_preferences_clicked), self);
}