[gnome-weather] Changing sensitivity of "ADD" button in new location dialog-box



commit 3b9b4f56ec6427f3271e650755fdf4944f10cb5c
Author: Saurabh_P <srp201201051 gmail com>
Date:   Mon Feb 17 19:06:47 2014 +0530

    Changing sensitivity of "ADD" button in new location dialog-box
    
    Connect to 'notify::location' signal of locationEntry and
    check if location is valid given in locationEntry and if it
    is not then make "Add" button insensitive otherwise make "Add" button sensitive.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724416

 src/window.js |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/window.js b/src/window.js
index ae62929..0c971a1 100644
--- a/src/window.js
+++ b/src/window.js
@@ -52,6 +52,7 @@ const NewLocationController = new Lang.Class({
         dialog.set_default_response(Gtk.ResponseType.OK);
 
         dialog.connect('response', Lang.bind(this, this._onResponse));
+        entry.connect('notify::location', Lang.bind(this, this._locationChanged));
 
         this._dialog = dialog;
         this._entry = entry;
@@ -59,6 +60,7 @@ const NewLocationController = new Lang.Class({
 
     run: function() {
         this._dialog.show();
+        this._locationChanged(this._entry);
     },
 
     _onResponse: function(dialog, response) {
@@ -72,6 +74,10 @@ const NewLocationController = new Lang.Class({
             return;
 
         this._worldModel.addLocation(location);
+    },
+
+    _locationChanged: function(entry) {
+       this._dialog.set_response_sensitive(Gtk.ResponseType.OK, entry.location != null);
     }
 });
 


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