summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--data/css/eos-wikipedia-domain.css4
-rw-r--r--endless/eosflexygrid.c17
-rw-r--r--endless/eosflexygridcell.c17
-rw-r--r--endless/eoswindow.c32
-rw-r--r--wikipedia/EndlessWikipedia.js1
-rw-r--r--wikipedia/widgets/category_button.js66
7 files changed, 34 insertions, 107 deletions
diff --git a/configure.ac b/configure.ac
index 0bdaff2..0458a57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,10 +76,10 @@ AC_SUBST(EOS_SDK_LT_VERSION_INFO)
# Required versions of libraries
# Update these whenever you use a function that requires a certain API version
-GLIB_REQUIREMENT="glib-2.0 >= 2.36"
+GLIB_REQUIREMENT="glib-2.0 >= 2.38"
GOBJECT_REQUIREMENT="gobject-2.0"
GIO_REQUIREMENT="gio-2.0"
-GTK_REQUIREMENT="gtk+-3.0 >= 3.4"
+GTK_REQUIREMENT="gtk+-3.0 >= 3.10"
# These go into the pkg-config file as Requires: and Requires.private:
# (Generally, use Requires.private: instead of Requires:)
EOS_REQUIRED_MODULES=
diff --git a/data/css/eos-wikipedia-domain.css b/data/css/eos-wikipedia-domain.css
index 932fb8b..0ad1954 100644
--- a/data/css/eos-wikipedia-domain.css
+++ b/data/css/eos-wikipedia-domain.css
@@ -71,11 +71,11 @@ Gjs_ArticleList .scrollbar.slider {
color: rgba(255, 255, 255, 0.9);
}
-Gjs_CategoryButton GtkEventBox {
+Gjs_CategoryButton.clickable {
transition: background-color 1000ms ease-in-out;
}
-Gjs_CategoryButton GtkEventBox:hover {
+Gjs_CategoryButton.clickable:hover {
background-color: alpha(#212121, 0.5);
transition: background-color 100ms ease-in-out;
}
diff --git a/endless/eosflexygrid.c b/endless/eosflexygrid.c
index d831163..81cf3ba 100644
--- a/endless/eosflexygrid.c
+++ b/endless/eosflexygrid.c
@@ -63,22 +63,11 @@ enum
LAST_SIGNAL
};
-#if GLIB_CHECK_VERSION (2, 37, 5)
-
-# define EOS_FLEXY_GRID_GET_PRIV(obj) \
+#define EOS_FLEXY_GRID_GET_PRIV(obj) \
((EosFlexyGridPrivate *) eos_flexy_grid_get_instance_private ((EosFlexyGrid *) (obj)))
G_DEFINE_TYPE_WITH_PRIVATE (EosFlexyGrid, eos_flexy_grid, GTK_TYPE_CONTAINER)
-#else
-
-# define EOS_FLEXY_GRID_GET_PRIV(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EOS_TYPE_FLEXY_GRID, EosFlexyGridPrivate))
-
-G_DEFINE_TYPE (EosFlexyGrid, eos_flexy_grid, GTK_TYPE_CONTAINER)
-
-#endif /* GLIB_CHECK_VERSION (2, 37, 5) */
-
static guint grid_signals[LAST_SIGNAL] = { 0, };
static GParamSpec *grid_props[LAST_PROP] = { NULL, };
@@ -852,10 +841,6 @@ eos_flexy_grid_finalize (GObject *gobject)
static void
eos_flexy_grid_class_init (EosFlexyGridClass *klass)
{
-#if !GLIB_CHECK_VERSION (2, 37, 5)
- g_type_class_add_private (klass, sizeof (EosFlexyGridPrivate));
-#endif
-
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = eos_flexy_grid_finalize;
gobject_class->set_property = eos_flexy_grid_set_property;
diff --git a/endless/eosflexygridcell.c b/endless/eosflexygridcell.c
index 4091f06..726c7f1 100644
--- a/endless/eosflexygridcell.c
+++ b/endless/eosflexygridcell.c
@@ -21,22 +21,11 @@ typedef struct {
guint selected : 1;
} EosFlexyGridCellPrivate;
-#if GLIB_CHECK_VERSION (2, 37, 5)
-
-# define EOS_FLEXY_GRID_CELL_GET_PRIV(obj) \
+#define EOS_FLEXY_GRID_CELL_GET_PRIV(obj) \
((EosFlexyGridCellPrivate *) eos_flexy_grid_cell_get_instance_private ((EosFlexyGridCell *) (obj)))
G_DEFINE_TYPE_WITH_PRIVATE (EosFlexyGridCell, eos_flexy_grid_cell, GTK_TYPE_BIN)
-#else
-
-# define EOS_FLEXY_GRID_CELL_GET_PRIV(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EOS_TYPE_FLEXY_GRID_CELL, EosFlexyGridCellPrivate))
-
-G_DEFINE_TYPE (EosFlexyGridCell, eos_flexy_grid_cell, GTK_TYPE_BIN)
-
-#endif /* GLIB_CHECK_VERSION (2, 37, 5) */
-
enum
{
PROP_0,
@@ -90,10 +79,6 @@ eos_flexy_grid_cell_get_property (GObject *gobject,
static void
eos_flexy_grid_cell_class_init (EosFlexyGridCellClass *klass)
{
-#if !GLIB_CHECK_VERSION (2, 37, 6)
- g_type_class_add_private (klass, sizeof (EosFlexyGridCellPrivate));
-#endif
-
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = eos_flexy_grid_cell_set_property;
gobject_class->get_property = eos_flexy_grid_cell_get_property;
diff --git a/endless/eoswindow.c b/endless/eoswindow.c
index 923de63..6258d8b 100644
--- a/endless/eoswindow.c
+++ b/endless/eoswindow.c
@@ -570,36 +570,6 @@ eos_window_class_init (EosWindowClass *klass)
g_object_class_install_properties (object_class, NPROPS, eos_window_props);
}
-#if GTK_CHECK_VERSION (3, 10, 0)
-#define our_window_close(w) gtk_window_close (w)
-#else
-static gboolean
-queue_close (gpointer user_data)
-{
- GtkWidget *window = user_data;
-
- GdkEvent *event = gdk_event_new (GDK_DELETE);
-
- event->any.window = gtk_widget_get_window (window);
- event->any.send_event = TRUE;
-
- gtk_main_do_event (event);
-
- gdk_event_free (event);
-
- return G_SOURCE_REMOVE;
-}
-
-static void
-our_window_close (GtkWindow *window)
-{
- if (!gtk_widget_get_realized (GTK_WIDGET (window)))
- return;
-
- gdk_threads_add_idle (queue_close, window);
-}
-#endif /* GTK_CHECK_VERSION (3, 10, 0) */
-
static void
on_minimize_clicked_cb (GtkWidget* top_bar)
{
@@ -613,7 +583,7 @@ on_close_clicked_cb (GtkWidget* top_bar)
{
GtkWidget *window = gtk_widget_get_toplevel (top_bar);
- our_window_close (GTK_WINDOW (window));
+ gtk_window_close (GTK_WINDOW (window));
}
/* Make sure that the edge finishing does not catch input events */
diff --git a/wikipedia/EndlessWikipedia.js b/wikipedia/EndlessWikipedia.js
index 2767e61..cba5c3e 100644
--- a/wikipedia/EndlessWikipedia.js
+++ b/wikipedia/EndlessWikipedia.js
@@ -13,6 +13,7 @@ const STYLE_CLASS_TITLE = 'title';
const STYLE_CLASS_MAIN = 'main-element';
const STYLE_CLASS_PREBUILT = 'prebuilt';
const STYLE_CLASS_CATEGORY = 'category';
+const STYLE_CLASS_CATEGORY_CLICKABLE = 'clickable';
const STYLE_CLASS_ARTICLE = 'article';
const STYLE_CLASS_FRONT_PAGE = 'front-page';
const STYLE_CLASS_CATEGORY_PAGE = 'category-page';
diff --git a/wikipedia/widgets/category_button.js b/wikipedia/widgets/category_button.js
index 667a816..1cc6572 100644
--- a/wikipedia/widgets/category_button.js
+++ b/wikipedia/widgets/category_button.js
@@ -21,7 +21,7 @@ GObject.ParamFlags.READWRITE = GObject.ParamFlags.READABLE | GObject.ParamFlags.
const CategoryButton = new Lang.Class({
Name: 'CategoryButton',
- Extends: Gtk.EventBox,
+ Extends: Gtk.Button,
Properties: {
// resource URI for the category's accompanying image
'image-uri': GObject.ParamSpec.string('image-uri',
@@ -51,9 +51,6 @@ const CategoryButton = new Lang.Class({
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
false)
},
- Signals: {
- 'clicked': {}
- },
_init: function(props) {
// Get ready for property construction
@@ -63,19 +60,14 @@ const CategoryButton = new Lang.Class({
this._is_main_category = null;
this._pixbuf = null;
- this._eventbox = new Gtk.EventBox({
+ this._overlay = new Gtk.Overlay({
expand: true
});
- this._eventbox_grid = new Gtk.Grid({
- orientation: Gtk.Orientation.HORIZONTAL,
- hexpand: true,
- valign: Gtk.Align.END
- });
this._label = new Gtk.Label({
margin_left: CATEGORY_LABEL_LEFT_MARGIN,
margin_bottom: CATEGORY_LABEL_BOTTOM_MARGIN - CATEGORY_LABEL_BASELINE_CORRECTION,
- hexpand: true,
halign: Gtk.Align.START,
+ valign: Gtk.Align.END,
xalign: 0.0, // deprecated Gtk.Misc properties; necessary because
wrap: true, // "wrap" doesn't respect "halign"
width_chars: 18,
@@ -86,8 +78,12 @@ const CategoryButton = new Lang.Class({
margin_right: CATEGORY_BUTTON_RIGHT_MARGIN,
margin_bottom: CATEGORY_BUTTON_BOTTOM_MARGIN + CATEGORY_BUTTON_BASELINE_CORRECTION,
halign: Gtk.Align.END,
- valign: Gtk.Align.END,
- opacity: 0
+ valign: Gtk.Align.END
+ });
+ // Make the arrow image transparent to mouse events
+ this._arrow.connect_after('realize', function (frame) {
+ let gdk_window = frame.get_window();
+ gdk_window.set_child_input_shapes();
});
let context = this._label.get_style_context();
@@ -99,15 +95,21 @@ const CategoryButton = new Lang.Class({
this.parent(props);
// Put widgets together
- this._eventbox_grid.add(this._label);
- this._eventbox_grid.add(this._arrow);
- this._eventbox.add(this._eventbox_grid);
- this.add(this._eventbox);
+ let alignment = new Gtk.Alignment({ expand: true });
+ alignment.add(this._label);
+ this._overlay.add(alignment);
+ this._overlay.add_overlay(this._arrow);
+ this.add(this._overlay);
this.show_all();
-
- // Connect signals
- this.connect('button-press-event',
- Lang.bind(this, this._onButtonPress));
+ this._arrow.hide();
+
+ this.connect("enter", Lang.bind(this, function (w) {
+ if(this._clickable_category)
+ this._arrow.show();
+ }));
+ this.connect("leave", Lang.bind(this, function (w) {
+ this._arrow.hide();
+ }));
},
get image_uri() {
@@ -135,19 +137,9 @@ const CategoryButton = new Lang.Class({
set clickable_category(value) {
this._clickable_category = value;
if(this._clickable_category) {
- //Hover events/effects only trigger if the button is clickable.
- this._eventbox.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK |
- Gdk.EventMask.LEAVE_NOTIFY_MASK);
- this._eventbox.connect('enter-notify-event',
- Lang.bind(this, function(widget, event) {
- this._eventbox.set_state_flags(Gtk.StateFlags.PRELIGHT, false);
- this._arrow.opacity = 1.0;
- }));
- this._eventbox.connect('leave-notify-event',
- Lang.bind(this, function(widget, event) {
- this._eventbox.unset_state_flags(Gtk.StateFlags.PRELIGHT);
- this._arrow.opacity = 0.0;
- }));
+ this.get_style_context().add_class(EndlessWikipedia.STYLE_CLASS_CATEGORY_CLICKABLE);
+ } else {
+ this.get_style_context().remove_class(EndlessWikipedia.STYLE_CLASS_CATEGORY_CLICKABLE);
}
},
@@ -203,11 +195,5 @@ const CategoryButton = new Lang.Class({
// a better fix in the future, i.e. fix this through gjs.
cr.$dispose();
return ret;
- },
-
- // HANDLERS
-
- _onButtonPress: function(widget, event) {
- this.emit('clicked')
}
});