[evolution-data-server/treitter-client-gdbus] Port EDataCalView to GDBus.



commit fc2a12da0e3d109a74643775ef4b9f0f8f6ba4d7
Author: Travis Reitter <treitter gmail com>
Date:   Wed Dec 23 12:03:45 2009 -0800

    Port EDataCalView to GDBus.

 calendar/libecal/Makefile.am                      |    9 +-
 calendar/libecal/e-cal-view-private.h             |    4 +-
 calendar/libecal/e-cal-view.c                     |  129 ++++++++------
 calendar/libecal/e-cal.c                          |  193 +++++++++++----------
 calendar/libecal/e-data-cal-view-gdbus-bindings.h |   45 +++++
 5 files changed, 224 insertions(+), 156 deletions(-)
---
diff --git a/calendar/libecal/Makefile.am b/calendar/libecal/Makefile.am
index 5564ab4..cd4cab0 100644
--- a/calendar/libecal/Makefile.am
+++ b/calendar/libecal/Makefile.am
@@ -18,9 +18,9 @@ libecal_1_2_la_CPPFLAGS = \
 
 libecal_1_2_la_SOURCES =	             \
 	$(MARSHAL_GENERATED)	             \
-	$(DBUS_GENERATED_H)	             \
 	e-data-cal-factory-gdbus-bindings.h  \
 	e-data-cal-gdbus-bindings.h          \
+	e-data-cal-view-gdbus-bindings.h     \
 	e-cal.c			             \
 	e-cal-component.c	             \
 	e-cal-recur.c		             \
@@ -60,12 +60,7 @@ libecalinclude_HEADERS =	\
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libecal-$(API_VERSION).pc
 
-DBUS_GENERATED_H = e-data-cal-view-bindings.h
-
-%-bindings.h: $(top_srcdir)/calendar/libedata-cal/%.xml
-	dbus-binding-tool --mode=glib-client --output=$@ --prefix=$(subst -,_,$*) $^
-
-BUILT_SOURCES = $(DBUS_GENERATED_H) $(MARSHAL_GENERATED)
+BUILT_SOURCES = $(MARSHAL_GENERATED)
 CLEANFILES = $(BUILT_SOURCES)
 DISTCLEANFILES = $(pkgconfig_DATA)
 
diff --git a/calendar/libecal/e-cal-view-private.h b/calendar/libecal/e-cal-view-private.h
index e542702..5b2ff39 100644
--- a/calendar/libecal/e-cal-view-private.h
+++ b/calendar/libecal/e-cal-view-private.h
@@ -24,11 +24,11 @@
 #include <libecal/e-cal-types.h>
 #include <libecal/e-cal-view.h>
 
-#include <dbus/dbus-glib.h>
+#include <gdbus/gdbus.h>
 
 G_BEGIN_DECLS
 
-ECalView *_e_cal_view_new (struct _ECal *client, DBusGProxy *view_proxy, GStaticRecMutex *connection_lock);
+ECalView *_e_cal_view_new (struct _ECal *client, GDBusProxy *view_proxy, GStaticRecMutex *connection_lock);
 
 G_END_DECLS
 
diff --git a/calendar/libecal/e-cal-view.c b/calendar/libecal/e-cal-view.c
index b17e51a..a80340c 100644
--- a/calendar/libecal/e-cal-view.c
+++ b/calendar/libecal/e-cal-view.c
@@ -26,11 +26,13 @@
 #endif
 
 #include <string.h>
+
+#include <glib-object.h>
 #include "e-cal-marshal.h"
 #include "e-cal.h"
 #include "e-cal-view.h"
 #include "e-cal-view-private.h"
-#include "e-data-cal-view-bindings.h"
+#include "e-data-cal-view-gdbus-bindings.h"
 
 G_DEFINE_TYPE(ECalView, e_cal_view, G_TYPE_OBJECT);
 #define E_CAL_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), E_TYPE_CAL_VIEW, ECalViewPrivate))
