aboutsummaryrefslogtreecommitdiff
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
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 :)
-rw-r--r--debian/changelog7
-rw-r--r--src/session-service.c73
-rw-r--r--src/status-service.c12
3 files changed, 92 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index c7452f7..afc70b9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+indicator-sus (0.1~ppa2~indicator9ubuntu1) UNRELEASED; urgency=low
+
+ * Adding in lots of fun menu items. This way the menu looks
+ more complete than it really is :)
+
+ -- Ted Gould <ted@ubuntu.com> Tue, 21 Jul 2009 10:55:29 -0500
+
indicator-sus (0.1~ppa2~indicator9) karmic; urgency=low
* Updating the users daemon to have usable generic functions
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);
diff --git a/src/status-service.c b/src/status-service.c
index e31a0db..314929e 100644
--- a/src/status-service.c
+++ b/src/status-service.c
@@ -42,6 +42,13 @@ static DbusmenuMenuitem * root_menuitem = NULL;
static GMainLoop * mainloop = NULL;
static void
+lock_screen (DbusmenuMenuitem * mi, gpointer data)
+{
+ g_debug("Lock Screen");
+ return;
+}
+
+static void
status_menu_click (DbusmenuMenuitem * mi, gpointer data)
{
StatusProviderStatus status = (StatusProviderStatus)GPOINTER_TO_INT(data);
@@ -83,6 +90,11 @@ build_menu (gpointer data)
g_debug("Built %s", status_strings[i]);
}
+ DbusmenuMenuitem * mi = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(mi, "label", _("Lock Screen"));
+ g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(lock_screen), GINT_TO_POINTER(i));
+ dbusmenu_menuitem_child_append(root, mi);
+
return FALSE;
}