diff options
author | raveit65 <[email protected]> | 2013-08-21 23:46:40 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2013-08-21 23:46:40 +0200 |
commit | 6b2d9e48c82b8b73fd2af640fce4c1ba27eb7b50 (patch) | |
tree | a2eceb3588f8e75fd7eaa9c109e8f0f31d727ee1 | |
parent | 8701e25197a994f544c8b65561f25478dafc0b5b (diff) | |
download | mate-user-share-6b2d9e48c82b8b73fd2af640fce4c1ba27eb7b50.tar.bz2 mate-user-share-6b2d9e48c82b8b73fd2af640fce4c1ba27eb7b50.tar.xz |
make bluetooth really optional
-rw-r--r-- | configure.ac | 33 | ||||
-rw-r--r-- | src/share-extension.c | 13 |
2 files changed, 32 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac index 758d4b3..5b9b489 100644 --- a/configure.ac +++ b/configure.ac @@ -50,20 +50,20 @@ fi AC_SUBST(HTTPD) -PKG_CHECK_MODULES(USER_SHARE, glib-2.0 >= 2.15.2 gio-2.0 >= 2.26 gdk-x11-2.0 gtk+-2.0 dbus-1 >= 1.1.1 dbus-glib-1 libnotify >= 0.7.0 libcanberra-gtk $DBUS_MODULES) -AC_SUBST(USER_SHARE_CFLAGS) -AC_SUBST(USER_SHARE_LIBS) - -PKG_CHECK_MODULES(BLUETOOTH, mate-bluetooth-1.0 >= 1.2.0, - have_bluetooth=true, have_bluetooth=false) -AC_SUBST(BLUETOOTH_CFLAGS) -AC_SUBST(BLUETOOTH_LIBS) -if $have_bluetooth; then - AC_DEFINE(HAVE_BLUETOOTH, 1, [Set to true if mate-bluetooth support is available]) +BLUETOOTH_PKG="mate-bluetooth-1.0 >= 1.2.0" +AC_ARG_ENABLE(bluetooth, AS_HELP_STRING([--disable-bluetooth],[compile without bluetooth support]),,enable_bluetooth=yes) +if test "x$enable_bluetooth" = "xyes"; then + PKG_CHECK_MODULES(BLUETOOTH, $BLUETOOTH_PKG) + AC_DEFINE(HAVE_BLUETOOTH, 1, [Set to true if mate-bluetooth support is available]) else - AC_MSG_WARN([Bluetooth support is disabled.]) + BLUETOOTH_PKG="" + AC_MSG_WARN([Bluetooth support is disabled.]) fi -AM_CONDITIONAL(USE_BLUETOOTH, [test "$have_bluetooth" = "true"]) +AM_CONDITIONAL(USE_BLUETOOTH, [test "$enable_bluetooth" = "yes"]) + +PKG_CHECK_MODULES(USER_SHARE, glib-2.0 >= 2.15.2 gio-2.0 >= 2.26 gdk-x11-2.0 gtk+-2.0 dbus-1 >= 1.1.1 dbus-glib-1 libnotify >= 0.7.0 libcanberra-gtk $DBUS_MODULES $BLUETOOTH_PKG) +AC_SUBST(USER_SHARE_CFLAGS) +AC_SUBST(USER_SHARE_LIBS) PKG_CHECK_MODULES(USER_SHARE_CONFIG, glib-2.0 >= 2.15.2 gio-2.0 >= 2.25.0 gtk+-2.0 >= 2.12.0 unique-1.0) AC_SUBST(USER_SHARE_CONFIG_CFLAGS) @@ -139,7 +139,7 @@ AC_ARG_WITH(cajadir, [ac_with_cajadir=""]) PKG_CHECK_MODULES(EXTENSION, - libcaja-extension mate-bluetooth-1.0) + libcaja-extension $BLUETOOTH_PKG) if test "${ac_with_cajadir}" = ""; then ac_with_cajadir=`pkg-config --variable=extensiondir libcaja-extension` fi @@ -208,6 +208,13 @@ man/Makefile ]) AC_OUTPUT + +if test "x$enable_bluetooth" = "xyes"; then + AC_MSG_NOTICE([** Bluetooth support enabled (ObexPush and ObexFTP)]) +else + AC_MSG_NOTICE([ Bluetooth support disabled]) +fi + AC_MSG_NOTICE([mate-user-share was configured with the following options:]) AC_MSG_NOTICE([** httpd location: $HTTP]) AC_MSG_NOTICE([** httpd modules path: $MODULES_PATH]) diff --git a/src/share-extension.c b/src/share-extension.c index 188c559..b3b2952 100644 --- a/src/share-extension.c +++ b/src/share-extension.c @@ -27,10 +27,13 @@ #include <string.h> #include <glib/gi18n-lib.h> #include <gtk/gtk.h> -#include <bluetooth-client.h> #include <libcaja-extension/caja-menu-provider.h> #include <libcaja-extension/caja-location-widget-provider.h> +#ifdef HAVE_BLUETOOTH +#include <bluetooth-client.h> +#endif + #include "caja-share-bar.h" #include "user_share-common.h" @@ -101,6 +104,7 @@ bar_response_cb (CajaShareBar *bar, } } ++#ifdef HAVE_BLUETOOTH static void downloads_bar_set_from_bluetooth_status (GtkWidget *bar) { @@ -121,6 +125,7 @@ default_adapter_powered_cb (GObject *gobject, { downloads_bar_set_from_bluetooth_status (bar); } +#endif /* HAVE_BLUETOOTH */ static GtkWidget * caja_user_share_get_location_widget (CajaLocationWidgetProvider *iface, @@ -163,8 +168,13 @@ caja_user_share_get_location_widget (CajaLocationWidgetProvider *iface, if (is_dir[0] != FALSE && is_dir[1] != FALSE) { bar = caja_share_bar_new (_("May be used to share or receive files")); } else if (is_dir[0] != FALSE) { +#ifndef HAVE_BLUETOOTH bar = caja_share_bar_new (_("May be shared over the network or Bluetooth")); +#else + bar = caja_share_bar_new (_("May be shared over the network")); +#endif /* !HAVE_BLUETOOTH */ } else { +#ifdef HAVE_BLUETOOTH BluetoothClient *client; bar = caja_share_bar_new (_("May be used to receive files over Bluetooth")); @@ -175,6 +185,7 @@ caja_user_share_get_location_widget (CajaLocationWidgetProvider *iface, g_signal_connect (G_OBJECT (client), "notify::default-adapter-powered", G_CALLBACK (default_adapter_powered_cb), bar); downloads_bar_set_from_bluetooth_status (bar); +#endif /* HAVE_BLUETOOTH */ } g_signal_connect (bar, "response", |