aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-tree.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-03 07:07:06 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:05 +0800
commit282701a518017e2e6ba3f7910e045c2bbe052190 (patch)
tree62ec7567a542a54baf81132e45fe7e75bc2cc6e6 /mail/em-folder-tree.c
parenta216303baf631f18b592b3e5bb051b3741846477 (diff)
downloadgsoc2013-evolution-282701a518017e2e6ba3f7910e045c2bbe052190.tar.gz
gsoc2013-evolution-282701a518017e2e6ba3f7910e045c2bbe052190.tar.zst
gsoc2013-evolution-282701a518017e2e6ba3f7910e045c2bbe052190.zip
Add em_folder_tree_get_selected_account().
Comes in handy for a few EMailShellView actions.
Diffstat (limited to 'mail/em-folder-tree.c')
-rw-r--r--mail/em-folder-tree.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index da845fbac6..e0ce87b89c 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -3157,6 +3157,32 @@ done:
return fi;
}
+EAccount *
+em_folder_tree_get_selected_account (EMFolderTree *folder_tree)
+{
+ GtkTreeView *tree_view;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ CamelStore *store = NULL;
+ const gchar *uid = NULL;
+
+ g_return_val_if_fail (EM_IS_FOLDER_TREE (folder_tree), NULL);
+
+ tree_view = GTK_TREE_VIEW (folder_tree);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ gtk_tree_model_get (
+ model, &iter,
+ COL_POINTER_CAMEL_STORE, &store, -1);
+
+ if (CAMEL_IS_STORE (store))
+ uid = camel_service_get_uid (CAMEL_SERVICE (store));
+
+ return (uid != NULL) ? e_get_account_by_uid (uid) : NULL;
+}
+
void
em_folder_tree_set_skip_double_click (EMFolderTree *folder_tree, gboolean skip)
{