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