[evolution-patches] 69922 Do not use deprecated gnome-vfs mime api



Note that this make evolution depend on gnome-vfs 2.4, not sure if
that's ok.

Marco
? depcomp
? help/C/evolution-2.2-C.omf
? help/C/evolution-2.2.xml
Index: mail/em-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-popup.c,v
retrieving revision 1.30
diff -u -r1.30 em-popup.c
--- mail/em-popup.c	12 Nov 2004 05:54:07 -0000	1.30
+++ mail/em-popup.c	25 Nov 2004 19:43:05 -0000
@@ -40,6 +40,7 @@
 
 #include <libgnome/gnome-url.h>
 #include <libgnomevfs/gnome-vfs-mime.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
 #include <libgnome/gnome-i18n.h>
 
 #include "em-popup.h"
@@ -572,32 +573,16 @@
 	path = em_utils_temp_save_part(target->target.widget, target->part);
 	if (path) {
 		GnomeVFSMimeApplication *app = item->user_data;
-		int douri = (app->expects_uris == GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS);
-		char *command;
+		char *uri;
+		GList *uris = NULL;
 		
-		if (app->requires_terminal) {
-			char *term, *args = NULL;
-			GConfClient *gconf;
-			
-			gconf = gconf_client_get_default ();
-			if ((term = gconf_client_get_string (gconf, "/desktop/gnome/applications/terminal/exec", NULL)))
-				args = gconf_client_get_string (gconf, "/desktop/gnome/applications/terminal/exec_arg", NULL);
-			g_object_unref (gconf);
-			
-			if (term == NULL)
-				return;
-			
-			command = g_strdup_printf ("%s%s%s %s %s%s &", term, args ? " " : "", args ? args : "",
-						   app->command, douri ? "file://" : "", path);
-			g_free (term);
-			g_free (args);
-		} else {
-			command = g_strdup_printf ("%s %s%s &", app->command, douri ? "file://" : "", path);
-		}
-		
-		/* FIXME: Do not use system here */
-		system(command);
-		g_free(command);
+		uri = gnome_vfs_get_uri_from_local_path(path);
+		uris = g_list_append(uris, uri);
+
+		gnome_vfs_mime_application_launch(app, uris);
+
+		g_free(uri);
+		g_list_free(uris);
 		g_free(path);
 	}
 }
@@ -647,7 +632,7 @@
 		break; }
 	case EM_POPUP_TARGET_PART: {
 		EMPopupTargetPart *t = (EMPopupTargetPart *)emp->target;
-		GList *apps = gnome_vfs_mime_get_short_list_applications(t->mime_type);
+		GList *apps = gnome_vfs_mime_get_all_applications(t->mime_type);
 
 		/* FIXME: use the snoop_part stuff from em-format.c */
 		if (apps == NULL && strcmp(t->mime_type, "application/octet-stream") == 0) {
@@ -662,7 +647,7 @@
 				else
 					name_type = gnome_vfs_mime_type_from_name(filename);
 				if (name_type)
-					apps = gnome_vfs_mime_get_short_list_applications(name_type);
+					apps = gnome_vfs_mime_get_all_applications(name_type);
 			}
 		}
 
Index: shell/e-shell-window-commands.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window-commands.c,v
retrieving revision 1.24
diff -u -r1.24 e-shell-window-commands.c
--- shell/e-shell-window-commands.c	28 Sep 2004 04:53:59 -0000	1.24
+++ shell/e-shell-window-commands.c	25 Nov 2004 19:43:39 -0000
@@ -44,6 +44,7 @@
 
 #include <libgnomevfs/gnome-vfs-mime-handlers.h>
 #include <libgnomevfs/gnome-vfs-mime-utils.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
 
 #include <bonobo/bonobo-ui-component.h>
 
@@ -485,9 +486,6 @@
 			 const char *path)
 {
 	char *quickref;
-	char *uri;
-	char *command;
-	GString *str;
 	GnomeVFSMimeApplication *app;
 	const GList *lang_list = gnome_i18n_get_language_list ("LC_MESSAGES");
 
@@ -503,29 +501,18 @@
 		quickref = g_build_filename (EVOLUTION_HELPDIR, "quickref", lang, "quickref.pdf", NULL);
 		if (g_file_test (quickref, G_FILE_TEST_EXISTS)) {
 			app = gnome_vfs_mime_get_default_application ("application/pdf");
+
 			if (app) {
-				str = g_string_new ("");
-				str = g_string_append (str, app->command);
+				GList *uris = NULL;
+				char *uri;
+
+				uri = gnome_vfs_get_uri_from_local_path (quickref);
+				uris = g_list_append (uris, uri);
 
-				switch (app->expects_uris) {
-				case GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS:
-					uri = g_strconcat ("file://", quickref, NULL);
-					g_string_append_printf (str, " %s", uri);
-					g_free (uri);
-					break;
-				case GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_PATHS:
-				case GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS_FOR_NON_FILES:
-					g_string_append_printf (str, " %s", quickref);
-					break;
-				}
-
-				command = g_string_free (str, FALSE);
-				if (command != NULL &&
-				!g_spawn_command_line_async (command, NULL)) {
-					g_warning ("Could not launch %s", command);
-				}
+				gnome_vfs_mime_application_launch (app, uris);
 
-				g_free (command);
+				g_free (uri);
+				g_list_free (uris);
 				gnome_vfs_mime_application_free (app);
 			}
 
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.746
diff -u -r1.746 configure.in
--- configure.in	9 Nov 2004 05:04:32 -0000	1.746
+++ configure.in	25 Nov 2004 19:57:54 -0000
@@ -1105,6 +1105,7 @@
 EDS_REQUIRED=1.1.0
 EDS_PACKAGE=1.2
 BONOBOUI_REQUIRED=2.4.2
+GNOME_VFS_REQUIRED=2.4
 
 AC_SUBST(GAL_REQUIRED)
 AC_SUBST(GAL_PACKAGE)
@@ -1113,10 +1114,11 @@
 AC_SUBST(EDS_REQUIRED)
 AC_SUBST(EDS_PACKAGE)
 AC_SUBST(BONOBOUI_REQUIRED)
+AC_SUBST(GNOME_VFS_REQUIRED)
 
 dnl --- Flags to get all the GNOME stuff
 
-FULL_GNOME_DEPS="glib-2.0 libbonoboui-2.0 >= $BONOBOUI_REQUIRED gnome-vfs-2.0 libgnomeui-2.0 libglade-2.0 libgnomecanvas-2.0 libxml-2.0 gconf-2.0 gal-$GAL_PACKAGE >= $GAL_REQUIRED"
+FULL_GNOME_DEPS="glib-2.0 libbonoboui-2.0 >= $BONOBOUI_REQUIRED gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED libgnomeui-2.0 libglade-2.0 libgnomecanvas-2.0 libxml-2.0 gconf-2.0 gal-$GAL_PACKAGE >= $GAL_REQUIRED"
 
 EVO_SET_COMPILE_FLAGS(GNOME_FULL, $FULL_GNOME_DEPS)
 AC_SUBST(GNOME_FULL_CFLAGS)


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