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

C++ GTK_APPLICATION函数代码示例

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

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



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

示例1: initialize_app_menubar

void
initialize_app_menubar (GApplication *application)
{
	GtkBuilder *builder;
	GSettings  *settings;

	g_action_map_add_action_entries (G_ACTION_MAP (application),
					 app_menu_entries,
					 G_N_ELEMENTS (app_menu_entries),
					 application);

	builder = _gtk_builder_new_from_resource ("app-menubar.ui");
	gtk_application_set_menubar (GTK_APPLICATION (application),
				     G_MENU_MODEL (gtk_builder_get_object (builder, "app-menubar")));
	g_object_unref (builder);

	settings = fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_UI);
	g_simple_action_set_state (GET_ACTION (PREF_UI_VIEW_SIDEBAR),
				   g_variant_new_boolean (g_settings_get_boolean (settings, PREF_UI_VIEW_SIDEBAR)));

	settings = fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_LISTING);
	g_simple_action_set_state (GET_ACTION (PREF_LISTING_LIST_MODE),
				   g_variant_new_string (_g_enum_type_get_value (FR_TYPE_WINDOW_LIST_MODE,
						   	 g_settings_get_enum (settings, PREF_LISTING_LIST_MODE))->value_nick));

	g_signal_connect (fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_UI),
			  "changed::" PREF_UI_VIEW_SIDEBAR,
			  G_CALLBACK (pref_view_sidebar_changed),
			  application);
	g_signal_connect (fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_LISTING),
			  "changed::" PREF_LISTING_LIST_MODE,
			  G_CALLBACK (pref_list_mode_changed),
			  application);
}
开发者ID:13917547121,项目名称:file-roller,代码行数:34,代码来源:fr-application-menu.c


示例2: gw_application_set_win_menubar

void
gw_application_set_win_menubar (GwApplication *application, GMenuModel *menumodel)
{
    //Sanity checks
    g_return_if_fail (application != NULL);
    g_return_if_fail (menumodel != NULL);
    if (g_menu_model_get_n_items (menumodel) == 0) return;

    //Declarations
    GMenuModel *menubar;
    gint length;

    //Initializations
    menubar = gtk_application_get_menubar (GTK_APPLICATION (application));
    g_return_if_fail (menubar != NULL);
    length = g_menu_model_get_n_items (menubar);

    //Clear the menubar
    while (length-- > 0) g_menu_remove (G_MENU (menubar), 0);

    //Add the menuitem linking the menus 
    {
      GMenuItem *menuitem = g_menu_item_new_section (NULL, menumodel);
      if (menuitem != NULL)
      {
        g_menu_append_item (G_MENU (menubar), menuitem);
        g_object_unref (menuitem); menuitem = NULL;
      }
      gw_application_add_accelerators (application, menubar);
    }
}
开发者ID:kyoushuu,项目名称:gwaei,代码行数:31,代码来源:application.c


示例3: gw_application_load_menubar

static void
gw_application_load_menubar (GwApplication *application)
{
    GMenuModel *menumodel;
    menumodel = G_MENU_MODEL (g_menu_new ());
    gtk_application_set_menubar (GTK_APPLICATION (application), menumodel);
}
开发者ID:kyoushuu,项目名称:gwaei,代码行数:7,代码来源:application.c


示例4: trg_gtk_app_command_line

static int
trg_gtk_app_command_line(GApplication * application,
                         GApplicationCommandLine * cmdline)
{
    GList *windows =
        gtk_application_get_windows(GTK_APPLICATION(application));
    TrgMainWindow *window;
    gchar **argv;

    if (!windows || !windows->data)
        return 1;

    window = TRG_MAIN_WINDOW(windows->data);
    argv = g_application_command_line_get_arguments(cmdline, NULL);

    if (g_application_command_line_get_is_remote(cmdline)) {
        if (!argv[0]) {
            gtk_window_present(GTK_WINDOW(window));
            g_strfreev(argv);
        } else {
            return trg_add_from_filename(window, argv);
        }
    } else {
        trg_main_window_set_start_args(window, argv);
        auto_connect_if_required(TRG_MAIN_WINDOW(windows->data));
    }

    return 0;
}
开发者ID:MaximKraev,项目名称:transmission-remote-gtk,代码行数:29,代码来源:trg-gtk-app.c


