aboutsummaryrefslogtreecommitdiff
path: root/src/session-service.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-07-21 10:55:51 -0500
committerTed Gould <ted@canonical.com>2009-07-21 10:55:51 -0500
commit2ca3cfc69a973ee7fcf1092b2123aff8d6d50a92 (patch)
tree580a682ed07ceca2a2fe2d0edb8f84696bdd9cf6 /src/session-service.c
parenta8c42b30eec77e825ce16141004742eeb5c3078c (diff)
parent9ac0cedfc49dc8e1b89bf24ac0964cff0195437e (diff)
downloadayatana-indicator-session-2ca3cfc69a973ee7fcf1092b2123aff8d6d50a92.tar.gz
ayatana-indicator-session-2ca3cfc69a973ee7fcf1092b2123aff8d6d50a92.tar.bz2
ayatana-indicator-session-2ca3cfc69a973ee7fcf1092b2123aff8d6d50a92.zip
Adding in lots of fun menu items. This way the menu looks
more complete than it really is :)
Diffstat (limited to 'src/session-service.c')
-rw-r--r--src/session-service.c73
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);