[evince/wip/gpoo/Retire-app-menu] shell: Remove App menu



commit 9f7d28debc10e27cb66f8d0d0ab42a53b7ea812f
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Mon Oct 8 21:45:21 2018 -0300

    shell: Remove App menu
    
    Move the items in the App Menu at the bottom of the primary
    menu.
    
    See also https://gitlab.gnome.org/GNOME/Initiatives/issues/4
    
    Fixes #994

 shell/ev-application.c | 98 ++------------------------------------------------
 shell/ev-application.h |  3 --
 shell/ev-window.c      | 89 +++++++++++++++++++++++++++++++++++++++++++++
 shell/evince-menus.ui  | 33 ++++++++---------
 4 files changed, 105 insertions(+), 118 deletions(-)
---
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 42fef8cb..b01b3fa0 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -938,73 +938,9 @@ ev_application_migrate_config_dir (EvApplication *application)
         g_free (old_accels);
 }
 
-static void
-app_help_cb (GSimpleAction *action,
-             GVariant      *parameter,
-             gpointer       user_data)
-{
-        EvApplication *application = user_data;
-
-        ev_application_show_help (application, NULL, NULL);
-}
-
-static void
-app_about_cb (GSimpleAction *action,
-              GVariant      *parameter,
-              gpointer       user_data)
-{
-        EvApplication *application = user_data;
-
-        const char *authors[] = {
-                "Martin Kretzschmar <m_kretzschmar gmx net>",
-                "Jonathan Blandford <jrb gnome org>",
-                "Marco Pesenti Gritti <marco gnome org>",
-                "Nickolay V. Shmyrev <nshmyrev yandex ru>",
-                "Bryan Clark <clarkbw gnome org>",
-                "Carlos Garcia Campos <carlosgc gnome org>",
-                "Wouter Bolsterlee <wbolster gnome org>",
-                "Christian Persch <chpe" "\100" "gnome.org>",
-                "Germán Poo-Caamaño <gpoo" "\100" "gnome.org>",
-                NULL
-        };
-        const char *documenters[] = {
-                "Nickolay V. Shmyrev <nshmyrev yandex ru>",
-                "Phil Bull <philbull gmail com>",
-                "Tiffany Antpolski <tiffany antopolski gmail com>",
-                NULL
-        };
-#ifdef ENABLE_NLS
-        const char **p;
-
-        for (p = authors; *p; ++p)
-                *p = _(*p);
-
-        for (p = documenters; *p; ++p)
-                *p = _(*p);
-#endif
-
-        gtk_show_about_dialog (gtk_application_get_active_window (GTK_APPLICATION (application)),
-                               "name", _("Evince"),
-                               "version", VERSION,
-                               "copyright", _("© 1996–2017 The Evince authors"),
-                               "license-type", GTK_LICENSE_GPL_2_0,
-                               "website", "https://wiki.gnome.org/Apps/Evince";,
-                               "comments", _("Document Viewer"),
-                               "authors", authors,
-                               "documenters", documenters,
-                               "translator-credits", _("translator-credits"),
-                               "logo-icon-name", "org.gnome.Evince",
-                               NULL);
-}
-
 static void
 ev_application_startup (GApplication *gapplication)
 {
-        const GActionEntry app_menu_actions[] = {
-                { "help", app_help_cb, NULL, NULL, NULL },
-                { "about", app_about_cb, NULL, NULL, NULL }
-        };
-
         const gchar *action_accels[] = {
           "win.open",                   "<Ctrl>O", NULL,
           "win.open-copy",              "<Ctrl>N", NULL,
@@ -1047,6 +983,8 @@ ev_application_startup (GApplication *gapplication)
           "win.reload",                 "<Ctrl>R", NULL,
           "win.add-annotation",         "s", NULL,
           "win.highlight-annotation",   "<Ctrl>H", NULL,
+          "win.help",                   "F1", NULL,
+          "win.about",                  NULL, NULL,
           NULL
         };
 
@@ -1057,10 +995,6 @@ ev_application_startup (GApplication *gapplication)
 
         G_APPLICATION_CLASS (ev_application_parent_class)->startup (gapplication);
 
-        g_action_map_add_action_entries (G_ACTION_MAP (application),
-                                         app_menu_actions, G_N_ELEMENTS (app_menu_actions),
-                                         application);
-
         for (it = action_accels; it[0]; it += g_strv_length ((gchar **)it) + 1)
                 gtk_application_set_accels_for_action (GTK_APPLICATION (application), it[0], &it[1]);
 }
