Merge lp:~larsu/nautilus/add-menubar-patch into lp:~ubuntu-desktop/nautilus/ubuntu

Proposed by Lars Karlitski
Status: Merged
Merged at revision: 422
Proposed branch: lp:~larsu/nautilus/add-menubar-patch
Merge into: lp:~ubuntu-desktop/nautilus/ubuntu
Diff against target: 593 lines (+578/-0)
2 files modified
debian/patches/restore-traditional-menu-bar.patch (+577/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~larsu/nautilus/add-menubar-patch
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email: mp+208429@code.launchpad.net

Commit message

Add restore-traditional-menu-bar.patch

Description of the change

Add restore-traditional-menu-bar.patch

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the work, that works nicely here!

Looking at the layout suggested in the linked bugs I've some questions/comments (I know some actions are missing which makes more difficult to add some of the items, it's fine to do without those)

- the bug description has "Edit" with the "selection section" before the "copy/cut/paste" one, the patch has the order reversed. Looking to gedit and some other apps, it seems the norm is to do what the patch is doing, let's keep it this way

- same for the view menu, let's keep the zoom at the bottom (eog does it as well)

- can we have the "view as icon/list" added?

- bookmark isn't listing the actual bookmarks, is that a bug or one of those items that would be more work to add with the current codebase/structure?

- the "go" menu is missing, same question ... technical reason or overlook? ;-)

review: Needs Information
lp:~larsu/nautilus/add-menubar-patch updated
423. By Lars Karlitski

restore menubar patch: rearrange View and add Go menu

Revision history for this message
Lars Karlitski (larsu) wrote :

> - the bug description has "Edit" with the "selection section" before the
> "copy/cut/paste" one, the patch has the order reversed. Looking to gedit and
> some other apps, it seems the norm is to do what the patch is doing, let's
> keep it this way
>
> - same for the view menu, let's keep the zoom at the bottom (eog does it as
> well)

I agree.

> - can we have the "view as icon/list" added?

Added in r423

> - bookmark isn't listing the actual bookmarks, is that a bug or one of those
> items that would be more work to add with the current codebase/structure?
>
> - the "go" menu is missing, same question ... technical reason or overlook?

Overlooked it. I've added it in r423. However, I'm not sure I like "Enter Location..." and "Search..." as menu items, because they only change the window's UI instead of opening a dialog. They are still helping discoverability, especially of the keyboard accels.

Did you want to change the Help menu to only contain "Contents" and "About"?

Revision history for this message
Lars Karlitski (larsu) wrote :

Oops, forgot to reply about that one:

> - bookmark isn't listing the actual bookmarks, is that a bug or one of those
> items that would be more work to add with the current codebase/structure?

It would indeed be a bit more work, as the bookmark list to menu item stuff has been completely removed and the remaining bookmark functionality refactored. Probably a day's worth of work to stitch it back together.

I think not having the bookmarks in the menu is worse than not having the menu at all. So I think we should either remove the menu completely or fix it properly.

Revision history for this message
Sebastien Bacher (seb128) wrote :

> However, I'm not sure I like "Enter Location..." and "Search..." as menu items, because they only change the window's UI instead of opening a dialog. They are still helping discoverability

I've no strong opinion, if they were there before let's just keep them, we never got complain (or check with mpt/a designer?)

> Did you want to change the Help menu to only contain "Contents" and "About"?

I've no strong opinion, seems like we had several items in precise so let's keep it the way it is in the current version, that should be good enough

> I think not having the bookmarks in the menu is worse than not having the menu at all. So I think we should either remove the menu completely or fix it properly.

I don't think I agree with the first statement, it helps discoverability and it's the only UI way to add a bookmark I think? You also can access the list from the editor, so even without the complete list it's still useful. Having the items listed would be nicer but I think we should register that as a bugfix and put in the queue and see if we get to it before release

