From 79a19889986cf667f3cbdc1758e8153bea49531a Mon Sep 17 00:00:00 2001 From: Juan Pablo Ugarte Date: Tue, 5 Sep 2006 18:41:02 +0000 Subject: small optimization, there is no need to move a child if the new parent is * src/glade-base-editor.c, src/glade-gtk.c: small optimization, there is no need to move a child if the new parent is the same as the old one. (in GladeBaseEditor "move-child" signal handlers) * src/glade-command.c: fixed a warnign in glade_command_delete_execute() Widgets in the clipboard have no parents. --- ChangeLog | 9 +++++++++ src/glade-base-editor.c | 16 ++++++++++------ src/glade-command.c | 2 +- src/glade-gtk.c | 9 ++++++--- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index aba1465a..b24d53c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-09-05 Juan Pablo Ugarte + + * src/glade-base-editor.c, src/glade-gtk.c: small optimization, there is + no need to move a child if the new parent is the same as the old one. + (in GladeBaseEditor "move-child" signal handlers) + + * src/glade-command.c: fixed a warnign in glade_command_delete_execute() + Widgets in the clipboard have no parents. + 2006-08-28 Juan Pablo Ugarte * src/glade-gtk.c: Fixed bug 345075 "GtkPaned is invisible on load". diff --git a/src/glade-base-editor.c b/src/glade-base-editor.c index 97fa95f1..3485fa6a 100644 --- a/src/glade-base-editor.c +++ b/src/glade-base-editor.c @@ -585,9 +585,10 @@ glade_base_editor_reorder_children (GladeBaseEditor *editor, GtkTreeIter *child) do { gtk_tree_model_get (model, &iter, GLADE_BASE_EDITOR_MENU_GWIDGET, &gchild, -1); - position++; + if ((property = glade_widget_get_property (gchild, "position")) != NULL) glade_command_set_property (property, position); + position++; } while (gtk_tree_model_iter_next (model, &iter)); } @@ -852,7 +853,7 @@ glade_base_editor_reorder (GladeBaseEditor *editor, GtkTreeIter *iter) { glade_base_editor_clear (editor); glade_base_editor_fill_store (editor); - glade_base_editor_find_child (editor, gparent, &editor->priv->iter); + glade_base_editor_find_child (editor, gchild, &editor->priv->iter); } glade_command_pop_group (); @@ -1162,10 +1163,13 @@ glade_base_editor_move_child (GladeBaseEditor *editor, { GList list = {0, }; - list.data = gchild; - glade_command_cut (&list); - glade_command_paste (&list, gparent, NULL); - + if (gparent != glade_widget_get_parent (gchild)) + { + list.data = gchild; + glade_command_cut (&list); + glade_command_paste (&list, gparent, NULL); + } + return TRUE; } diff --git a/src/glade-command.c b/src/glade-command.c index 026052cc..7d1f2313 100644 --- a/src/glade-command.c +++ b/src/glade-command.c @@ -953,7 +953,7 @@ glade_command_delete_execute (GladeCommandCreateDelete *me) { cdata = list->data; - if (cdata->parent) + if (cdata->parent && me->from_clipboard == FALSE) { if (cdata->placeholder) glade_widget_replace diff --git a/src/glade-gtk.c b/src/glade-gtk.c index 2fbb4524..074e133d 100644 --- a/src/glade-gtk.c +++ b/src/glade-gtk.c @@ -3717,9 +3717,12 @@ glade_gtk_menu_shell_move_child (GladeBaseEditor *editor, if (GTK_IS_MENU_ITEM (parent)) gparent = glade_gtk_menu_shell_item_get_parent (gparent, parent); - list.data = gchild; - glade_command_cut (&list); - glade_command_paste (&list, gparent, NULL); + if (gparent != glade_widget_get_parent (gchild)) + { + list.data = gchild; + glade_command_cut (&list); + glade_command_paste (&list, gparent, NULL); + } return TRUE; } -- cgit v1.2.1