aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-selector.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-03-11 05:28:50 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-03-11 05:28:50 +0800
commitf5f54e2eaa8e123473d5a20cef325e5418d1ee21 (patch)
tree5c279b13616acc553b9f962b9d054cd18fa8cb90 /mail/em-folder-selector.c
parente948af7be842595b0028001c0e9f7db5d4ed3cb7 (diff)
downloadgsoc2013-evolution-f5f54e2eaa8e123473d5a20cef325e5418d1ee21.tar.gz
gsoc2013-evolution-f5f54e2eaa8e123473d5a20cef325e5418d1ee21.tar.zst
gsoc2013-evolution-f5f54e2eaa8e123473d5a20cef325e5418d1ee21.zip
Partial fix for bug #53862
2004-03-10 Jeffrey Stedfast <fejj@ximian.com> Partial fix for bug #53862 * em-folder-selector.c (emfs_response): Connect to the newly added "folder-added" signal and save a created_uri string so that we can be sure to only listen for the creation of the folder the user created in *our* create-folder dilog (and not from some other place). * em-folder-tree-model.c (folder_subscribed): Emit a new "folder-added" signal. svn path=/trunk/; revision=25013
Diffstat (limited to 'mail/em-folder-selector.c')
-rw-r--r--mail/em-folder-selector.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c
index 66792f1556..754c123141 100644
--- a/mail/em-folder-selector.c
+++ b/mail/em-folder-selector.c
@@ -108,6 +108,15 @@ em_folder_selector_init (EMFolderSelector *emfs)
static void
em_folder_selector_destroy (GtkObject *obj)
{
+ EMFolderSelector *emfs = (EMFolderSelector *) obj;
+ EMFolderTreeModel *model;
+
+ if (emfs->created_id != 0) {
+ model = em_folder_tree_get_model (emfs->emft);
+ g_signal_handler_disconnect (model, emfs->created_id);
+ emfs->created_id = 0;
+ }
+
GTK_OBJECT_CLASS (parent_class)->destroy (obj);
}
@@ -118,11 +127,35 @@ em_folder_selector_finalize (GObject *obj)
g_free (emfs->selected_path);
g_free (emfs->selected_uri);
+ g_free (emfs->created_uri);
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
static void
+folder_created_cb (EMFolderTreeModel *model, const char *path, const char *uri, EMFolderSelector *emfs)
+{
+ CamelException ex;
+ CamelStore *store;
+
+ printf ("folder_created_cb: uri=%s (we are waiting for %s)\n", uri, emfs->created_uri);
+
+ camel_exception_init (&ex);
+ if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex)))
+ return;
+
+ if (camel_store_folder_uri_equal (store, emfs->created_uri, uri)) {
+ printf ("we got it!\n");
+ em_folder_tree_set_selected (emfs->emft, uri);
+ g_signal_handler_disconnect (model, emfs->created_id);
+ emfs->created_id = 0;
+ } else
+ printf ("we didn't get it... :(\n");
+
+ camel_object_unref (store);
+}
+
+static void
emfs_response (GtkWidget *dialog, int response, EMFolderSelector *emfs)
{
EMFolderTreeModel *model;
@@ -141,8 +174,13 @@ emfs_response (GtkWidget *dialog, int response, EMFolderSelector *emfs)
uri = em_folder_selector_get_selected_uri ((EMFolderSelector *) dialog);
path = em_folder_selector_get_selected_path ((EMFolderSelector *) dialog);
- if (em_folder_tree_create_folder (emfs->emft, path, uri))
- em_folder_tree_set_selected (emfs->emft, uri);
+ g_free (emfs->created_uri);
+ emfs->created_uri = g_strdup (uri);
+
+ if (emfs->created_id == 0)
+ emfs->created_id = g_signal_connect (model, "folder-added", G_CALLBACK (folder_created_cb), emfs);
+
+ em_folder_tree_create_folder (emfs->emft, path, uri);
}
gtk_widget_destroy (dialog);