summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Pablo Ugarte <jpu@src.gnome.org>2006-09-05 18:41:02 +0000
committerJuan Pablo Ugarte <jpu@src.gnome.org>2006-09-05 18:41:02 +0000
commit79a19889986cf667f3cbdc1758e8153bea49531a (patch)
treee48d3f367ee1ebf447fa086911cdd8b037db9862
parent98febc5aab35ebaec2d35dfba0c88ea00adf90e2 (diff)
downloadglade-79a19889986cf667f3cbdc1758e8153bea49531a.tar.gz
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.
-rw-r--r--ChangeLog9
-rw-r--r--src/glade-base-editor.c16
-rw-r--r--src/glade-command.c2
-rw-r--r--src/glade-gtk.c9
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 <juanpablougarte@gmail.com>
+
+ * 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 <juanpablougarte@gmail.com>
* 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;
}