~ubuntu-desktop/evince/ubuntu

« back to all changes in this revision

Viewing changes to debian/patches/traditional_menu_bar.patch

  • Committer: Jeremy Bicha
  • Date: 2016-08-07 22:26:40 UTC
  • Revision ID: jbicha@ubuntu.com-20160807222640-r56bbj5k0na1mz2o
* Merge with Debian 3.20.1-1
* Build-depend on dh-translations and run dh --with translations
* Don't break/replace apparmor-profiles-extra << 1.7.
  Ubuntu's version didn't ship the evince profile but more importantly,
  apparmor-profiles-extra 1.7 isn't in Ubuntu yet
* debian/patches/traditional_menu_bar.patch:
  - Refreshed and re-enabled F1 keyboard shortcut for help (LP: #1610742)

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
https://bugzilla.gnome.org/show_bug.cgi?id=736419
12
12
 
13
 
Index: evince-3.18.1/shell/ev-application.c
 
13
Index: evince-3.20.1/shell/ev-application.c
14
14
===================================================================
15
 
--- evince-3.18.1.orig/shell/ev-application.c
16
 
+++ evince-3.18.1/shell/ev-application.c
17
 
@@ -50,7 +50,8 @@ struct _EvApplication {
 
15
--- evince-3.20.1.orig/shell/ev-application.c
 
16
+++ evince-3.20.1/shell/ev-application.c
 
17
@@ -50,6 +50,7 @@ struct _EvApplication {
18
18
        gchar *uri;
19
19
 
20
20
        gchar *dot_dir;
21
 
-
22
 
+    GMenu *bookmarks_menu;
23
 
+    
 
21
+       GMenu *bookmarks_menu;
 
22
 
24
23
 #ifdef ENABLE_DBUS
25
24
         EvEvinceApplication *skeleton;
26
 
        EvMediaPlayerKeys *keys;
27
25
@@ -1038,6 +1039,26 @@ app_about_cb (GSimpleAction *action,
28
26
 }
29
27
 
51
49
 ev_application_startup (GApplication *gapplication)
52
50
 {
53
51
         const GActionEntry app_menu_actions[] = {
54
 
@@ -1098,11 +1119,29 @@ ev_application_startup (GApplication *ga
 
52
@@ -1097,6 +1118,25 @@ ev_application_startup (GApplication *ga
 
53
                                          app_menu_actions, G_N_ELEMENTS (app_menu_actions),
55
54
                                          application);
56
55
 
57
 
         builder = gtk_builder_new ();
58
 
-        gtk_builder_add_from_resource (builder, "/org/gnome/evince/shell/ui/menus.ui", &error);
59
 
-        g_assert_no_error (error);
60
 
 
61
 
-        gtk_application_set_app_menu (GTK_APPLICATION (application),
62
 
+        if (ev_application_has_traditional_menus (application))
63
 
+          {
64
 
+            gtk_builder_add_from_resource (builder, "/org/gnome/evince/shell/ui/traditional-menus.ui", &error);
65
 
+            g_assert_no_error (error);
66
 
+
67
 
+            gtk_application_set_menubar (GTK_APPLICATION (application),
68
 
+                                         G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
69
 
+
70
 
+            application->bookmarks_menu = G_MENU (gtk_builder_get_object (builder, "bookmarks"));
71
 
+            g_signal_connect_swapped (application, "notify::active-window",
72
 
+                                      G_CALLBACK (ev_application_update_bookmarks_menu), application);
73
 
+            ev_application_update_bookmarks_menu (application);
74
 
+          }
75
 
+        else
76
 
+        {
77
 
+           gtk_builder_add_from_resource (builder, "/org/gnome/evince/shell/ui/menus.ui", &error);
78
 
+           g_assert_no_error (error);
79
 
+
80
 
+           gtk_application_set_app_menu (GTK_APPLICATION (application),
81
 
                                       G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu")));
82
 
+               }
83
 
+               
84
 
         g_object_unref (builder);
85
 
 
 
56
+        if (ev_application_has_traditional_menus (application)) {
 
57
+                GtkBuilder *builder;
 
58
+                GError *error = NULL;
 
59
+
 
60
+                builder = gtk_builder_new ();
 
61
+                gtk_builder_add_from_resource (builder, "/org/gnome/evince/gtk/traditional-menus.ui", &error);
 
62
+                g_assert_no_error (error);
 
63
+
 
64
+                gtk_application_set_app_menu (GTK_APPLICATION (application), NULL);
 
65
+                gtk_application_set_menubar (GTK_APPLICATION (application),
 
66
+                                             G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
 
67
+
 
68
+                application->bookmarks_menu = G_MENU (gtk_builder_get_object (builder, "bookmarks"));
 
69
+                g_signal_connect_swapped (application, "notify::active-window",
 
70
+                                          G_CALLBACK (ev_application_update_bookmarks_menu), application);
 
71
+                ev_application_update_bookmarks_menu (application);
 
72
+                g_object_unref (builder);
 
73
+        }
 
74
+
86
75
         for (it = action_accels; it[0]; it += g_strv_length ((gchar **)it) + 1)
87
 
@@ -1328,3 +1367,25 @@ ev_application_show_help (EvApplication
 
76
                 gtk_application_set_accels_for_action (GTK_APPLICATION (application), it[0], &it[1]);
 
77
 }
 
78
@@ -1320,3 +1360,24 @@ ev_application_show_help (EvApplication
88
79
         gtk_show_uri (screen, uri, gtk_get_current_event_time (), NULL);
89
80
         g_free (uri);
90
81
 }
92
83
+gboolean
93
84
+ev_application_has_traditional_menus (EvApplication *application)
94
85
+{
95
 
+   GdkDisplay *display;
96
 
+   GdkScreen *screen;
97
 
+   GtkSettings *settings;
98
 
+   gboolean show_app_menu;
99
 
+   gboolean show_menubar;
100
 
+
101
 
+   g_return_val_if_fail (EV_IS_APPLICATION (application), FALSE);
102
 
+
103
 
+   display = gdk_display_get_default ();
104
 
+   screen = gdk_display_get_default_screen (display);
105
 
+   settings = gtk_settings_get_for_screen (screen);
106
 
+   g_object_get (G_OBJECT (settings),
107
 
+             "gtk-shell-shows-app-menu", &show_app_menu,
108
 
+             "gtk-shell-shows-menubar", &show_menubar,
109
 
+             NULL);
110
 
+
111
 
+   return !show_app_menu || show_menubar;
 
86
+        GdkDisplay *display;
 
87
+        GdkScreen *screen;
 
88
+        GtkSettings *settings;
 
89
+        gboolean show_app_menu;
 
90
+        gboolean show_menubar;
 
91
+
 
92
+        g_return_val_if_fail (EV_IS_APPLICATION (application), FALSE);
 
93
+
 
94
+        display = gdk_display_get_default ();
 
95
+        screen = gdk_display_get_default_screen (display);
 
96
+        settings = gtk_settings_get_for_screen (screen);
 
97
+        g_object_get (G_OBJECT (settings),
 
98
+                      "gtk-shell-shows-app-menu", &show_app_menu,
 
99
+                      "gtk-shell-shows-menubar", &show_menubar, NULL);
 
100
+
 
101
+        return !show_app_menu || show_menubar;
112
102
+}
113
 
Index: evince-3.18.1/shell/ev-application.h
 
103
Index: evince-3.20.1/shell/ev-application.h
114
104
===================================================================
115
 
--- evince-3.18.1.orig/shell/ev-application.h
116
 
+++ evince-3.18.1/shell/ev-application.h
 
105
--- evince-3.20.1.orig/shell/ev-application.h
 
106
+++ evince-3.20.1/shell/ev-application.h
117
107
@@ -75,6 +75,8 @@ void              ev_application_show_he
118
108
                                                       GdkScreen       *screen,
119
109
                                                       const char      *topic);
123
113
 G_END_DECLS
124
114
 
125
115
 #endif /* !EV_APPLICATION_H */
126
 
Index: evince-3.18.1/shell/evince.gresource.xml
 
116
Index: evince-3.20.1/shell/evince.gresource.xml.in
127
117
===================================================================
128
 
--- evince-3.18.1.orig/shell/evince.gresource.xml
129
 
+++ evince-3.18.1/shell/evince.gresource.xml
130
 
@@ -20,5 +20,6 @@
131
 
     <file alias="ui/evince.css" compressed="true">evince.css</file>
 
118
--- evince-3.20.1.orig/shell/evince.gresource.xml.in
 
119
+++ evince-3.20.1/shell/evince.gresource.xml.in
 
120
@@ -21,5 +21,6 @@
 
121
     <file alias="ui/evince.css" compressed="true">@EVINCE_CSS@</file>
132
122
     <file alias="ui/thumbnail-frame.png" compressed="true">thumbnail-frame.png</file>
133
 
     <file alias="ui/menus.ui" compressed="true" preprocess="xml-stripblanks">evince-menus.ui</file>
134
 
+    <file alias="ui/traditional-menus.ui" compressed="true" preprocess="xml-stripblanks">traditional-menus.ui</file>
 
123
     <file alias="gtk/menus.ui" compressed="true" preprocess="xml-stripblanks">evince-menus.ui</file>
 
124
+    <file alias="gtk/traditional-menus.ui" compressed="true" preprocess="xml-stripblanks">traditional-menus.ui</file>
135
125
   </gresource>
136
126
 </gresources>
137
 
Index: evince-3.18.1/shell/ev-window.c
 
127
Index: evince-3.20.1/shell/ev-window.c
138
128
===================================================================
139
 
--- evince-3.18.1.orig/shell/ev-window.c
140
 
+++ evince-3.18.1/shell/ev-window.c
 
129
--- evince-3.20.1.orig/shell/ev-window.c
 
130
+++ evince-3.20.1/shell/ev-window.c
141
131
@@ -637,6 +637,8 @@ update_chrome_visibility (EvWindow *wind
142
132
 
143
133
        set_widget_visibility (priv->toolbar, toolbar);
147
137
 }
148
138
 
149
139
 static void
150
 
@@ -7139,7 +7141,6 @@ ev_window_new (void)
 
140
@@ -7141,7 +7143,6 @@ ev_window_new (void)
151
141
        ev_window = GTK_WIDGET (g_object_new (EV_TYPE_WINDOW,
152
142
                                              "type", GTK_WINDOW_TOPLEVEL,
153
143
                                               "application", g_application_get_default (),
155
145
                                              NULL));
156
146
 
157
147
        return ev_window;
158
 
Index: evince-3.18.1/shell/Makefile.am
 
148
Index: evince-3.20.1/shell/Makefile.am
159
149
===================================================================
160
 
--- evince-3.18.1.orig/shell/Makefile.am
161
 
+++ evince-3.18.1/shell/Makefile.am
162
 
@@ -172,7 +172,8 @@ EXTRA_DIST = \
 
150
--- evince-3.20.1.orig/shell/Makefile.am
 
151
+++ evince-3.20.1/shell/Makefile.am
 
152
@@ -174,7 +174,8 @@ EXTRA_DIST = \
163
153
        evince-icon.rc \
164
 
        evince.gresource.xml \
 
154
        evince.gresource.xml.in \
165
155
        ev-gdbus.xml \
166
156
-       ev-daemon-gdbus.xml
167
157
+       ev-daemon-gdbus.xml \
168
158
+       traditional-menus.ui
169
159
 
170
 
 ev-resources.c: evince.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir=$(srcdir) --sourcedir=$(top_srcdir)/data $(srcdir)/evince.gresource.xml)
171
 
        $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir=$(srcdir) --sourcedir=$(top_srcdir)/data --generate-source --c-name ev $<
172
 
Index: evince-3.18.1/shell/traditional-menus.ui
 
160
 GRESOURCE_XML_IN_FILES = evince.gresource.xml.in
 
161
 GRESOURCE_XML_FILE = $(GRESOURCE_XML_IN_FILES:.xml.in=.xml)
 
162
Index: evince-3.20.1/shell/traditional-menus.ui
173
163
===================================================================
174
164
--- /dev/null
175
 
+++ evince-3.18.1/shell/traditional-menus.ui
176
 
@@ -0,0 +1,229 @@
 
165
+++ evince-3.20.1/shell/traditional-menus.ui
 
166
@@ -0,0 +1,234 @@
177
167
+<?xml version="1.0" encoding="UTF-8"?>
178
168
+<!--
179
169
+  Copyright © 2014 Canonical Ltd.
392
382
+      <attribute name="label" translatable="yes">_Help</attribute>
393
383
+      <section>
394
384
+        <item>
 
385
+          <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
 
386
+          <attribute name="action">win.show-help-overlay</attribute>
 
387
+        </item>
 
388
+        <item>
395
389
+          <attribute name="label" translatable="yes">_Help</attribute>
396
390
+          <attribute name="action">app.help</attribute>
 
391
+          <attribute name="accel">F1</attribute>
397
392
+        </item>
398
393
+        <item>
399
394
+          <attribute name="label" translatable="yes">_About</attribute>
403
398
+    </submenu>
404
399
+  </menu>
405
400
+</interface>
406
 
Index: evince-3.18.1/po/POTFILES.in
 
401
Index: evince-3.20.1/po/POTFILES.in
407
402
===================================================================
408
 
--- evince-3.18.1.orig/po/POTFILES.in
409
 
+++ evince-3.18.1/po/POTFILES.in
410
 
@@ -65,3 +65,4 @@ shell/ev-zoom-action.c
 
403
--- evince-3.20.1.orig/po/POTFILES.in
 
404
+++ evince-3.20.1/po/POTFILES.in
 
405
@@ -65,4 +65,5 @@ shell/ev-zoom-action.c
411
406
 shell/main.c
412
407
 [type: gettext/glade]shell/evince-menus.ui
 
408
 [type: gettext/glade]shell/help-overlay.ui
 
409
+[type: gettext/glade]shell/traditional-menus.ui
413
410
 evince.appdata.xml.in
414
 
+[type: gettext/glade]shell/traditional-menus.ui