Re: Drag'n drop of files on a launcher



And here's a little patch to make it all happen! :)

Shall I commit?

- Frank


On Thu, 2002-07-25 at 17:03, Frank Worsley wrote:
> You have to define an Exec parameter value in the desktop file's Exec
> string, otherwise Nautilus just appends the URIs to the command. Since
> non-gnomevfs apps don't understand URIs this leads to problems.
> 
> For emacs you probably want something like "emacs %F". See here for the
> available parameters: 
> 
> http://www.freedesktop.org/standards/desktop-entry-spec/desktop-entry-spec.html#EXEC-VARIABLES
> 
> A saner default might be to append the local file paths instead of URIs,
> anyone object to changing that? I personally think it would be better
> since then non-gnome2 apps would work and gnome2 apps understand local
> paths anyways. It would break drag'n'drop from remote URIs though, but
> that is less common than dragging local files to launchers without Exec
> parameters.
> 
> - Frank
> 
> 
> On Thu, 2002-07-25 at 14:34, Anne et Bertrand wrote:
> > I'm running nautilus-2.0.1 compiled from from Mdk cooker.
> > 
> > Action : drag'n drop of a file on an application launcher.
> > 
> > If the application of the launcher isn't a gnome2 app (say emacs, or 
> > gqview, I've tested), the app opens its default location (splash for 
> > emacs, ~/ for gqview) and not the file you dropped on it.
> > 
> > I've got the same behaviour with launcher on gnome-panel.
> > 
> > Is this bug the same as 75620 and 82604 ?
> > 
> > Bertrand Dekoninck
> > -- 
> > nautilus-list mailing list
> > nautilus-list gnome org
> > http://mail.gnome.org/mailman/listinfo/nautilus-list
> 
> 
> -- 
> nautilus-list mailing list
> nautilus-list gnome org
> http://mail.gnome.org/mailman/listinfo/nautilus-list

Index: libgnome-desktop/gnome-desktop-item.c
===================================================================
RCS file: /cvs/gnome/gnome-desktop/libgnome-desktop/gnome-desktop-item.c,v
retrieving revision 1.109
diff -u -p -r1.109 gnome-desktop-item.c
--- libgnome-desktop/gnome-desktop-item.c	12 Jul 2002 03:45:09 -0000	1.109
+++ libgnome-desktop/gnome-desktop-item.c	20 Jul 2002 02:45:05 -0000
@@ -1478,7 +1478,8 @@ ditem_execute (const GnomeDesktopItem *i
                char **envp,
 	       gboolean launch_only_one,
 	       gboolean use_current_dir,
-		 gboolean append_uris,
+	       gboolean append_uris,
+	       gboolean append_paths,
 	       GError **error)
 {
 	char **real_argv;
@@ -1532,6 +1533,16 @@ ditem_execute (const GnomeDesktopItem *i
 			added_status = ADDED_ALL;
 		}
 
+		/* append_uris and append_paths are mutually exlusive */
+		if (launched == 0 && added_status == ADDED_NONE && append_paths) {
+			uris = stringify_files (args, FALSE, FALSE);
+			temp = g_strconcat (new_exec, " ", uris, NULL);
+			g_free (uris);
+			g_free (new_exec);
+			new_exec = temp;
+			added_status = ADDED_ALL;
+		}
+
 		if (launched > 0 && added_status == ADDED_NONE) {
 			g_free (new_exec);
 			break;
@@ -1649,7 +1660,7 @@ gnome_desktop_item_launch (const GnomeDe
 }
 
 /**
- * gnome_desktop_item_launch_wth_env:
+ * gnome_desktop_item_launch_with_env:
  * @item: A desktop item
  * @file_list:  Files/URIs to launch this item with, can be %NULL
  * @flags: FIXME
@@ -1736,6 +1747,7 @@ gnome_desktop_item_launch_with_env (cons
 			     (flags & GNOME_DESKTOP_ITEM_LAUNCH_ONLY_ONE),
 			     (flags & GNOME_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR),
 			     (flags & GNOME_DESKTOP_ITEM_LAUNCH_APPEND_URIS),
+			     (flags & GNOME_DESKTOP_ITEM_LAUNCH_APPEND_PATHS),
 			     error);
 
 	return ret;
Index: libgnome-desktop/gnome-desktop-item.h
===================================================================
RCS file: /cvs/gnome/gnome-desktop/libgnome-desktop/gnome-desktop-item.h,v
retrieving revision 1.45
diff -u -p -r1.45 gnome-desktop-item.h
--- libgnome-desktop/gnome-desktop-item.h	12 Jul 2002 03:45:09 -0000	1.45
+++ libgnome-desktop/gnome-desktop-item.h	20 Jul 2002 02:45:05 -0000
@@ -118,7 +118,9 @@ typedef enum {
 	/* Append the list of URIs to the command if no Exec
 	 * parameter is specified, instead of launching the 
 	 * app without parameters. */
-	  GNOME_DESKTOP_ITEM_LAUNCH_APPEND_URIS = 1<<2
+	GNOME_DESKTOP_ITEM_LAUNCH_APPEND_URIS = 1<<2,
+	/* Same as above but instead append local paths */
+	GNOME_DESKTOP_ITEM_LAUNCH_APPEND_PATHS = 1<<3
 } GnomeDesktopItemLaunchFlags;
 
 typedef enum {
Index: nautilus-program-choosing.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-program-choosing.c,v
retrieving revision 1.59
diff -u -p -r1.59 nautilus-program-choosing.c
--- nautilus-program-choosing.c	10 Jul 2002 18:54:07 -0000	1.59
+++ nautilus-program-choosing.c	26 Jul 2002 00:13:45 -0000
@@ -723,7 +723,7 @@ nautilus_launch_desktop_file (const char
 	
 	error = NULL;
 	gnome_desktop_item_launch (ditem, (GList *) parameter_uris,
-				   GNOME_DESKTOP_ITEM_LAUNCH_APPEND_URIS,
+				   GNOME_DESKTOP_ITEM_LAUNCH_APPEND_PATHS,
 				   &error);
 
 	if (error != NULL) {


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