[gnome-shell] dateMenu: Don't make dateMenuButton reactive on current day



commit 19afabe2a1e1b50603cbdee8f1fb9f6bef4fb494
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Wed Mar 19 19:23:05 2014 +0500

    dateMenu: Don't make dateMenuButton reactive on current day
    
    Having the ability to go to the current date if the user is already
    on the current date can be confusing. So don't make the button reactive
    until the selected date changes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726724

 js/ui/dateMenu.js |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index e869607..009df83 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -63,8 +63,11 @@ const DateMenuButton = new Lang.Class({
         hbox.add(vbox);
 
         // Date
+        // Having the ability to go to the current date if the user is already
+        // on the current date can be confusing. So don't make the button reactive
+        // until the selected date changes.
         this._date = new St.Button({ style_class: 'datemenu-date-label',
-                                     can_focus: true,
+                                     reactive: false
                                    });
         this._date.connect('clicked',
                            Lang.bind(this, function() {
@@ -82,6 +85,9 @@ const DateMenuButton = new Lang.Class({
                                   // and the calender makes those dates unclickable when instantiated with
                                   // a null event source
                                    this._eventList.setDate(date);
+
+                                   // Make the button reactive only if the selected date is not the current 
date.
+                                   this._date.can_focus = this._date.reactive = !this._isToday(date)
                                }));
         vbox.add(this._calendar.actor);
 
@@ -132,6 +138,13 @@ const DateMenuButton = new Lang.Class({
         this._sessionUpdated();
     },
 
+    _isToday: function(date) {
+        let now = new Date();
+        return now.getYear() == date.getYear() &&
+               now.getMonth() == date.getMonth() &&
+               now.getDay() == date.getDay();
+    },
+
     _appInstalledChanged: function() {
         this._calendarApp = undefined;
         this._updateEventsVisibility();


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