aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog11
-rw-r--r--mail/em-folder-selector.c42
-rw-r--r--mail/em-folder-selector.h3
-rw-r--r--mail/em-folder-tree-model.c14
-rw-r--r--mail/em-folder-tree-model.h4
5 files changed, 72 insertions, 2 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index d44e016cc0..ea2088737c 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,16 @@
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.
+
* mail-session.c (request_password): Focus the entry widget. Fixes
bug #55330.
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);
diff --git a/mail/em-folder-selector.h b/mail/em-folder-selector.h
index 0dbad9c7df..d3777b6ee3 100644
--- a/mail/em-folder-selector.h
+++ b/mail/em-folder-selector.h
@@ -49,6 +49,9 @@ struct _EMFolderSelector {
struct _GtkEntry *name_entry;
char *selected_path;
char *selected_uri;
+
+ char *created_uri;
+ guint created_id;
};
struct _EMFolderSelectorClass {
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 948de7774a..a095a88da6 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -77,6 +77,7 @@ static void account_removed (EAccountList *accounts, EAccount *account, gpointer
enum {
LOADING_ROW,
+ FOLDER_ADDED,
LAST_SIGNAL
};
@@ -143,6 +144,17 @@ em_folder_tree_model_class_init (EMFolderTreeModelClass *klass)
G_TYPE_NONE, 2,
G_TYPE_POINTER,
G_TYPE_POINTER);
+
+ signals[FOLDER_ADDED] =
+ g_signal_new ("folder-added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EMFolderTreeModelClass, loading_row),
+ NULL, NULL,
+ em_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
}
static int
@@ -525,6 +537,8 @@ folder_subscribed (CamelStore *store, CamelFolderInfo *fi, EMFolderTreeModel *mo
em_folder_tree_model_set_folder_info (model, &iter, si, fi);
+ g_signal_emit (model, signals[FOLDER_ADDED], 0, fi->path, fi->url);
+
done:
camel_object_unref (store);
diff --git a/mail/em-folder-tree-model.h b/mail/em-folder-tree-model.h
index b21b406125..df48d1738a 100644
--- a/mail/em-folder-tree-model.h
+++ b/mail/em-folder-tree-model.h
@@ -100,6 +100,10 @@ struct _EMFolderTreeModelClass {
void (* loading_row) (EMFolderTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter);
+
+ void (* folder_added) (EMFolderTreeModel *model,
+ const char *path,
+ const char *uri);
};