diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/session-service.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/session-service.c b/src/session-service.c index 7a2ad27..80d4172 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -1,4 +1,6 @@ +#include <glib/gi18n.h> + #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-bindings.h> @@ -10,6 +12,73 @@ static DbusmenuMenuitem * root_menuitem = NULL; static GMainLoop * mainloop = NULL; +static void +log_out (DbusmenuMenuitem * mi, gpointer userdata) +{ + g_debug("Log Out"); + return; +} + +static void +suspend (DbusmenuMenuitem * mi, gpointer userdata) +{ + g_debug("Suspend"); + return; +} + +static void +hibernate (DbusmenuMenuitem * mi, gpointer userdata) +{ + g_debug("Hibernate"); + return; +} + +static void +restart (DbusmenuMenuitem * mi, gpointer userdata) +{ + g_debug("Restart"); + return; +} + +static void +shutdown (DbusmenuMenuitem * mi, gpointer userdata) +{ + g_debug("Shutdown"); + return; +} + +static void +create_items (DbusmenuMenuitem * root) { + DbusmenuMenuitem * mi = NULL; + + mi = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(mi, "label", _("Log Out")); + dbusmenu_menuitem_child_append(root, mi); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(log_out), NULL); + + mi = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(mi, "label", _("Suspend")); + dbusmenu_menuitem_child_append(root, mi); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(suspend), NULL); + + mi = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(mi, "label", _("Hibernate")); + dbusmenu_menuitem_child_append(root, mi); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(hibernate), NULL); + + mi = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(mi, "label", _("Restart")); + dbusmenu_menuitem_child_append(root, mi); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(restart), NULL); + + mi = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(mi, "label", _("Shutdown")); + dbusmenu_menuitem_child_append(root, mi); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(shutdown), NULL); + + return; +} + int main (int argc, char ** argv) { @@ -31,6 +100,10 @@ main (int argc, char ** argv) } root_menuitem = dbusmenu_menuitem_new(); + g_debug("Root ID: %d", dbusmenu_menuitem_get_id(root_menuitem)); + + create_items(root_menuitem); + DbusmenuServer * server = dbusmenu_server_new(INDICATOR_SESSION_DBUS_OBJECT); dbusmenu_server_set_root(server, root_menuitem); |