[evolution/gtk3] GtkComboBox vs. GtkComboBoxText usage



commit 0695c4b2fd3569436a5b913f180257587338a4d2
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jan 24 15:19:57 2011 +0100

    GtkComboBox vs. GtkComboBoxText usage

 addressbook/gui/contact-editor/contact-editor.ui   |    3 +-
 .../gui/contact-editor/e-contact-editor-fullname.c |    5 ----
 addressbook/gui/contact-editor/e-contact-editor.c  |   25 ++++++++++++++++----
 addressbook/gui/contact-editor/fullname.ui         |    2 +
 calendar/gui/dialogs/event-page.ui                 |    2 +-
 calendar/gui/dialogs/memo-page.ui                  |    2 +-
 mail/e-mail-tag-editor.c                           |    9 ++++---
 mail/mail-dialogs.ui                               |    1 +
 modules/addressbook/addressbook-config.c           |    1 -
 modules/addressbook/ldap-config.ui                 |    3 +-
 modules/mail/em-mailer-prefs.c                     |    9 +++++-
 11 files changed, 41 insertions(+), 21 deletions(-)
---
diff --git a/addressbook/gui/contact-editor/contact-editor.ui b/addressbook/gui/contact-editor/contact-editor.ui
index cd32ec0..428b17a 100644
--- a/addressbook/gui/contact-editor/contact-editor.ui
+++ b/addressbook/gui/contact-editor/contact-editor.ui
@@ -257,7 +257,8 @@
                                 <child>
                                   <object class="GtkComboBox" id="combo-file-as">
                                     <property name="visible">True</property>
-                                    <property name="has-entry">TRUE</property>
+                                    <property name="has-entry">True</property>
+                                    <property name="entry-text-column">0</property>
                                     <property name="model">model1</property>
                                   </object>
                                   <packing>
diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
index 9f69012..15eddbd 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
@@ -227,11 +227,6 @@ e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullnam
 
 	gtk_window_set_icon_name (
 		GTK_WINDOW (e_contact_editor_fullname), "contact-new");
-
-	widget = e_builder_get_widget (builder, "comboentry-title");
-	gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (widget), 0);
-	widget = e_builder_get_widget (builder, "comboentry-suffix");
-	gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (widget), 0);
 }
 
 GtkWidget*
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index c86e28c..891cba0 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -537,8 +537,13 @@ file_as_set_style (EContactEditor *editor, gint style)
 	company = gtk_entry_get_text (GTK_ENTRY (company_w));
 
 	if (style == -1) {
-		string = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo_file_as));
-		strings = g_list_append (strings, string);
+		GtkWidget *entry;
+
+		entry = gtk_bin_get_child (GTK_BIN (combo_file_as));
+		if (entry) {
+			string = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
+			strings = g_list_append (strings, string);
+		}
 	}
 
 	for (i = 0; i < 6; i++) {
@@ -554,11 +559,16 @@ file_as_set_style (EContactEditor *editor, gint style)
 
 	if (combo_file_as) {
 		GList *l;
+		GtkListStore *list_store;
+		GtkTreeIter iter;
 
-		gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (combo_file_as)));
+		list_store = GTK_LIST_STORE (gtk_combo_box_get_model (combo_file_as));
+
+		gtk_list_store_clear (list_store);
 
 		for (l = strings; l; l = l->next) {
-			gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_file_as), l->data);
+			gtk_list_store_append (list_store, &iter);
+			gtk_list_store_set (list_store, &iter, 0, l->data, -1);
 		}
 	}
 
