[evolution] Remove e_dialog_append_list_store_text().



commit eb240691223ac8a2fedcce1445db95a4fd35fb64
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Dec 23 18:18:46 2011 -0500

    Remove e_dialog_append_list_store_text().
    
    Silly function.  Do it manually or use a GtkComboBoxText.

 calendar/gui/dialogs/event-page.c |   42 +++++++++++++++++++++++++-----------
 calendar/gui/dialogs/memo-page.c  |   38 ++++++++++++++++++++++++--------
 calendar/gui/dialogs/task-page.c  |   37 +++++++++++++++++++++++--------
 e-util/e-dialog-widgets.c         |   22 -------------------
 e-util/e-dialog-widgets.h         |    2 -
 5 files changed, 84 insertions(+), 57 deletions(-)
---
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 5152b9a..c8c208e 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -1200,11 +1200,19 @@ event_page_fill_widgets (CompEditorPage *page,
 				g_signal_handlers_block_by_func (gtk_bin_get_child (GTK_BIN (priv->organizer)), organizer_changed_cb, epage);
 
 				if (!priv->user_org) {
-					GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer));
-
-					gtk_list_store_clear (GTK_LIST_STORE (model));
-					e_dialog_append_list_store_text (model, 0, string);
-					gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0);
+					GtkComboBox *combo_box;
+					GtkListStore *list_store;
+					GtkTreeModel *model;
+					GtkTreeIter iter;
+
+					combo_box = GTK_COMBO_BOX (priv->organizer);
+					model = gtk_combo_box_get_model (combo_box);
+					list_store = GTK_LIST_STORE (model);
+
+					gtk_list_store_clear (list_store);
+					gtk_list_store_append (list_store, &iter);
+					gtk_list_store_set (list_store, &iter, 0, string, -1);
+					gtk_combo_box_set_active (combo_box, 0);
 					gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE);
 				} else {
 					gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))), string);
@@ -3476,8 +3484,10 @@ event_page_construct (EventPage *epage,
                       EMeetingStore *meeting_store)
 {
 	EventPagePrivate *priv;
+	GtkComboBox *combo_box;
+	GtkListStore *list_store;
 	GtkTreeModel *model;
-	GtkListStore *store;
+	GtkTreeIter iter;
 	gint ii;
 
 	priv = epage->priv;
@@ -3503,21 +3513,27 @@ event_page_construct (EventPage *epage,
 		priv->location_completion);
 
 	/* Initialize completino model */
-	store = gtk_list_store_new (1, G_TYPE_STRING);
+	list_store = gtk_list_store_new (1, G_TYPE_STRING);
 	gtk_entry_completion_set_model (priv->location_completion,
-		GTK_TREE_MODEL (store));
+		GTK_TREE_MODEL (list_store));
 	gtk_entry_completion_set_text_column (priv->location_completion, 0);
 
-	model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer));
+	combo_box = GTK_COMBO_BOX (priv->organizer);
+	model = gtk_combo_box_get_model (combo_box);
+	list_store = GTK_LIST_STORE (model);
 
 	priv->address_strings = itip_get_user_identities ();
 	priv->fallback_address = itip_get_fallback_identity ();
 
-	for (ii = 0; priv->address_strings[ii] != NULL; ii++)
-		e_dialog_append_list_store_text (
-			model, 0, priv->address_strings[ii]);
+	/* FIXME Could we just use a GtkComboBoxText? */
+	for (ii = 0; priv->address_strings[ii] != NULL; ii++) {
+		gtk_list_store_append (list_store, &iter);
+		gtk_list_store_set (
+			list_store, &iter,
+			0, priv->address_strings[ii], -1);
+	}
 
-	gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0);
+	gtk_combo_box_set_active (combo_box, 0);
 
 	g_signal_connect (
 		gtk_bin_get_child (GTK_BIN (priv->organizer)), "changed",
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index 4ef58ea..10483f2 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -339,11 +339,19 @@ memo_page_fill_widgets (CompEditorPage *page,
 			if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) {
 				gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->org_combo))), string);
 			} else {
-				GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->org_combo));
-
-				gtk_list_store_clear (GTK_LIST_STORE (model));
-				e_dialog_append_list_store_text (model, 0, string);
-				gtk_combo_box_set_active (GTK_COMBO_BOX (priv->org_combo), 0);
+				GtkComboBox *combo_box;
+				GtkListStore *list_store;
+				GtkTreeModel *model;
+				GtkTreeIter iter;
+
+				combo_box = GTK_COMBO_BOX (priv->org_combo);
+				model = gtk_combo_box_get_model (combo_box);
+				list_store = GTK_LIST_STORE (model);
+
+				gtk_list_store_clear (list_store);
+				gtk_list_store_append (list_store, &iter);
+				gtk_list_store_set (list_store, &iter, 0, string, -1);
+				gtk_combo_box_set_active (combo_box, 0);
 				gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->org_combo))), FALSE);
 			}
 			g_free (string);
@@ -1227,18 +1235,28 @@ memo_page_construct (MemoPage *mpage)
 	}
 
 	if (flags & COMP_EDITOR_IS_SHARED) {
+		GtkComboBox *combo_box;
+		GtkListStore *list_store;
 		GtkTreeModel *model;
+		GtkTreeIter iter;
 		gint ii;
 
-		model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->org_combo));
+		combo_box = GTK_COMBO_BOX (priv->org_combo);
+		model = gtk_combo_box_get_model (combo_box);
+		list_store = GTK_LIST_STORE (model);
+
 		priv->address_strings = itip_get_user_identities ();
 		priv->fallback_address = itip_get_fallback_identity ();
 
