[gnome-shell/wip/fmuellner/calendar-refresh: 7/12] calendar: Only show section title for other days



commit 88c21b9ac7fa682da5447695b12d1f63dbb802b3
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Feb 26 04:35:43 2017 +0100

    calendar: Only show section title for other days
    
    The section titles usually don't provide a lot of value - messages
    themselves are usually pretty unambiguous about their type, and
    having a hidden shortcut to some settings panel or application isn't
    essential either - except when showing the selected date when browsing
    other days, as it adds context to the listed events. Based on that,
    remove the section title as a general MessageListSection feature and
    move it into the EventsSection, where we only show it when it is useful.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775763

 data/theme/gnome-shell-high-contrast.css |   10 +++---
 data/theme/gnome-shell.css               |   10 +++---
 js/ui/calendar.js                        |   40 ++++++++++++------------------
 js/ui/messageList.js                     |   16 +-----------
 js/ui/mpris.js                           |    2 +-
 5 files changed, 28 insertions(+), 50 deletions(-)
---
diff --git a/data/theme/gnome-shell-high-contrast.css b/data/theme/gnome-shell-high-contrast.css
index 476dfb2..2714b92 100644
--- a/data/theme/gnome-shell-high-contrast.css
+++ b/data/theme/gnome-shell-high-contrast.css
@@ -737,7 +737,7 @@ StScrollBar {
 .datemenu-today-button,
 .world-clocks-button,
 .weather-button,
-.message-list-section-title {
+.events-section-title {
   border-radius: 4px;
   padding: .4em; }
 
@@ -752,13 +752,13 @@ StScrollBar {
 .world-clocks-button:focus,
 .weather-button:hover,
 .weather-button:focus,
-.message-list-section-title:hover,
-.message-list-section-title:focus {
+.events-section-title:hover,
+.events-section-title:focus {
   background-color: #0d0d0d; }
 .datemenu-today-button:active,
 .world-clocks-button:active,
 .weather-button:active,
-.message-list-section-title:active {
+.events-section-title:active {
   color: white;
   background-color: #215d9c; }
 
@@ -767,7 +767,7 @@ StScrollBar {
 
 .world-clocks-header,
 .weather-header,
-.message-list-section-title {
+.events-section-title {
   color: #999999;
   font-weight: bold; }
 
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 40be853..efac28f 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -737,7 +737,7 @@ StScrollBar {
 .datemenu-today-button,
 .world-clocks-button,
 .weather-button,
-.message-list-section-title {
+.events-section-title {
   border-radius: 4px;
   padding: .4em; }
 
@@ -752,13 +752,13 @@ StScrollBar {
 .world-clocks-button:focus,
 .weather-button:hover,
 .weather-button:focus,
-.message-list-section-title:hover,
-.message-list-section-title:focus {
+.events-section-title:hover,
+.events-section-title:focus {
   background-color: #454c4c; }
 .datemenu-today-button:active,
 .world-clocks-button:active,
 .weather-button:active,
-.message-list-section-title:active {
+.events-section-title:active {
   color: white;
   background-color: #215d9c; }
 
@@ -767,7 +767,7 @@ StScrollBar {
 
 .world-clocks-header,
 .weather-header,
-.message-list-section-title {
+.events-section-title {
   color: #8e8e80;
   font-weight: bold; }
 
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 8669efe..68e560e 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -811,7 +811,16 @@ const EventsSection = new Lang.Class({
         this._desktopSettings.connect('changed', Lang.bind(this, this._reloadEvents));
         this._eventSource = new EmptyEventSource();
 
-        this.parent('');
+        this.parent();
+
+        this._title = new St.Button({ style_class: 'events-section-title',
+                                      label: '',
+                                      x_align: St.Align.START,
+                                      can_focus: true });
+        this.actor.insert_child_below(this._title, null);
+
+        this._title.connect('clicked', Lang.bind(this, this._onTitleClicked));
+        this._title.connect('key-focus-in', Lang.bind(this, this._onKeyFocusIn));
 
         Shell.AppSystem.get_default().connect('installed-changed',
                                               Lang.bind(this, this._appInstalledChanged));
@@ -832,10 +841,10 @@ const EventsSection = new Lang.Class({
     },
 
     _updateTitle: function() {
-        if (isToday(this._date)) {
-            this._title.label = _("Events");
+        this._title.visible = !isToday(this._date);
+
+        if (!this._title.visible)
             return;
-        }
 
         let dayFormat;
         let now = new Date();
@@ -897,7 +906,8 @@ const EventsSection = new Lang.Class({
     },
 
     _onTitleClicked: function() {
-        this.parent();
+        Main.overview.hide();
+        Main.panel.closeCalendar();
 
         let app = this._getCalendarApp();
         if (app.get_id() == 'evolution.desktop')
@@ -928,7 +938,7 @@ const NotificationSection = new Lang.Class({
     Extends: MessageList.MessageListSection,
 
     _init: function() {
-        this.parent(_("Notifications"));
+        this.parent();
 
         this._sources = new Map();
         this._nUrgent = 0;
@@ -1017,26 +1027,8 @@ const NotificationSection = new Lang.Class({
                 message.notification.acknowledged = true;
     },
 
-    _onTitleClicked: function() {
-        this.parent();
-
-        let app = Shell.AppSystem.get_default().lookup_app('gnome-notifications-panel.desktop');
-
-        if (!app) {
-            log('Settings panel for desktop file ' + desktopFile + ' could not be loaded!');
-            return;
-        }
-
-        app.activate();
-    },
-
     _shouldShow: function() {
         return !this.empty && isToday(this._date);
-    },
-
-    _sync: function() {
-        this.parent();
-        this._title.reactive = Main.sessionMode.allowSettings;
     }
 });
 
diff --git a/js/ui/messageList.js b/js/ui/messageList.js
index 8978fa2..1038789 100644
--- a/js/ui/messageList.js
+++ b/js/ui/messageList.js
@@ -520,19 +520,10 @@ Signals.addSignalMethods(Message.prototype);
 const MessageListSection = new Lang.Class({
     Name: 'MessageListSection',
 
-    _init: function(title) {
+    _init: function() {
         this.actor = new St.BoxLayout({ style_class: 'message-list-section',
                                         clip_to_allocation: true,
                                         x_expand: true, vertical: true });
-        this._title = new St.Button({ style_class: 'message-list-section-title',
-                                      label: title,
-                                      can_focus: true,
-                                      x_expand: true,
-                                      x_align: St.Align.START });
-        this.actor.add_actor(this._title);
-
-        this._title.connect('clicked', Lang.bind(this, this._onTitleClicked));
-        this._title.connect('key-focus-in', Lang.bind(this, this._onKeyFocusIn));
 
         this._list = new St.BoxLayout({ style_class: 'message-list-section-list',
                                         vertical: true });
@@ -554,11 +545,6 @@ const MessageListSection = new Lang.Class({
         this._sync();
     },
 
-    _onTitleClicked: function() {
-        Main.overview.hide();
-        Main.panel.closeCalendar();
-    },
-
     _onKeyFocusIn: function(actor) {
         this.emit('key-focus-in', actor);
     },
diff --git a/js/ui/mpris.js b/js/ui/mpris.js
index 825a00e..b42d9aa 100644
--- a/js/ui/mpris.js
+++ b/js/ui/mpris.js
@@ -214,7 +214,7 @@ const MediaSection = new Lang.Class({
     Extends: MessageList.MessageListSection,
 
     _init: function() {
-        this.parent(_("Media"));
+        this.parent();
 
         this._players = new Map();
 


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