@@ -40,7 +42,7 @@ G_DEFINE_TYPE(ECalView, e_cal_view, G_TYPE_OBJECT);
 
 /* Private part of the ECalView structure */
 struct _ECalViewPrivate {
-	DBusGProxy *view_proxy;
+	GDBusProxy *view_proxy;
 	GStaticRecMutex *view_proxy_lock;
 	ECal *client;
 };
@@ -105,88 +107,122 @@ build_id_list (const gchar **seq)
 }
 
 static void
-objects_added_cb (DBusGProxy *proxy, const gchar **objects, gpointer data)
+cal_view_handle_signal_objects_added (ECalView    *view,
+				      const char **objects)
 {
-	ECalView *view;
-        GList *list;
+	GList *list;
 
-	view = E_CAL_VIEW (data);
 	g_object_ref (view);
 
 	list = build_object_list (objects);
 
 	g_signal_emit (G_OBJECT (view), signals[OBJECTS_ADDED], 0, list);
 
-        while (list) {
-          icalcomponent_free (list->data);
-          list = g_list_delete_link (list, list);
-        }
+	while (list) {
+		icalcomponent_free (list->data);
+		list = g_list_delete_link (list, list);
+	}
 
 	g_object_unref (view);
 }
 
 static void
-objects_modified_cb (DBusGProxy *proxy, const gchar **objects, gpointer data)
+cal_view_handle_signal_objects_modified (ECalView    *view,
+					 const char **objects)
 {
-	ECalView *view;
-        GList *list;
+	GList *list;
 
-	view = E_CAL_VIEW (data);
 	g_object_ref (view);
 
 	list = build_object_list (objects);
 
 	g_signal_emit (G_OBJECT (view), signals[OBJECTS_MODIFIED], 0, list);
 
-        while (list) {
-          icalcomponent_free (list->data);
-          list = g_list_delete_link (list, list);
-        }
+	while (list) {
+		icalcomponent_free (list->data);
+		list = g_list_delete_link (list, list);
+	}
 
 	g_object_unref (view);
 }
 
 static void
-objects_removed_cb (DBusGProxy *proxy, const gchar **uids, gpointer data)
+cal_view_handle_signal_objects_removed (ECalView    *view,
+					const char **uids)
 {
-	ECalView *view;
-        GList *list;
+	GList *list;
 
-	view = E_CAL_VIEW (data);
 	g_object_ref (view);
 
 	list = build_id_list (uids);
 
 	g_signal_emit (G_OBJECT (view), signals[OBJECTS_REMOVED], 0, list);
 
-        while (list) {
+	while (list) {
 		e_cal_component_free_id (list->data);
 		list = g_list_delete_link (list, list);
-        }
+	}
 
 	g_object_unref (view);
 }
 
 static void
-progress_cb (DBusGProxy *proxy, const gchar *message, gint percent, gpointer data)
+cal_view_handle_signal_progress (ECalView   *view,
+				 const char *message,
+				 gint        percent)
 {
-	ECalView *view;
-
-	view = E_CAL_VIEW (data);
-
 	g_signal_emit (G_OBJECT (view), signals[VIEW_PROGRESS], 0, message, percent);
 }
 
 static void
-done_cb (DBusGProxy *proxy, ECalendarStatus status, gpointer data)
+cal_view_handle_signal_done (ECalView        *view,
+			     ECalendarStatus  status)
 {
-	ECalView *view;
-
-	view = E_CAL_VIEW (data);
-
 	g_signal_emit (G_OBJECT (view), signals[VIEW_DONE], 0, status);
 }
 
