Re: eel capability patches



Please don't add this to Nautilus, we are working on a similar mechanism
for GnomeVFS 2.2. Honestly, if you need a VFS feature that GnomeVFS is
not providing its much better to see if it could/should be added to the
main library before tacking it into eel. Eel already has a bunch of VFS
code that really should have gone into GnomeVFS.

-Seth

On Fri, 2002-06-14 at 12:03, Dave Camp wrote:
> These patches have the changes alex and I discussed on irc.
> 
> -- 
> Dave Camp <dave ximian com>
> ----
> 

> ? eel-has-capability.patch
> ? test/test-eel-pixbuf-scale
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/eel/ChangeLog,v
> retrieving revision 1.407
> diff -u -r1.407 ChangeLog
> --- ChangeLog	13 Jun 2002 18:22:00 -0000	1.407
> +++ ChangeLog	14 Jun 2002 19:03:32 -0000
> @@ -1,3 +1,10 @@
> +2002-06-14  Dave Camp  <dave ximian com>
> +
> +	* eel/eel-vfs-extensions.c: (eel_vfs_has_capability_uri): Moved
> +	here from eel_vfs_test_capabilities().
> +	(eel_vfs_has_capability): New function, takes a string uri.  
> +	* eel/eel-vfs-extensions.h: Changed EelVfsTest to EelVfsCapability.
> +
>  2002-06-13  Dave Camp  <dave ximian com>
>  
>  	* eel/eel-stock-dialogs.c: (eel_run_simple_dialog): Don't try to
> Index: eel/eel-vfs-extensions.c
> ===================================================================
> RCS file: /cvs/gnome/eel/eel/eel-vfs-extensions.c,v
> retrieving revision 1.12
> diff -u -r1.12 eel-vfs-extensions.c
> --- eel/eel-vfs-extensions.c	6 Jun 2002 16:53:12 -0000	1.12
> +++ eel/eel-vfs-extensions.c	14 Jun 2002 19:03:32 -0000
> @@ -1635,8 +1635,8 @@
>  
>  
>  gboolean
> -eel_vfs_test_capabilities (GnomeVFSURI *uri,
> -			   EelVfsTest   test)
> +eel_vfs_has_capability_uri (GnomeVFSURI     *uri,
> +			    EelVfsCapability capability)
>  {
>  	gboolean ret;
>  	const char *scheme;
> @@ -1645,7 +1645,7 @@
>  
>  	scheme = gnome_vfs_uri_get_scheme (uri);
>  
> -	switch (test) {
> +	switch (capability) {
>  	case EEL_VFS_TEST_IS_REMOTE_AND_SLOW:
>  		ret = !(gnome_vfs_uri_is_local (uri) ||
>  			!strcmp (scheme, "file"));
> @@ -1654,6 +1654,24 @@
>  		ret = FALSE;
>  		g_assert_not_reached ();
>  	}
> +
> +	return ret;
> +}
> +
> +gboolean
> +eel_vfs_has_capability (const char       *text_uri,
> +			EelVfsCapability  capability)
> +{
> +	gboolean ret;
> +	GnomeVFSURI *uri;
> +	
> +	g_return_val_if_fail (text_uri != NULL, FALSE);
> +
> +	uri = gnome_vfs_uri_new (text_uri);
> +
> +	ret = eel_vfs_has_capability_uri (uri, capability);
> +	
> +	gnome_vfs_uri_unref (uri);
>  
>  	return ret;
>  }
> Index: eel/eel-vfs-extensions.h
> ===================================================================
> RCS file: /cvs/gnome/eel/eel/eel-vfs-extensions.h,v
> retrieving revision 1.9
> diff -u -r1.9 eel-vfs-extensions.h
> --- eel/eel-vfs-extensions.h	6 Jun 2002 16:53:12 -0000	1.9
> +++ eel/eel-vfs-extensions.h	14 Jun 2002 19:03:33 -0000
> @@ -98,10 +98,12 @@
>  typedef enum {
>  /*	EEL_VFS_TEST_SAFE_TO_EXECUTE, - fm-directory-view.c: ~4820 ? */
>  	EEL_VFS_TEST_IS_REMOTE_AND_SLOW  /* We prefer to link, rather than copy */
> -} EelVfsTest;
> +} EelVfsCapability;
>  
> -gboolean           eel_vfs_test_capabilities             (GnomeVFSURI          *uri,
> -							  EelVfsTest            test);
> +gboolean           eel_vfs_has_capability                (const char           *text_uri,
> +						          EelVfsCapability      capability);
> +gboolean           eel_vfs_has_capability_uri            (GnomeVFSURI          *uri,
> +						          EelVfsCapability      capability);
>  
>  G_END_DECLS
>  
> ----
> 

