[libgda] Removed file modifications monitoring other than Gio, and removed GnomeVFS usage



commit cabee28c69a46521946ee440aff89d0a7d0e9e5c
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed Jul 14 16:39:30 2010 +0200

    Removed file modifications monitoring other than Gio, and removed GnomeVFS usage

 configure.ac                |   38 +---------
 libgda/Makefile.am          |    7 +-
 libgda/gda-config.c         |  180 -------------------------------------------
 libgda/gda-data-model-dir.c |   16 ----
 4 files changed, 5 insertions(+), 236 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5c60ff2..6bb0926 100644
--- a/configure.ac
+++ b/configure.ac
@@ -367,8 +367,7 @@ AC_SUBST(NO_UNDEFINED)
 AC_SUBST(SOPREFIX)
 
 dnl *******************************************************
-dnl Checks for GIO or Gnome VFS, use GIO preferably
-dnl if GIO is not found, then see if FAM or gamin are found
+dnl Checks for GIO
 dnl *******************************************************
 
 GIO_MODULES="gio-2.0 >= 2.16"
@@ -377,45 +376,12 @@ AM_CONDITIONAL(HAVE_GIO, test x"$have_gio" = "xyes")
 if test x"$have_gio" = "xyes"
 then
         GIO_CFLAGS="$GIO_CFLAGS -DHAVE_GIO"
-	GNOMEVFS_CFLAGS=""
-	GNOMEVFS_LIBS=""
-	have_gnomevfs=no
 else
-	GNOMEVFS_MODULES="gnome-vfs-2.0 >= 2.20"
-	PKG_CHECK_MODULES(GNOMEVFS, $GNOMEVFS_MODULES, have_gnomevfs=yes, have_gnomevfs=no)
-	if test x"$have_gnomevfs" = "xyes"
-	then
-	        GNOMEVFS_CFLAGS="$GNOMEVFS_CFLAGS -DHAVE_GNOMEVFS"
-	fi
-
-	FAM_LIBS=
-	FAM_CFLAGS=
-	FAM_MISSING_WARNING="Libgda depends on FAM to provide notification when configuration files are changed, without FAM support any application using Libgda will have to be restarted when configuration files are changed to take into account those changes"
-	PKG_CHECK_MODULES(GAMIN, gamin >= 0.1.8, have_fam=yes, have_fam=no)
-	if test x"$have_fam" = "xyes"
-	then
-	        FAM_CFLAGS="$GAMIN_CFLAGS"
-	        FAM_LIBS="$GAMIN_LIBS"
-		AC_DEFINE(HAVE_FAM, [], [Define if we have FAM])
-	else
-	        AC_CHECK_LIB(fam, FAMOpen,
-	          [AC_CHECK_HEADERS(fam.h,
-	            [AC_DEFINE(HAVE_FAM, [], [Define if we have FAM])
-	             FAM_LIBS="-lfam"],
-	            AC_MSG_WARN(*** FAM support will not be built (header files not found) $FAM_MISSING_WARNING ***))],
-	          AC_MSG_WARN(*** FAM support will not be built (FAM library not found) $FAM_MISSING_WARNING ***))
-	fi
-	AC_SUBST(FAM_LIBS)
-	AC_SUBST(FAM_CFLAGS)	
+        AC_MSG_WARN([Libgda depends on Gio to provide notification when configuration files are changed, without Gio support any application using Libgda will have to be restarted when configuration files are changed to take into account those changes]) 
 fi
 AC_SUBST(GIO_CFLAGS)
 AC_SUBST(GIO_LIBS)
 
-AC_SUBST(GNOMEVFS_CFLAGS)
-AC_SUBST(GNOMEVFS_LIBS)
-AM_CONDITIONAL(HAVE_GNOMEVFS, test x"$have_gnomevfs" = "xyes")
-
-
 dnl ******************************
 dnl Checks for libxslt
 dnl ******************************
diff --git a/libgda/Makefile.am b/libgda/Makefile.am
index dba8d60..04836ce 100644
--- a/libgda/Makefile.am
+++ b/libgda/Makefile.am
@@ -17,10 +17,9 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/libgda \
 	-DABI_VERSION=\""$(GDA_ABI_VERSION)"\" \
 	$(LIBGDA_CFLAGS) \
-	$(FAM_CFLAGS) \
 	$(BDB_CFLAGS) \
 	-DBDB_LIB=\""$(BDB_LIB)"\" \
-	$(GIO_CFLAGS) $(GNOMEVFS_CFLAGS) $(GNOME_KEYRING_CFLAGS)
+	$(GIO_CFLAGS) $(GNOME_KEYRING_CFLAGS)
 
 _gda_marshal_built_files = gda-marshal.h gda-marshal.c
 
@@ -225,8 +224,8 @@ libgda_4_0_la_LIBADD = \
 	binreloc/libgda_binreloc-4.0.la \
 	sqlite/libgda-sqlite.la \
 	thread-wrapper/libgda_threadwrapper-4.0.la \
