Commit da22878d authored by Tristan Van Berkom's avatar Tristan Van Berkom

Worked around special child type naming discrepencies between formats from


	* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in:
	  Worked around special child type naming discrepencies between
	  formats from the plugin side (bug 533217 - fix by Pavel Kostyuchenko).


svn path=/trunk/; revision=1860
parent 103cdc2b
2008-08-09 Tristan Van Berkom <tvb@gnome.org>
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in:
Worked around special child type naming discrepencies between
formats from the plugin side (bug 533217 - fix by Pavel Kostyuchenko).
2008-08-06 Tristan Van Berkom <tvb@gnome.org>
* plugins/gtk+/Makefile.am, plugins/gtk+/glade-attributes.[ch]:
......
......@@ -3560,7 +3560,9 @@ glade_widget_write_child (GladeWidget *widget,
GladeXmlContext *context,
GladeXmlNode *node)
{
glade_widget_adaptor_write_child (widget->adaptor,
g_return_if_fail (widget->parent);
glade_widget_adaptor_write_child (widget->parent->adaptor,
widget, context, node);
}
......
......@@ -31,6 +31,7 @@
#include <gladeui/glade-editor-property.h>
#include <gladeui/glade-base-editor.h>
#include <gladeui/glade-xml-utils.h>
#include <gtk/gtk.h>
......@@ -3157,8 +3158,16 @@ glade_gtk_frame_add_child (GladeWidgetAdaptor *adaptor,
special_child_type = g_object_get_data (child, "special-child-type");
if (special_child_type &&
!strcmp (special_child_type, "label_item"))
if (special_child_type && !strcmp (special_child_type, "label"))
{
g_object_set_data (child,
"special-child-type",
"label_item");
gtk_frame_set_label_widget (GTK_FRAME (object),
GTK_WIDGET (child));
}
else if (special_child_type &&
!strcmp (special_child_type, "label_item"))
{
gtk_frame_set_label_widget (GTK_FRAME (object),
GTK_WIDGET (child));
......@@ -3170,6 +3179,78 @@ glade_gtk_frame_add_child (GladeWidgetAdaptor *adaptor,
}
}
void
glade_gtk_frame_remove_child (GladeWidgetAdaptor *adaptor,
GObject *object,
GObject *child)
{
gchar *special_child_type;
special_child_type = g_object_get_data (child, "special-child-type");
if (special_child_type &&
!strcmp (special_child_type, "label_item"))
{
gtk_frame_set_label_widget (GTK_FRAME (object),
glade_placeholder_new ());
}
else
{
gtk_container_remove (GTK_CONTAINER (object),
GTK_WIDGET (child));
gtk_container_add (GTK_CONTAINER (object),
glade_placeholder_new ());
}
}
static gboolean
write_special_child_label_item (GladeWidgetAdaptor *adaptor,
GladeWidget *widget,
GladeXmlContext *context,
GladeXmlNode *node,
GladeWriteWidgetFunc write_func)
{
gchar *special_child_type = NULL;
GObject *child;
if (glade_project_get_format (widget->project) == GLADE_PROJECT_FORMAT_GTKBUILDER)
{
child = widget->object;
if (child)
special_child_type = g_object_get_data (child, "special-child-type");
}
if (special_child_type && !strcmp (special_child_type, "label_item"))
{
g_object_set_data (child,
"special-child-type",
"label");
write_func (adaptor, widget, context, node);
g_object_set_data (child,
"special-child-type",
"label_item");
return TRUE;
}
else
return FALSE;
}
void
glade_gtk_frame_write_child (GladeWidgetAdaptor *adaptor,
GladeWidget *widget,
GladeXmlContext *context,
GladeXmlNode *node)
{
if (!write_special_child_label_item (adaptor, widget, context, node,
GWA_GET_CLASS(GTK_TYPE_CONTAINER)->write_child))
/* Chain Up */
GWA_GET_CLASS
(GTK_TYPE_CONTAINER)->write_child (adaptor,
widget,
context,
node);
}
/* ----------------------------- GtkNotebook ------------------------------ */
typedef struct
{
......@@ -4234,7 +4315,16 @@ glade_gtk_expander_add_child (GladeWidgetAdaptor *adaptor,
special_child_type = g_object_get_data (child, "special-child-type");
if (special_child_type &&
!strcmp (special_child_type, "label_item"))
!strcmp (special_child_type, "label"))
{
g_object_set_data (child,
"special-child-type",
"label_item");
gtk_expander_set_label_widget (GTK_EXPANDER (object),
GTK_WIDGET (child));
}
else if (special_child_type &&
!strcmp (special_child_type, "label_item"))
{
gtk_expander_set_label_widget (GTK_EXPANDER (object),
GTK_WIDGET (child));
......@@ -4267,6 +4357,24 @@ glade_gtk_expander_remove_child (GladeWidgetAdaptor *adaptor,
}
}
void
glade_gtk_expander_write_child (GladeWidgetAdaptor *adaptor,
GladeWidget *widget,
GladeXmlContext *context,
GladeXmlNode *node)
{
if (!write_special_child_label_item (adaptor, widget, context, node,
GWA_GET_CLASS(GTK_TYPE_CONTAINER)->write_child))
/* Chain Up */
GWA_GET_CLASS
(GTK_TYPE_CONTAINER)->write_child (adaptor,
widget,
context,
node);
}
/* -------------------------------- GtkEntry -------------------------------- */
static void
glade_gtk_entry_changed (GtkEditable *editable, GladeWidget *gentry)
......
......@@ -1169,7 +1169,9 @@ embedded in another object</_tooltip>
<glade-widget-class name="GtkFrame" generic-name="frame" _title="Frame">
<post-create-function>glade_gtk_frame_post_create</post-create-function>
<add-child-function>glade_gtk_frame_add_child</add-child-function>
<remove-child-function>glade_gtk_frame_remove_child</remove-child-function>
<replace-child-function>glade_gtk_frame_replace_child</replace-child-function>
<write-child-function>glade_gtk_frame_write_child</write-child-function>
<special-child-type>type</special-child-type>
<properties>
......@@ -1350,6 +1352,7 @@ embedded in another object</_tooltip>
<add-child-function>glade_gtk_expander_add_child</add-child-function>
<remove-child-function>glade_gtk_expander_remove_child</remove-child-function>
<replace-child-function>glade_gtk_expander_replace_child</replace-child-function>
<write-child-function>glade_gtk_expander_write_child</write-child-function>
<special-child-type>type</special-child-type>
<properties>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment