Bug #633779 - GtkComboBoxText issues

This commit is contained in:
Milan Crha
2010-11-18 13:35:36 +01:00
parent 41117c2b8c
commit b09b3e9cca
12 changed files with 87 additions and 53 deletions

View File

@ -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>

View File

@ -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;

View File

@ -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",

View File

@ -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>

View File

@ -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 */

View File

@ -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>

View File

@ -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));
}

View File

@ -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>

View File

@ -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 (

View File

@ -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)

View File

@ -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>

View File

@ -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);