[nautilus] view-icon-controller: Use event box for click handling
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] view-icon-controller: Use event box for click handling
- Date: Fri, 10 Mar 2017 14:26:42 +0000 (UTC)
commit 08e6082974e826f348b444e7fff653ee6d985df8
Author: Carlos Soriano <csoriano gnome org>
Date: Fri Mar 10 15:20:09 2017 +0100
view-icon-controller: Use event box for click handling
Either we expand the GtkFlowBox making the icons scarce around, or
we need to handle ourselves the mouse events with an event box on top
of it.
Ideally GtkFlowBox would expand but have a property to pack the
children. This will be possible in gtk4 when GtkContainer is an
interface and GtkFlowBox implements it, but being able to have an
overlay on top that will handle these clicks outside of the actual area
and also the rubber band selection.
src/nautilus-view-icon-controller.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index 908539e..b432363 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -16,6 +16,7 @@ struct _NautilusViewIconController
NautilusViewIconUi *view_ui;
NautilusViewModel *model;
+ GtkEventBox *event_box;
GIcon *view_icon;
GActionGroup *action_group;
@@ -816,13 +817,16 @@ constructed (GObject *object)
self->model = nautilus_view_model_new ();
self->view_ui = nautilus_view_icon_ui_new (self);
- g_signal_connect_after (GTK_WIDGET (self->view_ui), "button-press-event",
- (GCallback) on_button_press_event, self);
gtk_widget_show (GTK_WIDGET (self->view_ui));
self->view_icon = g_themed_icon_new ("view-grid-symbolic");
+ self->event_box = GTK_EVENT_BOX (gtk_event_box_new ());
+ gtk_container_add (GTK_CONTAINER (self->event_box), GTK_WIDGET (self->view_ui));
+ g_signal_connect (GTK_WIDGET (self->event_box), "button-press-event",
+ (GCallback) on_button_press_event, self);
+
content_widget = nautilus_files_view_get_content_widget (NAUTILUS_FILES_VIEW (self));
- gtk_container_add (GTK_CONTAINER (content_widget), GTK_WIDGET (self->view_ui));
+ gtk_container_add (GTK_CONTAINER (content_widget), GTK_WIDGET (self->event_box));
self->action_group = nautilus_files_view_get_action_group (NAUTILUS_FILES_VIEW (self));
g_action_map_add_action_entries (G_ACTION_MAP (self->action_group),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]