aboutsummaryrefslogtreecommitdiffstats
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
parent41117c2b8c8fafe581608cd91f84803cacb08f5d (diff)
downloadgsoc2013-evolution-b09b3e9ccacea345fee998ff20ef01ae043eaeac.tar.gz
gsoc2013-evolution-b09b3e9ccacea345fee998ff20ef01ae043eaeac.tar.zst
gsoc2013-evolution-b09b3e9ccacea345fee998ff20ef01ae043eaeac.zip
Bug #633779 - GtkComboBoxText issues
-rw-r--r--addressbook/gui/contact-editor/contact-editor.ui8
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c28
-rw-r--r--calendar/gui/dialogs/event-page.c21
-rw-r--r--calendar/gui/dialogs/event-page.ui2
-rw-r--r--e-util/gtk-compat.h1
-rw-r--r--filter/filter.ui2
-rw-r--r--mail/em-filter-editor.c16
-rw-r--r--mail/mail-config.ui6
-rw-r--r--modules/mail/em-mailer-prefs.c30
-rw-r--r--smime/gui/e-cert-selector.c13
-rw-r--r--smime/gui/smime-ui.ui2
-rw-r--r--widgets/misc/e-dateedit.c11
12 files changed, 87 insertions, 53 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;
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 32c2c18653..06ba14751b 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -2859,6 +2859,8 @@ init_widgets (EventPage *epage)
GtkTreeSelection *selection;
gboolean active;
ECal *client;
+ GtkTreeIter iter;
+ GtkListStore *store;
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage));
client = comp_editor_get_client (editor);
@@ -3025,17 +3027,28 @@ init_widgets (EventPage *epage)
break;
}
+ store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->alarm_time_combo)));
if (combo_label) {
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->alarm_time_combo), combo_label);
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ 0, combo_label,
+ -1);
g_free (combo_label);
priv->alarm_map = alarm_map_with_user_time;
} else {
priv->alarm_map = alarm_map_without_user_time;
}
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->alarm_time_combo), _("Customize"));
- /* Translators: "None" for "No alarm set" */
- gtk_combo_box_text_prepend_text (GTK_COMBO_BOX_TEXT (priv->alarm_time_combo), C_("cal-alarms", "None"));
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ 0, _("Customize"),
+ -1);
+
+ gtk_list_store_insert (store, &iter, 0);
+ gtk_list_store_set (store, &iter,
+ /* Translators: "None" for "No alarm set" */
+ 0, C_("cal-alarms", "None"),
+ -1);
g_signal_connect_swapped (
priv->alarm_time_combo, "changed",
diff --git a/calendar/gui/dialogs/event-page.ui b/calendar/gui/dialogs/event-page.ui
index fe3ece21ca..17919048a6 100644
--- a/calendar/gui/dialogs/event-page.ui
+++ b/calendar/gui/dialogs/event-page.ui
@@ -1059,7 +1059,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="alarm-time-combobox">
+ <object class="GtkComboBox" id="alarm-time-combobox">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
diff --git a/e-util/gtk-compat.h b/e-util/gtk-compat.h
index ab4a87209b..bbee3717cf 100644
--- a/e-util/gtk-compat.h
+++ b/e-util/gtk-compat.h
@@ -11,6 +11,7 @@
#define gtk_combo_box_text_prepend_text gtk_combo_box_prepend_text
#define gtk_combo_box_text_get_active_text gtk_combo_box_get_active_text
#define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX
+#define GTK_IS_COMBO_BOX_TEXT GTK_IS_COMBO_BOX
#define GtkComboBoxText GtkComboBox
/* The below can be used only once in sources */
diff --git a/filter/filter.ui b/filter/filter.ui
index a7e981c936..b2e11f6fc1 100644
--- a/filter/filter.ui
+++ b/filter/filter.ui
@@ -107,7 +107,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="filter_source_combobox">
+ <object class="GtkComboBox" id="filter_source_combobox">
<property name="visible">True</property>
<property name="model">model1</property>
<child>
diff --git a/mail/em-filter-editor.c b/mail/em-filter-editor.c
index ca351e8e4a..ca41486b1e 100644
--- a/mail/em-filter-editor.c
+++ b/mail/em-filter-editor.c
@@ -35,9 +35,6 @@
#include "em-filter-editor.h"
#include "em-filter-rule.h"
-/* backward-compatibility cruft */
-#include "e-util/gtk-compat.h"
-
static gpointer parent_class;
static EFilterRule *
@@ -170,16 +167,19 @@ em_filter_editor_construct (EMFilterEditor *fe,
GtkWidget *combobox;
gint i;
GtkTreeViewColumn *column;
- GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkListStore *store;
GSList *sources = NULL;
combobox = e_builder_get_widget (builder, "filter_source_combobox");
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
- gtk_list_store_clear (GTK_LIST_STORE (model));
+ store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combobox)));
+ gtk_list_store_clear (store);
for (i = 0; source_names[i].source; i++) {
- gtk_combo_box_text_append_text (
- GTK_COMBO_BOX_TEXT (combobox), source_names[i].name);
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ 0, source_names[i].name,
+ -1);
sources = g_slist_append (sources, g_strdup (source_names[i].source));
}
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index 171205c94b..7252206a56 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -2704,7 +2704,7 @@ For example: "Work" or "Personal"</property>
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="comboboxEmptyTrashDays">
+ <object class="GtkComboBox" id="comboboxEmptyTrashDays">
<property name="visible">True</property>
<property name="model">model1</property>
<child>
@@ -3342,7 +3342,7 @@ For example: "Work" or "Personal"</property>
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="default_junk_plugin">
+ <object class="GtkComboBox" id="default_junk_plugin">
<property name="visible">True</property>
</object>
<packing>
@@ -3427,7 +3427,7 @@ For example: "Work" or "Personal"</property>
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="junk_empty_combobox">
+ <object class="GtkComboBox" id="junk_empty_combobox">
<property name="visible">True</property>
<property name="model">model2</property>
<child>
diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c
index 2c4a2ebd06..b03ac60b0c 100644
--- a/modules/mail/em-mailer-prefs.c
+++ b/modules/mail/em-mailer-prefs.c
@@ -544,21 +544,24 @@ emmp_empty_trash_init (EMMailerPrefs *prefs,
GtkComboBox *combo_box)
{
gint days, hist = 0, ii;
- GtkTreeModel *model;
+ GtkListStore *store;
+ GtkTreeIter iter;
days = gconf_client_get_int (
prefs->gconf,
"/apps/evolution/mail/trash/empty_on_exit_days", NULL);
- model = gtk_combo_box_get_model (combo_box);
- gtk_list_store_clear (GTK_LIST_STORE (model));
+ store = GTK_LIST_STORE (gtk_combo_box_get_model (combo_box));
+ gtk_list_store_clear (store);
for (ii = 0; ii < G_N_ELEMENTS (empty_trash_frequency); ii++) {
if (days >= empty_trash_frequency[ii].days)
hist = ii;
- gtk_combo_box_text_append_text (
- GTK_COMBO_BOX_TEXT (combo_box),
- gettext (empty_trash_frequency[ii].label));
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ 0, gettext (empty_trash_frequency[ii].label),
+ -1);
}
g_signal_connect (
@@ -589,21 +592,24 @@ emmp_empty_junk_init (EMMailerPrefs *prefs,
GtkComboBox *combo_box)
{
gint days, hist = 0, ii;
- GtkTreeModel *model;
+ GtkListStore *store;
+ GtkTreeIter iter;
days = gconf_client_get_int (
prefs->gconf,
"/apps/evolution/mail/junk/empty_on_exit_days", NULL);
- model = gtk_combo_box_get_model (combo_box);
- gtk_list_store_clear (GTK_LIST_STORE (model));
+ store = GTK_LIST_STORE (gtk_combo_box_get_model (combo_box));
+ gtk_list_store_clear (store);
for (ii = 0; ii < G_N_ELEMENTS (empty_trash_frequency); ii++) {
if (days >= empty_trash_frequency[ii].days)
hist = ii;
- gtk_combo_box_text_append_text (
- GTK_COMBO_BOX_TEXT (combo_box),
- gettext (empty_trash_frequency[ii].label));
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ 0, gettext (empty_trash_frequency[ii].label),
+ -1);
}
g_signal_connect (
diff --git a/smime/gui/e-cert-selector.c b/smime/gui/e-cert-selector.c
index 5bbf3afc40..f20baa582c 100644
--- a/smime/gui/e-cert-selector.c
+++ b/smime/gui/e-cert-selector.c
@@ -37,9 +37,6 @@
#include "e-util/e-util.h"
#include "e-util/e-util-private.h"
-/* backward-compatibility cruft */
-#include "e-util/gtk-compat.h"
-
struct _ECertSelectorPrivate {
CERTCertList *certlist;
@@ -153,6 +150,8 @@ e_cert_selector_new (gint type, const gchar *currentid)
GtkBuilder *builder;
GtkWidget *content_area;
GtkWidget *w;
+ GtkListStore *store;
+ GtkTreeIter iter;
gint n=0, active=0;
ecs = g_object_new (e_cert_selector_get_type (), NULL);
@@ -179,7 +178,8 @@ e_cert_selector_new (gint type, const gchar *currentid)
break;
}
- gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (p->combobox))));
+ store = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (p->combobox)));
+ gtk_list_store_clear (store);
certlist = CERT_FindUserCertsByUsage (CERT_GetDefaultCertDB (), usage, FALSE, TRUE, NULL);
ecs->priv->certlist = certlist;
@@ -187,7 +187,10 @@ e_cert_selector_new (gint type, const gchar *currentid)
node = CERT_LIST_HEAD (certlist);
while (!CERT_LIST_END (node, certlist)) {
if (node->cert->nickname || node->cert->emailAddr) {
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (p->combobox), node->cert->nickname?node->cert->nickname:node->cert->emailAddr);
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ 0, node->cert->nickname?node->cert->nickname:node->cert->emailAddr,
+ -1);
if (currentid != NULL
&& ((node->cert->nickname != NULL && strcmp (node->cert->nickname, currentid) == 0)
diff --git a/smime/gui/smime-ui.ui b/smime/gui/smime-ui.ui
index 0f876ea36e..3d3dd28939 100644
--- a/smime/gui/smime-ui.ui
+++ b/smime/gui/smime-ui.ui
@@ -1332,7 +1332,7 @@
</packing>
</child>
<child>
- <object class="GtkComboBoxText" id="cert_combobox">
+ <object class="GtkComboBox" id="cert_combobox">
<property name="visible">True</property>
<property name="model">model1</property>
<child>
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index a1a385ca70..d0b9b7ea8f 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -578,17 +578,6 @@ create_children (EDateEdit *dedit)
"has-entry", TRUE,
"entry-text-column", 0,
NULL);
-
- {
- GtkCellRenderer *cell;
-
- gtk_cell_layout_clear (GTK_CELL_LAYOUT (priv->time_combo));
-
- cell = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->time_combo), cell, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (priv->time_combo), cell, "text", 0, NULL);
- }
-
#else
priv->time_combo = gtk_combo_box_entry_new_with_model (
GTK_TREE_MODEL (time_store), 0);