gnome-bluetooth r553 - trunk/properties



Author: hadess
Date: Mon Mar 30 13:55:40 2009
New Revision: 553
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=553&view=rev

Log:
Fix wrong tab showing up when there's no killswitches and no adapters


Modified:
   trunk/properties/adapter.c

Modified: trunk/properties/adapter.c
==============================================================================
--- trunk/properties/adapter.c	(original)
+++ trunk/properties/adapter.c	Mon Mar 30 13:55:40 2009
@@ -265,6 +265,20 @@
 	gtk_widget_set_sensitive(button, FALSE);
 }
 
+static void
+set_current_page (GtkNotebook *notebook)
+{
+	if (gtk_tree_model_iter_n_children (adapter_model, NULL) == 0) {
+		if (bluetooth_killswitch_has_killswitches (killswitch) != FALSE) {
+			gtk_notebook_set_current_page (notebook,
+						       KILLSWITCH_PAGE_NUM(notebook));
+		} else {
+			gtk_notebook_set_current_page (notebook,
+						       NO_ADAPTERS_PAGE_NUM(notebook));
+		}
+	}
+}
+
 static void create_adapter(adapter_data *adapter)
 {
 	GHashTable *hash = NULL;
@@ -622,15 +636,7 @@
 		adapter->reference = NULL;
 
 		gtk_notebook_remove_page(notebook, i);
-		if (gtk_tree_model_iter_n_children (model, NULL) == 0) {
-			if (bluetooth_killswitch_has_killswitches (killswitch) != FALSE) {
-				gtk_notebook_set_current_page (notebook,
-							       KILLSWITCH_PAGE_NUM(notebook));
-			} else {
-				gtk_notebook_set_current_page (notebook,
-							       NO_ADAPTERS_PAGE_NUM(notebook));
-			}
-		}
+		set_current_page (notebook);
 		/* When the default adapter changes, the adapter_changed signal will
 		 * take care of setting the right page */
 
@@ -721,6 +727,8 @@
 			  G_CALLBACK (button_clicked_cb), button);
 	gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
 
+	gtk_widget_show_all (mainbox);
+
 	gtk_notebook_append_page(notebook, mainbox, NULL);
 }
 
@@ -740,6 +748,8 @@
 	label = create_label(_("No Bluetooth adapters present"));
 	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
 
+	gtk_widget_show_all (mainbox);
+
 	//FIXME add a label saying we should insert a device
 	gtk_notebook_append_page(notebook, mainbox, NULL);
 }
@@ -763,6 +773,8 @@
 				G_CALLBACK (adapter_changed), notebook);
 
 	gtk_tree_model_foreach(adapter_model, adapter_insert, notebook);
+
+	set_current_page (notebook);
 }
 
 void cleanup_adapter(void)



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