diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-03 07:07:06 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-05-03 07:07:06 +0800 |
commit | 52844f40f158be11749f5d8dcdf52454e776c9bd (patch) | |
tree | 63c20593c805bec00dfdcf9491882ab41700d03c /mail | |
parent | 305c62f1e07d1987b93fa7f4fe22b1eb891ebbd4 (diff) | |
download | gsoc2013-evolution-52844f40f158be11749f5d8dcdf52454e776c9bd.tar gsoc2013-evolution-52844f40f158be11749f5d8dcdf52454e776c9bd.tar.gz gsoc2013-evolution-52844f40f158be11749f5d8dcdf52454e776c9bd.tar.bz2 gsoc2013-evolution-52844f40f158be11749f5d8dcdf52454e776c9bd.tar.lz gsoc2013-evolution-52844f40f158be11749f5d8dcdf52454e776c9bd.tar.xz gsoc2013-evolution-52844f40f158be11749f5d8dcdf52454e776c9bd.tar.zst gsoc2013-evolution-52844f40f158be11749f5d8dcdf52454e776c9bd.zip |
Add em_folder_tree_get_selected_account().
Comes in handy for a few EMailShellView actions.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/em-folder-tree.c | 26 | ||||
-rw-r--r-- | mail/em-folder-tree.h | 2 |
2 files changed, 28 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) { diff --git a/mail/em-folder-tree.h b/mail/em-folder-tree.h index ecf0ddd29c..c824e86ed2 100644 --- a/mail/em-folder-tree.h +++ b/mail/em-folder-tree.h @@ -123,6 +123,8 @@ CamelFolder * em_folder_tree_get_selected_folder CamelFolderInfo * em_folder_tree_get_selected_folder_info (EMFolderTree *folder_tree); +EAccount * em_folder_tree_get_selected_account + (EMFolderTree *folder_tree); gboolean em_folder_tree_create_folder (EMFolderTree *folder_tree, const gchar *full_name, const gchar *uri); |