[gnome-calendar/wip/gbsneto/dnd: 2/14] event-widget: setup itself as a drag source



commit b9f114035119cdda14c6c044a720aa3f761beb80
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat May 21 10:33:53 2016 -0300

    event-widget: setup itself as a drag source
    
    Ideally, every single view will support drag and drop. So
    let's just assume that and make the event widget set itself
    as a drag source, and let each view set itself as a drag
    target.

 src/gcal-event-widget.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index c54400b..4a00657 100644
--- a/src/gcal-event-widget.c
+++ b/src/gcal-event-widget.c
@@ -184,15 +184,26 @@ gcal_event_widget_set_event_internal (GcalEventWidget *self,
 static void
 gcal_event_widget_init (GcalEventWidget *self)
 {
+  GtkWidget *widget;
   GSettings *settings;
   gchar *clock_format;
 
+  widget = GTK_WIDGET (self);
   settings = g_settings_new ("org.gnome.desktop.interface");
   clock_format = g_settings_get_string (settings, "clock-format");
   self->clock_format_24h = g_strcmp0 (clock_format, "24h") == 0;
 
-  gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
-  gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
+  gtk_widget_set_has_window (widget, FALSE);
+  gtk_widget_set_can_focus (widget, TRUE);
+
+  /* Setup the event widget as a drag source */
+  gtk_drag_source_set (widget,
+                       GDK_BUTTON1_MASK,
+                       NULL,
+                       0,
+                       GDK_ACTION_COPY);
+
+  gtk_drag_source_add_text_targets (widget);
 
   g_clear_object (&settings);
   g_free (clock_format);


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