[evolution-data-server] EDataBookView: Remove private EDataBook member.



commit 299f2a395cce2bb287119cf2b96ed0ccc93e7e93
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Mar 26 13:29:57 2013 -0400

    EDataBookView: Remove private EDataBook member.
    
    Alters the signature of e_data_book_view_new(), but it's a private
    function only used by EDataBook.

 addressbook/libedata-book/e-data-book-view.c |   52 +------------------------
 addressbook/libedata-book/e-data-book-view.h |    3 +-
 addressbook/libedata-book/e-data-book.c      |    2 +-
 3 files changed, 5 insertions(+), 52 deletions(-)
---
diff --git a/addressbook/libedata-book/e-data-book-view.c b/addressbook/libedata-book/e-data-book-view.c
index ea70cec..3d8ec56 100644
--- a/addressbook/libedata-book/e-data-book-view.c
+++ b/addressbook/libedata-book/e-data-book-view.c
@@ -48,7 +48,6 @@ struct _EDataBookViewPrivate {
        EGdbusBookView *gdbus_object;
        gchar *object_path;
 
-       EDataBook *book;
        EBookBackend *backend;
 
        EBookBackendSExp *sexp;
@@ -208,24 +207,6 @@ ensure_pending_flush_timeout (EDataBookView *view)
                THRESHOLD_SECONDS, pending_flush_timeout_cb, view);
 }
 
-static void
-book_destroyed_cb (gpointer data,
-                   GObject *dead)
-{
-       EDataBookView *view = E_DATA_BOOK_VIEW (data);
-
-       /* The book has just died, so unset the pointer so
-        * we don't try and remove a dead weak reference. */
-       view->priv->book = NULL;
-
-       /* If the view is running stop it here. */
-       if (view->priv->running) {
-               e_book_backend_stop_view (view->priv->backend, view);
-               view->priv->running = FALSE;
-               view->priv->complete = FALSE;
-       }
-}
-
 static gpointer
 bookview_start_thread (gpointer data)
 {
@@ -488,14 +469,6 @@ data_book_view_dispose (GObject *object)
                priv->connection = NULL;
        }
 
-       if (priv->book != NULL) {
-               /* Remove the weak reference */
-               g_object_weak_unref (
-                       G_OBJECT (priv->book),
-                       book_destroyed_cb, object);
-               priv->book = NULL;
-       }
-
        if (priv->backend != NULL) {
                g_object_unref (priv->backend);
                priv->backend = NULL;
@@ -687,42 +660,23 @@ e_data_book_view_init (EDataBookView *view)
  * and place it on DBus at the object path #path.
  */
 EDataBookView *
-e_data_book_view_new (EDataBook *book,
+e_data_book_view_new (EBookBackend *backend,
                       EBookBackendSExp *sexp,
                       GDBusConnection *connection,
                       const gchar *object_path,
                       GError **error)
 {
-       EDataBookView *view;
-       EBookBackend *backend;
-
-       g_return_val_if_fail (E_IS_DATA_BOOK (book), NULL);
+       g_return_val_if_fail (E_IS_BOOK_BACKEND (backend), NULL);
        g_return_val_if_fail (E_IS_BOOK_BACKEND_SEXP (sexp), NULL);
        g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
        g_return_val_if_fail (object_path != NULL, NULL);
 
-       backend = e_data_book_ref_backend (book);
-
-       view = g_initable_new (
+       return g_initable_new (
                E_TYPE_DATA_BOOK_VIEW, NULL, error,
                "backend", backend,
                "connection", connection,
                "object-path", object_path,
                "sexp", sexp, NULL);
-
-       g_object_unref (backend);
-
-       if (view == NULL)
-               return NULL;
-
-       view->priv->book = book;
-       /* Attach a weak reference to the book, so
-        * if it dies the book view is destroyed too. */
-       g_object_weak_ref (
-               G_OBJECT (view->priv->book),
-               book_destroyed_cb, view);
-
-       return view;
 }
 
 /**
diff --git a/addressbook/libedata-book/e-data-book-view.h b/addressbook/libedata-book/e-data-book-view.h
index fe626e5..7919e36 100644
--- a/addressbook/libedata-book/e-data-book-view.h
+++ b/addressbook/libedata-book/e-data-book-view.h
@@ -53,7 +53,6 @@
 
 G_BEGIN_DECLS
 
-struct _EDataBook;
 struct _EBookBackend;
 
 typedef struct _EDataBookView EDataBookView;
@@ -70,7 +69,7 @@ struct _EDataBookViewClass {
 };
 
 GType          e_data_book_view_get_type       (void) G_GNUC_CONST;
-EDataBookView *        e_data_book_view_new            (struct _EDataBook *book,
+EDataBookView *        e_data_book_view_new            (struct _EBookBackend *backend,
                                                 EBookBackendSExp *sexp,
                                                 GDBusConnection *connection,
                                                 const gchar *object_path,
diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c
index 587a025..c9d66a0 100644
--- a/addressbook/libedata-book/e-data-book.c
+++ b/addressbook/libedata-book/e-data-book.c
@@ -699,7 +699,7 @@ operation_thread (gpointer data,
                        connection = e_data_book_get_connection (op->book);
 
                        view = e_data_book_view_new (
-                               op->book, card_sexp,
+                               op->backend, card_sexp,
                                connection, object_path, &error);
 
                        g_object_unref (card_sexp);


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