[gnome-todo/wip/gbsneto/subtasks] task-list-view: delegate DnD to GtdDndRow
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo/wip/gbsneto/subtasks] task-list-view: delegate DnD to GtdDndRow
- Date: Fri, 14 Oct 2016 13:26:21 +0000 (UTC)
commit 4a5fc0e841670c723084600fccb777be2443923d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Oct 14 10:26:36 2016 -0300
task-list-view: delegate DnD to GtdDndRow
src/gtd-dnd-row.c | 4 ++--
src/gtd-dnd-row.h | 11 +++++++++++
src/gtd-task-list-view.c | 26 +++++++++++++++-----------
3 files changed, 28 insertions(+), 13 deletions(-)
---
diff --git a/src/gtd-dnd-row.c b/src/gtd-dnd-row.c
index 72df094..ba73cd8 100644
--- a/src/gtd-dnd-row.c
+++ b/src/gtd-dnd-row.c
@@ -126,7 +126,7 @@ gtd_dnd_row_drag_leave (GtkWidget *widget,
self->has_dnd = FALSE;
}
-static gboolean
+gboolean
gtd_dnd_row_drag_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
@@ -162,7 +162,7 @@ gtd_dnd_row_drag_motion (GtkWidget *widget,
return TRUE;
}
-static gboolean
+gboolean
gtd_dnd_row_drag_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
diff --git a/src/gtd-dnd-row.h b/src/gtd-dnd-row.h
index 338e34f..d52775d 100644
--- a/src/gtd-dnd-row.h
+++ b/src/gtd-dnd-row.h
@@ -37,6 +37,17 @@ void gtd_dnd_row_set_row_above (GtdDndRow
GtdTaskRow *row);
+gboolean gtd_dnd_row_drag_drop (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time);
+
+gboolean gtd_dnd_row_drag_motion (GtkWidget *widget,
+ GdkDragContext *context,
+ gint x,
+ gint y,
+ guint time);
gboolean gtd_dnd_row_has_dnd (GtdDndRow *self);
diff --git a/src/gtd-task-list-view.c b/src/gtd-task-list-view.c
index 71cc805..325c9b2 100644
--- a/src/gtd-task-list-view.c
+++ b/src/gtd-task-list-view.c
@@ -989,6 +989,16 @@ gtd_task_list_view_drag_motion (GtkWidget *widget,
gtk_list_box_invalidate_sort (priv->listbox);
}
+ /*
+ * Also pass the current motion to the DnD row, so it correctly
+ * adjusts itself - even when the DnD is hovering another row.
+ */
+ gtd_dnd_row_drag_motion (GTK_WIDGET (priv->dnd_row),
+ context,
+ x,
+ y,
+ time);
+
gdk_drag_status (context, GDK_ACTION_COPY, time);
return TRUE;
@@ -1002,20 +1012,14 @@ gtd_task_list_view_drag_drop (GtkWidget *widget,
guint time)
{
GtdTaskListViewPrivate *priv;
- GtkWidget *source_widget, *row;
priv = gtd_task_list_view_get_instance_private (GTD_TASK_LIST_VIEW (widget));
- gtk_widget_hide (priv->dnd_row);
-
- /*
- * When the drag operation began, the source row was hidden. Now is the time
- * to show it again.
- */
- source_widget = gtk_drag_get_source_widget (context);
- row = gtk_widget_get_ancestor (source_widget, GTK_TYPE_LIST_BOX_ROW);
-
- gtk_widget_show (row);
+ gtd_dnd_row_drag_drop (GTK_WIDGET (priv->dnd_row),
+ context,
+ x,
+ y,
+ time);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]