Re: [Nautilus-list] [PATCH] makes the hide sidebar work



On sáb, 2002-03-02 at 21:38, Alex Larsson wrote:
> On 2 Mar 2002, Diego González wrote:
> 
> > hi
> > 
> > 	This patch makes the sidebar to be completely hidden when selecting so
> > from the preferences or from then menu.
> 
> Looks pretty good!
> 
> There are some issues though. You can easily get it "confused" by clicking 
> on the splitter to collapse it, and then the view menu still says "hide 
> sidebar", but selecting it expands the sidebar.
> 
> I think you should make splitter_hide() just hide the first child, and not 
> mess with the position and saved position at all. Then you should export a 
> new function nautilus_horizontal_splitter_is_hidden(), that returns if
> if !(paned->child1 && GTK_WIDGET_VISIBLE (paned->child1)). Then use this 
> function from nautilus_window_sidebar_showing.

here is my second try. This time it seems to work as it is supposed to.

i added a function _is_hidden and _show/_hide.

> 
> I think that will work.
> 
> -- 
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>  Alexander Larsson                                            Red Hat, Inc 
>                    alexl redhat com    alla lysator liu se 
> He's a world-famous voodoo master criminal with no name. She's a supernatural 
> French-Canadian opera singer who hides her beauty behind a pair of 
> thick-framed spectacles. They fight crime! 
> 
> 
> _______________________________________________
> nautilus-list mailing list
> nautilus-list lists eazel com
> http://lists.eazel.com/mailman/listinfo/nautilus-list

Index: nautilus-horizontal-splitter.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-horizontal-splitter.c,v
retrieving revision 1.19
diff -u -r1.19 nautilus-horizontal-splitter.c
--- nautilus-horizontal-splitter.c	2001/11/10 05:00:33	1.19
+++ nautilus-horizontal-splitter.c	2002/03/03 15:32:37
@@ -103,10 +103,58 @@
 	}
 }
 
+static void
+splitter_hide (NautilusHorizontalSplitter *splitter)
+{
+	GtkPaned *parent;
+
+	parent = GTK_PANED (splitter);
+
+	gtk_widget_hide (parent->child1);
+}
+
+static void
+splitter_show (NautilusHorizontalSplitter *splitter)
+{
+	GtkPaned *parent;
+
+	parent = GTK_PANED (splitter);
+
+	gtk_widget_show (parent->child1);
+}
+
+static gboolean
+splitter_is_hidden (NautilusHorizontalSplitter *splitter)
+{
+	GtkPaned *parent;
+	
+	parent = GTK_PANED (splitter);
+
+	return GTK_WIDGET_VISIBLE (parent->child1);
+}
+
 void
 nautilus_horizontal_splitter_expand (NautilusHorizontalSplitter *splitter)
 {
 	splitter_expand (splitter, gtk_paned_get_position (GTK_PANED (splitter)));
+}
+
+void
+nautilus_horizontal_splitter_hide (NautilusHorizontalSplitter *splitter)
+{
+	splitter_hide (splitter);
+}
+
+void
+nautilus_horizontal_splitter_show (NautilusHorizontalSplitter *splitter)
+{
+	splitter_show (splitter);
+}
+
+gboolean
+nautilus_horizontal_splitter_is_hidden (NautilusHorizontalSplitter *splitter)
+{
+	return splitter_is_hidden (splitter);
 }
 
 void
Index: nautilus-horizontal-splitter.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-horizontal-splitter.h,v
retrieving revision 1.8
diff -u -r1.8 nautilus-horizontal-splitter.h
--- nautilus-horizontal-splitter.h	2001/11/08 23:09:32	1.8
+++ nautilus-horizontal-splitter.h	2002/03/03 15:32:37
@@ -50,7 +50,10 @@
 GtkType    nautilus_horizontal_splitter_get_type (void);
 GtkWidget *nautilus_horizontal_splitter_new      (void);
 
+gboolean   nautilus_horizontal_splitter_is_hidden	(NautilusHorizontalSplitter *splitter);
 void	   nautilus_horizontal_splitter_collapse	(NautilusHorizontalSplitter *splitter);
+void	   nautilus_horizontal_splitter_hide		(NautilusHorizontalSplitter *splitter);
+void	   nautilus_horizontal_splitter_show		(NautilusHorizontalSplitter *splitter);
 void	   nautilus_horizontal_splitter_expand		(NautilusHorizontalSplitter *splitter);
 void	   nautilus_horizontal_splitter_toggle_position	(NautilusHorizontalSplitter *splitter);
 
Index: nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.371
diff -u -r1.371 nautilus-window.c
--- nautilus-window.c	2002/03/01 22:57:33	1.371
+++ nautilus-window.c	2002/03/03 15:36:09
@@ -2067,7 +2067,7 @@
 	if (window->sidebar == NULL) {
 		return;
 	}
-	nautilus_horizontal_splitter_collapse
+	nautilus_horizontal_splitter_hide
 		(NAUTILUS_HORIZONTAL_SPLITTER (window->content_hbox));
 	nautilus_window_update_show_hide_menu_items (window);
 }
@@ -2078,7 +2078,7 @@
 	if (window->sidebar == NULL) {
 		return;
 	}
-	nautilus_horizontal_splitter_expand
+	nautilus_horizontal_splitter_show
 		(NAUTILUS_HORIZONTAL_SPLITTER (window->content_hbox));
 	nautilus_window_update_show_hide_menu_items (window);
 }
@@ -2088,8 +2088,8 @@
 {
 	g_return_val_if_fail (NAUTILUS_IS_WINDOW (window), FALSE);
 
-	return GTK_IS_PANED (window->content_hbox)
-		&& gtk_paned_get_position (GTK_PANED (window->content_hbox)) != 0;
+	return GTK_IS_PANED (window->content_hbox) 
+		&& nautilus_horizontal_splitter_is_hidden (NAUTILUS_HORIZONTAL_SPLITTER (window->content_hbox));
 }
 
 void 
Index: nautilus-window-menus.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-menus.c,v
retrieving revision 1.226
diff -u -r1.226 nautilus-window-menus.c
--- nautilus-window-menus.c	2002/03/02 00:30:53	1.226
+++ nautilus-window-menus.c	2002/03/03 15:36:10
@@ -393,6 +393,7 @@
 	NautilusWindow *window;
 
 	window = NAUTILUS_WINDOW (user_data);
+
 	if (nautilus_window_sidebar_showing (window)) {
 		nautilus_window_hide_sidebar (window);
 	} else {


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