gnome-bluetooth r394 - trunk/applet



Author: hadess
Date: Fri Feb 27 16:38:04 2009
New Revision: 394
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=394&view=rev

Log:
Simplify the adapter added/removed code

Makes it easier to change the behaviour now.

Modified:
   trunk/applet/main.c

Modified: trunk/applet/main.c
==============================================================================
--- trunk/applet/main.c	(original)
+++ trunk/applet/main.c	Fri Feb 27 16:38:04 2009
@@ -40,6 +40,7 @@
 
 static BluetoothClient *client;
 static GtkTreeModel *adapter_model;
+
 static gboolean adapter_present = FALSE;
 
 enum {
@@ -312,26 +313,6 @@
 	return menu;
 }
 
-static void adapter_added(GtkTreeModel *model, GtkTreePath *path,
-					GtkTreeIter *iter, gpointer user_data)
-{
-	adapter_present = TRUE;
-
-	if (icon_policy != ICON_POLICY_NEVER)
-		show_icon();
-}
-
-static void adapter_removed(GtkTreeModel *model, GtkTreePath *path,
-							gpointer user_data)
-{
-	if (gtk_tree_model_iter_n_children(model, NULL) < 1) {
-		adapter_present = FALSE;
-
-		if (icon_policy != ICON_POLICY_ALWAYS)
-			hide_icon();
-	}
-}
-
 static void update_icon_visibility()
 {
 	if (icon_policy == ICON_POLICY_NEVER)
@@ -346,6 +327,22 @@
 	}
 }
 
+static void adapter_added(GtkTreeModel *model, GtkTreePath *path,
+					GtkTreeIter *iter, gpointer user_data)
+{
+	adapter_present = TRUE;
+	update_icon_visibility ();
+}
+
+static void adapter_removed(GtkTreeModel *model, GtkTreePath *path,
+							gpointer user_data)
+{
+	if (gtk_tree_model_iter_n_children(model, NULL) < 1) {
+		adapter_present = FALSE;
+		update_icon_visibility ();
+	}
+}
+
 static GConfEnumStringPair icon_policy_enum_map [] = {
 	{ ICON_POLICY_NEVER,	"never"		},
 	{ ICON_POLICY_ALWAYS,	"always"	},



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]