[gnome-calendar] month-view: hide overflow popover on drag and drop
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] month-view: hide overflow popover on drag and drop
- Date: Wed, 28 Sep 2016 00:49:23 +0000 (UTC)
commit 97f8979c535665dda1f7d7e66572d52ea2220888
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Sep 27 21:48:07 2016 -0300
month-view: hide overflow popover on drag and drop
When the user starts a drag operation from the overflow popover,
it should hide itself, otherwise it can block dropping the event
below it. Currently, this is not what happens.
Fix that by making the overflow popover a drag and drop target,
and hide it when it detects drag movement.
https://bugzilla.gnome.org/show_bug.cgi?id=771663
src/gcal-month-view.c | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index 6f90bec..f32f8fa 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -838,9 +838,14 @@ gcal_month_view_drag_motion (GtkWidget *widget,
/* Setup the drag highlight */
if (priv->dnd_cell != -1)
- gtk_drag_highlight (widget);
+ {
+ gtk_drag_highlight (widget);
+ gtk_widget_hide (priv->overflow_popover);
+ }
else
- gtk_drag_unhighlight (widget);
+ {
+ gtk_drag_unhighlight (widget);
+ }
/*
* Sets the status of the drag - if it fails, sets the action to 0 and
@@ -950,6 +955,14 @@ gcal_month_view_drag_leave (GtkWidget *widget,
gtk_widget_queue_draw (widget);
}
+static gboolean
+cancel_dnd_from_overflow_popover (GtkWidget *popover)
+{
+ gtk_widget_hide (popover);
+
+ return FALSE;
+}
+
static void
add_new_event_button_cb (GtkWidget *button,
gpointer user_data)
@@ -1028,6 +1041,10 @@ gcal_month_view_init (GcalMonthView *self)
priv->overflow_popover = gtk_popover_new (GTK_WIDGET (self));
gtk_style_context_add_class (gtk_widget_get_style_context (priv->overflow_popover), "events");
g_signal_connect (priv->overflow_popover, "hide", G_CALLBACK (overflow_popover_hide), self);
+ g_signal_connect_swapped (priv->overflow_popover,
+ "drag-motion",
+ G_CALLBACK (cancel_dnd_from_overflow_popover),
+ priv->overflow_popover);
grid = gtk_grid_new ();
g_object_set (grid, "row-spacing", 6, "orientation", GTK_ORIENTATION_VERTICAL, NULL);
@@ -1053,6 +1070,17 @@ gcal_month_view_init (GcalMonthView *self)
NULL,
0,
GDK_ACTION_MOVE);
+
+ /*
+ * Also set the overflow popover as a drop destination, so we can hide
+ * it when the user starts dragging an event that is inside the overflow
+ * list.
+ */
+ gtk_drag_dest_set (GTK_WIDGET (priv->overflow_popover),
+ 0,
+ NULL,
+ 0,
+ GDK_ACTION_MOVE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]