[evolution-data-server/openismus-work] Handled the new 'requested_fields' of the getBookView call in libedata-book



commit 2f315940a9d2110627d21b755d854c1af1dbeb2d
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun Jun 12 16:40:55 2011 +0900

    Handled the new 'requested_fields' of the getBookView call in libedata-book
    
    Changes imply:
      o Bookkeeping the 'requested_fields' array in EDataBookView
      o Added the 'requested_fields' parameter to e_data_book_view_new()
      o Added e_data_book_view_get_requested_fields()
      o Pass the 'requested_fields' along from EDataBook when handling
        the getBookView call.

 addressbook/libedata-book/e-data-book-view.c |   31 +++++++++++++++++++++++--
 addressbook/libedata-book/e-data-book-view.h |   16 +++++++------
 addressbook/libedata-book/e-data-book.c      |    9 ++++++-
 addressbook/libedata-book/e-data-book.xml    |    2 +-
 4 files changed, 45 insertions(+), 13 deletions(-)
---
diff --git a/addressbook/libedata-book/e-data-book-view.c b/addressbook/libedata-book/e-data-book-view.c
index 6aa6cd3..dce561c 100644
--- a/addressbook/libedata-book/e-data-book-view.c
+++ b/addressbook/libedata-book/e-data-book-view.c
@@ -45,9 +45,10 @@ struct _EDataBookViewPrivate {
 	EDataBook *book;
 	EBookBackend *backend;
 
-	gchar * card_query;
+	gchar            *card_query;
 	EBookBackendSExp *card_sexp;
-	gint max_results;
+	gchar           **requested_fields;
+	gint              max_results;
 
 	gboolean running;
 	GMutex *pending_mutex;
@@ -476,13 +477,18 @@ e_data_book_view_notify_status_message (EDataBookView *book_view, const gchar *m
  * @book: The #EDataBook to search
  * @card_query: The query as a string
  * @card_sexp: The query as an #EBookBackendSExp
+ * @requested_fields: The vcard fields requested for this view or %NULL for all fields.
  * @max_results: The maximum number of results to return
  *
  * Create a new #EDataBookView for the given #EBook, filtering on #card_sexp,
  * and place it on DBus at the object path #path.
  */
 EDataBookView *
-e_data_book_view_new (EDataBook *book, const gchar *card_query, EBookBackendSExp *card_sexp, gint max_results)
+e_data_book_view_new (EDataBook           *book, 
+		      const gchar         *card_query, 
+		      EBookBackendSExp    *card_sexp, 
+		      const gchar * const *requested_fields,
+		      gint                 max_results)
 {
 	EDataBookView *view;
 	EDataBookViewPrivate *priv;
@@ -497,6 +503,7 @@ e_data_book_view_new (EDataBook *book, const gchar *card_query, EBookBackendSExp
 	priv->card_query = g_strdup (card_query);
 	priv->card_sexp = card_sexp;
 	priv->max_results = max_results;
+	priv->requested_fields = g_strdupv ((gchar **)requested_fields);
 
 	return view;
 }
@@ -637,6 +644,7 @@ e_data_book_view_finalize (GObject *object)
 	g_array_free (priv->removes, TRUE);
 
 	g_free (priv->card_query);
+	g_strfreev (priv->requested_fields);
 
 	g_mutex_free (priv->pending_mutex);
 
@@ -690,6 +698,23 @@ e_data_book_view_get_card_sexp (EDataBookView *book_view)
 }
 
 /**
+ * e_data_book_view_get_requested_fields:
+ * @book_view: an #EDataBookView
+ *
+ * Gets the required fields which should be reported
+ * in #EContacts.
+ *
+ * Returns: A %NULL terminated array of field names which should not be freed or modified.
+ **/
+const gchar **
+e_data_book_view_get_requested_fields (EDataBookView *book_view)
+{
+	g_return_val_if_fail (E_IS_DATA_BOOK_VIEW (book_view), NULL);
+
+	return (const gchar **)book_view->priv->requested_fields;
+}
+
+/**
  * e_data_book_view_get_max_results:
  * @book_view: an #EDataBookView
  *
diff --git a/addressbook/libedata-book/e-data-book-view.h b/addressbook/libedata-book/e-data-book-view.h
index 1f856b9..2e37c0a 100644
--- a/addressbook/libedata-book/e-data-book-view.h
+++ b/addressbook/libedata-book/e-data-book-view.h
@@ -52,10 +52,11 @@ struct _EDataBookViewClass {
 	GObjectClass parent;
 };
 
-EDataBookView *e_data_book_view_new                  (EDataBook        *book,
-						      const gchar      *card_query,
-						      EBookBackendSExp *card_sexp,
-						      gint              max_results);
+EDataBookView *e_data_book_view_new                  (EDataBook           *book,
+						      const gchar         *card_query,
+						      EBookBackendSExp    *card_sexp,
+						      const gchar * const *requested_fields,
+						      gint                 max_results);
 
 guint e_data_book_view_register_gdbus_object (EDataBookView *query, GDBusConnection *connection, const gchar *object_path, GError **error);
 
@@ -63,11 +64,12 @@ void              e_data_book_view_set_thresholds    (EDataBookView *book_view,
 						      gint minimum_grouping_threshold,
 						      gint maximum_grouping_threshold);
 
-const gchar *       e_data_book_view_get_card_query    (EDataBookView                *book_view);
+const gchar *     e_data_book_view_get_card_query    (EDataBookView                *book_view);
 EBookBackendSExp* e_data_book_view_get_card_sexp     (EDataBookView                *book_view);
-gint               e_data_book_view_get_max_results   (EDataBookView                *book_view);
+const gchar ** e_data_book_view_get_requested_fields (EDataBookView                *book_view);
+gint              e_data_book_view_get_max_results   (EDataBookView                *book_view);
 EBookBackend*     e_data_book_view_get_backend       (EDataBookView                *book_view);
-void         e_data_book_view_notify_update          (EDataBookView                *book_view,
+void              e_data_book_view_notify_update     (EDataBookView                *book_view,
 						      EContact                     *contact);
 
 void         e_data_book_view_notify_update_vcard    (EDataBookView                *book_view,
diff --git a/addressbook/libedata-book/e-data-book.c b/addressbook/libedata-book/e-data-book.c
index 9d58510..76086fc 100644
--- a/addressbook/libedata-book/e-data-book.c
+++ b/addressbook/libedata-book/e-data-book.c
@@ -636,7 +636,12 @@ construct_bookview_path (void)
 }
 
 static gboolean
-impl_Book_getBookView (EGdbusBook *object, GDBusMethodInvocation *invocation, const gchar *search, const guint max_results, EDataBook *book)
+impl_Book_getBookView (EGdbusBook            *object, 
+		       GDBusMethodInvocation *invocation, 
+		       const gchar           *search, 
+		       const gchar * const   *requested_fields,
+		       const guint            max_results, 
+		       EDataBook *book)
 {
 	EBookBackend *backend = e_data_book_get_backend (book);
 	EBookBackendSExp *card_sexp;
@@ -654,7 +659,7 @@ impl_Book_getBookView (EGdbusBook *object, GDBusMethodInvocation *invocation, co
 	}
 
 	path = construct_bookview_path ();
-	book_view = e_data_book_view_new (book, search, card_sexp, max_results);
+	book_view = e_data_book_view_new (book, search, card_sexp, requested_fields, max_results);
 	e_data_book_view_register_gdbus_object (book_view, g_dbus_method_invocation_get_connection (invocation), path, &error);
 
 	if (error) {
diff --git a/addressbook/libedata-book/e-data-book.xml b/addressbook/libedata-book/e-data-book.xml
index 4641483..da5ea4d 100644
--- a/addressbook/libedata-book/e-data-book.xml
+++ b/addressbook/libedata-book/e-data-book.xml
@@ -98,7 +98,7 @@
       <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_AddressBook_Book_getBookView"/>
       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
       <arg name="query" type="s" direction="in"/>
-      <!-- <arg name="fields" type="as" direction="in"/> -->
+      <arg name="requested_fields" type="as" direction="in"/>
       <arg name="max_results" type="u" direction="in"/>
       <arg name="view" type="o" direction="out"/>
     </method>



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