-	$(LIBGDA_LIBS) $(FAM_LIBS) \
-	$(GIO_LIBS) $(GNOMEVFS_LIBS) $(GNOME_KEYRING_LIBS)
+	$(LIBGDA_LIBS) \
+	$(GIO_LIBS) $(GNOME_KEYRING_LIBS)
 
 if PLATFORM_WIN32
 libgda_4_0_la_LDFLAGS += -export-symbols $(builddir)/libgda.def
diff --git a/libgda/gda-config.c b/libgda/gda-config.c
index a89fd8b..9996736 100644
--- a/libgda/gda-config.c
+++ b/libgda/gda-config.c
@@ -37,18 +37,8 @@
 #include <libgda/sqlite/gda-sqlite-provider.h>
 
 #ifdef HAVE_GIO
-  #ifdef HAVE_FAM
-    #error Impossible to have GIO and FAM at the same time
-  #endif
   #include <gio/gio.h>
 #else
-  #ifdef HAVE_FAM
-    #include <fam.h>
-    #include <glib.h>
-    #include <sys/types.h>
-    #include <sys/stat.h>
-    #include <unistd.h>
-  #endif
 #endif
 #ifdef G_OS_WIN32 
 #include <io.h>
@@ -132,24 +122,6 @@ static void lock_notify_changes (void);
 static void unlock_notify_changes (void);
 #endif
 
-#ifdef HAVE_FAM
-/*
- * FAM declarations and static variables
- */
-static FAMConnection *fam_connection = NULL;
-static gint           fam_watch_id = 0;
-static gboolean       lock_fam = FALSE;
-static FAMRequest    *fam_conf_user = NULL;
-static FAMRequest    *fam_conf_global = NULL;
-static time_t         last_mtime = 0;
-static time_t         last_ctime = 0;
-static off_t          last_size = 0;
-
-static gboolean       fam_callback (GIOChannel *source, GIOCondition condition, gpointer data);
-static void           fam_lock_notify ();
-static void           fam_unlock_notify ();
-#endif
-
 static GStaticRecMutex gda_mutex = G_STATIC_REC_MUTEX_INIT;
 #define GDA_CONFIG_LOCK() g_static_rec_mutex_lock(&gda_mutex)
 #define GDA_CONFIG_UNLOCK() g_static_rec_mutex_unlock(&gda_mutex)
@@ -474,9 +446,6 @@ save_config_file (gboolean is_system)
 #ifdef HAVE_GIO
 	lock_notify_changes ();
 #endif
-#ifdef HAVE_FAM
-        fam_lock_notify ();
-#endif
 	if (!is_system && unique_instance->priv->user_file) {
 		if (xmlSaveFormatFile (unique_instance->priv->user_file, doc, TRUE) == -1)
                         g_warning ("Error saving config data to '%s'", unique_instance->priv->user_file);
@@ -489,9 +458,6 @@ save_config_file (gboolean is_system)
 #ifdef HAVE_GIO
 	unlock_notify_changes ();
 #endif
-#ifdef HAVE_FAM
-        fam_unlock_notify ();
-#endif
 	xmlFreeDoc (doc);
 }
 
@@ -651,55 +617,6 @@ gda_config_constructor (GType type,
 			g_object_unref (gf);
 		}
 #endif
-
-#ifdef HAVE_FAM
-		if (!fam_connection) {
-			/* FAM init */
-			GIOChannel *ioc;
-			int res;
-			
-#ifdef GDA_DEBUG_NO
-			g_print ("Using FAM to monitor configuration files changes.\n");
-#endif
-			fam_connection = g_malloc0 (sizeof (FAMConnection));
-			if (FAMOpen2 (fam_connection, "libgda user") != 0) {
-				g_print ("FAMOpen failed, FAMErrno=%d\n", FAMErrno);
-				g_free (fam_connection);
-				fam_connection = NULL;
-			}
-			else {
-				ioc = g_io_channel_unix_new (FAMCONNECTION_GETFD(fam_connection));
-				fam_watch_id = g_io_add_watch (ioc,
-							       G_IO_IN | G_IO_HUP | G_IO_ERR,
-							       fam_callback, NULL);
-				
-				if (unique_instance->priv->system_file) {
-					fam_conf_global = g_new0 (FAMRequest, 1);
-					res = FAMMonitorFile (fam_connection, unique_instance->priv->system_file, 
-							      fam_conf_global,
-							      GINT_TO_POINTER (TRUE));
-#ifdef GDA_DEBUG_NO
-					g_print ("Monitoring changes on file %s: %s\n", 
-						 unique_instance->priv->system_file, 
-						 res ? "ERROR" : "Ok");
-#endif
-				}
-				
-				if (unique_instance->priv->user_file) {
-					fam_conf_user = g_new0 (FAMRequest, 1);
-					res = FAMMonitorFile (fam_connection, unique_instance->priv->user_file, 
-							      fam_conf_user,
-							      GINT_TO_POINTER (FALSE));
-#ifdef GDA_DEBUG_NO
-					g_print ("Monitoring changes on file %s: %s\n",
-						 unique_instance->priv->user_file, 
-						 res ? "ERROR" : "Ok");
-#endif
-				}
-			}
-			
-		}
-#endif
 		/* load existing DSN definitions */
 		if (unique_instance->priv->system_file)
 			load_config_file (unique_instance->priv->system_file, TRUE);