@@ -592,7 +602,12 @@ name_entry_changed (GtkWidget *widget, EContactEditor *editor)
 static void
 file_as_combo_changed (GtkWidget *widget, EContactEditor *editor)
 {
-	gchar *string = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (widget));
+	GtkWidget *entry;
+	gchar *string = NULL;
+
+	entry = gtk_bin_get_child (GTK_BIN (widget));
+	if (entry)
+		string = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
 
 	if (string && *string) {
 		gchar *title;
diff --git a/addressbook/gui/contact-editor/fullname.ui b/addressbook/gui/contact-editor/fullname.ui
index 6a58f60..227bec9 100644
--- a/addressbook/gui/contact-editor/fullname.ui
+++ b/addressbook/gui/contact-editor/fullname.ui
@@ -315,6 +315,7 @@
               <object class="GtkComboBox" id="comboentry-title">
                 <property name="visible">True</property>
                 <property name="has-entry">True</property>
+                <property name="entry-text-column">0</property>
                 <property name="add_tearoffs">False</property>
                 <property name="has_frame">True</property>
                 <property name="focus_on_click">True</property>
@@ -333,6 +334,7 @@
               <object class="GtkComboBox" id="comboentry-suffix">
                 <property name="visible">True</property>
                 <property name="has-entry">True</property>
+                <property name="entry-text-column">0</property>
                 <property name="add_tearoffs">False</property>
                 <property name="has_frame">True</property>
                 <property name="focus_on_click">True</property>
diff --git a/calendar/gui/dialogs/event-page.ui b/calendar/gui/dialogs/event-page.ui
index c4df6a5..0d3d73f 100644
--- a/calendar/gui/dialogs/event-page.ui
+++ b/calendar/gui/dialogs/event-page.ui
@@ -745,7 +745,7 @@
                         <property name="visible">True</property>
                         <property name="add_tearoffs">False</property>
                         <property name="has_frame">True</property>
-                        <property name="has_entry">True</property>
+                        <property name="has-entry">True</property>
 			<property name="entry-text-column">0</property>
                         <property name="focus_on_click">True</property>
                         <property name="model">model2</property>
diff --git a/calendar/gui/dialogs/memo-page.ui b/calendar/gui/dialogs/memo-page.ui
index c531460..f0dd0bb 100644
--- a/calendar/gui/dialogs/memo-page.ui
+++ b/calendar/gui/dialogs/memo-page.ui
@@ -426,7 +426,7 @@
                     <property name="visible">False</property>
                     <property name="add_tearoffs">False</property>
                     <property name="has_frame">True</property>
-                    <property name="has_entry">True</property>
+                    <property name="has-entry">True</property>
 		    <property name="entry-text-column">0</property>
                     <property name="focus_on_click">True</property>
                     <property name="model">model1</property>
diff --git a/mail/e-mail-tag-editor.c b/mail/e-mail-tag-editor.c
index 90cf890..0b1e20c 100644
--- a/mail/e-mail-tag-editor.c
+++ b/mail/e-mail-tag-editor.c
@@ -158,10 +158,12 @@ mail_tag_editor_get_tag_list (EMailTagEditor *editor)
 {
 	CamelTag *tag_list = NULL;
 	time_t date;
-	gchar *text;
+	gchar *text = NULL;
+	GtkWidget *entry;
 
-	text = gtk_combo_box_text_get_active_text (
-		GTK_COMBO_BOX_TEXT (editor->priv->combo_entry));
+	entry = gtk_bin_get_child (GTK_BIN (editor->priv->combo_entry));
+	if (entry)
+		text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
 	camel_tag_set (&tag_list, "follow-up", text);
 	g_free (text);
 
@@ -332,7 +334,6 @@ mail_tag_editor_init (EMailTagEditor *editor)
 		renderer, "text", 1, NULL);
 
 	widget = e_builder_get_widget (builder, "combo");
-	gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (widget), 0);
 	editor->priv->combo_entry = GTK_COMBO_BOX (widget);
 	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), DEFAULT_FLAG);
 
diff --git a/mail/mail-dialogs.ui b/mail/mail-dialogs.ui
index 87bd71a..3520a0d 100644
--- a/mail/mail-dialogs.ui
+++ b/mail/mail-dialogs.ui
@@ -334,6 +334,7 @@ Please select a follow up action from the "Flag" menu.</property>
           <object class="GtkComboBox" id="combo">
             <property name="visible">True</property>
             <property name="has-entry">True</property>
+            <property name="entry-text-column">0</property>
             <property name="model">combo_model</property>
           </object>
           <packing>
diff --git a/modules/addressbook/addressbook-config.c b/modules/addressbook/addressbook-config.c
index a6ad324..0743e2a 100644
--- a/modules/addressbook/addressbook-config.c
+++ b/modules/addressbook/addressbook-config.c
@@ -748,7 +748,6 @@ eabc_general_host (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
 	g_signal_connect (sdialog->host, "changed", G_CALLBACK (host_changed_cb), sdialog);
 
 	sdialog->port_comboentry = e_builder_get_widget (builder, "port-comboentry");
-	gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (sdialog->port_comboentry), 0);
 	gtk_widget_set_has_tooltip (sdialog->port_comboentry, TRUE);
 	gtk_widget_set_tooltip_text (sdialog->port_comboentry, _("This is the port on the LDAP server that Evolution will try to connect to. A list of standard ports has been provided. Ask your system administrator what port you should specify."));
 	sprintf(port, "%u", lud && lud->lud_port? lud->lud_port : LDAP_PORT);
diff --git a/modules/addressbook/ldap-config.ui b/modules/addressbook/ldap-config.ui
index 10cdcb6..4d045f5 100644
--- a/modules/addressbook/ldap-config.ui
+++ b/modules/addressbook/ldap-config.ui
@@ -311,7 +311,8 @@
       <object class="GtkComboBox" id="port-comboentry">
         <property name="visible">True</property>
         <property name="model">model2</property>
-	<property name="has-entry">TRUE</property>
+	<property name="has-entry">True</property>
+	<property name="entry-text-column">0</property>
       </object>
       <packing>
         <property name="left_attach">1</property>
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 8bec111..870e5ec 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -670,9 +670,12 @@ junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs)
 {
 	gchar *def_plugin;
 	const GList *plugins = mail_session_get_junk_plugins (prefs->session);
+	GtkTreeIter iter;
+
+	g_return_if_fail (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter));
 
-	def_plugin = gtk_combo_box_text_get_active_text (
-		GTK_COMBO_BOX_TEXT (combo));
+	def_plugin = NULL;
+	gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (combo)), &iter, 0, &def_plugin, -1);
 
 	gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/junk/default_plugin", def_plugin, NULL);
 	while (plugins) {
@@ -705,6 +708,8 @@ junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs)
 		}
 		plugins = plugins->next;
 	}
+
+	g_free (def_plugin);
 }
 
 static void



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