+static void
+cal_view_proxy_signal_cb (GDBusProxy *proxy,
+			  gchar      *sender_name,
+			  gchar      *signal_name,
+			  GVariant   *parameters,
+			  ECalView   *view)
+{
+        if (FALSE) {
+        } else if (!g_strcmp0 (signal_name, "ObjectsAdded")) {
+                const char **value;
+
+                g_variant_get (parameters, "(^a&s)", &value, NULL);
+
+                cal_view_handle_signal_objects_added (view, value);
+                g_free (value);
+        } else if (!g_strcmp0 (signal_name, "ObjectsModified")) {
+                const char **value;
+                g_variant_get (parameters, "(^a&s)", &value, NULL);
+
+                cal_view_handle_signal_objects_modified (view, value);
+                g_free (value);
+        } else if (!g_strcmp0 (signal_name, "ObjectsRemoved")) {
+                const char **value;
+                g_variant_get (parameters, "(^a&s)", &value, NULL);
+
+                cal_view_handle_signal_objects_removed (view, value);
+                g_free (value);
+        } else if (!g_strcmp0 (signal_name, "Progress")) {
+                const char *value_string;
+                const gint value_int;
+
+                g_variant_get (parameters, "(&su)", &value_string, &value_int);
+
+                cal_view_handle_signal_progress (view, value_string, value_int);
+        } else if (!g_strcmp0 (signal_name, "Done")) {
+                const guint value;
+                g_variant_get (parameters, "(u)", &value);
+
+                cal_view_handle_signal_done (view, value);
+        }
+}
+
 /* Object initialization function for the calendar view */
 static void
 e_cal_view_init (ECalView *view)
