static void action_show_hidden_files_callback (GtkAction *action, gpointer callback_data) { NautilusWindow *window; NautilusWindowShowHiddenFilesMode mode; window = NAUTILUS_WINDOW (callback_data); if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { mode = NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE; } else { mode = NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DISABLE; } nautilus_window_set_hidden_files_mode (window, mode); }
static void gtk_switch_sync_action_properties (GtkActivatable *activatable, GtkAction *action) { if (!action) return; if (gtk_action_is_visible (action)) gtk_widget_show (GTK_WIDGET (activatable)); else gtk_widget_hide (GTK_WIDGET (activatable)); gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action)); gtk_action_block_activate (action); gtk_switch_set_active (GTK_SWITCH (activatable), gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); gtk_action_unblock_activate (action); }
static void gtk_toggle_tool_button_update (GtkActivatable *activatable, GtkAction *action, const gchar *property_name) { GtkToggleToolButton *button; parent_activatable_iface->update (activatable, action, property_name); button = GTK_TOGGLE_TOOL_BUTTON (activatable); if (strcmp (property_name, "active") == 0) { gtk_action_block_activate (action); gtk_toggle_tool_button_set_active (button, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); gtk_action_unblock_activate (action); } }
static void task_view_nonstandard_days_cb (GtkAction *action, gpointer data) { PlannerTaskViewPriv *priv; gboolean state; priv = PLANNER_TASK_VIEW (data)->priv; state = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); planner_task_tree_set_nonstandard_days ( PLANNER_TASK_TREE (priv->tree), state); planner_conf_set_bool (NOSTDDAYS_PATH_KEY, state, NULL); }
void view_flip_vertically_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; gboolean active; return_if_no_display (display, data); shell = gimp_display_get_shell (display); active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); if (active != shell->flip_vertically) { gimp_display_shell_flip (shell, shell->flip_horizontally, active); } }
void _gedit_cmd_view_leave_fullscreen_mode (GtkAction *action, GeditWindow *window) { GtkAction *view_action; view_action = gtk_action_group_get_action (window->priv->always_sensitive_action_group, "ViewFullscreen"); g_signal_handlers_block_by_func (view_action, G_CALLBACK (_gedit_cmd_view_toggle_fullscreen_mode), window); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (view_action), FALSE); _gedit_window_unfullscreen (window); g_signal_handlers_unblock_by_func (view_action, G_CALLBACK (_gedit_cmd_view_toggle_fullscreen_mode), window); }
int main(int argc, char *argv[]) { gtk_init(&argc, &argv); GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(window), 200, 200); g_signal_connect(window, "destroy", G_CALLBACK(destroy), NULL); GtkWidget *menubar = gtk_menu_bar_new(); gtk_container_add(GTK_CONTAINER(window), menubar); GtkActionGroup *actiongroup = gtk_action_group_new("ActionGroup"); GtkAction *action = gtk_action_new("actionFile", "_File", NULL, NULL); gtk_action_group_add_action(GTK_ACTION_GROUP(actiongroup), action); GtkWidget *menuitemFile = gtk_action_create_menu_item(GTK_ACTION(action)); gtk_menu_bar_append(GTK_MENU_BAR(menubar), menuitemFile); GtkWidget *menu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitemFile), menu); GtkToggleAction *toggleaction; toggleaction = gtk_toggle_action_new("actionNew", "_New", "Create a new document", GTK_STOCK_NEW); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(toggleaction), TRUE); gtk_action_group_add_action(GTK_ACTION_GROUP(actiongroup), GTK_ACTION(toggleaction)); GtkWidget *menuitemNew = gtk_action_create_menu_item(GTK_ACTION(toggleaction)); gtk_menu_append(GTK_MENU(menu), menuitemNew); toggleaction = gtk_toggle_action_new("actionOpen", "_Open", "Open a file", GTK_STOCK_OPEN); gtk_action_group_add_action(GTK_ACTION_GROUP(actiongroup), GTK_ACTION(toggleaction)); GtkWidget *menuitemOpen = gtk_action_create_menu_item(GTK_ACTION(toggleaction)); gtk_menu_append(GTK_MENU(menu), menuitemOpen); toggleaction = gtk_toggle_action_new("actionSave", "_Save", "Save a file", GTK_STOCK_SAVE); gtk_action_group_add_action(GTK_ACTION_GROUP(actiongroup), GTK_ACTION(toggleaction)); GtkWidget *menuitemSave = gtk_action_create_menu_item(GTK_ACTION(toggleaction)); gtk_menu_append(GTK_MENU(menu), menuitemSave); gtk_widget_show_all(window); gtk_main(); return 0; }
void tools_toggle_visibility_cmd_callback (GtkAction *action, gpointer data) { GimpContext *context; GimpToolInfo *tool_info; return_if_no_context (context, data); tool_info = gimp_context_get_tool (context); if (tool_info) { gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); if (active != tool_info->visible) g_object_set (tool_info, "visible", active, NULL); } }
/** Set the visibility of the toolbar */ static void gui_set_toolbar_visible(void) { GSList *list; gboolean visible; list = gtk_ui_manager_get_toplevels(ui_manager, GTK_UI_MANAGER_TOOLBAR); g_assert(g_slist_length(list) == 1); visible = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION (gtk_ui_manager_get_action (ui_manager, "ui/MainMenu/SettingsMenu/ShowHideToolbar"))); if (visible) gtk_widget_show(GTK_WIDGET(list->data)); else gtk_widget_hide(GTK_WIDGET(list->data)); config_set_int("settings/show_toolbar", visible); g_slist_free(list); }
static void action_show_hidden_files_callback (GtkAction *action, gpointer callback_data) { CajaWindow *window; CajaWindowShowHiddenFilesMode mode; window = CAJA_WINDOW (callback_data); if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { mode = CAJA_WINDOW_SHOW_HIDDEN_FILES_ENABLE; } else { mode = CAJA_WINDOW_SHOW_HIDDEN_FILES_DISABLE; } caja_window_info_set_hidden_files_mode (window, mode); }
static void show_view_highlight_critical_cb (GtkAction *action, gpointer data) { PlannerShowView *view; PlannerShowViewPriv *priv; gboolean state; view = PLANNER_SHOW_VIEW (data); priv = view->priv; state = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); planner_gantt_chart_set_highlight_critical_tasks ( PLANNER_GANTT_CHART (priv->gantt), state); //planner_task_tree_set_highlight_critical ( //PLANNER_TASK_TREE (priv->tree), state); }
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 action_show_hide_search_callback (GtkAction *action, gpointer user_data) { NemoWindowPane *pane = user_data; NemoWindow *window = pane->window; if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { nemo_window_pane_ensure_search_bar (pane); } else { NemoWindowSlot *slot; GFile *location = NULL; slot = pane->active_slot; nemo_window_pane_hide_search_bar (pane); /* Use the location bar as the return location */ if (slot->query_editor != NULL) { NemoQuery *query; char *uri; query = nemo_query_editor_get_query (slot->query_editor); if (query != NULL) { uri = nemo_query_get_location (query); if (uri != NULL) { location = g_file_new_for_uri (uri); g_free (uri); } g_object_unref (query); } /* Last try: use the home directory as the return location */ if (location == NULL) { location = g_file_new_for_path (g_get_home_dir ()); } nemo_window_go_to (window, location); g_object_unref (location); } } }
void view_display_bpc_cmd_callback (GtkAction *action, gpointer data) { GimpDisplayShell *shell; GimpColorConfig *color_config; gboolean active; return_if_no_shell (shell, data); color_config = gimp_display_shell_get_color_config (shell); active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); if (active != gimp_color_config_get_display_bpc (color_config)) { g_object_set (color_config, "display-use-black-point-compensation", active, NULL); shell->color_config_set = TRUE; } }
void search_box_toggle_highlight (SearchBox * search_box, gboolean status) { if (!search_box->priv->current_editor) return; search_box->priv->highlight_all = status; gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(search_box->priv->highlight_action), status); if (!status) { ianjuta_indicable_clear(IANJUTA_INDICABLE(search_box->priv->current_editor), NULL); g_clear_object (&search_box->priv->start_highlight); g_clear_object (&search_box->priv->end_highlight); } else { search_box_highlight_all (search_box); } }
void view_softproof_gamut_check_cmd_callback (GtkAction *action, gpointer data) { GimpDisplayShell *shell; GimpColorConfig *color_config; gboolean active; return_if_no_shell (shell, data); color_config = gimp_display_shell_get_color_config (shell); active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); if (active != gimp_color_config_get_simulation_gamut_check (color_config)) { g_object_set (color_config, "simulation-gamut-check", active, NULL); shell->color_config_set = TRUE; } }
static void cmd_toggle_fullscreen (GtkAction *action, EmerillonWindow *self) { gboolean fullscreen; GtkWidget *window; fullscreen = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); window = emerillon_window_dup_default (); if (fullscreen) { gtk_window_fullscreen (GTK_WINDOW (window)); } else { gtk_window_unfullscreen (GTK_WINDOW (window)); } g_object_unref (window); }
void view_fullscreen_cmd_callback (GtkAction *action, gpointer data) { GimpDisplay *display; GimpDisplayShell *shell; GimpImageWindow *window; return_if_no_display (display, data); shell = gimp_display_get_shell (display); window = gimp_display_shell_get_window (shell); if (window) { gboolean active; active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); gimp_image_window_set_fullscreen (window, active); } }
static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GtkToggleAction *action = GTK_TOGGLE_ACTION (object); switch (prop_id) { case PROP_DRAW_AS_RADIO: gtk_toggle_action_set_draw_as_radio (action, g_value_get_boolean (value)); break; case PROP_ACTIVE: gtk_toggle_action_set_active (action, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
void face_handle_send (EPlugin *ep, EMEventTargetComposer *target) { GtkhtmlEditor *editor; GtkAction *action; editor = GTKHTML_EDITOR (target->composer); action = gtkhtml_editor_get_action (editor, "face-plugin"); g_return_if_fail (action != NULL); if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { gchar *face = get_face_base64 (); if (face) e_msg_composer_set_header (target->composer, "Face", face); g_free (face); } }
static void show_view_nonstandard_days_cb (GtkAction *action, gpointer data) { PlannerShowView *view; PlannerShowViewPriv *priv; gboolean state; view = PLANNER_SHOW_VIEW (data); priv = view->priv; state = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); planner_gantt_chart_set_nonstandard_days ( PLANNER_GANTT_CHART (priv->gantt), state); planner_task_tree_set_nonstandard_days ( PLANNER_TASK_TREE (priv->tree), state); //show_view_update_row_height (view); }
static void cmd_show_hide_bar (GtkAction *action, EmerillonWindow *self) { gboolean visible; const gchar *action_name; GtkWidget *target_widget; const gchar *target_conf_key; visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); action_name = gtk_action_get_name (action); if (g_ascii_strcasecmp (action_name, "ViewToolbar") == 0) { target_widget = self->priv->toolbar; target_conf_key = EMERILLON_CONF_UI_TOOLBAR; } else if (g_ascii_strcasecmp (action_name, "ViewStatusbar") == 0) { target_widget = self->priv->statusbar; target_conf_key = EMERILLON_CONF_UI_STATUSBAR; } else if (g_ascii_strcasecmp (action_name, "ViewSidebar") == 0) { target_widget = self->priv->sidebar; target_conf_key = EMERILLON_CONF_UI_SIDEBAR; } else { g_warning ("Unknown action '%s'\n", action_name); return; } if (visible) gtk_widget_show (target_widget); else gtk_widget_hide (target_widget); g_settings_set_boolean (self->priv->settings_ui, target_conf_key, visible); }
static void on_session_load (AnjutaShell *shell, AnjutaSessionPhase phase, AnjutaSession *session, AnjutaApp *app) { /* We load layout at last so that all plugins would have loaded by now */ if (phase == ANJUTA_SESSION_PHASE_LAST) { gchar *geometry; gchar *layout_file; /* Restore geometry */ geometry = anjuta_session_get_string (session, "Anjuta", "Geometry"); anjuta_app_set_geometry (app, geometry); /* Restore window state */ if (anjuta_session_get_int (session, "Anjuta", "Fullscreen")) { /* bug #304495 */ AnjutaUI* ui = anjuta_shell_get_ui(shell, NULL); GtkAction* action = anjuta_ui_get_action (ui, "ActionGroupToggleView", "ActionViewFullscreen"); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE); gtk_window_fullscreen (GTK_WINDOW (shell)); } else if (anjuta_session_get_int (session, "Anjuta", "Maximized")) { gtk_window_maximize (GTK_WINDOW (shell)); } /* Restore layout */ layout_file = g_build_filename (anjuta_session_get_session_directory (session), "dock-layout.xml", NULL); anjuta_app_layout_load (app, layout_file, NULL); g_free (layout_file); } }
/* 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 on_screen_show_images(GtkAction * action, gpointer user_data) { AppUIData *app_ui_data = (AppUIData *) user_data; gboolean active = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); g_return_if_fail(app_ui_data != NULL); if (active != PDF_FLAGS_IS_SET(app_ui_data->flags, PDF_FLAGS_SHOW_IMAGES)) { gboolean images; PDF_FLAGS_TOGGLE(app_ui_data->flags, PDF_FLAGS_SHOW_IMAGES); images = PDF_FLAGS_IS_SET(app_ui_data->flags, PDF_FLAGS_SHOW_IMAGES); } if (pdf_viewer_get_num_pages() > 0) pdf_viewer_toggle_images(); }
static void set_auto_spell_from_metadata (GeditWindow *window, GeditDocument *doc, GtkActionGroup *action_group) { gboolean active = FALSE; gchar *active_str; GeditDocument *active_doc; active_str = gedit_document_get_metadata (doc, GEDIT_METADATA_ATTRIBUTE_SPELL_ENABLED); if (active_str) { active = *active_str == '1'; g_free (active_str); } set_auto_spell (window, doc, active); /* In case that the doc is the active one we mark the spell action */ active_doc = gedit_window_get_active_document (window); if (active_doc == doc && action_group != NULL) { GtkAction *action; action = gtk_action_group_get_action (action_group, "AutoSpell"); g_signal_handlers_block_by_func (action, auto_spell_cb, window); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active); g_signal_handlers_unblock_by_func (action, auto_spell_cb, window); } }
static void show_hidden_files_preference_callback (gpointer callback_data) { NautilusWindow *window; GtkAction *action; window = NAUTILUS_WINDOW (callback_data); if (window->details->show_hidden_files_mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) { action = gtk_action_group_get_action (window->details->main_action_group, NAUTILUS_ACTION_SHOW_HIDDEN_FILES); g_assert (GTK_IS_ACTION (action)); /* update button */ g_signal_handlers_block_by_func (action, action_show_hidden_files_callback, window); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES)); g_signal_handlers_unblock_by_func (action, action_show_hidden_files_callback, window); /* inform views */ nautilus_window_info_set_hidden_files_mode (window, NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT); } }
static void show_hidden_files_preference_callback (gpointer callback_data) { NemoWindow *window; GtkAction *action; window = NEMO_WINDOW (callback_data); if (window->details->show_hidden_files_mode == NEMO_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) { action = gtk_action_group_get_action (nemo_window_get_main_action_group (window), NEMO_ACTION_SHOW_HIDDEN_FILES); /* update button */ g_signal_handlers_block_by_func (action, action_show_hidden_files_callback, window); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_SHOW_HIDDEN_FILES)); g_signal_handlers_unblock_by_func (action, action_show_hidden_files_callback, window); /* inform views */ nemo_window_set_hidden_files_mode (window, NEMO_WINDOW_SHOW_HIDDEN_FILES_DEFAULT); } }
static void gtk_switch_update (GtkActivatable *activatable, GtkAction *action, const gchar *property_name) { if (strcmp (property_name, "visible") == 0) { if (gtk_action_is_visible (action)) gtk_widget_show (GTK_WIDGET (activatable)); else gtk_widget_hide (GTK_WIDGET (activatable)); } else if (strcmp (property_name, "sensitive") == 0) { gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action)); } else if (strcmp (property_name, "active") == 0) { gtk_action_block_activate (action); gtk_switch_set_active (GTK_SWITCH (activatable), gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); gtk_action_unblock_activate (action); } }
void _gedit_cmd_view_show_side_pane (GtkAction *action, GeditWindow *window) { gboolean visible; GeditPanel *panel; gedit_debug (DEBUG_COMMANDS); visible = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); panel = gedit_window_get_side_panel (window); if (visible) { gtk_widget_show (GTK_WIDGET (panel)); gtk_widget_grab_focus (GTK_WIDGET (panel)); } else { gtk_widget_hide (GTK_WIDGET (panel)); } }