[gnome-system-tools] Fix empty shells combo box



commit b3dfabc03b9ece4ad606343105e5fa24e9189bf7
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Fri Nov 6 17:52:51 2009 +0100

    Fix empty shells combo box
    
    The available shells combo box in user settings dialog should be filled from gst_tool_update_config() just like all other data. Filling it from setup_shells_combo() was wrong: liboobs always returned an empty list at that point. This commit makes setup_shells_combo() create the model, just like other similar functions, and creates an update_shells() function in users-tool.c that fills the list when ready. This would also allow updating the list when system settings change, if the backends supported that.

 src/users/table.c      |   11 -----------
 src/users/users-tool.c |   22 ++++++++++++++++++++++
 2 files changed, 22 insertions(+), 11 deletions(-)
---
diff --git a/src/users/table.c b/src/users/table.c
index d9650b9..5781490 100644
--- a/src/users/table.c
+++ b/src/users/table.c
@@ -97,20 +97,9 @@ setup_shells_combo (GstUsersTool *tool)
 {
 	GtkWidget *combo;
 	GtkTreeModel *model;
-	GtkTreeIter iter;
-	GList *shells;
 
 	combo = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog, "user_settings_shell");
 	model = GTK_TREE_MODEL (gtk_list_store_new (1, G_TYPE_STRING));
-	shells = oobs_users_config_get_available_shells (OOBS_USERS_CONFIG (tool->users_config));
-
-	while (shells) {
-		gtk_list_store_append (GTK_LIST_STORE (model), &iter);
-		gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-				    0, shells->data,
-				    -1);
-		shells = shells->next;
-	}
 
 	gtk_combo_box_set_model (GTK_COMBO_BOX (combo), model);
 	g_object_unref (model);
diff --git a/src/users/users-tool.c b/src/users/users-tool.c
index eea298e..f1f20ea 100644
--- a/src/users/users-tool.c
+++ b/src/users/users-tool.c
@@ -184,11 +184,33 @@ update_profiles (GstUsersTool *tool)
 }
 
 static void
+update_shells (GstUsersTool *tool)
+{
+	GtkWidget *combo;
+	GtkTreeModel *model;
+	GList *shells;
+	GtkTreeIter iter;
+
+	combo = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog, "user_settings_shell");
+	model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
+	shells = oobs_users_config_get_available_shells (OOBS_USERS_CONFIG (tool->users_config));
+
+	while (shells) {
+		gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+		gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+				    0, shells->data,
+				    -1);
+		shells = shells->next;
+	}
+}
+
+static void
 gst_users_tool_update_gui (GstTool *tool)
 {
 	update_users (GST_USERS_TOOL (tool));
 	update_groups (GST_USERS_TOOL (tool));
 	update_profiles (GST_USERS_TOOL (tool));
+	update_shells (GST_USERS_TOOL (tool));
 }
 
 static void



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