aboutsummaryrefslogtreecommitdiff
path: root/src/status-provider-pidgin.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-06-12 12:50:02 -0500
committerTed Gould <ted@canonical.com>2009-06-12 12:50:02 -0500
commitf3f762e1bb3c91ef2226ea82982d24c51ee7a39e (patch)
treef722c1409ae9d0b86f2a6aa5d6a92b5509aab3e4 /src/status-provider-pidgin.c
parent54a3bda1d88cf6f72c0d913380b1d574e9b21cb6 (diff)
downloadayatana-indicator-session-f3f762e1bb3c91ef2226ea82982d24c51ee7a39e.tar.gz
ayatana-indicator-session-f3f762e1bb3c91ef2226ea82982d24c51ee7a39e.tar.bz2
ayatana-indicator-session-f3f762e1bb3c91ef2226ea82982d24c51ee7a39e.zip
Putting in the status translation tables.
Diffstat (limited to 'src/status-provider-pidgin.c')
-rw-r--r--src/status-provider-pidgin.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/src/status-provider-pidgin.c b/src/status-provider-pidgin.c
index 4dde758..1f5c5cc 100644
--- a/src/status-provider-pidgin.c
+++ b/src/status-provider-pidgin.c
@@ -7,9 +7,42 @@
#include <dbus/dbus-glib.h>
+typedef enum {
+ PG_STATUS_UNKNOWN,
+ PG_STATUS_OFFLINE,
+ PG_STATUS_AVAILABLE,
+ PG_STATUS_UNAVAILABLE,
+ PG_STATUS_INVISIBLE,
+ PG_STATUS_AWAY,
+ PG_STATUS_EXTENDEND_AWAY,
+ PG_STATUS_MOBILE,
+ PG_STATUS_TUNE
+} pg_status_t;
+
+static const StatusProviderStatus pg_to_sp_map[] = {
+ /* PG_STATUS_UNKNOWN, */ STATUS_PROVIDER_STATUS_OFFLINE,
+ /* PG_STATUS_OFFLINE, */ STATUS_PROVIDER_STATUS_OFFLINE,
+ /* PG_STATUS_AVAILABLE, */ STATUS_PROVIDER_STATUS_ONLINE,
+ /* PG_STATUS_UNAVAILABLE, */ STATUS_PROVIDER_STATUS_DND,
+ /* PG_STATUS_INVISIBLE, */ STATUS_PROVIDER_STATUS_INVISIBLE,
+ /* PG_STATUS_AWAY, */ STATUS_PROVIDER_STATUS_AWAY,
+ /* PG_STATUS_EXTENDEND_AWAY, */ STATUS_PROVIDER_STATUS_AWAY,
+ /* PG_STATUS_MOBILE, */ STATUS_PROVIDER_STATUS_OFFLINE,
+ /* PG_STATUS_TUNE */ STATUS_PROVIDER_STATUS_OFFLINE
+};
+
+static const pg_status_t sp_to_pg_map[STATUS_PROVIDER_STATUS_LAST] = {
+ /* STATUS_PROVIDER_STATUS_ONLINE, */ PG_STATUS_AVAILABLE,
+ /* STATUS_PROVIDER_STATUS_AWAY, */ PG_STATUS_AWAY,
+ /* STATUS_PROVIDER_STATUS_DND */ PG_STATUS_UNAVAILABLE,
+ /* STATUS_PROVIDER_STATUS_INVISIBLE*/ PG_STATUS_INVISIBLE,
+ /* STATUS_PROVIDER_STATUS_OFFLINE */ PG_STATUS_OFFLINE
+};
+
typedef struct _StatusProviderPidginPrivate StatusProviderPidginPrivate;
struct _StatusProviderPidginPrivate {
DBusGProxy * proxy;
+ pg_status_t pg_status;
};
#define STATUS_PROVIDER_PIDGIN_GET_PRIVATE(o) \
@@ -51,6 +84,7 @@ status_provider_pidgin_init (StatusProviderPidgin *self)
StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(self);
priv->proxy = NULL;
+ priv->pg_status = PG_STATUS_OFFLINE;
return;
}
@@ -80,13 +114,17 @@ status_provider_pidgin_new (void)
static void
set_status (StatusProvider * sp, StatusProviderStatus status)
{
-
+ g_return_if_fail(IS_STATUS_PROVIDER_PIDGIN(sp));
+ StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(sp);
+ pg_status_t pg_status = sp_to_pg_map[status];
+ priv->pg_status = pg_status;
return;
}
static StatusProviderStatus
get_status (StatusProvider * sp)
{
-
- return STATUS_PROVIDER_STATUS_OFFLINE;
+ g_return_val_if_fail(IS_STATUS_PROVIDER_PIDGIN(sp), STATUS_PROVIDER_STATUS_OFFLINE);
+ StatusProviderPidginPrivate * priv = STATUS_PROVIDER_PIDGIN_GET_PRIVATE(sp);
+ return pg_to_sp_map[priv->pg_status];
}