aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-07-08 22:18:05 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-07-09 20:44:21 +0800
commitacac6795d927185fec36dae65ee4c74e8165152c (patch)
tree6c966fce05db268ceb265c3a015ae5b4433b1ed1
parentec1e0144581bd14d1993b7bf0a1e423d2092f463 (diff)
downloadgsoc2013-evolution-acac6795d927185fec36dae65ee4c74e8165152c.tar
gsoc2013-evolution-acac6795d927185fec36dae65ee4c74e8165152c.tar.gz
gsoc2013-evolution-acac6795d927185fec36dae65ee4c74e8165152c.tar.bz2
gsoc2013-evolution-acac6795d927185fec36dae65ee4c74e8165152c.tar.lz
gsoc2013-evolution-acac6795d927185fec36dae65ee4c74e8165152c.tar.xz
gsoc2013-evolution-acac6795d927185fec36dae65ee4c74e8165152c.tar.zst
gsoc2013-evolution-acac6795d927185fec36dae65ee4c74e8165152c.zip
Avoid em_folder_tree_get_selected_folder() in some places.
em_folder_tree_get_selected_folder() currently blocks, and I'm about to remove the function. But there's a couple places where we just need to block for now, else it would require a significant rewrite. So execute the em_folder_tree_get_selected_folder() logic manually in those places.
-rw-r--r--mail/message-list.c36
-rw-r--r--modules/mail/e-mail-shell-view.c22
2 files changed, 50 insertions, 8 deletions
diff --git a/mail/message-list.c b/mail/message-list.c
index 849fae8ef9..997e38d12a 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -2447,6 +2447,7 @@ ml_tree_drag_motion (ETree *tree,
{
GList *targets;
GdkDragAction action, actions = 0;
+ GtkWidget *source_widget;
/* If drop target is name of the account/store and not actual folder, don't allow any action */
if (!ml->folder) {
@@ -2454,18 +2455,41 @@ ml_tree_drag_motion (ETree *tree,
return TRUE;
}
+ source_widget = gtk_drag_get_source_widget (context);
+
/* If source widget is packed under 'tree', don't allow any action */
- if (is_tree_widget_children (tree, gtk_drag_get_source_widget (context))) {
+ if (is_tree_widget_children (tree, source_widget)) {
gdk_drag_status (context, 0, time);
return TRUE;
}
- if (EM_IS_FOLDER_TREE (gtk_drag_get_source_widget (context))) {
+ if (EM_IS_FOLDER_TREE (source_widget)) {
EMFolderTree *folder_tree;
- CamelFolder *folder;
-
- folder_tree = EM_FOLDER_TREE (gtk_drag_get_source_widget (context));
- folder = em_folder_tree_get_selected_folder (folder_tree);
+ CamelFolder *folder = NULL;
+ CamelStore *selected_store;
+ gchar *selected_folder_name;
+ gboolean has_selection;
+
+ folder_tree = EM_FOLDER_TREE (source_widget);
+
+ has_selection = em_folder_tree_get_selected (
+ folder_tree, &selected_store, &selected_folder_name);
+
+ /* Sanity checks */
+ g_warn_if_fail (
+ (has_selection && selected_store != NULL) ||
+ (!has_selection && selected_store == NULL));
+ g_warn_if_fail (
+ (has_selection && selected_folder_name != NULL) ||
+ (!has_selection && selected_folder_name == NULL));
+
+ if (has_selection) {
+ folder = camel_store_get_folder_sync (
+ selected_store, selected_folder_name,
+ CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
+ g_object_unref (selected_store);
+ g_free (selected_folder_name);
+ }
if (folder == ml->folder) {
gdk_drag_status (context, 0, time);
diff --git a/modules/mail/e-mail-shell-view.c b/modules/mail/e-mail-shell-view.c
index 4d91a3dbd1..146b89f38b 100644
--- a/modules/mail/e-mail-shell-view.c
+++ b/modules/mail/e-mail-shell-view.c
@@ -502,6 +502,9 @@ all_accounts:
* account-wide searches still in progress. */
text = e_shell_searchbar_get_search_text (searchbar);
if (text == NULL || *text == '\0') {
+ CamelStore *selected_store;
+ gchar *selected_folder_name;
+
if (priv->search_account_all != NULL) {
g_object_unref (priv->search_account_all);
priv->search_account_all = NULL;
@@ -518,8 +521,14 @@ all_accounts:
* avoid search conflicts, so we can't just grab the
* folder URI and let the asynchronous callbacks run
* after we've already kicked off the search. */
- folder = em_folder_tree_get_selected_folder (folder_tree);
+ em_folder_tree_get_selected (
+ folder_tree, &selected_store, &selected_folder_name);
+ folder = camel_store_get_folder_sync (
+ selected_store, selected_folder_name,
+ CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
e_mail_reader_set_folder (reader, folder);
+ g_object_unref (selected_store);
+ g_free (selected_folder_name);
gtk_widget_set_sensitive (GTK_WIDGET (combo_box), TRUE);
@@ -606,6 +615,9 @@ current_account:
* account-wide searches still in progress. */
text = e_shell_searchbar_get_search_text (searchbar);
if (text == NULL || *text == '\0') {
+ CamelStore *selected_store;
+ gchar *selected_folder_name;
+
if (priv->search_account_current != NULL) {
g_object_unref (priv->search_account_current);
priv->search_account_current = NULL;
@@ -622,8 +634,14 @@ current_account:
* avoid search conflicts, so we can't just grab the
* folder URI and let the asynchronous callbacks run
* after we've already kicked off the search. */
- folder = em_folder_tree_get_selected_folder (folder_tree);
+ em_folder_tree_get_selected (
+ folder_tree, &selected_store, &selected_folder_name);
+ folder = camel_store_get_folder_sync (
+ selected_store, selected_folder_name,
+ CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
e_mail_reader_set_folder (reader, folder);
+ g_object_unref (selected_store);
+ g_free (selected_folder_name);
gtk_widget_set_sensitive (GTK_WIDGET (combo_box), TRUE);