[gnome-weather] Proposals for the Fix of selection mode.



commit 0b89d6c0c399a8451afde21328a674461e06f7ea
Author: Evgeny Bobkin <evgen ibqn gmail com>
Date:   Wed Jul 3 12:22:52 2013 +0200

    Proposals for the Fix of selection mode.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703530

 data/window.ui |    3 ++-
 src/window.js  |   17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/data/window.ui b/data/window.ui
index f37848f..0dbf888 100644
--- a/data/window.ui
+++ b/data/window.ui
@@ -214,6 +214,7 @@
             <child>
               <object class="GtkButton" id="delete-button">
                 <property name="visible">True</property>
+                <property name="sensitive">False</property>
                 <property name="can_focus">True</property>
                 <property name="label" translatable="yes">Delete</property>
                 <property name="action-name">win.delete-selected</property>
@@ -223,7 +224,7 @@
                 </style>
               </object>
               <packing>
-                <property name="pack_type">start</property>
+                <property name="pack_type">end</property>
               </packing>
             </child>
           </object>
diff --git a/src/window.js b/src/window.js
index 4f5cd8e..4c0c7e4 100644
--- a/src/window.js
+++ b/src/window.js
@@ -129,8 +129,14 @@ const MainWindow = new Lang.Class({
         let selectionMenu = builder.get_object("selection-menu");
 
         this._selectionMenuButton = builder.get_object('selection-menu-button');
+        this._selectionMenuButtonLabel = builder.get_object('selection-menu-button-label');
         this._stack = builder.get_object('main-stack');
 
+        let closeButton = builder.get_object('close-button');
+        let closeButtonSeparator = builder.get_object('close-button-separator');
+
+        this._deleteButton = builder.get_object('delete-button');
+
         this._cityView = new City.WeatherView({ hexpand: true,
                                                 vexpand: true });
         this._stack.add(this._cityView);
@@ -156,6 +162,10 @@ const MainWindow = new Lang.Class({
 
         iconView.bind_property('selection-mode', newButton, 'visible',
                                GObject.BindingFlags.INVERT_BOOLEAN);
+        iconView.bind_property('selection-mode', closeButtonSeparator, 'visible',
+                               GObject.BindingFlags.INVERT_BOOLEAN);
+        iconView.bind_property('selection-mode', closeButton, 'visible',
+                               GObject.BindingFlags.INVERT_BOOLEAN);
         iconView.bind_property('selection-mode', select, 'visible',
                                GObject.BindingFlags.INVERT_BOOLEAN);
         iconView.bind_property('selection-mode', selectDone, 'visible',
@@ -171,16 +181,20 @@ const MainWindow = new Lang.Class({
         iconView.connect('view-selection-changed', Lang.bind(this, function() {
             let items = iconView.get_selection();
             let label;
+            let sensitive;
 
             if (items.length > 0) {
                 label = Gettext.ngettext("%d selected",
                                          "%d selected",
                                          items.length).format(items.length);
+                sensitive = true;
             } else {
                 label = _("Click on locations to select them");
+                sensitive = false;
             }
 
-            this._selectionMenuButton.set_label(label);
+            this._selectionMenuButtonLabel.label = label;
+            this._deleteButton.sensitive = sensitive;
         }));
 
         this.add(grid);
@@ -257,6 +271,7 @@ const MainWindow = new Lang.Class({
 
     _setSelectionMode: function(action, param) {
         this._worldView.iconView.selection_mode = param.get_boolean();
+        this._deleteButton.sensitive = false;
     },
 
     _selectAll: function() {


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