aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-01-21 20:45:06 +0100
committerMarcel Holtmann <marcel@holtmann.org>2009-01-21 20:45:06 +0100
commit34e6d95d9f9a70397c2fb33561d1b49c7b934dd9 (patch)
tree00fb89ee7cd12ec260a6862762f225b6a6549cf5
parentf8093ac16f4abe53174036e9e7f81f69c8b0673f (diff)
downloadconnman-gnome-34e6d95d9f9a70397c2fb33561d1b49c7b934dd9.tar.gz
Hide menu when daemon is not available
-rw-r--r--applet/status.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/applet/status.c b/applet/status.c
index 1775922..ef11bcc 100644
--- a/applet/status.c
+++ b/applet/status.c
@@ -27,6 +27,8 @@
#include "status.h"
+static gboolean available = FALSE;
+
static GtkStatusIcon *statusicon = NULL;
static GdkPixbuf *pixbuf_load(GtkIconTheme *icontheme, const gchar *name)
@@ -98,6 +100,8 @@ static gboolean icon_animation_timeout(gpointer data)
static void icon_animation_start(IconAnimation *animation,
guint start, guint end)
{
+ available = TRUE;
+
gtk_status_icon_set_tooltip(statusicon, NULL);
animation->start = start;
@@ -114,6 +118,8 @@ static void icon_animation_start(IconAnimation *animation,
static void icon_animation_stop(IconAnimation *animation)
{
+ available = TRUE;
+
gtk_status_icon_set_tooltip(statusicon, NULL);
if (animation->id > 0)
@@ -149,6 +155,9 @@ static void activate_callback(GObject *object, gpointer user_data)
guint32 activate_time = gtk_get_current_event_time();
GtkWidget *menu;
+ if (available == FALSE)
+ return;
+
menu = gtk_menu_new();
if (callback == NULL || callback(GTK_MENU(menu)) == FALSE) {
@@ -238,6 +247,8 @@ void status_unavailable(void)
{
icon_animation_stop(animation);
+ available = FALSE;
+
gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_notifier);
gtk_status_icon_set_tooltip(statusicon,
"Connection Manager daemon is not running");
@@ -251,6 +262,8 @@ void status_hide(void)
icon_animation_stop(animation);
+ available = FALSE;
+
gtk_status_icon_set_from_pixbuf(statusicon, NULL);
}
@@ -281,6 +294,8 @@ static void set_ready(gint signal)
{
int index;
+ available = TRUE;
+
if (signal < 0) {
gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_wired);
gtk_status_icon_set_tooltip(statusicon, NULL);