[gnome-builder] dnd: remove broken DnD for uri-list from editor



commit f02fce032aff7ba6685d98bd3ee057c4fb592ff1
Author: Christian Hergert <chergert redhat com>
Date:   Tue Dec 12 15:58:35 2017 -0800

    dnd: remove broken DnD for uri-list from editor
    
    We broke this long ago, so let's remove the broken code so that
    we can do it correctly going forward.

 src/libide/editor/ide-editor-view.c     |   64 -------------------------------
 src/libide/sourceview/ide-source-view.c |   12 ------
 2 files changed, 0 insertions(+), 76 deletions(-)
---
diff --git a/src/libide/editor/ide-editor-view.c b/src/libide/editor/ide-editor-view.c
index 35b72dd..5d4467f 100644
--- a/src/libide/editor/ide-editor-view.c
+++ b/src/libide/editor/ide-editor-view.c
@@ -41,10 +41,6 @@ enum {
   N_PROPS
 };
 
-enum {
-  DND_TARGET_URI_LIST = 100,
-};
-
 static void ide_editor_view_update_reveal_timer (IdeEditorView *self);
 
 G_DEFINE_TYPE (IdeEditorView, ide_editor_view, IDE_TYPE_LAYOUT_VIEW)
@@ -123,54 +119,6 @@ ide_editor_view_notify_child_revealed (IdeEditorView *self,
     }
 }
 
-static void
-ide_editor_view_drag_data_received (IdeEditorView    *self,
-                                    GdkDragContext   *context,
-                                    gint              x,
-                                    gint              y,
-                                    GtkSelectionData *selection_data,
-                                    guint             info,
-                                    guint             timestamp,
-                                    IdeSourceView    *source_view)
-{
-  g_auto(GStrv) uri_list = NULL;
-
-  g_assert (IDE_IS_EDITOR_VIEW (self));
-  g_assert (IDE_IS_SOURCE_VIEW (source_view));
-
-  switch (info)
-    {
-    case DND_TARGET_URI_LIST:
-      uri_list = dzl_dnd_get_uri_list (selection_data);
-
-      if (uri_list != NULL)
-        {
-          GVariantBuilder *builder;
-          GVariant *variant;
-          guint i;
-
-          builder = g_variant_builder_new (G_VARIANT_TYPE_STRING_ARRAY);
-          for (i = 0; uri_list [i]; i++)
-            g_variant_builder_add (builder, "s", uri_list [i]);
-          variant = g_variant_builder_end (builder);
-          g_variant_builder_unref (builder);
-
-          /*
-           * request that we get focus first so the workbench will deliver the
-           * document to us in the case it is not already open
-           */
-          gtk_widget_grab_focus (GTK_WIDGET (self));
-          dzl_gtk_widget_action (GTK_WIDGET (self), "workbench", "open-uri-list", variant);
-        }
-
-      gtk_drag_finish (context, TRUE, FALSE, timestamp);
-      break;
-
-    default:
-      break;
-    }
-}
-
 static gboolean
 ide_editor_view_focus_in_event (IdeEditorView *self,
                                 GdkEventFocus *focus,
@@ -713,11 +661,6 @@ ide_editor_view_constructed (GObject *object)
   _ide_editor_view_init_settings (self);
 
   g_signal_connect_swapped (self->source_view,
-                            "drag-data-received",
-                            G_CALLBACK (ide_editor_view_drag_data_received),
-                            self);
-
-  g_signal_connect_swapped (self->source_view,
                             "focus-in-event",
                             G_CALLBACK (ide_editor_view_focus_in_event),
                             self);
@@ -962,8 +905,6 @@ ide_editor_view_class_init (IdeEditorViewClass *klass)
 static void
 ide_editor_view_init (IdeEditorView *self)
 {
-  GtkTargetList *target_list;
-
   DZL_COUNTER_INC (instances);
 
   gtk_widget_init_template (GTK_WIDGET (self));
@@ -1015,11 +956,6 @@ ide_editor_view_init (IdeEditorView *self)
   self->buffer_bindings = dzl_binding_group_new ();
   dzl_binding_group_bind (self->buffer_bindings, "title", self, "title", 0);
 
-  /* Setup Drag and Drop support. */
-  target_list = gtk_drag_dest_get_target_list (GTK_WIDGET (self->source_view));
-  if (target_list != NULL)
-    gtk_target_list_add_uri_targets (target_list, DND_TARGET_URI_LIST);
-
   /* Load our custom font for the overview map. */
   gtk_source_map_set_view (self->map, GTK_SOURCE_VIEW (self->source_view));
 }
diff --git a/src/libide/sourceview/ide-source-view.c b/src/libide/sourceview/ide-source-view.c
index 489166d..374ed35 100644
--- a/src/libide/sourceview/ide-source-view.c
+++ b/src/libide/sourceview/ide-source-view.c
@@ -280,10 +280,6 @@ enum {
 };
 
 enum {
-  TARGET_URI_LIST = 100
-};
-
-enum {
   FONT_SCALE_XX_SMALL,
   FONT_SCALE_X_SMALL,
   FONT_SCALE_SMALL,
@@ -6691,7 +6687,6 @@ ide_source_view_init (IdeSourceView *self)
 {
   IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
   GtkSourceCompletion *completion;
-  GtkTargetList *target_list;
 
   priv->include_regex = g_regex_new (INCLUDE_STATEMENTS,
                                      G_REGEX_OPTIMIZE,
@@ -6831,13 +6826,6 @@ ide_source_view_init (IdeSourceView *self)
   completion = gtk_source_view_get_completion (GTK_SOURCE_VIEW (self));
   gtk_source_completion_block_interactive (completion);
 
-  /*
-   * Drag and drop support
-   */
-  target_list = gtk_drag_dest_get_target_list (GTK_WIDGET (self));
-  if (target_list)
-    gtk_target_list_add_uri_targets (target_list, TARGET_URI_LIST);
-
   dzl_widget_action_group_attach (self, "sourceview");
 }
 


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