[gnome-calendar/wip/gbsneto/dnd: 14/14] year-view: don't render DnD when it leaves



commit 88730dbafbb1d7e0e57ecc0806e37b45b026581d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat May 21 18:51:03 2016 -0300

    year-view: don't render DnD when it leaves

 data/ui/year-view.ui |    1 +
 src/gcal-year-view.c |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/year-view.ui b/data/ui/year-view.ui
index 23b75e7..4fdb787 100644
--- a/data/ui/year-view.ui
+++ b/data/ui/year-view.ui
@@ -26,6 +26,7 @@
                 <signal name="motion-notify-event" handler="navigator_motion_notify_cb" 
object="GcalYearView" swapped="yes"/>
                 <signal name="drag-motion" handler="navigator_drag_motion_cb" object="GcalYearView" 
swapped="yes"/>
                 <signal name="drag-drop" handler="navigator_drag_drop_cb" object="GcalYearView" 
swapped="yes"/>
+                <signal name="drag-leave" handler="navigator_drag_leave_cb" object="GcalYearView" 
swapped="yes"/>
                 <style>
                   <class name="year-navigator"/>
                 </style>
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 1e7a50c..79911f1 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -1376,6 +1376,19 @@ navigator_drag_drop_cb (GcalYearView   *self,
 }
 
 static void
+navigator_drag_leave_cb (GcalYearView   *self,
+                         GdkDragContext *context,
+                         guint           time,
+                         GtkWidget      *navigator)
+{
+  /* Cancel the DnD after the event is dropped */
+  self->selected_data->dnd_day = -1;
+  self->selected_data->dnd_month = -1;
+
+  gtk_widget_queue_draw (navigator);
+}
+
+static void
 gcal_year_view_finalize (GObject *object)
 {
   GcalYearView *year_view = GCAL_YEAR_VIEW (object);
@@ -1770,6 +1783,7 @@ gcal_year_view_class_init (GcalYearViewClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, navigator_button_press_cb);
   gtk_widget_class_bind_template_callback (widget_class, navigator_button_release_cb);
   gtk_widget_class_bind_template_callback (widget_class, navigator_drag_drop_cb);
+  gtk_widget_class_bind_template_callback (widget_class, navigator_drag_leave_cb);
   gtk_widget_class_bind_template_callback (widget_class, navigator_drag_motion_cb);
   gtk_widget_class_bind_template_callback (widget_class, navigator_motion_notify_cb);
   gtk_widget_class_bind_template_callback (widget_class, add_event_clicked_cb);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]