diff options
author | Ted Gould <ted@gould.cx> | 2009-12-18 21:12:20 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2009-12-18 21:12:20 -0600 |
commit | 9e9c366430db392d005442cc503e7cd990ca51c5 (patch) | |
tree | a836fb580e5d1111439038bbbe5343acaf7ff1bc /src | |
parent | 5be8ede939efb973da4aa7b864fad188803aa650 (diff) | |
parent | d96e16ad7ffdea4807f942ac4b452a6dc607a1fa (diff) | |
download | ayatana-indicator-session-9e9c366430db392d005442cc503e7cd990ca51c5.tar.gz ayatana-indicator-session-9e9c366430db392d005442cc503e7cd990ca51c5.tar.bz2 ayatana-indicator-session-9e9c366430db392d005442cc503e7cd990ca51c5.zip |
Merging in the ubuntu-desktop branch.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/status-provider-mc5.c | 37 |
2 files changed, 29 insertions, 12 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index fefcd37..6a5fc44 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -154,7 +154,9 @@ EXTRA_DIST = \ status-service.xml \ status-provider-mc5.list \ status-provider-pidgin.list \ - status-provider-telepathy.list + status-provider-telepathy.list \ + users-service.xml \ + users-service.list CLEANFILES = \ $(BUILT_SOURCES) diff --git a/src/status-provider-mc5.c b/src/status-provider-mc5.c index 6154fb7..d65a482 100644 --- a/src/status-provider-mc5.c +++ b/src/status-provider-mc5.c @@ -24,7 +24,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "config.h" #endif -#include "libempathy/empathy-account-manager.h" +#include <telepathy-glib/account-manager.h> #include "status-provider.h" #include "status-provider-mc5.h" @@ -65,7 +65,7 @@ static StatusProviderStatus tp_to_sp_map[TP_CONNECTION_PRESENCE_TYPE_ERROR + 1] typedef struct _StatusProviderMC5Private StatusProviderMC5Private; struct _StatusProviderMC5Private { - EmpathyAccountManager * manager; + TpAccountManager * manager; StatusProviderStatus status; DBusGProxy * dbus_proxy; }; @@ -83,7 +83,7 @@ static void status_provider_mc5_finalize (GObject *object); /* Internal Funcs */ static void set_status (StatusProvider * sp, StatusProviderStatus status); static StatusProviderStatus get_status (StatusProvider * sp); -static void presence_changed (EmpathyAccountManager * eam, guint type, const gchar * type_str, const gchar * message, StatusProviderMC5 * sp); +static void presence_changed (TpAccountManager * eam, guint type, const gchar * type_str, const gchar * message, StatusProviderMC5 * sp); static void dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, StatusProviderMC5 * self); static void mc5_exists_cb (DBusGProxy * proxy, gboolean exists, GError * error, gpointer userdata); @@ -109,25 +109,41 @@ status_provider_mc5_class_init (StatusProviderMC5Class *klass) return; } -/* Build our empathy account manager instance if we don't +/* Build our telepathy account manager instance if we don't have one. */ static void build_eam (StatusProviderMC5 * self) { StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(self); + static TpDBusDaemon *daemon = NULL; + GError *error = NULL; if (priv->manager != NULL) { return; } + /* the daemon is used to communicate via DBus */ + daemon = tp_dbus_daemon_dup(&error); - priv->manager = EMPATHY_ACCOUNT_MANAGER(g_object_new(EMPATHY_TYPE_ACCOUNT_MANAGER, NULL)); - g_signal_connect(G_OBJECT(priv->manager), "global-presence-changed", G_CALLBACK(presence_changed), self); + if (daemon == NULL) + { + g_debug("Cannot create DBus daemon: %s\n", error->message); + g_error_free(error); + return; + } + + priv->manager = TP_ACCOUNT_MANAGER (g_object_new (TP_TYPE_ACCOUNT_MANAGER, + "dbus-daemon", daemon, + "dbus-connection", ((TpProxy *) daemon)->dbus_connection, + "bus-name", "org.freedesktop.Telepathy.MissionControl5", + "object-path", "/org/freedesktop/Telepathy/AccountManager", + NULL)); + g_signal_connect(G_OBJECT(priv->manager), "most-available-presence-changed", G_CALLBACK(presence_changed), self); return; } /* Creating an instance of the status provider. We set the variables - and create an EmpathyAccountManager object. It does all the hard + and create an TpAccountManager object. It does all the hard work in this module of tracking MissionControl and enumerating the accounts and all that jazz. */ static void @@ -266,8 +282,7 @@ set_status (StatusProvider * sp, StatusProviderStatus status) StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(sp); build_eam(STATUS_PROVIDER_MC5(sp)); - - empathy_account_manager_request_global_presence(priv->manager, sp_to_tp_map[status], sp_to_mc_map[status], ""); + tp_account_manager_set_all_requested_presences(priv->manager, sp_to_tp_map[status], sp_to_mc_map[status], ""); return; } @@ -287,11 +302,11 @@ get_status (StatusProvider * sp) return priv->status; } -/* A signal handler for when the EmpatyAccountManager believes +/* A signal handler for when the TpAccountManager believes that the global status has changed. It roughly calculates this by finding the most available of all accounts that are active. */ static void -presence_changed (EmpathyAccountManager * eam, guint type, const gchar * type_str, const gchar * message, StatusProviderMC5 * sp) +presence_changed (TpAccountManager * eam, guint type, const gchar * type_str, const gchar * message, StatusProviderMC5 * sp) { StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(sp); |