[patch] removing sidebar prefs



Hi,

Here's a patch that removes all the stuff that lets you enable/disable
sidebars.

Thanks,
James


Index: libnautilus-private/nautilus-global-preferences.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-global-preferences.c,v
retrieving revision 1.204
diff -u -r1.204 nautilus-global-preferences.c
--- libnautilus-private/nautilus-global-preferences.c	9 Jul 2002 20:57:12 -0000	1.204
+++ libnautilus-private/nautilus-global-preferences.c	5 Nov 2002 01:26:14 -0000
@@ -492,34 +492,6 @@
 	  "default_zoom_level"
 	},
 
-	/* Sidebar panel default */
-	{ nautilus_sidebar_news_enabled_preference_name,
-	  PREFERENCE_BOOLEAN,
-	  GINT_TO_POINTER (TRUE)
-	},
-	{ nautilus_sidebar_notes_enabled_preference_name,
-	  PREFERENCE_BOOLEAN,
-	  GINT_TO_POINTER (TRUE)
-	},
-	{ nautilus_sidebar_history_enabled_preference_name,
-	  PREFERENCE_BOOLEAN,
-	  GINT_TO_POINTER (TRUE)
-	},
-	{ nautilus_sidebar_tree_enabled_preference_name,
-	  PREFERENCE_BOOLEAN,
-	  GINT_TO_POINTER (FALSE)
-	},
-
-	/* news panel preferences */
-	{ NAUTILUS_PREFERENCES_NEWS_MAX_ITEMS,
-	  PREFERENCE_INTEGER,
-	  GINT_TO_POINTER (6)
-	},
-	{ NAUTILUS_PREFERENCES_NEWS_UPDATE_INTERVAL,
-	  PREFERENCE_INTEGER,
-	  GINT_TO_POINTER (5)
-	},
-
 	/* non-visible preferences */
 	{ NAUTILUS_PREFERENCES_ADD_TO_SESSION,
 	  PREFERENCE_BOOLEAN,
Index: libnautilus-private/nautilus-sidebar-functions.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-sidebar-functions.c,v
retrieving revision 1.9
diff -u -r1.9 nautilus-sidebar-functions.c
--- libnautilus-private/nautilus-sidebar-functions.c	18 Apr 2002 18:39:00 -0000	1.9
+++ libnautilus-private/nautilus-sidebar-functions.c	5 Nov 2002 01:26:14 -0000
@@ -25,31 +25,10 @@
 #include <config.h>
 #include "nautilus-sidebar-functions.h"
 
-#include "nautilus-global-preferences.h"
 #include "nautilus-view-identifier.h"
 #include <eel/eel-glib-extensions.h>
 #include <eel/eel-string.h>
 
-#define PREFERENCES_SIDEBAR_PANEL_PREFIX "sidebar-panels"
-
-#define NEWS_PANEL_IID		"OAFIID:Nautilus_News_View"
-#define NOTES_PANEL_IID		"OAFIID:Nautilus_Notes_View"
-#define HISTORY_PANEL_IID	"OAFIID:Nautilus_History_View"
-#define TREE_PANEL_IID		"OAFIID:Nautilus_Tree_View"
-
-const char nautilus_sidebar_news_enabled_preference_name[] = PREFERENCES_SIDEBAR_PANEL_PREFIX "/" NEWS_PANEL_IID;
-const char nautilus_sidebar_notes_enabled_preference_name[] = PREFERENCES_SIDEBAR_PANEL_PREFIX "/" NOTES_PANEL_IID;
-const char nautilus_sidebar_history_enabled_preference_name[] = PREFERENCES_SIDEBAR_PANEL_PREFIX "/" HISTORY_PANEL_IID;
-const char nautilus_sidebar_tree_enabled_preference_name[] = PREFERENCES_SIDEBAR_PANEL_PREFIX "/" TREE_PANEL_IID;
-
-static char *
-sidebar_panel_make_preference_key (const char *panel_iid)
-{
-	g_return_val_if_fail (panel_iid != NULL, NULL);
-
-	return g_strconcat (PREFERENCES_SIDEBAR_PANEL_PREFIX "/", panel_iid, NULL);
-}
-
 static int
 compare_view_identifiers (gconstpointer a, gconstpointer b)
 {
@@ -65,29 +44,6 @@
 	return eel_strcmp (idenfifier_a->name, idenfifier_b->name);
 }
 
-static gboolean
-sidebar_is_sidebar_panel_enabled (NautilusViewIdentifier *panel_identifier)
-{
-	gboolean enabled;
-        gchar  *key;
-	
-	g_return_val_if_fail (panel_identifier != NULL, FALSE);
-	g_return_val_if_fail (panel_identifier->iid != NULL, FALSE);
-	
-	key = sidebar_panel_make_preference_key (panel_identifier->iid);
-	g_return_val_if_fail (key != NULL, FALSE);
-        enabled = eel_preferences_get_boolean (key);
-        g_free (key);
-
-        return enabled;
-}
-
-static gboolean
-sidebar_is_sidebar_panel_enabled_cover (gpointer data, gpointer callback_data)
-{
-	return sidebar_is_sidebar_panel_enabled (data);
-}
-
 /* Make a query to find out what sidebar panels are available. */
 static GList *
 sidebar_get_sidebar_panel_view_identifiers (void)
@@ -101,7 +57,8 @@
 
 	CORBA_exception_init (&ev);
 
-	query = "nautilus:sidebar_panel_name.defined() AND repo_ids.has ('IDL:Bonobo/Control:1.0')";
+	/* get all the sidebars, and ignore the "loser" ones */
+	query = "nautilus:sidebar_panel_name.defined() AND repo_ids.has ('IDL:Bonobo/Control:1.0') AND (NOT test_only == true)";
 
 	bonobo_activation_result = bonobo_activation_query (query, NULL, &ev);
 		
@@ -128,46 +85,7 @@
 }
 
 GList *
