summaryrefslogtreecommitdiff
path: root/overrides
diff options
context:
space:
mode:
authorPhilip Chimento <philip@endlessm.com>2014-08-14 17:46:19 -0700
committerPhilip Chimento <philip@endlessm.com>2014-08-14 17:46:19 -0700
commit1aba52ae2af0bea733b4fa0b2fa5e3fa3392d392 (patch)
treee303df3a412f674739a07f923bba349b960839bd /overrides
parentd5aef18db5e45e45df2bdbaf185630ba3dfa7abf (diff)
Refactor code for back and forward into loop
Code that should be applied to both the back and the forward button is refactored into a foreach loop over an array containing the two buttons. This is to avoid lots of duplicated code in the next commit. [endlessm/eos-sdk#1483]
Diffstat (limited to 'overrides')
-rw-r--r--overrides/endless_private/topbar_nav_button.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/overrides/endless_private/topbar_nav_button.js b/overrides/endless_private/topbar_nav_button.js
index 2f77eea..7af7c07 100644
--- a/overrides/endless_private/topbar_nav_button.js
+++ b/overrides/endless_private/topbar_nav_button.js
@@ -26,12 +26,14 @@ const TopbarNavButton = new Lang.Class({
Gtk.IconSize.SMALL_TOOLBAR);
this._forward_button = Gtk.Button.new_from_icon_name('topbar-go-next-symbolic',
Gtk.IconSize.SMALL_TOOLBAR);
- this._back_button.can_focus = false;
- this._forward_button.can_focus = false;
+
this._back_button.get_style_context().add_class('back');
- this._back_button.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED);
this._forward_button.get_style_context().add_class('forward');
- this._forward_button.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED);
+
+ [this._back_button, this._forward_button].forEach(function (button) {
+ button.can_focus = false;
+ button.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED);
+ });
this.add(this._back_button);
this.add(this._forward_button);