diff -p -up dalston-0.1.6git20091002/dalston/dalston-power-applet.c.powerpolicy dalston-0.1.6git20091002/dalston/dalston-power-applet.c --- dalston-0.1.6git20091002/dalston/dalston-power-applet.c.powerpolicy 2009-10-02 19:38:36.000000000 +0200 +++ dalston-0.1.6git20091002/dalston/dalston-power-applet.c 2009-10-12 19:01:06.000000000 +0200 @@ -31,6 +31,8 @@ #include <nbtk/nbtk-gtk.h> #include <glib/gi18n.h> #include <libnotify/notify.h> +#include <dbus/dbus-glib.h> +#include <dbus/dbus-glib-lowlevel.h> G_DEFINE_TYPE (DalstonPowerApplet, dalston_power_applet, G_TYPE_OBJECT) @@ -496,6 +498,33 @@ dalston_power_applet_init (DalstonPowerA GtkWidget *hbox; gchar *str; + DBusGConnection *system_connection; + GError *error = NULL; + gint ret; + + system_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); + if (error) { + g_debug ("%s", error->message); + g_error_free (error); + system_connection = NULL; + } + + if (system_connection) { + ret = dbus_bus_request_name(dbus_g_connection_get_connection(system_connection), + "org.freedesktop.Policy.Power", + DBUS_NAME_FLAG_REPLACE_EXISTING, NULL); + switch (ret) { + case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: + g_debug("Successfully acquired interface org.freedesktop.Policy.Power."); + break; + case DBUS_REQUEST_NAME_REPLY_IN_QUEUE: + g_debug("Queued for interface org.freedesktop.Policy.Power."); + break; + default: + break; + }; + } + /* Create the pane hbox */ priv->main_hbox = gtk_hbox_new (FALSE, 4); gtk_container_set_border_width (GTK_CONTAINER (priv->main_hbox), 4);