[PATCH] Respect show toolbar gconf pref (was: Convergence Of Twain)



On Wed, 2004-05-05 at 23:13 +0000, Brad Barnich wrote:
> I'm not here to complain about spacial nautilus, I don't like it, never 
> will, but agree it has its uses. I have been going through the source 
> for nautilus, and I thought about something.
> 
> Why not take browser mode (whatever its called, 2.4 nautilus style) add 
> the following options
[...]
> - hide navigation bar.

Later in the thread it emerged that you actually want to hide the
toolbar. It works (should have worked, as you'll see) using GConf.
Up to now, it didn't work because said key was neither evaluated nor
used for new windows. Unfortunately we can't add a visible menuitem to
the view menu because we're in UI freeze. I think we'll come up with a
menuitem for showing/hiding it in Nautilus 2.8.
The attached patch allows to hide the toolbar through unsetting
the /apps/nautilus/preferences/start_with_toolbar GConf key, though.

regs,
 Chris
Index: libnautilus-private/nautilus-global-preferences.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-global-preferences.c,v
retrieving revision 1.215
diff -u -r1.215 nautilus-global-preferences.c
--- libnautilus-private/nautilus-global-preferences.c	20 Feb 2004 10:33:46 -0000	1.215
+++ libnautilus-private/nautilus-global-preferences.c	8 May 2004 13:45:18 -0000
@@ -399,6 +399,10 @@
 	  PREFERENCE_BOOLEAN,
 	  GINT_TO_POINTER (TRUE)
 	},
+	{ NAUTILUS_PREFERENCES_START_WITH_TOOLBAR,
+	  PREFERENCE_BOOLEAN,
+	  GINT_TO_POINTER (TRUE)
+	},
 	{ NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES,
 	  PREFERENCE_BOOLEAN,
 	  GINT_TO_POINTER (TRUE)
Index: libnautilus-private/nautilus-global-preferences.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-global-preferences.h,v
retrieving revision 1.122
diff -u -r1.122 nautilus-global-preferences.h
--- libnautilus-private/nautilus-global-preferences.h	20 Feb 2004 10:33:49 -0000	1.122
+++ libnautilus-private/nautilus-global-preferences.h	8 May 2004 13:45:18 -0000
@@ -80,6 +80,7 @@
 #define NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR		"preferences/start_with_location_bar"
 #define NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR		"preferences/start_with_status_bar"
 #define NAUTILUS_PREFERENCES_START_WITH_SIDEBAR		 	"preferences/start_with_sidebar"
+#define NAUTILUS_PREFERENCES_START_WITH_TOOLBAR			"preferences/start_with_toolbar"
 #define NAUTILUS_PREFERENCES_SIDE_PANE_VIEW                     "preferences/side_pane_view"
 
 /* Sorting order */
Index: src/nautilus-navigation-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-navigation-window.c,v
retrieving revision 1.423
diff -u -r1.423 nautilus-navigation-window.c
--- src/nautilus-navigation-window.c	8 Apr 2004 20:30:06 -0000	1.423
+++ src/nautilus-navigation-window.c	8 May 2004 13:45:21 -0000
@@ -1359,6 +1359,26 @@
 	}
 }
 
+void 
+nautilus_navigation_window_hide_toolbar (NautilusNavigationWindow *window)
+{
+	hide_dock_item (window, TOOLBAR_PATH);
+	if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR) &&
+	    eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR)) {
+		eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR, FALSE);
+	}
+}
+
+void 
+nautilus_navigation_window_show_toolbar (NautilusNavigationWindow *window)
+{
+	show_dock_item (window, TOOLBAR_PATH);
+	if (eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR) &&
+	    !eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR)) {
+		eel_preferences_set_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR, TRUE);
+	}
+}
+
 gboolean
 nautilus_navigation_window_location_bar_showing (NautilusNavigationWindow *window)
 {
@@ -1471,6 +1491,12 @@
 		nautilus_window_show_status_bar (NAUTILUS_WINDOW (window));
 	} else {
 		nautilus_window_hide_status_bar (NAUTILUS_WINDOW (window));
+	}
+
+	if (eel_preferences_get_boolean (NAUTILUS_PREFERENCES_START_WITH_TOOLBAR)) {
+		nautilus_navigation_window_show_toolbar (window);
+	} else {
+		nautilus_navigation_window_hide_toolbar (window);
 	}
 
 	GTK_WIDGET_CLASS (parent_class)->show (widget);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]