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



commit 836c2b869d10608fb5783137afd067ac3182a46c
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Mar 19 23:53:08 2013 -0400

    EBookBackend: Add a "closed" signal.

 addressbook/libedata-book/e-book-backend.c |   25 +++++++++++++++++++++++++
 addressbook/libedata-book/e-book-backend.h |    5 ++++-
 addressbook/libedata-book/e-data-book.c    |    6 ++++++
 3 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 1e30896..a578924 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -43,6 +43,13 @@ enum {
        PROP_WRITABLE
 };
 
+enum {
+       CLOSED,
+       LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
 G_DEFINE_TYPE (EBookBackend, e_book_backend, E_TYPE_BACKEND)
 
 static void
@@ -342,6 +349,24 @@ e_book_backend_class_init (EBookBackendClass *class)
                        FALSE,
                        G_PARAM_READWRITE |
                        G_PARAM_STATIC_STRINGS));
+
+       /**
+        * EBookBackend::closed:
+        * @backend: the #EBookBackend which emitted the signal
+        * @sender: the bus name that invoked the "close" method
+        *
+        * Emitted when a client destroys its #EBookClient for @backend.
+        *
+        * Since: 3.10
+        **/
+       signals[CLOSED] = g_signal_new (
+               "closed",
+               G_OBJECT_CLASS_TYPE (object_class),
+               G_SIGNAL_RUN_LAST,
+               G_STRUCT_OFFSET (EBookBackendClass, closed),
+               NULL, NULL, NULL,
+               G_TYPE_NONE, 1,
+               G_TYPE_STRING);
 }
 
 static void
diff --git a/addressbook/libedata-book/e-book-backend.h b/addressbook/libedata-book/e-book-backend.h
index b79da95..fe38f3c 100644
--- a/addressbook/libedata-book/e-book-backend.h
+++ b/addressbook/libedata-book/e-book-backend.h
@@ -201,8 +201,11 @@ struct _EBookBackendClass {
        void            (*configure_direct)     (EBookBackend *backend,
                                                 const gchar *config);
 
-       /* Notification signals */
        void            (*sync)                 (EBookBackend *backend);
+
+       /* Signals */
+       void            (*closed)               (EBookBackend *backend,
+                                                const gchar *sender);
 };
 
 GType          e_book_backend_get_type         (void) G_GNUC_CONST;
diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c
index 071073f..8d1dafe 100644
--- a/addressbook/libedata-book/e-data-book.c
+++ b/addressbook/libedata-book/e-data-book.c
@@ -1104,6 +1104,8 @@ data_book_handle_close_cb (EDBusAddressBook *interface,
                            EDataBook *book)
 {
        OperationData *op;
+       EBookBackend *backend;
+       const gchar *sender;
 
        op = op_new (OP_CLOSE, book, invocation);
        /* unref here makes sure the book is freed in a separate thread */
@@ -1112,6 +1114,10 @@ data_book_handle_close_cb (EDBusAddressBook *interface,
        /* This operation is never queued. */
        e_operation_pool_push (ops_pool, op);
 
+       backend = e_data_book_get_backend (book);
+       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]