aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-02-16 03:20:38 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-02-16 03:20:38 +0800
commitf89ca302d1bc8cdd0a988121523928b80366441a (patch)
tree4779cde1691418bccaa93608c7493c6558cd30f6 /camel
parentcb66ad3fe4a2297ea211adfe012dbdf3f875090b (diff)
downloadgsoc2013-evolution-f89ca302d1bc8cdd0a988121523928b80366441a.tar
gsoc2013-evolution-f89ca302d1bc8cdd0a988121523928b80366441a.tar.gz
gsoc2013-evolution-f89ca302d1bc8cdd0a988121523928b80366441a.tar.bz2
gsoc2013-evolution-f89ca302d1bc8cdd0a988121523928b80366441a.tar.lz
gsoc2013-evolution-f89ca302d1bc8cdd0a988121523928b80366441a.tar.xz
gsoc2013-evolution-f89ca302d1bc8cdd0a988121523928b80366441a.tar.zst
gsoc2013-evolution-f89ca302d1bc8cdd0a988121523928b80366441a.zip
Emit the folder_created signal here.
2001-02-15 Jeffrey Stedfast <fejj@ximian.com> * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Emit the folder_created signal here. * providers/local/camel-local-folder.c (camel_local_folder_construct): Emit the folder_created signal. * providers/local/camel-local-store.c (delete_folder): On error, free the 'name' string so we don't leak. Also emit the folder_deleted signal. * providers/imap/camel-imap-store.c (subscribe_folder): Emit the folder_created signal. (unsubscribe_folder): Emit the folder_deleted signal. * camel-store.c (camel_store_class_init): Added folder_created and folder_deleted signal defs. svn path=/trunk/; revision=8246
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog19
-rw-r--r--camel/camel-object.h151
-rw-r--r--camel/camel-store.c11
-rw-r--r--camel/providers/imap/camel-imap-store.c39
-rw-r--r--camel/providers/local/camel-local-folder.c14
-rw-r--r--camel/providers/local/camel-local-store.c14
-rw-r--r--camel/providers/vee/camel-vee-folder.c15
7 files changed, 183 insertions, 80 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 72f1101207..ff45a526bd 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,22 @@
+2001-02-15 Jeffrey Stedfast <fejj@ximian.com>
+
+ * providers/vee/camel-vee-folder.c (camel_vee_folder_new): Emit
+ the folder_created signal here.
+
+ * providers/local/camel-local-folder.c
+ (camel_local_folder_construct): Emit the folder_created signal.
+
+ * providers/local/camel-local-store.c (delete_folder): On error,
+ free the 'name' string so we don't leak. Also emit the
+ folder_deleted signal.
+
+ * providers/imap/camel-imap-store.c (subscribe_folder): Emit the
+ folder_created signal.
+ (unsubscribe_folder): Emit the folder_deleted signal.
+
+ * camel-store.c (camel_store_class_init): Added folder_created and
+ folder_deleted signal defs.
+
2001-02-15 Dan Winship <danw@ximian.com>
* camel-folder-thread.c (container_parent_child): Deal with
diff --git a/camel/camel-object.h b/camel/camel-object.h
index 1308e075d5..1d27807d24 100644
--- a/camel/camel-object.h
+++ b/camel/camel-object.h
@@ -27,8 +27,7 @@
#define CAMEL_OBJECT_H 1
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#pragma }
#endif /* __cplusplus } */
@@ -62,83 +61,83 @@ extern "C"
#define CAMEL_OBJECT_GET_CLASS(o) ((CamelObjectClass *)(CAMEL_OBJECT(o))->classfuncs)
#define CAMEL_OBJECT_GET_TYPE(o) ((CamelType)(CAMEL_OBJECT(o))->s.type)
- typedef guint32 CamelType;
-
- typedef struct _CamelObjectShared
- {
- guint32 magic;
- CamelType type;
- }
- CamelObjectShared;
-
- typedef struct _CamelObjectClass
- {
- CamelObjectShared s;
-
- GHashTable *event_to_preplist;
- }
- CamelObjectClass;
-
- typedef struct _CamelObject
- {
- CamelObjectShared s;
- guint32 ref_count:31;
- guint32 in_event:1;
- CamelObjectClass *classfuncs;
- GHashTable *event_to_hooklist;
- }
- CamelObject;
-
- typedef void (*CamelObjectClassInitFunc) (CamelObjectClass *);
- typedef void (*CamelObjectClassFinalizeFunc) (CamelObjectClass *);
- typedef void (*CamelObjectInitFunc) (CamelObject *);
- typedef void (*CamelObjectFinalizeFunc) (CamelObject *);
-
- typedef gboolean (*CamelObjectEventPrepFunc) (CamelObject *,
- gpointer);
- typedef void (*CamelObjectEventHookFunc) (CamelObject *, gpointer,
- gpointer);
+typedef guint32 CamelType;
+
+typedef struct _CamelObjectShared
+{
+ guint32 magic;
+ CamelType type;
+}
+CamelObjectShared;
+
+typedef struct _CamelObjectClass
+{
+ CamelObjectShared s;
+
+ GHashTable *event_to_preplist;
+}
+CamelObjectClass;
+
+typedef struct _CamelObject
+{
+ CamelObjectShared s;
+ guint32 ref_count:31;
+ guint32 in_event:1;
+ CamelObjectClass *classfuncs;
+ GHashTable *event_to_hooklist;
+}
+CamelObject;
+
+typedef void (*CamelObjectClassInitFunc) (CamelObjectClass *);
+typedef void (*CamelObjectClassFinalizeFunc) (CamelObjectClass *);
+typedef void (*CamelObjectInitFunc) (CamelObject *);
+typedef void (*CamelObjectFinalizeFunc) (CamelObject *);
+
+typedef gboolean (*CamelObjectEventPrepFunc) (CamelObject *,
+ gpointer);
+typedef void (*CamelObjectEventHookFunc) (CamelObject *, gpointer,
+ gpointer);
/* The type system .... it's pretty simple..... */
- void camel_type_init (void);
- CamelType camel_type_register (CamelType parent, const gchar * name,
- size_t instance_size,
- size_t classfuncs_size,
- CamelObjectClassInitFunc class_init,
- CamelObjectClassFinalizeFunc
- class_finalize,
- CamelObjectInitFunc instance_init,
- CamelObjectFinalizeFunc
- instance_finalize);
- CamelObjectClass *camel_type_get_global_classfuncs (CamelType type);
- const gchar *camel_type_to_name (CamelType type);
-
- CamelType camel_object_get_type (void);
- CamelObject *camel_object_new (CamelType type);
- void camel_object_ref (CamelObject * obj);
- void camel_object_unref (CamelObject * obj);
- CamelObject *camel_object_check_cast (CamelObject * obj,
- CamelType ctype);
- CamelObjectClass *camel_object_class_check_cast (CamelObjectClass *
- class,
- CamelType ctype);
- gboolean camel_object_is_of_type (CamelObject * obj, CamelType ctype);
- gboolean camel_object_class_is_of_type (CamelObjectClass * class,
- CamelType ctype);
- gchar *camel_object_describe (CamelObject * obj);
- void camel_object_class_declare_event (CamelObjectClass * class,
- const gchar * name,
- CamelObjectEventPrepFunc prep);
- void camel_object_hook_event (CamelObject * obj, const gchar * name,
- CamelObjectEventHookFunc hook,
- gpointer user_data);
- void camel_object_unhook_event (CamelObject * obj, const gchar * name,
- CamelObjectEventHookFunc hook,
- gpointer user_data);
- void camel_object_trigger_event (CamelObject * obj,
- const gchar * name,
- gpointer event_data);
+void camel_type_init (void);
+CamelType camel_type_register (CamelType parent, const gchar * name,
+ size_t instance_size,
+ size_t classfuncs_size,
+ CamelObjectClassInitFunc class_init,
+ CamelObjectClassFinalizeFunc
+ class_finalize,
+ CamelObjectInitFunc instance_init,
+ CamelObjectFinalizeFunc
+ instance_finalize);
+CamelObjectClass *camel_type_get_global_classfuncs (CamelType type);
+const gchar *camel_type_to_name (CamelType type);
+
+CamelType camel_object_get_type (void);
+CamelObject *camel_object_new (CamelType type);
+void camel_object_ref (CamelObject * obj);
+void camel_object_unref (CamelObject * obj);
+CamelObject *camel_object_check_cast (CamelObject * obj,
+ CamelType ctype);
+CamelObjectClass *camel_object_class_check_cast (CamelObjectClass *
+ class,
+ CamelType ctype);
+gboolean camel_object_is_of_type (CamelObject * obj, CamelType ctype);
+gboolean camel_object_class_is_of_type (CamelObjectClass * class,
+ CamelType ctype);
+gchar *camel_object_describe (CamelObject * obj);
+void camel_object_class_declare_event (CamelObjectClass * class,
+ const gchar * name,
+ CamelObjectEventPrepFunc prep);
+void camel_object_hook_event (CamelObject * obj, const gchar * name,
+ CamelObjectEventHookFunc hook,
+ gpointer user_data);
+void camel_object_unhook_event (CamelObject * obj, const gchar * name,
+ CamelObjectEventHookFunc hook,
+ gpointer user_data);
+void camel_object_trigger_event (CamelObject * obj,
+ const gchar * name,
+ gpointer event_data);
#ifdef __cplusplus
}
diff --git a/camel/camel-store.c b/camel/camel-store.c
index bc86a72232..3af355c92c 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -65,8 +65,11 @@ static void unsubscribe_folder (CamelStore *store, const char *folder_name, Came
static void
camel_store_class_init (CamelStoreClass *camel_store_class)
{
+ CamelObjectClass *camel_object_class =
+ CAMEL_OBJECT_CLASS (camel_store_class);
+
parent_class = CAMEL_SERVICE_CLASS (camel_type_get_global_classfuncs (camel_service_get_type ()));
-
+
/* virtual method definition */
camel_store_class->hash_folder_name = g_str_hash;
camel_store_class->compare_folder_name = g_str_equal;
@@ -81,6 +84,12 @@ camel_store_class_init (CamelStoreClass *camel_store_class)
camel_store_class->folder_subscribed = folder_subscribed;
camel_store_class->subscribe_folder = subscribe_folder;
camel_store_class->unsubscribe_folder = unsubscribe_folder;
+
+ /* virtual method overload */
+ camel_object_class_declare_event (camel_object_class,
+ "folder_created", NULL);
+ camel_object_class_declare_event (camel_object_class,
+ "folder_deleted", NULL);
}
static void
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 1355cedb76..960d6275ca 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -715,6 +715,7 @@ create_folder (CamelStore *store, const char *parent_name,
fi = get_folder_info (store, full_name, FALSE, FALSE, FALSE, ex);
g_free (full_name);
+
return fi;
}
@@ -966,7 +967,7 @@ subscribe_folder (CamelStore *store, const char *folder_name,
{
CamelImapStore *imap_store = CAMEL_IMAP_STORE (store);
CamelImapResponse *response;
-
+
if (!camel_remote_store_connected (CAMEL_REMOTE_STORE (store), ex))
return;
@@ -975,9 +976,27 @@ subscribe_folder (CamelStore *store, const char *folder_name,
"SUBSCRIBE %S", folder_name);
CAMEL_IMAP_STORE_UNLOCK(imap_store, command_lock);
if (response) {
+ CamelFolderInfo *fi;
+ char *name;
+
g_hash_table_insert (imap_store->subscribed_folders,
g_strdup (folder_name),
GUINT_TO_POINTER (1));
+
+ name = strrchr (folder_name, imap_store->dir_sep);
+ if (name)
+ name++;
+
+ fi = g_new0 (CamelFolderInfo, 1);
+ fi->full_name = g_strdup (folder_name);
+ fi->name = g_strdup (name);
+ fi->url = g_strdup_printf ("%s%s", imap_store->base_url, folder_name);
+ fi->unread_message_count = -1;
+
+ camel_object_trigger_event (CAMEL_OBJECT (store),
+ "folder_created", fi);
+
+ camel_folder_info_free (fi);
}
camel_imap_response_free (response);
}
@@ -998,11 +1017,29 @@ unsubscribe_folder (CamelStore *store, const char *folder_name,
"UNSUBSCRIBE %S", folder_name);
CAMEL_IMAP_STORE_UNLOCK(imap_store, command_lock);
if (response) {
+ CamelFolderInfo *fi;
+ char *name;
+
g_hash_table_lookup_extended (imap_store->subscribed_folders,
folder_name, &key, &value);
g_hash_table_remove (imap_store->subscribed_folders,
folder_name);
g_free (key);
+
+ name = strrchr (folder_name, imap_store->dir_sep);
+ if (name)
+ name++;
+
+ fi = g_new0 (CamelFolderInfo, 1);
+ fi->full_name = g_strdup (folder_name);
+ fi->name = g_strdup (name);
+ fi->url = g_strdup_printf ("%s%s", imap_store->base_url, folder_name);
+ fi->unread_message_count = -1;
+
+ camel_object_trigger_event (CAMEL_OBJECT (store),
+ "folder_deleted", fi);
+
+ camel_folder_info_free (fi);
}
camel_imap_response_free (response);
}
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index 116a10ea7d..ea2894aa2e 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -162,6 +162,7 @@ CamelType camel_local_folder_get_type(void)
CamelLocalFolder *
camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, const char *full_name, guint32 flags, CamelException *ex)
{
+ CamelFolderInfo *fi;
CamelFolder *folder;
const char *root_dir_path, *name;
struct stat st;
@@ -213,7 +214,18 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con
camel_object_unref (CAMEL_OBJECT (folder));
return NULL;
}
-
+
+ fi = g_new0 (CamelFolderInfo, 1);
+ fi->full_name = g_strdup (full_name);
+ fi->name = g_strdup (name);
+ fi->url = g_strdup (lf->folder_path);
+ fi->unread_message_count = -1;
+
+ camel_object_trigger_event (CAMEL_OBJECT (parent_store),
+ "folder_deleted", fi);
+
+ camel_folder_info_free (fi);
+
return lf;
}
diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c
index b6ea31a98f..34da035301 100644
--- a/camel/providers/local/camel-local-store.c
+++ b/camel/providers/local/camel-local-store.c
@@ -270,6 +270,7 @@ rename_folder(CamelStore *store, const char *old, const char *new, CamelExceptio
static void
delete_folder(CamelStore *store, const char *folder_name, CamelException *ex)
{
+ CamelFolderInfo *fi;
char *name;
char *str;
@@ -281,6 +282,7 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex)
_("Could not delete folder summary file `%s': %s"),
str, strerror(errno));
g_free(str);
+ g_free (name);
return;
}
g_free(str);
@@ -290,8 +292,20 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex)
_("Could not delete folder index file `%s': %s"),
str, strerror(errno));
g_free(str);
+ g_free (name);
return;
}
g_free(str);
g_free(name);
+
+ fi = g_new0 (CamelFolderInfo, 1);
+ fi->full_name = g_strdup (folder_name);
+ fi->name = g_strdup (g_basename (folder_name));
+ fi->url = g_strdup_printf ("%s%s", CAMEL_SERVICE(store)->url->path, folder_name);
+ fi->unread_message_count = -1;
+
+ camel_object_trigger_event (CAMEL_OBJECT (store),
+ "folder_deleted", fi);
+
+ camel_folder_info_free (fi);
}
diff --git a/camel/providers/vee/camel-vee-folder.c b/camel/providers/vee/camel-vee-folder.c
index 4f3616ec12..057d227a61 100644
--- a/camel/providers/vee/camel-vee-folder.c
+++ b/camel/providers/vee/camel-vee-folder.c
@@ -22,6 +22,7 @@
#include "camel-exception.h"
#include "camel-vee-folder.h"
+#include "camel-store.h"
#include "camel-folder-summary.h"
#include "camel-mime-message.h"
#ifdef DYNAMIC
@@ -172,6 +173,7 @@ camel_vee_folder_finalise (CamelObject *obj)
CamelFolder *
camel_vee_folder_new (CamelStore *parent_store, const char *name, CamelException *ex)
{
+ CamelFolderInfo *fi;
CamelFolder *folder;
CamelVeeFolder *vf;
char *namepart, *searchpart;
@@ -201,7 +203,18 @@ camel_vee_folder_new (CamelStore *parent_store, const char *name, CamelException
camel_object_unref (CAMEL_OBJECT (folder));
return NULL;
}
-
+
+ fi = g_new0 (CamelFolderInfo, 1);
+ fi->full_name = g_strdup (name);
+ fi->name = g_strdup (name);
+ fi->url = g_strdup_printf ("vfolder:%s?%s", vf->vname, vf->expression);
+ fi->unread_message_count = -1;
+
+ camel_object_trigger_event (CAMEL_OBJECT (parent_store),
+ "folder_created", fi);
+
+ camel_folder_info_free (fi);
+
return folder;
}