aboutsummaryrefslogtreecommitdiff
path: root/src/session-service.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-15 16:00:43 -0500
committerTed Gould <ted@gould.cx>2010-03-15 16:00:43 -0500
commitacc3a9675f035777b3b32335edb7854860bfb9ba (patch)
treee6ec379f13aaca458adf112251fe50cc5aa1ecf1 /src/session-service.c
parentbdba7e5c6a5081c599ade54e4798f9f1af0b536e (diff)
downloadayatana-indicator-session-acc3a9675f035777b3b32335edb7854860bfb9ba.tar.gz
ayatana-indicator-session-acc3a9675f035777b3b32335edb7854860bfb9ba.tar.bz2
ayatana-indicator-session-acc3a9675f035777b3b32335edb7854860bfb9ba.zip
Adding some comments to describe a long function.
Diffstat (limited to 'src/session-service.c')
-rw-r--r--src/session-service.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/session-service.c b/src/session-service.c
index 53c305c..3ee1f6c 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -434,16 +434,21 @@ rebuild_items (DbusmenuMenuitem *root,
gboolean can_lockscreen;
GList *children;
+ /* Make sure we have a valid GConf client, and build one
+ if needed */
ensure_gconf_client ();
+ /* Check to see which menu items we're allowed to have */
can_activate = users_service_dbus_can_activate_session (service) &&
!gconf_client_get_bool (gconf_client, LOCKDOWN_KEY_USER, NULL);
can_lockscreen = !gconf_client_get_bool (gconf_client, LOCKDOWN_KEY_SCREENSAVER, NULL);
+ /* Remove the old menu items if that makes sense */
children = dbusmenu_menuitem_take_children (root);
g_list_foreach (children, (GFunc)g_object_unref, NULL);
g_list_free (children);
+ /* Lock screen item */
if (can_lockscreen) {
lock_menuitem = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, _("Lock Screen"));
@@ -456,6 +461,7 @@ rebuild_items (DbusmenuMenuitem *root,
}
}
+ /* Build all of the user switching items */
if (can_activate == TRUE)
{
if (can_lockscreen) {
@@ -534,12 +540,16 @@ rebuild_items (DbusmenuMenuitem *root,
g_list_free(users);
}
+ /* If there were a bunch of items before us, we need a
+ separator. */
if (can_lockscreen || can_activate) {
DbusmenuMenuitem * separator = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
dbusmenu_menuitem_child_append(root, separator);
}
+ /* Start going through the session based items. */
+
logout_mi = dbusmenu_menuitem_new();
if (supress_confirmations()) {
dbusmenu_menuitem_property_set(logout_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Log Out"));