[evolution-patches] Patch for #69922: Do not use deprecated gnome-vfs mime api
- From: Marco Pesenti Gritti <marco gnome org>
- To: evolution-patches lists ximian com
- Subject: [evolution-patches] Patch for #69922: Do not use deprecated gnome-vfs mime api
- Date: Tue, 22 Feb 2005 14:12:53 +0100
1 Do not use gnome_vfs_mime_get_short_list. You can use
gnome_vfs_mime_get_all_applications.
2 Do not use the command field of GnomeVFSMimeApplication. The syntax of
desktop files Exec is different. Command has the old syntax and is only
partially compatible. Stuff like "myapp %u --my-param" will not work. It
seem easier to just use gnome-vfs launch api.
Marco
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ChangeLog,v
retrieving revision 1.1439
diff -u -r1.1439 ChangeLog
--- ChangeLog 3 Feb 2005 17:58:52 -0000 1.1439
+++ ChangeLog 22 Feb 2005 13:05:55 -0000
@@ -1,3 +1,17 @@
+2005-02-22 Marco Pesenti Gritti <marco gnome org>
+
+ * configure.in:
+
+ Depend on gnome-vfs >= 2.4
+
+ * mail/em-popup.c: (emp_apps_open_in), (emp_standard_menu_factory):
+
+ Use gnome-vfs API to launch external applications
+
+ * shell/e-shell-window-commands.c: (command_quick_reference):
+
+ Use gnome-vfs API to open quick reference in the pdf viewer
+
2005-02-01 Priit Laes <amd store20 com>
* configure.in : Remove duplicate entries for addressbook-groupwise,
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.784
diff -u -r1.784 configure.in
--- configure.in 9 Feb 2005 00:24:57 -0000 1.784
+++ configure.in 22 Feb 2005 13:06:02 -0000
@@ -1105,6 +1105,7 @@
EDS_REQUIRED=1.1.5
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)
Index: mail/em-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-popup.c,v
retrieving revision 1.34
diff -u -r1.34 em-popup.c
--- mail/em-popup.c 18 Feb 2005 16:43:55 -0000 1.34
+++ mail/em-popup.c 22 Feb 2005 13:06:14 -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"
@@ -567,32 +568,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);
}
}
@@ -642,7 +627,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) {
@@ -657,7 +642,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.27
diff -u -r1.27 e-shell-window-commands.c
--- shell/e-shell-window-commands.c 2 Feb 2005 01:40:47 -0000 1.27
+++ shell/e-shell-window-commands.c 22 Feb 2005 13:06:20 -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>
@@ -486,9 +487,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");
@@ -504,29 +502,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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]