[gnome-shell] [InfoBar] Allow to optionally change the button label



commit d1108e1e7de3768ae385dbfeefef630ec058d056
Author: Florian Müllner <fmuellner src gnome org>
Date:   Wed Mar 10 15:14:56 2010 +0100

    [InfoBar] Allow to optionally change the button label
    
    Currently the infoBar's button will always read "Undo" - sometimes
    a different label makes more sense, so allow to optionally set the
    label to something else.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=612200

 js/ui/overview.js |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index cf3b574..070d676 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -89,8 +89,7 @@ InfoBar.prototype = {
                                   x_fill: true,
                                   y_fill: false });
         this._label = new St.Label();
-        this._undo = new St.Button({ label: _("Undo"),
-                                     style_class: 'info-bar-link-button' });
+        this._undo = new St.Button({ style_class: 'info-bar-link-button' });
 
         let bin = new St.Bin({ x_fill: false,
                                y_fill: false,
@@ -153,7 +152,7 @@ InfoBar.prototype = {
             this._overviewWasHidden = true;
     },
 
-    setMessage: function(text, undoCallback) {
+    setMessage: function(text, undoCallback, undoLabel) {
         if (this._timeoutId)
             Mainloop.source_remove(this._timeoutId);
 
@@ -177,6 +176,11 @@ InfoBar.prototype = {
 
         this._timeoutId = Mainloop.timeout_add_seconds(INFO_BAR_HIDE_TIMEOUT, Lang.bind(this, this._onTimeout));
 
+        if (undoLabel)
+            this._undo.label = undoLabel;
+        else
+            this._undo.label = _("Undo");
+
         this._undoCallback = undoCallback;
         if (undoCallback)
             this._undo.show();



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