[gnome-shell] dateMenu: Hide displays section when disabled by session mode



commit 61c5f259ec5a8a720cf282b84f90eb0abae659a0
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Mar 3 01:27:43 2015 +0100

    dateMenu: Hide displays section when disabled by session mode
    
    We currently show the world clocks section unconditionally, even when
    the session mode disallows launching the Clocks app to configure the
    displayed clocks. This does not make sense, so hide the entire section
    when the session mode disallows settings.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745494

 js/ui/dateMenu.js |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index f3c374d..76d66fc 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -386,15 +386,15 @@ const DateMenuButton = new Lang.Class({
 
         vbox.add(this._calendar.actor);
 
-        let scroll = new St.ScrollView({ style_class: 'vfade',
-                                         x_expand: true, x_fill: true,
-                                         overlay_scrollbars: true });
-        scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
-        vbox.add_actor(scroll);
+        this._displaysSection = new St.ScrollView({ style_class: 'datemenu-displays-section vfade',
+                                                    x_expand: true, x_fill: true,
+                                                    overlay_scrollbars: true });
+        this._displaysSection.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
+        vbox.add_actor(this._displaysSection);
 
         let displaysBox = new St.BoxLayout({ vertical: true,
                                              style_class: 'datemenu-displays-box' });
-        scroll.add_actor(displaysBox);
+        this._displaysSection.add_actor(displaysBox);
 
         this._clocksItem = new WorldClocksSection();
         displaysBox.add(this._clocksItem.actor, { x_fill: true });
@@ -432,5 +432,10 @@ const DateMenuButton = new Lang.Class({
             eventSource = new Calendar.EmptyEventSource();
         }
         this._setEventSource(eventSource);
+
+        // Displays are not actually expected to launch Settings when activated
+        // but the corresponding app (clocks, weather); however we can consider
+        // that display-specific settings, so re-use "allowSettings" here ...
+        this._displaysSection.visible = Main.sessionMode.allowSettings;
     }
 });


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]