-		for (ii = 0; priv->address_strings[ii] != NULL; ii++)
-			e_dialog_append_list_store_text (
-				model, 0, priv->address_strings[ii]);
+		/* FIXME Could we just use a GtkComboBoxText? */
+		for (ii = 0; priv->address_strings[ii] != NULL; ii++) {
+			gtk_list_store_append (list_store, &iter);
+			gtk_list_store_set (
+				list_store, &iter,
+				0, priv->address_strings[ii], -1);
+		}
 
-		gtk_combo_box_set_active (GTK_COMBO_BOX (priv->org_combo), 0);
+		gtk_combo_box_set_active (combo_box, 0);
 
 		gtk_widget_show (priv->org_label);
 		gtk_widget_show (priv->org_combo);
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 2fe06d9..5da1ca3 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -669,11 +669,19 @@ task_page_fill_widgets (CompEditorPage *page,
 				g_signal_handlers_block_by_func (gtk_bin_get_child (GTK_BIN (priv->organizer)), organizer_changed_cb, tpage);
 
 				if (!priv->user_org) {
-					GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer));
-
-					gtk_list_store_clear (GTK_LIST_STORE (model));
-					e_dialog_append_list_store_text (model, 0, string);
-					gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0);
+					GtkComboBox *combo_box;
+					GtkListStore *list_store;
+					GtkTreeModel *model;
+					GtkTreeIter iter;
+
+					combo_box = GTK_COMBO_BOX (priv->organizer);
+					model = gtk_combo_box_get_model (combo_box);
+					list_store = GTK_LIST_STORE (model);
+
+					gtk_list_store_clear (list_store);
+					gtk_list_store_append (list_store, &iter);
+					gtk_list_store_set (list_store, &iter, 0, string, -1);
+					gtk_combo_box_set_active (combo_box, 0);
 					gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE);
 				} else {
 					gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->organizer))), string);
@@ -2094,7 +2102,10 @@ task_page_construct (TaskPage *tpage,
                      ECalClient *client)
 {
 	TaskPagePrivate *priv;
+	GtkComboBox *combo_box;
+	GtkListStore *list_store;
 	GtkTreeModel *model;
+	GtkTreeIter iter;
 	gint ii;
 
 	priv = tpage->priv;
@@ -2116,16 +2127,22 @@ task_page_construct (TaskPage *tpage,
 		return NULL;
 	}
 
-	model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer));
+	combo_box = GTK_COMBO_BOX (priv->organizer);
+	model = gtk_combo_box_get_model (combo_box);
+	list_store = GTK_LIST_STORE (model);
 
 	priv->address_strings = itip_get_user_identities ();
 	priv->fallback_address = itip_get_fallback_identity ();
 
-	for (ii = 0; priv->address_strings[ii] != NULL; ii++)
-		e_dialog_append_list_store_text (
-			model, 0, priv->address_strings[ii]);
+	/* FIXME Could we just use a GtkComboBoxText? */
+	for (ii = 0; priv->address_strings[ii] != NULL; ii++) {
+		gtk_list_store_append (list_store, &iter);
+		gtk_list_store_set (
+			list_store, &iter,
+			0, priv->address_strings[ii], -1);
+	}
 
-	gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0);
+	gtk_combo_box_set_active (combo_box, 0);
 
 	g_signal_connect (
 		gtk_bin_get_child (GTK_BIN (priv->organizer)), "changed",
diff --git a/e-util/e-dialog-widgets.c b/e-util/e-dialog-widgets.c
index a8416ec..2793141 100644
--- a/e-util/e-dialog-widgets.c
+++ b/e-util/e-dialog-widgets.c
@@ -134,25 +134,3 @@ e_dialog_combo_box_get (GtkWidget *widget,
 	return i;
 }
 
-/**
- * e_dialog_append_list_store_text:
- * @list_store: A #GtkListStore
- * @text_column: A string column ID, where to write @text_value
- * @text_value: A string to be added to the @list_store
- **/
-void
-e_dialog_append_list_store_text (GtkTreeModel *list_store,
-                                 gint text_column,
-                                 const gchar *text_value)
-{
-	GtkTreeIter iter;
-	GtkListStore *store;
-
-	g_return_if_fail (GTK_IS_LIST_STORE (list_store));
-	g_return_if_fail (text_column >= 0);
-	g_return_if_fail (text_value != NULL);
-
-	store = GTK_LIST_STORE (list_store);
-	gtk_list_store_append (store, &iter);
-	gtk_list_store_set (store, &iter, text_column, text_value, -1);
-}
diff --git a/e-util/e-dialog-widgets.h b/e-util/e-dialog-widgets.h
index 65de4d9..5b3f650 100644
--- a/e-util/e-dialog-widgets.h
+++ b/e-util/e-dialog-widgets.h
@@ -30,6 +30,4 @@
 void e_dialog_combo_box_set (GtkWidget *widget, gint value, const gint *value_map);
 gint e_dialog_combo_box_get (GtkWidget *widget, const gint *value_map);
 
-void e_dialog_append_list_store_text (GtkTreeModel *list_store, gint text_column, const gchar *text_value);
-
 #endif



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