示例5: get_network_available

static void
get_network_available (GNetworkMonitor *monitor,
		       gboolean         available,
		       GeditApp        *app)
{
	gboolean enable;
	GList *windows, *w;

	enable = g_network_monitor_get_network_available (monitor);

	windows = gtk_application_get_windows (GTK_APPLICATION (app));

	for (w = windows; w != NULL; w = w->next)
	{
		GeditWindow *window = GEDIT_WINDOW (w->data);

		if (GEDIT_IS_WINDOW (window))
		{
			GList *tabs, *t;

			tabs = _gedit_window_get_all_tabs (window);

			for (t = tabs; t != NULL; t = t->next)
			{
				_gedit_tab_set_network_available (GEDIT_TAB (t->data),
					                          enable);
			}

			g_list_free (tabs);
		}
	}
}
开发者ID:noemis13,项目名称:gedit,代码行数:32,代码来源:gedit-app.c


示例6: openoffice_missing_unoconv

static void
openoffice_missing_unoconv (NemoPreviewPdfLoader *self)
{
  GApplication *app = g_application_get_default ();
  GtkWidget *widget = GTK_WIDGET (gtk_application_get_active_window (GTK_APPLICATION (app)));
  GDBusConnection *connection = g_application_get_dbus_connection (app);
  guint xid = 0;
  GdkWindow *gdk_window;
  const gchar *unoconv_path[2];

  gdk_window = gtk_widget_get_window (widget);
  if (gdk_window != NULL)
    xid = GDK_WINDOW_XID (gdk_window);

  unoconv_path[0] = "/usr/bin/unoconv";
  unoconv_path[1] = NULL;

  g_dbus_connection_call (connection,
                          "org.freedesktop.PackageKit",
                          "/org/freedesktop/PackageKit",
                          "org.freedesktop.PackageKit.Modify",
                          "InstallProvideFiles",
                          g_variant_new ("(u^ass)",
                                         xid,
                                         unoconv_path,
                                         "hide-confirm-deps"),
                          NULL, G_DBUS_CALL_FLAGS_NONE,
                          G_MAXINT, NULL,
                          openoffice_missing_unoconv_ready_cb,
                          self);
}
开发者ID:007durgesh219,项目名称:nemo-extensions,代码行数:31,代码来源:nemo-preview-pdf-loader.c


示例7: activate_wizard

static void
activate_wizard(GApplication *app,
                gpointer user_data)
{
    create_assistant(GTK_APPLICATION(app), *(int *)user_data);
    update_gui_state_from_problem_data(UPDATE_SELECTED_EVENT);
}
开发者ID:credmon,项目名称:libreport,代码行数:7,代码来源:main.c


示例8: maybe_open_with_existing_workspace

static gboolean
maybe_open_with_existing_workspace (IdeApplication *self,
                                    GFile          *file,
                                    const gchar    *hint,
                                    GCancellable   *cancellable)
{
  GList *windows;
  GList *iter;

  g_assert (IDE_IS_APPLICATION (self));
  g_assert (G_IS_FILE (file));

  windows = gtk_application_get_windows (GTK_APPLICATION (self));

  for (iter = windows; iter != NULL; iter = iter->next)
    {
      GtkWindow *window = iter->data;

      if (IDE_IS_WORKBENCH (window) &&
          workbench_manages_file (IDE_WORKBENCH (window), file))
        {
          ide_workbench_open_files_async (IDE_WORKBENCH (window),
                                          &file,
                                          1,
                                          hint,
                                          0,
                                          cancellable,
                                          NULL,
                                          NULL);
          return TRUE;
        }
    }

  return FALSE;
}
开发者ID:badwolfie,项目名称:gnome-builder,代码行数:35,代码来源:ide-application-open.c


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


示例10: XPLAYER_SCREENSAVER_PLUGIN

