diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2014-01-20 17:39:35 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2014-01-20 18:23:57 -0300 |
commit | 0cd31e7d85d6b2a9e908d93137533faffe9e4ac3 (patch) | |
tree | efa002f559faf1e14c1911d4e0b5ab19ef5ab527 /plugins | |
parent | 1081ade884f561fab4688856358a0d33faf2cce7 (diff) | |
download | glade-0cd31e7d85d6b2a9e908d93137533faffe9e4ac3.tar.gz |
Revert "Fixed Bug 702314 "Cancelling an Add Parent action is destructive""
because it introduced another bug.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/gtk+/glade-gtk-widget.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/plugins/gtk+/glade-gtk-widget.c b/plugins/gtk+/glade-gtk-widget.c index 6bb0f9a0..c6ac7e1a 100644 --- a/plugins/gtk+/glade-gtk-widget.c +++ b/plugins/gtk+/glade-gtk-widget.c @@ -891,31 +891,31 @@ glade_gtk_widget_action_activate (GladeWidgetAdaptor * adaptor, { GladeWidgetAdaptor *adaptor = glade_widget_adaptor_get_by_type (new_type); + GList *saved_props, *prop_cmds; GladeWidget *gnew_parent; + GladeProperty *property; glade_command_push_group (_("Adding parent %s for %s"), glade_widget_adaptor_get_title (adaptor), glade_widget_get_name (gwidget)); + /* Record packing properties */ + saved_props = + glade_widget_dup_properties (gwidget, glade_widget_get_packing_properties (gwidget), + FALSE, FALSE, FALSE); + + + property = glade_widget_get_parentless_widget_ref (gwidget); + + /* Remove "this" widget, If the parent we're removing is a parentless + * widget reference, the reference will be implicitly broken by the 'cut' command */ + this_widget.data = gwidget; + glade_command_delete (&this_widget); + /* Create new widget and put it where the placeholder was */ if ((gnew_parent = glade_command_create (adaptor, gparent, NULL, project)) != NULL) { - GList *saved_props, *prop_cmds; - GladeProperty *property; - - /* Record packing properties */ - saved_props = - glade_widget_dup_properties (gwidget, glade_widget_get_packing_properties (gwidget), - FALSE, FALSE, FALSE); - - /* Remove "this" widget, If the parent we're removing is a parentless - * widget reference, the reference will be implicitly broken by the 'cut' command */ - this_widget.data = gwidget; - glade_command_delete (&this_widget); - - property = glade_widget_get_parentless_widget_ref (gwidget); - /* Now we created the new parent, if gwidget had a parentless widget reference... * set that reference to the new parent instead */ if (property) @@ -947,6 +947,15 @@ glade_gtk_widget_action_activate (GladeWidgetAdaptor * adaptor, /* Add "this" widget to the new parent */ glade_command_add (&this_widget, gnew_parent, NULL, project, FALSE); } + else + { + /* Create parent was cancelled, paste back to parent */ + glade_command_add (&this_widget, gparent, NULL, project, FALSE); + + /* Restore any parentless widget reference if there was one */ + if (property) + glade_command_set_property (property, glade_widget_get_object (gwidget)); + } glade_command_pop_group (); } |