From 9f7b100ca52ccc8e19a89d30fe8f2ba3083aa765 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Sat, 10 May 2014 09:45:08 +0200 Subject: [PATCH] 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 475dfafe..6dce7e97 100644 --- a/shell/ev-application.c +++ b/shell/ev-application.c @@ -937,11 +937,80 @@ app_help_cb (GSimpleAction *action, ev_application_show_help (application, NULL, NULL); } +static void +app_about_cb (GSimpleAction *action, + GVariant *parameter, + gpointer user_data) +{ + const char *authors[] = { + "Martin Kretzschmar ", + "Jonathan Blandford ", + "Marco Pesenti Gritti ", + "Nickolay V. Shmyrev ", + "Bryan Clark ", + "Carlos Garcia Campos ", + "Wouter Bolsterlee ", + "Christian Persch ", + NULL + }; + const char *documenters[] = { + "Nickolay V. Shmyrev ", + "Phil Bull ", + "Tiffany Antpolski ", + 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 bb7f0b92..174284a1 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 ", - "Jonathan Blandford ", - "Marco Pesenti Gritti ", - "Nickolay V. Shmyrev ", - "Bryan Clark ", - "Carlos Garcia Campos ", - "Wouter Bolsterlee ", - "Christian Persch ", - NULL - }; - - const char *documenters[] = { - "Nickolay V. Shmyrev ", - "Phil Bull ", - "Tiffany Antpolski ", - 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 04e0701f..9cca88b8 100644 --- a/shell/evince-appmenu.ui +++ b/shell/evince-appmenu.ui @@ -24,6 +24,10 @@ app.help F1 + + _About + app.about + diff --git a/shell/evince-ui.xml b/shell/evince-ui.xml index 97844b3d..bf84b4aa 100644 --- a/shell/evince-ui.xml +++ b/shell/evince-ui.xml @@ -26,8 +26,6 @@ - -