aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-tree.c
diff options
context:
space:
mode:
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)
{