diff options
-rw-r--r-- | widgets/table/e-table.c | 22 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 23 |
2 files changed, 45 insertions, 0 deletions
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 9f250da2c2..0d148459b7 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -2079,6 +2079,27 @@ scroll_off (ETable *et) } static void +context_destroyed (gpointer data) +{ + ETable *et = data; + et->last_drop_x = 0; + et->last_drop_y = 0; + et->last_drop_time = 0; + et->last_drop_context = NULL; + scroll_off (et); + gtk_object_unref (GTK_OBJECT (et)); +} + +static void +context_connect (ETable *et, GdkDragContext *context) +{ + if (g_dataset_get_data (context, "e-table") == NULL) { + gtk_object_ref (GTK_OBJECT (et)); + g_dataset_set_data_full (context, "e-table", et, context_destroyed); + } +} + +static void et_drag_leave(GtkWidget *widget, GdkDragContext *context, guint time, @@ -2110,6 +2131,7 @@ et_drag_motion(GtkWidget *widget, et->last_drop_y = y; et->last_drop_time = time; et->last_drop_context = context; + context_connect (et, context); ret_val = do_drag_motion (et, context, diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index acd841d085..9bb71f6c92 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -2211,6 +2211,28 @@ hover_off (ETree *et) } static void +context_destroyed (gpointer data) +{ + ETree *et = data; + et->priv->last_drop_x = 0; + et->priv->last_drop_y = 0; + et->priv->last_drop_time = 0; + et->priv->last_drop_context = NULL; + scroll_off (et); + hover_off (et); + gtk_object_unref (GTK_OBJECT (et)); +} + +static void +context_connect (ETree *et, GdkDragContext *context) +{ + if (g_dataset_get_data (context, "e-tree") == NULL) { + gtk_object_ref (GTK_OBJECT (et)); + g_dataset_set_data_full (context, "e-tree", et, context_destroyed); + } +} + +static void et_drag_leave(GtkWidget *widget, GdkDragContext *context, guint time, @@ -2244,6 +2266,7 @@ et_drag_motion(GtkWidget *widget, et->priv->last_drop_y = y; et->priv->last_drop_time = time; et->priv->last_drop_context = context; + context_connect (et, context); if (et->priv->hover_idle_id != 0) { if (abs (et->priv->hover_x - x) > 3 || |