libgsf r991 - in trunk: . gsf-gnome



Author: mortenw
Date: Thu Jul  3 02:28:21 2008
New Revision: 991
URL: http://svn.gnome.org/viewvc/libgsf?rev=991&view=rev

Log:
2008-07-02  Morten Welinder  <terra gnome org>

	* gsf-gnome/gsf-output-gnomevfs.c: Use gio, not gnomevfs, when
	LIBGSF_GNOMEVFS_VIA_GIO is defined.

	* gsf-gnome/gsf-input-gnomevfs.c (gsf_input_gnomevfs_new,
	gsf_input_gnomevfs_new_uri): Call gsf_input_gio_new_for_uri, not
	gsf_input_gio_new_for_path.



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/configure.in
   trunk/gsf-gnome/gsf-input-gnomevfs.c
   trunk/gsf-gnome/gsf-output-gnomevfs.c
   trunk/gsf-gnome/gsf-output-gnomevfs.h

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Thu Jul  3 02:28:21 2008
@@ -12,7 +12,7 @@
 
 Morten:
 	* Use g_base64_-routines from glib when available.
-	* Prepare for using gio to simulate gnome-vfs interface.
+	* When gio is available, do not link in gnomevfs.
 	* Add self-check for the benefit of __arm__.
 
 --------------------------------------------------------------------------

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Thu Jul  3 02:28:21 2008
@@ -397,11 +397,11 @@
 	no) want_gnome_vfs=no;;
 	esac[]dnl
 ])
-if test $want_gnome_vfs = auto -a "DISABLED$want_gio" = yes; then
+if test $want_gnome_vfs = auto -a "$want_gio" = yes; then
    	want_gnome_vfs=yes
 fi
 if test $want_gnome_vfs = yes; then
-   	if test "DISABLED$want_gio" = yes; then
+   	if test "$want_gio" = yes; then
 	   	AC_DEFINE(LIBGSF_GNOMEVFS_VIA_GIO, 1, [Define if gio is used to implement gnome-vfs api])
 	else
 	        libgsf_gnome_reqs="$libgsf_gnome_reqs gnome-vfs-2.0 >= 2.2.0"

Modified: trunk/gsf-gnome/gsf-input-gnomevfs.c
==============================================================================
--- trunk/gsf-gnome/gsf-input-gnomevfs.c	(original)
+++ trunk/gsf-gnome/gsf-input-gnomevfs.c	Thu Jul  3 02:28:21 2008
@@ -59,7 +59,7 @@
 GsfInput *
 gsf_input_gnomevfs_new (char const *uri, GError **error)
 {
-	return gsf_input_gio_new_for_path (uri, error);
+	return gsf_input_gio_new_for_uri (uri, error);
 }
 
 GsfInput *
@@ -84,8 +84,7 @@
 
 	if (h_g_vfs_uri_to_string) {
 		char *uritxt = h_g_vfs_uri_to_string (uri, 0);
-		g_printerr ("uri=[%s]\n", uritxt);
-		GsfInput *res = gsf_input_gio_new_for_path (uritxt, error);
+		GsfInput *res = gsf_input_gio_new_for_uri (uritxt, error);
 		g_free (uritxt);
 		return res;
 	}

Modified: trunk/gsf-gnome/gsf-output-gnomevfs.c
==============================================================================
--- trunk/gsf-gnome/gsf-output-gnomevfs.c	(original)
+++ trunk/gsf-gnome/gsf-output-gnomevfs.c	Thu Jul  3 02:28:21 2008
@@ -20,10 +20,18 @@
  */
 
 #include <gsf-config.h>
+
+#ifdef LIBGSF_GNOMEVFS_VIA_GIO
+#include <gsf/gsf-output-gio.h>
+#define GnomeVFSHandle void
+#define GnomeVFSURI void
+#endif
+
 #include <gsf-gnome/gsf-output-gnomevfs.h>
 #include <gsf/gsf-output-impl.h>
 #include <gsf/gsf-impl-utils.h>
 
+
 struct _GsfOutputGnomeVFS {
     GsfOutput output;
 
@@ -34,6 +42,54 @@
     GsfOutputClass output_class;
 } GsfOutputGnomeVFSClass;
 
+#ifdef LIBGSF_GNOMEVFS_VIA_GIO
+
+GType
+gsf_output_gnomevfs_get_type (void)
+{
+	return gsf_output_gio_get_type ();
+}
+
+GsfOutput *
+gsf_output_gnomevfs_new (char const *uri, GError **error)
+{
+	return gsf_output_gio_new_for_uri (uri, error);
+}
+
+GsfOutput *
+gsf_output_gnomevfs_new_uri (GnomeVFSURI *uri, GError **error)
+{
+	static gboolean tried = FALSE;
+	static char * (*h_g_vfs_uri_to_string) (const GnomeVFSURI *uri, int);
+
+	if (!tried) {
+		gpointer p;
+		GModule *module;
+
+		tried = TRUE;
+		module = g_module_open (NULL, 0);
+		if (module) {
+			if (g_module_symbol (module, "gnome_vfs_uri_to_string",
+					     &p))
+				h_g_vfs_uri_to_string = p;
+			g_module_close (module);
+		}
+	}
+
+	if (h_g_vfs_uri_to_string) {
+		char *uritxt = h_g_vfs_uri_to_string (uri, 0);
+		GsfOutput *res = gsf_output_gio_new_for_uri (uritxt, error);
+		g_free (uritxt);
+		return res;
+	}
+
+	g_set_error (error, gsf_output_error_id (), 0,
+		     "Failed to interface to gnome-vfs");
+	return NULL;
+}
+
+#else
+
 /**
  * gsf_output_gnomevfs_new :
  * @text_uri : in utf8.
@@ -226,3 +282,5 @@
 
 GSF_CLASS (GsfOutputGnomeVFS, gsf_output_gnomevfs,
            gsf_output_gnomevfs_class_init, gsf_output_gnomevfs_init, GSF_OUTPUT_TYPE)
+
+#endif

Modified: trunk/gsf-gnome/gsf-output-gnomevfs.h
==============================================================================
--- trunk/gsf-gnome/gsf-output-gnomevfs.h	(original)
+++ trunk/gsf-gnome/gsf-output-gnomevfs.h	Thu Jul  3 02:28:21 2008
@@ -23,7 +23,13 @@
 #define GSF_OUTPUT_GNOMEVFS_H
 
 #include <gsf/gsf-output.h>
+#ifndef LIBGSF_GNOMEVFS_VIA_GIO
+/*
+ * The installed version will always do this.  For our emulation layer, we
+ * want to avoid it.
+ */
 #include <libgnomevfs/gnome-vfs.h>
+#endif
 
 G_BEGIN_DECLS
 



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