diff options
author | Ted Gould <ted@canonical.com> | 2009-08-17 16:29:54 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-08-17 16:29:54 -0500 |
commit | 2c69e50476ce831a8b878c76f3534263926be575 (patch) | |
tree | 1b624208dc2743692fb6b85e7f4c22c9c7409f41 /src | |
parent | a2f9b2b061063f4878573705ddf356b7b5cbd4cb (diff) | |
download | ayatana-indicator-session-2c69e50476ce831a8b878c76f3534263926be575.tar.gz ayatana-indicator-session-2c69e50476ce831a8b878c76f3534263926be575.tar.bz2 ayatana-indicator-session-2c69e50476ce831a8b878c76f3534263926be575.zip |
Now we can set the value in Pidgin and have it come back over the wire
Diffstat (limited to 'src')
-rw-r--r-- | src/status-provider-pidgin.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/status-provider-pidgin.c b/src/status-provider-pidgin.c index 1d09ec8..342cddc 100644 --- a/src/status-provider-pidgin.c +++ b/src/status-provider-pidgin.c @@ -102,13 +102,47 @@ status_provider_pidgin_class_init (StatusProviderPidginClass *klass) } static void -changed_status (DBusGProxy * proxy, gint savedstatus, GError ** error, StatusProviderPidgin * spp) +type_cb (DBusGProxy * proxy, DBusGProxyCall * call, gpointer userdata) +{ + GError * error = NULL; + gint status = 0; + if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_INT, &status, G_TYPE_INVALID)) { + g_warning("Unable to get type from Pidgin: %s", error->message); + g_error_free(error); + return; + } + + StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(userdata); + if (status != priv->pg_status) { + priv->pg_status = status; + + g_signal_emit(G_OBJECT(userdata), STATUS_PROVIDER_SIGNAL_STATUS_CHANGED_ID, 0, pg_to_sp_map[priv->pg_status], TRUE); + } + + return; +} + +static void +saved_status_to_type (StatusProviderPidgin * spp, gint savedstatus) { + StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(spp); + + g_debug("Pidgin figuring out type for %d", savedstatus); + dbus_g_proxy_begin_call(priv->proxy, + "PurpleSavedstatusGetType", type_cb, spp, NULL, + G_TYPE_INT, savedstatus, G_TYPE_INVALID); return; } static void +changed_status (DBusGProxy * proxy, gint savedstatus, GError ** error, StatusProviderPidgin * spp) +{ + saved_status_to_type(spp, savedstatus); + return; +} + +static void proxy_destroy (DBusGProxy * proxy, StatusProviderPidgin * spp) { StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(spp); |