diff options
-rw-r--r-- | data/css/endless-widgets.css | 4 | ||||
-rw-r--r-- | data/css/eos-wikipedia-domain.css | 9 | ||||
-rw-r--r-- | endless/eostopbar.c | 7 | ||||
-rw-r--r-- | endless/eoswindow.c | 3 | ||||
-rw-r--r-- | wikipedia/WikipediaWebView.js | 5 | ||||
-rw-r--r-- | wikipedia/presenters/domain_wiki_presenter.js | 14 | ||||
-rw-r--r-- | wikipedia/widgets/category_button.js | 26 |
7 files changed, 49 insertions, 19 deletions
diff --git a/data/css/endless-widgets.css b/data/css/endless-widgets.css index bfa2027..c820fbc 100644 --- a/data/css/endless-widgets.css +++ b/data/css/endless-widgets.css @@ -37,6 +37,10 @@ EosWindow { from(#464646), to(#1e1e1e)); } +.top-bar.unmaximized { + border-radius: 7px 7px 0px 0px; +} + .top-bar:backdrop { background-image: -gtk-gradient(linear, center top, center bottom, from(#282828), to(#1e1e1e)); diff --git a/data/css/eos-wikipedia-domain.css b/data/css/eos-wikipedia-domain.css index 50e3e71..df6aec6 100644 --- a/data/css/eos-wikipedia-domain.css +++ b/data/css/eos-wikipedia-domain.css @@ -82,15 +82,6 @@ Gjs_CategoryButton.clickable:hover { background-color: alpha(#212121, 0.5); } -Gjs_CategoryButton .image { - opacity: 0.0; - transition: opacity 150ms ease-in-out; -} - -Gjs_CategoryButton.clickable .image:hover { - opacity: 1.0; -} - #side_bar_button:hover { background-color: rgba(0, 0, 0, 0.2); } diff --git a/endless/eostopbar.c b/endless/eostopbar.c index 735ba6c..85f4753 100644 --- a/endless/eostopbar.c +++ b/endless/eostopbar.c @@ -18,6 +18,7 @@ * The action buttons area contain "minimize", "maximize" and "close" buttons. */ #define _EOS_STYLE_CLASS_TOP_BAR "top-bar" +#define _EOS_STYLE_CLASS_UNMAXIMIZED "unmaximized" #define _EOS_TOP_BAR_HEIGHT_PX 36 #define _EOS_TOP_BAR_BUTTON_PADDING_PX 4 #define _EOS_TOP_BAR_ICON_SIZE_PX 16 @@ -344,4 +345,10 @@ eos_top_bar_update_window_maximized (EosTopBar *self, gtk_image_set_from_icon_name (GTK_IMAGE (priv->maximize_icon), icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR); + + GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self)); + if (!is_maximized) + gtk_style_context_add_class (context, _EOS_STYLE_CLASS_UNMAXIMIZED); + else + gtk_style_context_remove_class (context, _EOS_STYLE_CLASS_UNMAXIMIZED); } diff --git a/endless/eoswindow.c b/endless/eoswindow.c index cdf0fc7..ce95ae8 100644 --- a/endless/eoswindow.c +++ b/endless/eoswindow.c @@ -760,7 +760,7 @@ on_close_clicked_cb (GtkWidget *top_bar, gtk_window_close (GTK_WINDOW (self)); } -static void +static gboolean on_window_state_event_cb (GtkWidget *widget, GdkEventWindowState *event) { @@ -769,6 +769,7 @@ on_window_state_event_cb (GtkWidget *widget, GdkWindowState window_state = event->new_window_state; priv->maximized = window_state & GDK_WINDOW_STATE_MAXIMIZED; eos_top_bar_update_window_maximized (EOS_TOP_BAR (priv->top_bar), priv->maximized); + return FALSE; } /* Make sure that the edge finishing does not catch input events */ diff --git a/wikipedia/WikipediaWebView.js b/wikipedia/WikipediaWebView.js index 4fd6ee6..771a38c 100644 --- a/wikipedia/WikipediaWebView.js +++ b/wikipedia/WikipediaWebView.js @@ -137,13 +137,14 @@ const WikipediaWebView = new Lang.Class({ let suffix = parts[parts.length - 1]; let id = decodeURI(suffix); this.loadArticleById(id); - return true; + decision.ignore(); + return true; // handled } else if (GLib.uri_parse_scheme(uri).startsWith('browser-')) { // Open everything that starts with 'browser-' in the system // browser let realURI = uri.slice('browser-'.length); - printerr('Showing', realURI); Gtk.show_uri(null, realURI, Gdk.CURRENT_TIME); + decision.ignore(); return true; // handled } } diff --git a/wikipedia/presenters/domain_wiki_presenter.js b/wikipedia/presenters/domain_wiki_presenter.js index 764bb17..736158d 100644 --- a/wikipedia/presenters/domain_wiki_presenter.js +++ b/wikipedia/presenters/domain_wiki_presenter.js @@ -1,6 +1,7 @@ const Endless = imports.gi.Endless; const Lang = imports.lang; const GObject = imports.gi.GObject; +const System = imports.system; //Local Libraries const Utils = imports.wikipedia.utils; @@ -67,8 +68,17 @@ const DomainWikiPresenter = new Lang.Class({ }, initAppInfoFromJsonFile: function(filename) { - let app_content = JSON.parse(Utils.load_file_from_resource(filename)); - this._model.loadFromJson(app_content); + try { + let app_content = JSON.parse(Utils.load_file_from_resource(filename)); + this._model.loadFromJson(app_content); + } catch(e) { + print(e); + if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND)) { + print("****** This app does not support the personality", + Endless.get_system_personality(), "******"); + } + System.exit(1); + } }, // Respond to the front page's 'category-clicked' signal by loading the diff --git a/wikipedia/widgets/category_button.js b/wikipedia/widgets/category_button.js index 08ce2ed..cafa7a6 100644 --- a/wikipedia/widgets/category_button.js +++ b/wikipedia/widgets/category_button.js @@ -96,6 +96,26 @@ const CategoryButton = new Lang.Class({ this._inner_grid.add(this._arrow); this.add(this._inner_grid); this.show_all(); + + // For some reason, on the NUC, setting opacity in CSS for this button does not work. + // So we have to set it in Gtk code. Also, we have to set the opacity + // to zero upfront. I am putting that here instead of in the initialisation + // of the arrow since it is part of this NUC-specific hack + this._arrow.connect('state-flags-changed', Lang.bind(this, this._update_appearance)); + this._arrow.set_opacity(0) + }, + + _update_appearance: function(widget) { + // If button is hovered over and/or pressed, then show the arrow icon + if ((widget.get_state_flags() & Gtk.StateFlags.ACTIVE || + widget.get_state_flags() & Gtk.StateFlags.PRELIGHT) && + this._clickable_category) { + this._arrow.set_opacity(1); + return false; + } + // If no hover or press, then hide the arrow icon + this._arrow.set_opacity(0); + return false; }, get image_uri() { @@ -122,11 +142,7 @@ const CategoryButton = new Lang.Class({ set clickable_category(value) { this._clickable_category = value; - if(this._clickable_category) { - this.get_style_context().add_class(EndlessWikipedia.STYLE_CLASS_CATEGORY_CLICKABLE); - } else { - this.get_style_context().remove_class(EndlessWikipedia.STYLE_CLASS_CATEGORY_CLICKABLE); - } + this._update_appearance(this._arrow); }, get is_main_category() { |