diff options
author | Ted Gould <ted@canonical.com> | 2009-07-21 10:51:08 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-07-21 10:51:08 -0500 |
commit | 2c4cdbd4ccf400a537a945c670eb1b8f705a1896 (patch) | |
tree | 5c776f537b48f303d42618ee4ea1e0324e50ee1f /src | |
parent | fdb5cc0addc4ad4a801854879a2b1869da18073f (diff) | |
download | ayatana-indicator-session-2c4cdbd4ccf400a537a945c670eb1b8f705a1896.tar.gz ayatana-indicator-session-2c4cdbd4ccf400a537a945c670eb1b8f705a1896.tar.bz2 ayatana-indicator-session-2c4cdbd4ccf400a537a945c670eb1b8f705a1896.zip |
Adding menu items for session stuff
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); |