@@ -1864,100 +1781,3 @@ unlock_notify_changes (void)
 }
 
 #endif
-
-#ifdef HAVE_FAM
-static gboolean
-fam_callback (GIOChannel *source, GIOCondition condition, gpointer data)
-{
-        gboolean res = TRUE;
-
-	if (!unique_instance)
-		return TRUE;
-
-        GDA_CONFIG_LOCK ();
-        while (fam_connection && FAMPending (fam_connection)) {
-                FAMEvent ev;
-                gboolean is_system;
-
-                if (FAMNextEvent (fam_connection, &ev) != 1) {
-                        FAMClose (fam_connection);
-                        g_free (fam_connection);
-                        g_source_remove (fam_watch_id);
-                        fam_watch_id = 0;
-                        fam_connection = NULL;
-                        GDA_CONFIG_UNLOCK ();
-                        return FALSE;
-                }
-
-                if (lock_fam)
-                        continue;
-
-                is_system = GPOINTER_TO_INT (ev.userdata);
-                switch (ev.code) {
-                case FAMChanged: {
-                        struct stat stat;
-                        if (lstat (ev.filename, &stat))
-                                break;
-                        if ((stat.st_mtime != last_mtime) ||
-                            (stat.st_ctime != last_ctime) ||
-                            (stat.st_size != last_size)) {
-                                last_mtime = stat.st_mtime;
-                                last_ctime = stat.st_ctime;
-                                last_size = stat.st_size;
-                        }
-                        else
-                                break;
-                }
-                case FAMDeleted:
-                case FAMCreated:
-#ifdef GDA_DEBUG_NO
-                        g_print ("Reloading config files (%s config has changed)\n", is_system ? "global" : "user");
-			GSList *list;
-			for (list = unique_instance->priv->dsn_list; list; list = list->next) {
-				GdaDsnInfo *info = (GdaDsnInfo *) list->data;
-				g_print ("[info %p]: %s/%s\n", info, info->provider, info->name);
-			}
-#endif
-			while (unique_instance->priv->dsn_list) {
-				GdaDsnInfo *info = (GdaDsnInfo *) unique_instance->priv->dsn_list->data;
-				if (unique_instance->priv->emit_signals)
-					g_signal_emit (unique_instance, gda_config_signals[DSN_TO_BE_REMOVED], 0, info);
-				unique_instance->priv->dsn_list = g_slist_remove (unique_instance->priv->dsn_list, info);
-				if (unique_instance->priv->emit_signals)
-					g_signal_emit (unique_instance, gda_config_signals[DSN_REMOVED], 0, info);
-				data_source_info_free (info);
-			}
-			
-			if (unique_instance->priv->system_file)
-				load_config_file (unique_instance->priv->system_file, TRUE);
-			if (unique_instance->priv->user_file)
-				load_config_file (unique_instance->priv->user_file, FALSE);
-                        break;
-                case FAMAcknowledge:
-                case FAMStartExecuting:
-                case FAMStopExecuting:
-                case FAMExists:
-                case FAMEndExist:
-                case FAMMoved:
-                        /* Not supported */
-                        break;
-                }
-        }
-
-        GDA_CONFIG_UNLOCK ();
-        return res;
-}
-
-static void
-fam_lock_notify ()
-{
-        lock_fam = TRUE;
-}
-
-static void
-fam_unlock_notify ()
-{
-        lock_fam = FALSE;
-}
-
-#endif
diff --git a/libgda/gda-data-model-dir.c b/libgda/gda-data-model-dir.c
index bed605e..bcc0bbc 100644
--- a/libgda/gda-data-model-dir.c
+++ b/libgda/gda-data-model-dir.c
@@ -29,10 +29,6 @@
 
 #ifdef HAVE_GIO
 #include <gio/gio.h>
-#else
-  #ifdef HAVE_GNOMEVFS
-  #include <libgnomevfs/gnome-vfs-mime.h>
-  #endif
 #endif
 
 /* Use the RSA reference implementation included in the RFC-1321, http://www.freesoft.org/CIE/RFC/1321/ */
@@ -597,19 +593,7 @@ update_file_mime (FileRow *row, const gchar *complete_filename)
 		value = gda_value_new_null ();
 	g_object_unref (file);
 #else
-  #ifdef HAVE_GNOMEVFS
-	const gchar *mime;
-	
-	mime = gnome_vfs_get_file_mime_type (complete_filename, NULL, FALSE);
-	if (mime) {
-		value = gda_value_new (G_TYPE_STRING);
-		g_value_set_string (value, mime);
-	}
-	else 
-		value = gda_value_new_null ();
-  #else
 	value = gda_value_new_null ();
-  #endif
 #endif
 
 	if (value) {



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