[glade/glade-3-16] Revert "Fixed Bug 702314 "Cancelling an Add Parent action is destructive"" because it introduced ano



commit 75bb07d12fa29035ba920ff0ba162b5bd6614b59
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Mon Jan 20 17:39:35 2014 -0300

    Revert "Fixed Bug 702314 "Cancelling an Add Parent action is destructive""
    because it introduced another bug.

 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 4a817dd..2f82867 100644
--- a/plugins/gtk+/glade-gtk-widget.c
+++ b/plugins/gtk+/glade-gtk-widget.c
@@ -864,31 +864,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)
@@ -920,6 +920,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 ();
         }


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