当前位置: 首页>>代码示例>>C++>>正文


C++ G_ACTION函数代码示例

本文整理汇总了C++中G_ACTION函数的典型用法代码示例。如果您正苦于以下问题:C++ G_ACTION函数的具体用法?C++ G_ACTION怎么用?C++ G_ACTION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了G_ACTION函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gstyle_color_panel_actions_toggle_page

static void
gstyle_color_panel_actions_toggle_page (GSimpleAction *action,
                                        GVariant      *variant,
                                        gpointer       user_data)
{
  GstyleColorPanel *self = (GstyleColorPanel *)user_data;
  g_autoptr (GVariant) value = NULL;
  g_autofree gchar *page_name = NULL;
  const gchar *name;
  gboolean state;

  g_assert (GSTYLE_IS_COLOR_PANEL (self));

  value = g_action_get_state (G_ACTION (action));
  state = g_variant_get_boolean (value);
  name = g_action_get_name(G_ACTION (action));
  if (!g_str_has_prefix (name, "toggle-"))
    return;

  page_name = g_strdup (&name [7]);
  g_simple_action_set_state (action, g_variant_new_boolean (!state));
  if (!state)
    {
      _gstyle_color_panel_update_prefs_page (self, page_name);
      gtk_stack_set_visible_child_name (self->prefs_stack, page_name);
    }

  gstyle_slidein_reveal_slide (GSTYLE_SLIDEIN (self->prefs_slidein),
                               !gstyle_slidein_get_revealed (GSTYLE_SLIDEIN (self->prefs_slidein)));
}
开发者ID:GNOME,项目名称:gnome-builder,代码行数:30,代码来源:gstyle-color-panel-actions.c

示例2: _brio_application_set_app_menu

static void
_brio_application_set_app_menu (GApplication *app)
{
  GMenu *app_menu = g_menu_new ();
  GSimpleAction *about;
  GSimpleAction *quit;

  about = g_simple_action_new ("about", NULL);
  g_signal_connect (about,
                    "activate",
                    G_CALLBACK (_brio_application_show_about),
                    app);
  g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (about));
  g_menu_append (app_menu, _("About"), "app.about");

  quit = g_simple_action_new ("quit", NULL);
  g_signal_connect (quit,
                    "activate",
                    G_CALLBACK (_brio_application_quit),
                    app);
  g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (quit));
  g_menu_append (app_menu, _("Quit"), "app.quit");

  gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (app_menu));
}
开发者ID:bpepple,项目名称:brio,代码行数:25,代码来源:brio-application.c

示例3: create_action_group

static GSimpleActionGroup *
create_action_group(ReaderWindowPrivate *priv)
{
	GSimpleActionGroup *actions = g_simple_action_group_new();

	gboolean side_pane = cainteoir_settings_get_boolean(priv->settings, "index", "visible", TRUE);

	priv->index_pane_action = g_simple_action_new_stateful("side-pane", nullptr, g_variant_new_boolean(side_pane));
	g_action_map_add_action(G_ACTION_MAP(actions), G_ACTION(priv->index_pane_action));
	g_signal_connect(priv->index_pane_action, "activate", G_CALLBACK(on_index_pane_toggle_action), priv);

	priv->open_action = g_simple_action_new("open", nullptr);
	g_action_map_add_action(G_ACTION_MAP(actions), G_ACTION(priv->open_action));
	g_signal_connect(priv->open_action, "activate", G_CALLBACK(on_open_file_action), priv);

	priv->play_stop_action = g_simple_action_new("play-stop", nullptr);
	g_action_map_add_action(G_ACTION_MAP(actions), G_ACTION(priv->play_stop_action));
	g_signal_connect(priv->play_stop_action, "activate", G_CALLBACK(on_play_stop_action), priv);

	priv->record_action = g_simple_action_new("record", nullptr);
	g_action_map_add_action(G_ACTION_MAP(actions), G_ACTION(priv->record_action));
	g_signal_connect(priv->record_action, "activate", G_CALLBACK(on_record_action), priv);

	return actions;
}
开发者ID:happytcj,项目名称:cainteoir-gtk,代码行数:25,代码来源:reader_window.cpp

示例4: shell_add_actions

