diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2014-03-26 21:51:47 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2014-03-27 08:24:34 +0800 |
commit | 79920ca23f382587c67c9d5034a29f57f49d0c76 (patch) | |
tree | 729a70555aaae79cc9d0f726195edf4074897a60 /mail | |
parent | d40a75af9d6e0f079d1f4aa7c6f5cb38599abcbe (diff) | |
download | gsoc2013-evolution-79920ca23f382587c67c9d5034a29f57f49d0c76.tar gsoc2013-evolution-79920ca23f382587c67c9d5034a29f57f49d0c76.tar.gz gsoc2013-evolution-79920ca23f382587c67c9d5034a29f57f49d0c76.tar.bz2 gsoc2013-evolution-79920ca23f382587c67c9d5034a29f57f49d0c76.tar.lz gsoc2013-evolution-79920ca23f382587c67c9d5034a29f57f49d0c76.tar.xz gsoc2013-evolution-79920ca23f382587c67c9d5034a29f57f49d0c76.tar.zst gsoc2013-evolution-79920ca23f382587c67c9d5034a29f57f49d0c76.zip |
Add em_folder_selector_get_selected().
Will eventually replace em_folder_selector_get_selected_uri().
Diffstat (limited to 'mail')
-rw-r--r-- | mail/em-folder-selector.c | 40 | ||||
-rw-r--r-- | mail/em-folder-selector.h | 3 |
2 files changed, 43 insertions, 0 deletions
diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index 609eecdbd9..e3e2c597dc 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -750,6 +750,46 @@ em_folder_selector_get_folder_tree (EMFolderSelector *selector) return selector->priv->folder_tree; } +/** + * em_folder_selector_get_selected: + * @selector: an #EMFolderSelector + * @out_store: return location for a #CamelStore, or %NULL + * @out_folder_name: return location for a folder name string, or %NULL + * + * Sets @out_store and @out_folder_name to the currently selected folder + * in the @selector dialog and returns %TRUE. If only a #CamelStore row + * is selected, the function returns the #CamelStore through @out_store, + * sets @out_folder_name to %NULL and returns %TRUE. + * + * If the dialog has no selection, the function leaves @out_store and + * @out_folder_name unset and returns %FALSE. + * + * Unreference the returned #CamelStore with g_object_unref() and free + * the returned folder name with g_free() when finished with them. + * + * Returns: whether a row is selected in the @selector dialog + **/ +gboolean +em_folder_selector_get_selected (EMFolderSelector *selector, + CamelStore **out_store, + gchar **out_folder_name) +{ + EMFolderTree *folder_tree; + + g_return_val_if_fail (EM_IS_FOLDER_SELECTOR (selector), FALSE); + + folder_tree = em_folder_selector_get_folder_tree (selector); + + if (em_folder_tree_store_root_selected (folder_tree, out_store)) { + if (out_folder_name != NULL) + *out_folder_name = NULL; + return TRUE; + } + + return em_folder_tree_get_selected ( + folder_tree, out_store, out_folder_name); +} + const gchar * em_folder_selector_get_selected_uri (EMFolderSelector *selector) { diff --git a/mail/em-folder-selector.h b/mail/em-folder-selector.h index 44d7b9f6a4..a1207e8013 100644 --- a/mail/em-folder-selector.h +++ b/mail/em-folder-selector.h @@ -84,6 +84,9 @@ GtkWidget * em_folder_selector_get_content_area (EMFolderSelector *selector); EMFolderTree * em_folder_selector_get_folder_tree (EMFolderSelector *selector); +gboolean em_folder_selector_get_selected (EMFolderSelector *selector, + CamelStore **out_store, + gchar **out_folder_name); const gchar * em_folder_selector_get_selected_uri (EMFolderSelector *selector); |