aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-02-15 05:52:43 +0800
committerDan Winship <danw@src.gnome.org>2001-02-15 05:52:43 +0800
commitcb6f0cd1110c86eca9efd3e0c90127792e4431b4 (patch)
tree7b1685be594de247eb537af95319840dbe44e4f6
parent7d76ff550168871217e6d483f965ce430427c536 (diff)
downloadgsoc2013-evolution-cb6f0cd1110c86eca9efd3e0c90127792e4431b4.tar
gsoc2013-evolution-cb6f0cd1110c86eca9efd3e0c90127792e4431b4.tar.gz
gsoc2013-evolution-cb6f0cd1110c86eca9efd3e0c90127792e4431b4.tar.bz2
gsoc2013-evolution-cb6f0cd1110c86eca9efd3e0c90127792e4431b4.tar.lz
gsoc2013-evolution-cb6f0cd1110c86eca9efd3e0c90127792e4431b4.tar.xz
gsoc2013-evolution-cb6f0cd1110c86eca9efd3e0c90127792e4431b4.tar.zst
gsoc2013-evolution-cb6f0cd1110c86eca9efd3e0c90127792e4431b4.zip
Connect to the "create_folder" signal on the storage.
* component-factory.c (add_storage): Connect to the "create_folder" signal on the storage. (storage_create_folder): Do folder creation. svn path=/trunk/; revision=8232
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/component-factory.c54
2 files changed, 60 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index bbd36988bc..8fd9089b64 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,9 @@
+2001-02-14 Dan Winship <danw@ximian.com>
+
+ * component-factory.c (add_storage): Connect to the
+ "create_folder" signal on the storage.
+ (storage_create_folder): Do folder creation.
+
2001-02-14 Jeffrey Stedfast <fejj@ximian.com>
* component-factory.c (owner_set_cb): Setup the Trash folder.
diff --git a/mail/component-factory.c b/mail/component-factory.c
index f46a0a5f9b..4cedc6e3c0 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -306,6 +306,57 @@ component_factory_init (void)
}
}
+static int
+storage_create_folder (EvolutionStorage *storage, const char *path,
+ const char *type, const char *description,
+ const char *parent_physical_uri, gpointer user_data)
+{
+ CamelStore *store = user_data;
+ char *name;
+ CamelURL *url;
+ CamelException ex;
+ CamelFolderInfo *fi;
+
+ if (strcmp (type, "mail") != 0)
+ return EVOLUTION_STORAGE_ERROR_UNSUPPORTED_TYPE;
+ name = strrchr (path, '/');
+ if (!name++)
+ return EVOLUTION_STORAGE_ERROR_INVALID_URI;
+
+ camel_exception_init (&ex);
+ if (*parent_physical_uri) {
+ url = camel_url_new (parent_physical_uri, NULL);
+ if (!url)
+ return EVOLUTION_STORAGE_ERROR_INVALID_URI;
+
+ fi = camel_store_create_folder (store, url->path + 1, name, &ex);
+ camel_url_free (url);
+ } else
+ fi = camel_store_create_folder (store, NULL, name, &ex);
+
+ if (camel_exception_is_set (&ex)) {
+ /* FIXME: do better than this */
+ camel_exception_clear (&ex);
+ return EVOLUTION_STORAGE_ERROR_INVALID_URI;
+ }
+
+ if (camel_store_supports_subscriptions (store))
+ camel_store_subscribe_folder (store, fi->full_name, NULL);
+
+ if (fi->unread_message_count > 0) {
+ name = g_strdup_printf ("%s (%d)", fi->name,
+ fi->unread_message_count);
+ } else
+ name = g_strdup (fi->name);
+ evolution_storage_new_folder (storage, path, name, type,
+ fi->url ? fi->url : "", description,
+ fi->unread_message_count > 0);
+ g_free (name);
+ camel_store_free_folder_info (store, fi);
+
+ return EVOLUTION_STORAGE_OK;
+}
+
static void
add_storage (const char *name, const char *uri, CamelService *store,
GNOME_Evolution_Shell corba_shell, CamelException *ex)
@@ -314,6 +365,9 @@ add_storage (const char *name, const char *uri, CamelService *store,
EvolutionStorageResult res;
storage = evolution_storage_new (name, uri, "mailstorage");
+ gtk_signal_connect (GTK_OBJECT (storage), "create_folder",
+ GTK_SIGNAL_FUNC (storage_create_folder),
+ store);
res = evolution_storage_register_on_shell (storage, corba_shell);