[evolution-data-server] ECalBackend: Add a "closed" signal.



commit 737967473279591476bcf2b1a7e87f154850e4aa
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Mar 20 00:12:15 2013 -0400

    ECalBackend: Add a "closed" signal.

 calendar/libedata-cal/e-cal-backend.c |   25 +++++++++++++++++++++++++
 calendar/libedata-cal/e-cal-backend.h |    4 ++++
 calendar/libedata-cal/e-data-cal.c    |    6 ++++++
 3 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index f3753f5..e807703 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -77,6 +77,13 @@ enum {
        PROP_WRITABLE
 };
 
+enum {
+       CLOSED,
+       LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
 /* Forward Declarations */
 static void    e_cal_backend_remove_client_private
                                        (ECalBackend *backend,
@@ -615,6 +622,24 @@ e_cal_backend_class_init (ECalBackendClass *class)
                        FALSE,
                        G_PARAM_READWRITE |
                        G_PARAM_STATIC_STRINGS));
+
+       /**
+        * ECalBackend::closed:
+        * @backend: the #ECalBackend which emitted the signal
+        * @sender: the bus name that invoked the "close" method
+        *
+        * Emitted when a client destroys its #ECalClient for @backend
+        *
+        * Since: 3.10
+        **/
+       signals[CLOSED] = g_signal_new (
+               "closed",
+               G_OBJECT_CLASS_TYPE (object_class),
+               G_SIGNAL_RUN_LAST,
+               G_STRUCT_OFFSET (ECalBackendClass, closed),
+               NULL, NULL, NULL,
+               G_TYPE_NONE, 1,
+               G_TYPE_STRING);
 }
 
 static void
diff --git a/calendar/libedata-cal/e-cal-backend.h b/calendar/libedata-cal/e-cal-backend.h
index ccd3d99..fba96d7 100644
--- a/calendar/libedata-cal/e-cal-backend.h
+++ b/calendar/libedata-cal/e-cal-backend.h
@@ -239,6 +239,10 @@ struct _ECalBackendClass {
                                                 EDataCalView *view);
        void            (*stop_view)            (ECalBackend *backend,
                                                 EDataCalView *view);
+
+       /* Signals */
+       void            (*closed)               (ECalBackend *backend,
+                                                const gchar *sender);
 };
 
 GType          e_cal_backend_get_type          (void) G_GNUC_CONST;
diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c
index 9228b67..cb6b2d5 100644
--- a/calendar/libedata-cal/e-data-cal.c
+++ b/calendar/libedata-cal/e-data-cal.c
@@ -1200,6 +1200,8 @@ data_cal_handle_close_cb (EDBusCalendar *interface,
                           EDataCal *cal)
 {
        OperationData *op;
+       ECalBackend *backend;
+       const gchar *sender;
 
        op = op_new (OP_CLOSE, cal, invocation);
        /* unref here makes sure the cal is freed in a separate thread */
@@ -1208,6 +1210,10 @@ data_cal_handle_close_cb (EDBusCalendar *interface,
        /* This operation is never queued. */
        e_operation_pool_push (ops_pool, op);
 
+       backend = e_data_cal_get_backend (cal);
+       sender = g_dbus_method_invocation_get_sender (invocation);
+       g_signal_emit_by_name (backend, "closed", sender);
+
        return TRUE;
 }
 


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