diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2013-04-04 04:15:58 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2013-04-04 04:17:47 +0900 |
commit | 79fef75ee0ed24878bb46c988ecfbbd6e3903c18 (patch) | |
tree | 2aade585b640fc2b0559ec05e19076d342be3d64 /gladeui/glade-design-view.c | |
parent | c9040f87a5cefd6c979056a69768e7062233c026 (diff) | |
download | glade-79fef75ee0ed24878bb46c988ecfbbd6e3903c18.tar.gz |
GladeDesignView: Remove some of the hacks in Drag and Drop
Allow normal code paths to run at drop time, GladeWidget implementations
ensure that the child is dropped at the right location.
Diffstat (limited to 'gladeui/glade-design-view.c')
-rw-r--r-- | gladeui/glade-design-view.c | 52 |
1 files changed, 5 insertions, 47 deletions
diff --git a/gladeui/glade-design-view.c b/gladeui/glade-design-view.c index d7e90e6d..d4a3055f 100644 --- a/gladeui/glade-design-view.c +++ b/gladeui/glade-design-view.c @@ -647,35 +647,6 @@ glade_design_view_drag_data_received (GtkWidget *widget, GLADE_DESIGN_VIEW (widget)); } - -static void -glade_design_view_fixed_move (GladeWidget *gsource, - GtkWidget *widget, - GdkDragContext *context, - GtkWidget *child, - gint x, - gint y) -{ - GladeProperty *prop_x, *prop_y; - gint dx, dy, hx, hy; - GtkWidget *layout; - - gtk_widget_translate_coordinates (widget, child, x, y, &dx, &dy); - - prop_x = glade_widget_get_pack_property (gsource, "x"); - prop_y = glade_widget_get_pack_property (gsource, "y"); - - layout = gtk_drag_get_source_widget (context); - - if (layout && GLADE_IS_DESIGN_LAYOUT (layout)) - _glade_design_layout_get_hot_point (GLADE_DESIGN_LAYOUT (layout), &hx, &hy); - else - hx = hy = 0; - - glade_command_set_property (prop_x, dx - hx); - glade_command_set_property (prop_y, dy - hy); -} - static gboolean glade_design_view_drag_drop (GtkWidget *widget, GdkDragContext *context, @@ -705,13 +676,8 @@ glade_design_view_drag_drop (GtkWidget *widget, else if (GTK_IS_FIXED (child) || GTK_IS_LAYOUT (child)) { GladeWidget *parent = glade_widget_get_from_gobject (child); - - glade_command_push_group ("Drag and Drop"); - if (parent != glade_widget_get_parent (gsource)) - glade_command_dnd (&widgets, parent, NULL); - - glade_design_view_fixed_move (gsource, widget, context, child, x, y); - glade_command_pop_group (); + + glade_command_dnd (&widgets, parent, NULL); } else if (!glade_widget_get_from_gobject (child)) glade_command_dnd (&widgets, NULL, NULL); @@ -732,17 +698,9 @@ glade_design_view_drag_drop (GtkWidget *widget, GladeWidget *parent = glade_widget_get_from_gobject (child); if (parent) - { - GladeWidget *gsource; - glade_command_push_group ("Drag and Drop"); - - gsource = glade_command_create (priv->drag_adaptor, - parent, NULL, - priv->project); - - glade_design_view_fixed_move (gsource, widget, context, child, x, y); - glade_command_pop_group (); - } + glade_command_create (priv->drag_adaptor, + parent, NULL, + priv->project); } else { |