static void
shell_add_actions (GApplication *application)
{
	GActionMap *action_map;
	GSimpleAction *action;

	action_map = G_ACTION_MAP (application);

	/* Add actions that remote instances can invoke. */

	action = g_simple_action_new ("new-window", G_VARIANT_TYPE_STRING);
	g_signal_connect (
		action, "activate",
		G_CALLBACK (shell_action_new_window_cb), application);
	g_action_map_add_action (action_map, G_ACTION (action));
	g_object_unref (action);

	action = g_simple_action_new (
		"handle-uris", G_VARIANT_TYPE_STRING_ARRAY);
	g_signal_connect (
		action, "activate",
		G_CALLBACK (shell_action_handle_uris_cb), application);
	g_action_map_add_action (action_map, G_ACTION (action));
	g_object_unref (action);

	action = g_simple_action_new ("quit", NULL);
	g_signal_connect (
		action, "activate",
		G_CALLBACK (shell_action_quit_cb), application);
	g_action_map_add_action (action_map, G_ACTION (action));
	g_object_unref (action);
}
开发者ID:UIKit0,项目名称:evolution,代码行数:32,代码来源:e-shell.c

示例5: impl_activate

static void
impl_activate (PeasActivatable *plugin)
{
	TotemDiscRecorderPlugin *pi = TOTEM_DISC_RECORDER_PLUGIN (plugin);
	TotemDiscRecorderPluginPrivate *priv = pi->priv;
	GMenu *menu;
	char *path;

	/* make sure brasero is in the path */
	path = g_find_program_in_path ("brasero");
	if (!path)
		return;
	g_free (path);

	priv->totem = g_object_get_data (G_OBJECT (plugin), "object");

	g_signal_connect (priv->totem,
			  "file-opened",
			  G_CALLBACK (totem_disc_recorder_file_opened),
			  plugin);
	g_signal_connect (priv->totem,
			  "file-closed",
			  G_CALLBACK (totem_disc_recorder_file_closed),
			  plugin);

	/* Create the actions */
	priv->dvd_action = g_simple_action_new ("media-optical-video-new", NULL);
	g_signal_connect (G_OBJECT (priv->dvd_action), "activate",
			  G_CALLBACK (totem_disc_recorder_plugin_burn), plugin);
	g_action_map_add_action (G_ACTION_MAP (priv->totem), G_ACTION (priv->dvd_action));

	priv->copy_action = g_simple_action_new ("media-optical-copy", NULL);
	g_signal_connect (G_OBJECT (priv->copy_action), "activate",
			  G_CALLBACK (totem_disc_recorder_plugin_copy), plugin);
	g_action_map_add_action (G_ACTION_MAP (priv->totem), G_ACTION (priv->copy_action));

	priv->copy_vcd_action = g_simple_action_new ("media-optical-copy-vcd", NULL);
	g_signal_connect (G_OBJECT (priv->copy_vcd_action), "activate",
			  G_CALLBACK (totem_disc_recorder_plugin_copy), plugin);
	g_action_map_add_action (G_ACTION_MAP (priv->totem), G_ACTION (priv->copy_vcd_action));

	/* Install the menu */
	menu = totem_object_get_menu_section (priv->totem, "burn-placeholder");
	menu_append_hidden (G_MENU (menu), _("_Create Video Disc…"), "app.media-optical-video-new");
	menu_append_hidden (G_MENU (menu), _("Copy Vide_o DVD…"), "app.media-optical-copy");
	menu_append_hidden (G_MENU (menu), _("Copy (S)VCD…"), "app.media-optical-copy-vcd");

	if (!totem_object_is_paused (priv->totem) && !totem_object_is_playing (priv->totem)) {
		set_menu_items_state (pi, FALSE, FALSE, FALSE);
	} else {
		char *mrl;

		mrl = totem_object_get_current_mrl (priv->totem);
		totem_disc_recorder_file_opened (priv->totem, mrl, pi);
		g_free (mrl);
	}
}
开发者ID:Avinashkumarsharma,项目名称:totem,代码行数:57,代码来源:totem-disc-recorder.c

示例6: cc_application_startup

