aboutsummaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2014-07-11 13:18:20 +1200
committerRobert Ancell <robert.ancell@canonical.com>2014-07-11 13:18:20 +1200
commitee96595e624448de2516934851137e25485df8c0 (patch)
tree6525c678f1d2ba3a698aa1b275076c5cd05be480 /src/service.c
parent63f2cd2eb4cb1ef1ec95732b4a5ed052d523d71f (diff)
downloadayatana-indicator-session-ee96595e624448de2516934851137e25485df8c0.tar.gz
ayatana-indicator-session-ee96595e624448de2516934851137e25485df8c0.tar.bz2
ayatana-indicator-session-ee96595e624448de2516934851137e25485df8c0.zip
Hide relevant items from session indicator when org.gnome.desktop.lockdown disable-lock-screen or disable-user-switching are set to match 12.04 LTS behaviour
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/service.c b/src/service.c
index 7484134..692a990 100644
--- a/src/service.c
+++ b/src/service.c
@@ -537,7 +537,7 @@ static GMenuModel *
create_switch_section (IndicatorSessionService * self, int profile)
{
GMenu * menu;
- GMenuItem * item;
+ GMenuItem * item = NULL;
gboolean want_accel;
guint i;
gpointer guser;
@@ -559,32 +559,47 @@ create_switch_section (IndicatorSessionService * self, int profile)
indicator_session_guest_is_active (p->backend_guest))
{
const char * action = "indicator.switch-to-greeter";
- item = g_menu_item_new (ellipsis ? _("Switch Account…")
- : _("Switch Account"), action);
+ if (indicator_session_actions_can_switch (p->backend_actions))
+ item = g_menu_item_new (ellipsis ? _("Switch Account…")
+ : _("Switch Account"), action);
want_accel = FALSE;
}
else
{
- const char * action = "indicator.switch-to-screensaver";
+ const char * lock_switch_action = "indicator.switch-to-screensaver";
+ const char * switch_action = "indicator.switch-to-greeter";
- if (g_hash_table_size (p->users) == 1)
- item = g_menu_item_new (_("Lock"), action);
- else
- item = g_menu_item_new (ellipsis ? _("Lock/Switch Account…")
- : _("Lock/Switch Account"), action);
+ if (g_hash_table_size (p->users) > 1 &&
+ indicator_session_actions_can_switch (p->backend_actions))
+ {
+ if (indicator_session_actions_can_lock (p->backend_actions))
+ item = g_menu_item_new (ellipsis ? _("Lock/Switch Account…")
+ : _("Lock/Switch Account"), lock_switch_action);
+ else
+ item = g_menu_item_new (ellipsis ? _("Switch Account…")
+ : _("Switch Account"), switch_action);
+ }
+ else if (indicator_session_actions_can_lock (p->backend_actions))
+ item = g_menu_item_new (_("Lock"), lock_switch_action);
want_accel = TRUE;
}
- if (want_accel)
+ if (item)
{
- gchar * str = g_settings_get_string (p->keybinding_settings, "screensaver");
- g_menu_item_set_attribute (item, "accel", "s", str);
- g_free (str);
+ if (want_accel)
+ {
+ gchar * str = g_settings_get_string (p->keybinding_settings, "screensaver");
+ g_menu_item_set_attribute (item, "accel", "s", str);
+ g_free (str);
+ }
+
+ g_menu_append_item (menu, item);
+ g_object_unref (item);
}
- g_menu_append_item (menu, item);
- g_object_unref (item);
+ if (!indicator_session_actions_can_switch (p->backend_actions))
+ return G_MENU_MODEL (menu);
if (indicator_session_guest_is_allowed (p->backend_guest))
{