[gnome-shell/wip/gtk-notification: 11/22] messageTray: Replace setButtonSensitive by simply returning the button



commit 4a3ebba943416a12da7e99ff0e84e7e8e5ad2a15
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Oct 13 22:56:26 2013 -0400

    messageTray: Replace setButtonSensitive by simply returning the button

 js/ui/messageTray.js      |   23 +----------------------
 js/ui/status/bluetooth.js |   11 +++++------
 2 files changed, 6 insertions(+), 28 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 4f86143..c577032 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -859,7 +859,6 @@ const Notification = new Lang.Class({
         }
 
         let button = new St.Button({ can_focus: true });
-        button._actionId = id;
 
         let iconName = strHasSuffix(id, '-symbolic') ? id : id + '-symbolic';
         if (this._useActionIcons && Gtk.IconTheme.get_default().has_icon(iconName)) {
@@ -874,27 +873,7 @@ const Notification = new Lang.Class({
         button.connect('clicked', Lang.bind(this, this._onActionInvoked, id));
 
         this.updated();
-    },
-
-    // setButtonSensitive:
-    // @id: the action ID
-    // @sensitive: whether the button should be sensitive
-    //
-    // If the notification contains a button with action ID @id,
-    // its sensitivity will be set to @sensitive. Insensitive
-    // buttons cannot be clicked.
-    setButtonSensitive: function(id, sensitive) {
-        if (!this._buttonBox)
-            return;
-
-        let button = this._buttonBox.get_children().filter(function(b) {
-            return b._actionId == id;
-        })[0];
-
-        if (!button || button.reactive == sensitive)
-            return;
-
-        button.reactive = sensitive;
+        return button;
     },
 
     setUrgency: function(urgency) {
diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js
index fb4bad2..718a866 100644
--- a/js/ui/status/bluetooth.js
+++ b/js/ui/status/bluetooth.js
@@ -217,14 +217,13 @@ const PinNotification = new Lang.Class({
         }));
         this.addActor(this._entry);
 
-        this.addButton('ok', _("OK"));
+        let okButton = this.addButton('ok', _("OK"));
         this.addButton('cancel', _("Cancel"));
 
-        this.setButtonSensitive('ok', this._canActivateOkButton());
-        this._entry.clutter_text.connect('text-changed', Lang.bind(this,
-            function() {
-                this.setButtonSensitive('ok', this._canActivateOkButton());
-            }));
+        okButton.reactive = this._canActivateOkButton();
+        this._entry.clutter_text.connect('text-changed', Lang.bind(this, function() {
+            okButton.reactive = this._canActivateOkButton();
+        }));
 
         this.connect('action-invoked', Lang.bind(this, function(self, action) {
             if (action == 'ok') {


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