glade3 r1860 - in trunk: . gladeui plugins/gtk+
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r1860 - in trunk: . gladeui plugins/gtk+
- Date: Sat, 9 Aug 2008 14:59:57 +0000 (UTC)
Author: tvb
Date: Sat Aug 9 14:59:56 2008
New Revision: 1860
URL: http://svn.gnome.org/viewvc/glade3?rev=1860&view=rev
Log:
* 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).
Modified:
trunk/ChangeLog
trunk/gladeui/glade-widget.c
trunk/plugins/gtk+/glade-gtk.c
trunk/plugins/gtk+/gtk+.xml.in
Modified: trunk/gladeui/glade-widget.c
==============================================================================
--- trunk/gladeui/glade-widget.c (original)
+++ trunk/gladeui/glade-widget.c Sat Aug 9 14:59:56 2008
@@ -3560,7 +3560,9 @@
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);
}
Modified: trunk/plugins/gtk+/glade-gtk.c
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.c (original)
+++ trunk/plugins/gtk+/glade-gtk.c Sat Aug 9 14:59:56 2008
@@ -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 @@
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 @@
}
}
+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 @@
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 @@
}
}
+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)
Modified: trunk/plugins/gtk+/gtk+.xml.in
==============================================================================
--- trunk/plugins/gtk+/gtk+.xml.in (original)
+++ trunk/plugins/gtk+/gtk+.xml.in Sat Aug 9 14:59:56 2008
@@ -1169,7 +1169,9 @@
<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 @@
<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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]