-nautilus_sidebar_get_enabled_sidebar_panel_view_identifiers (void)
+nautilus_sidebar_get_all_sidebar_panel_view_identifiers (void)
 {
-	GList *enabled_view_identifiers;
- 	GList *disabled_view_identifiers;
-        
-	enabled_view_identifiers = sidebar_get_sidebar_panel_view_identifiers ();
-
-	enabled_view_identifiers = eel_g_list_partition (enabled_view_identifiers,
-							      sidebar_is_sidebar_panel_enabled_cover,
-							      NULL,
-							      &disabled_view_identifiers);
-	
-	nautilus_view_identifier_list_free (disabled_view_identifiers);
-	
-        return enabled_view_identifiers;
-}
-
-void
-nautilus_sidebar_for_each_panel (NautilusSidebarPanelCallback callback,
-				 gpointer callback_data)
-{
-	char *preference_key;
-	GList *view_identifiers;
-	GList *node;
-	NautilusViewIdentifier *identifier;
-
-	g_return_if_fail (callback != NULL);
-
-	view_identifiers = sidebar_get_sidebar_panel_view_identifiers ();
-
-	for (node = view_identifiers; node != NULL; node = node->next) {
-		g_assert (node->data != NULL);
-		identifier = node->data;
-		
-		preference_key = sidebar_panel_make_preference_key (identifier->iid);
-
-		(* callback) (identifier->name, identifier->iid, preference_key, callback_data);
-
-		g_free (preference_key);
-	}
-
-	nautilus_view_identifier_list_free (view_identifiers);
+	return sidebar_get_sidebar_panel_view_identifiers ();
 }
Index: libnautilus-private/nautilus-sidebar-functions.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-sidebar-functions.h,v
retrieving revision 1.7
diff -u -r1.7 nautilus-sidebar-functions.h
--- libnautilus-private/nautilus-sidebar-functions.h	21 Feb 2002 19:26:47 -0000	1.7
+++ libnautilus-private/nautilus-sidebar-functions.h	5 Nov 2002 01:26:14 -0000
@@ -27,22 +27,7 @@
 
 #include <glib/glist.h>
 
-extern const char nautilus_sidebar_news_enabled_preference_name[];
-extern const char nautilus_sidebar_notes_enabled_preference_name[];
-extern const char nautilus_sidebar_history_enabled_preference_name[];
-extern const char nautilus_sidebar_tree_enabled_preference_name[];
-
-/*
- * A callback which can be invoked for each sidebar panel available.
- */
-typedef void (*NautilusSidebarPanelCallback) (const char *name,
-					      const char *iid,
-					      const char *preference_key,
-					      gpointer callback_data);
-
-GList *nautilus_sidebar_get_enabled_sidebar_panel_view_identifiers (void);
-void   nautilus_sidebar_for_each_panel                             (NautilusSidebarPanelCallback callback,
-								    gpointer                     callback_data);
+GList *nautilus_sidebar_get_all_sidebar_panel_view_identifiers (void);
 
 #endif /* NAUTILUS_SIDEBAR_FUNCTIONS_H */
 