@@ -1256,31 +1190,3 @@ ev_application_get_dot_dir (EvApplication *application,
 
        return application->dot_dir;
 }
-
-/**
- * ev_application_show_help:
- * @application: the #EvApplication
- * @screen: (allow-none): a #GdkScreen, or %NULL to use the default screen
- * @topic: (allow-none): the help topic, or %NULL to show the index
- *
- * Launches the help viewer on @screen to show the evince help.
- * If @topic is %NULL, shows the help index; otherwise the topic.
- */
-void
-ev_application_show_help (EvApplication *application,
-                          GdkScreen     *screen,
-                          const char    *topic)
-{
-        char *escaped_topic, *uri;
-
-        if (topic != NULL) {
-                escaped_topic = g_uri_escape_string (topic, NULL, TRUE);
-                uri = g_strdup_printf ("help:evince/%s", escaped_topic);
-                g_free (escaped_topic);
-        } else {
-                uri = g_strdup ("help:evince");
-        }
-
-        gtk_show_uri (screen, uri, gtk_get_current_event_time (), NULL);
-        g_free (uri);
-}
diff --git a/shell/ev-application.h b/shell/ev-application.h
index 7eb6a5b9..00a7a18b 100644
--- a/shell/ev-application.h
+++ b/shell/ev-application.h
@@ -70,9 +70,6 @@ GObject                *ev_application_get_media_keys      (EvApplication   *application);
 
 const gchar      *ev_application_get_dot_dir         (EvApplication   *application,
                                                       gboolean         create);
-void              ev_application_show_help           (EvApplication   *application,
-                                                      GdkScreen       *screen,
-                                                      const char      *topic);
 void              ev_application_new_window          (EvApplication *application,
                                                       GdkScreen     *screen,
                                                       guint32        timestamp);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 8faa4ed3..a1263541 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -3847,6 +3847,93 @@ ev_window_cmd_file_close_window (GSimpleAction *action,
                gtk_widget_destroy (GTK_WIDGET (ev_window));
 }
 
