aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2014-07-18 21:36:13 +0000
committerCI bot <ps-jenkins@lists.canonical.com>2014-07-18 21:36:13 +0000
commit97a82970ede0be03c1c9d0a2b43d91615d738f03 (patch)
treec6cf1af09d0ff5a9aa1bef75f3140abdb78b684c /src
parent373e7a8db9784809d0c464a04abdcee8cf5f9f96 (diff)
parentee96595e624448de2516934851137e25485df8c0 (diff)
downloadayatana-indicator-session-97a82970ede0be03c1c9d0a2b43d91615d738f03.tar.gz
ayatana-indicator-session-97a82970ede0be03c1c9d0a2b43d91615d738f03.tar.bz2
ayatana-indicator-session-97a82970ede0be03c1c9d0a2b43d91615d738f03.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 Fixes: 1325353
Approved by: Charles Kerr, PS Jenkins bot
Diffstat (limited to 'src')
-rw-r--r--src/service.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/service.c b/src/service.c
index 034e67c..445f1af 100644
--- a/src/service.c
+++ b/src/service.c
@@ -613,7 +613,7 @@ static GMenuModel *
create_switch_section (IndicatorSessionService * self, int profile)
{
GMenu * menu;
- GMenuItem * item;
+ GMenuItem * item = NULL;
gboolean want_accel;
guint i;
gpointer guser;
@@ -635,32 +635,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))
{