void athena_navigation_state_sync_all (AthenaNavigationState *self) { GList *l; gint length, idx; const gchar *action_name; GtkAction *action; gboolean master_value; GtkActionGroup *group; length = g_strv_length (self->priv->action_names); for (idx = 0; idx < length; idx++) { action_name = self->priv->action_names[idx]; action = gtk_action_group_get_action (self->priv->master, action_name); master_value = gtk_action_get_sensitive (action); for (l = self->priv->groups; l != NULL; l = l->next) { group = l->data; action = gtk_action_group_get_action (group, action_name); gtk_action_set_sensitive (action, master_value); } } }
static void contextMenuItemActivatedCallback(GtkAction* action, WebPageProxy* page) { gboolean isToggle = GTK_IS_TOGGLE_ACTION(action); WebKit::WebContextMenuItemData item(isToggle ? WebCore::CheckableActionType : WebCore::ActionType, static_cast<WebCore::ContextMenuAction>(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(action), gContextMenuActionId))), String::fromUTF8(gtk_action_get_label(action)), gtk_action_get_sensitive(action), isToggle ? gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)) : false); page->contextMenuItemSelected(item); }
void checkActionState(GtkAction* action, unsigned state) { if (state & Visible) g_assert(gtk_action_get_visible(action)); else g_assert(!gtk_action_get_visible(action)); if (state & Enabled) g_assert(gtk_action_get_sensitive(action)); else g_assert(!gtk_action_get_sensitive(action)); if (GTK_IS_TOGGLE_ACTION(action)) { if (state & Checked) g_assert(gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))); else g_assert(!gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))); } }
void iconview_menubar_state (gboolean s) { if (s) { GtkAction *a = gtk_ui_manager_get_action(mdata->ui, "/menubar/View"); if (a != NULL && !gtk_action_get_sensitive(a)) { gtk_action_set_sensitive(a, TRUE); } } flip(mdata->ui, "/menubar/View/IconView", s); }
static gboolean sensitive_get_mapping (GValue *value, GVariant *variant, gpointer data) { GtkAction *action; gboolean active, before, after; action = GTK_ACTION (data); active = g_variant_get_boolean (variant); before = gtk_action_get_sensitive (action); ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, active); after = gtk_action_get_sensitive (action); /* Set (GtkAction::sensitive) to the value in GSettings _only if_ * the LOCKDOWN_FLAG had some real effect in the GtkAction */ g_value_set_boolean (value, (before != after) ? after : before); return TRUE; }
static void gimp_editor_button_extended_clicked (GtkWidget *button, GdkModifierType mask, gpointer data) { GList *extended = g_object_get_data (G_OBJECT (button), "extended-actions"); GList *list; for (list = extended; list; list = g_list_next (list)) { ExtendedAction *ext = list->data; if ((ext->mod_mask & mask) == ext->mod_mask && gtk_action_get_sensitive (ext->action)) { gtk_action_activate (ext->action); break; } } }
static gboolean create_popup_menu_item (GeditCollaborationWindowHelper *helper, GtkMenu *menu, const gchar *id, gboolean create_separator) { GtkAction *action; GtkWidget *item; GtkActionGroup *ac; action = get_action (helper, id); g_object_get (action, "action-group", &ac, NULL); if (!gtk_action_get_sensitive (action) || !gtk_action_group_get_sensitive (ac)) { g_object_unref (ac); return FALSE; } gtk_action_set_accel_group (action, gtk_ui_manager_get_accel_group (helper->priv->uimanager)); g_object_unref (ac); if (create_separator) { item = gtk_separator_menu_item_new (); gtk_widget_show (item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); } item = gtk_action_create_menu_item (action); gtk_widget_show (item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); return TRUE; }
static void plug_in_actions_history_changed (GimpPlugInManager *manager, GimpActionGroup *group) { GimpPlugInProcedure *proc; gint i; proc = gimp_plug_in_manager_history_nth (manager, 0); if (proc) { GtkAction *actual_action; const gchar *label; gchar *repeat; gchar *reshow; gboolean sensitive = FALSE; /* copy the sensitivity of the plug-in procedure's actual action * instead of calling plug_in_actions_update() because doing the * latter would set the sensitivity of this image's action on * all images' actions. See bug #517683. */ actual_action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), GIMP_OBJECT (proc)->name); if (actual_action) sensitive = gtk_action_get_sensitive (actual_action); label = gimp_plug_in_procedure_get_label (proc); repeat = g_strdup_printf (_("Re_peat \"%s\""), label); reshow = g_strdup_printf (_("R_e-Show \"%s\""), label); gimp_action_group_set_action_label (group, "plug-in-repeat", repeat); gimp_action_group_set_action_label (group, "plug-in-reshow", reshow); gimp_action_group_set_action_sensitive (group, "plug-in-repeat", sensitive); gimp_action_group_set_action_sensitive (group, "plug-in-reshow", sensitive); g_free (repeat); g_free (reshow); } else { gimp_action_group_set_action_label (group, "plug-in-repeat", _("Repeat Last")); gimp_action_group_set_action_label (group, "plug-in-reshow", _("Re-Show Last")); gimp_action_group_set_action_sensitive (group, "plug-in-repeat", FALSE); gimp_action_group_set_action_sensitive (group, "plug-in-reshow", FALSE); } for (i = 0; i < gimp_plug_in_manager_history_length (manager); i++) { GtkAction *action; GtkAction *actual_action; gchar *name = g_strdup_printf ("plug-in-recent-%02d", i + 1); gboolean sensitive = FALSE; action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name); g_free (name); proc = gimp_plug_in_manager_history_nth (manager, i); /* see comment above */ actual_action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), GIMP_OBJECT (proc)->name); if (actual_action) sensitive = gtk_action_get_sensitive (actual_action); g_object_set (action, "visible", TRUE, "sensitive", sensitive, "procedure", proc, "label", gimp_plug_in_procedure_get_label (proc), "stock-id", gimp_plug_in_procedure_get_stock_id (proc), "tooltip", gimp_plug_in_procedure_get_blurb (proc), NULL); } for (; i < gimp_plug_in_manager_history_size (manager); i++) { GtkAction *action; gchar *name = g_strdup_printf ("plug-in-recent-%02d", i + 1); action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name); g_free (name); g_object_set (action, "visible", FALSE, "procedure", NULL, NULL); } }
static void filters_actions_history_changed (Gimp *gimp, GimpActionGroup *group) { GimpProcedure *proc; GimpActionGroup *plug_in_group; gint i; plug_in_group = filters_actions_get_plug_in_group (group); proc = gimp_filter_history_nth (gimp, 0); if (proc) { GtkAction *actual_action = NULL; const gchar *label; gchar *repeat; gchar *reshow; gboolean sensitive = FALSE; label = gimp_procedure_get_label (proc); repeat = g_strdup_printf (_("Re_peat \"%s\""), label); reshow = g_strdup_printf (_("R_e-Show \"%s\""), label); gimp_action_group_set_action_label (group, "filters-repeat", repeat); gimp_action_group_set_action_label (group, "filters-reshow", reshow); g_free (repeat); g_free (reshow); if (g_str_has_prefix (gimp_object_get_name (proc), "filters-")) { actual_action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), gimp_object_get_name (proc)); } else if (plug_in_group) { /* copy the sensitivity of the plug-in procedure's actual * action instead of calling filters_actions_update() * because doing the latter would set the sensitivity of * this image's action on all images' actions. See bug * #517683. */ actual_action = gtk_action_group_get_action (GTK_ACTION_GROUP (plug_in_group), gimp_object_get_name (proc)); } if (actual_action) sensitive = gtk_action_get_sensitive (actual_action); gimp_action_group_set_action_sensitive (group, "filters-repeat", sensitive); gimp_action_group_set_action_sensitive (group, "filters-reshow", sensitive); } else { gimp_action_group_set_action_label (group, "filters-repeat", _("Repeat Last")); gimp_action_group_set_action_label (group, "filters-reshow", _("Re-Show Last")); gimp_action_group_set_action_sensitive (group, "filters-repeat", FALSE); gimp_action_group_set_action_sensitive (group, "filters-reshow", FALSE); } for (i = 0; i < gimp_filter_history_length (gimp); i++) { GtkAction *action; GtkAction *actual_action = NULL; const gchar *label; gchar *name; gboolean sensitive = FALSE; name = g_strdup_printf ("filter-recent-%02d", i + 1); action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name); g_free (name); proc = gimp_filter_history_nth (gimp, i); label = gimp_procedure_get_menu_label (proc); if (g_str_has_prefix (gimp_object_get_name (proc), "filters-")) { actual_action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), gimp_object_get_name (proc)); } else if (plug_in_group) { /* see comment above */ actual_action = gtk_action_group_get_action (GTK_ACTION_GROUP (plug_in_group), gimp_object_get_name (proc)); } if (actual_action) sensitive = gtk_action_get_sensitive (actual_action); g_object_set (action, "visible", TRUE, "sensitive", sensitive, "procedure", proc, "label", label, "icon-name", gimp_viewable_get_icon_name (GIMP_VIEWABLE (proc)), "tooltip", gimp_procedure_get_blurb (proc), NULL); } for (; i < gimp_filter_history_size (gimp); i++) { GtkAction *action; gchar *name = g_strdup_printf ("filter-recent-%02d", i + 1); action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), name); g_free (name); g_object_set (action, "visible", FALSE, "procedure", NULL, NULL); } }