+/**
+ * ev_window_show_help:
+ * @window: the #EvWindow
+ * @screen: (allow-none): a #GdkScreen, or %NULL to use the default screen
+ * @topic: (allow-none): the help topic, or %NULL to show the index
+ *
+ * Launches the help viewer on @screen to show the evince help.
+ * If @topic is %NULL, shows the help index; otherwise the topic.
+ */
+static void
+ev_window_show_help (EvWindow   *window,
+                     GdkScreen  *screen,
+                     const char *topic)
+{
+        char *escaped_topic, *uri;
+
+        if (topic != NULL) {
+                escaped_topic = g_uri_escape_string (topic, NULL, TRUE);
+                uri = g_strdup_printf ("help:evince/%s", escaped_topic);
+                g_free (escaped_topic);
+        } else {
+                uri = g_strdup ("help:evince");
+        }
+
+        gtk_show_uri (screen, uri, gtk_get_current_event_time (), NULL);
+        g_free (uri);
+}
+
+static void
+ev_window_cmd_help (GSimpleAction *action,
+                   GVariant      *parameter,
+                   gpointer       user_data)
+{
+       EvWindow *ev_window = user_data;
+
+        ev_window_show_help (ev_window, NULL, NULL);
+}
+
+static void
+ev_window_cmd_about (GSimpleAction *action,
+                    GVariant      *parameter,
+                    gpointer       user_data)
+{
+       EvWindow *ev_window = user_data;
+
+        const char *authors[] = {
+                "Martin Kretzschmar <m_kretzschmar gmx net>",
+                "Jonathan Blandford <jrb gnome org>",
+                "Marco Pesenti Gritti <marco gnome org>",
+                "Nickolay V. Shmyrev <nshmyrev yandex ru>",
+                "Bryan Clark <clarkbw gnome org>",
+                "Carlos Garcia Campos <carlosgc gnome org>",
+                "Wouter Bolsterlee <wbolster gnome org>",
+                "Christian Persch <chpe" "\100" "gnome.org>",
+                "Germán Poo-Caamaño <gpoo" "\100" "gnome.org>",
+                NULL
+        };
+        const char *documenters[] = {
+                "Nickolay V. Shmyrev <nshmyrev yandex ru>",
+                "Phil Bull <philbull gmail com>",
+                "Tiffany Antpolski <tiffany antopolski gmail com>",
+                NULL
+        };
+#ifdef ENABLE_NLS
+        const char **p;
+
+        for (p = authors; *p; ++p)
+                *p = _(*p);
+
+        for (p = documenters; *p; ++p)
+                *p = _(*p);
+#endif
+
+        gtk_show_about_dialog (GTK_WINDOW (ev_window),
+                               "name", _("Evince"),
+                               "version", VERSION,
+                               "copyright", _("© 1996–2017 The Evince authors"),
+                               "license-type", GTK_LICENSE_GPL_2_0,
+                               "website", "https://wiki.gnome.org/Apps/Evince";,
+                               "comments", _("Document Viewer"),
+                               "authors", authors,
+                               "documenters", documenters,
+                               "translator-credits", _("translator-credits"),
+                               "logo-icon-name", "org.gnome.Evince",
+                               NULL);
+}
+
 static void
 ev_window_cmd_focus_page_selector (GSimpleAction *action,
                                   GVariant      *parameter,
@@ -5963,6 +6050,8 @@ static const GActionEntry actions[] = {
        { "add-annotation", NULL, NULL, "false", ev_window_cmd_add_annotation },
        { "highlight-annotation", NULL, NULL, "false", ev_window_cmd_add_highlight_annotation },
        { "toggle-edit-annots", NULL, NULL, "false", ev_window_cmd_toggle_edit_annots },
+       { "about", ev_window_cmd_about },
+       { "help", ev_window_cmd_help },
        /* Popups specific items */
        { "annotate-selected-text", ev_window_popup_cmd_annotate_selected_text },
        { "open-link", ev_window_popup_cmd_open_link },
diff --git a/shell/evince-menus.ui b/shell/evince-menus.ui
index e23174b7..9aee988c 100644
--- a/shell/evince-menus.ui
+++ b/shell/evince-menus.ui
@@ -18,24 +18,6 @@
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 -->
 <interface>
-  <menu id="app-menu">
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
-        <attribute name="action">win.show-help-overlay</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">_Help</attribute>
-        <attribute name="action">app.help</attribute>
-        <attribute name="accel">F1</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">_About</attribute>
-        <attribute name="action">app.about</attribute>
-      </item>
-    </section>
-  </menu>
-
   <menu id="action-menu">
     <section>
       <attribute name="display-hint">horizontal-buttons</attribute>
@@ -120,6 +102,19 @@
         <attribute name="label" translatable="yes">Save Current Settings as Defa_ult</attribute>
         <attribute name="action">win.save-settings</attribute>
       </item>
+      <item>
+        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
+        <attribute name="action">win.show-help-overlay</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Help</attribute>
+        <attribute name="action">win.help</attribute>
+        <attribute name="accel">F1</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_About</attribute>
+        <attribute name="action">win.about</attribute>
+      </item>
     </section>
   </menu>
 
@@ -315,4 +310,4 @@
       </item>
     </section>
   </menu>
-</interface>
\ No newline at end of file
+</interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]