Re: Spring Loaded Folders Reloaded



On 26 Feb 2003, iain wrote:

> Dave liked the first patch, but managed to break it
> So this fixes the breakages.
> He also wanted no warnings so I turned on -Werror
> Except then I had to do loads of gtk_idle gtk_timeout changes as well
> And now I'm too tired to remove them from the patch.

Man. This is really really nice. I didn't look at the actual patch, but 
I'd love to have this. I also commited all the deprecated API changes. 
Attached is a new version of the spring-folders patch without them.

However, looking at the Apple latest patent [1], it is clear that the 
patch would make Nautilus violates claim 1 of that patent.

I fucking hate this, because I would love to get this in Nautilus. 
However, as things stand now I don't think we can apply this. Does anyone 
know of any prior art for this? The first patent [1] related to this was 
filed  June 11, 1993. If we had a good case of prior art I think we would 
be on more solid ground with respect to this. (Although I would still like 
to confer with a laywer.)

[1]
http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=/netahtml/search-adv.htm&r=1&f=G&l=50&d=PTXT&p=1&p=1&S1=(('spring+loaded'+AND+folders)+AND+apple)&OS=%22spring+loaded%22+AND+folders+AND+apple&RS=((%22spring+loaded%22+AND+folders)+AND+apple)#bottom

[2] 
http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=/netahtml/search-adv.htm&r=6&f=G&l=50&d=PTXT&p=1&p=1&S1=(('spring+loaded'+AND+folders)+AND+apple)&OS=%22spring+loaded%22+AND+folders+AND+apple&RS=((%22spring+loaded%22+AND+folders)+AND+apple)

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a world-famous umbrella-wielding boxer She's a ditzy tomboy angel from 
out of town. They fight crime! 
Index: libnautilus/nautilus-view-component.idl
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus/nautilus-view-component.idl,v
retrieving revision 1.46
diff -u -p -r1.46 nautilus-view-component.idl
--- libnautilus/nautilus-view-component.idl	15 May 2002 15:57:18 -0000	1.46
+++ libnautilus/nautilus-view-component.idl	28 Feb 2003 15:31:45 -0000
@@ -90,6 +90,9 @@ module Nautilus {
 		oneway void open_location_force_new_window (in URI location,
 							    in URIList selection);
 
+		oneway void open_location_spring_loaded (in URI location,
+							 in URIList selection);
+
 		/* Called by a view component when the location
 		 * changes, but the view component is handling it
 		 * directly. This differs from
@@ -151,6 +154,8 @@ module Nautilus {
 		 */
 		oneway void go_back ();
 		oneway void close_window ();
+
+		oneway void close_sprung_windows ();
 	};
 
 };
Index: libnautilus/nautilus-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus/nautilus-view.c,v
retrieving revision 1.94
diff -u -p -r1.94 nautilus-view.c
--- libnautilus/nautilus-view.c	15 May 2002 15:57:19 -0000	1.94
+++ libnautilus/nautilus-view.c	28 Feb 2003 15:31:45 -0000
@@ -607,6 +607,27 @@ call_open_location_force_new_window (Nau
 }
 
 static void
