[gnome-control-center] sharing: Hide Bluetooth sharing when there is no Bluetooth adapter
- From: Thomas Wood <thos src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] sharing: Hide Bluetooth sharing when there is no Bluetooth adapter
- Date: Mon, 28 Jan 2013 17:53:32 +0000 (UTC)
commit dbcffa5d9bb4242a4de1708599d2f8e536b1edd5
Author: Thomas Wood <thomas wood intel com>
Date: Mon Jan 28 17:24:15 2013 +0000
sharing: Hide Bluetooth sharing when there is no Bluetooth adapter
https://bugzilla.gnome.org/show_bug.cgi?id=691764
panels/sharing/Makefile.am | 3 +-
panels/sharing/cc-sharing-panel.c | 45 +++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/panels/sharing/Makefile.am b/panels/sharing/Makefile.am
index d9ac3fa..365f13d 100644
--- a/panels/sharing/Makefile.am
+++ b/panels/sharing/Makefile.am
@@ -6,6 +6,7 @@ uidir = $(pkgdatadir)/ui/sharing
AM_CPPFLAGS = \
$(PANEL_CFLAGS) \
$(SHARING_PANEL_CFLAGS) \
+ $(BLUETOOTH_CFLAGS) \
-DLIBEXECDIR=\"$(libexecdir)\" \
$(NULL)
@@ -38,7 +39,7 @@ cc-sharing-resources.h: sharing.gresource.xml $(resource_files)
$(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name cc_sharing $<
-libsharing_la_LIBADD = $(PANEL_LIBS) $(SHARING_PANEL_LIBS)
+libsharing_la_LIBADD = $(PANEL_LIBS) $(SHARING_PANEL_LIBS) $(BLUETOOTH_LIBS)
libsharing_la_LDFLAGS = $(PANEL_LDFLAGS)
libexec_PROGRAMS = cc-remote-login-helper
diff --git a/panels/sharing/cc-sharing-panel.c b/panels/sharing/cc-sharing-panel.c
index cf57249..7a5452c 100644
--- a/panels/sharing/cc-sharing-panel.c
+++ b/panels/sharing/cc-sharing-panel.c
@@ -30,6 +30,11 @@
#include "cc-media-sharing.h"
#include <glib/gi18n.h>
+#include <config.h>
+
+#ifdef HAVE_BLUETOOTH
+#include <bluetooth-killswitch.h>
+#endif
CC_PANEL_REGISTER (CcSharingPanel, cc_sharing_panel)
@@ -66,6 +71,10 @@ struct _CcSharingPanelPrivate
GtkWidget *personal_file_sharing_dialog;
GtkWidget *remote_login_dialog;
GtkWidget *screen_sharing_dialog;
+
+#ifdef HAVE_BLUETOOTH
+ BluetoothKillswitch *bluetooth_killswitch;
+#endif
};
static void
@@ -73,6 +82,10 @@ cc_sharing_panel_dispose (GObject *object)
{
CcSharingPanelPrivate *priv = CC_SHARING_PANEL (object)->priv;
+#ifdef HAVE_BLUETOOTH
+ g_clear_object (&priv->bluetooth_killswitch);
+#endif
+
g_clear_object (&priv->builder);
if (priv->bluetooth_sharing_dialog)
@@ -261,12 +274,44 @@ bluetooth_set_accept_files (const GValue *value,
return g_variant_new_string ("always");
}
+#ifdef HAVE_BLUETOOTH
+
+static void
+bluetooth_state_changed (CcSharingPanel *self)
+{
+ CcSharingPanelPrivate *priv = self->priv;
+ BluetoothKillswitchState killswitch_state;
+
+ killswitch_state = BLUETOOTH_KILLSWITCH_STATE_NO_ADAPTER;
+
+ if (priv->bluetooth_killswitch)
+ killswitch_state = bluetooth_killswitch_get_state (priv->bluetooth_killswitch);
+
+ if (killswitch_state == BLUETOOTH_KILLSWITCH_STATE_NO_ADAPTER)
+ gtk_widget_hide (WID ("bluetooth-sharing-button"));
+ else
+ gtk_widget_show (WID ("bluetooth-sharing-button"));
+}
+
+#endif
+
static void
cc_sharing_panel_setup_bluetooth_sharing_dialog (CcSharingPanel *self)
{
CcSharingPanelPrivate *priv = self->priv;
GSettings *settings;
+#ifdef HAVE_BLUETOOTH
+ priv->bluetooth_killswitch = bluetooth_killswitch_new ();
+
+ /* get the initial state */
+ bluetooth_state_changed (self);
+
+ g_signal_connect_swapped (priv->bluetooth_killswitch, "state-changed",
+ G_CALLBACK (bluetooth_state_changed), self);
+#endif
+
+
cc_sharing_panel_bind_switch_to_label (WID ("share-public-folder-switch"),
WID ("bluetooth-sharing-status-label"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]