aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog7
-rw-r--r--src/status-provider-pidgin.c16
-rw-r--r--src/status-provider.c5
-rw-r--r--src/status-service.c20
4 files changed, 46 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 9d3240f..43a4cc6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+indicator-sus (0.1~ppa2~indicator9ubuntu9) UNRELEASED; urgency=low
+
+ * Lock screen works
+ * Pidgin proxy gets setup and doesn't crash
+
+ -- Ted Gould <ted@ubuntu.com> Sun, 26 Jul 2009 23:45:15 -0500
+
indicator-sus (0.1~ppa2~indicator9ubuntu8) karmic; urgency=low
* Ah, forgot the service files.
diff --git a/src/status-provider-pidgin.c b/src/status-provider-pidgin.c
index 600ee79..529f457 100644
--- a/src/status-provider-pidgin.c
+++ b/src/status-provider-pidgin.c
@@ -86,6 +86,21 @@ status_provider_pidgin_init (StatusProviderPidgin *self)
priv->proxy = NULL;
priv->pg_status = PG_STATUS_OFFLINE;
+ DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+ g_return_if_fail(bus != NULL); /* Can't do anymore DBus stuff without this,
+ all non-DBus stuff should be done */
+
+ GError * error = NULL;
+ priv->proxy = dbus_g_proxy_new_for_name_owner (bus,
+ "im.pidgin.purple.PurpleService",
+ "/im/pidgin/purple/PurpleObject",
+ "im.pidgin.purple.PurpleInterface",
+ &error);
+ if (error != NULL) {
+ g_debug("Unable to get Pidgin proxy: %s", error->message);
+ g_error_free(error);
+ }
+
return;
}
@@ -124,6 +139,7 @@ status_provider_pidgin_new (void)
static void
set_status (StatusProvider * sp, StatusProviderStatus status)
{
+ g_debug("\tSetting Pidgin Status: %d", 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];
diff --git a/src/status-provider.c b/src/status-provider.c
index cc9eb32..97f1798 100644
--- a/src/status-provider.c
+++ b/src/status-provider.c
@@ -59,7 +59,8 @@ status_provider_set_status (StatusProvider * sp, StatusProviderStatus status)
{
g_return_if_fail(IS_STATUS_PROVIDER(sp));
- StatusProviderClass * class = STATUS_PROVIDER_CLASS(sp);
+ StatusProviderClass * class = STATUS_PROVIDER_GET_CLASS(sp);
+ g_return_if_fail(class != NULL);
g_return_if_fail(class->set_status != NULL);
return class->set_status(sp, status);
@@ -70,7 +71,7 @@ status_provider_get_status (StatusProvider * sp)
{
g_return_val_if_fail(IS_STATUS_PROVIDER(sp), STATUS_PROVIDER_STATUS_OFFLINE);
- StatusProviderClass * class = STATUS_PROVIDER_CLASS(sp);
+ StatusProviderClass * class = STATUS_PROVIDER_GET_CLASS(sp);
g_return_val_if_fail(class->get_status != NULL, STATUS_PROVIDER_STATUS_OFFLINE);
return class->get_status(sp);
diff --git a/src/status-service.c b/src/status-service.c
index e02e70f..dbb597c 100644
--- a/src/status-service.c
+++ b/src/status-service.c
@@ -41,10 +41,30 @@ static const gchar * status_icons[STATUS_PROVIDER_STATUS_LAST] = {
static DbusmenuMenuitem * root_menuitem = NULL;
static GMainLoop * mainloop = NULL;
+/* A fun little function to actually lock the screen. If,
+ that's what you want, let's do it! */
static void
lock_screen (DbusmenuMenuitem * mi, gpointer data)
{
g_debug("Lock Screen");
+
+ DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
+ g_return_if_fail(session_bus != NULL);
+
+ DBusGProxy * proxy = dbus_g_proxy_new_for_name_owner(session_bus,
+ "org.gnome.ScreenSaver",
+ "/",
+ "org.gnome.ScreenSaver",
+ NULL);
+ g_return_if_fail(proxy != NULL);
+
+ dbus_g_proxy_call_no_reply(proxy,
+ "Lock",
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+
+ g_object_unref(proxy);
+
return;
}