1
From 16b27bfe1f79cbe19b8f32e035ce4a71716e1610 Mon Sep 17 00:00:00 2001
2
From: Lars Uebernickel <lars.uebernickel@canonical.com>
3
Date: Fri, 28 Feb 2014 14:42:36 +0100
4
Subject: [PATCH] Restore traditional menu bar for desktops that show it
6
https://bugzilla.gnome.org/show_bug.cgi?id=712357
8
data/ui/Makefile.am | 1 +
9
data/ui/menubar.ui | 241 +++++++++++++++++++++++++++++++++++++++++++++++++
11
shell/rb-application.c | 15 ++-
12
4 files changed, 257 insertions(+), 1 deletion(-)
13
create mode 100644 data/ui/menubar.ui
15
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
16
index cebefea..a2b89f1 100644
17
--- a/data/ui/Makefile.am
18
+++ b/data/ui/Makefile.am
26
display-page-add-menu.ui \
27
diff --git a/data/ui/menubar.ui b/data/ui/menubar.ui
29
index 0000000..3459503
31
+++ b/data/ui/menubar.ui
33
+<?xml version="1.0"?>
37
+ <attribute name="label" translatable="yes">_Music</attribute>
39
+ <attribute name="label" translatable="yes">_Add Music…</attribute>
40
+ <attribute name="action">app.library-import</attribute>
41
+ <attribute name="accel"><Ctrl>O</attribute>
44
+ <attribute name="label" translatable="yes">_Check for New Devices</attribute>
45
+ <attribute name="action">app.check-devices</attribute>
48
+ <attribute name="label" translatable="yes">_Playlist</attribute>
49
+ <link name="submenu">
52
+ <attribute name="label" translatable="yes">_New Playlist…</attribute>
53
+ <attribute name="action">app.playlist-new</attribute>
54
+ <attribute name="accel"><Ctrl>N</attribute>
57
+ <attribute name="label" translatable="yes">New _Automatic Playlist…</attribute>
58
+ <attribute name="action">app.playlist-new-auto</attribute>
61
+ <attribute name="label" translatable="yes">_Load from File…</attribute>
62
+ <attribute name="action">app.playlist-load</attribute>
65
+ <attribute name="label" translatable="yes">_Save to File…</attribute>
66
+ <attribute name="action">app.playlist-save</attribute>
67
+ <attribute name="accel"><Ctrl>S</attribute>
70
+ <attribute name="label" translatable="yes">_Edit…</attribute>
71
+ <attribute name="action">app.playlist-edit</attribute>
76
+ <attribute name="label" translatable="yes">_Delete</attribute>
77
+ <attribute name="action">app.display-page-remove</attribute>
84
+ <attribute name="label" translatable="yes">Pr_operties</attribute>
85
+ <attribute name="action">app.clipboard-properties</attribute>
90
+ <attribute name="label" translatable="yes">_Close</attribute>
91
+ <attribute name="action">app.quit</attribute>
92
+ <attribute name="accel"><Ctrl>W</attribute>
97
+ <attribute name="label" translatable="yes">_Edit</attribute>
100
+ <attribute name="label" translatable="yes">Cu_t</attribute>
101
+ <attribute name="action">app.clipboard-cut</attribute>
102
+ <attribute name="accel"><Ctrl>X</attribute>
105
+ <attribute name="label" translatable="yes">_Copy</attribute>
106
+ <attribute name="action">app.clipboard-copy</attribute>
107
+ <attribute name="accel"><Ctrl>C</attribute>
110
+ <attribute name="label" translatable="yes">_Paste</attribute>
111
+ <attribute name="action">app.clipboard-paste</attribute>
112
+ <attribute name="accel"><Ctrl>V</attribute>
117
+ <attribute name="label" translatable="yes">Select _All</attribute>
118
+ <attribute name="action">app.clipboard-select-all</attribute>
119
+ <attribute name="accel"><Ctrl>A</attribute>
122
+ <attribute name="label" translatable="yes">D_eselect All</attribute>
123
+ <attribute name="action">app.clipboard-select-none</attribute>
124
+ <attribute name="accel"><Ctrl><Shift>A</attribute>
129
+ <attribute name="label" translatable="yes">Add _to Play Queue</attribute>
130
+ <attribute name="action">app.clipboard-add-to-queue</attribute>
133
+ <attribute name="label" translatable="yes">Add to _Playlist</attribute>
134
+ <link name="submenu">
136
+ <attribute name="label" translatable="yes">_New Playlist</attribute>
137
+ <attribute name="action">app.playlist-add-to-new</attribute>
144
+ <attribute name="label" translatable="yes">_Move to Trash</attribute>
145
+ <attribute name="action">app.clipboard-trash</attribute>
150
+ <attribute name="label" translatable="yes">Prefere_nces</attribute>
151
+ <attribute name="action">app.preferences</attribute>
156
+ <attribute name="label" translatable="yes">_View</attribute>
159
+ <attribute name="label" translatable="yes">Party _Mode</attribute>
160
+ <attribute name="action">win.party-mode</attribute>
161
+ <attribute name="accel">F11</attribute>
166
+ <attribute name="label" translatable="yes">Side _Pane</attribute>
167
+ <attribute name="action">win.display-page-tree-visible</attribute>
168
+ <attribute name="accel">F9</attribute>
171
+ <attribute name="label" translatable="yes">View _Queue as Side Pane</attribute>
172
+ <attribute name="action">win.queue-as-sidebar</attribute>
173
+ <attribute name="accel"><Ctrl>K</attribute>
176
+ <attribute name="label" translatable="yes">S_tatusbar</attribute>
177
+ <attribute name="action">win.statusbar-visible</attribute>
180
+ <attribute name="label" translatable="yes">_Song Position Slider</attribute>
181
+ <attribute name="action">win.show-song-position-slider</attribute>
184
+ <attribute name="label" translatable="yes">_Album Art</attribute>
185
+ <attribute name="action">win.show-album-art</attribute>
190
+ <attribute name="label" translatable="yes">_Jump to Playing Song</attribute>
191
+ <attribute name="action">win.jump-to-playing</attribute>
192
+ <attribute name="accel"><Ctrl>J</attribute>
196
+ <attribute name="rb-plugin-menu-link">view</attribute>
200
+ <attribute name="label" translatable="yes">_Control</attribute>
203
+ <attribute name="label" translatable="yes">_Play</attribute>
204
+ <attribute name="action">app.play</attribute>
205
+ <attribute name="accel"><Ctrl>space</attribute>
210
+ <attribute name="label" translatable="yes">Pre_vious</attribute>
211
+ <attribute name="action">app.play-previous</attribute>
212
+ <attribute name="accel"><Alt>Left</attribute>
215
+ <attribute name="label" translatable="yes">_Next</attribute>
216
+ <attribute name="action">app.play-next</attribute>
217
+ <attribute name="accel"><Alt>Right</attribute>
222
+ <attribute name="label" translatable="yes">_Increase Volume</attribute>
223
+ <attribute name="action">app.volume-up</attribute>
224
+ <attribute name="accel"><Ctrl>Up</attribute>
227
+ <attribute name="label" translatable="yes">_Decrease Volume</attribute>
228
+ <attribute name="action">app.volume-down</attribute>
229
+ <attribute name="accel"><Ctrl>Down</attribute>
234
+ <attribute name="label" translatable="yes">Sh_uffle</attribute>
235
+ <attribute name="action">app.play-shuffle</attribute>
236
+ <attribute name="accel"><Ctrl>U</attribute>
239
+ <attribute name="label" translatable="yes">_Repeat</attribute>
240
+ <attribute name="action">app.play-repeat</attribute>
241
+ <attribute name="accel"><Ctrl>R</attribute>
246
+ <attribute name="label" translatable="yes">_Tools</attribute>
248
+ <attribute name="rb-plugin-menu-link">tools</attribute>
252
+ <attribute name="label" translatable="yes">Plu_gins…</attribute>
253
+ <attribute name="action">app.plugins</attribute>
258
+ <attribute name="label" translatable="yes">_Help</attribute>
261
+ <attribute name="label" translatable="yes">_Contents</attribute>
262
+ <attribute name="action">app.help</attribute>
263
+ <attribute name="accel">F1</attribute>
266
+ <attribute name="label" translatable="yes">_About</attribute>
267
+ <attribute name="action">app.about</attribute>
274
diff --git a/po/POTFILES.in b/po/POTFILES.in
275
index 15d5d81..b6123c5 100644
278
@@ -7,6 +7,7 @@ data/playlists.xml.in
279
data/rhythmbox.desktop.in.in
280
data/rhythmbox-device.desktop.in.in
281
[type: gettext/glade]data/ui/app-menu.ui
282
+[type: gettext/glade]data/ui/menubar.ui
283
[type: gettext/glade]data/ui/browser-popup.ui
284
[type: gettext/glade]data/ui/create-playlist.ui
285
[type: gettext/glade]data/ui/display-page-add-menu.ui
286
diff --git a/shell/rb-application.c b/shell/rb-application.c
287
index 11945ad..c57822c 100644
288
--- a/shell/rb-application.c
289
+++ b/shell/rb-application.c
290
@@ -332,6 +332,7 @@ impl_startup (GApplication *app)
292
RBApplication *rb = RB_APPLICATION (app);
293
gboolean shell_shows_app_menu;
294
+ gboolean shell_shows_menubar;
297
GtkCssProvider *provider;
298
@@ -361,6 +362,7 @@ impl_startup (GApplication *app)
300
g_object_get (gtk_settings_get_default (),
301
"gtk-shell-shows-app-menu", &shell_shows_app_menu,
302
+ "gtk-shell-shows-menubar", &shell_shows_menubar,
305
builder = rb_builder_load ("app-menu.ui", NULL);
306
@@ -371,9 +373,20 @@ impl_startup (GApplication *app)
307
/* only set the app menu if the shell shows it; otherwise, we'll
308
* stick a menu button in the toolbar.
310
- if (shell_shows_app_menu) {
311
+ if (shell_shows_app_menu && !shell_shows_menubar) {
312
gtk_application_set_app_menu (GTK_APPLICATION (app), menu);
314
+ else if (!shell_shows_app_menu || shell_shows_menubar) {
315
+ GtkBuilder *menubar_builder;
316
+ GMenuModel *menubar;
318
+ menubar_builder = rb_builder_load ("menubar.ui", NULL);
319
+ menubar = G_MENU_MODEL (gtk_builder_get_object (menubar_builder, "menubar"));
320
+ rb_application_link_shared_menus (rb, G_MENU (menubar));
321
+ gtk_application_set_menubar (GTK_APPLICATION (app), menubar);
323
+ g_object_unref (menubar_builder);
326
g_object_unref (builder);