static void
cc_application_startup (GApplication *application)
{
  CcApplication *self = CC_APPLICATION (application);
  GMenu *menu;
  GMenu *section;
  GSimpleAction *action;

  G_APPLICATION_CLASS (cc_application_parent_class)->startup (application);

#ifdef HAVE_CHEESE
  if (gtk_clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
    {
      g_critical ("Unable to initialize Clutter");
      return;
    }
#endif /* HAVE_CHEESE */

  /* register a symbolic icon size for use in sidebar lists */
  gtk_icon_size_register ("cc-sidebar-list", 24, 24);

  action = g_simple_action_new ("help", NULL);
  g_action_map_add_action (G_ACTION_MAP (application), G_ACTION (action));
  g_signal_connect (action, "activate", G_CALLBACK (help_activated), self);
  g_object_unref (action);

  action = g_simple_action_new ("quit", NULL);
  g_action_map_add_action (G_ACTION_MAP (application), G_ACTION (action));
  g_signal_connect (action, "activate", G_CALLBACK (cc_application_quit), self);
  g_object_unref (action);

  /* Launch panel by id. The parameter is a (panel_id, array_of_panel_parameters)
   * tuple. The GVariant-containing array usually is just the same array of
   * strings that would be generated by passing panel-specific arguments on
   * the command line. */
  action = g_simple_action_new ("launch-panel", G_VARIANT_TYPE ("(sav)"));
  g_action_map_add_action (G_ACTION_MAP (application), G_ACTION (action));
  g_signal_connect (action, "activate", G_CALLBACK (launch_panel_activated), self);
  g_object_unref (action);

  menu = g_menu_new ();

  section = g_menu_new ();
  g_menu_append (section, _("Help"), "app.help");
  g_menu_append (section, _("Quit"), "app.quit");

  g_menu_append_section (menu, NULL, G_MENU_MODEL (section));

  gtk_application_set_app_menu (GTK_APPLICATION (application),
                                G_MENU_MODEL (menu));

  gtk_application_add_accelerator (GTK_APPLICATION (application),
                                   "F1", "app.help", NULL);

  self->priv->window = cc_window_new (GTK_APPLICATION (application));
}
开发者ID:ChrisCummins,项目名称:gnome-control-center,代码行数:56,代码来源:cc-application.c

示例7: activate_action

static void
activate_action (GSimpleAction *action,
                 GVariant      *parameter,
                 gpointer       data)
{
  GAction *win_action = get_corresponding_window_action (GTK_APPLICATION (data),
                                                         G_ACTION (action));
  g_action_activate (win_action, parameter);

  if (parameter)
    g_action_change_state (G_ACTION (action), parameter);
}
开发者ID:Khanumka,项目名称:gucharmap,代码行数:12,代码来源:main.c

示例8: toggle_speed

static void
toggle_speed (GtkToggleButton *button, gpointer data)
{
  GMenuModel *model;
  GActionGroup *group;
  GSimpleAction *action;
  gboolean adding;
  GMenuModel *m;
  GMenu *submenu;
  GtkTreeView *tv = data;
  GtkTreeModel *store;

  model = g_object_get_data (G_OBJECT (button), "model");
  group = g_object_get_data (G_OBJECT (button), "group");

  store = gtk_tree_view_get_model (tv);

  adding = gtk_toggle_button_get_active (button);

  m = g_menu_model_get_item_link (model, 1, G_MENU_LINK_SECTION);
  if (adding)
    {
      action = g_simple_action_new ("faster", NULL);
      g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action));
      g_signal_connect (action, "activate", G_CALLBACK (activate_action), NULL);
      g_object_unref (action);

      action = g_simple_action_new ("slower", NULL);
      g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action));
      g_signal_connect (action, "activate", G_CALLBACK (activate_action), NULL);
      g_object_unref (action);

      action_list_add (store, "faster");
      action_list_add (store, "slower");

      submenu = g_menu_new ();
      g_menu_append (submenu, "Faster", "faster");
      g_menu_append (submenu, "Slower", "slower");
      g_menu_append_submenu (G_MENU (m), "Speed", G_MENU_MODEL (submenu));
    }
  else
    {
      g_action_map_remove_action (G_ACTION_MAP (group), "faster");
      g_action_map_remove_action (G_ACTION_MAP (group), "slower");

      action_list_remove (store, "faster");
      action_list_remove (store, "slower");

      g_menu_remove (G_MENU (m), g_menu_model_get_n_items (m) - 1);
    }
}
开发者ID:3v1n0,项目名称:gtk,代码行数:51,代码来源:testgmenu.c

示例9: gcal_application_set_app_menu

