static void preferences_hookup_string_combo (EmpathyPreferences *preferences, const gchar *key, GtkWidget *widget) { guint id; preferences_widget_sync_string_combo (key, widget); g_object_set_data_full (G_OBJECT (widget), "key", g_strdup (key), g_free); g_signal_connect (widget, "changed", G_CALLBACK (preferences_string_combo_changed_cb), NULL); id = empathy_conf_notify_add (empathy_conf_get (), key, preferences_notify_string_combo_cb, widget); if (id) { preferences_add_id (preferences, id); } }
static void preferences_hookup_radio_button (EmpathyPreferences *preferences, const gchar *key, GtkWidget *widget) { GSList *group, *l; guint id; preferences_widget_sync_string (key, widget); group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); for (l = group; l; l = l->next) { g_signal_connect (l->data, "toggled", G_CALLBACK (preferences_radio_button_toggled_cb), NULL); g_object_set_data_full (G_OBJECT (l->data), "key", g_strdup (key), g_free); } id = empathy_conf_notify_add (empathy_conf_get (), key, preferences_notify_string_cb, widget); if (id) { preferences_add_id (preferences, id); } }
static void preferences_setup_widgets (EmpathyPreferences *preferences) { guint id; preferences_hookup_toggle_button (preferences, EMPATHY_PREFS_SOUNDS_ENABLED, preferences->checkbutton_sounds_enabled); preferences_hookup_toggle_button (preferences, EMPATHY_PREFS_SOUNDS_DISABLED_AWAY, preferences->checkbutton_sounds_disabled_away); preferences_hookup_sensitivity (preferences, EMPATHY_PREFS_SOUNDS_ENABLED, preferences->checkbutton_sounds_disabled_away); preferences_hookup_sensitivity (preferences, EMPATHY_PREFS_SOUNDS_ENABLED, preferences->treeview_sounds); preferences_hookup_toggle_button (preferences, EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS, preferences->checkbutton_separate_chat_windows); preferences_hookup_toggle_button (preferences, EMPATHY_PREFS_UI_SHOW_AVATARS, preferences->checkbutton_show_avatars); preferences_hookup_toggle_button (preferences, EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST, preferences->checkbutton_compact_contact_list); preferences_hookup_toggle_button (preferences, EMPATHY_PREFS_CHAT_SHOW_SMILEYS, preferences->checkbutton_show_smileys); preferences_hookup_string_combo (preferences, EMPATHY_PREFS_CHAT_THEME, preferences->combobox_chat_theme); preferences_hookup_radio_button (preferences, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM, preferences->radiobutton_contact_list_sort_by_name); preferences_hookup_toggle_button (preferences, EMPATHY_PREFS_AUTOCONNECT, preferences->checkbutton_autoconnect); id = empathy_conf_notify_add (empathy_conf_get (), EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST, preferences_compact_contact_list_changed_cb, preferences); if (id) { preferences_add_id (preferences, id); } preferences_compact_contact_list_changed_cb (empathy_conf_get (), EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST, preferences); }
static void preferences_hookup_string_combo(PreferencesDialog *prefs, const gchar *key, GtkComboBox *combo_box){ guint id; preferences_widget_sync_string_combo(key, combo_box); g_object_set_data_full(G_OBJECT(combo_box), "key", g_strdup(key), g_free); g_signal_connect(combo_box, "changed", (GCallback)preferences_string_combo_changed_cb, prefs); if((id=gconfig_notify_add(g_strdup(key), preferences_notify_string_combo_cb, combo_box))) preferences_add_id(prefs, id); }
static void preferences_hookup_toggle_button(PreferencesDialog *prefs, const gchar *key, gboolean bool_default, GtkCheckButton *check_button){ guint id; g_object_set_data_full(G_OBJECT(check_button), "key", g_strdup(key), g_free); g_object_set_data_full(G_OBJECT(check_button), "bool_default", g_strdup((bool_default?"TRUE" :"FALSE")), g_free); g_signal_connect(check_button, "toggled", (GCallback)preferences_toggle_button_toggled_cb, prefs); preferences_widget_sync_bool(key, check_button); if((id=gconfig_notify_add(g_strdup(key), preferences_notify_bool_cb, check_button))) preferences_add_id(prefs, id); }
static void preferences_hookup_int_combo(PreferencesDialog *prefs, const gchar *key,const gint default_int, GtkComboBox *combo_box){ guint id; g_object_set_data_full(G_OBJECT(combo_box), "key", g_strdup(key), g_free); g_object_set_data(G_OBJECT(combo_box), "default_int", GINT_TO_POINTER(default_int)); preferences_widget_sync_int_combo(key, combo_box); g_signal_connect(combo_box, "changed", (GCallback)preferences_int_combo_changed_cb, prefs); if((id=gconfig_notify_add(key, preferences_notify_int_combo_cb, combo_box))) preferences_add_id (prefs, id); }
static void preferences_hookup_sensitivity (EmpathyPreferences *preferences, const gchar *key, GtkWidget *widget) { gboolean value; guint id; if (empathy_conf_get_bool (empathy_conf_get (), key, &value)) { gtk_widget_set_sensitive (widget, value); } id = empathy_conf_notify_add (empathy_conf_get (), key, preferences_notify_sensitivity_cb, widget); if (id) { preferences_add_id (preferences, id); } }