[gnome-todo/wip/gbsneto/dnd-fixups: 6/6] task-row: Make most of the row header draggable
- From: Gitlab Administrative User <gitlab src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo/wip/gbsneto/dnd-fixups: 6/6] task-row: Make most of the row header draggable
- Date: Tue, 31 Oct 2017 18:42:48 +0000 (UTC)
commit 9787f47725146caf99ef667351ded48b8ac73413
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Oct 31 16:40:12 2017 -0200
task-row: Make most of the row header draggable
Related to both #104 and #106
data/ui/task-row.ui | 6 +++++-
src/gtd-task-row.c | 15 ++++++++++++---
2 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/task-row.ui b/data/ui/task-row.ui
index d959045..aced237 100644
--- a/data/ui/task-row.ui
+++ b/data/ui/task-row.ui
@@ -77,8 +77,12 @@
</child>
<child>
- <object class="GtkEventBox">
+ <object class="GtkEventBox" id="header_event_box">
<property name="visible">True</property>
+ <signal name="button-press-event" handler="button_press_event" object="GtdTaskRow"
swapped="no" />
+ <signal name="drag-begin" handler="drag_begin_cb" object="GtdTaskRow" swapped="no" />
+ <signal name="drag-end" handler="drag_end_cb" object="GtdTaskRow" swapped="no" />
+ <signal name="drag-failed" handler="drag_failed_cb" object="GtdTaskRow" swapped="no" />
<signal name="enter-notify-event" handler="mouse_over_event_cb" object="GtdTaskRow"
swapped="no" />
<signal name="leave-notify-event" handler="mouse_out_event_cb" object="GtdTaskRow"
swapped="no" />
<child>
diff --git a/src/gtd-task-row.c b/src/gtd-task-row.c
index dcd4e12..80ff5f8 100644
--- a/src/gtd-task-row.c
+++ b/src/gtd-task-row.c
@@ -39,6 +39,7 @@ struct _GtdTaskRow
GtkWidget *done_check;
GtkWidget *edit_panel;
GtkWidget *edit_panel_revealer;
+ GtkWidget *header_event_box;
GtkWidget *title_entry;
GtkWidget *toggle_button;
@@ -199,7 +200,7 @@ button_press_event (GtkWidget *widget,
}
static void
-drag_begin_cb (GtkWidget *dnd_event_box,
+drag_begin_cb (GtkWidget *event_box,
GdkDragContext *context,
GtdTaskRow *self)
{
@@ -209,7 +210,7 @@ drag_begin_cb (GtkWidget *dnd_event_box,
widget = GTK_WIDGET (self);
- gtk_widget_translate_coordinates (dnd_event_box,
+ gtk_widget_translate_coordinates (event_box,
widget,
self->clicked_x,
self->clicked_y,
@@ -234,7 +235,7 @@ drag_begin_cb (GtkWidget *dnd_event_box,
}
static void
-drag_end_cb (GtkWidget *dnd_event_box,
+drag_end_cb (GtkWidget *event_box,
GdkDragContext *context,
GtdTaskRow *self)
{
@@ -619,6 +620,7 @@ gtd_task_row_class_init (GtdTaskRowClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtdTaskRow, done_check);
gtk_widget_class_bind_template_child (widget_class, GtdTaskRow, edit_panel);
gtk_widget_class_bind_template_child (widget_class, GtdTaskRow, edit_panel_revealer);
+ gtk_widget_class_bind_template_child (widget_class, GtdTaskRow, header_event_box);
gtk_widget_class_bind_template_child (widget_class, GtdTaskRow, revealer);
gtk_widget_class_bind_template_child (widget_class, GtdTaskRow, task_date_label);
gtk_widget_class_bind_template_child (widget_class, GtdTaskRow, task_list_label);
@@ -654,6 +656,13 @@ gtd_task_row_init (GtdTaskRow *self)
NULL,
0,
GDK_ACTION_MOVE);
+
+ /* But the rest of the row header is also draggable */
+ gtk_drag_source_set (self->header_event_box,
+ GDK_BUTTON1_MASK,
+ NULL,
+ 0,
+ GDK_ACTION_MOVE);
}
GtkWidget*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]