static void
impl_deactivate	(PeasActivatable *plugin)
{
	XplayerScreensaverPlugin *pi = XPLAYER_SCREENSAVER_PLUGIN (plugin);

	g_object_unref (pi->priv->settings);

	if (pi->priv->handler_id_playing != 0) {
		XplayerObject *xplayer;
		xplayer = g_object_get_data (G_OBJECT (plugin), "object");
		g_signal_handler_disconnect (G_OBJECT (xplayer), pi->priv->handler_id_playing);
		pi->priv->handler_id_playing = 0;
	}
	if (pi->priv->handler_id_metadata != 0) {
		g_signal_handler_disconnect (G_OBJECT (pi->priv->bvw), pi->priv->handler_id_metadata);
		pi->priv->handler_id_metadata = 0;
	}

	if (pi->priv->inhibit_cookie != 0) {
		gtk_application_uninhibit (GTK_APPLICATION (pi->priv->xplayer), pi->priv->inhibit_cookie);
		pi->priv->inhibit_cookie = 0;
	}

	g_object_unref (pi->priv->xplayer);
	g_object_unref (pi->priv->bvw);
}
开发者ID:JosephMcc,项目名称:xplayer,代码行数:26,代码来源:xplayer-screensaver.c


示例11: gw_window_constructed

static void 
gw_window_constructed (GObject *object)
{
    GwWindow *window;
    GwWindowPrivate *priv;
    gboolean os_shows_app_menu;
    GtkSettings *settings;

    //Chain the parent class
    {
      G_OBJECT_CLASS (gw_window_parent_class)->constructed (object);
    }

    window = GW_WINDOW (object);
    priv = window->priv;
    settings = gtk_settings_get_default ();
    g_object_get (settings, "gtk-shell-shows-app-menu", &os_shows_app_menu, NULL);
    gtk_widget_add_events (GTK_WIDGET (window), GDK_FOCUS_CHANGE_MASK);

    gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (window), FALSE);

    priv->accelgroup = gtk_accel_group_new ();
    gtk_window_add_accel_group (GTK_WINDOW (window), priv->accelgroup);
    gtk_window_set_application (GTK_WINDOW (window), GTK_APPLICATION (priv->application));
    priv->builder = gtk_builder_new ();
    gw_window_load_ui_xml (window, priv->ui_xml);
    priv->toplevel = GTK_WIDGET (gw_window_get_object (GW_WINDOW (window), "toplevel"));

    g_signal_connect (G_OBJECT (window), "configure-event", G_CALLBACK (gw_window_configure_event_cb), NULL);
    g_signal_connect (window, "focus-in-event", G_CALLBACK (gw_window_focus_in_event_cb), NULL);
}
开发者ID:kyoushuu,项目名称:gwaei,代码行数:31,代码来源:window.c


示例12: refimpl_app_startup

static void refimpl_app_startup(GApplication* application) {
    RefImplApp* app = REFIMPL_APP(application);

    G_APPLICATION_CLASS(refimpl_app_parent_class)->startup(application);

    g_action_map_add_action_entries(G_ACTION_MAP(app), app_entries, G_N_ELEMENTS(app_entries), app);

    if (refimpl_app_has_app_menu(app)) {
	GtkBuilder* builder;
	GError* error = NULL;

	builder = gtk_builder_new();
	if (!gtk_builder_add_from_resource(builder,
					   "/com/bobtacoindustries/N3888_RefImpl/refimpl_menu.ui",
					   &error)) {
	    g_warning("Loading menu builder file failed. Message: %s", error->message);
	    g_error_free(error);
	}
	else {
	    GMenuModel* appMenu;
	    appMenu = G_MENU_MODEL(gtk_builder_get_object(builder, "app_menu"));
	    gtk_application_set_app_menu(GTK_APPLICATION(application), appMenu);
	}

	g_object_unref(builder);
    }

    //setup_accelerators(app);
}
开发者ID:cristianadam,项目名称:io2d,代码行数:29,代码来源:RefImplApp.c


示例13: shell_action_new_window_cb