> ? nautilus-has-capability.patch
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/nautilus/ChangeLog,v
> retrieving revision 1.5373
> diff -u -r1.5373 ChangeLog
> --- ChangeLog	13 Jun 2002 18:26:11 -0000	1.5373
> +++ ChangeLog	14 Jun 2002 19:04:32 -0000
> @@ -1,3 +1,8 @@
> +2002-06-14  Dave Camp  <dave ximian com>
> +
> +	* src/file-manager/fm-icon-view.c: (icon_view_handle_uri_list):
> +	Use the eel_vfs_has_capability() function.
> +
>  2002-06-13  Dave Camp  <dave ximian com>
>  
>  	* libnautilus-private/nautilus-file.c:
> Index: src/file-manager/fm-icon-view.c
> ===================================================================
> RCS file: /cvs/gnome/nautilus/src/file-manager/fm-icon-view.c,v
> retrieving revision 1.263
> diff -u -r1.263 fm-icon-view.c
> --- src/file-manager/fm-icon-view.c	6 Jun 2002 16:57:05 -0000	1.263
> +++ src/file-manager/fm-icon-view.c	14 Jun 2002 19:04:34 -0000
> @@ -2232,13 +2232,12 @@
>  
>  	GList *uri_list;
>  	GList *node, *real_uri_list = NULL;
> -	GnomeVFSURI *container_uri;
>  	GnomeDesktopItem *entry;
>  	GdkPoint point;
>  	char *uri;
>  	char *path;
>  	char *stripped_uri;
> -	char *container_uri_string;
> +	char *container_uri;
>  	const char *last_slash, *link_name;
>  	int n_uris;
>  	gboolean all_local;
> @@ -2248,17 +2247,15 @@
>  		return;
>  	}
>  
> -	container_uri_string = fm_directory_view_get_uri (FM_DIRECTORY_VIEW (view));
> -	container_uri = gnome_vfs_uri_new (container_uri_string);
> +	container_uri = fm_directory_view_get_uri (FM_DIRECTORY_VIEW (view));
>  	g_return_if_fail (container_uri != NULL);
>  
> -	if (eel_vfs_test_capabilities (container_uri,
> -				       EEL_VFS_TEST_IS_REMOTE_AND_SLOW)) {
> +	if (eel_vfs_has_capability (container_uri,
> +				    EEL_VFS_TEST_IS_REMOTE_AND_SLOW)) {
>  		eel_show_warning_dialog (_("Drag and drop is only supported to local file systems."),
>  					 _("Drag and Drop error"),
>  					 fm_directory_view_get_containing_window (FM_DIRECTORY_VIEW (view)));
> -		gnome_vfs_uri_unref (container_uri);
> -		g_free (container_uri_string);
> +		g_free (container_uri);
>  		return;
>  	}
>  
> @@ -2276,8 +2273,7 @@
>  		eel_show_warning_dialog (_("An invalid drag type was used."),
>  					 _("Drag and Drop error"),
>  					 fm_directory_view_get_containing_window (FM_DIRECTORY_VIEW (view)));
> -		gnome_vfs_uri_unref (container_uri);
> -		g_free (container_uri_string);
> +		g_free (container_uri);
>  		return;
>  	}
>  
> @@ -2299,8 +2295,10 @@
>  		if (sanitized_uri == NULL)
>  			continue;
>  		real_uri_list = g_list_append (real_uri_list, sanitized_uri);
> -		if (strncmp (sanitized_uri, "file", 4) != 0)
> +		if (eel_vfs_has_capability (sanitized_uri,
> +					    EEL_VFS_TEST_IS_REMOTE_AND_SLOW)) {
>  			all_local = FALSE;
> +		}
>  		n_uris++;
>  	}
>  	nautilus_icon_dnd_uri_list_free_strings (uri_list);
> @@ -2319,7 +2317,7 @@
>  			points = NULL;
>  		}
>  		fm_directory_view_move_copy_items (real_uri_list, points,
> -						   container_uri_string,
> +						   container_uri,
>  						   action, x, y, FM_DIRECTORY_VIEW (view));
>  		
>  		if (points)
> @@ -2341,7 +2339,7 @@
>  
>  			if (entry != NULL) {
>  				/* FIXME: Handle name conflicts? */
> -				nautilus_link_local_create_from_gnome_entry (entry, container_uri_string, &point);
> +				nautilus_link_local_create_from_gnome_entry (entry, container_uri, &point);
>  
>  				gnome_desktop_item_unref (entry);
>  				continue;
> @@ -2359,7 +2357,7 @@
>  			
>  			if (!eel_str_is_empty (link_name)) {
>  				/* FIXME: Handle name conflicts? */
> -				nautilus_link_local_create (container_uri_string, link_name,
> +				nautilus_link_local_create (container_uri, link_name,
>  							    NULL, uri,
>  							    &point, NAUTILUS_LINK_GENERIC);
>  			}
> @@ -2371,8 +2369,7 @@
>  	
>  	nautilus_icon_dnd_uri_list_free_strings (real_uri_list);
>  
> -	gnome_vfs_uri_unref (container_uri);
> -	g_free (container_uri_string);
> +	g_free (container_uri);
>  	
>  }
>  





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