]> git.0d.be Git - empathy.git/commitdiff
Drop gnome-vfs dependency and use gio instead. Fixes bug #514380 (Cosimo Cecchi).
authorXavier Claessens <xclaesse@src.gnome.org>
Tue, 11 Mar 2008 09:27:31 +0000 (09:27 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Tue, 11 Mar 2008 09:27:31 +0000 (09:27 +0000)
svn path=/trunk/; revision=737

configure.ac
libempathy-gtk/empathy-avatar-chooser.c
libempathy-gtk/empathy-ui-utils.c
src/empathy-chat-chandler.c
src/empathy.c

index de9d604240731576b3c25fec848c29d1d37d5d31..95208e5bae13ba44417ece01dac2b91c04fa08c9 100644 (file)
@@ -25,7 +25,7 @@ AC_SUBST(LIBEMPATHY_GTK_AGE)
 AC_SUBST(LIBEMPATHY_GTK_REVISION)
 
 # Minimal version required
-GLIB_REQUIRED=2.14.0
+GLIB_REQUIRED=2.15.5
 GTK_REQUIRED=2.12.0
 GCONF_REQUIRED=1.2.0
 LIBGLADE_REQUIRED=2.0.0
@@ -93,11 +93,11 @@ PKG_CHECK_MODULES(EMPATHY,
 [
    glib-2.0 >= $GLIB_REQUIRED
    gobject-2.0
+   gio-2.0 >= $GLIB_REQUIRED
    gconf-2.0 >= $GCONF_REQUIRED
    libtelepathy >= $TELEPATHY_REQUIRED
    telepathy-glib >= $TELEPATHY_GLIB_REQUIRED
    libmissioncontrol >= $MISSION_CONTROL_REQUIRED
-   gnome-vfs-2.0
    gtk+-2.0 >= $GTK_REQUIRED
    x11
    libglade-2.0 >= $LIBGLADE_REQUIRED
@@ -178,7 +178,6 @@ if test "x$enable_megaphone" != "xno"; then
       gtk+-2.0 >= $GTK_REQUIRED
       gconf-2.0 >= $GCONF_REQUIRED
       libglade-2.0 >= $LIBGLADE_REQUIRED 
-      gnome-vfs-2.0
       libtelepathy >= $TELEPATHY_REQUIRED
       libmissioncontrol >= $MISSION_CONTROL_REQUIRED
    ], have_megaphone="yes", have_megaphone="no")
@@ -264,7 +263,6 @@ if test "x$enable_python" != "xno"; then
          gobject-2.0
          gconf-2.0 >= $GCONF_REQUIRED
          libxml-2.0
-         gnome-vfs-2.0
          libtelepathy >= $TELEPATHY_REQUIRED
          libmissioncontrol >= $MISSION_CONTROL_REQUIRED
          gtk+-2.0 >= $GTK_REQUIRED
index 78bb32938acbc90bfbab74ecff0e263dd5c2bd69..aeaba5c94e53f680d8fac2f7092570cdbe2028f6 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
+#include <gio/gio.h>
 
 #include <libempathy/empathy-debug.h>
 
@@ -329,9 +329,8 @@ avatar_chooser_drag_data_received_cb (GtkWidget          *widget,
 
        target_type = gdk_atom_name (selection_data->target);
        if (!strcmp (target_type, URI_LIST_TYPE)) {
-               GnomeVFSHandle   *handle = NULL;
-               GnomeVFSResult    result;
-               GnomeVFSFileInfo  info;
+               GFile            *file;
+               GFileInputStream *input_stream;
                gchar            *uri;
                gchar            *nl;
                gchar            *data = NULL;
@@ -343,31 +342,41 @@ avatar_chooser_drag_data_received_cb (GtkWidget          *widget,
                } else {
                        uri = g_strdup (selection_data->data);
                }
-
-               result = gnome_vfs_open (&handle, uri, GNOME_VFS_OPEN_READ);
-               if (result == GNOME_VFS_OK) {
-                       result = gnome_vfs_get_file_info_from_handle (handle,
-                                                                     &info,
-                                                                     GNOME_VFS_FILE_INFO_DEFAULT);
-                       if (result == GNOME_VFS_OK) {
-                               GnomeVFSFileSize data_size;
-
-                               data = g_malloc (info.size);
-
-                               result = gnome_vfs_read (handle, data, info.size, &data_size);
-                               if (result == GNOME_VFS_OK) {
+               
+               file = g_file_new_for_uri (uri);
+               input_stream = g_file_read (file, NULL, NULL);
+
+               if (input_stream != NULL) {
+                       GFileInfo *info;
+                       
+                       info = g_file_query_info (file,
+                                                 G_FILE_ATTRIBUTE_STANDARD_SIZE,
+                                                 0, NULL, NULL);
+                       if (info != NULL) {
+                               goffset size;
+                               gssize bytes_read;
+                               
+                               size = g_file_info_get_size (info);
+                               data = g_malloc (size);
+
+                               bytes_read = g_input_stream_read (G_INPUT_STREAM (input_stream),
+                                                                 data, size,
+                                                                 NULL, NULL);
+                               g_object_unref (info);
+                               if (bytes_read != -1) {
                                        avatar_chooser_set_image_from_data (chooser,
                                                                            data,
-                                                                           data_size);
+                                                                           (gsize) bytes_read);
                                        handled = TRUE;
                                } else {
                                        g_free (data);
                                }
                        }
 
-                       gnome_vfs_close (handle);
+                       g_input_stream_close (G_INPUT_STREAM (input_stream), NULL, NULL);
                }
-
+               
+               g_object_unref (file);
                g_free (uri);
        }
 
index 80dcd42275f98a8c581f53add638813116cc1466..f5c8d358946bbd80b0bf451216ed1db40da30dcb 100644 (file)
@@ -35,8 +35,8 @@
 #include <gdk/gdkx.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+#include <gio/gio.h>
 #include <glade/glade.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
 
 #include <libmissioncontrol/mc-profile.h>
 
@@ -1320,14 +1320,21 @@ void
 empathy_url_show (const char *url)
 {
        gchar          *real_url;
-       GnomeVFSResult  res;
+       gboolean        res;
+       GError         *err;
 
        real_url = fixup_url (url);
-       res = gnome_vfs_url_show (real_url);
-       if (res != GNOME_VFS_OK) {
+       /* FIXME: this does not work for multihead, we should use
+        * GdkAppLaunchContext for that, when we can depend on GTK+ trunk
+        */
+       res = g_app_info_launch_default_for_uri (real_url,
+                                                NULL,
+                                                &err);
+       if (!res) {
                empathy_debug (DEBUG_DOMAIN, "Couldn't show URL %s: %s",
                              real_url,
-                             gnome_vfs_result_to_string (res));
+                             err->message);
+               g_error_free (err);
        }
 
        g_free (real_url);
index ab67209129973c5bd14bbe95b9994287119463a4..febea756d78ccf7b8fec6062f732f521cbc64219 100644 (file)
@@ -28,8 +28,6 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <libgnomevfs/gnome-vfs.h>
-
 #include <libmissioncontrol/mission-control.h>
 
 #include <libempathy/empathy-chandler.h>
@@ -138,7 +136,6 @@ main (int argc, char *argv[])
        gtk_window_set_default_icon_name ("empathy");
        gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
                                           PKGDATADIR G_DIR_SEPARATOR_S "icons");
-       gnome_vfs_init ();
 
        mc = empathy_mission_control_new ();
        chandler = empathy_chandler_new (BUS_NAME, OBJECT_PATH);
index 863d307f2bbacfc3d6759d768df7a5f3ed93fc1e..850144e970856a2133e37346df5cc4f540ef6796 100644 (file)
@@ -31,7 +31,6 @@
 #include <gdk/gdkx.h>
 
 #include <libebook/e-book.h>
-#include <libgnomevfs/gnome-vfs.h>
 
 #include <telepathy-glib/util.h>
 #include <libmissioncontrol/mc-account.h>
@@ -299,7 +298,6 @@ main (int argc, char *argv[])
        gtk_window_set_default_icon_name ("empathy");
        gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
                                           PKGDATADIR G_DIR_SEPARATOR_S "icons");
-       gnome_vfs_init ();
 
         /* Setting up the bacon connection */
        connection = bacon_message_connection_new ("empathy");