[evolution-data-server] Add signal handlers when folder selection changes and when connection shuts down



commit 6ff4c69f9e066f007d242b6b72232c9d42fc038f
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Mon Jul 5 13:05:10 2010 +0530

    Add signal handlers when folder selection changes and when connection shuts down

 camel/providers/imapx/camel-imapx-server.c |   43 ++++++++++++++++++++++++++++
 camel/providers/imapx/camel-imapx-server.h |    4 ++
 2 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 238d191..31945d5 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -69,6 +69,14 @@ struct _uidset_state {
 	guint32 last;
 };
 
+enum {
+	SELECT_CHANGED,
+	SHUTDOWN,
+	LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
 void imapx_uidset_init(struct _uidset_state *ss, gint total, gint limit);
 gint imapx_uidset_done(struct _uidset_state *ss, struct _CamelIMAPXCommand *ic);
 gint imapx_uidset_add(struct _uidset_state *ss, struct _CamelIMAPXCommand *ic, const gchar *uid);
@@ -2341,6 +2349,8 @@ imapx_command_select_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 
 	is->select_pending = NULL;
 	camel_imapx_command_free (ic);
+
+	g_signal_emit (is, signals[SELECT_CHANGED], 0);
 }
 
 /* Should have a queue lock. TODO Change the way select is written */
@@ -4534,6 +4544,9 @@ imapx_parser_thread (gpointer d)
 
 	is->parser_thread = NULL;
 	is->parser_quit = FALSE;
+
+	g_signal_emit (is, signals[SHUTDOWN], 0);
+
 	return NULL;
 }
 
@@ -4600,6 +4613,36 @@ camel_imapx_server_class_init(CamelIMAPXServerClass *class)
 	object_class->constructed = imapx_server_constructed;
 	object_class->dispose = imapx_server_dispose;
 
+	class->select_changed = NULL;
+	class->shutdown = NULL;
+
+	/**
+	 * CamelIMAPXServer::select_changed
+	 * @server: the #CamelIMAPXServer which emitted the signal
+	 **/
+	signals[SELECT_CHANGED] = g_signal_new (
+		"select_changed",
+		G_OBJECT_CLASS_TYPE (class),
+		G_SIGNAL_RUN_FIRST,
+		G_STRUCT_OFFSET (CamelIMAPXServerClass, select_changed),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
+
+	/**
+	 * CamelIMAPXServer::shutdown
+	 * @server: the #CamelIMAPXServer which emitted the signal
+	 **/
+	signals[SHUTDOWN] = g_signal_new (
+		"shutdown",
+		G_OBJECT_CLASS_TYPE (class),
+		G_SIGNAL_RUN_FIRST,
+		G_STRUCT_OFFSET (CamelIMAPXServerClass, shutdown),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
+
+
 	class->tagprefix = 'A';
 }
 
diff --git a/camel/providers/imapx/camel-imapx-server.h b/camel/providers/imapx/camel-imapx-server.h
index 3eac3ec..4bf851a 100644
--- a/camel/providers/imapx/camel-imapx-server.h
+++ b/camel/providers/imapx/camel-imapx-server.h
@@ -128,6 +128,10 @@ struct _CamelIMAPXServer {
 struct _CamelIMAPXServerClass {
 	CamelObjectClass parent_class;
 
+	/* Signals */
+	void	(*select_changed)	(CamelIMAPXServer *server);
+	void	(*shutdown)		(CamelIMAPXServer *server);
+
 	gchar tagprefix;
 };
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]