aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-status-preset-dialog.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c
index 1357849a2..b011b5db3 100644
--- a/libempathy-gtk/empathy-status-preset-dialog.c
+++ b/libempathy-gtk/empathy-status-preset-dialog.c
@@ -153,6 +153,10 @@ static void
status_preset_add_combo_reset (EmpathyStatusPresetDialog *self)
{
EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
+ GtkWidget *entry;
+
+ entry = gtk_bin_get_child (GTK_BIN (priv->add_combobox));
+ gtk_entry_set_text (GTK_ENTRY (entry), "");
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->add_combobox),
&priv->selected_iter);
@@ -412,9 +416,12 @@ status_preset_dialog_add_preset (GtkWidget *widget,
{
EmpathyStatusPresetDialogPriv *priv = GET_PRIV (self);
GtkTreeModel *model;
+ GtkTreeIter iter;
GtkWidget *entry;
- McPresence state;
+ McPresence state, cstate;
const char *status;
+ char *cstatus;
+ gboolean valid, match = FALSE;
g_return_if_fail (priv->add_combo_changed);
@@ -430,6 +437,40 @@ status_preset_dialog_add_preset (GtkWidget *widget,
empathy_status_presets_set_last (state, status);
status_preset_dialog_presets_update (self);
+
+ /* select the added status*/
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->presets_treeview));
+ for (valid = gtk_tree_model_get_iter_first (model, &iter);
+ valid;
+ valid = gtk_tree_model_iter_next (model, &iter)) {
+
+ gtk_tree_model_get (model, &iter,
+ PRESETS_STORE_STATE, &cstate,
+ PRESETS_STORE_STATUS, &cstatus,
+ -1);
+
+ match = (cstate == state) && (strcmp (cstatus, status) == 0);
+
+ g_free (cstatus);
+
+ if (match) {
+ GtkTreePath *path;
+
+ path = gtk_tree_model_get_path (model, &iter);
+
+ gtk_tree_selection_select_iter (
+ gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->presets_treeview)),
+ &iter);
+ gtk_tree_view_scroll_to_cell (
+ GTK_TREE_VIEW (priv->presets_treeview),
+ path, NULL,
+ FALSE, 0., 0.);
+ break;
+ }
+ }
+
+ if (!match) g_warning ("No match");
+
status_preset_add_combo_reset (self);
}