static void 
gcal_application_set_app_menu (GApplication *app)
{
  GcalApplicationPrivate *priv;

  GMenu *app_menu;
  GMenu *view_as;
  GSimpleAction *about;
  GSimpleAction *quit;

  g_return_if_fail (GCAL_IS_APPLICATION (app));
  priv = GCAL_APPLICATION (app)->priv;

  app_menu = g_menu_new ();

  priv->view = g_simple_action_new_stateful (
      "view",
      G_VARIANT_TYPE_STRING,
      g_settings_get_value (priv->settings, "active-view"));

  g_signal_connect (priv->view,
                    "activate",
                    G_CALLBACK (gcal_application_change_view),
                    app);
  g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (priv->view));

  view_as = g_menu_new ();
  g_menu_append (view_as, _("Weeks"), "app.view::week");
  g_menu_append (view_as, _("Months"), "app.view::month");

  g_menu_append_section (app_menu, _("View as"), G_MENU_MODEL (view_as));

  about = g_simple_action_new ("about", NULL);
  g_signal_connect (about,
                    "activate",
                    G_CALLBACK (gcal_application_show_about),
                    app);
  g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (about));
  g_menu_append (app_menu, _("About"), "app.about");

  quit = g_simple_action_new ("quit", NULL);
  g_signal_connect (quit,
                    "activate",
                    G_CALLBACK (gcal_application_quit),
                    app);
  g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (quit));
  g_menu_append (app_menu, _("Quit"), "app.quit");

  gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (app_menu));
}
开发者ID:erick2red,项目名称:gnome-calendar,代码行数:50,代码来源:gcal-application.c

示例10: photos_application_action_toggle

static void
photos_application_action_toggle (GSimpleAction *simple, GVariant *parameter, gpointer user_data)
{
  GVariant *state;
  GVariant *new_state;

  state = g_action_get_state (G_ACTION (simple));
  if (state == NULL)
    return;

  new_state = g_variant_new ("b", !g_variant_get_boolean (state));
  g_action_change_state (G_ACTION (simple), new_state);
  g_variant_unref (state);
}
开发者ID:UIKit0,项目名称:gnome-photos,代码行数:14,代码来源:photos-application.c

示例11: action_toggle_state

static void
action_toggle_state (GSimpleAction *action,
                     GVariant *parameter,
                     gpointer user_data)
{
	GVariant *state;
	gboolean new_state;

	state = g_action_get_state (G_ACTION (action));
	new_state = !g_variant_get_boolean (state);
	g_action_change_state (G_ACTION (action),
	                       g_variant_new_boolean (new_state));
	g_variant_unref (state);
}
开发者ID:DOICHE,项目名称:eog,代码行数:14,代码来源:eog-application.c

示例12: startup

static void
startup (GApplication *app,
         gpointer      user_data)
{
  GSimpleAction *new_action;
  GSimpleAction *quit_action;

  new_action = g_simple_action_new ("new", NULL);
  g_signal_connect (new_action, "activate", G_CALLBACK (new_callback), app);
  g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (new_action));

  quit_action = g_simple_action_new ("quit", NULL);
  g_signal_connect (quit_action, "activate", G_CALLBACK (quit_callback), app);
  g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (quit_action));
}
开发者ID:GNOME,项目名称:gnome-devel-docs,代码行数:15,代码来源:menubottun_0.c

示例13: activate_toggle_action

static void
activate_toggle_action (GSimpleAction *action,
                        GVariant      *parameter,
                        gpointer       data)
{
  GVariant *state = g_action_get_state (G_ACTION (action));
  gboolean value = g_variant_get_boolean (state);
  GAction *win_action;

  win_action = get_corresponding_window_action (GTK_APPLICATION (data),
                                                G_ACTION (action));
  g_action_change_state (win_action, g_variant_new_boolean (!value));
  g_action_change_state (G_ACTION (action), g_variant_new_boolean (!value));
  g_variant_unref (state);
}
开发者ID:Khanumka,项目名称:gucharmap,代码行数:15,代码来源:main.c

示例14: 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

示例15: xfdashboard_application_init

/* Object initialization
 * Create private structure and set up default values
 */
static void xfdashboard_application_init(XfdashboardApplication *self)
{
	XfdashboardApplicationPrivate	*priv;
	GSimpleAction					*action;

	priv=self->priv=XFDASHBOARD_APPLICATION_GET_PRIVATE(self);

	/* Set default values */
	priv->isDaemon=FALSE;
	priv->isSuspended=FALSE;
	priv->themeName=NULL;
	priv->inited=FALSE;
	priv->xfconfChannel=NULL;
	priv->viewManager=NULL;
	priv->searchManager=NULL;
	priv->focusManager=NULL;
	priv->theme=NULL;
	priv->xfconfThemeChangedSignalID=0L;
	priv->isQuitting=FALSE;
	priv->sessionManagementClient=NULL;

	/* Add callable DBUS actions for this application */
	action=g_simple_action_new("Quit", NULL);
	g_signal_connect(action, "activate", G_CALLBACK(xfdashboard_application_quit_forced), NULL);
	g_action_map_add_action(G_ACTION_MAP(self), G_ACTION(action));
	g_object_unref(action);
}
开发者ID:Zeioth,项目名称:xfdashboard,代码行数:30,代码来源:application.c


注:本文中的G_ACTION函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。