GNOME Bugzilla – Bug 525721
Add possibility to show/hide zoom control widget (patch included)
Last modified: 2010-06-11 16:57:28 UTC
Nautilus users must have the possibility to show/hide the zoom control widget. Most time it is useless but it takes additional space on the toolbar. I wrote a simple patch which adds "Zoom control" option to the "View" menu. Russian translation is included. Patch is for nautilus 2.22.1. I'd like to see this improvement in the future nautilus releases. Alexander
Created attachment 108458 [details] [review] zoom control patch
Created attachment 108459 [details] patched nautilus window
Comment on attachment 108458 [details] [review] zoom control patch >diff -cr ./libnautilus-private/apps_nautilus_preferences.schemas.in ../patched/libnautilus-private/apps_nautilus_preferences.schemas.in >*** ./libnautilus-private/apps_nautilus_preferences.schemas.in 2008-01-22 12:05:00.000000000 +0200 >--- ../patched/libnautilus-private/apps_nautilus_preferences.schemas.in 2008-03-31 21:28:57.000000000 +0300 >*************** >*** 813,830 **** > </long> > </locale> > </schema> > > <schema> >! <key>/schemas/apps/nautilus/preferences/start_with_sidebar</key> >! <applyto>/apps/nautilus/preferences/start_with_sidebar</applyto> > <owner>nautilus</owner> > <type>bool</type> > <default>true</default> > <locale name="C"> >! <short>Show side pane in new windows</short> > <long> >! If set to true, newly opened windows will have the side >! pane visible. > </long> > </locale> > </schema> >--- 813,845 ---- > </long> > </locale> > </schema> >+ >+ <schema> >+ <key>/schemas/apps/nautilus/preferences/start_with_status_bar</key> >+ <applyto>/apps/nautilus/preferences/start_with_status_bar</applyto> >+ <owner>nautilus</owner> >+ <type>bool</type> >+ <default>true</default> >+ <locale name="C"> >+ <short>Show status bar in new windows</short> >+ <long> >+ If set to true, newly opened windows will have the status >+ bar visible. >+ </long> >+ </locale> >+ </schema> > > <schema> >! <key>/schemas/apps/nautilus/preferences/start_with_zoom_control</key> >! <applyto>/apps/nautilus/preferences/start_with_zoom_control</applyto> > <owner>nautilus</owner> > <type>bool</type> > <default>true</default> > <locale name="C"> >! <short>Show zoom control in new windows</short> > <long> >! If set to true, newly opened windows will have the zoom >! control visible. > </long> > </locale> > </schema> >diff -cr ./libnautilus-private/nautilus-global-preferences.c ../patched/libnautilus-private/nautilus-global-preferences.c >*** ./libnautilus-private/nautilus-global-preferences.c 2008-01-17 14:40:17.000000000 +0200 >--- ../patched/libnautilus-private/nautilus-global-preferences.c 2008-03-31 21:41:07.000000000 +0300 >*************** >*** 347,352 **** >--- 347,356 ---- > PREFERENCE_BOOLEAN, > GINT_TO_POINTER (TRUE) > }, >+ { NAUTILUS_PREFERENCES_START_WITH_ZOOM_CONTROL, >+ PREFERENCE_BOOLEAN, >+ GINT_TO_POINTER (TRUE) >+ }, > { NAUTILUS_PREFERENCES_START_WITH_SIDEBAR, > PREFERENCE_BOOLEAN, > GINT_TO_POINTER (TRUE) >diff -cr ./libnautilus-private/nautilus-global-preferences.h ../patched/libnautilus-private/nautilus-global-preferences.h >*** ./libnautilus-private/nautilus-global-preferences.h 2008-01-17 14:40:17.000000000 +0200 >--- ../patched/libnautilus-private/nautilus-global-preferences.h 2008-03-31 21:21:28.000000000 +0300 >*************** >*** 99,104 **** >--- 99,105 ---- > #define NAUTILUS_PREFERENCES_SIDE_PANE_VIEW "preferences/side_pane_view" > #define NAUTILUS_PREFERENCES_NAVIGATION_WINDOW_SAVED_GEOMETRY "preferences/navigation_window_saved_geometry" > #define NAUTILUS_PREFERENCES_NAVIGATION_WINDOW_MAXIMIZED "preferences/navigation_window_saved_maximized" >+ #define NAUTILUS_PREFERENCES_START_WITH_ZOOM_CONTROL "preferences/start_with_zoom_control" > > /* Sorting order */ > #define NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST "preferences/sort_directories_first" >diff -cr ./po/ru.po ../patched/po/ru.po >*** ./po/ru.po 2008-03-14 13:58:02.000000000 +0200 >--- ../patched/po/ru.po 2008-04-02 11:56:17.000000000 +0300 >*************** >*** 5797,5806 **** > msgstr "Строка _состояния" > > #. tooltip >! #: ../src/nautilus-navigation-window-menus.c:520 > msgid "Change the visibility of this window's statusbar" > msgstr "Изменить видимость строки состояния этого окна" > > #: ../src/nautilus-navigation-window-menus.c:544 > msgid "_Back" > msgstr "На_зад" >--- 5797,5818 ---- > msgstr "Строка _состояния" > > #. tooltip >! #: ../src/nautilus-navigation-window-menus.c:541 > msgid "Change the visibility of this window's statusbar" > msgstr "Изменить видимость строки состояния этого окна" > >+ #. is_active >+ #. name, stock id >+ #. label, accelerator >+ #: ../src/nautilus-navigation-window-menus.c:545 >+ msgid "Zoom Co_ntrol" >+ msgstr "Инструмент _масштабирования" >+ >+ #. tooltip >+ #: ../src/nautilus-navigation-window-menus.c:546 >+ msgid "Change the visibility of this window's zoom control" >+ msgstr "Изменить видимость инструмента масштабирования" >+ > #: ../src/nautilus-navigation-window-menus.c:544 > msgid "_Back" > msgstr "На_зад" >diff -cr ./src/nautilus-actions.h ../patched/src/nautilus-actions.h >*** ./src/nautilus-actions.h 2007-11-28 09:54:54.000000000 +0200 >--- ../patched/src/nautilus-actions.h 2008-03-31 22:19:20.000000000 +0300 >*************** >*** 37,42 **** >--- 37,43 ---- > #define NAUTILUS_ACTION_SHOW_HIDE_SIDEBAR "Show Hide Sidebar" > #define NAUTILUS_ACTION_SHOW_HIDE_STATUSBAR "Show Hide Statusbar" > #define NAUTILUS_ACTION_SHOW_HIDE_LOCATION_BAR "Show Hide Location Bar" >+ #define NAUTILUS_ACTION_SHOW_HIDE_ZOOM_CONTROL "Show Hide Zoom Control" > #define NAUTILUS_ACTION_GO_TO_BURN_CD "Go to Burn CD" > #define NAUTILUS_ACTION_GO_TO_LOCATION "Go to Location" > #define NAUTILUS_ACTION_GO_HOME "Home" >diff -cr ./src/nautilus-navigation-window.c ../patched/src/nautilus-navigation-window.c >*** ./src/nautilus-navigation-window.c 2007-12-14 12:22:42.000000000 +0200 >--- ../patched/src/nautilus-navigation-window.c 2008-03-31 23:12:14.000000000 +0300 >*************** >*** 992,997 **** >--- 992,998 ---- > { > > NautilusNavigationWindow *window; >+ gboolean show_zoom_control; > > window = NAUTILUS_NAVIGATION_WINDOW (nautilus_window); > >*************** >*** 1011,1017 **** > gtk_container_add (GTK_CONTAINER (window->details->content_box), > GTK_WIDGET (new_view)); > >! if (new_view != NULL && nautilus_view_supports_zooming (new_view)) { > gtk_widget_show (window->zoom_control); > } else { > gtk_widget_hide (window->zoom_control); >--- 1012,1019 ---- > gtk_container_add (GTK_CONTAINER (window->details->content_box), > GTK_WIDGET (new_view)); > >! show_zoom_control = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_ZOOM_CONTROL); >! if (show_zoom_control && new_view != NULL && nautilus_view_supports_zooming (new_view)) { > gtk_widget_show (window->zoom_control); > } else { > gtk_widget_hide (window->zoom_control); >*************** >*** 1355,1361 **** > return TRUE; > } > >! void > nautilus_navigation_window_hide_status_bar (NautilusNavigationWindow *window) > { > gtk_widget_hide (NAUTILUS_WINDOW (window)->details->statusbar); >--- 1357,1363 ---- > return TRUE; > } > >! void > nautilus_navigation_window_hide_status_bar (NautilusNavigationWindow *window) > { > gtk_widget_hide (NAUTILUS_WINDOW (window)->details->statusbar); >*************** >*** 1367,1373 **** > } > } > >! void > nautilus_navigation_window_show_status_bar (NautilusNavigationWindow *window) > { > gtk_widget_show (NAUTILUS_WINDOW (window)->details->statusbar); >--- 1369,1375 ---- > } > } > >! void > nautilus_navigation_window_show_status_bar (NautilusNavigationWindow *window) > { > gtk_widget_show (NAUTILUS_WINDOW (window)->details->statusbar); >*************** >*** 1380,1385 **** >--- 1382,1423 ---- > } > > gboolean >+ nautilus_navigation_window_zoom_control_showing (NautilusNavigationWindow *window) >+ { >+ if (window->zoom_control != NULL) { >+ return GTK_WIDGET_VISIBLE (window->zoom_control); >+ } >+ /* If we're not visible yet we haven't changed visibility, so its TRUE */ >+ return TRUE; >+ } >+ >+ void >+ nautilus_navigation_window_hide_zoom_control (NautilusNavigationWindow *window) >+ { >+ gtk_widget_hide (window->zoom_control); >+ >+ nautilus_navigation_window_update_show_hide_menu_items (window); >+ if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_ZOOM_CONTROL) && >+ eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_ZOOM_CONTROL)) { >+ eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_ZOOM_CONTROL, FALSE); >+ } >+ >+ } >+ >+ void >+ nautilus_navigation_window_show_zoom_control (NautilusNavigationWindow *window) >+ { >+ gtk_widget_show (window->zoom_control); >+ >+ nautilus_navigation_window_update_show_hide_menu_items (window); >+ if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_ZOOM_CONTROL) && >+ !eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_ZOOM_CONTROL)) { >+ eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_ZOOM_CONTROL, TRUE); >+ } >+ >+ } >+ >+ gboolean > nautilus_navigation_window_status_bar_showing (NautilusNavigationWindow *window) > { > if (NAUTILUS_WINDOW (window)->details->statusbar != NULL) { >diff -cr ./src/nautilus-navigation-window.h ../patched/src/nautilus-navigation-window.h >*** ./src/nautilus-navigation-window.h 2007-10-19 12:11:34.000000000 +0300 >--- ../patched/src/nautilus-navigation-window.h 2008-03-31 20:09:00.000000000 +0300 >*************** >*** 112,117 **** >--- 112,119 ---- > NautilusSidebar *sidebar_panel); > void nautilus_navigation_window_hide_status_bar (NautilusNavigationWindow *window); > void nautilus_navigation_window_show_status_bar (NautilusNavigationWindow *window); >+ void nautilus_navigation_window_hide_zoom_control (NautilusNavigationWindow *window); >+ void nautilus_navigation_window_show_zoom_control (NautilusNavigationWindow *window); > gboolean nautilus_navigation_window_status_bar_showing (NautilusNavigationWindow *window); > void nautilus_navigation_window_back_or_forward (NautilusNavigationWindow *window, > gboolean back, >diff -cr ./src/nautilus-navigation-window-menus.c ../patched/src/nautilus-navigation-window-menus.c >*** ./src/nautilus-navigation-window-menus.c 2008-02-19 11:06:54.000000000 +0200 >--- ../patched/src/nautilus-navigation-window-menus.c 2008-03-31 23:23:54.000000000 +0300 >*************** >*** 203,208 **** >--- 203,224 ---- > } > } > >+ static void >+ action_show_hide_zoom_control_callback (GtkAction *action, >+ gpointer user_data) >+ { >+ NautilusNavigationWindow *window; >+ >+ window = NAUTILUS_NAVIGATION_WINDOW (user_data); >+ >+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { >+ nautilus_navigation_window_show_zoom_control (window); >+ } else { >+ nautilus_navigation_window_hide_zoom_control (window); >+ } >+ >+ } >+ > void > nautilus_navigation_window_update_show_hide_menu_items (NautilusNavigationWindow *window) > { >*************** >*** 229,234 **** >--- 245,256 ---- > NAUTILUS_ACTION_SHOW_HIDE_STATUSBAR); > gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), > nautilus_navigation_window_status_bar_showing (window)); >+ >+ action = gtk_action_group_get_action (window->details->navigation_action_group, >+ NAUTILUS_ACTION_SHOW_HIDE_ZOOM_CONTROL); >+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), >+ nautilus_navigation_window_zoom_control_showing (window)); >+ > } > > void >*************** >*** 496,502 **** > /* name, stock id, label */ { "Search", "gtk-find", N_("_Search for Files..."), > "<control>F", N_("Locate documents and folders on this computer by name or content"), > G_CALLBACK (action_search_callback) }, >- > }; > > static const GtkToggleActionEntry navigation_toggle_entries[] = { >--- 518,523 ---- >*************** >*** 504,525 **** > /* label, accelerator */ N_("_Main Toolbar"), NULL, > /* tooltip */ N_("Change the visibility of this window's main toolbar"), > G_CALLBACK (action_show_hide_toolbar_callback), >! /* is_active */ TRUE }, > /* name, stock id */ { "Show Hide Sidebar", NULL, > /* label, accelerator */ N_("_Side Pane"), "F9", > /* tooltip */ N_("Change the visibility of this window's side pane"), > G_CALLBACK (action_show_hide_sidebar_callback), >! /* is_active */ TRUE }, > /* name, stock id */ { "Show Hide Location Bar", NULL, > /* label, accelerator */ N_("Location _Bar"), NULL, > /* tooltip */ N_("Change the visibility of this window's location bar"), > G_CALLBACK (action_show_hide_location_bar_callback), >! /* is_active */ TRUE }, > /* name, stock id */ { "Show Hide Statusbar", NULL, > /* label, accelerator */ N_("St_atusbar"), NULL, > /* tooltip */ N_("Change the visibility of this window's statusbar"), > G_CALLBACK (action_show_hide_statusbar_callback), >! /* is_active */ TRUE }, > }; > > void >--- 525,552 ---- > /* label, accelerator */ N_("_Main Toolbar"), NULL, > /* tooltip */ N_("Change the visibility of this window's main toolbar"), > G_CALLBACK (action_show_hide_toolbar_callback), >! /* is_active */ TRUE }, > /* name, stock id */ { "Show Hide Sidebar", NULL, > /* label, accelerator */ N_("_Side Pane"), "F9", > /* tooltip */ N_("Change the visibility of this window's side pane"), > G_CALLBACK (action_show_hide_sidebar_callback), >! /* is_active */ TRUE }, > /* name, stock id */ { "Show Hide Location Bar", NULL, > /* label, accelerator */ N_("Location _Bar"), NULL, > /* tooltip */ N_("Change the visibility of this window's location bar"), > G_CALLBACK (action_show_hide_location_bar_callback), >! /* is_active */ TRUE }, > /* name, stock id */ { "Show Hide Statusbar", NULL, > /* label, accelerator */ N_("St_atusbar"), NULL, > /* tooltip */ N_("Change the visibility of this window's statusbar"), > G_CALLBACK (action_show_hide_statusbar_callback), >! /* is_active */ TRUE }, >! /* name, stock id */ { "Show Hide Zoom Control", NULL, >! /* label, accelerator */ N_("Zoom Co_ntrol"), NULL, >! /* tooltip */ N_("Change the visibility of this window's zoom control"), >! G_CALLBACK (action_show_hide_zoom_control_callback), >! /* is_active */ TRUE }, >! > }; > > void >diff -cr ./src/nautilus-navigation-window-ui.xml ../patched/src/nautilus-navigation-window-ui.xml >*** ./src/nautilus-navigation-window-ui.xml 2007-11-28 09:54:54.000000000 +0200 >--- ../patched/src/nautilus-navigation-window-ui.xml 2008-03-31 20:00:22.000000000 +0300 >*************** >*** 16,21 **** >--- 16,22 ---- > <menuitem name="Show Hide Sidebar" action="Show Hide Sidebar"/> > <menuitem name="Show Hide Location Bar" action="Show Hide Location Bar"/> > <menuitem name="Show Hide Statusbar" action="Show Hide Statusbar"/> >+ <menuitem name="Show Hide Zoom Control" action="Show Hide Zoom Control"/> > </placeholder> > </menu> > <placeholder name="Other Menus">
Created attachment 108471 [details] [review] Updated patch as 'z' hotkey in "View" menu is already used
Thanks for your bug report and for your work! While it may sound a like a nice feature for people who want to have a wide location bar, adding a UI for showing/hiding items on toolbars does not sounds like a good idea. The solution for giving the users full control over the toolbar is to add a toolbar editor. Confirming, marking patch as "rejected", making bug report depend on bug 42834 (toolbar editing).
*** Bug 509660 has been marked as a duplicate of this bug. ***
Christian: is bug 42834 likely to be addressed for 2.24? If yes, cool. I'm looking for ward to that. But, if this is not the case: hiding the zoom and/or view widgets would still be nice to have, as it would cover most use cases for the editor, and we could have it today without deep code changes. So if the toolbar editor is not one of the priorized tasks for 2.24, let's go for a "small" solution like this, for now.
> Christian: is bug 42834 likely to be addressed for 2.24? If yes, cool. I do not think I will have the time to work on it, but anybody [this includes you! :)] is invited to work on it. > But, if this is not the case: hiding the zoom > and/or view widgets would still be nice to have, > as it would cover most use cases for the editor, To my perception most people want to have additional widgets (for instance a trash shortcut) on the toolbar, rather than hiding existing ones. > and we could have it today without deep code changes. We appreciate all the work you invested. However, with the solution you propose we add GUI widgets to the menu ["clutter"], we add preferences [translatable strings => much work for translators]. Since only a handful of people seems to request this feature, most of them being programmers, I just propose to edit the nautilus UI .xml files manually.
(In reply to comment #6) > *** Bug 509660 has been marked as a duplicate of this bug. *** I don't think that bug is a duplicate of this one. This one offers the ability to enable/disable the widgets, but bug 509660 proposes moving them to the main toolbar, for reasons cited here and otherwise. Simply put: those widgets would be more appropriate on the main toolbar. Or am I missing the bigger picture here?
We're prioritising the toolbar editor for 3.0. That makes this bug unecessary, as far as I can see. Closing as not a bug. Please correct me if I am wrong though. :)