static void
shell_action_new_window_cb (GSimpleAction *action,
                            GVariant *parameter,
                            EShell *shell)
{
	GtkApplication *application;
	GList *list;
	const gchar *view_name;

	application = GTK_APPLICATION (shell);
	list = gtk_application_get_windows (application);

	view_name = g_variant_get_string (parameter, NULL);

	/* Present the first EShellWindow showing 'view_name'. */
	while (list != NULL) {
		GtkWindow *window = GTK_WINDOW (list->data);

		if (E_IS_SHELL_WINDOW (window)) {
			const gchar *active_view;

			active_view = e_shell_window_get_active_view (
				E_SHELL_WINDOW (window));
			if (g_strcmp0 (active_view, view_name) == 0) {
				gtk_window_present (window);
				return;
			}
		}

		list = g_list_next (list);
	}

	/* No suitable EShellWindow found, so create one. */
	e_shell_create_shell_window (shell, view_name);
}
开发者ID:UIKit0,项目名称:evolution,代码行数:35,代码来源:e-shell.c


示例14: bmd_activate

/************************************************************ APP Main Window */
static void
bmd_activate (GtkApplication *app, gpointer data)
{
	bmd_widgets *a = (bmd_widgets *) data;


	/* create a window with title, default size, icon and a box container */
	a->window = gtk_application_window_new (app);
	gtk_window_set_application (GTK_WINDOW (a->window), GTK_APPLICATION (app));
	gtk_window_set_position (GTK_WINDOW (a->window), GTK_WIN_POS_CENTER);
	gtk_window_set_title (GTK_WINDOW (a->window), "Book Management Demo");
	gtk_window_set_default_size (GTK_WINDOW (a->window), XSIZE, YSIZE);
	gtk_window_set_default_icon_from_file ("bmd_icon.png", NULL);
	a->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_container_add (GTK_CONTAINER (a->window), a->box);

	/* moved the creation of the menu to a dedicated function */
	bmd_construct_menu (app, (gpointer) a);
	a->paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
	gtk_box_pack_start (GTK_BOX (a->box), a->paned, TRUE, TRUE, 0);
	bmd_construct_editablecells (app, (gpointer) a);
	bmd_construct_imagedemo (app, (gpointer) a);

	gtk_widget_show_all (GTK_WIDGET (a->window));
}
开发者ID:mhorauer,项目名称:GTK-Demo-Examples,代码行数:26,代码来源:bmd_classicmenu.c


示例15: terminal_app_startup

