void games_pause_action_set_is_paused (GamesPauseAction *action, gboolean is_paused) { g_return_if_fail (GAMES_IS_PAUSE_ACTION (action)); if ((action->priv->is_paused && is_paused) || (!action->priv->is_paused && !is_paused)) return; action->priv->is_paused = is_paused; if (is_paused) gtk_action_set_stock_id (GTK_ACTION (action), GAMES_STOCK_RESUME_GAME); else gtk_action_set_stock_id (GTK_ACTION (action), GAMES_STOCK_PAUSE_GAME); g_object_notify (G_OBJECT (action), "is-paused"); g_signal_emit (G_OBJECT (action), signals[STATE_CHANGED], 0); }
static void update_action (GamesFullscreenAction *action) { gboolean visible = TRUE; if (action->priv->is_fullscreen) { gtk_action_set_stock_id (GTK_ACTION (action), GTK_STOCK_LEAVE_FULLSCREEN); if (action->priv->visible_policy == GAMES_FULLSCREEN_ACTION_VISIBLE_ON_UNFULLSCREEN) visible = FALSE; } else { if (action->priv->visible_policy == GAMES_FULLSCREEN_ACTION_VISIBLE_ON_FULLSCREEN) visible = FALSE; gtk_action_set_stock_id (GTK_ACTION (action), GTK_STOCK_FULLSCREEN); } gtk_action_set_visible (GTK_ACTION (action), visible); }
/* * Initialise tool actions. * The caller owns the return value. */ static GtkActionGroup * create_or_ref_tool_actions (void) { GtkIconFactory *icon_factory; GtkActionGroup *actions; GtkAction *action; int i; if (tool_actions) return g_object_ref (tool_actions); actions = gtk_action_group_new ("tool-actions"); gtk_action_group_set_translation_domain (actions, NULL); gtk_action_group_set_translate_func (actions, _dia_translate, NULL, NULL); gtk_action_group_add_actions (actions, tool_entries, G_N_ELEMENTS (tool_entries), NULL); icon_factory = gtk_icon_factory_new (); for (i = 0; i < num_tools; i++) { action = gtk_action_group_get_action (actions, tool_data[i].action_name); if (action != NULL) { g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK (tool_menu_select), &tool_data[i].callback_data); gtk_action_set_tooltip (action, _(tool_data[i].tool_desc)); { GdkPixbuf *pb = tool_get_pixbuf (&tool_data[i]); GtkIconSet *is = gtk_icon_set_new_from_pixbuf (pb); /* not sure if the action name is unique enough */ gtk_icon_factory_add (icon_factory, tool_data[i].action_name, is); gtk_action_set_stock_id (action, tool_data[i].action_name); g_object_unref (pb); } } else { g_warning ("couldn't find tool menu item %s", tool_data[i].action_name); } } gtk_icon_factory_add_default (icon_factory); return actions; }
static void games_pause_action_init (GamesPauseAction *self) { self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GAMES_PAUSE_ACTION_TYPE, GamesPauseActionPrivate); gtk_action_set_stock_id (GTK_ACTION (self), GAMES_STOCK_PAUSE_GAME); }
static void gtk_action_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GtkAction *action; action = GTK_ACTION (object); switch (prop_id) { case PROP_NAME: action->private_data->name = g_intern_string (g_value_get_string (value)); break; case PROP_LABEL: gtk_action_set_label (action, g_value_get_string (value)); break; case PROP_SHORT_LABEL: gtk_action_set_short_label (action, g_value_get_string (value)); break; case PROP_TOOLTIP: gtk_action_set_tooltip (action, g_value_get_string (value)); break; case PROP_STOCK_ID: gtk_action_set_stock_id (action, g_value_get_string (value)); break; case PROP_GICON: gtk_action_set_gicon (action, g_value_get_object (value)); break; case PROP_ICON_NAME: gtk_action_set_icon_name (action, g_value_get_string (value)); break; case PROP_VISIBLE_HORIZONTAL: gtk_action_set_visible_horizontal (action, g_value_get_boolean (value)); break; case PROP_VISIBLE_VERTICAL: gtk_action_set_visible_vertical (action, g_value_get_boolean (value)); break; case PROP_VISIBLE_OVERFLOWN: action->private_data->visible_overflown = g_value_get_boolean (value); break; case PROP_IS_IMPORTANT: gtk_action_set_is_important (action, g_value_get_boolean (value)); break; case PROP_HIDE_IF_EMPTY: action->private_data->hide_if_empty = g_value_get_boolean (value); break; case PROP_SENSITIVE: gtk_action_set_sensitive (action, g_value_get_boolean (value)); break; case PROP_VISIBLE: gtk_action_set_visible (action, g_value_get_boolean (value)); break; case PROP_ACTION_GROUP: gtk_action_set_action_group (action, g_value_get_object (value)); break; case PROP_ALWAYS_SHOW_IMAGE: gtk_action_set_always_show_image (action, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }