summaryrefslogtreecommitdiff
path: root/wikipedia
diff options
context:
space:
mode:
authorRory MacQueen <rorymacqueen@gmail.com>2013-09-30 21:58:00 -0700
committerRory MacQueen <rorymacqueen@gmail.com>2013-10-01 16:08:12 -0700
commited8c15a21b0f5060c1403a80047bbd785ea7b511 (patch)
treea14a287354f6db70971e9031ffb83f14c5f73b6b /wikipedia
parente3c9ea1cb19dc4d381c263b718ffd24e5ef55438 (diff)
Styled top bar back button
Previously, the back button on the top window bar was not styled correctly according to designs. This commit changes the BackButton widget to now suclass Endless Asset Button and have the right styling. [endlessm/eos-sdk#301]
Diffstat (limited to 'wikipedia')
-rw-r--r--wikipedia/PrebuiltCategoryPage.js7
-rw-r--r--wikipedia/views/domain_wiki_view.js11
-rw-r--r--wikipedia/widgets/BackButton.js20
3 files changed, 20 insertions, 18 deletions
diff --git a/wikipedia/PrebuiltCategoryPage.js b/wikipedia/PrebuiltCategoryPage.js
index be20547..3ad3ebf 100644
--- a/wikipedia/PrebuiltCategoryPage.js
+++ b/wikipedia/PrebuiltCategoryPage.js
@@ -122,8 +122,7 @@ const PrebuiltCategoryPage = new Lang.Class({
normal_image_uri: "resource://com/endlessm/wikipedia-domain/assets/introduction_back_button_normal.png",
active_image_uri: "resource://com/endlessm/wikipedia-domain/assets/introduction_back_button_pressed.png",
prelight_image_uri: "resource://com/endlessm/wikipedia-domain/assets/introduction_back_button_hover.png",
- label: _("OTHER CATEGORIES"),
- name: "category_page_back_button"
+ label: _("OTHER CATEGORIES")
});
this._back_button.connect('clicked', Lang.bind(this, function() {
@@ -153,6 +152,10 @@ const PrebuiltCategoryPage = new Lang.Class({
this.add(this._outer_most_grid);
this._category_provider = new Gtk.CssProvider();
+
+ // Add style contexts for CSS
+ let context = this.get_style_context();
+ context.add_class(EndlessWikipedia.STYLE_CLASS_CATEGORY_PAGE);
},
get title() {
diff --git a/wikipedia/views/domain_wiki_view.js b/wikipedia/views/domain_wiki_view.js
index 90a29ff..ca0d6bd 100644
--- a/wikipedia/views/domain_wiki_view.js
+++ b/wikipedia/views/domain_wiki_view.js
@@ -1,18 +1,12 @@
const EndlessWikipedia = imports.wikipedia.EndlessWikipedia;
-const Gettext = imports.gettext;
-const GLib = imports.gi.GLib;
const Lang = imports.lang;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const Endless = imports.gi.Endless;
-const Config = imports.wikipedia.config;
const BackButton = imports.wikipedia.widgets.BackButton;
const SideBarButton = imports.wikipedia.widgets.SideBarButton;
-const _ = function(string) { return GLib.dgettext('eos-sdk', string); };
-Gettext.bindtextdomain('eos-sdk', Config.DATADIR + '/locale');
-
const SIDEBAR_BACK_BUTTON_URI = "/com/endlessm/wikipedia-domain/assets/image_strip_back_button.png";
const SUBMENU_SEPARATOR_A_URI = "/com/endlessm/wikipedia-domain/assets/submenu_separator_shadow_a.png";
const SUBMENU_SEPARATOR_B_URI = "/com/endlessm/wikipedia-domain/assets/submenu_separator_shadow_b.png";
@@ -142,12 +136,9 @@ const DomainWikiView = new Lang.Class({
this._category_page.add(this._category_view);
this._category_page.add(this._category_article_list);
- this._category_back_button = new BackButton.BackButton({
- label: _("HOME")
- });
+ this._category_back_button = new BackButton.BackButton();
this._category_back_button.show();
-
this._category_article_list.connect('article-chosen',
Lang.bind(this, this._onArticleClicked));
diff --git a/wikipedia/widgets/BackButton.js b/wikipedia/widgets/BackButton.js
index cfb3155..2d44e3f 100644
--- a/wikipedia/widgets/BackButton.js
+++ b/wikipedia/widgets/BackButton.js
@@ -1,18 +1,26 @@
+const Endless = imports.gi.Endless;
+const Gettext = imports.gettext;
+const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
+const Config = imports.wikipedia.config;
+
+const _ = function(string) { return GLib.dgettext('eos-sdk', string); };
+Gettext.bindtextdomain('eos-sdk', Config.DATADIR + '/locale');
+
+const BACK_BUTTON_URI = "resource://com/endlessm/wikipedia-domain/assets/topbar_back_icon_normal.png";
+
const BackButton = new Lang.Class({
Name: 'BackButton',
- Extends: Gtk.Button,
+ Extends: Endless.AssetButton,
_init: function(props) {
props = props || {};
- props.image = Gtk.Image.new_from_icon_name('go-previous-symbolic',
- Gtk.IconSize.BUTTON);
- props.always_show_image = true;
- // Don't do that. What should actually happen is the system-wide setting
- // that controls whether buttons show images should be changed.
+ props.label = _("BACK");
+ props.normal_image_uri = BACK_BUTTON_URI;
+
this.parent(props);
}
});