+call_open_location_spring_loaded (NautilusView *view,
+				  gpointer callback_data)
+{
+	LocationPlus *location_plus;
+	CORBA_Environment ev;
+	Nautilus_ViewFrame view_frame;
+	Nautilus_URIList *uri_list;
+
+	location_plus = callback_data;
+
+	view_frame = view_frame_call_begin (view, &ev);
+	if (view_frame != CORBA_OBJECT_NIL) {
+		uri_list = nautilus_uri_list_from_g_list (location_plus->selection);
+		Nautilus_ViewFrame_open_location_spring_loaded
+			(view_frame, location_plus->location, uri_list, &ev);
+		CORBA_free (uri_list);
+	}
+	view_frame_call_end (view_frame, &ev);
+}
+
+static void
 call_report_location_change (NautilusView *view,
 			     gpointer callback_data)
 {
@@ -788,6 +809,19 @@ call_close_window (NautilusView *view,
 	view_frame_call_end (view_frame, &ev);
 }
 
+static void
+call_close_sprung_windows (NautilusView *view,
+			   gpointer callback_data)
+{
+	CORBA_Environment ev;
+	Nautilus_ViewFrame view_frame;
+
+	view_frame = view_frame_call_begin (view, &ev);
+	if (view_frame != CORBA_OBJECT_NIL) {
+		Nautilus_ViewFrame_close_sprung_windows (view_frame, &ev);
+	}
+	view_frame_call_end (view_frame, &ev);
+}
 
 void
 nautilus_view_open_location_in_this_window (NautilusView *view,
@@ -827,6 +861,23 @@ nautilus_view_open_location_force_new_wi
 }
 
 void
+nautilus_view_open_location_spring_loaded (NautilusView *view,
+					   const char *location,
+					   GList *selection)
+{
+	LocationPlus *location_plus;
+	
+	location_plus = g_new0 (LocationPlus, 1);
+	location_plus->location = g_strdup (location);
+	location_plus->selection = str_list_copy (selection);
+
+	queue_outgoing_call (view,
+			     call_open_location_spring_loaded,
+			     location_plus,
+			     free_location_plus_callback);
+}
+
+void
 nautilus_view_report_location_change (NautilusView *view,
 				      const char *location,
 				      GList *selection,
@@ -951,6 +1002,15 @@ nautilus_view_close_window (NautilusView
 			     NULL);
 }
 
+void
+nautilus_view_close_sprung_windows (NautilusView *view)
+{
+	queue_outgoing_call (view,
+			     call_close_sprung_windows,
+			     NULL,
+			     NULL);
+}
+				  
 BonoboControl *
 nautilus_view_get_bonobo_control (NautilusView *view)
 {
Index: libnautilus/nautilus-view.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus/nautilus-view.h,v
retrieving revision 1.48
diff -u -p -r1.48 nautilus-view.h
--- libnautilus/nautilus-view.h	4 Feb 2003 10:36:00 -0000	1.48
+++ libnautilus/nautilus-view.h	28 Feb 2003 15:31:45 -0000
@@ -77,6 +77,9 @@ void               nautilus_view_open_lo
 void               nautilus_view_open_location_force_new_window       (NautilusView           *view,
 								       const char             *location_uri,
 								       GList                  *selection); /* list of URI char *s */
+void               nautilus_view_open_location_spring_loaded          (NautilusView           *view,
+								       const char             *location_uri,
+								       GList                  *selection); /* list of URI char *s */
 void               nautilus_view_report_location_change               (NautilusView           *view,
 								       const char             *location_uri,
 								       GList                  *selection, /* list of URI char *s */
@@ -99,6 +102,7 @@ void               nautilus_view_set_tit
 								       const char             *title);
 void               nautilus_view_go_back                              (NautilusView           *view);
 void               nautilus_view_close_window                         (NautilusView           *view);
+void               nautilus_view_close_sprung_windows                 (NautilusView           *view);
 
 /* Some utility functions useful for doing the CORBA work directly.
  * Not needed by most components, but shared with the view frame code,
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.318
diff -u -p -r1.318 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c	28 Feb 2003 15:14:58 -0000	1.318
+++ libnautilus-private/nautilus-icon-container.c	28 Feb 2003 15:31:45 -0000
@@ -202,6 +202,7 @@ enum {
 	SELECTION_CHANGED,
 	ICON_ADDED,
 	ICON_REMOVED,
+	ICON_DROP_TARGET_CHANGED,
 	CLEARED,
 	LAST_SIGNAL
 };
@@ -3467,6 +3468,16 @@ nautilus_icon_container_class_init (Naut
 		                g_cclosure_marshal_VOID__POINTER,
 		                G_TYPE_NONE, 1, G_TYPE_POINTER);
 
+	signals[ICON_DROP_TARGET_CHANGED]
+		= g_signal_new ("icon_drop_target_changed",
+				G_TYPE_FROM_CLASS (class),
+				G_SIGNAL_RUN_LAST,
+				G_STRUCT_OFFSET (NautilusIconContainerClass,
+						 icon_drop_target_changed),
+				NULL, NULL,
+				g_cclosure_marshal_VOID__POINTER,
+				G_TYPE_NONE, 1, G_TYPE_POINTER);
+
 	signals[CLEARED]
 		= g_signal_new ("cleared",
 		                G_TYPE_FROM_CLASS (class),
@@ -6005,6 +6016,14 @@ nautilus_icon_container_accessible_get_t
         }
 
         return type;
+}
+
+void
+nautilus_icon_container_drop_target_changed (NautilusIconContainer *container,
+				   	     NautilusIconData *icon_data)
+{
+	g_signal_emit (G_OBJECT (container), signals[ICON_DROP_TARGET_CHANGED],
+		       0, icon_data);
 }
 
 #if ! defined (NAUTILUS_OMIT_SELF_CHECK)
Index: libnautilus-private/nautilus-icon-container.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.h,v
retrieving revision 1.74
diff -u -p -r1.74 nautilus-icon-container.h
--- libnautilus-private/nautilus-icon-container.h	16 Oct 2002 16:27:20 -0000	1.74
+++ libnautilus-private/nautilus-icon-container.h	28 Feb 2003 15:31:45 -0000
@@ -161,6 +161,8 @@ typedef struct {
                                                    NautilusIconData *data);
         void         (* icon_removed)             (NautilusIconContainer *container,
                                                    NautilusIconData *data);
+	void	     (* icon_drop_target_changed) (NautilusIconContainer *container,
+						   NautilusIconData *data);
         void         (* cleared)                  (NautilusIconContainer *container);
 } NautilusIconContainerClass;
 
@@ -241,4 +243,6 @@ void              nautilus_icon_containe
 void              nautilus_icon_container_set_use_drop_shadows          (NautilusIconContainer  *container,
 									 gboolean                use_drop_shadows);
 
+void              nautilus_icon_container_drop_target_changed           (NautilusIconContainer  *container,
+									 NautilusIconData       *icon_data);
 #endif /* NAUTILUS_ICON_CONTAINER_H */
Index: libnautilus-private/nautilus-icon-dnd.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-dnd.c,v
retrieving revision 1.126
diff -u -p -r1.126 nautilus-icon-dnd.c
--- libnautilus-private/nautilus-icon-dnd.c	17 Feb 2003 09:20:55 -0000	1.126
+++ libnautilus-private/nautilus-icon-dnd.c	28 Feb 2003 15:31:45 -0000
@@ -1108,6 +1108,8 @@ set_drop_target (NautilusIconContainer *
 	container->details->drop_target = icon;
 	nautilus_icon_container_update_icon (container, old_icon);
 	nautilus_icon_container_update_icon (container, icon);
+
+	nautilus_icon_container_drop_target_changed (container, icon ? icon->data : NULL);
 }
 
 static void
@@ -1238,7 +1240,7 @@ nautilus_icon_dnd_begin_drag (NautilusIc
 				  actions,
 				  button,
 				  (GdkEvent *) event);
-
+	
 	if (context) {
 		/* set the icon for dragging */
 		gtk_drag_set_icon_pixbuf (context, pixbuf, x_offset, y_offset);
@@ -1296,7 +1298,7 @@ void
 nautilus_icon_dnd_end_drag (NautilusIconContainer *container)
 {
 	NautilusIconDndInfo *dnd_info;
-
+	
 	g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
 		
 	dnd_info = container->details->dnd_info;
Index: src/nautilus-view-frame-corba.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-view-frame-corba.c,v
retrieving revision 1.42
diff -u -p -r1.42 nautilus-view-frame-corba.c
--- src/nautilus-view-frame-corba.c	17 Jan 2002 01:39:26 -0000	1.42
+++ src/nautilus-view-frame-corba.c	28 Feb 2003 15:31:45 -0000
@@ -102,6 +102,19 @@ open_force_new_window (NautilusViewFrame
 }
 
 static void
+open_spring_loaded_window (NautilusViewFrame *view,
+			   gpointer callback_data)
+{
+	LocationPlus *location_plus;
+
+	location_plus = callback_data;
+	nautilus_view_frame_open_location_spring_loaded
+		(view,
+		 location_plus->location,
+		 location_plus->selection);
+}
+
+static void
 report_location_change (NautilusViewFrame *view,
 			gpointer callback_data)
 {
@@ -194,6 +207,13 @@ close_window (NautilusViewFrame *view,
 }
 
 static void
+close_sprung_windows (NautilusViewFrame *view,
+		      gpointer callback_data)
+{
+	nautilus_view_frame_close_sprung_windows (view);
+}
+
+static void
 impl_Nautilus_ViewFrame_open_location_in_this_window (PortableServer_Servant servant,
 						      const CORBA_char *location,
 						      CORBA_Environment *ev)
@@ -237,6 +257,25 @@ impl_Nautilus_ViewFrame_open_location_fo
 }
 
 static void
+impl_Nautilus_ViewFrame_open_location_spring_loaded (PortableServer_Servant servant,
+						     const CORBA_char *location,
+						     const Nautilus_URIList *selection,
+						     CORBA_Environment *ev)
+{
+	LocationPlus *location_plus;
+
+	location_plus = g_new0 (LocationPlus, 1);
+	location_plus->location = g_strdup (location);
+	location_plus->selection = nautilus_g_list_from_uri_list (selection);
+
+	nautilus_view_frame_queue_incoming_call
+		(servant,
+		 open_spring_loaded_window,
+		 location_plus,
+		 free_location_plus_callback);
+}
+
+static void
 impl_Nautilus_ViewFrame_report_location_change (PortableServer_Servant servant,
 						const CORBA_char *location,
 						const Nautilus_URIList *selection,
@@ -381,6 +420,14 @@ impl_Nautilus_ViewFrame_close_window (Po
 		(servant, close_window, NULL, NULL);
 }
 
+static void
+impl_Nautilus_ViewFrame_close_sprung_windows (PortableServer_Servant servant,
+					      CORBA_Environment *ev)
+{
+	nautilus_view_frame_queue_incoming_call
+		(servant, close_sprung_windows, NULL, NULL);
+}
+
 static GType nautilus_view_frame_corba_part_get_type (void);
 
 BONOBO_CLASS_BOILERPLATE_FULL (NautilusViewFrameCorbaPart, nautilus_view_frame_corba_part,
@@ -396,6 +443,7 @@ nautilus_view_frame_corba_part_class_ini
 	class->epv.open_location_in_this_window = impl_Nautilus_ViewFrame_open_location_in_this_window;
 	class->epv.open_location_prefer_existing_window = impl_Nautilus_ViewFrame_open_location_prefer_existing_window;
 	class->epv.open_location_force_new_window = impl_Nautilus_ViewFrame_open_location_force_new_window;
+	class->epv.open_location_spring_loaded = impl_Nautilus_ViewFrame_open_location_spring_loaded;
 	class->epv.report_location_change = impl_Nautilus_ViewFrame_report_location_change;
 	class->epv.report_redirect = impl_Nautilus_ViewFrame_report_redirect;
 	class->epv.report_selection_change = impl_Nautilus_ViewFrame_report_selection_change;
@@ -407,6 +455,7 @@ nautilus_view_frame_corba_part_class_ini
 	class->epv.set_title = impl_Nautilus_ViewFrame_set_title;
 	class->epv.go_back = impl_Nautilus_ViewFrame_go_back;
 	class->epv.close_window = impl_Nautilus_ViewFrame_close_window;
+	class->epv.close_sprung_windows = impl_Nautilus_ViewFrame_close_sprung_windows;
 }
 
 static void
Index: src/nautilus-view-frame.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-view-frame.c,v
retrieving revision 1.161
diff -u -p -r1.161 nautilus-view-frame.c
--- src/nautilus-view-frame.c	28 Feb 2003 15:15:02 -0000	1.161
+++ src/nautilus-view-frame.c	28 Feb 2003 15:31:46 -0000
@@ -60,10 +60,12 @@ enum {
 	GET_HISTORY_LIST,
 	GO_BACK,
 	CLOSE_WINDOW,
+	CLOSE_SPRUNG_WINDOWS,
 	LOAD_COMPLETE,
 	LOAD_PROGRESS_CHANGED,
 	LOAD_UNDERWAY,
 	OPEN_LOCATION_FORCE_NEW_WINDOW,
+	OPEN_LOCATION_SPRING_LOADED,
 	OPEN_LOCATION_IN_THIS_WINDOW,
 	OPEN_LOCATION_PREFER_EXISTING_WINDOW,
 	REPORT_LOCATION_CHANGE,
@@ -1108,6 +1110,23 @@ nautilus_view_frame_open_location_force_
 }
 
 void
+nautilus_view_frame_open_location_spring_loaded (NautilusViewFrame *view,
+						 const char *location,
+						 GList *selection)
+{
+	g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
+
+	if (view->details->state == VIEW_FRAME_FAILED) {
+		return;
+	}
+
+	view_frame_wait_is_over (view);
+	g_signal_emit (view,
+		       signals[OPEN_LOCATION_SPRING_LOADED], 0,
+		       location, selection);
+}
+
+void
 nautilus_view_frame_report_location_change (NautilusViewFrame *view,
 					    const char *location,
 					    GList *selection,
@@ -1246,6 +1265,14 @@ nautilus_view_frame_close_window (Nautil
 }
 
 void
+nautilus_view_frame_close_sprung_windows (NautilusViewFrame *view)
+{
+	g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (view));
+
+	g_signal_emit (view, signals[CLOSE_SPRUNG_WINDOWS], 0);
+}
+
+void
 nautilus_view_frame_set_title (NautilusViewFrame *view,
                                const char *title)
 {
@@ -1441,6 +1468,15 @@ nautilus_view_frame_class_init (Nautilus
 		 NULL, NULL,
 		 g_cclosure_marshal_VOID__VOID,
 		 G_TYPE_NONE, 0);
+	signals[CLOSE_SPRUNG_WINDOWS] = g_signal_new
+		("close_sprung_windows",
+		 G_TYPE_FROM_CLASS (class),
+		 G_SIGNAL_RUN_LAST,
+		 G_STRUCT_OFFSET (NautilusViewFrameClass,
+				  close_sprung_windows),
+		 NULL, NULL,
+		 g_cclosure_marshal_VOID__VOID,
+		 G_TYPE_NONE, 0);
 	signals[LOAD_COMPLETE] = g_signal_new
 		("load_complete",
 		 G_TYPE_FROM_CLASS (class),
@@ -1474,6 +1510,15 @@ nautilus_view_frame_class_init (Nautilus
 		 G_SIGNAL_RUN_LAST,
 		 G_STRUCT_OFFSET (NautilusViewFrameClass, 
 				  open_location_force_new_window),
+		 NULL, NULL,
+		 eel_marshal_VOID__STRING_POINTER,
+		 G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_POINTER);
+	signals[OPEN_LOCATION_SPRING_LOADED] = g_signal_new
+		("open_location_spring_loaded",
+		 G_TYPE_FROM_CLASS (class),
+		 G_SIGNAL_RUN_LAST,
+		 G_STRUCT_OFFSET (NautilusViewFrameClass,
+				  open_location_spring_loaded),
 		 NULL, NULL,
 		 eel_marshal_VOID__STRING_POINTER,
 		 G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_POINTER);
Index: src/nautilus-view-frame.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-view-frame.h,v
retrieving revision 1.70
diff -u -p -r1.70 nautilus-view-frame.h
--- src/nautilus-view-frame.h	4 Feb 2003 10:36:14 -0000	1.70
+++ src/nautilus-view-frame.h	28 Feb 2003 15:31:46 -0000
@@ -72,6 +72,9 @@ typedef struct {
         void               (* open_location_force_new_window)       (NautilusViewFrame *view,
                                                                      const char        *location,
                                                                      GList             *selection); /* list of char * */
+        void               (* open_location_spring_loaded)          (NautilusViewFrame *view,
+                                                                     const char        *location,
+                                                                     GList             *selection); /* list of char * */
         void               (* report_location_change)               (NautilusViewFrame *view,
                                                                      const char        *location,
                                                                      GList             *selection, /* list of char * */
@@ -93,6 +96,7 @@ typedef struct {
 	Nautilus_History * (* get_history_list)                     (NautilusViewFrame *view);
         void               (* go_back)                              (NautilusViewFrame *view);
         void               (* close_window)                         (NautilusViewFrame *view);
+        void               (* close_sprung_windows)                 (NautilusViewFrame *view);
 } NautilusViewFrameClass;
 
 /* basic view management */
@@ -137,4 +141,8 @@ char *             nautilus_view_frame_g
 void               nautilus_view_frame_set_label                 (NautilusViewFrame   *view,
                                                                   const char          *label);
 
+void               nautilus_view_frame_close_sprung_windows      (NautilusViewFrame   *view);
+void               nautilus_view_frame_open_location_spring_loaded (NautilusViewFrame *view,
+                                                                    const char *location,
+                                                                    GList *selection);
 #endif /* NAUTILUS_VIEW_FRAME_H */
Index: src/nautilus-window-manage-views.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-manage-views.c,v
retrieving revision 1.313
diff -u -p -r1.313 nautilus-window-manage-views.c
--- src/nautilus-window-manage-views.c	12 Dec 2002 09:05:22 -0000	1.313
+++ src/nautilus-window-manage-views.c	28 Feb 2003 15:31:46 -0000
@@ -113,6 +113,8 @@ static void free_location_change   (Naut
 static void end_location_change    (NautilusWindow             *window);
 static void cancel_location_change (NautilusWindow             *window);
 
+static GList *spring_loaded_folders = NULL;
+
 static void
 change_selection (NautilusWindow *window,
                   GList *selection,
@@ -709,10 +711,18 @@ location_has_really_changed (NautilusWin
 }
 
 static void
+remove_window_from_list (NautilusWindow *window,
+                         gpointer data)
+{
+        spring_loaded_folders = g_list_remove (spring_loaded_folders, window);
+}
+
+static void
 open_location (NautilusWindow *window,
                const char *location,
                gboolean force_new_window,
-               GList *new_selection)
+               GList *new_selection,
+               gboolean spring_loaded)
 {
         NautilusWindow *target_window;
         gboolean create_new_window;
@@ -743,6 +753,11 @@ open_location (NautilusWindow *window,
                 target_window = nautilus_application_create_window (
 						window->application,
 						gtk_window_get_screen (GTK_WINDOW (window)));
+                if (spring_loaded) {
+                        g_object_weak_ref (G_OBJECT (target_window),
+                                           (GWeakNotify) remove_window_from_list, NULL);
+                        spring_loaded_folders = g_list_prepend (spring_loaded_folders, target_window);
+                }
 	}
 
 	eel_g_list_free_deep (target_window->details->pending_selection);
@@ -760,7 +775,7 @@ void
 nautilus_window_open_location (NautilusWindow *window,
                                const char *location)
 {
-        open_location (window, location, FALSE, NULL);
+        open_location (window, location, FALSE, NULL, FALSE);
 }
 
 void
@@ -768,7 +783,7 @@ nautilus_window_open_location_with_selec
 					      const char *location,
 					      GList *selection)
 {
-	open_location (window, location, FALSE, selection);
+	open_location (window, location, FALSE, selection, FALSE);
 }					      
 
 
@@ -1815,6 +1830,23 @@ close_window_callback (NautilusViewFrame
 }
 
 static void
+close_sprung_windows_callback (NautilusViewFrame *view,
+                               NautilusWindow *window)
+{
+        GList *slf, *s;
+        g_assert (NAUTILUS_IS_WINDOW (window));
+
+        slf = spring_loaded_folders;
+        spring_loaded_folders = NULL;
+
+        for (s = slf; s; s = s->next) {
+                nautilus_window_close (NAUTILUS_WINDOW (s->data));
+        }
+
+        g_list_free (slf);
+}
+
+static void
 change_selection_callback (NautilusViewFrame *view,
                            GList *selection,
                            NautilusWindow *window)
@@ -1915,7 +1947,7 @@ open_location_prefer_existing_window_cal
         }
 
         /* Otherwise, open a new window. */
-        open_location (window, location, TRUE, NULL);
+        open_location (window, location, TRUE, NULL, FALSE);
 }
 
 static void
@@ -1926,7 +1958,18 @@ open_location_force_new_window_callback 
 {
         g_assert (NAUTILUS_IS_WINDOW (window));
 
-        open_location (window, location, TRUE, selection);
+        open_location (window, location, TRUE, selection, FALSE);
+}
+
+static void
+open_location_spring_loaded_callback (NautilusViewFrame *view,
+                                      const char *location,
+                                      GList *selection,
+                                      NautilusWindow *window)
+{
+        g_assert (NAUTILUS_IS_WINDOW (window));
+
+        open_location (window, location, TRUE, selection, TRUE);
 }
 
 static void
@@ -2127,10 +2170,12 @@ view_loaded_callback (NautilusViewFrame 
 	macro (get_history_list)			\
 	macro (go_back)					\
         macro (close_window)                            \
-	macro (load_complete)				\
+        macro (close_sprung_windows)                    \
+        macro (load_complete)				\
 	macro (load_underway)				\
 	macro (open_location_force_new_window)		\
-	macro (open_location_in_this_window)		\
+        macro (open_location_spring_loaded)             \
+        macro (open_location_in_this_window)		\
 	macro (open_location_prefer_existing_window)	\
 	macro (report_location_change)			\
 	macro (report_redirect)				\
Index: src/file-manager/fm-icon-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-icon-view.c,v
retrieving revision 1.273
diff -u -p -r1.273 fm-icon-view.c
--- src/file-manager/fm-icon-view.c	28 Feb 2003 15:15:05 -0000	1.273
+++ src/file-manager/fm-icon-view.c	28 Feb 2003 15:31:46 -0000
@@ -101,6 +101,8 @@
 #define ID_TIGHTER_LAYOUT                       "Tighter Layout"
 #define ID_SORT_REVERSED                        "Reversed Order"
 
+#define SPRING_FOLDERS_DELAY                    500
+
 typedef struct {
 	NautilusFileSortType sort_type;
 	const char *metadata_text;
@@ -136,6 +138,9 @@ struct FMIconViewDetails
 
 	gboolean filter_by_screen;
 	int num_screens;
+
+	guint spring_id;
+	NautilusFile *spring_drop_target;
 };
 
 
@@ -1850,6 +1855,57 @@ selection_changed_callback (NautilusIcon
 	fm_directory_view_notify_selection_changed (FM_DIRECTORY_VIEW (icon_view));
 }
 
+static gboolean
+spring_folder (gpointer data)
+{
+	NautilusView *view;
+	FMIconView *icon_view;
+	char *location_uri;
+
+	icon_view = data;
+	view = fm_directory_view_get_nautilus_view (FM_DIRECTORY_VIEW (icon_view));
+
+	location_uri = nautilus_file_get_uri (icon_view->details->spring_drop_target);
+	nautilus_view_open_location_spring_loaded (view, location_uri, NULL);
+	g_free (location_uri);
+	
+	icon_view->details->spring_id = 0;
+	return FALSE;
+}
+
+static void
+drop_target_changed_callback (NautilusIconContainer *container,
+			      NautilusIconData *data,
+			      FMIconView *icon_view)
+{
+	if (icon_view->details->spring_id > 0) {
+		g_source_remove (icon_view->details->spring_id);
+	}
+
+	if (data == NULL) {
+		return;
+	}
+	
+	icon_view->details->spring_drop_target = NAUTILUS_FILE (data);
+	icon_view->details->spring_id = g_timeout_add (SPRING_FOLDERS_DELAY, spring_folder, icon_view);
+}
+
+static void
+drag_end_callback (NautilusIconContainer *container,
+		   GdkDragContext *context,
+		   FMIconView *icon_view)
+{
+	NautilusView *view;
+
+	if (icon_view->details->spring_id > 0) {
+		g_source_remove (icon_view->details->spring_id);
+		icon_view->details->spring_id = 0;
+	}
+	
+	view = fm_directory_view_get_nautilus_view (FM_DIRECTORY_VIEW (icon_view));
+	nautilus_view_close_sprung_windows (view);
+}
+
 static void
 icon_container_context_click_selection_callback (NautilusIconContainer *container,
 						 GdkEventButton *event,
@@ -2238,6 +2294,10 @@ create_icon_container (FMIconView *icon_
 				 G_CALLBACK (fm_icon_view_icon_text_changed_callback), icon_view, 0);
 	g_signal_connect_object (icon_container, "selection_changed",
 				 G_CALLBACK (selection_changed_callback), icon_view, 0);
+	g_signal_connect (icon_container, "icon_drop_target_changed",
+			  G_CALLBACK (drop_target_changed_callback), icon_view);
+	g_signal_connect (icon_container, "drag_end",
+			  G_CALLBACK (drag_end_callback), icon_view);
 	/* FIXME: many of these should move into fm-icon-container as virtual methods */
 	g_signal_connect_object (icon_container, "get_icon_uri",
 				 G_CALLBACK (get_icon_uri_callback), icon_view, 0);


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