From 1aba52ae2af0bea733b4fa0b2fa5e3fa3392d392 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Thu, 14 Aug 2014 17:46:19 -0700 Subject: 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] --- overrides/endless_private/topbar_nav_button.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'overrides') 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); -- cgit v1.2.3