static void main_window_notify_contact_list_size_cb (EmpathyConf *conf, const gchar *key, EmpathyMainWindow *window) { gboolean show_avatars; gboolean compact_contact_list; gint value = CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS; if (empathy_conf_get_bool (conf, EMPATHY_PREFS_UI_SHOW_AVATARS, &show_avatars) && empathy_conf_get_bool (conf, EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST, &compact_contact_list)) { if (compact_contact_list) { value = CONTACT_LIST_COMPACT_SIZE; } else if (show_avatars) { value = CONTACT_LIST_NORMAL_SIZE_WITH_AVATARS; } else { value = CONTACT_LIST_NORMAL_SIZE; } } /* By changing the value of the GtkRadioAction, it emits a signal that calls main_window_view_contacts_list_size_cb which updates the contacts list */ gtk_radio_action_set_current_value (window->normal_with_avatars, value); }
static void shell_window_init_switcher_style (EShellWindow *shell_window) { GtkAction *action; GSettings *settings; GtkToolbarStyle style; gchar *string; settings = e_util_ref_settings ("org.gnome.evolution.shell"); action = ACTION (SWITCHER_STYLE_ICONS); string = g_settings_get_string (settings, "buttons-style"); g_object_unref (settings); if (string != NULL) { if (strcmp (string, "icons") == 0) style = GTK_TOOLBAR_ICONS; else if (strcmp (string, "text") == 0) style = GTK_TOOLBAR_TEXT; else if (strcmp (string, "both") == 0) style = GTK_TOOLBAR_BOTH_HORIZ; else style = -1; gtk_radio_action_set_current_value ( GTK_RADIO_ACTION (action), style); g_free (string); } g_signal_connect ( action, "changed", G_CALLBACK (shell_window_save_switcher_style_cb), shell_window); }
static void main_window_notify_sort_contact_cb (EmpathyConf *conf, const gchar *key, EmpathyMainWindow *window) { gchar *str = NULL; if (empathy_conf_get_string (conf, key, &str) && str) { GType type; GEnumClass *enum_class; GEnumValue *enum_value; type = empathy_contact_list_store_sort_get_type (); enum_class = G_ENUM_CLASS (g_type_class_peek (type)); enum_value = g_enum_get_value_by_nick (enum_class, str); if (enum_value) { /* By changing the value of the GtkRadioAction, it emits a signal that calls main_window_view_sort_contacts_cb which updates the contacts list */ gtk_radio_action_set_current_value (window->sort_by_name, enum_value->value); } else { g_warning ("Wrong value for sort_criterium configuration : %s", str); } g_free (str); } }
void liferea_shell_set_view_mode (nodeViewType newMode) { GtkRadioAction *action; action = GTK_RADIO_ACTION (gtk_action_group_get_action (shell->priv->generalActions, "NormalView")); gtk_radio_action_set_current_value (action, newMode); }
void Actions::updateStatefulActions() { onToolbarVisibilityChanged(m_window->toolbarVisible()); onStatusBarVisibilityChanged(m_window->statusBarVisible()); onWindowFullScreenChanged(m_window->inFullScreen()); gtk_radio_action_set_current_value( m_radioActionGroups[RADIO_ACTION_GROUP_WINDOW_LAYOUT], m_window->layout()); }
static void shell_searchbar_custom_search_cb (EShellView *shell_view, EFilterRule *custom_rule, EShellSearchbar *searchbar) { GtkRadioAction *search_option; gint value = SEARCH_OPTION_ADVANCED; e_shell_searchbar_set_search_text (searchbar, NULL); search_option = e_shell_searchbar_get_search_option (searchbar); if (search_option != NULL) gtk_radio_action_set_current_value (search_option, value); }
static void shell_searchbar_clear_search_cb (EShellView *shell_view, EShellSearchbar *searchbar) { GtkRadioAction *search_option; gint current_value; e_shell_searchbar_set_search_text (searchbar, NULL); search_option = e_shell_searchbar_get_search_option (searchbar); if (search_option == NULL) return; /* Reset the search option if it's set to advanced search. */ current_value = gtk_radio_action_get_current_value (search_option); if (current_value == SEARCH_OPTION_ADVANCED) gtk_radio_action_set_current_value (search_option, 0); }
static void action_combo_box_changed (GtkComboBox *combo_box) { GtkRadioAction *action; GtkTreeModel *model; GtkTreeIter iter; gint value; /* This method is virtual, so no need to chain up. */ if (!gtk_combo_box_get_active_iter (combo_box, &iter)) return; model = gtk_combo_box_get_model (combo_box); gtk_tree_model_get (model, &iter, COLUMN_ACTION, &action, -1); g_object_get (action, "value", &value, NULL); gtk_radio_action_set_current_value (action, value); }
static void rc_plugin_tag_edit_menu_cb() { GtkTreeIter iter; gchar *uri = NULL; GtkAction *action; action = gtk_ui_manager_get_action(rc_gui_get_ui_manager(), "/RCMenuBar/ViewMenu/ViewPlaylist"); gtk_radio_action_set_current_value(GTK_RADIO_ACTION(action), table_id+3); if(rc_gui_list2_get_cursor(&iter)) { gtk_tree_model_get(rc_gui_list2_get_model(), &iter, PLIST2_URI, &uri, -1); if(uri!=NULL) { rc_plugin_tag_read_uri(uri); g_free(uri); } } }
void nemo_window_update_show_hide_menu_items (NemoWindow *window) { GtkActionGroup *action_group; GtkAction *action; guint current_value; action_group = nemo_window_get_main_action_group (window); action = gtk_action_group_get_action (action_group, NEMO_ACTION_SHOW_HIDE_EXTRA_PANE); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), nemo_window_split_view_showing (window)); nemo_window_update_split_view_actions_sensitivity (window); action = gtk_action_group_get_action (action_group, "Sidebar Places"); current_value = sidebar_id_to_value (window->details->sidebar_id); gtk_radio_action_set_current_value (GTK_RADIO_ACTION (action), current_value); }
static void date_changed_cb (AnnumShellWindow *self, GnomeCalendarViewType view, AnnumShellView *shell_view) { const char *view_id; ECalendar *date_navigator; GDate *today; GDate start; GDate end; if (view != GNOME_CAL_DAY_VIEW) return; /* Week_View also uses GNOME_CAL_DAY_VIEW, so make sure */ view_id = e_shell_view_get_view_id (E_SHELL_VIEW (shell_view)); if (!g_strcmp0 (view_id, "Week_View")) return; /* DAY_VIEW is treated specially, because we only want to have * the button toggled if we are showing today, not any other * day */ date_navigator = annum_shell_sidebar_get_date_navigator (ANNUM_SHELL_SIDEBAR (self->priv->sidebar)); today = g_date_new (); g_date_set_time_t (today, time (NULL)); e_calendar_item_get_selection (date_navigator->calitem, &start, &end); if (g_date_compare (today, &start) || g_date_compare (&start, &end)) { GtkAction *action = gtk_action_group_get_action (self->priv->action_group, "ShowDay"); gtk_radio_action_set_current_value (GTK_RADIO_ACTION (action), ANNUM_VIEW_DAY); } g_date_free (today); }
/* gtk_radio_action_set_current_value() replacement for GTK+ < 2.10 */ void radio_action_set_current_value(GtkRadioAction *action, gint current_value) { #if GTK_CHECK_VERSION(2, 10, 0) gtk_radio_action_set_current_value(action, current_value); #else GSList *group; gint value; group = gtk_radio_action_get_group(action); while (group) { action = GTK_RADIO_ACTION(group->data); g_object_get(G_OBJECT(action), "value", &value, NULL); if (value == current_value) { gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE); return; } group = g_slist_next(group); } #endif }
void cb_row_selected (GtkTreeSelection *selection, gpointer data) { ProcData * const procdata = static_cast<ProcData*>(data); procdata->selection = selection; procdata->selected_process = NULL; /* get the most recent selected process and determine if there are ** no selected processes */ gtk_tree_selection_selected_foreach (procdata->selection, get_last_selected, &procdata->selected_process); if (procdata->selected_process) { gint value; gint nice = procdata->selected_process->nice; if (nice < -7) value = VERY_HIGH_PRIORITY; else if (nice < -2) value = HIGH_PRIORITY; else if (nice < 3) value = NORMAL_PRIORITY; else if (nice < 7) value = LOW_PRIORITY; else value = VERY_LOW_PRIORITY; GtkRadioAction* normal = GTK_RADIO_ACTION(gtk_action_group_get_action(procdata->action_group, "Normal")); block_priority_changed_handlers(procdata, TRUE); gtk_radio_action_set_current_value(normal, value); block_priority_changed_handlers(procdata, FALSE); } update_sensitivity(procdata); }