本文整理汇总了C++中GTK_ACTION_GROUP函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_ACTION_GROUP函数的具体用法?C++ GTK_ACTION_GROUP怎么用?C++ GTK_ACTION_GROUP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_ACTION_GROUP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plug_in_actions_unregister_procedure
static void
plug_in_actions_unregister_procedure (GimpPDB *pdb,
GimpProcedure *procedure,
GimpActionGroup *group)
{
if (GIMP_IS_PLUG_IN_PROCEDURE (procedure))
{
GimpPlugInProcedure *plug_in_proc = GIMP_PLUG_IN_PROCEDURE (procedure);
g_signal_handlers_disconnect_by_func (plug_in_proc,
plug_in_actions_menu_path_added,
group);
if ((plug_in_proc->menu_label || plug_in_proc->menu_paths) &&
! plug_in_proc->file_proc)
{
GtkAction *action;
#if 0
g_print ("%s: %s\n", G_STRFUNC,
gimp_object_get_name (GIMP_OBJECT (procedure)));
#endif
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
GIMP_OBJECT (procedure)->name);
if (action)
gtk_action_group_remove_action (GTK_ACTION_GROUP (group), action);
}
}
}
示例2: tool_options_actions_update_presets
static void
tool_options_actions_update_presets (GimpActionGroup *group,
const gchar *action_prefix,
GCallback callback,
const gchar *help_id,
GimpContainer *presets)
{
GList *list;
gint n_children = 0;
gint i;
for (i = 0; ; i++)
{
gchar *action_name;
GtkAction *action;
action_name = g_strdup_printf ("%s-%03d", action_prefix, i);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
action_name);
g_free (action_name);
if (! action)
break;
gtk_action_group_remove_action (GTK_ACTION_GROUP (group), action);
}
if (presets)
n_children = gimp_container_get_n_children (presets);
if (n_children > 0)
{
GimpEnumActionEntry entry;
entry.name = NULL;
entry.label = NULL;
entry.accelerator = "";
entry.tooltip = NULL;
entry.value = 0;
entry.value_variable = FALSE;
entry.help_id = help_id;
for (list = GIMP_LIST (presets)->list, i = 0;
list;
list = g_list_next (list), i++)
{
GimpObject *options = list->data;
entry.name = g_strdup_printf ("%s-%03d", action_prefix, i);
entry.label = gimp_object_get_name (options);
entry.stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (options));
entry.value = i;
gimp_action_group_add_enum_actions (group, NULL, &entry, 1, callback);
g_free ((gchar *) entry.name);
}
}
}
示例3: edit_actions_setup
void
edit_actions_setup (GimpActionGroup *group)
{
GimpContext *context = gimp_get_user_context (group->gimp);
GimpRGB color;
GimpPattern *pattern;
GtkAction *action;
gimp_action_group_add_actions (group, "edit-action",
edit_actions,
G_N_ELEMENTS (edit_actions));
gimp_action_group_add_enum_actions (group, "edit-action",
edit_fill_actions,
G_N_ELEMENTS (edit_fill_actions),
G_CALLBACK (edit_fill_cmd_callback));
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
"edit-paste-as-new-short");
gtk_action_set_accel_path (action, "<Actions>/edit/edit-paste-as-new");
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
"edit-fill-pattern");
g_object_set (action, "context", context, NULL);
g_signal_connect_object (context, "foreground-changed",
G_CALLBACK (edit_actions_foreground_changed),
group, 0);
g_signal_connect_object (context, "background-changed",
G_CALLBACK (edit_actions_background_changed),
group, 0);
g_signal_connect_object (context, "pattern-changed",
G_CALLBACK (edit_actions_pattern_changed),
group, 0);
gimp_context_get_foreground (context, &color);
edit_actions_foreground_changed (context, &color, group);
gimp_context_get_background (context, &color);
edit_actions_background_changed (context, &color, group);
pattern = gimp_context_get_pattern (context);
edit_actions_pattern_changed (context, pattern, group);
#define SET_ALWAYS_SHOW_IMAGE(action,show) \
gimp_action_group_set_action_always_show_image (group, action, show)
SET_ALWAYS_SHOW_IMAGE ("edit-fill-fg", TRUE);
SET_ALWAYS_SHOW_IMAGE ("edit-fill-bg", TRUE);
SET_ALWAYS_SHOW_IMAGE ("edit-fill-pattern", TRUE);
#undef SET_ALWAYS_SHOW_IMAGE
}
示例4: windows_actions_dock_window_removed
static void
windows_actions_dock_window_removed (GimpDialogFactory *factory,
GimpDockWindow *dock_window,
GimpActionGroup *group)
{
GtkAction *action;
gchar *action_name = windows_actions_dock_window_to_action_name (dock_window);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
if (action)
gtk_action_group_remove_action (GTK_ACTION_GROUP (group), action);
g_free (action_name);
}
示例5: gimp_action_group_set_action_active
void
gimp_action_group_set_action_active (GimpActionGroup *group,
const gchar *action_name,
gboolean active)
{
GtkAction *action;
g_return_if_fail (GIMP_IS_ACTION_GROUP (group));
g_return_if_fail (action_name != NULL);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
if (! action)
{
g_warning ("%s: Unable to set \"active\" of action "
"which doesn't exist: %s",
G_STRFUNC, action_name);
return;
}
if (! GTK_IS_TOGGLE_ACTION (action))
{
g_warning ("%s: Unable to set \"active\" of action "
"which is not a GtkToggleAction: %s",
G_STRFUNC, action_name);
return;
}
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
active ? TRUE : FALSE);
}
示例6: gimp_action_group_dispose
static void
gimp_action_group_dispose (GObject *object)
{
const gchar *name = gtk_action_group_get_name (GTK_ACTION_GROUP (object));
if (name)
{
GimpActionGroupClass *group_class;
GList *list;
group_class = GIMP_ACTION_GROUP_GET_CLASS (object);
list = g_hash_table_lookup (group_class->groups, name);
if (list)
{
list = g_list_remove (list, object);
if (list)
g_hash_table_replace (group_class->groups,
g_strdup (name), list);
else
g_hash_table_remove (group_class->groups, name);
}
}
G_OBJECT_CLASS (parent_class)->dispose (object);
}
示例7: gimp_action_group_constructed
static void
gimp_action_group_constructed (GObject *object)
{
GimpActionGroup *group = GIMP_ACTION_GROUP (object);
const gchar *name;
G_OBJECT_CLASS (parent_class)->constructed (object);
g_assert (GIMP_IS_GIMP (group->gimp));
name = gtk_action_group_get_name (GTK_ACTION_GROUP (object));
if (name)
{
GimpActionGroupClass *group_class;
GList *list;
group_class = GIMP_ACTION_GROUP_GET_CLASS (object);
list = g_hash_table_lookup (group_class->groups, name);
list = g_list_append (list, object);
g_hash_table_replace (group_class->groups,
g_strdup (name), list);
}
}
示例8: menus_get_action
GtkAction *
menus_get_action (const gchar *name)
{
GtkAction *action;
action = gtk_action_group_get_action (toolbox_actions, name);
if (!action)
action = gtk_action_group_get_action (display_actions, name);
if (!action)
action = gtk_action_group_get_action (tool_actions, name);
if (!action) {
GList *groups, *list;
/* search everything there is, could probably replace the above */
if (display_ui_manager) /* classic mode */
groups = gtk_ui_manager_get_action_groups (display_ui_manager);
else
groups = gtk_ui_manager_get_action_groups (_ui_manager);
for (list = groups; list != NULL; list = list->next) {
action = gtk_action_group_get_action (GTK_ACTION_GROUP (list->data), name);
if (action)
break;
}
}
return action;
}
示例9: clip_GTK_ACTIONGROUPTRANSLATESTRING
int
clip_GTK_ACTIONGROUPTRANSLATESTRING(ClipMachine * ClipMachineMemory)
{
C_object *cagroup = _fetch_co_arg(ClipMachineMemory);
gchar *string = _clip_parc(ClipMachineMemory, 2);
gchar *resstr;
CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
CHECKCOBJ(cagroup, GTK_IS_ACTION_GROUP(cagroup->object));
CHECKARG(2, CHARACTER_type_of_ClipVarType);
LOCALE_TO_UTF(string);
resstr = (gchar *) gtk_action_group_translate_string(GTK_ACTION_GROUP(cagroup->object), string);
LOCALE_FROM_UTF(resstr);
_clip_retc(ClipMachineMemory, resstr);
FREE_TEXT(string);
FREE_TEXT(resstr);
return 0;
err:
return 1;
}
示例10: clip_GTK_ACTIONGROUPSETTRANSLATEFUNC
int
clip_GTK_ACTIONGROUPSETTRANSLATEFUNC(ClipMachine * ClipMachineMemory)
{
C_object *cagroup = _fetch_co_arg(ClipMachineMemory);
ClipVar *cfunc = _clip_spar(ClipMachineMemory, 2);
ClipVar *cfunc2 = _clip_spar(ClipMachineMemory, 3);
C_var *c = NEW(C_var);
CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
CHECKCOBJ(cagroup, GTK_IS_ACTION_GROUP(cagroup->object));
CHECKARG2(2, PCODE_type_of_ClipVarType, CCODE_type_of_ClipVarType);
CHECKARG2(3, PCODE_type_of_ClipVarType, CCODE_type_of_ClipVarType);
c->ClipMachineMemory = ClipMachineMemory;
c->co = cagroup;
_clip_mclone(ClipMachineMemory, &c->cfunc, cfunc);
_clip_mclone(ClipMachineMemory, &c->cfunc2, cfunc2);
gtk_action_group_set_translate_func(GTK_ACTION_GROUP(cagroup->object),
(GtkTranslateFunc) translate_func, c, (GtkDestroyNotify) destroy_notify);
return 0;
err:
return 1;
}
示例11: clip_GTK_ACTIONGROUPGETACTION
int
clip_GTK_ACTIONGROUPGETACTION(ClipMachine * ClipMachineMemory)
{
C_object *cagroup = _fetch_co_arg(ClipMachineMemory);
gchar *name = _clip_parc(ClipMachineMemory, 2);
GtkAction *action;
C_object *caction;
CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType);
CHECKCOBJ(cagroup, GTK_IS_ACTION_GROUP(cagroup->object));
CHECKARG(2, CHARACTER_type_of_ClipVarType);
LOCALE_TO_UTF(name);
action = gtk_action_group_get_action(GTK_ACTION_GROUP(cagroup->object), name);
if (action)
{
caction = _list_get_cobject(ClipMachineMemory, action);
if (!caction)
caction = _register_object(ClipMachineMemory, action, GTK_TYPE_ACTION, NULL, NULL);
if (caction)
_clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &caction->obj);
}
FREE_TEXT(name);
return 0;
err:
return 1;
}
示例12: gimp_action_group_set_action_viewable
void
gimp_action_group_set_action_viewable (GimpActionGroup *group,
const gchar *action_name,
GimpViewable *viewable)
{
GtkAction *action;
g_return_if_fail (GIMP_IS_ACTION_GROUP (group));
g_return_if_fail (action_name != NULL);
g_return_if_fail (viewable == NULL || GIMP_IS_VIEWABLE (viewable));
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
if (! action)
{
g_warning ("%s: Unable to set viewable of action "
"which doesn't exist: %s",
G_STRFUNC, action_name);
return;
}
if (! GIMP_IS_ACTION (action))
{
g_warning ("%s: Unable to set \"viewable\" of action "
"which is not a GimpAction: %s",
G_STRFUNC, action_name);
return;
}
g_object_set (action, "viewable", viewable, NULL);
}
示例13: gimp_action_group_check_unique_action
static gboolean
gimp_action_group_check_unique_action (GimpActionGroup *group,
const gchar *action_name)
{
if (G_UNLIKELY (gtk_action_group_get_action (GTK_ACTION_GROUP (group),
action_name)))
{
g_warning ("Refusing to add non-unique action '%s' to action group '%s'",
action_name,
gtk_action_group_get_name (GTK_ACTION_GROUP (group)));
return FALSE;
}
return TRUE;
}
示例14: windows_actions_display_remove
static void
windows_actions_display_remove (GimpContainer *container,
GimpDisplay *display,
GimpActionGroup *group)
{
GtkAction *action;
gchar *action_name = gimp_display_get_action_name (display);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), action_name);
if (action)
gtk_action_group_remove_action (GTK_ACTION_GROUP (group), action);
g_free (action_name);
windows_actions_update_display_accels (group);
}
示例15: window_actions_display_closed
static void
window_actions_display_closed (GdkDisplay *display,
gboolean is_error,
GimpActionGroup *group)
{
const gchar *group_name;
gint n_screens;
gint i;
group_name = gtk_action_group_get_name (GTK_ACTION_GROUP (group));
n_screens = gdk_display_get_n_screens (display);
for (i = 0; i < n_screens; i++)
{
GdkScreen *screen = gdk_display_get_screen (display, i);
GtkAction *action;
gchar *screen_name;
gchar *action_name;
screen_name = gdk_screen_make_display_name (screen);
action_name = g_strdup_printf ("%s-move-to-screen-%s",
group_name, screen_name);
g_free (screen_name);
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
action_name);
if (action)
{
GSList *radio_group;
radio_group = gtk_radio_action_get_group (GTK_RADIO_ACTION (action));
if (radio_group->data == (gpointer) action)
radio_group = radio_group->next;
gtk_action_group_remove_action (GTK_ACTION_GROUP (group), action);
g_object_set_data (G_OBJECT (group), "change-to-screen-radio-group",
radio_group);
}
g_free (action_name);
}
}