aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-status-preset-dialog.c
diff options
context:
space:
mode:
authorDavyd Madeley <davyd@madeley.id.au>2009-04-22 17:34:23 +0800
committerDavyd Madeley <davyd@madeley.id.au>2009-04-22 17:34:23 +0800
commit93cc6d738d5fc2a91b257c568dd08687368fe637 (patch)
tree03bc932b32b7c6de4a127d2cfec35c2ef7c411c5 /libempathy-gtk/empathy-status-preset-dialog.c
parent6f3fd3de6db0fae7071f8665a62fe0ba092590e9 (diff)
downloadgsoc2013-empathy-93cc6d738d5fc2a91b257c568dd08687368fe637.tar
gsoc2013-empathy-93cc6d738d5fc2a91b257c568dd08687368fe637.tar.gz
gsoc2013-empathy-93cc6d738d5fc2a91b257c568dd08687368fe637.tar.bz2
gsoc2013-empathy-93cc6d738d5fc2a91b257c568dd08687368fe637.tar.lz
gsoc2013-empathy-93cc6d738d5fc2a91b257c568dd08687368fe637.tar.xz
gsoc2013-empathy-93cc6d738d5fc2a91b257c568dd08687368fe637.tar.zst
gsoc2013-empathy-93cc6d738d5fc2a91b257c568dd08687368fe637.zip
Don't reset the state to Available when you click [Add]
Diffstat (limited to 'libempathy-gtk/empathy-status-preset-dialog.c')
-rw-r--r--libempathy-gtk/empathy-status-preset-dialog.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c
index 22cba1a53..085332f35 100644
--- a/libempathy-gtk/empathy-status-preset-dialog.c
+++ b/libempathy-gtk/empathy-status-preset-dialog.c
@@ -60,7 +60,7 @@ struct _EmpathyStatusPresetDialogPriv
GtkWidget *add_combobox;
GtkWidget *add_button;
- McPresence selected_state;
+ GtkTreeIter selected_iter;
gboolean add_combo_changed;
};
@@ -131,7 +131,8 @@ status_preset_add_combo_reset (EmpathyStatusPresetDialog *self)
{
EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->add_combobox), 0);
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->add_combobox),
+ &priv->selected_iter);
}
static void
@@ -181,7 +182,7 @@ status_preset_dialog_setup_add_combobox (EmpathyStatusPresetDialog *self)
"foreground", "Gray", /* FIXME - theme */
NULL);
- status_preset_add_combo_reset (self);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0);
}
static void
@@ -304,8 +305,8 @@ status_preset_dialog_add_combo_changed (GtkComboBox *combo,
if (gtk_combo_box_get_active_iter (combo, &iter)) {
char *icon_name;
+ priv->selected_iter = iter;
gtk_tree_model_get (model, &iter,
- PRESETS_STORE_STATE, &priv->selected_state,
PRESETS_STORE_ICON_NAME, &icon_name,
-1);
@@ -330,16 +331,23 @@ status_preset_dialog_add_preset (GtkWidget *widget,
EmpathyStatusPresetDialog *self)
{
EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+ GtkTreeModel *model;
GtkWidget *entry;
+ McPresence state;
const char *status;
g_return_if_fail (priv->add_combo_changed);
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->add_combobox));
entry = gtk_bin_get_child (GTK_BIN (priv->add_combobox));
+
status = gtk_entry_get_text (GTK_ENTRY (entry));
+ gtk_tree_model_get (model, &priv->selected_iter,
+ PRESETS_STORE_STATE, &state,
+ -1);
- DEBUG ("ADD PRESET (%i, %s)\n", priv->selected_state, status);
- empathy_status_presets_set_last (priv->selected_state, status);
+ DEBUG ("ADD PRESET (%i, %s)\n", state, status);
+ empathy_status_presets_set_last (state, status);
status_preset_dialog_setup_presets_update (self);
status_preset_add_combo_reset (self);