[glade] GladeCommand: Make sure a template widget is unset undoably if deleted.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] GladeCommand: Make sure a template widget is unset undoably if deleted.
- Date: Tue, 9 Apr 2013 15:07:22 +0000 (UTC)
commit e1256cd36b827cb1be0267143b30b52f40ed0d85
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Wed Apr 10 00:06:37 2013 +0900
GladeCommand: Make sure a template widget is unset undoably if deleted.
gladeui/glade-command.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gladeui/glade-command.c b/gladeui/glade-command.c
index 0e75bde..7293976 100644
--- a/gladeui/glade-command.c
+++ b/gladeui/glade-command.c
@@ -1197,10 +1197,6 @@ glade_command_remove (GList *widgets)
g_return_if_fail (widgets != NULL);
- me = g_object_new (GLADE_COMMAND_ADD_REMOVE_TYPE, NULL);
- me->add = FALSE;
- me->from_clipboard = FALSE;
-
/* internal children cannot be deleted. Notify the user. */
for (list = widgets; list && list->data; list = list->next)
{
@@ -1227,6 +1223,10 @@ glade_command_remove (GList *widgets)
}
}
+ me = g_object_new (GLADE_COMMAND_ADD_REMOVE_TYPE, NULL);
+ me->add = FALSE;
+ me->from_clipboard = FALSE;
+
GLADE_COMMAND (me)->priv->project = glade_widget_get_project (widget);
GLADE_COMMAND (me)->priv->description = g_strdup ("dummy");
@@ -1248,6 +1248,10 @@ glade_command_remove (GList *widgets)
get_all_parentless_reffed_widgets (cdata->reffed, widget)) != NULL)
g_list_foreach (cdata->reffed, (GFunc) g_object_ref, NULL);
+ /* If we're removing the template widget, then we need to unset it as template */
+ if (glade_project_get_template (GLADE_COMMAND (me)->priv->project) == widget)
+ glade_command_set_template (GLADE_COMMAND (me)->priv->project, NULL);
+
/* Undoably unset any object properties that may point to the removed object */
glade_command_delete_prop_refs (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]