@@ -209,22 +245,7 @@ e_cal_view_set_property (GObject *object, guint property_id, const GValue *value
 			g_object_unref (priv->view_proxy);
 
 		priv->view_proxy = g_object_ref (g_value_get_pointer (value));
-
-                dbus_g_proxy_add_signal (priv->view_proxy, "ObjectsAdded", G_TYPE_STRV, G_TYPE_INVALID);
-                dbus_g_proxy_connect_signal (priv->view_proxy, "ObjectsAdded", G_CALLBACK (objects_added_cb), view, NULL);
-
-                dbus_g_proxy_add_signal (priv->view_proxy, "ObjectsModified", G_TYPE_STRV, G_TYPE_INVALID);
-                dbus_g_proxy_connect_signal (priv->view_proxy, "ObjectsModified", G_CALLBACK (objects_modified_cb), view, NULL);
-
-                dbus_g_proxy_add_signal (priv->view_proxy, "ObjectsRemoved", G_TYPE_STRV, G_TYPE_INVALID);
-                dbus_g_proxy_connect_signal (priv->view_proxy, "ObjectsRemoved", G_CALLBACK (objects_removed_cb), view, NULL);
-
-                dbus_g_object_register_marshaller (e_cal_marshal_VOID__STRING_UINT, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
-                dbus_g_proxy_add_signal (priv->view_proxy, "Progress", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
-                dbus_g_proxy_connect_signal (priv->view_proxy, "Progress", G_CALLBACK (progress_cb), view, NULL);
-
-                dbus_g_proxy_add_signal (priv->view_proxy, "Done", G_TYPE_UINT, G_TYPE_INVALID);
-                dbus_g_proxy_connect_signal (priv->view_proxy, "Done", G_CALLBACK (done_cb), view, NULL);
+		g_signal_connect (priv->view_proxy, "g-signal", G_CALLBACK (cal_view_proxy_signal_cb), view);
 
 		break;
 	case PROP_VIEW_LOCK:
@@ -358,7 +379,7 @@ e_cal_view_class_init (ECalViewClass *klass)
 
 /**
  * _e_cal_view_new:
- * @corba_view: The CORBA object for the view.
+ * @view_proxy: The @GDBusProxy for the view.
  * @client: An #ECal object.
  *
  * Creates a new view object by issuing the view creation request to the
@@ -367,7 +388,7 @@ e_cal_view_class_init (ECalViewClass *klass)
  * Return value: A newly-created view object, or NULL if the request failed.
  **/
 ECalView *
-_e_cal_view_new (ECal *client, DBusGProxy *view_proxy, GStaticRecMutex *connection_lock)
+_e_cal_view_new (ECal *client, GDBusProxy *view_proxy, GStaticRecMutex *connection_lock)
 {
 	ECalView *view;
 
@@ -413,8 +434,10 @@ e_cal_view_start (ECalView *view)
 
 	priv = E_CAL_VIEW_GET_PRIVATE(view);
 
+	g_return_if_fail (G_IS_DBUS_PROXY (priv->view_proxy));
+
 	LOCK_VIEW ();
-	if (!org_gnome_evolution_dataserver_calendar_CalView_start (priv->view_proxy, &error)) {
+	if (!e_data_cal_view_gdbus_start_sync (priv->view_proxy, &error)) {
 		UNLOCK_VIEW ();
 		g_printerr("%s: %s\n", __FUNCTION__, error->message);
 		g_error_free (error);
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index 630e37a..b8d45ab 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -48,8 +48,6 @@
 #include "e-data-cal-gdbus-bindings.h"
 #include <libedata-cal/e-data-cal-types.h>
 
-static DBusGConnection *connection = NULL;
-static DBusGProxy *factory_proxy = NULL;
 static GDBusConnection *connection_gdbus = NULL;
 static GDBusProxy *factory_proxy_gdbus = NULL;
 
@@ -89,7 +87,6 @@ struct _ECalPrivate {
 
 	gboolean read_only;
 
-	DBusGProxy *proxy;
 	GDBusProxy *gdbus_proxy;
 
 	/* The authentication function */
@@ -380,7 +377,6 @@ e_cal_init (ECal *ecal)
 	priv->alarm_email_address = NULL;
 	priv->ldap_attribute = NULL;
 	priv->capabilities = NULL;
-	priv->proxy = NULL;
 	priv->gdbus_proxy = NULL;
 	priv->timezones = g_hash_table_new (g_str_hash, g_str_equal);
 	priv->default_zone = icaltimezone_get_utc_timezone ();
@@ -403,8 +399,6 @@ proxy_destroyed (gpointer data, GObject *object)
 
         /* Ensure that everything relevant is reset */
         LOCK_CONN ();
-        factory_proxy = NULL;
-        priv->proxy = NULL;
 	priv->gdbus_proxy = NULL;
 	priv->load_state = E_CAL_LOAD_NOT_LOADED;
         UNLOCK_CONN ();
@@ -422,19 +416,6 @@ e_cal_dispose (GObject *object)
 	ecal = E_CAL (object);
 	priv = ecal->priv;
 
-	if (priv->proxy) {
-		GError *error = NULL;
-
-		LOCK_CONN ();
-		g_object_unref (priv->proxy);
-		priv->proxy = NULL;
-		UNLOCK_CONN ();
-
-		if (error) {
-			g_warning ("%s: Failed to close calendar, %s\n", G_STRFUNC, error->message);
-			g_error_free (error);
-		}
-	}
 	if (priv->gdbus_proxy) {
 		g_object_weak_unref (G_OBJECT (priv->gdbus_proxy), proxy_destroyed, ecal);
 
@@ -566,25 +547,23 @@ e_cal_class_init (ECalClass *klass)
 	g_type_class_add_private (klass, sizeof (ECalPrivate));
 }
 
-/* one-time start up for libecal */
-static gboolean
-e_cal_activate(GError **error)
+/* FIXME: this is a hack until we can figure out how to do this purely in gdbus
+ *  */
+static char*
+get_factory_dbus_proxy_owner_name ()
 {
+        DBusGConnection *connection = NULL;
+        DBusGProxy *factory_proxy = NULL;
+        GError *error = NULL;
 	DBusError derror;
-	const gchar *factory_proxy_name;
+	char *name;
 
 	LOCK_CONN ();
-	if (G_LIKELY (factory_proxy && factory_proxy_gdbus)) {
-		UNLOCK_CONN ();
-		return TRUE;
-	}
 
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
 	if (!connection) {
-		connection = dbus_g_bus_get (DBUS_BUS_SESSION, error);
-		if (!connection) {
-			UNLOCK_CONN ();
-			return FALSE;
-		}
+		UNLOCK_CONN ();
+		return FALSE;
 	}
 
 	dbus_error_init (&derror);
@@ -592,25 +571,46 @@ e_cal_activate(GError **error)
 													"org.gnome.evolution.dataserver.Calendar",
 													0, NULL, &derror))
 	{
-		dbus_set_g_error (error, &derror);
+		dbus_set_g_error (&error, &derror);
 		dbus_error_free (&derror);
-		UNLOCK_CONN ();
-		return FALSE;
+
+                g_warning (G_STRLOC ": FAILED to start "
+				"org.gnome.evolution.dataserver.Calendar");
+
+                goto get_factory_dbus_proxy_owner_name_OUT;
 	}
 
+	factory_proxy = dbus_g_proxy_new_for_name_owner (connection,
+						"org.gnome.evolution.dataserver.Calendar",
+						"/org/gnome/evolution/dataserver/calendar/CalFactory",
+						"org.gnome.evolution.dataserver.calendar.CalFactory",
+						&error);
 	if (!factory_proxy) {
-		factory_proxy = dbus_g_proxy_new_for_name_owner (connection,
-							"org.gnome.evolution.dataserver.Calendar",
-							"/org/gnome/evolution/dataserver/calendar/CalFactory",
-							"org.gnome.evolution.dataserver.calendar.CalFactory",
-							error);
-		if (!factory_proxy) {
-			UNLOCK_CONN ();
-			return FALSE;
-		}
+		g_warning (G_STRLOC ": failed to get ECal Factory D-Bus proxy: %s",
+                                error->message);
+                goto get_factory_dbus_proxy_owner_name_OUT;
 	}
 
-	factory_proxy_name = dbus_g_proxy_get_bus_name (factory_proxy);
+	name = g_strdup (dbus_g_proxy_get_bus_name (factory_proxy));
+
+get_factory_dbus_proxy_owner_name_OUT:
+        if (factory_proxy)
+                g_object_unref (factory_proxy);
+        if (connection)
+                dbus_g_connection_unref (connection);
+
+	UNLOCK_CONN ();
+
+	return name;
+}
+
+/* one-time start up for libecal */
+static gboolean
+e_cal_activate(GError **error)
+{
+	char *factory_proxy_name;
+
+	factory_proxy_name = get_factory_dbus_proxy_owner_name ();
 
 	/* FIXME: better to just watch for the proxy instead of using the
 	 * connection directly? */
@@ -650,6 +650,8 @@ e_cal_activate(GError **error)
 
 	UNLOCK_CONN ();
 
+	g_free (factory_proxy_name);
+
 	return TRUE;
 }
 
@@ -663,15 +665,16 @@ reopen_with_auth (gpointer data)
 }
 
 static void
-auth_required_cb (DBusGProxy *proxy, ECal *cal)
+cal_handle_signal_auth_required (ECal *cal)
 {
 	g_return_if_fail (E_IS_CAL (cal));
 
-	g_idle_add (reopen_with_auth, (gpointer)cal);
+	g_idle_add (reopen_with_auth, (gpointer) cal);
 }
 
 static void
-mode_cb (DBusGProxy *proxy, EDataCalMode mode, ECal *cal)
+cal_handle_signal_mode (ECal         *cal,
+			EDataCalMode  mode)
 {
 	g_return_if_fail (E_IS_CAL (cal));
 	g_return_if_fail (mode & AnyMode);
@@ -681,7 +684,8 @@ mode_cb (DBusGProxy *proxy, EDataCalMode mode, ECal *cal)
 }
 
 static void
-readonly_cb (DBusGProxy *proxy, gboolean read_only, ECal *cal)
+cal_handle_signal_readonly (ECal     *cal,
+			    gboolean  read_only)
 {
 	ECalPrivate *priv;
 
@@ -691,18 +695,6 @@ readonly_cb (DBusGProxy *proxy, gboolean read_only, ECal *cal)
 	priv->read_only = read_only;
 }
 
-/*
-static void
-backend_died_cb (EComponentListener *cl, gpointer user_data)
-{
-	ECalPrivate *priv;
-	ECal *ecal = (ECal *) user_data;
-
-	priv = ecal->priv;
-	priv->load_state = E_CAL_LOAD_NOT_LOADED;
-	g_signal_emit (G_OBJECT (ecal), e_cal_signals[BACKEND_DIED], 0);
-}*/
-
 typedef struct
 {
 	ECal *ecal;
@@ -723,22 +715,50 @@ backend_error_idle_cb (gpointer data)
 	return FALSE;
 }
 
-/* Handle the error_occurred signal from the listener */
 static void
-backend_error_cb (DBusGProxy *proxy, const gchar *message, ECal *ecal)
+cal_handle_signal_backend_error (ECal        *cal,
+				 const gchar *message)
 {
 	ECalErrorData *error_data;
 
-	g_return_if_fail (E_IS_CAL (ecal));
+	g_return_if_fail (E_IS_CAL (cal));
 
 	error_data = g_new0 (ECalErrorData, 1);
 
-	error_data->ecal = g_object_ref (ecal);
+	error_data->ecal = g_object_ref (cal);
 	error_data->message = g_strdup (message);
 
 	g_idle_add (backend_error_idle_cb, error_data);
 }
 
+static void
+cal_proxy_signal_cb (GDBusProxy *proxy,
+		     gchar      *sender_name,
+                     gchar      *signal_name,
+                     GVariant   *parameters,
+                     ECal       *cal)
+{
+        if (FALSE) {
+        } else if (!g_strcmp0 (signal_name, "auth_required")) {
+                cal_handle_signal_auth_required (cal);
+        } else if (!g_strcmp0 (signal_name, "backend_error")) {
+		const char *value;
+		g_variant_get (parameters, "(&s)", &value);
+
+                cal_handle_signal_backend_error (cal, value);
+        } else if (!g_strcmp0 (signal_name, "readonly")) {
+		gboolean value;
+		g_variant_get (parameters, "(b)", &value);
+
+                cal_handle_signal_readonly (cal, value);
+        } else if (!g_strcmp0 (signal_name, "mode")) {
+		gint32 value;
+		g_variant_get (parameters, "(i)", &value);
+
+                cal_handle_signal_mode (cal, value);
+        }
+}
+
 /* TODO - For now, the policy of where each backend serializes its
  * attachment data is hardcoded below. Should this end up as a
  * gconf key set during the account creation  and fetched
@@ -867,11 +887,6 @@ e_cal_new (ESource *source, ECalSourceType type)
 	}
 	g_free (xml);
 
-	priv->proxy = dbus_g_proxy_new_for_name_owner (connection,
-									"org.gnome.evolution.dataserver.Calendar", path,
-									"org.gnome.evolution.dataserver.calendar.Cal",
-									&error);
-
 	priv->gdbus_proxy = g_dbus_proxy_new_sync (connection_gdbus,
 						   G_TYPE_DBUS_PROXY,
 						   G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
@@ -883,13 +898,6 @@ e_cal_new (ESource *source, ECalSourceType type)
 
 	UNLOCK_CONN ();
 
-	if (!priv->proxy) {
-		g_warning (G_STRLOC ": cannot get dbus-glib proxy for calendar %s: %s", path, error->message);
-		g_free (path);
-		g_object_unref (ecal);
-		return NULL;
-	}
-
 	if (!priv->gdbus_proxy) {
 		g_warning (G_STRLOC ": cannot get gdbus proxy for calendar %s: %s", path, error->message);
 		g_free (path);
@@ -900,14 +908,7 @@ e_cal_new (ESource *source, ECalSourceType type)
 
 	g_object_weak_ref (G_OBJECT (priv->gdbus_proxy), proxy_destroyed, ecal);
 
-	dbus_g_proxy_add_signal (priv->proxy, "auth_required", G_TYPE_INVALID);
-	dbus_g_proxy_connect_signal (priv->proxy, "auth_required", G_CALLBACK (auth_required_cb), ecal, NULL);
-	dbus_g_proxy_add_signal (priv->proxy, "backend_error", G_TYPE_STRING, G_TYPE_INVALID);
-	dbus_g_proxy_connect_signal (priv->proxy, "backend_error", G_CALLBACK (backend_error_cb), ecal, NULL);
-	dbus_g_proxy_add_signal (priv->proxy, "readonly", G_TYPE_BOOLEAN, G_TYPE_INVALID);
-	dbus_g_proxy_connect_signal (priv->proxy, "readonly", G_CALLBACK (readonly_cb), ecal, NULL);
-	dbus_g_proxy_add_signal (priv->proxy, "mode", G_TYPE_INT, G_TYPE_INVALID);
-	dbus_g_proxy_connect_signal (priv->proxy, "mode", G_CALLBACK (mode_cb), ecal, NULL);
+	g_signal_connect (priv->gdbus_proxy, "g-signal", G_CALLBACK (cal_proxy_signal_cb), ecal);
 
 	/* Set the local attachment store path for the calendar */
 	set_local_attachment_store (ecal);
@@ -1702,7 +1703,7 @@ load_static_capabilities (ECal *ecal, GError **error)
 	ECalPrivate *priv;
 
 	priv = ecal->priv;
-	e_return_error_if_fail (priv->proxy, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
+	e_return_error_if_fail (priv->gdbus_proxy, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
 
 	if (priv->capabilities)
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_OK, error);
@@ -3844,7 +3845,7 @@ e_cal_get_query (ECal *ecal, const gchar *sexp, ECalView **query, GError **error
 	ECalPrivate *priv;
 	ECalendarStatus status;
 	gchar *query_path;
-	DBusGProxy *query_proxy;
+	GDBusProxy *query_proxy_gdbus;
 
 	e_return_error_if_fail (sexp, E_CALENDAR_STATUS_INVALID_ARG);
 	e_return_error_if_fail (query, E_CALENDAR_STATUS_INVALID_ARG);
@@ -3867,20 +3868,24 @@ e_cal_get_query (ECal *ecal, const gchar *sexp, ECalView **query, GError **error
 	status = E_CALENDAR_STATUS_OK;
 
 	LOCK_CONN ();
-	query_proxy = dbus_g_proxy_new_for_name_owner (connection,
-                                                "org.gnome.evolution.dataserver.Calendar", query_path,
-                                                "org.gnome.evolution.dataserver.calendar.CalView", error);
+	query_proxy_gdbus = g_dbus_proxy_new_sync (connection_gdbus,
+							G_TYPE_DBUS_PROXY,
+							G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+							g_dbus_proxy_get_unique_bus_name (factory_proxy_gdbus),
+							query_path,
+							"org.gnome.evolution.dataserver.calendar.CalView",
+							NULL,
+							error);
 	UNLOCK_CONN ();
 
-	if (!query_proxy) {
+	if (!query_proxy_gdbus) {
 		*query = NULL;
 		status = E_CALENDAR_STATUS_OTHER_ERROR;
 	} else {
-		*query = _e_cal_view_new (ecal, query_proxy, &connection_lock);
+		*query = _e_cal_view_new (ecal, query_proxy_gdbus, &connection_lock);
+		g_object_unref (query_proxy_gdbus);
 	}
 
-	g_object_unref (query_proxy);
-
 	E_CALENDAR_CHECK_STATUS (status, error);
 }
 
diff --git a/calendar/libecal/e-data-cal-view-gdbus-bindings.h b/calendar/libecal/e-data-cal-view-gdbus-bindings.h
new file mode 100644
index 0000000..37d415f
--- /dev/null
+++ b/calendar/libecal/e-data-cal-view-gdbus-bindings.h
@@ -0,0 +1,45 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2009 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU Lesser General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Author: Travis Reitter (travis reitter collabora co uk)
+ */
+
+#include <glib.h>
+#include <gdbus/gdbus.h>
+
+#include <libedata-gdbus-bindings/e-data-gdbus-bindings-common.h>
+
+G_BEGIN_DECLS
+
+/* FIXME: These bindings were created manually; replace with generated bindings
+ * when possible */
+
+static gboolean
+e_data_cal_view_gdbus_start_sync (GDBusProxy  *proxy,
+				  GError     **error)
+{
+	GVariant *parameters;
+	GVariant *retvals;
+
+	parameters = g_variant_new ("()");
+	retvals = g_dbus_proxy_invoke_method_sync (proxy, "start", parameters, -1, NULL, error);
+
+	return demarshal_retvals__VOID (retvals);
+}
+
+G_END_DECLS



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