[PATCH] Wrap nautilus_file_get_activation_uri to NautilusFileInfo



The attached patch ensures that extensions can query a file's activation
URI, which is required for making nautilus-open-terminal work with the
home link on the desktop (for volumes I clould also use get_volume,
get_drive).

While this might seem to be overhead, some distros like Ubuntu also have
a "Documents" item on the desktop, and other NautilusDesktopFile-based
icons might be added in the future, so keeping track with them with a
manually compiled list that maps "x-nautilus-desktop//foo.desktop" to
foo_uri isn't really feasible.

-- 
Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-file.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file.c,v
retrieving revision 1.391
diff -u -p -r1.391 nautilus-file.c
--- libnautilus-private/nautilus-file.c	27 Sep 2006 16:02:39 -0000	1.391
+++ libnautilus-private/nautilus-file.c	16 Dec 2006 13:47:20 -0000
@@ -6243,6 +6253,7 @@ nautilus_file_info_iface_init (NautilusF
 	iface->get_uri = nautilus_file_get_uri;
 	iface->get_parent_uri = nautilus_file_get_parent_uri;
 	iface->get_uri_scheme = nautilus_file_get_uri_scheme;
+	iface->get_activation_uri = nautilus_file_get_activation_uri;
 	iface->get_mime_type = nautilus_file_get_mime_type;
 	iface->is_mime_type = nautilus_file_is_mime_type;
 	iface->is_directory = nautilus_file_is_directory;
Index: libnautilus-extension/nautilus-file-info.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-extension/nautilus-file-info.c,v
retrieving revision 1.4
diff -u -p -r1.4 nautilus-file-info.c
--- libnautilus-extension/nautilus-file-info.c	3 Oct 2005 13:44:47 -0000	1.4
+++ libnautilus-extension/nautilus-file-info.c	16 Dec 2006 13:47:20 -0000
@@ -109,6 +109,15 @@ nautilus_file_info_get_uri (NautilusFile
 }
 
 char *
+nautilus_file_info_get_activation_uri (NautilusFileInfo *file)
+{
+	g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL);
+	g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_activation_uri != NULL, NULL);
+
+	return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_activation_uri (file);
+}
+
+char *
 nautilus_file_info_get_parent_uri (NautilusFileInfo *file)
 {
 	g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL);
Index: libnautilus-extension/nautilus-file-info.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-extension/nautilus-file-info.h,v
retrieving revision 1.5
diff -u -p -r1.5 nautilus-file-info.h
--- libnautilus-extension/nautilus-file-info.h	3 Oct 2005 13:44:47 -0000	1.5
+++ libnautilus-extension/nautilus-file-info.h	16 Dec 2006 13:47:20 -0000
@@ -80,6 +80,8 @@ struct _NautilusFileInfoIface 
 	gboolean              (*has_drive)        (NautilusFileInfo *file);
 	GnomeVFSVolume*       (*get_volume)       (NautilusFileInfo *file);
 	GnomeVFSDrive*        (*get_drive)        (NautilusFileInfo *file);
+
+	char *            (*get_activation_uri)   (NautilusFileInfo *file);
 };
 
 GList            *nautilus_file_info_list_copy            (GList            *files);
@@ -92,6 +94,7 @@ gboolean          nautilus_file_info_is_
 /* Name and Location */
 char *            nautilus_file_info_get_name             (NautilusFileInfo *file);
 char *            nautilus_file_info_get_uri              (NautilusFileInfo *file);
+char *            nautilus_file_info_get_activation_uri   (NautilusFileInfo *file);
 char *            nautilus_file_info_get_parent_uri       (NautilusFileInfo *file);
 char *            nautilus_file_info_get_uri_scheme       (NautilusFileInfo *file);
 


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