示例#1
0
static void
action_combo_box_action_group_notify_cb (GtkActionGroup *action_group,
                                         GParamSpec *pspec,
                                         EActionComboBox *combo_box)
{
	g_object_set (
		combo_box, "sensitive",
		gtk_action_group_get_sensitive (action_group), "visible",
		gtk_action_group_get_visible (action_group), NULL);
}
示例#2
0
/**
 * gtk_action_is_sensitive:
 * @action: the action object
 * 
 * Returns whether the action is effectively sensitive.
 *
 * Return value: %TRUE if the action and its associated action group 
 * are both sensitive.
 *
 * Since: 2.4
 **/
gboolean
gtk_action_is_sensitive (GtkAction *action)
{
  GtkActionPrivate *priv;
  g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);

  priv = action->private_data;
  return priv->sensitive &&
    (priv->action_group == NULL ||
     gtk_action_group_get_sensitive (priv->action_group));
}
示例#3
0
int
clip_GTK_ACTIONGROUPGETSENSITIVE(ClipMachine * ClipMachineMemory)
{
   C_object *cagroup = _fetch_co_arg(ClipMachineMemory);

   CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
   CHECKCOBJ(cagroup, GTK_IS_ACTION_GROUP(cagroup->object));

   _clip_retl(ClipMachineMemory, gtk_action_group_get_sensitive(GTK_ACTION_GROUP(cagroup->object)));

   return 0;
 err:
   return 1;
}
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;
}
示例#5
0
gboolean
update(ParasiteActionList *actionlist)
{
    GSList *i;

    gtk_tree_store_clear(actionlist->priv->model);

    for (i = actionlist->priv->uimanagers; i != NULL; i = g_slist_next(i))
    {
        GtkUIManager *uimanager;
        GList *action_groups;
        GList *j;
        gchar *name;

        uimanager = GTK_UI_MANAGER(i->data);

        GtkTreeIter i_iter;
        gtk_tree_store_append(actionlist->priv->model, &i_iter, NULL);

        name = g_strdup_printf("UIManager at %p", uimanager);
        gtk_tree_store_set(actionlist->priv->model, &i_iter,
                           ACTION_LABEL, name,
                           SORT_NAME, name,
                           ADDRESS, uimanager,
                           -1);
        g_free(name);

        action_groups = gtk_ui_manager_get_action_groups(uimanager);
        for (j = action_groups; j != NULL; j = g_list_next(j))
        {
            GtkActionGroup *action_group;
            GtkTreeIter j_iter;
            GList *actions;
            GList *k;

            action_group = GTK_ACTION_GROUP(j->data);

            gtk_tree_store_append(actionlist->priv->model, &j_iter, &i_iter);

            name = (gchar*) gtk_action_group_get_name(action_group);
            gtk_tree_store_set(actionlist->priv->model, &j_iter,
                               ACTION_LABEL, name,
                               SORT_NAME, name,
                               ROW_COLOR, gtk_action_group_get_sensitive(action_group)
                                              ? "black" : "grey",
                               ADDRESS, action_group,
                               -1);

            actions = gtk_action_group_list_actions(action_group);
            for (k = actions; k != NULL; k = g_list_next(k))
            {
                GtkTreeIter k_iter;
                GtkAction *action;
                gchar *action_label;
                gchar *action_name;
                gchar *action_stock;
                gchar *sort_name;

                action = GTK_ACTION(k->data);
                g_object_get(action,
                             "label",    &action_label,
                             "name",     &action_name,
                             "stock-id", &action_stock,
                             NULL);

                sort_name = g_strdup_printf("%s%s", name, action_name);

                gtk_tree_store_append(actionlist->priv->model, &k_iter, &j_iter);
                // FIXME: format the mnemonic
                gtk_tree_store_set(actionlist->priv->model, &k_iter,
                                   ACTION_LABEL, action_label,
                                   ACTION_NAME, action_name,
                                   ACTION_ICON, action_stock,
                                   ROW_COLOR, gtk_action_is_sensitive(action)
                                                  ? "black" : "grey",
                                   SORT_NAME, sort_name,
                                   ADDRESS, action,
                                   -1);

                g_free(sort_name);
                g_free(action_stock);
                g_free(action_name);
                g_free(action_label);
            }
        }
    }

    // FIXME: I'm undecided about this, but I also don't really want to try to
    // preserve the exsting expansion state of the whole tree.
    gtk_tree_view_expand_all(GTK_TREE_VIEW(actionlist));

    actionlist->priv->update_timeout = 0;

    return FALSE;
}