summaryrefslogtreecommitdiff
path: root/wikipedia/PrebuiltCategoryPage.js
diff options
context:
space:
mode:
authorPhilip Chimento <philip@endlessm.com>2014-01-20 17:51:02 -0200
committerPhilip Chimento <philip@endlessm.com>2014-01-22 22:33:34 -0200
commit46b36cd29f5dd4fe7aefce1e2edb668c3254cee6 (patch)
tree2d058f9667f968548545611249f757bc9df8d016 /wikipedia/PrebuiltCategoryPage.js
parent4d7b0cb396f5a1992aacf077bcd893758cbc9b1f (diff)
Move category back button to its own class
For better code organization and cleaner CSS; add style classes. [endlessm/eos-sdk#504]
Diffstat (limited to 'wikipedia/PrebuiltCategoryPage.js')
-rw-r--r--wikipedia/PrebuiltCategoryPage.js30
1 files changed, 2 insertions, 28 deletions
diff --git a/wikipedia/PrebuiltCategoryPage.js b/wikipedia/PrebuiltCategoryPage.js
index debf6a8..fdae4f2 100644
--- a/wikipedia/PrebuiltCategoryPage.js
+++ b/wikipedia/PrebuiltCategoryPage.js
@@ -1,27 +1,19 @@
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 BoxWithBg = imports.wikipedia.widgets.BoxWithBg;
-const CompositeButton = imports.wikipedia.widgets.composite_button;
-const Config = imports.wikipedia.config;
+const CategoryBackButton = imports.wikipedia.widgets.category_back_button;
const FixedSizeTextView = imports.wikipedia.widgets.FixedSizeTextView;
const ScaledImage = imports.wikipedia.widgets.scaled_image;
const SHADOW_SEPARATOR_RESOURCE_PATH = "/com/endlessm/wikipedia-domain/assets/submenu_separator_shadow_a.png";
const INTRO_TITLE_SEPARATOR_URI = "/com/endlessm/wikipedia-domain/assets/introduction_title_separator.png";
-const CATEGORY_BACK_BUTTON_ASSET_RESOURCE_URI = 'resource:///com/endlessm/wikipedia-domain/assets/wikipedia-category-back-symbolic.svg';
-const CATEGORY_BACK_BUTTON_SIZE_PIXELS = 68;
const LEFT_MARGIN_FOR_TEXT = 45;
GObject.ParamFlags.READWRITE = GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE;
-const _ = function(string) { return GLib.dgettext('eos-sdk', string); };
-Gettext.bindtextdomain('eos-sdk', Config.DATADIR + '/locale');
-
function _resourceUriToPath(uri) {
if(uri.startsWith('resource://'))
return uri.slice('resource://'.length);
@@ -121,30 +113,12 @@ const PrebuiltCategoryPage = new Lang.Class({
this._description_scrolled_window.set_policy(Gtk.PolicyType.NEVER,
Gtk.PolicyType.AUTOMATIC);
- let gicon = new Gio.FileIcon({
- file: Gio.File.new_for_uri(CATEGORY_BACK_BUTTON_ASSET_RESOURCE_URI)
- });
- let backButtonIcon = Gtk.Image.new_from_gicon(gicon,
- Gtk.IconSize.DIALOG);
- backButtonIcon.pixel_size = CATEGORY_BACK_BUTTON_SIZE_PIXELS;
- let backButtonLabel = new Gtk.Label({
- label: _("OTHER CATEGORIES")
- });
- let backButtonInnerGrid = new Gtk.Grid();
- this._back_button = new CompositeButton.CompositeButton({
+ this._back_button = new CategoryBackButton.CategoryBackButton({
name: "category-back-button",
expand: true,
halign: Gtk.Align.START,
valign: Gtk.Align.CENTER
});
- backButtonInnerGrid.add(backButtonIcon);
- backButtonInnerGrid.add(backButtonLabel);
- this._back_button.add(backButtonInnerGrid);
- this._back_button.setSensitiveChildren([
- backButtonIcon,
- backButtonLabel
- ]);
-
this._back_button.connect('clicked', Lang.bind(this, function() {
this.emit('go-back-home');
}));