[evince] shell: Move about dialog to the app menu and make it independent from the document



commit 9f7b100ca52ccc8e19a89d30fe8f2ba3083aa765
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sat May 10 09:45:08 2014 +0200

    shell: Move about dialog to the app menu and make it independent from the document

 shell/ev-application.c  |   69 +++++++++++++++++++++++++++++++++++
 shell/ev-window.c       |   93 -----------------------------------------------
 shell/evince-appmenu.ui |    4 ++
 shell/evince-ui.xml     |    2 -
 4 files changed, 73 insertions(+), 95 deletions(-)
---
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 475dfaf..6dce7e9 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -938,10 +938,79 @@ app_help_cb (GSimpleAction *action,
 }
 
 static void
+app_about_cb (GSimpleAction *action,
+              GVariant      *parameter,
+              gpointer       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>",
+                NULL
+        };
+        const char *documenters[] = {
+                "Nickolay V. Shmyrev <nshmyrev yandex ru>",
+                "Phil Bull <philbull gmail com>",
+                "Tiffany Antpolski <tiffany antopolski gmail com>",
+                NULL
+        };
+        const char *license[] = {
+                N_("Evince is free software; you can redistribute it and/or modify "
+                   "it under the terms of the GNU General Public License as published by "
+                   "the Free Software Foundation; either version 2 of the License, or "
+                   "(at your option) any later version.\n"),
+                N_("Evince is distributed in the hope that it will be useful, "
+                   "but WITHOUT ANY WARRANTY; without even the implied warranty of "
+                   "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the "
+                   "GNU General Public License for more details.\n"),
+                N_("You should have received a copy of the GNU General Public License "
+                   "along with Evince; if not, write to the Free Software Foundation, Inc., "
+                   "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA\n")
+        };
+        char *license_trans;
+#ifdef ENABLE_NLS
+        const char **p;
+
+        for (p = authors; *p; ++p)
+                *p = _(*p);
+
+        for (p = documenters; *p; ++p)
+                *p = _(*p);
+#endif
+
+        license_trans = g_strconcat (_(license[0]), "\n",
+                                     _(license[1]), "\n",
+                                     _(license[2]), "\n",
+                                     NULL);
+
+        gtk_show_about_dialog (NULL,
+                               "name", _("Evince"),
+                               "version", VERSION,
+                               "copyright", _("© 1996–2014 The Evince authors"),
+                               "license", license_trans,
+                               "website", "https://wiki.gnome.org/Apps/Evince";,
+                               "comments", _("Document Viewer"),
+                               "authors", authors,
+                               "documenters", documenters,
+                               "translator-credits", _("translator-credits"),
+                               "logo-icon-name", "evince",
+                               "wrap-license", TRUE,
+                               NULL);
+
+        g_free (license_trans);
+}
+
+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 }
         };
 
         EvApplication *application = EV_APPLICATION (gapplication);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index bb7f0b9..174284a 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -5015,96 +5015,6 @@ ev_window_dual_mode_odd_pages_left_changed_cb (EvDocumentModel *model,
                                         ev_document_model_get_dual_page_odd_pages_left (model));
 }
 
-static char *
-build_comments_string (EvDocument *document)
-{
-       gchar *comments = NULL;
-       EvDocumentBackendInfo info;
-
-       if (document && ev_document_get_backend_info (document, &info)) {
-               comments = g_strdup_printf (
-                       _("Document Viewer\nUsing %s (%s)"),
-                       info.name, info.version);
-       } else {
-               comments = g_strdup_printf (
-                       _("Document Viewer"));
-       }
-
-       return comments;
-}
-
-static void
-ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
-{
-       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>",
-               NULL
-       };
-
-       const char *documenters[] = {
-               "Nickolay V. Shmyrev <nshmyrev yandex ru>",
-               "Phil Bull <philbull gmail com>",
-               "Tiffany Antpolski <tiffany antopolski gmail com>",
-               NULL
-       };
-
-       const char *license[] = {
-               N_("Evince is free software; you can redistribute it and/or modify "
-                  "it under the terms of the GNU General Public License as published by "
-                  "the Free Software Foundation; either version 2 of the License, or "
-                  "(at your option) any later version.\n"),
-               N_("Evince is distributed in the hope that it will be useful, "
-                  "but WITHOUT ANY WARRANTY; without even the implied warranty of "
-                  "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the "
-                  "GNU General Public License for more details.\n"),
-               N_("You should have received a copy of the GNU General Public License "
-                  "along with Evince; if not, write to the Free Software Foundation, Inc., "
-                  "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA\n")
-       };
-
-       char *license_trans;
-       char *comments;
-
-#ifdef ENABLE_NLS
-       const char **p;
-
-       for (p = authors; *p; ++p)
-               *p = _(*p);
-
-       for (p = documenters; *p; ++p)
-               *p = _(*p);
-#endif
-
-       license_trans = g_strconcat (_(license[0]), "\n", _(license[1]), "\n",
-                                    _(license[2]), "\n", NULL);
-
-       comments = build_comments_string (ev_window->priv->document);
-
-       gtk_show_about_dialog (NULL,
-                              "name", _("Evince"),
-                              "version", VERSION,
-                              "copyright", _("© 1996–2014 The Evince authors"),
-                              "license", license_trans,
-                              "website", "https://wiki.gnome.org/Apps/Evince";,
-                              "comments", comments,
-                              "authors", authors,
-                              "documenters", documenters,
-                              "translator-credits", _("translator-credits"),
-                              "logo-icon-name", "evince",
-                              "wrap-license", TRUE,
-                              NULL);
-
-       g_free (comments);
-       g_free (license_trans);
-}
-
 static void
 ev_window_cmd_action_menu (GtkAction *action, EvWindow *ev_window)
 {
@@ -6105,9 +6015,6 @@ static const GtkActionEntry entries[] = {
          N_("Add a bookmark for the current page"),
          G_CALLBACK (ev_window_cmd_bookmarks_add) },
 
-       { "HelpAbout", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL,
-         G_CALLBACK (ev_window_cmd_help_about) },
-
        /* Toolbar-only */
        { "LeaveFullscreen", GTK_STOCK_LEAVE_FULLSCREEN, N_("Leave Fullscreen"), NULL,
          N_("Leave fullscreen mode"),
diff --git a/shell/evince-appmenu.ui b/shell/evince-appmenu.ui
index 04e0701..9cca88b 100644
--- a/shell/evince-appmenu.ui
+++ b/shell/evince-appmenu.ui
@@ -24,6 +24,10 @@
         <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>
 </interface>
diff --git a/shell/evince-ui.xml b/shell/evince-ui.xml
index 97844b3..bf84b4a 100644
--- a/shell/evince-ui.xml
+++ b/shell/evince-ui.xml
@@ -26,8 +26,6 @@
     </menu>
     <separator/>
     <menuitem name="FileCloseWindowMenu" action="FileCloseWindow"/>
-    <separator/>
-    <menuitem name="HelpAboutMenu" action="HelpAbout"/>
   </popup>
 
   <popup name="ViewMenuPopup" accelerators="true">


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