diff options
-rw-r--r-- | overrides/Endless.js | 12 | ||||
-rw-r--r-- | test/smoke-tests/action-buttons.js | 18 |
2 files changed, 20 insertions, 10 deletions
diff --git a/overrides/Endless.js b/overrides/Endless.js index 00315a3..8fadd94 100644 --- a/overrides/Endless.js +++ b/overrides/Endless.js @@ -15,4 +15,16 @@ function _init() { } } } + + // Override Endless.ActionMenu.add_action() so that we hide the use of + // GtkAction from the developer, as that will be deprecated in the future. + Endless.ActionMenu.prototype._add_action_real = Endless.ActionMenu.prototype.add_action; + Endless.ActionMenu.prototype.add_action = function(dict, callback) { + let action = new Gtk.Action(dict); + this._add_action_real(action); + + if (typeof callback === "function") { + action.connect('activate', callback); + } + } } diff --git a/test/smoke-tests/action-buttons.js b/test/smoke-tests/action-buttons.js index 54d0fc1..85499f9 100644 --- a/test/smoke-tests/action-buttons.js +++ b/test/smoke-tests/action-buttons.js @@ -15,13 +15,11 @@ const TestApplication = new Lang.Class ({ this._page = new Endless.ActionMenu(); - this._page.add_action (new Gtk.Action({ + this._page.add_action ({ name: 'select', 'icon-name': 'object-select-symbolic', label: 'select stuff', - 'is-important': true })); - - this._page.get_action('select').connect('activate', + 'is-important': true }, Lang.bind(this, function () { var md = new Gtk.MessageDialog({modal:true, title:"Information", message_type:Gtk.MessageType.INFO, @@ -30,23 +28,23 @@ const TestApplication = new Lang.Class ({ md.destroy(); })); - this._page.add_action (new Gtk.Action({ + this._page.add_action ({ name: 'delete', 'icon-name': 'edit-delete-symbolic', label: 'delete stuff', - 'is-important': false })); + 'is-important': false }); - this._page.add_action (new Gtk.Action({ + this._page.add_action ({ name: 'smile', 'icon-name': 'face-smile-symbolic', label: 'smile', - 'is-important': false })); + 'is-important': false }); - this._page.add_action (new Gtk.Action({ + this._page.add_action ({ name: 'sadface', 'icon-name': 'face-sad-symbolic', label: 'sadface', - 'is-important': false })); + 'is-important': false }); this._pm = new Endless.PageManager(); this._pm.add(this._page, { name: "page" }); |