aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-11-18 20:35:36 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:41:01 +0800
commit12a91dbb21f2a052d26460c9aad30835fd17456b (patch)
tree5dede0765bb0f74f363614a05210e533655e0c39 /addressbook
parent9e833a704ce57e4f571d0da91e795e6ae7cc2469 (diff)
downloadgsoc2013-evolution-12a91dbb21f2a052d26460c9aad30835fd17456b.tar
gsoc2013-evolution-12a91dbb21f2a052d26460c9aad30835fd17456b.tar.gz
gsoc2013-evolution-12a91dbb21f2a052d26460c9aad30835fd17456b.tar.bz2
gsoc2013-evolution-12a91dbb21f2a052d26460c9aad30835fd17456b.tar.lz
gsoc2013-evolution-12a91dbb21f2a052d26460c9aad30835fd17456b.tar.xz
gsoc2013-evolution-12a91dbb21f2a052d26460c9aad30835fd17456b.tar.zst
gsoc2013-evolution-12a91dbb21f2a052d26460c9aad30835fd17456b.zip
Bug #633779 - GtkComboBoxText issues
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/gui/contact-editor/contact-editor.ui8
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c28
2 files changed, 29 insertions, 7 deletions
diff --git a/addressbook/gui/contact-editor/contact-editor.ui b/addressbook/gui/contact-editor/contact-editor.ui
index 1c0dcca2ac..88c90c1c31 100644
--- a/addressbook/gui/contact-editor/contact-editor.ui
+++ b/addressbook/gui/contact-editor/contact-editor.ui
@@ -376,7 +376,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="combobox-email-1">
+ <object class="GtkComboBox" id="combobox-email-1">
<property name="visible">True</property>
<property name="model">model2</property>
<child>
@@ -392,7 +392,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="combobox-email-3">
+ <object class="GtkComboBox" id="combobox-email-3">
<property name="visible">True</property>
<property name="model">model3</property>
<child>
@@ -410,7 +410,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="combobox-email-2">
+ <object class="GtkComboBox" id="combobox-email-2">
<property name="visible">True</property>
<property name="model">model4</property>
<child>
@@ -428,7 +428,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="combobox-email-4">
+ <object class="GtkComboBox" id="combobox-email-4">
<property name="visible">True</property>
<property name="model">model5</property>
<child>
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index e67305bb80..e1794572a5 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -722,6 +722,8 @@ init_email_record_location (EContactEditor *editor, gint record)
GtkWidget *email_entry;
gchar *widget_name;
gint i;
+ GtkTreeIter iter;
+ GtkListStore *store;
widget_name = g_strdup_printf ("entry-email-%d", record);
email_entry = e_builder_get_widget (editor->builder, widget_name);
@@ -731,10 +733,14 @@ init_email_record_location (EContactEditor *editor, gint record)
location_combo_box = GTK_COMBO_BOX (e_builder_get_widget (editor->builder, widget_name));
g_free (widget_name);
- gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (location_combo_box)));
+ store = GTK_LIST_STORE (gtk_combo_box_get_model (location_combo_box));
+ gtk_list_store_clear (store);
for (i = 0; i < G_N_ELEMENTS (common_location); i++) {
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (location_combo_box), _(common_location[i].pretty_name));
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ 0, _(common_location[i].pretty_name),
+ -1);
}
g_signal_connect_swapped (location_combo_box, "changed", G_CALLBACK (gtk_widget_grab_focus), email_entry);
@@ -2371,13 +2377,29 @@ extract_simple_field (EContactEditor *editor, GtkWidget *widget, gint field_id)
const gchar *text = gtk_entry_get_text (GTK_ENTRY (widget));
e_contact_set (contact, field_id, (gchar *) text);
}
- else if (GTK_IS_COMBO_BOX (widget)) {
+ else if (GTK_IS_COMBO_BOX_TEXT (widget)) {
gchar *text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (widget));
e_contact_set (contact, field_id, text);
g_free (text);
}
+ else if (GTK_IS_COMBO_BOX (widget)) {
+ GtkTreeIter iter;
+ gchar *text = NULL;
+
+ if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter)) {
+ GtkListStore *store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (widget)));
+
+ gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
+ 0, &text,
+ -1);
+ }
+
+ e_contact_set (contact, field_id, text);
+
+ g_free (text);
+ }
else if (GTK_IS_TEXT_VIEW (widget)) {
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
GtkTextIter start, end;