$OpenBSD: patch-src_user_share_c,v 1.7 2013/07/16 06:39:42 ajacoutot Exp $

https://bugzilla.gnome.org/show_bug.cgi?id=601890

--- src/user_share.c.orig	Mon Jul 15 15:59:28 2013
+++ src/user_share.c	Tue Jul 16 08:21:22 2013
@@ -27,7 +27,6 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include <glib/gstdio.h>
-#include <bluetooth-client.h>
 #include <gio/gio.h>
 #include <X11/Xlib.h>
 
@@ -35,8 +34,12 @@
 #include "user_share-private.h"
 #include "user_share-common.h"
 #include "http.h"
+
+#ifdef HAVE_BLUETOOTH
+#include <bluetooth-client.h>
 #include "obexftp.h"
 #include "obexpush.h"
+#endif /* HAVE_BLUETOOTH */
 
 #include <stdarg.h>
 #include <string.h>
@@ -53,6 +56,8 @@
 static GSettings *settings = NULL;
 
 static guint disabled_timeout_tag = 0;
+
+#ifdef HAVE_BLUETOOTH
 static GDBusProxy *session_proxy = NULL;
 static gboolean has_console = TRUE;
 
@@ -182,6 +187,7 @@ bluez_init (void)
 	g_signal_connect (G_OBJECT (client), "notify::default-adapter-powered",
 			  G_CALLBACK (default_adapter_changed), NULL);
 }
+#endif /* HAVE_BLUETOOTH */
 
 static void
 migrate_old_configuration (void)
@@ -213,9 +219,13 @@ disabled_timeout_callback (void)
 {
 	http_down ();
 
+#ifdef HAVE_BLUETOOTH
 	if (g_settings_get_boolean (settings, FILE_SHARING_BLUETOOTH_ENABLED) == FALSE &&
 	    g_settings_get_boolean (settings, FILE_SHARING_BLUETOOTH_OBEXPUSH_ENABLED) == FALSE)
 		_exit (0);
+#else
+	_exit (0);
+#endif /* HAVE_BLUETOOTH */
 	return FALSE;
 }
 
@@ -243,6 +253,7 @@ file_sharing_enabled_changed (void)
 	}
 }
 
+#ifdef HAVE_BLUETOOTH
 static void
 file_sharing_bluetooth_allow_write_changed (void)
 {
@@ -309,6 +320,7 @@ file_sharing_bluetooth_obexpush_notify_changed (void)
 {
 	obexpush_set_notify (g_settings_get_boolean (settings, FILE_SHARING_BLUETOOTH_OBEXPUSH_NOTIFY));
 }
+#endif /* HAVE_BLUETOOTH */
 
 static void
 setttings_changed (GSettings *settings,
@@ -321,6 +333,7 @@ setttings_changed (GSettings *settings,
 	else if (g_strcmp0 (FILE_SHARING_REQUIRE_PASSWORD, path) == 0)
 		require_password_changed ();
 
+#ifdef HAVE_BLUETOOTH
 	else if (g_strcmp0 (FILE_SHARING_BLUETOOTH_ENABLED, path) == 0)
 		file_sharing_bluetooth_enabled_changed ();
 
@@ -338,14 +351,17 @@ setttings_changed (GSettings *settings,
 
 	else if (g_strcmp0 (FILE_SHARING_BLUETOOTH_OBEXPUSH_NOTIFY, path) == 0)
 		file_sharing_bluetooth_obexpush_notify_changed ();
+#endif /* HAVE_BLUETOOTH */
 }
 
 static void
 cleanup_handler (int sig)
 {
 	http_down ();
+#ifdef HAVE_BLUETOOTH
 	obexftp_down ();
 	obexpush_down ();
+#endif /* HAVE_BLUETOOTH */
 	_exit (2);
 }
 
@@ -353,7 +369,9 @@ static int
 x_io_error_handler (Display *xdisplay)
 {
 	http_down ();
+#ifdef HAVE_BLUETOOTH
 	obexftp_down ();
+#endif /* HAVE_BLUETOOTH */
 	_exit (2);
 }
 
@@ -408,10 +426,14 @@ main (int argc, char **argv)
 
 	migrate_old_configuration ();
 
+#ifdef HAVE_BLUETOOTH
 	settings = g_settings_new (GNOME_USER_SHARE_SCHEMAS);
 	if (g_settings_get_boolean (settings, FILE_SHARING_ENABLED) == FALSE &&
 	    g_settings_get_boolean (settings, FILE_SHARING_BLUETOOTH_ENABLED) == FALSE &&
 	    g_settings_get_boolean (settings, FILE_SHARING_BLUETOOTH_OBEXPUSH_ENABLED) == FALSE)
+#else
+	if (g_settings_get_boolean (settings, FILE_SHARING_ENABLED) == FALSE)
+#endif /* HAVE_BLUETOOTH */
 		return 1;
 
 	x_fd = ConnectionNumber (xdisplay);
@@ -419,22 +441,28 @@ main (int argc, char **argv)
 
 	if (http_init () == FALSE)
 		return 1;
+#ifdef HAVE_BLUETOOTH
 	if (obexftp_init () == FALSE)
 		return 1;
 	if (obexpush_init () == FALSE)
 		return 1;
+#endif /* HAVE_BLUETOOTH */
 
 	g_signal_connect (settings, "changed", G_CALLBACK(setttings_changed), NULL);
 
+#ifdef HAVE_BLUETOOTH
 	bluez_init ();
 	session_init ();
+#endif /* HAVE_BLUETOOTH */
 
 	/* Initial setting */
 	file_sharing_enabled_changed ();
+#ifdef HAVE_BLUETOOTH
 	file_sharing_bluetooth_enabled_changed ();
 	file_sharing_bluetooth_obexpush_accept_files_changed ();
 	file_sharing_bluetooth_obexpush_notify_changed ();
 	file_sharing_bluetooth_obexpush_enabled_changed ();
+#endif /* HAVE_BLUETOOTH */
 
 	gtk_main ();
 	g_object_unref (settings);