static void
terminal_app_startup (GApplication *application)
{
  const GActionEntry app_menu_actions[] = {
    { "preferences", app_menu_preferences_cb,   NULL, NULL, NULL },
    { "help",        app_menu_help_cb,          NULL, NULL, NULL },
    { "about",       app_menu_about_cb,         NULL, NULL, NULL },
    { "quit",        app_menu_quit_cb,          NULL, NULL, NULL }
  };

  gs_unref_object GtkBuilder *builder;
  GError *error = NULL;

  G_APPLICATION_CLASS (terminal_app_parent_class)->startup (application);

  /* Need to set the WM class (bug #685742) */
  gdk_set_program_class("Gnome-terminal");

  g_action_map_add_action_entries (G_ACTION_MAP (application),
                                   app_menu_actions, G_N_ELEMENTS (app_menu_actions),
                                   application);

  builder = gtk_builder_new ();
  gtk_builder_add_from_resource (builder,
                                 TERMINAL_RESOURCES_PATH_PREFIX "ui/terminal-appmenu.ui",
                                 &error);
  g_assert_no_error (error);

  gtk_application_set_app_menu (GTK_APPLICATION (application),
                                G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu")));

  _terminal_debug_print (TERMINAL_DEBUG_SERVER, "Startup complete\n");
}
开发者ID:NitikaAgarwal,项目名称:gnome-terminal,代码行数:33,代码来源:terminal-app.c


示例16: create_window

static NemoWindow *
create_window (NemoApplication *application,
	       GdkScreen *screen)
{
	NemoWindow *window;
	
	g_return_val_if_fail (NEMO_IS_APPLICATION (application), NULL);
	
	window = g_object_new (NEMO_TYPE_WINDOW,
			       "screen", screen,
			       NULL);

	g_signal_connect_data (window, "delete_event",
			       G_CALLBACK (nemo_window_delete_event_callback), NULL, NULL,
			       G_CONNECT_AFTER);

	gtk_application_add_window (GTK_APPLICATION (application),
				    GTK_WINDOW (window));

	/* Do not yet show the window. It will be shown later on if it can
	 * successfully display its initial URI. Otherwise it will be destroyed
	 * without ever having seen the light of day.
	 */

	return window;
}
开发者ID:Cobinja,项目名称:nemo,代码行数:26,代码来源:nemo-application.c


示例17: create_new_desktop_window

static void
create_new_desktop_window (NemoDesktopManager *manager,
                                         gint  monitor,
                                     gboolean  primary,
                                     gboolean  show_desktop)
{
    GtkWidget *window;

    DesktopInfo *info = g_slice_new0 (DesktopInfo);

    info->monitor_num = monitor;
    info->shows_desktop = show_desktop;
    info->is_primary = primary;

    if (show_desktop) {
        window = GTK_WIDGET (nemo_desktop_window_new (monitor));
    } else {
        window = GTK_WIDGET (nemo_blank_desktop_window_new (monitor));
    }

    info->window = window;

    /* We realize it immediately so that the NEMO_DESKTOP_WINDOW_ID
       property is set so gnome-settings-daemon doesn't try to set the
       background. And we do a gdk_flush() to be sure X gets it. */

    gtk_widget_realize (GTK_WIDGET (window));
    gdk_flush ();

    gtk_application_add_window (GTK_APPLICATION (nemo_application_get_singleton ()),
                                GTK_WINDOW (window));

    manager->desktops = g_list_append (manager->desktops, info);
}
开发者ID:Seb35,项目名称:nemo,代码行数:34,代码来源:nemo-desktop-manager.c


示例18: _gedit_app_extend_menu

GeditMenuExtension *
_gedit_app_extend_menu (GeditApp    *app,
                       const gchar *extension_point)
{
	GeditAppPrivate *priv;
	GMenuModel *model;
	GMenuModel *section;

	g_return_val_if_fail (GEDIT_IS_APP (app), NULL);
	g_return_val_if_fail (extension_point != NULL, NULL);

	priv = gedit_app_get_instance_private (app);

	/* First look in the window menu */
	section = find_extension_point_section (priv->window_menu, extension_point);

	/* otherwise look in the app menu */
	if (section == NULL)
	{
		model = gtk_application_get_app_menu (GTK_APPLICATION (app));

		if (model != NULL)
		{
			section = find_extension_point_section (model, extension_point);
		}
	}

	return section != NULL ? gedit_menu_extension_new (G_MENU (section)) : NULL;
}
开发者ID:noemis13,项目名称:gedit,代码行数:29,代码来源:gedit-app.c


示例19: photos_main_window_constructed

static void
photos_main_window_constructed (GObject *object)
{
  PhotosMainWindow *self = PHOTOS_MAIN_WINDOW (object);
  GApplication *app;

  G_OBJECT_CLASS (photos_main_window_parent_class)->constructed (object);

  /* HACK: Since GtkWindow:application is a non-construct property it
   * will be set after constructed has finished. We explicitly add
   * the window to the application here before creating the rest of
   * the widget hierarchy. This ensures that we can use
   * photos_application_get_scale_factor while constructing the
   * widgets.
   */
  app = g_application_get_default ();
  gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (self));

  self->edit_cancel = g_action_map_lookup_action (G_ACTION_MAP (app), "edit-cancel");
  self->import_cancel = g_action_map_lookup_action (G_ACTION_MAP (app), "import-cancel");
  self->load_next = g_action_map_lookup_action (G_ACTION_MAP (app), "load-next");
  self->load_previous = g_action_map_lookup_action (G_ACTION_MAP (app), "load-previous");

  gtk_widget_init_template (GTK_WIDGET (self));
}
开发者ID:GNOME,项目名称:gnome-photos,代码行数:25,代码来源:photos-main-window.c


示例20: application_startup_cb

static void
application_startup_cb (GApplication       *application,
                        GnomeControlCenter *shell)
{
  GMenu *menu, *section;
  GAction *action;

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

  action = G_ACTION (g_simple_action_new ("quit", NULL));
  g_action_map_add_action (G_ACTION_MAP (application), action);
  g_signal_connect (action, "activate", G_CALLBACK (quit_activated), shell);

  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));

  /* nothing else to do here, we don't want to show a window before
   * we've looked at the commandline
   */
}
开发者ID:tigersoldier,项目名称:gnome-control-center,代码行数:30,代码来源:control-center.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_ASSISTANT函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_ALIGNMENT函数代码示例发布时间: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