[glade/composite-templates: 9/9] glade_composite_template_save_from_widget() make sure we do not promt the user for input when replac



commit 76b0d34cc49f1cb9c4c7dbccc3340c9fce4db0e3
Author: Juan Pablo Ugarte <juanpablougarte gmai com>
Date:   Thu Jan 31 18:41:45 2013 +0100

    glade_composite_template_save_from_widget() make sure we do not promt
    the user for input when replacing a widget with the recently created composite template.

 gladeui/glade-composite-template.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gladeui/glade-composite-template.c b/gladeui/glade-composite-template.c
index 6de6539..5672026 100644
--- a/gladeui/glade-composite-template.c
+++ b/gladeui/glade-composite-template.c
@@ -292,16 +292,25 @@ glade_composite_template_save_from_widget (GladeWidget *gwidget,
       GladeProject *project = glade_widget_get_project (gwidget);
       GladeWidget *parent = glade_widget_get_parent (gwidget);
       GladeWidgetAdaptor *new_adaptor;
+      GladeWidget *new_widget;
       GList widgets = {0, };
       
       /* Create it at run time */
       if ((new_adaptor = glade_composite_template_load_from_string (template_xml)))
         g_object_set (new_adaptor, "template-path", filename, NULL);
 
+      new_widget = glade_widget_adaptor_create_widget (new_adaptor, FALSE,
+                                                       "parent", parent,
+                                                       "project", project,
+                                                       "reason", GLADE_CREATE_REBUILD,
+                                                       NULL);
+      glade_widget_copy_properties (new_widget, gwidget, FALSE, FALSE);
+      
       glade_command_push_group (_("Create new composite type %s"), template_class);
       widgets.data = gwidget;
-      glade_command_cut (&widgets);
-      glade_command_create (new_adaptor, parent, NULL, project);
+      glade_command_delete (&widgets);
+      widgets.data = new_widget;
+      glade_command_add (&widgets, parent, NULL, project, FALSE);
       glade_command_pop_group ();
     }
   



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