[evolution-data-server/treitter-client-gdbus-watch-proxy] attempting to watch the proxy -- NEEDS WORK
- From: Travis Reitter <treitter src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-data-server/treitter-client-gdbus-watch-proxy] attempting to watch the proxy -- NEEDS WORK
- Date: Wed, 25 Nov 2009 19:43:25 +0000 (UTC)
commit 35767d695809f403cee233077038b49225ba055e
Author: Travis Reitter <treitter gmail com>
Date: Wed Nov 25 11:02:38 2009 -0800
attempting to watch the proxy -- NEEDS WORK
addressbook/libebook/e-book.c | 80 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 80 insertions(+), 0 deletions(-)
---
diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c
index 8fe617b..80d8858 100644
--- a/addressbook/libebook/e-book.c
+++ b/addressbook/libebook/e-book.c
@@ -72,6 +72,7 @@ static DBusGConnection *connection = NULL;
static DBusGProxy *factory_proxy = NULL;
static GDBusConnection *connection_gdbus = NULL;
static GDBusProxy *factory_proxy_gdbus = NULL;
+guint watcher_id;
/* guards both connection and factory_proxy */
static GStaticRecMutex connection_lock = G_STATIC_REC_MUTEX_INIT;
@@ -116,6 +117,66 @@ proxy_destroyed (gpointer data, GObject *object)
g_signal_emit (G_OBJECT (book), e_book_signals [BACKEND_DIED], 0);
}
+/* FIXME: cut this */
+static void
+print_properties (GDBusProxy *proxy)
+{
+ gchar **property_names;
+ guint n;
+
+ g_print (" properties:\n");
+
+ property_names = g_dbus_proxy_get_cached_property_names (proxy, NULL);
+ for (n = 0; property_names != NULL && property_names[n] != NULL; n++)
+ {
+ const gchar *key = property_names[n];
+ GVariant *value;
+ gchar *value_str;
+ value = g_dbus_proxy_get_cached_property (proxy, key, NULL);
+ value_str = g_variant_print (value, TRUE);
+ g_print (" %s -> %s\n", key, value_str);
+ g_variant_unref (value);
+ g_free (value_str);
+ }
+ g_strfreev (property_names);
+}
+
+
+static void
+gdbus_proxy_appeared_cb (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ GDBusProxy *proxy,
+ gpointer user_data)
+{
+ /* FIXME: cut this */
+ g_print ("+++ Acquired proxy object for remote object owned by %s; connection: %p, proxy: %p\n",
+ name_owner, connection, proxy);
+
+ print_properties (proxy);
+
+ /* FIXME: uncomment this
+ g_signal_connect (proxy,
+ "g-properties-changed",
+ G_CALLBACK (on_properties_changed),
+ NULL);
+
+ g_signal_connect (proxy,
+ "g-signal",
+ G_CALLBACK (on_signal),
+ NULL);
+ */
+}
+
+static void
+gdbus_proxy_vanished_cb (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data)
+{
+ /* FIXME: cut this */
+ g_print ("--- Cannot create proxy object for the factory or factory proxy destroyed\n");
+}
+
static void
e_book_dispose (GObject *object)
{
@@ -231,6 +292,21 @@ e_book_activate(GError **error)
return TRUE;
}
+ watcher_id = g_bus_watch_proxy (G_BUS_TYPE_SESSION,
+ E_DATA_BOOK_FACTORY_SERVICE_NAME,
+ "/org/gnome/evolution/dataserver/addressbook/BookFactory",
+ "org.gnome.evolution.dataserver.addressbook.BookFactory",
+ G_TYPE_DBUS_PROXY,
+ G_DBUS_PROXY_FLAGS_NONE,
+ gdbus_proxy_appeared_cb,
+ gdbus_proxy_vanished_cb,
+ NULL,
+ NULL);
+
+ /* FIXME: uncomment and relocate this
+ g_bus_unwatch_proxy (watcher_id);
+ */
+
if (!connection) {
connection = dbus_g_bus_get (DBUS_BUS_SESSION, error);
if (!connection) {
@@ -2217,6 +2293,10 @@ e_book_new (ESource *source, GError **error)
xml = e_source_to_standalone_xml (source);
LOCK_CONN ();
+
+ /* FIXME: cut this */
+ g_debug ("factory_proxy_gdbus: %p", factory_proxy_gdbus);
+
if (!e_data_book_factory_gdbus_get_book (factory_proxy_gdbus, xml, &path, &err)) {
UNLOCK_CONN ();
g_free (xml);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]