本文整理汇总了C++中G_ACTION_GROUP函数的典型用法代码示例。如果您正苦于以下问题:C++ G_ACTION_GROUP函数的具体用法?C++ G_ACTION_GROUP怎么用?C++ G_ACTION_GROUP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_ACTION_GROUP函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ide_editor_view_actions_init
void
ide_editor_view_actions_init (IdeEditorView *self)
{
g_autoptr(GSimpleActionGroup) group = NULL;
group = g_simple_action_group_new ();
g_action_map_add_action_entries (G_ACTION_MAP (group), IdeEditorViewActions,
G_N_ELEMENTS (IdeEditorViewActions), self);
gtk_widget_insert_action_group (GTK_WIDGET (self), "view", G_ACTION_GROUP (group));
gtk_widget_insert_action_group (GTK_WIDGET (self->tweak_widget), "view", G_ACTION_GROUP (group));
#define WATCH_PROPERTY(name) \
G_STMT_START { \
g_signal_connect (self->frame1->source_view, \
"notify::"name, \
G_CALLBACK (ide_editor_view_actions_source_view_notify), \
group); \
g_object_notify (G_OBJECT (self->frame1->source_view), name); \
} G_STMT_END
WATCH_PROPERTY ("auto-indent");
WATCH_PROPERTY ("highlight-current-line");
WATCH_PROPERTY ("insert-spaces-instead-of-tabs");
WATCH_PROPERTY ("show-line-numbers");
WATCH_PROPERTY ("show-right-margin");
WATCH_PROPERTY ("smart-backspace");
WATCH_PROPERTY ("tab-width");
#undef WATCH_PROPERTY
}
开发者ID:kakkilaya,项目名称:gnome-builder,代码行数:30,代码来源:ide-editor-view-actions.c
示例2: gb_project_tree_actions_init
void
gb_project_tree_actions_init (GbProjectTree *self)
{
g_autoptr(GSettings) settings = NULL;
g_autoptr(GSettings) tree_settings = NULL;
g_autoptr(GSimpleActionGroup) actions = NULL;
g_autoptr(GAction) action = NULL;
g_autoptr(GVariant) show_icons = NULL;
actions = g_simple_action_group_new ();
settings = g_settings_new ("org.gtk.Settings.FileChooser");
action = g_settings_create_action (settings, "sort-directories-first");
g_action_map_add_action (G_ACTION_MAP (actions), action);
g_action_map_add_action_entries (G_ACTION_MAP (actions),
GbProjectTreeActions,
G_N_ELEMENTS (GbProjectTreeActions),
self);
gtk_widget_insert_action_group (GTK_WIDGET (self),
"project-tree",
G_ACTION_GROUP (actions));
tree_settings = g_settings_new ("org.gnome.builder.project-tree");
show_icons = g_settings_get_value (tree_settings, "show-icons");
action_set (G_ACTION_GROUP (actions), "show-icons",
"state", show_icons,
NULL);
gb_project_tree_actions_update (self);
}
开发者ID:Dagal,项目名称:gnome-builder,代码行数:31,代码来源:gb-project-tree-actions.c
示例3: main
int
main (int argc, char **argv)
{
GApplication *app;
int status;
app = g_application_new ("org.gtk.TestApplication", 0);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
g_application_set_inactivity_timeout (app, 10000);
add_actions (app);
if (argc > 1 && strcmp (argv[1], "--simple-action") == 0)
{
g_application_register (app, NULL, NULL);
g_action_group_activate_action (G_ACTION_GROUP (app), "simple-action", NULL);
exit (0);
}
else if (argc > 1 && strcmp (argv[1], "--toggle-action") == 0)
{
g_application_register (app, NULL, NULL);
g_action_group_activate_action (G_ACTION_GROUP (app), "toggle-action", NULL);
exit (0);
}
status = g_application_run (app, argc, argv);
g_object_unref (app);
return status;
}
开发者ID:Tonyton,项目名称:gstreamer-ducati,代码行数:31,代码来源:gapplication-example-actions.c
示例4: gtk_application_window_real_realize
static void
gtk_application_window_real_realize (GtkWidget *widget)
{
GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);
GtkApplication *application;
GtkSettings *settings;
application = gtk_window_get_application (GTK_WINDOW (window));
settings = gtk_widget_get_settings (widget);
g_signal_connect (settings, "notify::gtk-shell-shows-app-menu",
G_CALLBACK (gtk_application_window_shell_shows_app_menu_changed), window);
g_signal_connect (settings, "notify::gtk-shell-shows-menubar",
G_CALLBACK (gtk_application_window_shell_shows_menubar_changed), window);
if (!window->priv->muxer_initialised)
{
g_action_muxer_insert (G_ACTION_MUXER (window->priv->muxer), "app", G_ACTION_GROUP (application));
g_action_muxer_insert (G_ACTION_MUXER (window->priv->muxer), "win", G_ACTION_GROUP (window));
window->priv->muxer_initialised = TRUE;
}
gtk_application_window_update_shell_shows_app_menu (window, settings);
gtk_application_window_update_shell_shows_menubar (window, settings);
gtk_application_window_update_menubar (window);
gtk_application_window_update_accels (window);
GTK_WIDGET_CLASS (gtk_application_window_parent_class)
->realize (widget);
#ifdef GDK_WINDOWING_X11
{
GdkWindow *gdkwindow;
gdkwindow = gtk_widget_get_window (GTK_WIDGET (window));
if (GDK_IS_X11_WINDOW (gdkwindow) && window->priv->session)
{
gdk_x11_window_set_utf8_property (gdkwindow, "_GTK_APPLICATION_ID",
g_application_get_application_id (G_APPLICATION (application)));
gdk_x11_window_set_utf8_property (gdkwindow, "_GTK_UNIQUE_BUS_NAME",
g_dbus_connection_get_unique_name (window->priv->session));
gdk_x11_window_set_utf8_property (gdkwindow, "_GTK_APPLICATION_OBJECT_PATH",
g_application_get_dbus_object_path (G_APPLICATION (application)));
gdk_x11_window_set_utf8_property (gdkwindow, "_GTK_WINDOW_OBJECT_PATH",
window->priv->object_path);
gdk_x11_window_set_utf8_property (gdkwindow, "_GTK_APP_MENU_OBJECT_PATH",
gtk_application_get_app_menu_object_path (application));
gdk_x11_window_set_utf8_property (gdkwindow, "_GTK_MENUBAR_OBJECT_PATH",
gtk_application_get_menubar_object_path (application));
}
}
#endif
}
开发者ID:jdapena,项目名称:gtk,代码行数:59,代码来源:gtkapplicationwindow.c
示例5: activate_action
static void
activate_action (GtkWidget *widget,
const gchar *prefix,
const gchar *action_name,
GVariant *parameter)
{
GApplication *app;
GtkWidget *toplevel;
GActionGroup *group = NULL;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (prefix);
g_return_if_fail (action_name);
g_print ("activate!\n");
app = g_application_get_default ();
toplevel = gtk_widget_get_toplevel (widget);
while ((group == NULL) && (widget != NULL))
{
group = gtk_widget_get_action_group (widget, prefix);
widget = gtk_widget_get_parent (widget);
}
if (!group && g_str_equal (prefix, "win") && G_IS_ACTION_GROUP (toplevel))
group = G_ACTION_GROUP (toplevel);
if (!group && g_str_equal (prefix, "app") && G_IS_ACTION_GROUP (app))
group = G_ACTION_GROUP (app);
if (group)
{
if (g_action_group_has_action (group, action_name))
{
g_print ("Activating %s.%s\n", prefix, action_name);
g_action_group_activate_action (group, action_name, parameter);
return;
}
}
if (parameter && g_variant_is_floating (parameter))
{
parameter = g_variant_ref_sink (parameter);
g_variant_unref (parameter);
}
g_warning ("Failed to resolve action %s.%s", prefix, action_name);
}
开发者ID:riadnassiffe,项目名称:gnome-builder,代码行数:49,代码来源:gd-tagged-entry.c
示例6: action_enter_location_callback
static void
action_enter_location_callback (GtkAction *action,
gpointer user_data)
{
g_action_group_activate_action (G_ACTION_GROUP (g_application_get_default ()),
"enter-location", NULL);
}
开发者ID:GeorgesStavracas,项目名称:eos-file-manager,代码行数:7,代码来源:nautilus-window-menus.c
示例7: bus_acquired
static void
bus_acquired (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
IndicatorTestService *indicator = user_data;
GError *error = NULL;
indicator->actions_export_id = g_dbus_connection_export_action_group (connection,
"/com/canonical/indicator/test",
G_ACTION_GROUP (indicator->actions),
&error);
if (indicator->actions_export_id == 0)
{
g_warning ("cannot export action group: %s", error->message);
g_error_free (error);
return;
}
indicator->menu_export_id = g_dbus_connection_export_menu_model (connection,
"/com/canonical/indicator/test/desktop",
G_MENU_MODEL (indicator->menu),
&error);
if (indicator->menu_export_id == 0)
{
g_warning ("cannot export menu: %s", error->message);
g_error_free (error);
return;
}
}
开发者ID:sneetsher,项目名称:mysystemindicator_minimum,代码行数:30,代码来源:indicator-test-service.c
示例8: gtk_application_window_init
static void
gtk_application_window_init (GtkApplicationWindow *window)
{
window->priv = gtk_application_window_get_instance_private (window);
window->priv->actions = gtk_application_window_actions_new (window);
window->priv->app_menu_section = g_menu_new ();
window->priv->menubar_section = g_menu_new ();
window->priv->accels = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (window), window->priv->accels);
gtk_widget_insert_action_group (GTK_WIDGET (window), "win", G_ACTION_GROUP (window->priv->actions));
/* window->priv->actions is the one and only ref on the group, so when
* we dispose, the action group will die, disconnecting all signals.
*/
g_signal_connect_swapped (window->priv->actions, "action-added",
G_CALLBACK (g_action_group_action_added), window);
g_signal_connect_swapped (window->priv->actions, "action-enabled-changed",
G_CALLBACK (g_action_group_action_enabled_changed), window);
g_signal_connect_swapped (window->priv->actions, "action-state-changed",
G_CALLBACK (g_action_group_action_state_changed), window);
g_signal_connect_swapped (window->priv->actions, "action-removed",
G_CALLBACK (g_action_group_action_removed), window);
}
开发者ID:hkishn121,项目名称:gtk,代码行数:25,代码来源:gtkapplicationwindow.c
示例9: action_about_nautilus_callback
static void
action_about_nautilus_callback (GtkAction *action,
gpointer user_data)
{
g_action_group_activate_action (G_ACTION_GROUP (g_application_get_default ()),
"about", NULL);
}
开发者ID:GeorgesStavracas,项目名称:eos-file-manager,代码行数:7,代码来源:nautilus-window-menus.c
示例10: g_dbus_action_group_describe_all_done
static void
g_dbus_action_group_describe_all_done (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GDBusActionGroup *group= user_data;
GVariant *reply;
g_assert (group->actions == NULL);
group->actions = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, action_info_free);
g_assert (group->connection == (gpointer) source);
reply = g_dbus_connection_call_finish (group->connection, result, NULL);
if (reply != NULL)
{
GVariantIter *iter;
ActionInfo *action;
g_variant_get (reply, "(a{s(bgav)})", &iter);
while ((action = action_info_new_from_iter (iter)))
{
g_hash_table_insert (group->actions, action->name, action);
if (group->strict)
g_action_group_action_added (G_ACTION_GROUP (group), action->name);
}
g_variant_iter_free (iter);
g_variant_unref (reply);
}
g_object_unref (group);
}
开发者ID:ImageMagick,项目名称:glib,代码行数:33,代码来源:gdbusactiongroup.c
示例11: action_bookmarks_callback
static void
action_bookmarks_callback (GtkAction *action,
gpointer user_data)
{
g_action_group_activate_action (G_ACTION_GROUP (g_application_get_default ()),
"bookmarks", NULL);
}
开发者ID:GeorgesStavracas,项目名称:eos-file-manager,代码行数:7,代码来源:nautilus-window-menus.c
示例12: action_connect_to_server_callback
static void
action_connect_to_server_callback (GtkAction *action,
gpointer user_data)
{
g_action_group_activate_action (G_ACTION_GROUP (g_application_get_default ()),
"connect-to-server", NULL);
}
开发者ID:GeorgesStavracas,项目名称:eos-file-manager,代码行数:7,代码来源:nautilus-window-menus.c
示例13: gpm_applet_cb
/**
* gpm_applet_cb:
* @_applet: GpmInhibitApplet instance created by the applet factory
* @iid: Applet id
*
* the function called by libpanel-applet factory after creation
**/
static gboolean
gpm_applet_cb (PanelApplet *_applet, const gchar *iid, gpointer data)
{
GpmInhibitApplet *applet = GPM_INHIBIT_APPLET(_applet);
GSimpleActionGroup *action_group;
gchar *ui_path;
static const GActionEntry menu_actions [] = {
{ "about", gpm_applet_dialog_about_cb, NULL, NULL, NULL },
};
if (strcmp (iid, GPM_INHIBIT_APPLET_ID) != 0) {
return FALSE;
}
action_group = g_simple_action_group_new ();
g_action_map_add_action_entries (G_ACTION_MAP (action_group),
menu_actions,
G_N_ELEMENTS (menu_actions),
applet);
ui_path = g_build_filename (INHIBIT_MENU_UI_DIR, "inhibit-applet-menu.xml", NULL);
panel_applet_setup_menu_from_file (PANEL_APPLET (applet), ui_path, action_group, GETTEXT_PACKAGE);
g_free (ui_path);
gtk_widget_insert_action_group (GTK_WIDGET (applet), "inhibit",
G_ACTION_GROUP (action_group));
g_object_unref (action_group);
return TRUE;
}
开发者ID:GNOME,项目名称:gnome-applets,代码行数:38,代码来源:inhibit-applet.c
示例14: action_new_window_callback
static void
action_new_window_callback (GtkAction *action,
gpointer user_data)
{
g_action_group_activate_action (G_ACTION_GROUP (g_application_get_default ()),
"new-window", NULL);
}
开发者ID:GeorgesStavracas,项目名称:eos-file-manager,代码行数:7,代码来源:nautilus-window-menus.c
示例15: action_close_all_windows_callback
static void
action_close_all_windows_callback (GtkAction *action,
gpointer user_data)
{
g_action_group_activate_action (G_ACTION_GROUP (g_application_get_default ()),
"quit", NULL);
}
开发者ID:GeorgesStavracas,项目名称:eos-file-manager,代码行数:7,代码来源:nautilus-window-menus.c
示例16: gb_preferences_switch_update_settings
static void
gb_preferences_switch_update_settings (GbPreferencesSwitch *self)
{
g_assert (GB_IS_PREFERENCES_SWITCH (self));
if ((self->settings != NULL) && (self->settings_schema_key != NULL))
{
GSimpleActionGroup *group;
GAction *action;
gchar *name;
action = g_settings_create_action (self->settings, self->settings_schema_key);
group = g_simple_action_group_new ();
g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action));
gtk_widget_insert_action_group (GTK_WIDGET (self), "settings", G_ACTION_GROUP (group));
g_object_unref (action);
name = g_strdup_printf ("settings.%s", self->settings_schema_key);
if (self->is_radio)
{
gtk_actionable_set_action_name (GTK_ACTIONABLE (self->settings_radio), name);
gtk_actionable_set_action_name (GTK_ACTIONABLE (self->settings_switch), NULL);
}
else
{
gtk_actionable_set_action_name (GTK_ACTIONABLE (self->settings_radio), NULL);
gtk_actionable_set_action_name (GTK_ACTIONABLE (self->settings_switch), name);
}
g_free (name);
}
}
开发者ID:meghprkh,项目名称:gnome-builder,代码行数:33,代码来源:gb-preferences-switch.c
示例17: update_undo_sensitivity
void
update_undo_sensitivity (void)
{
/* Unfortunately, this does not change the state of undo button in app menu :( */
gboolean enable = UndoVisible ();
gboolean result = g_action_group_query_action (G_ACTION_GROUP (application), "Undo", &enable, NULL, NULL, NULL, NULL);
}
开发者ID:bellau,项目名称:gnome-games,代码行数:7,代码来源:gyahtzee.c
示例18: photos_searchbar_enable_search
static void
photos_searchbar_enable_search (PhotosSearchbar *self, gboolean enable)
{
GVariant *state;
state = g_variant_new ("b", enable);
g_action_group_change_action_state (G_ACTION_GROUP (self->priv->app), "search", state);
}
开发者ID:UIKit0,项目名称:gnome-photos,代码行数:8,代码来源:photos-searchbar.c
示例19: egg_empty_state_action
static gboolean
egg_empty_state_action (GtkWidget *widget,
const gchar *prefix,
const gchar *action_name,
GVariant *parameter)
{
GtkWidget *toplevel;
GApplication *app;
GActionGroup *group = NULL;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (prefix, FALSE);
g_return_val_if_fail (action_name, FALSE);
app = g_application_get_default ();
toplevel = gtk_widget_get_toplevel (widget);
while ((group == NULL) && (widget != NULL))
{
group = gtk_widget_get_action_group (widget, prefix);
widget = gtk_widget_get_parent (widget);
}
if (!group && g_str_equal (prefix, "win") && G_IS_ACTION_GROUP (toplevel))
group = G_ACTION_GROUP (toplevel);
if (!group && g_str_equal (prefix, "app") && G_IS_ACTION_GROUP (app))
group = G_ACTION_GROUP (app);
if (group && g_action_group_has_action (group, action_name))
{
g_action_group_activate_action (group, action_name, parameter);
return TRUE;
}
if (parameter && g_variant_is_floating (parameter))
{
parameter = g_variant_ref_sink (parameter);
g_variant_unref (parameter);
}
g_warning ("Failed to locate action %s.%s", prefix, action_name);
return FALSE;
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:45,代码来源:egg-empty-state.c
示例20: add_accel_closure
/* Hack. We iterate over the accel map instead of the actions,
* in order to pull the parameters out of accel map entries
*/
static void
add_accel_closure (gpointer data,
const gchar *accel_path,
guint accel_key,
GdkModifierType accel_mods,
gboolean changed)
{
GtkApplicationWindow *window = data;
GActionGroup *actions;
const gchar *path;
const gchar *p;
gchar *action_name;
GVariant *parameter;
AccelClosure *closure;
if (accel_key == 0)
return;
if (!g_str_has_prefix (accel_path, "<GAction>/"))
return;
path = accel_path + strlen ("<GAction>/");
p = strchr (path, '/');
if (p)
{
action_name = g_strndup (path, p - path);
parameter = g_variant_parse (NULL, p + 1, NULL, NULL, NULL);
if (!parameter)
g_warning ("Failed to parse parameter from '%s'\n", accel_path);
}
else
{
action_name = g_strdup (path);
parameter = NULL;
}
actions = G_ACTION_GROUP (_gtk_widget_get_action_muxer (GTK_WIDGET (window)));
if (g_action_group_has_action (actions, action_name))
{
closure = (AccelClosure*) g_closure_new_object (sizeof (AccelClosure), g_object_ref (actions));
g_closure_set_marshal (&closure->closure, accel_activate);
closure->action_name = g_strdup (action_name);
closure->parameter = parameter ? g_variant_ref_sink (parameter) : NULL;
window->priv->accel_closures = g_slist_prepend (window->priv->accel_closures, g_closure_ref (&closure->closure));
g_closure_sink (&closure->closure);
gtk_accel_group_connect_by_path (window->priv->accels, accel_path, &closure->closure);
}
else if (parameter)
{
g_variant_unref (parameter);
}
g_free (action_name);
}
开发者ID:hkishn121,项目名称:gtk,代码行数:60,代码来源:gtkapplicationwindow.c
注:本文中的G_ACTION_GROUP函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论