• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ G_ACTION函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: startup

/* Startup function for the menu we are creating in this sample */
static void
startup (GApplication *app,
         gpointer      user_data)
{
  GMenu *menu;
  GSimpleAction *quit_action;

  /* Initialize the GMenu, and add a menu item with label "About" and action 
   * "win.about". Also add another menu item with label "Quit" and action 
   * "app.quit" 
   */
  menu = g_menu_new ();
  g_menu_append (menu, "About", "win.about");
  g_menu_append (menu, "Quit", "app.quit");

  /* Create a new simple action for the application. (In this case it is the 
   * "quit" action.
   */
  quit_action = g_simple_action_new ("quit", NULL);

  /* Ensure that the menu we have just created is set for the overall application */
  gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (menu));

  g_signal_connect (quit_action, 
                    "activate", 
                    G_CALLBACK (quit_cb), 
                    app);

  g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (quit_action));

}
开发者ID:Kr0mAgn0n,项目名称:gnome-devel-docs,代码行数:32,代码来源:about_dialog.c


示例17: gt_twitch_chat_view_init

static void
gt_twitch_chat_view_init(GtTwitchChatView* self)
{
    GtTwitchChatViewPrivate* priv = gt_twitch_chat_view_get_instance_private(self);

    gtk_widget_init_template(GTK_WIDGET(self));

    priv->action_group = g_simple_action_group_new();
    priv->dark_theme_action = g_property_action_new("dark-theme", self, "dark-theme");
    g_action_map_add_action(G_ACTION_MAP(priv->action_group), G_ACTION(priv->dark_theme_action));

    priv->chat_css_provider = gtk_css_provider_new();
    gtk_style_context_add_provider(gtk_widget_get_style_context(GTK_WIDGET(self)),
                                   GTK_STYLE_PROVIDER(priv->chat_css_provider),
                                   GTK_STYLE_PROVIDER_PRIORITY_USER);

    priv->chat_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->chat_view));
    priv->tag_table = gtk_text_buffer_get_tag_table(priv->chat_buffer);
    priv->twitch_emotes = g_hash_table_new(g_direct_hash, g_direct_equal);
    gtk_text_buffer_get_end_iter(priv->chat_buffer, &priv->bottom_iter);
    priv->bottom_mark = gtk_text_buffer_create_mark(priv->chat_buffer, "end", &priv->bottom_iter, TRUE);

    priv->chat = gt_twitch_chat_client_new();
    priv->cur_chan = NULL;

    priv->joined_channel = FALSE;

    g_signal_connect(priv->chat_entry, "key-press-event", G_CALLBACK(key_press_cb), self);
    g_signal_connect(self, "hierarchy-changed", G_CALLBACK(anchored_cb), self);

    g_source_set_callback((GSource*) priv->chat->source, (GSourceFunc) twitch_chat_source_cb, self, NULL);

    ADD_STYLE_CLASS(self, "gt-twitch-chat-view");
}
开发者ID:pH5,项目名称:gnome-twitch,代码行数:34,代码来源:gt-twitch-chat-view.c


示例18: activate

static void
activate (GSimpleAction *action,
          GVariant      *parameter,
          gpointer       user_data)
{
  g_print ("%s activated\n", g_action_get_name (G_ACTION (action)));
}
开发者ID:3v1n0,项目名称:gtk,代码行数:7,代码来源:testpopover.c


示例19: on_menu_toggle_changed

static void
on_menu_toggle_changed(GSimpleAction *action, GVariant *value, gpointer user_data)
{
  WorkraveApplet *applet = WORKRAVE_APPLET(user_data);
  gboolean new_state = g_variant_get_boolean(value);
  int index = lookup_menu_index_by_action(g_action_get_name(G_ACTION(action)));
  if (index == -1)
    {
      return;
    }

  g_simple_action_set_state(action, value);

  GDBusProxy *proxy = workrave_timerbox_control_get_control_proxy(applet->priv->timerbox_control);
  if (proxy != NULL)
    {
      g_dbus_proxy_call(proxy,
                        menu_data[index].dbuscmd,
                        g_variant_new("(b)", new_state),
                        G_DBUS_CALL_FLAGS_NO_AUTO_START,
                        -1,
                        NULL,
                        (GAsyncReadyCallback) dbus_call_finish,
                        &applet);
    }
}
开发者ID:183amir,项目名称:workrave,代码行数:26,代码来源:WorkraveApplet.c


示例20: activate

static void
activate (GtkApplication *app,
          gpointer        user_data)
{
  GtkWidget *window;

  GSimpleAction *about_action;

  /* Create a window with a title and a default size */
  window = gtk_application_window_new (app);
  gtk_window_set_title (GTK_WINDOW (window), "AboutDialog Example");
  gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);

  /* Create a new simple action, giving it a NULL parameter type. It will 
   * always be NULL for actions invoked from a menu. (e.g clicking on an "ok" 
   * or "cancel" button)
   */
  about_action = g_simple_action_new ("about", NULL); 

  /* Connect the "activate" signal to the appropriate callback function. 
   * It will indicate that the action was just activated.
   */
  g_signal_connect (about_action, "activate", G_CALLBACK (about_cb), 
                    GTK_WINDOW (window));

  /* Adds the about_action to the overall action map. An Action map is an 
   * interface that contains a number of named GAction instances 
   * (such as about_action) 
   */
  g_action_map_add_action (G_ACTION_MAP (window), G_ACTION (about_action));

  gtk_widget_show_all (window);
}
开发者ID:Kr0mAgn0n,项目名称:gnome-devel-docs,代码行数:33,代码来源:about_dialog.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ G_ACTION_GROUP函数代码示例发布时间:2022-05-30
下一篇:
C++ G_函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap