~indicator-applet-developers/indicator-session/trunk.0.1

« back to all changes in this revision

Viewing changes to src/status-provider-mc5.c

  • Committer: Ted Gould
  • Date: 2009-10-08 20:12:42 UTC
  • mto: This revision was merged to the branch mainline in revision 56.
  • Revision ID: ted@canonical.com-20091008201242-cd3msp3784rrv8iz
Checking to see if there is an MC5 there when we start.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include "status-provider-mc5-marshal.h"
32
32
 
33
33
#include <dbus/dbus-glib.h>
 
34
#include <dbus/dbus-glib-bindings.h>
34
35
 
35
36
static gchar * sp_to_mc_map[STATUS_PROVIDER_STATUS_LAST] = {
36
37
        /* STATUS_PROVIDER_STATUS_ONLINE,  */  "available",
71
72
 
72
73
#define STATUS_PROVIDER_MC5_GET_PRIVATE(o) \
73
74
(G_TYPE_INSTANCE_GET_PRIVATE ((o), STATUS_PROVIDER_MC5_TYPE, StatusProviderMC5Private))
 
75
#define MC5_WELL_KNOWN_NAME  "org.freedesktop.Telepathy.MissionControl5"
74
76
 
75
77
/* Prototypes */
76
78
/* GObject stuff */
83
85
static StatusProviderStatus get_status (StatusProvider * sp);
84
86
static void presence_changed (EmpathyAccountManager * eam, guint type, const gchar * type_str, const gchar * message, StatusProviderMC5 * sp);
85
87
static void dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, StatusProviderMC5 * self);
 
88
static void mc5_exists_cb (DBusGProxy * proxy, gboolean exists, GError * error, gpointer userdata);
86
89
 
87
90
G_DEFINE_TYPE (StatusProviderMC5, status_provider_mc5, STATUS_PROVIDER_TYPE);
88
91
 
161
164
                                G_CALLBACK(dbus_namechange),
162
165
                                self, NULL);
163
166
 
 
167
        org_freedesktop_DBus_name_has_owner_async(priv->dbus_proxy, MC5_WELL_KNOWN_NAME, mc5_exists_cb, self);
 
168
 
164
169
        return;
165
170
}
166
171
 
194
199
        return;
195
200
}
196
201
 
197
 
#define MC5_WELL_KNOWN_NAME  "org.freedesktop.Telepathy.MissionControl5"
198
202
/* Watch for MC5 Coming on and off the bus. */
199
203
static void
200
204
dbus_namechange (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, StatusProviderMC5 * self)
220
224
        return;
221
225
}
222
226
 
 
227
/* Callback for the Dbus command to do HasOwner on
 
228
   the MC5 service.  If it exists, we want to have an
 
229
   account manager. */
 
230
static void
 
231
mc5_exists_cb (DBusGProxy * proxy, gboolean exists, GError * error, gpointer userdata)
 
232
{
 
233
        if (error) {
 
234
                g_warning("Unable to check if MC5 is running: %s", error->message);
 
235
                return;
 
236
        }
 
237
 
 
238
        if (exists) {
 
239
                build_eam(STATUS_PROVIDER_MC5(userdata));
 
240
        }
 
241
 
 
242
        return;
 
243
}
 
244
 
223
245
/**
224
246
        status_provider_mc5_new:
225
247