Revision history for this message
Sebastien Bacher (seb128) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'debian/patches/restore-traditional-menu-bar.patch'
--- debian/patches/restore-traditional-menu-bar.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/restore-traditional-menu-bar.patch 2014-02-27 12:36:46 +0000
@@ -0,0 +1,577 @@
1From 8fb2f4ad90992b0df7849202f13f1cd5d9bbcb5b Mon Sep 17 00:00:00 2001
2From: Lars Uebernickel <lars@uebernic.de>
3Date: Thu, 27 Feb 2014 13:34:43 +0100
4Subject: [PATCH] Restore traditional menu bar
5
6This is probably only useful for Unity, as it relies on unity-gtk-module
7exporting the GtkMenu.
8---
9 src/nautilus-application.c | 38 +++++++++++-----
10 src/nautilus-canvas-view-ui.xml | 19 ++++++++
11 src/nautilus-directory-view-ui.xml | 79 ++++++++++++++++++++++++++++++++
12 src/nautilus-list-view-ui.xml | 7 +++
13 src/nautilus-shell-ui.xml | 92 ++++++++++++++++++++++++++++++++++++++
14 src/nautilus-toolbar.c | 64 +++++++++++++++-----------
15 src/nautilus-window-menus.c | 56 ++++++++++++-----------
16 src/nautilus-window-private.h | 3 +-
17 src/nautilus-window.c | 10 +++--
18 9 files changed, 299 insertions(+), 69 deletions(-)
19
20diff --git a/src/nautilus-application.c b/src/nautilus-application.c
21index 21b22cf..ab8aace 100644
22--- a/src/nautilus-application.c
23+++ b/src/nautilus-application.c
24@@ -1010,8 +1010,8 @@ static GActionEntry app_entries[] = {
25 static void
26 nautilus_application_init_actions (NautilusApplication *self)
27 {
28- GtkBuilder *builder;
29- GError *error = NULL;
30+ gboolean show_app_menu;
31+ gboolean show_menubar;
32 const gchar *debug_no_app_menu;
33
34 g_action_map_add_action_entries (G_ACTION_MAP (self),
35@@ -1019,18 +1019,32 @@ nautilus_application_init_actions (NautilusApplication *self)
36 self);
37 gtk_application_add_accelerator (GTK_APPLICATION (self), "F10", "win.gear-menu", NULL);
38
39- builder = gtk_builder_new ();
40- gtk_builder_add_from_resource (builder, "/org/gnome/nautilus/nautilus-app-menu.ui", &error);
41+ g_object_get (gtk_settings_get_default (),
42+ "gtk-shell-shows-app-menu", &show_app_menu,
43+ "gtk-shell-shows-menubar", &show_menubar,
44+ NULL);
45
46- if (error == NULL) {
47- gtk_application_set_app_menu (GTK_APPLICATION (self),
48- G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
49- } else {
50- g_critical ("Unable to add the application menu: %s\n", error->message);
51- g_error_free (error);
52- }
53+ /* Only add the app menu when the shell doesn't show the menu
54+ * bar, because we merge the app menu into the menu bar.
55+ */
56+ if (show_app_menu && !show_menubar) {
57+ GtkBuilder *builder;
58+ GError *error = NULL;
59
60- g_object_unref (builder);
61+ builder = gtk_builder_new ();
62+ gtk_builder_add_from_resource (builder, "/org/gnome/nautilus/nautilus-app-menu.ui", &error);
63+
64+ if (error == NULL) {
65+
66+ gtk_application_set_app_menu (GTK_APPLICATION (self),
67+ G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
68+ } else {
69+ g_critical ("Unable to add the application menu: %s\n", error->message);
70+ g_error_free (error);
71+ }
72+
73+ g_object_unref (builder);
74+ }
75
76 debug_no_app_menu = g_getenv ("NAUTILUS_DEBUG_NO_APP_MENU");
77 if (debug_no_app_menu) {
78diff --git a/src/nautilus-canvas-view-ui.xml b/src/nautilus-canvas-view-ui.xml
79index 4ead416..14f407d 100644
80--- a/src/nautilus-canvas-view-ui.xml
81+++ b/src/nautilus-canvas-view-ui.xml
82@@ -1,4 +1,23 @@
83 <ui>
84+ <menubar name="menubar">
85+ <menu action="View">
86+ <placeholder name="View Items Placeholder">
87+ <placeholder action="Arrange Items">
88+ <menuitem name="Manual Layout" action="Manual Layout"/>
89+ <placeholder name="Auto Layout">
90+ <menuitem name="Sort by Name" action="Sort by Name"/>
91+ <menuitem name="Sort by Size" action="Sort by Size"/>
92+ <menuitem name="Sort by Type" action="Sort by Type"/>
93+ <menuitem name="Sort by Modification Date" action="Sort by Modification Date"/>
94+ <menuitem name="Sort by Trash Time" action="Sort by Trash Time"/>
95+ </placeholder>
96+ <separator name="Layout separator"/>
97+ <menuitem name="Reversed Order" action="Reversed Order"/>
98+ </placeholder>
99+ <menuitem name="Keep Aligned" action="Keep Aligned"/>
100+ </placeholder>
101+ </menu>
102+ </menubar>
103 <popup name="ViewMenu" accelerators="true">
104 <placeholder name="Layout Options">
105 <menuitem name="Manual Layout" action="Manual Layout"/>
106diff --git a/src/nautilus-directory-view-ui.xml b/src/nautilus-directory-view-ui.xml
107index 0f06fc6..64a9fc6 100644
108--- a/src/nautilus-directory-view-ui.xml
109+++ b/src/nautilus-directory-view-ui.xml
110@@ -4,6 +4,85 @@
111 <accelerator action="OpenCloseParent"/>
112 <accelerator action="PropertiesAccel"/>
113 <accelerator action="RenameSelectAll"/>
114+<menubar name="menubar">
115+ <menu action="File">
116+ <placeholder name="New Items Placeholder">
117+ <menuitem name="New Folder" action="New Folder"/>
118+ <menuitem name="New Folder with Selection" action="New Folder with Selection"/>
119+ <menu action="New Documents">
120+ <placeholder name="New Documents Placeholder"/>
121+ <separator name="After New Documents"/>
122+ </menu>
123+ </placeholder>
124+ <placeholder name="Open Placeholder">
125+ <menuitem name="Open" action="Open"/>
126+ <menuitem name="OpenInNewTab" action="OpenInNewTab"/>
127+ <menuitem name="OpenAlternate" action="OpenAlternate"/>
128+ <placeholder name="Applications Placeholder">
129+ </placeholder>
130+ <menu action="Open With">
131+ <placeholder name="Applications Placeholder"/>
132+ <separator name="Open With Separator"/>
133+ <menuitem name="OtherApplication" action="OtherApplication1"/>
134+ </menu>
135+ <placeholder name="OtherApplicationPlaceholder">
136+ <menuitem name="OtherApplication" action="OtherApplication2"/>
137+ </placeholder>
138+ <menu action="Scripts">
139+ <placeholder name="Scripts Placeholder"/>
140+ <separator name="After Scripts"/>
141+ <menuitem name="Open Scripts Folder" action="Open Scripts Folder"/>
142+ </menu>
143+ </placeholder>
144+ <placeholder name="File Items Placeholder">
145+ <menuitem name="Self Mount Volume" action="Self Mount Volume"/>
146+ <menuitem name="Self Unmount Volume" action="Self Unmount Volume"/>
147+ <menuitem name="Self Eject Volume" action="Self Eject Volume"/>
148+ <menuitem name="Self Start Volume" action="Self Start Volume"/>
149+ <menuitem name="Self Stop Volume" action="Self Stop Volume"/>
150+ <menuitem name="Self Poll" action="Self Poll"/>
151+ <separator name="Properties Separator"/>
152+ <menuitem name="Properties" action="Properties"/>
153+ </placeholder>
154+ <placeholder name="Global File Items Placeholder">
155+ <menuitem name="Empty Trash" action="Empty Trash"/>
156+ <menuitem name="Save Search" action="Save Search"/>
157+ <menuitem name="Save Search As" action="Save Search As"/>
158+ </placeholder>
159+ </menu>
160+ <menu action="Edit">
161+ <placeholder name="Clipboard Actions">
162+ <menuitem name="Cut" action="Cut"/>
163+ <menuitem name="Copy" action="Copy"/>
164+ <menuitem name="Paste" action="Paste"/>
165+ </placeholder>
166+ <placeholder name="Undostack Actions">
167+ <menuitem name="Undo" action="Undo"/>
168+ <menuitem name="Redo" action="Redo"/>
169+ </placeholder>
170+ <placeholder name="Select Items">
171+ <menuitem name="Select All" action="Select All"/>
172+ <menuitem name="Select Pattern" action="Select Pattern"/>
173+ <menuitem name="Invert Selection" action="Invert Selection"/>
174+ </placeholder>
175+ <placeholder name="File Items Placeholder">
176+ <menuitem name="Create Link" action="Create Link"/>
177+ <menuitem name="Rename" action="Rename"/>
178+ </placeholder>
179+ <placeholder name="Dangerous File Items Placeholder">
180+ <menuitem name="Trash" action="Trash"/>
181+ <menuitem name="Delete" action="Delete"/>
182+ <menuitem name="Restore From Trash" action="Restore From Trash"/>
183+ </placeholder>
184+ <placeholder name="Extension Actions"/>
185+ </menu>
186+ <menu action="View">
187+ <placeholder name="View Preferences Placeholder">
188+ <menuitem name="Reset to Defaults" action="Reset to Defaults"/>
189+ <menuitem name="Show Hidden Files" action="Show Hidden Files"/>
190+ </placeholder>
191+ </menu>
192+</menubar>
193 <popup name="ViewMenu" accelerators="true">
194 <placeholder name="View Details">
195 <menuitem name="Reset to Defaults" action="Reset to Defaults"/>
196diff --git a/src/nautilus-list-view-ui.xml b/src/nautilus-list-view-ui.xml
197index 20f336d..45d21dc 100644
198--- a/src/nautilus-list-view-ui.xml
199+++ b/src/nautilus-list-view-ui.xml
200@@ -1,4 +1,11 @@
201 <ui>
202+ <menubar name="menubar">
203+ <menu action="View">
204+ <placeholder name="View Items Placeholder">
205+ <menuitem name="Visible Columns" action="Visible Columns"/>
206+ </placeholder>
207+ </menu>
208+ </menubar>
209 <popup name="ViewMenu" accelerators="true">
210 <placeholder name="View Details">
211 <menuitem name="Visible Columns" action="Visible Columns"/>
212diff --git a/src/nautilus-shell-ui.xml b/src/nautilus-shell-ui.xml
213index 53f8022..280ce9e 100644
214--- a/src/nautilus-shell-ui.xml
215+++ b/src/nautilus-shell-ui.xml
216@@ -91,4 +91,96 @@
217 <separator/>
218 <placeholder name="After Zoom Items"/>
219 </popup>
220+<menubar name="menubar">
221+ <menu action="File">
222+ <placeholder name="New Items Placeholder">
223+ <menuitem name="New Window" action="New Window"/>
224+ <menuitem name="New Tab" action="New Tab"/>
225+ </placeholder>
226+ <separator/>
227+ <placeholder name="Open Placeholder"/>
228+ <separator/>
229+ <placeholder name="Location Placeholder"/>
230+ <menuitem name="Connect to Server" action="Connect to Server"/>
231+ <separator/>
232+ <placeholder name="File Items Placeholder"/>
233+ <separator/>
234+ <placeholder name="Global File Items Placeholder"/>
235+ <separator/>
236+ <placeholder name="Extension Actions"/>
237+ <separator/>
238+ <menuitem name="Close" action="Close"/>
239+ <placeholder name="Close Items Placeholder">
240+ <menuitem name="Close All Windows" action="Close All Windows"/>
241+ </placeholder>
242+ </menu>
243+ <menu action="Edit">
244+ <placeholder name="Undostack Actions"/>
245+ <separator/>
246+ <placeholder name="Clipboard Actions">
247+ </placeholder>
248+ <separator/>
249+ <placeholder name="Select Items"/>
250+ <separator/>
251+ <placeholder name="File Items Placeholder"/>
252+ <separator/>
253+ <placeholder name="Dangerous File Items Placeholder"/>
254+ <separator/>
255+ <placeholder name="Edit Items Placeholder"/>
256+ <placeholder name="Global Edit Items Placeholder"/>
257+ <separator/>
258+ <placeholder name="Extension Actions"/>
259+ <separator/>
260+ <menuitem name="Preferences" action="Preferences"/>
261+ </menu>
262+ <menu action="View">
263+ <menuitem name="Stop" action="Stop"/>
264+ <menuitem name="Reload" action="Reload"/>
265+ <separator/>
266+ <menuitem name="View List" action="View List" />
267+ <menuitem name="View Grid" action="View Grid" />
268+ <separator />
269+ <placeholder name="View Items Placeholder"/>
270+ <separator/>
271+ <placeholder name="View Preferences Placeholder"/>
272+ <separator/>
273+ <menuitem name="Show Hide Sidebar" action="Show Hide Sidebar"/>
274+ <separator/>
275+ <placeholder name="Zoom Items Placeholder">
276+ <menuitem name="Zoom In" action="Zoom In"/>
277+ <menuitem name="Zoom Out" action="Zoom Out"/>
278+ <menuitem name="Zoom Normal" action="Zoom Normal"/>
279+ </placeholder>
280+ <placeholder name="View Choices">
281+ <separator name="Before Short List"/>
282+ <placeholder name="Short List"/>
283+ </placeholder>
284+ </menu>
285+ <menu action="Go">
286+ <menuitem name="Up" action="Up" />
287+ <menuitem name="Back" action="Back" />
288+ <menuitem name="Forward" action="Forward" />
289+ <separator />
290+ <menuitem name="Enter Location" action="Enter Location" />
291+ <menuitem name="Find" action="Search" />
292+ </menu>
293+ <placeholder name="Other Menus">
294+ <menu action="Bookmarks">
295+ <menuitem name="Add Bookmark" action="Add Bookmark"/>
296+ <menuitem name="Edit Bookmark" action="Edit Bookmarks"/>
297+ <separator/>
298+ <placeholder name="Bookmarks Placeholder"/>
299+ </menu>
300+
301+ </placeholder>
302+ <menu action="Help">
303+ <menuitem action="NautilusHelp"/>
304+ <menuitem action="NautilusHelpSearch"/>
305+ <menuitem action="NautilusHelpSort"/>
306+ <menuitem action="NautilusHelpLost"/>
307+ <menuitem action="NautilusHelpShare"/>
308+ <separator/>
309+ <menuitem name="About Nautilus" action="About Nautilus"/>
310+ </menu>
311+</menubar>
312 </ui>
313diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
314index d44ba37..0732879 100644
315--- a/src/nautilus-toolbar.c
316+++ b/src/nautilus-toolbar.c
317@@ -388,6 +388,18 @@ close_button_clicked (GtkButton *button,
318 gtk_window_close (GTK_WINDOW (self->priv->window));
319 }
320
321+static gboolean
322+nautilus_toolbar_show_menu_buttons ()
323+{
324+ gboolean show_menubar;
325+
326+ g_object_get (gtk_settings_get_default (),
327+ "gtk-shell-shows-menubar", &show_menubar,
328+ NULL);
329+
330+ return !show_menubar;
331+}
332+
333 static void
334 nautilus_toolbar_constructed (GObject *obj)
335 {
336@@ -471,19 +483,6 @@ nautilus_toolbar_constructed (GObject *obj)
337
338 /* View buttons */
339 box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
340-
341- button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_VIEW_LIST, NULL);
342- gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
343- gtk_container_add (GTK_CONTAINER (box), button);
344- button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_VIEW_GRID, NULL);
345- gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
346- gtk_container_add (GTK_CONTAINER (box), button);
347- button = toolbar_create_toolbutton (self, TRUE, FALSE, "go-down-symbolic", _("View options"));
348- gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
349- gtk_container_add (GTK_CONTAINER (box), button);
350- menu = gtk_ui_manager_get_widget (ui_manager, "/ViewMenu");
351- gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu);
352-
353 gtk_style_context_add_class (gtk_widget_get_style_context (box),
354 GTK_STYLE_CLASS_RAISED);
355 gtk_style_context_add_class (gtk_widget_get_style_context (box),
356@@ -496,20 +495,35 @@ nautilus_toolbar_constructed (GObject *obj)
357 gtk_widget_set_margin_left (box, 6);
358 }
359
360- /* Action Menu */
361- button = toolbar_create_toolbutton (self, TRUE, FALSE, "emblem-system-symbolic", _("Location options"));
362+ button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_VIEW_LIST, NULL);
363+ gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
364+ gtk_container_add (GTK_CONTAINER (box), button);
365+ button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_VIEW_GRID, NULL);
366 gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
367- menu = gtk_ui_manager_get_widget (ui_manager, "/ActionMenu");
368- gtk_widget_set_halign (menu, GTK_ALIGN_END);
369- gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu);
370- gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.gear-menu");
371- g_signal_connect (menu, "key-press-event", G_CALLBACK (gear_menu_key_press), self);
372+ gtk_container_add (GTK_CONTAINER (box), button);
373
374- gtk_container_add (GTK_CONTAINER (toolbar), button);
375- if (rtl) {
376- gtk_widget_set_margin_right (button, 6);
377- } else {
378- gtk_widget_set_margin_left (button, 6);
379+ if (nautilus_toolbar_show_menu_buttons ()) {
380+ button = toolbar_create_toolbutton (self, TRUE, FALSE, "go-down-symbolic", _("View options"));
381+ gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
382+ gtk_container_add (GTK_CONTAINER (box), button);
383+ menu = gtk_ui_manager_get_widget (ui_manager, "/ViewMenu");
384+ gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu);
385+
386+ /* Action Menu */
387+ button = toolbar_create_toolbutton (self, TRUE, FALSE, "emblem-system-symbolic", _("Location options"));
388+ gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
389+ menu = gtk_ui_manager_get_widget (ui_manager, "/ActionMenu");
390+ gtk_widget_set_halign (menu, GTK_ALIGN_END);
391+ gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu);
392+ gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.gear-menu");
393+ g_signal_connect (menu, "key-press-event", G_CALLBACK (gear_menu_key_press), self);
394+
395+ gtk_container_add (GTK_CONTAINER (toolbar), button);
396+ if (rtl) {
397+ gtk_widget_set_margin_right (button, 6);
398+ } else {
399+ gtk_widget_set_margin_left (button, 6);
400+ }
401 }
402
403 /* Separator and Close */
404diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
405index ae14fc2..ae27d47 100644
406--- a/src/nautilus-window-menus.c
407+++ b/src/nautilus-window-menus.c
408@@ -466,6 +466,11 @@ action_view_radio_changed (GtkRadioAction *action,
409 }
410
411 static const GtkActionEntry main_entries[] = {
412+ /* name, stock id, label */ { "File", NULL, N_("_File") },
413+ /* name, stock id, label */ { "Edit", NULL, N_("_Edit") },
414+ /* name, stock id, label */ { "View", NULL, N_("_View") },
415+ /* name, stock id, label */ { "Go", NULL, N_("Go") },
416+ /* name, stock id, label */ { "Bookmarks", NULL, N_("Bookmarks") },
417 /* name, stock id, label */ { "Help", NULL, N_("_Help") },
418 /* name, stock id */ { NAUTILUS_ACTION_CLOSE, NULL,
419 /* label, accelerator */ N_("_Close"), "<control>W",
420@@ -621,7 +626,7 @@ static const GtkToggleActionEntry main_toggle_entries[] = {
421 static const GtkRadioActionEntry view_radio_entries[] = {
422 { NAUTILUS_ACTION_VIEW_LIST, "view-list-symbolic", N_("List"),
423 "<control>1", N_("View items as a list"), 0 },
424- { NAUTILUS_ACTION_VIEW_GRID, "view-grid-symbolic", N_("List"),
425+ { NAUTILUS_ACTION_VIEW_GRID, "view-grid-symbolic", N_("Grid"),
426 "<control>2", N_("View items as a grid of icons"), 1 }
427 };
428
429@@ -665,24 +670,17 @@ nautilus_window_initialize_actions (NautilusWindow *window)
430 }
431
432 static void
433-nautilus_window_menus_set_visibility_for_app_menu (NautilusWindow *window)
434+nautilus_window_menus_hide_app_actions (NautilusWindow *window)
435 {
436 const gchar *action_name;
437- gboolean shows_app_menu;
438- GtkSettings *settings;
439 GtkAction *action;
440 gint idx;
441
442- settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)));
443- g_object_get (settings,
444- "gtk-shell-shows-app-menu", &shows_app_menu,
445- NULL);
446-
447 for (idx = 0; idx < G_N_ELEMENTS (app_actions); idx++) {
448 action_name = app_actions[idx];
449 action = gtk_action_group_get_action (window->details->main_action_group, action_name);
450
451- gtk_action_set_visible (action, !shows_app_menu);
452+ gtk_action_set_visible (action, FALSE);
453 }
454 }
455
456@@ -691,14 +689,19 @@ nautilus_window_menus_set_visibility_for_app_menu (NautilusWindow *window)
457 *
458 * Create and install the set of menus for this window.
459 * @window: A recently-created NautilusWindow.
460+ *
461+ * Returns: (allow-none): the menubar to be installed on the main
462+ * window, or %NULL
463 */
464-void
465+GtkWidget *
466 nautilus_window_initialize_menus (NautilusWindow *window)
467 {
468 GtkActionGroup *action_group;
469 GtkUIManager *ui_manager;
470 GtkAction *action;
471 gint i;
472+ gboolean show_app_menu;
473+ gboolean show_menubar;
474
475 window->details->ui_manager = gtk_ui_manager_new ();
476 ui_manager = window->details->ui_manager;
477@@ -718,12 +721,6 @@ nautilus_window_initialize_menus (NautilusWindow *window)
478 -1, G_CALLBACK (action_view_radio_changed),
479 window);
480
481- nautilus_window_menus_set_visibility_for_app_menu (window);
482- window->details->app_menu_visibility_id =
483- g_signal_connect_swapped (gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window))),
484- "notify::gtk-shell-shows-app-menu",
485- G_CALLBACK (nautilus_window_menus_set_visibility_for_app_menu), window);
486-
487 action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_UP);
488 g_object_set (action, "short_label", _("_Up"), NULL);
489
490@@ -762,18 +759,23 @@ nautilus_window_initialize_menus (NautilusWindow *window)
491 g_signal_connect (ui_manager, "connect-proxy",
492 G_CALLBACK (connect_proxy_cb), window);
493
494- /* add the UI */
495+ g_object_get (gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window))),
496+ "gtk-shell-shows-app-menu", &show_app_menu,
497+ "gtk-shell-shows-menubar", &show_menubar,
498+ NULL);
499+
500+ if (show_app_menu && !show_menubar)
501+ nautilus_window_menus_hide_app_actions (window);
502+
503 gtk_ui_manager_add_ui_from_resource (ui_manager, "/org/gnome/nautilus/nautilus-shell-ui.xml", NULL);
504-}
505
506-void
507-nautilus_window_finalize_menus (NautilusWindow *window)
508-{
509- if (window->details->app_menu_visibility_id != 0) {
510- g_signal_handler_disconnect (gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window))),
511- window->details->app_menu_visibility_id);
512- window->details->app_menu_visibility_id = 0;
513- }
514+ /* Only return a menbar if it is exported to the shell.
515+ * Otherwise the view/action menu buttons will be used
516+ */
517+ if (show_menubar)
518+ return gtk_ui_manager_get_widget (ui_manager, "/menubar");
519+ else
520+ return NULL;
521 }
522
523 static GList *
524diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
525index 9cc6891..bfeac84 100644
526--- a/src/nautilus-window-private.h
527+++ b/src/nautilus-window-private.h
528@@ -110,8 +110,7 @@ void nautilus_window_sync_up_button (NautilusWindow *window);
529
530 /* window menus */
531 void nautilus_window_initialize_actions (NautilusWindow *window);
532-void nautilus_window_initialize_menus (NautilusWindow *window);
533-void nautilus_window_finalize_menus (NautilusWindow *window);
534+GtkWidget * nautilus_window_initialize_menus (NautilusWindow *window);
535
536 void nautilus_window_update_show_hide_menu_items (NautilusWindow *window);
537
538diff --git a/src/nautilus-window.c b/src/nautilus-window.c
539index 67b5899..b51a57b 100644
540--- a/src/nautilus-window.c
541+++ b/src/nautilus-window.c
542@@ -1487,6 +1487,7 @@ nautilus_window_constructed (GObject *self)
543 GtkWidget *grid;
544 NautilusWindowSlot *slot;
545 NautilusApplication *application;
546+ GtkWidget *menubar;
547
548 window = NAUTILUS_WINDOW (self);
549
550@@ -1507,9 +1508,14 @@ nautilus_window_constructed (GObject *self)
551 gtk_widget_show (grid);
552 gtk_container_add (GTK_CONTAINER (window), grid);
553
554- nautilus_window_initialize_menus (window);
555+ menubar = nautilus_window_initialize_menus (window);
556 nautilus_window_initialize_actions (window);
557
558+ if (menubar) {
559+ gtk_container_add (GTK_CONTAINER (grid), menubar);
560+ gtk_widget_show_all (menubar);
561+ }
562+
563 /* Register to menu provider extension signal managing menu updates */
564 g_signal_connect_object (nautilus_signaller_get_current (), "popup-menu-changed",
565 G_CALLBACK (nautilus_window_load_extension_menus), window, G_CONNECT_SWAPPED);
566@@ -1635,8 +1641,6 @@ nautilus_window_finalize (GObject *object)
567 window->details->sidebar_width_handler_id = 0;
568 }
569
570- nautilus_window_finalize_menus (window);
571-
572 g_clear_object (&window->details->ui_manager);
573
574 /* nautilus_window_close() should have run */
575--
5761.9.0
577
0578
=== modified file 'debian/patches/series'
--- debian/patches/series 2014-02-24 14:49:43 +0000
+++ debian/patches/series 2014-02-27 12:36:46 +0000
@@ -22,6 +22,7 @@
22git_sidebar_state_on_start.patch22git_sidebar_state_on_start.patch
23interactive_search.patch23interactive_search.patch
24ubuntu_show_titlebar.patch24ubuntu_show_titlebar.patch
25restore-traditional-menu-bar.patch
25ubuntu_titlebar_css.patch26ubuntu_titlebar_css.patch
26ubuntu_backspace_behaviour.patch27ubuntu_backspace_behaviour.patch
27git_valid_location_widget.patch28git_valid_location_widget.patch

Subscribers

People subscribed via source and target branches

to all changes: