[gnome-flashback] bluetooth-applet: fix applet hidding/showing
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] bluetooth-applet: fix applet hidding/showing
- Date: Thu, 10 Sep 2015 07:47:27 +0000 (UTC)
commit 3c5b1c5a0240e4ad47ea5ce18357a73ec1df56b4
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Thu Sep 10 10:45:21 2015 +0300
bluetooth-applet: fix applet hidding/showing
My intention was to hide status icon only if there is no bluetooth
adapter not when there is no connected devices.
https://bugzilla.gnome.org/show_bug.cgi?id=753424
.../libbluetooth-applet/gf-bluetooth-applet.c | 23 +++++++++++++-------
1 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/gnome-flashback/libbluetooth-applet/gf-bluetooth-applet.c
b/gnome-flashback/libbluetooth-applet/gf-bluetooth-applet.c
index 7845158..e9b01af 100644
--- a/gnome-flashback/libbluetooth-applet/gf-bluetooth-applet.c
+++ b/gnome-flashback/libbluetooth-applet/gf-bluetooth-applet.c
@@ -207,7 +207,7 @@ get_default_adapter (GfBluetoothApplet *applet)
return NULL;
}
-static guint
+static gint
get_n_connected_devices (GfBluetoothApplet *applet)
{
GtkTreeIter *adapter;
@@ -216,11 +216,11 @@ get_n_connected_devices (GfBluetoothApplet *applet)
GtkTreeIter iter;
adapter = get_default_adapter (applet);
- devices = 0;
if (adapter == NULL)
- return 0;
+ return -1;
+ devices = 0;
valid = gtk_tree_model_iter_children (applet->model, &iter, adapter);
while (valid)
@@ -245,7 +245,7 @@ get_n_connected_devices (GfBluetoothApplet *applet)
static void
gf_bluetooth_applet_sync (GfBluetoothApplet *applet)
{
- guint devices;
+ gint devices;
gboolean airplane_mode;
const gchar *title;
const gchar *icon_name;
@@ -253,7 +253,7 @@ gf_bluetooth_applet_sync (GfBluetoothApplet *applet)
devices = get_n_connected_devices (applet);
- if (devices == 0)
+ if (devices == -1)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_status_icon_set_visible (applet->status_icon, FALSE);
@@ -277,9 +277,16 @@ gf_bluetooth_applet_sync (GfBluetoothApplet *applet)
icon_name = "bluetooth-disabled";
}
- tooltip_text = g_strdup_printf (ngettext ("%d Connected Device",
- "%d Connected Devices",
- devices), devices);
+ if (devices > 0)
+ {
+ tooltip_text = g_strdup_printf (ngettext ("%d Connected Device",
+ "%d Connected Devices",
+ devices), devices);
+ }
+ else
+ {
+ tooltip_text = g_strdup (_("Not Connected"));
+ }
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]