diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-03-07 18:03:33 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-03-22 20:04:42 +0800 |
commit | 347d200c0b02fd27ae23f2953806adc8b0b88d32 (patch) | |
tree | 6e90757d05a9648c7e570f606bec73c6e9b4673b | |
parent | c628b0547ec2486841ed994674c9d10b66ca66dc (diff) | |
download | gsoc2013-empathy-347d200c0b02fd27ae23f2953806adc8b0b88d32.tar gsoc2013-empathy-347d200c0b02fd27ae23f2953806adc8b0b88d32.tar.gz gsoc2013-empathy-347d200c0b02fd27ae23f2953806adc8b0b88d32.tar.bz2 gsoc2013-empathy-347d200c0b02fd27ae23f2953806adc8b0b88d32.tar.lz gsoc2013-empathy-347d200c0b02fd27ae23f2953806adc8b0b88d32.tar.xz gsoc2013-empathy-347d200c0b02fd27ae23f2953806adc8b0b88d32.tar.zst gsoc2013-empathy-347d200c0b02fd27ae23f2953806adc8b0b88d32.zip |
factor out select_and_scroll_to_iter()
-rw-r--r-- | 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 d7039bcb3..964b9dd58 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -1610,6 +1610,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) { @@ -1957,20 +1979,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 |