Skip to contentSkip to conversation

New version of obexftp_available

PATCH In review Bastien Nocera 2 participants 2 messages Jul 25, 2007 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 New version of obexftp_available

This uses the modulesdir variable in newer gnome-vfs to look for configuration directories.

The code is still pretty ugly, but I guess we'll just use gvfs in a couple of GNOME release cycles.

Signature · 1 line
Bastien Nocera <[email protected]> 

Index: configure.in
===================================================================
RCS file: /cvsroot/bluez/gnome/configure.in,v
retrieving revision 1.47

configure.in +5 -0
diff -u -p -r1.47 configure.in
@@ -62,6 +62,11 @@ PKG_CHECK_MODULES(NOTIFY, libnotify >= 0
 AC_SUBST(NOTIFY_CFLAGS)
 AC_SUBST(NOTIFY_LIBS)
 
+MODULESDIR=`$PKG_CONFIG --variable=modulesdir gnome-vfs-2.0`
+if test x"$MODULESDIR" != "x" ; then
+	AC_DEFINE(MODULESDIR, [$MODULESDIR], [The location of gnome-vfs configuration files])
+fi
+
 dnl PKG_CHECK_MODULES(OPENOBEX, libopenobex-glib >= 1.4, dummy=yes, dummy=no)
 dnl AC_SUBST(OPENOBEX_CFLAGS)
 dnl AC_SUBST(OPENOBEX_LIBS)

Index: applet/main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.70

main.c +37 -0
diff -u -p -r1.70 main.c
@@ -1396,6 +1398,43 @@ static void name_owner_changed(DBusGProx
 
 static gboolean obexftp_available(void)
 {
+	char *path;
+	gboolean retval = FALSE;
+
+	/* Look for nautilus in the PATH */
+	path = g_find_program_in_path("nautilus");
+	if (path == NULL)
+		return FALSE;
+	g_free(path);
+
+#ifdef MODULESDIR
+	/* Look for obex-module.conf in the system-wide dir */
+	path = g_build_filename(MODULESDIR, "obex-module.conf", NULL);
+	retval = g_file_test(path, G_FILE_TEST_IS_REGULAR);
+	g_free(path);
+	if (retval != FALSE)
+		return TRUE;
+#endif /* MODULESDIR */
+	/* Look in the home dir */
+	if (g_get_home_dir() != NULL) {
+		path = g_build_filename(g_get_home_dir(), ".gnome2", "vfs",
+					 "modules", "obex-module.conf", NULL);
+		retval = g_file_test(path, G_FILE_TEST_IS_REGULAR);
+		g_free(path);
+		if (retval != FALSE)
+			return TRUE;
+	}
+
+	/* Look in the envvar defined dir */
+	if (g_getenv("GNOME_VFS_MODULE_CONFIG_PATH") != NULL) {
+		path = g_build_filename(g_getenv("GNOME_VFS_MODULE_CONFIG_PATH"),
+					"obex-module.conf", NULL);
+		retval = g_file_test(path, G_FILE_TEST_IS_REGULAR);
+		g_free(path);
+		if (retval != FALSE)
+			return TRUE;
+	}
+
 	return FALSE;
 }
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#1 lore raw

Hi Bastien,

Quoted 5 lines

This uses the modulesdir variable in newer gnome-vfs to look for configuration directories.

The code is still pretty ugly, but I guess we'll just use gvfs in a couple of GNOME release cycles.

too ugly for me. I decided to let Nautilus handle the error case ;)

Regards

Marcel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel