[empathy] factor out select_and_scroll_to_iter()
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] factor out select_and_scroll_to_iter()
- Date: Tue, 22 Mar 2011 12:05:54 +0000 (UTC)
commit 0ac4dcb553efbdd058a5b37ba948c1d542d87075
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Mon Mar 7 11:03:33 2011 +0100
factor out select_and_scroll_to_iter()
src/empathy-accounts-dialog.c | 37 +++++++++++++++++++++++--------------
1 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 501b936..ffe1df3 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -1501,6 +1501,28 @@ accounts_dialog_get_account_iter (EmpathyAccountsDialog *dialog,
}
static void
+select_and_scroll_to_iter (EmpathyAccountsDialog *dialog,
+ GtkTreeIter *iter)
+{
+ EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
+ GtkTreeSelection *selection;
+ GtkTreePath *path;
+ GtkTreeModel *model;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
+
+ gtk_tree_selection_select_iter (selection, iter);
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
+ path = gtk_tree_model_get_path (model, iter);
+
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->treeview), path, NULL,
+ TRUE, 0, 0.5);
+
+ gtk_tree_path_free (path);
+}
+
+static void
accounts_dialog_model_set_selected (EmpathyAccountsDialog *dialog,
EmpathyAccountSettings *settings)
{
@@ -1943,20 +1965,7 @@ accounts_dialog_set_selected_account (EmpathyAccountsDialog *dialog,
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
if (accounts_dialog_get_account_iter (dialog, account, &iter))
- {
- GtkTreePath *path;
- GtkTreeModel *model;
-
- gtk_tree_selection_select_iter (selection, &iter);
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
- path = gtk_tree_model_get_path (model, &iter);
-
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (priv->treeview), path, NULL,
- TRUE, 0, 0.5);
-
- gtk_tree_path_free (path);
- }
+ select_and_scroll_to_iter (dialog, &iter);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]