[glade] * gladeui/glade-widget.c: Make glade_widget_rebuild() use glade_widget_add/remove instead of gla
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] * gladeui/glade-widget.c: Make glade_widget_rebuild() use glade_widget_add/remove instead of gla
- Date: Sat, 5 Feb 2011 07:59:32 +0000 (UTC)
commit 1ec9c74e1bbadf10779dfba49bc18011338434ec
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sat Feb 5 17:06:21 2011 +0900
* gladeui/glade-widget.c: Make glade_widget_rebuild() use glade_widget_add/remove
instead of glade_widget_replace().
Conflicts:
ChangeLog
gladeui/glade-widget.c
ChangeLog | 3 +++
gladeui/glade-widget.c | 35 ++++++++++++++++++++---------------
plugins/gtk+/glade-gtk.c | 5 +++--
3 files changed, 26 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c858045..f052791 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
* plugins/gtk+/gtk+.xml.in: Disabling irrelevant properties for GtkScaleButton
+ * gladeui/glade-widget.c: Make glade_widget_rebuild() use glade_widget_add/remove
+ instead of glade_widget_replace().
+
2011-02-04 Tristan Van Berkom <tristanvb openismus com>
* gladeui/glade-project.c:
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index f8f1bba..923ab70 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -361,7 +361,7 @@ glade_widget_remove_signal_handler (GladeWidget * widget,
tmp_signal_handler = g_ptr_array_index (signals, i);
if (glade_signal_equal (tmp_signal_handler, signal_handler))
{
- g_signal_emit (widget, glade_widget_signals[REMOVE_SIGNAL_HANDLER], 0, tmp_signal_handler);
+ g_signal_emit (widget, glade_widget_signals[REMOVE_SIGNAL_HANDLER], 0, tmp_signal_handler);
g_object_unref (tmp_signal_handler);
g_ptr_array_remove_index (signals, i);
break;
@@ -2381,8 +2381,9 @@ glade_widget_rebuild (GladeWidget * gwidget)
GObject *new_object, *old_object;
GladeWidgetAdaptor *adaptor;
GladeProject *project = NULL;
+ GladeWidget *parent = NULL;
GList *children;
- gboolean reselect = FALSE, inparent;
+ gboolean reselect = FALSE;
GList *restore_properties = NULL;
GList *save_properties, *l;
@@ -2390,6 +2391,12 @@ glade_widget_rebuild (GladeWidget * gwidget)
adaptor = gwidget->priv->adaptor;
+ if (gwidget->priv->parent &&
+ glade_widget_adaptor_has_child (gwidget->priv->parent->priv->adaptor,
+ gwidget->priv->parent->priv->object,
+ gwidget->priv->object))
+ parent = gwidget->priv->parent;
+
g_object_ref (gwidget);
/* Extract and keep the child hierarchies aside... */
@@ -2442,6 +2449,11 @@ glade_widget_rebuild (GladeWidget * gwidget)
}
g_list_free (save_properties);
+ /* Remove old object from parent
+ */
+ if (parent)
+ glade_widget_remove_child (parent, gwidget);
+
/* Hold a reference to the old widget while we transport properties
* and children from it
*/
@@ -2451,18 +2463,6 @@ glade_widget_rebuild (GladeWidget * gwidget)
/* Only call this once the object has a proper GladeWidget */
glade_widget_adaptor_post_create (adaptor, new_object, GLADE_CREATE_REBUILD);
- /* Replace old object with new object in parent
- * (this can happen during construction before the object is actually
- * added to the parent but the parent pointer is set).
- */
-
- inparent = (gwidget->priv->parent &&
- glade_widget_adaptor_has_child (gwidget->priv->parent->priv->adaptor,
- gwidget->priv->parent->priv->object,
- old_object));
- if (inparent)
- glade_widget_replace (gwidget->priv->parent, old_object, new_object);
-
/* Must call dispose for cases like dialogs and toplevels */
if (GTK_IS_WINDOW (old_object))
gtk_widget_destroy (GTK_WIDGET (old_object));
@@ -2476,6 +2476,11 @@ glade_widget_rebuild (GladeWidget * gwidget)
glade_widget_insert_children (gwidget, children);
glade_widget_pop_superuser ();
+ /* Add new object to parent
+ */
+ if (parent)
+ glade_widget_add_child (parent, gwidget, FALSE);
+
/* Custom properties aren't transfered in build_object, since build_object
* is only concerned with object creation.
*/
@@ -2503,7 +2508,7 @@ glade_widget_rebuild (GladeWidget * gwidget)
/* Sync packing.
*/
- if (inparent)
+ if (parent)
glade_widget_sync_packing_props (gwidget);
/* If the widget was in a project (and maybe the selection), then
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 42d119c..ab5b21e 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -5870,9 +5870,10 @@ glade_gtk_button_write_widget (GladeWidgetAdaptor * adaptor,
if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
return;
- /* Do not save GtkColorButton and GtkFontButton label property */
+ /* Do not save GtkColorButton GtkFontButton and GtkScaleButton label property */
if (!(GTK_IS_COLOR_BUTTON (glade_widget_get_object (widget)) ||
- GTK_IS_FONT_BUTTON (glade_widget_get_object (widget))))
+ GTK_IS_FONT_BUTTON (glade_widget_get_object (widget)) ||
+ GTK_IS_SCALE_BUTTON (glade_widget_get_object (widget))))
{
/* Make a copy of the GladeProperty,
* override its value and ensure non-translatable if use-stock is TRUE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]