Index: src/Makefile.am
===================================================================
RCS file: /cvs/gnome/nautilus/src/Makefile.am,v
retrieving revision 1.144
diff -u -r1.144 Makefile.am
--- src/Makefile.am	31 Oct 2002 22:25:47 -0000	1.144
+++ src/Makefile.am	5 Nov 2002 01:26:15 -0000
@@ -69,7 +69,6 @@
 	nautilus-location-bar.c         	\
 	nautilus-main.c 			\
 	nautilus-navigation-bar.c         	\
-	nautilus-preferences-dialog.c		\
 	nautilus-profiler.c			\
 	nautilus-property-browser.c     	\
 	nautilus-search-bar-criterion.c		\
@@ -103,7 +102,6 @@
 	nautilus-location-bar.h			\
 	nautilus-main.h				\
 	nautilus-navigation-bar.h		\
-	nautilus-preferences-dialog.h		\
 	nautilus-profiler.h			\
 	nautilus-property-browser.h		\
 	nautilus-search-bar-criterion-private.h	\
Index: src/nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.399
diff -u -r1.399 nautilus-window.c
--- src/nautilus-window.c	4 Nov 2002 14:59:53 -0000	1.399
+++ src/nautilus-window.c	5 Nov 2002 01:26:21 -0000
@@ -118,9 +118,8 @@
 static GList *history_list;
 static int side_pane_width_auto_value = SIDE_PANE_MINIMUM_WIDTH;
 
-static void update_sidebar_panels_from_preferences (NautilusWindow *window);
-static void sidebar_panels_changed_callback        (gpointer        user_data);
-static void cancel_view_as_callback                (NautilusWindow *window);
+static void add_sidebar_panels                  (NautilusWindow *window);
+static void cancel_view_as_callback             (NautilusWindow *window);
 
 GNOME_CLASS_BOILERPLATE (NautilusWindow, nautilus_window,
 			 BonoboWindow, BONOBO_TYPE_WINDOW)
@@ -156,23 +155,6 @@
 }
 
 static void
-add_sidebar_panel_callback (const char *name,
-			    const char *iid,
-			    const char *preference_key,
-			    gpointer callback_data) 
-{
-	g_assert (name != NULL);
-	g_assert (iid != NULL);
-	g_assert (preference_key != NULL);
-	g_assert (NAUTILUS_IS_WINDOW (callback_data));
-	
-	eel_preferences_add_callback_while_alive (preference_key,
-						  sidebar_panels_changed_callback,
-						  callback_data,
-						  G_OBJECT (callback_data));
-}
-
-static void
 nautilus_window_instance_init (NautilusWindow *window)
 {
 	window->details = g_new0 (NautilusWindowDetails, 1);
@@ -208,9 +190,6 @@
 
 	gtk_quit_add_destroy (1, GTK_OBJECT (window));
 
-	/* Keep track of changes in enabled state of sidebar panels */
-	nautilus_sidebar_for_each_panel (add_sidebar_panel_callback, window);
-
 	/* Keep the main event loop alive as long as the window exists */
 	nautilus_main_event_loop_register (GTK_OBJECT (window));
 }
@@ -676,7 +655,7 @@
 				      _("Information"));
 
 	/* Set up the sidebar panels. */
-	update_sidebar_panels_from_preferences (window);
+	add_sidebar_panels (window);
 	
 	gtk_widget_show (GTK_WIDGET (window->sidebar));
 }
@@ -1930,18 +1909,14 @@
 }
 
 /**
- * update_sidebar_panels_from_preferences:
+ * add_sidebar_panels:
  * @window:	A NautilusWindow
  *
- * Update the current list of sidebar panels from preferences.   
- *
- * Disabled panels are removed if they are already in the list.
- *
- * Enabled panels are added if they are not already in the list.
+ * Adds all sidebars available
  *
  */
 static void
-update_sidebar_panels_from_preferences (NautilusWindow *window)
+add_sidebar_panels (NautilusWindow *window)
 {
 	GList *identifier_list;
 
@@ -1951,23 +1926,9 @@
 		return;
 	}
 
-	/* Obtain list of enabled view identifiers */
-	identifier_list = nautilus_sidebar_get_enabled_sidebar_panel_view_identifiers ();
+	identifier_list = nautilus_sidebar_get_all_sidebar_panel_view_identifiers ();
 	nautilus_window_set_sidebar_panels (window, identifier_list);
 	nautilus_view_identifier_list_free (identifier_list);
-}
-
-/**
- * sidebar_panels_changed_callback:
- * @user_data:	Callback data
- *
- * Called when enabled/disabled preferences change for any
- * sidebar panel.
- */
-static void
-sidebar_panels_changed_callback (gpointer user_data)
-{
-	update_sidebar_panels_from_preferences (NAUTILUS_WINDOW (user_data));
 }
 
 static void 


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