diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-11-17 19:05:41 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-11-23 23:06:37 +0800 |
commit | 6738d193bf3e30d0befaa3e8183cc75ffe607982 (patch) | |
tree | c623af60d80971d84874e2ef35483dea7f5c5431 /libempathy-gtk/empathy-account-widget.c | |
parent | db4180342c107e1641ae528739409e4168ba7d91 (diff) | |
download | gsoc2013-empathy-6738d193bf3e30d0befaa3e8183cc75ffe607982.tar gsoc2013-empathy-6738d193bf3e30d0befaa3e8183cc75ffe607982.tar.gz gsoc2013-empathy-6738d193bf3e30d0befaa3e8183cc75ffe607982.tar.bz2 gsoc2013-empathy-6738d193bf3e30d0befaa3e8183cc75ffe607982.tar.lz gsoc2013-empathy-6738d193bf3e30d0befaa3e8183cc75ffe607982.tar.xz gsoc2013-empathy-6738d193bf3e30d0befaa3e8183cc75ffe607982.tar.zst gsoc2013-empathy-6738d193bf3e30d0befaa3e8183cc75ffe607982.zip |
Set explicitely the model of combo box
The value of the param has to be in the first column as a string. This allow
us to display translated strings in the combo box.
Diffstat (limited to 'libempathy-gtk/empathy-account-widget.c')
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 6d804a7a0..caa899859 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -300,13 +300,21 @@ static void account_widget_combobox_changed_cb (GtkWidget *widget, EmpathyAccountWidget *self) { + GtkTreeIter iter; + GtkTreeModel *model; const gchar *value; const GValue *v; const gchar *default_value; const gchar *param_name; EmpathyAccountWidgetPriv *priv = GET_PRIV (self); - value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (widget)); + if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter)) + return; + + model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget)); + /* the param value is stored in the first column */ + gtk_tree_model_get (model, &iter, 0, &value, -1); + param_name = g_object_get_data (G_OBJECT (widget), "param_name"); v = empathy_account_settings_get_default (priv->settings, param_name); @@ -404,7 +412,8 @@ account_widget_setup_widget (EmpathyAccountWidget *self, } else if (GTK_IS_COMBO_BOX (widget)) { - /* Only support GtkComboBox created using gtk_combo_box_new_text () */ + /* The combo box's model has to contain the param value in its first + * column (as a string) */ const gchar *str; GtkTreeModel *model; GtkTreeIter iter; |