static void sound_events_list_changed_nt (G_GNUC_UNUSED gpointer id, GmConfEntry *entry, gpointer data) { GtkWidget *prefs_window = (GtkWidget*)data; if (gm_conf_entry_get_type (entry) == GM_CONF_STRING || gm_conf_entry_get_type (entry) == GM_CONF_BOOL) { if (prefs_window) gm_prefs_window_sound_events_list_build (prefs_window); } }
/* DESCRIPTION : Generic notifiers for int-based option menus. * This callback is called when a specific key of * the config database associated with an option menu changes, * it only updates the menu. * BEHAVIOR : It only updates the widget. * PRE : The config key triggering that notifier on modifiction * should be of type integer. */ void int_option_menu_changed_nt (G_GNUC_UNUSED gpointer cid, GmConfEntry *entry, gpointer data) { GtkWidget *e = NULL; gint current_value = 0; if (gm_conf_entry_get_type (entry) == GM_CONF_INT) { e = GTK_WIDGET (data); current_value = gm_conf_entry_get_int (entry); g_signal_handlers_block_matched (G_OBJECT (e), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) int_option_menu_changed, NULL); if (current_value != gtk_combo_box_get_active (GTK_COMBO_BOX (e))) gtk_combo_box_set_active (GTK_COMBO_BOX (e), current_value); g_signal_handlers_unblock_matched (G_OBJECT (e), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) int_option_menu_changed, NULL); } }
void adjustment_changed_nt (G_GNUC_UNUSED gpointer cid, GmConfEntry *entry, gpointer data) { GtkAdjustment *s = NULL; gdouble current_value = 0.0; if (gm_conf_entry_get_type (entry) == GM_CONF_INT) { s = GTK_ADJUSTMENT (data); current_value = gm_conf_entry_get_int (entry); g_signal_handlers_block_matched (G_OBJECT (s), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) adjustment_changed, NULL); if (gtk_adjustment_get_value (GTK_ADJUSTMENT (s)) > current_value || gtk_adjustment_get_value (GTK_ADJUSTMENT (s)) < current_value) gtk_adjustment_set_value (GTK_ADJUSTMENT (s), current_value); g_signal_handlers_unblock_matched (G_OBJECT (s), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) adjustment_changed, NULL); } }
/* DESCRIPTION : Generic notifiers for toggles. * This callback is called when a specific key of * the config database associated with a toggle changes, this * only updates the toggle. * BEHAVIOR : It only updates the widget. * PRE : The config key triggering that notifier on modification *" should be of type boolean. */ void toggle_changed_nt (G_GNUC_UNUSED gpointer cid, GmConfEntry *entry, gpointer data) { GtkWidget *e = NULL; gboolean current_value = FALSE; if (gm_conf_entry_get_type (entry) == GM_CONF_BOOL) { e = GTK_WIDGET (data); /* We set the new value for the widget */ current_value = gm_conf_entry_get_bool (entry); g_signal_handlers_block_matched (G_OBJECT (e), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) toggle_changed, NULL); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (e)) != current_value) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (e), current_value); g_signal_handlers_unblock_matched (G_OBJECT (e), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) toggle_changed, NULL); } }
/* DESCRIPTION : Generic notifiers for string-based option_menus. * This callback is called when a specific key of * the config database associated with an option menu changes, * this only updates the menu. * BEHAVIOR : It only updates the widget. * PRE : The config key triggering that notifier on modifiction * should be of type string. */ void string_option_menu_changed_nt (G_GNUC_UNUSED gpointer cid, GmConfEntry *entry, gpointer data) { int cpt = 0; int count = 0; GtkTreeModel *model = NULL; GtkTreeIter iter; GtkWidget *e = NULL; gchar *text = NULL; gchar* txt = NULL; if (gm_conf_entry_get_type (entry) == GM_CONF_STRING) { e = GTK_WIDGET (data); model = gtk_combo_box_get_model (GTK_COMBO_BOX (e)); count = gtk_tree_model_iter_n_children (model, NULL); gtk_tree_model_get_iter_first (model, &iter); for (cpt = 0 ; cpt < count ; cpt++) { gtk_tree_model_get (model, &iter, 0, &text, -1); txt = gm_conf_entry_get_string (entry); if (text && !g_strcmp0 (text, txt)) { g_free (text); g_free (txt); break; } g_free (txt); gtk_tree_model_iter_next (model, &iter); g_free (text); } g_signal_handlers_block_matched (G_OBJECT (e), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) string_option_menu_changed, NULL); if (cpt != count && gtk_combo_box_get_active (GTK_COMBO_BOX (data)) != cpt) gtk_combo_box_set_active (GTK_COMBO_BOX (data), cpt); g_signal_handlers_unblock_matched (G_OBJECT (e), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) string_option_menu_changed, NULL); } }
/* DESCRIPTION : Generic notifiers for entries. * This callback is called when a specific key of * the config database associated with an entry changes. * BEHAVIOR : It updates the widget. * PRE : The config key triggering that notifier on modification * should be of type string. */ void entry_changed_nt (G_GNUC_UNUSED gpointer cid, GmConfEntry *entry, gpointer data) { GtkWidget *e = NULL; gchar *current_value = NULL; if (gm_conf_entry_get_type(entry) == GM_CONF_STRING) { gdk_threads_enter (); e = GTK_WIDGET (data); current_value = (gchar *) gm_conf_entry_get_string (entry); if (current_value && strcmp (current_value, gtk_entry_get_text (GTK_ENTRY (e)))) { g_signal_handlers_block_matched (G_OBJECT (e), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) entry_focus_changed, NULL); g_signal_handlers_block_matched (G_OBJECT (e), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) entry_activate_changed, NULL); gtk_entry_set_text (GTK_ENTRY (e), current_value); g_signal_handlers_unblock_matched (G_OBJECT (e), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) entry_activate_changed, NULL); g_signal_handlers_unblock_matched (G_OBJECT (e), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer) entry_focus_changed, NULL); } gdk_threads_leave (); } }
static void show_offline_contacts_changed_nt (G_GNUC_UNUSED gpointer id, GmConfEntry *entry, gpointer data) { RosterViewGtk *self = NULL; GtkTreeModel *model = NULL; g_return_if_fail (data != NULL); self = ROSTER_VIEW_GTK (data); if (gm_conf_entry_get_type (entry) == GM_CONF_BOOL) { self->priv->show_offline_contacts = gm_conf_entry_get_bool (entry); /* beware: model is filtered here */ model = gtk_tree_view_get_model (self->priv->tree_view); gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model)); /* beware: we want the unfiltered model now */ model = GTK_TREE_MODEL (self->priv->store); /* there's an interesting problem there : hiding makes the rows * unexpanded... so they don't come back as they should! */ GtkTreeIter heaps; GtkTreePath* path = NULL; if (gtk_tree_model_get_iter_first (model, &heaps)) { do { path = gtk_tree_model_get_path (model, &heaps); gtk_tree_view_expand_row (self->priv->tree_view, path, FALSE); gtk_tree_path_free (path); roster_view_gtk_update_groups (self, &heaps); } while (gtk_tree_model_iter_next (model, &heaps)); } } }