|
|
ad2f2b |
diff --git a/src/yelp-application.c b/src/yelp-application.c
|
|
|
ad2f2b |
index 47a69991..28638ee7 100644
|
|
|
ad2f2b |
--- a/src/yelp-application.c
|
|
|
ad2f2b |
+++ b/src/yelp-application.c
|
|
|
ad2f2b |
@@ -90,6 +90,9 @@ static void application_adjust_font (GAction *a
|
|
|
ad2f2b |
GVariant *parameter,
|
|
|
ad2f2b |
YelpApplication *app);
|
|
|
ad2f2b |
static void application_set_font_sensitivity (YelpApplication *app);
|
|
|
ad2f2b |
+static void application_quit (GAction *action,
|
|
|
ad2f2b |
+ GVariant *parameter,
|
|
|
ad2f2b |
+ YelpApplication *app);
|
|
|
ad2f2b |
|
|
|
ad2f2b |
static void bookmarks_changed (GSettings *settings,
|
|
|
ad2f2b |
const gchar *key,
|
|
|
ad2f2b |
@@ -110,6 +113,7 @@ struct _YelpApplicationPrivate {
|
|
|
ad2f2b |
GPropertyAction *show_cursor_action;
|
|
|
ad2f2b |
GSimpleAction *larger_text_action;
|
|
|
ad2f2b |
GSimpleAction *smaller_text_action;
|
|
|
ad2f2b |
+ GSimpleAction *quit_action;
|
|
|
ad2f2b |
|
|
|
ad2f2b |
GSettingsBackend *backend;
|
|
|
ad2f2b |
GSettings *gsettings;
|
|
|
ad2f2b |
@@ -200,6 +204,11 @@ yelp_application_dispose (GObject *object)
|
|
|
ad2f2b |
priv->larger_text_action = NULL;
|
|
|
ad2f2b |
}
|
|
|
ad2f2b |
|
|
|
ad2f2b |
+ if (priv->quit_action) {
|
|
|
ad2f2b |
+ g_object_unref (priv->quit_action);
|
|
|
ad2f2b |
+ priv->quit_action = NULL;
|
|
|
ad2f2b |
+ }
|
|
|
ad2f2b |
+
|
|
|
ad2f2b |
if (priv->smaller_text_action) {
|
|
|
ad2f2b |
g_object_unref (priv->smaller_text_action);
|
|
|
ad2f2b |
priv->smaller_text_action = NULL;
|
|
|
ad2f2b |
@@ -267,6 +276,7 @@ yelp_application_startup (GApplication *application)
|
|
|
ad2f2b |
GMenu *menu, *section;
|
|
|
ad2f2b |
gchar *keyfile;
|
|
|
ad2f2b |
YelpSettings *settings;
|
|
|
ad2f2b |
+ const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
|
|
|
ad2f2b |
|
|
|
ad2f2b |
g_set_application_name (N_("Help"));
|
|
|
ad2f2b |
|
|
|
ad2f2b |
@@ -316,6 +326,16 @@ yelp_application_startup (GApplication *application)
|
|
|
ad2f2b |
|
|
|
ad2f2b |
application_set_font_sensitivity (app);
|
|
|
ad2f2b |
|
|
|
ad2f2b |
+ priv->quit_action = g_simple_action_new ("yelp-application-quit", NULL);
|
|
|
ad2f2b |
+ g_signal_connect (priv->quit_action,
|
|
|
ad2f2b |
+ "activate",
|
|
|
ad2f2b |
+ G_CALLBACK (application_quit),
|
|
|
ad2f2b |
+ app);
|
|
|
ad2f2b |
+ g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (priv->quit_action));
|
|
|
ad2f2b |
+
|
|
|
ad2f2b |
+ gtk_application_set_accels_for_action (
|
|
|
ad2f2b |
+ GTK_APPLICATION (app), "app.yelp-application-quit", quit_accels);
|
|
|
ad2f2b |
+
|
|
|
ad2f2b |
menu = g_menu_new ();
|
|
|
ad2f2b |
section = g_menu_new ();
|
|
|
ad2f2b |
g_menu_append (section, _("New Window"), "win.yelp-window-new");
|
|
|
ad2f2b |
@@ -326,11 +346,23 @@ yelp_application_startup (GApplication *application)
|
|
|
ad2f2b |
g_menu_append (section, _("Smaller Text"), "app.yelp-application-smaller-text");
|
|
|
ad2f2b |
g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
|
|
|
ad2f2b |
g_object_unref (section);
|
|
|
ad2f2b |
+ section = g_menu_new ();
|
|
|
ad2f2b |
+ g_menu_append (section, _("Quit"), "app.yelp-application-quit");
|
|
|
ad2f2b |
+ g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
|
|
|
ad2f2b |
+ g_object_unref (section);
|
|
|
ad2f2b |
gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (menu));
|
|
|
ad2f2b |
}
|
|
|
ad2f2b |
|
|
|
ad2f2b |
/******************************************************************************/
|
|
|
ad2f2b |
|
|
|
ad2f2b |
+static void
|
|
|
ad2f2b |
+application_quit (GAction *action,
|
|
|
ad2f2b |
+ GVariant *parameter,
|
|
|
ad2f2b |
+ YelpApplication *app)
|
|
|
ad2f2b |
+{
|
|
|
ad2f2b |
+ g_application_quit (G_APPLICATION (app));
|
|
|
ad2f2b |
+}
|
|
|
ad2f2b |
+
|
|
|
ad2f2b |
static void
|
|
|
ad2f2b |
application_adjust_font (GAction *action,
|
|
|
ad2f2b |
GVariant *parameter,
|