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
This commit is contained in:
Florian Müllner 2017-02-26 04:35:43 +01:00
parent 8a6157c7c1
commit fec511c786
6 changed files with 29 additions and 51 deletions

View File

@ -737,7 +737,7 @@ StScrollBar {
.datemenu-today-button, .datemenu-today-button,
.world-clocks-button, .world-clocks-button,
.weather-button, .weather-button,
.message-list-section-title { .events-section-title {
border-radius: 4px; border-radius: 4px;
padding: .4em; } padding: .4em; }
@ -752,13 +752,13 @@ StScrollBar {
.world-clocks-button:focus, .world-clocks-button:focus,
.weather-button:hover, .weather-button:hover,
.weather-button:focus, .weather-button:focus,
.message-list-section-title:hover, .events-section-title:hover,
.message-list-section-title:focus { .events-section-title:focus {
background-color: #0d0d0d; } background-color: #0d0d0d; }
.datemenu-today-button:active, .datemenu-today-button:active,
.world-clocks-button:active, .world-clocks-button:active,
.weather-button:active, .weather-button:active,
.message-list-section-title:active { .events-section-title:active {
color: white; color: white;
background-color: #215d9c; } background-color: #215d9c; }
@ -767,7 +767,7 @@ StScrollBar {
.world-clocks-header, .world-clocks-header,
.weather-header, .weather-header,
.message-list-section-title { .events-section-title {
color: #999999; color: #999999;
font-weight: bold; } font-weight: bold; }

@ -1 +1 @@
Subproject commit 8001b92b5ef26cb8ea5674c72beed6a4a6439e89 Subproject commit 7f6d89bfcd5fa1c4238eed83dcab75949df72a4d

View File

@ -737,7 +737,7 @@ StScrollBar {
.datemenu-today-button, .datemenu-today-button,
.world-clocks-button, .world-clocks-button,
.weather-button, .weather-button,
.message-list-section-title { .events-section-title {
border-radius: 4px; border-radius: 4px;
padding: .4em; } padding: .4em; }
@ -752,13 +752,13 @@ StScrollBar {
.world-clocks-button:focus, .world-clocks-button:focus,
.weather-button:hover, .weather-button:hover,
.weather-button:focus, .weather-button:focus,
.message-list-section-title:hover, .events-section-title:hover,
.message-list-section-title:focus { .events-section-title:focus {
background-color: #454c4c; } background-color: #454c4c; }
.datemenu-today-button:active, .datemenu-today-button:active,
.world-clocks-button:active, .world-clocks-button:active,
.weather-button:active, .weather-button:active,
.message-list-section-title:active { .events-section-title:active {
color: white; color: white;
background-color: #215d9c; } background-color: #215d9c; }
@ -767,7 +767,7 @@ StScrollBar {
.world-clocks-header, .world-clocks-header,
.weather-header, .weather-header,
.message-list-section-title { .events-section-title {
color: #8e8e80; color: #8e8e80;
font-weight: bold; } font-weight: bold; }

View File

@ -811,7 +811,16 @@ const EventsSection = new Lang.Class({
this._desktopSettings.connect('changed', Lang.bind(this, this._reloadEvents)); this._desktopSettings.connect('changed', Lang.bind(this, this._reloadEvents));
this._eventSource = new EmptyEventSource(); 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', Shell.AppSystem.get_default().connect('installed-changed',
Lang.bind(this, this._appInstalledChanged)); Lang.bind(this, this._appInstalledChanged));
@ -832,10 +841,10 @@ const EventsSection = new Lang.Class({
}, },
_updateTitle: function() { _updateTitle: function() {
if (isToday(this._date)) { this._title.visible = !isToday(this._date);
this._title.label = _("Events");
if (!this._title.visible)
return; return;
}
let dayFormat; let dayFormat;
let now = new Date(); let now = new Date();
@ -897,7 +906,8 @@ const EventsSection = new Lang.Class({
}, },
_onTitleClicked: function() { _onTitleClicked: function() {
this.parent(); Main.overview.hide();
Main.panel.closeCalendar();
let app = this._getCalendarApp(); let app = this._getCalendarApp();
if (app.get_id() == 'evolution.desktop') if (app.get_id() == 'evolution.desktop')
@ -928,7 +938,7 @@ const NotificationSection = new Lang.Class({
Extends: MessageList.MessageListSection, Extends: MessageList.MessageListSection,
_init: function() { _init: function() {
this.parent(_("Notifications")); this.parent();
this._sources = new Map(); this._sources = new Map();
this._nUrgent = 0; this._nUrgent = 0;
@ -1017,26 +1027,8 @@ const NotificationSection = new Lang.Class({
message.notification.acknowledged = true; 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() { _shouldShow: function() {
return !this.empty && isToday(this._date); return !this.empty && isToday(this._date);
},
_sync: function() {
this.parent();
this._title.reactive = Main.sessionMode.allowSettings;
} }
}); });

View File

@ -520,19 +520,10 @@ Signals.addSignalMethods(Message.prototype);
const MessageListSection = new Lang.Class({ const MessageListSection = new Lang.Class({
Name: 'MessageListSection', Name: 'MessageListSection',
_init: function(title) { _init: function() {
this.actor = new St.BoxLayout({ style_class: 'message-list-section', this.actor = new St.BoxLayout({ style_class: 'message-list-section',
clip_to_allocation: true, clip_to_allocation: true,
x_expand: true, vertical: 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', this._list = new St.BoxLayout({ style_class: 'message-list-section-list',
vertical: true }); vertical: true });
@ -554,11 +545,6 @@ const MessageListSection = new Lang.Class({
this._sync(); this._sync();
}, },
_onTitleClicked: function() {
Main.overview.hide();
Main.panel.closeCalendar();
},
_onKeyFocusIn: function(actor) { _onKeyFocusIn: function(actor) {
this.emit('key-focus-in', actor); this.emit('key-focus-in', actor);
}, },

View File

@ -214,7 +214,7 @@ const MediaSection = new Lang.Class({
Extends: MessageList.MessageListSection, Extends: MessageList.MessageListSection,
_init: function() { _init: function() {
this.parent(_("Media")); this.parent();
this._players = new Map(); this._players = new Map();