aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-06-10 16:55:12 -0500
committerTed Gould <ted@canonical.com>2009-06-10 16:55:12 -0500
commitbf4f01129a8fcec1b0dc800036ee3990436644bc (patch)
tree409a4915a9796faac8f1fdf621237af035326096
parent913e99f4a2151b57412b1db3e2eb48b5050ff9fb (diff)
downloadayatana-indicator-session-bf4f01129a8fcec1b0dc800036ee3990436644bc.tar.gz
ayatana-indicator-session-bf4f01129a8fcec1b0dc800036ee3990436644bc.tar.bz2
ayatana-indicator-session-bf4f01129a8fcec1b0dc800036ee3990436644bc.zip
Building the menuitems
-rw-r--r--src/status-service.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/status-service.c b/src/status-service.c
index 68b5685..1615985 100644
--- a/src/status-service.c
+++ b/src/status-service.c
@@ -38,6 +38,27 @@ static const gchar * status_icons[STATUS_SERVICE_STATUS_LAST] = {
static DbusmenuMenuitem * root_menuitem = NULL;
static GMainLoop * mainloop = NULL;
+gboolean
+build_menu (gpointer data)
+{
+ DbusmenuMenuitem * root = DBUSMENU_MENUITEM(data);
+ g_return_val_if_fail(root != NULL, FALSE);
+
+ StatusServiceStatus i;
+ for (i = STATUS_SERVICE_STATUS_ONLINE; i < STATUS_SERVICE_STATUS_LAST; i++) {
+ DbusmenuMenuitem * mi = dbusmenu_menuitem_new();
+
+ dbusmenu_menuitem_property_set(mi, "label", _(status_strings[i]));
+ dbusmenu_menuitem_property_set(mi, "icon", status_icons[i]);
+
+ dbusmenu_menuitem_child_append(root, mi);
+
+ g_debug("Built %s", status_strings[i]);
+ }
+
+ return FALSE;
+}
+
int
main (int argc, char ** argv)
{
@@ -62,6 +83,8 @@ main (int argc, char ** argv)
DbusmenuServer * server = dbusmenu_server_new(INDICATOR_STATUS_DBUS_OBJECT);
dbusmenu_server_set_root(server, root_menuitem);
+ g_idle_add(build_menu, root_menuitem);
+
mainloop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(mainloop);