[gnome-shell: 91/136] dateMenu: Swap calendar and event columns



commit 26330fde7efe4bd54e7da2b29b5a5bdbc99ff66a
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jan 30 05:56:28 2015 +0100

    dateMenu: Swap calendar and event columns
    
    The new design has the events list on the left and the calendar on the
    right, so swap them around and remove the vertical separator between
    them in favor of some additional whitespace as in the mockups.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744817

 data/theme/gnome-shell-sass |    2 +-
 data/theme/gnome-shell.css  |   16 ++++---
 js/ui/dateMenu.js           |   86 ++++++++++++++----------------------------
 3 files changed, 39 insertions(+), 65 deletions(-)
---
diff --git a/data/theme/gnome-shell-sass b/data/theme/gnome-shell-sass
index f9e45c1..8409846 160000
--- a/data/theme/gnome-shell-sass
+++ b/data/theme/gnome-shell-sass
@@ -1 +1 @@
-Subproject commit f9e45c152f56b086baac34f111c837287b7b1806
+Subproject commit 8409846c837c96f26533c7e9116c1009a4cc8bce
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index f823e3f..29e53e5 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -585,9 +585,16 @@ StScrollBar {
   #panel .screencast-indicator {
     color: #f57900; }
 
+#calendarArea {
+  padding: 0.75em 1.0em; }
+
 .calendar {
-  padding: .4em 1.75em .8em 1.75em;
-  margin-bottom: 2em; }
+  margin: 0 1.5em;
+  margin-bottom: 1em; }
+
+.datemenu-calendar-column {
+  spacing: 0.5em;
+  padding-bottom: 3em; }
 
 .datemenu-date-label {
   padding: .4em 1.7em;
@@ -596,11 +603,6 @@ StScrollBar {
   font-weight: bold;
   font-size: 110%; }
 
-.calendar-vertical-separator {
-  width: .3em;
-  -stipple-width: 1px;
-  -stipple-color: rgba(238, 238, 236, 0.2); }
-
 .calendar-month-label {
   color: #e2e2df;
   font-weight: bold;
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index 5dbdfb8..673a752 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -19,21 +19,6 @@ const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 const Calendar = imports.ui.calendar;
 
-function _onVertSepRepaint(area) {
-    let cr = area.get_context();
-    let themeNode = area.get_theme_node();
-    let [width, height] = area.get_surface_size();
-    let stippleColor = themeNode.get_color('-stipple-color');
-    let stippleWidth = themeNode.get_length('-stipple-width');
-    let x = Math.floor(width/2) + 0.5;
-    cr.moveTo(x, 0);
-    cr.lineTo(x, height);
-    Clutter.cairo_set_source_color(cr, stippleColor);
-    cr.setDash([1, 3], 1); // Hard-code for now
-    cr.setLineWidth(stippleWidth);
-    cr.stroke();
-    cr.$dispose();
-}
 
 const DateMenuButton = new Lang.Class({
     Name: 'DateMenuButton',
@@ -44,7 +29,7 @@ const DateMenuButton = new Lang.Class({
         let hbox;
         let vbox;
 
-        let menuAlignment = 0.25;
+        let menuAlignment = 0.5;
         if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
             menuAlignment = 1.0 - menuAlignment;
         this.parent(menuAlignment);
@@ -57,9 +42,36 @@ const DateMenuButton = new Lang.Class({
         hbox = new St.BoxLayout({ name: 'calendarArea' });
         this.menu.box.add_child(hbox);
 
+        this._calendar = new Calendar.Calendar();
+        this._calendar.connect('selected-date-changed',
+                               Lang.bind(this, function(calendar, date) {
+                                   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)
+                               }));
+
+        // Whenever the menu is opened, select today
+        this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
+            if (isOpen) {
+                let now = new Date();
+                this._calendar.setDate(now);
+
+                /* Translators: This is the date format to use when the calendar popup is
+                 * shown - it is shown just below the time in the shell (e.g. "Tue 9:29 AM").
+                 */
+                let dateFormat = Shell.util_translate_time_string (N_("%A %B %e, %Y"));
+                this._date.set_label(now.toLocaleFormat(dateFormat));
+            }
+        }));
+
         // Fill up the first column
+        this._eventList = new Calendar.EventsList();
+        hbox.add(this._eventList.actor, { expand: true, y_fill: false, y_align: St.Align.START });
 
-        vbox = new St.BoxLayout({vertical: true});
+        // Fill up the second column
+        vbox = new St.BoxLayout({ style_class: 'datemenu-calendar-column',
+                                  vertical: true });
         hbox.add(vbox);
 
         // Date
@@ -75,16 +87,6 @@ const DateMenuButton = new Lang.Class({
                            }));
         vbox.add(this._date, { x_fill: false  });
 
-        this._eventList = new Calendar.EventsList();
-        this._calendar = new Calendar.Calendar();
-
-        this._calendar.connect('selected-date-changed',
-                               Lang.bind(this, function(calendar, date) {
-                                   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);
 
         let separator = new PopupMenu.PopupSeparatorMenuItem();
@@ -108,27 +110,6 @@ const DateMenuButton = new Lang.Class({
             this._dateAndTimeSeparator = separator;
         }
 
-        this._separator = new St.DrawingArea({ style_class: 'calendar-vertical-separator',
-                                               pseudo_class: 'highlighted' });
-        this._separator.connect('repaint', Lang.bind(this, _onVertSepRepaint));
-        hbox.add(this._separator);
-
-        // Fill up the second column
-        hbox.add(this._eventList.actor, { expand: true, y_fill: false, y_align: St.Align.START });
-
-        // Whenever the menu is opened, select today
-        this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
-            if (isOpen) {
-                let now = new Date();
-                this._calendar.setDate(now);
-
-                /* Translators: This is the date format to use when the calendar popup is
-                 * shown - it is shown just below the time in the shell (e.g. "Tue 9:29 AM").
-                 */
-                let dateFormat = Shell.util_translate_time_string (N_("%A %B %e, %Y"));
-                this._date.set_label(now.toLocaleFormat(dateFormat));
-            }
-        }));
 
         // Done with hbox for calendar and event list
 
@@ -157,16 +138,7 @@ const DateMenuButton = new Lang.Class({
             (this._getCalendarApp() != null);
         this._openClocksItem.actor.visible = visible &&
             (this._getClockApp() != null);
-        this._separator.visible = visible;
         this._eventList.actor.visible = visible;
-        if (visible) {
-            let alignment = 0.25;
-            if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
-                alignment = 1.0 - alignment;
-            this.menu._arrowAlignment = alignment;
-        } else {
-            this.menu._arrowAlignment = 0.5;
-        }
     },
 
     _getEventSource: function() {


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