aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-11-18 20:35:36 +0800
committerMilan Crha <mcrha@redhat.com>2010-11-18 20:35:36 +0800
commitb09b3e9ccacea345fee998ff20ef01ae043eaeac (patch)
tree2d11701190da5f57461d41236bab44d22884a0a0 /addressbook
parent41117c2b8c8fafe581608cd91f84803cacb08f5d (diff)
downloadgsoc2013-evolution-b09b3e9ccacea345fee998ff20ef01ae043eaeac.tar
gsoc2013-evolution-b09b3e9ccacea345fee998ff20ef01ae043eaeac.tar.gz
gsoc2013-evolution-b09b3e9ccacea345fee998ff20ef01ae043eaeac.tar.bz2
gsoc2013-evolution-b09b3e9ccacea345fee998ff20ef01ae043eaeac.tar.lz
gsoc2013-evolution-b09b3e9ccacea345fee998ff20ef01ae043eaeac.tar.xz
gsoc2013-evolution-b09b3e9ccacea345fee998ff20ef01ae043eaeac.tar.zst
gsoc2013-evolution-b09b3e9ccacea345fee998ff20ef01ae043eaeac.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;