aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavyd Madeley <davyd@madeley.id.au>2009-05-28 17:47:09 +0800
committerDavyd Madeley <davyd@madeley.id.au>2009-05-28 17:47:09 +0800
commitaed93e6bd2c1b26cf66aa1486bdf4b98ca1ef36c (patch)
tree6796b9f8750d4353aff21852770dd7cae693eb1f
parent23c7cd285186313c9f1b3b9b6e3c0eae35eff0d7 (diff)
downloadgsoc2013-empathy-aed93e6bd2c1b26cf66aa1486bdf4b98ca1ef36c.tar
gsoc2013-empathy-aed93e6bd2c1b26cf66aa1486bdf4b98ca1ef36c.tar.gz
gsoc2013-empathy-aed93e6bd2c1b26cf66aa1486bdf4b98ca1ef36c.tar.bz2
gsoc2013-empathy-aed93e6bd2c1b26cf66aa1486bdf4b98ca1ef36c.tar.lz
gsoc2013-empathy-aed93e6bd2c1b26cf66aa1486bdf4b98ca1ef36c.tar.xz
gsoc2013-empathy-aed93e6bd2c1b26cf66aa1486bdf4b98ca1ef36c.tar.zst
gsoc2013-empathy-aed93e6bd2c1b26cf66aa1486bdf4b98ca1ef36c.zip
Highlight the most recently added entry in the status presets dialog
-rw-r--r--libempathy-gtk/empathy-status-preset-dialog.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c
index 1357849a2..82bc2e2d8 100644
--- a/libempathy-gtk/empathy-status-preset-dialog.c
+++ b/libempathy-gtk/empathy-status-preset-dialog.c
@@ -412,9 +412,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);
@@ -431,6 +434,37 @@ status_preset_dialog_add_preset (GtkWidget *widget,
status_preset_dialog_presets_update (self);
status_preset_add_combo_reset (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;
+ }
+ }
}
static gboolean