[glade3] * gladeui/glade-widget-adaptor.[ch], gladeui/glade-xml-utils.c, plugins/gtk+/glade-gtk.c, plugins/
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * gladeui/glade-widget-adaptor.[ch], gladeui/glade-xml-utils.c, plugins/gtk+/glade-gtk.c, plugins/
- Date: Thu, 30 Dec 2010 11:14:20 +0000 (UTC)
commit 56a65fb996ab0311e269e33151001b67034d6398
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Thu Dec 30 18:52:10 2010 +0900
* gladeui/glade-widget-adaptor.[ch], gladeui/glade-xml-utils.c, plugins/gtk+/glade-gtk.c,
plugins/gtk+/gtk+.xml.in:
Removed the boolean "fixed" property for catalogs and replaced it with a "create-widget-function"
tag that allows the backend to create a GladeWidget derived object to handle instances in
the runtime, modified the backend appropriately to create a GladeFixed for widgets that were
using the "fixed" property.
ChangeLog | 9 ++++++++
gladeui/glade-widget-adaptor.c | 42 ++++++++++++++-------------------------
gladeui/glade-widget-adaptor.h | 31 +++++++++++++++++------------
gladeui/glade-xml-utils.h | 2 +-
plugins/gtk+/glade-gtk.c | 13 ++++++++++-
plugins/gtk+/gtk+.xml.in | 12 +++++++---
6 files changed, 62 insertions(+), 47 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5a20fe8..58da7a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-12-30 Tristan Van Berkom <tristanvb openismus com>
+
+ * gladeui/glade-widget-adaptor.[ch], gladeui/glade-xml-utils.c, plugins/gtk+/glade-gtk.c,
+ plugins/gtk+/gtk+.xml.in:
+ Removed the boolean "fixed" property for catalogs and replaced it with a "create-widget-function"
+ tag that allows the backend to create a GladeWidget derived object to handle instances in
+ the runtime, modified the backend appropriately to create a GladeFixed for widgets that were
+ using the "fixed" property.
+
2010-12-29 Javier Jardón <jjardon gnome org>
* configure.ac: Use upstream gettext
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index 7166a15..dcac025 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -799,6 +799,14 @@ glade_widget_adaptor_real_get_property (GObject *object,
/*******************************************************************************
GladeWidgetAdaptor base class implementations
*******************************************************************************/
+static GladeWidget *
+glade_widget_adaptor_object_create_widget (GladeWidgetAdaptor *adaptor,
+ const gchar *first_property_name,
+ va_list var_args)
+{
+ return (GladeWidget *)g_object_new_valist (GLADE_TYPE_WIDGET, first_property_name, var_args);
+}
+
static GObject *
glade_widget_adaptor_object_construct_object (GladeWidgetAdaptor *adaptor,
guint n_parameters,
@@ -1184,6 +1192,7 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass *adaptor_class)
object_class->get_property = glade_widget_adaptor_real_get_property;
/* Class methods */
+ adaptor_class->create_widget = glade_widget_adaptor_object_create_widget;
adaptor_class->construct_object = glade_widget_adaptor_object_construct_object;
adaptor_class->deep_post_create = NULL;
adaptor_class->post_create = NULL;
@@ -1210,7 +1219,6 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass *adaptor_class)
adaptor_class->create_editable = glade_widget_adaptor_object_create_editable;
/* Base defaults here */
- adaptor_class->fixed = FALSE;
adaptor_class->toplevel = FALSE;
adaptor_class->use_placeholders = FALSE;
adaptor_class->default_width = -1;
@@ -1375,6 +1383,11 @@ gwa_extend_with_node_load_sym (GladeWidgetAdaptorClass *klass,
object_class->constructor = symbol;
if (glade_xml_load_sym_from_node (node, module,
+ GLADE_TAG_CREATE_WIDGET_FUNCTION,
+ &symbol))
+ klass->create_widget = symbol;
+
+ if (glade_xml_load_sym_from_node (node, module,
GLADE_TAG_CONSTRUCT_OBJECT_FUNCTION,
&symbol))
klass->construct_object = symbol;
@@ -1520,10 +1533,6 @@ gwa_derived_class_init (GladeWidgetAdaptorClass *adaptor_class,
glade_xml_get_property_boolean
(node, GLADE_TAG_DEPRECATED, adaptor_class->deprecated);
- adaptor_class->fixed =
- glade_xml_get_property_boolean
- (node, GLADE_TAG_FIXED, adaptor_class->fixed);
-
adaptor_class->toplevel =
glade_xml_get_property_boolean
(node, GLADE_TAG_TOPLEVEL, adaptor_class->toplevel);
@@ -2561,7 +2570,6 @@ glade_widget_adaptor_create_widget_real (gboolean query,
...)
{
GladeWidgetAdaptor *adaptor;
- GType gwidget_type;
GladeWidget *gwidget;
va_list vl, vl_copy;
@@ -2581,15 +2589,8 @@ glade_widget_adaptor_create_widget_real (gboolean query,
return NULL;
}
- if (GWA_IS_FIXED (adaptor))
- gwidget_type = GLADE_TYPE_FIXED;
- else
- gwidget_type = GLADE_TYPE_WIDGET;
-
+ gwidget = GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->create_widget (adaptor, first_property, vl_copy);
- gwidget = (GladeWidget *)g_object_new_valist (gwidget_type,
- first_property,
- vl_copy);
va_end (vl_copy);
if (query && glade_widget_adaptor_query (adaptor))
@@ -2849,19 +2850,6 @@ glade_widget_adaptor_construct_object (GladeWidgetAdaptor *adaptor,
{
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
-/*
- if (g_type_is_a (adaptor->type, GTK_TYPE_WINDOW))
- {
- GParameter type = {0, };
-
- type.name = "type";
- g_value_init (&type.value, GTK_TYPE_WINDOW_TYPE);
- g_value_set_enum (&type.value, GTK_WINDOW_OFFSCREEN);
-
- n_parameters = 1;
- parameters = &type;
- }*/
-
return GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->construct_object (adaptor, n_parameters, parameters);
}
diff --git a/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h
index 76f4b3a..0ff4643 100644
--- a/gladeui/glade-widget-adaptor.h
+++ b/gladeui/glade-widget-adaptor.h
@@ -25,16 +25,6 @@ typedef struct _GladeWidgetAdaptorPrivate GladeWidgetAdaptorPrivate;
typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
/**
- * GWA_IS_FIXED:
- * @obj: A #GladeWidgetAdaptor
- *
- * Checks whether this widget adaptor should be handled
- * as a free-form container
- */
-#define GWA_IS_FIXED(obj) \
- ((obj) ? GLADE_WIDGET_ADAPTOR_GET_CLASS(obj)->fixed : FALSE)
-
-/**
* GWA_DEPRECATED:
* @obj: A #GladeWidgetAdaptor
*
@@ -254,6 +244,22 @@ typedef enum
/**
* GladeSetPropertyFunc:
* @adaptor: A #GladeWidgetAdaptor
+ * @first_property_name: the name of the first property
+ * @var_args: the value of the first property, followed optionally by more
+ * name/value pairs, followed by %NULL
+ *
+ * This entry point allows the backend to create a specialized GladeWidget
+ * derived object for handling instances in the core.
+ *
+ * Returns: A newly created #GladeWidget for the said adaptor.
+ */
+typedef GladeWidget * (* GladeCreateWidgetFunc) (GladeWidgetAdaptor *adaptor,
+ const gchar *first_property_name,
+ va_list var_args);
+
+/**
+ * GladeSetPropertyFunc:
+ * @adaptor: A #GladeWidgetAdaptor
* @object: The #GObject
* @property_name: The property identifier
* @value: The #GValue
@@ -674,9 +680,6 @@ struct _GladeWidgetAdaptorClass
guint deprecated : 1; /* If this widget is currently
* deprecated
*/
- guint fixed : 1; /* If this is a Container, use free-form
- * placement with drag/resize/paste at mouse...
- */
guint toplevel : 1; /* If this class is toplevel */
guint use_placeholders : 1; /* Whether or not to use placeholders
@@ -686,6 +689,8 @@ struct _GladeWidgetAdaptorClass
gint default_width; /* Default width in GladeDesignLayout */
gint default_height; /* Default height in GladeDesignLayout */
+ GladeCreateWidgetFunc create_widget; /* Creates a GladeWidget for this adaptor */
+
GladeConstructObjectFunc construct_object; /* Object constructor
*/
diff --git a/gladeui/glade-xml-utils.h b/gladeui/glade-xml-utils.h
index 6e89a2b..1b170e1 100644
--- a/gladeui/glade-xml-utils.h
+++ b/gladeui/glade-xml-utils.h
@@ -92,6 +92,7 @@ typedef enum {
#define GLADE_TAG_NEEDS_SYNC "needs-sync"
#define GLADE_TAG_DEFAULT_PALETTE_STATE "default-palette-state"
#define GLADE_TAG_REPLACE_CHILD_FUNCTION "replace-child-function"
+#define GLADE_TAG_CREATE_WIDGET_FUNCTION "create-widget-function"
#define GLADE_TAG_CONSTRUCT_OBJECT_FUNCTION "construct-object-function"
#define GLADE_TAG_DEEP_POST_CREATE_FUNCTION "deep-post-create-function"
#define GLADE_TAG_POST_CREATE_FUNCTION "post-create-function"
@@ -167,7 +168,6 @@ typedef enum {
#define GLADE_TAG_THEMED_ICON "themed-icon"
#define GLADE_TAG_INIT_FUNCTION "init-function"
#define GLADE_TAG_ATK_PROPERTY "atk-property"
-#define GLADE_TAG_FIXED "fixed"
#define GLADE_TAG_TRANSFER_ON_PASTE "transfer-on-paste"
#define GLADE_TAG_WEIGHT "weight"
#define GLADE_TAG_GET_TYPE_FUNCTION "get-type-function"
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 14d67bd..92001f2 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -1171,12 +1171,21 @@ glade_gtk_container_get_children (GladeWidgetAdaptor *adaptor,
GladeEditable *
glade_gtk_container_create_editable (GladeWidgetAdaptor *adaptor,
- GladeEditorPageType type)
+ GladeEditorPageType type)
{
- return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type);;
+ return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type);
}
/* ----------------------------- GtkBox ------------------------------ */
+
+GladeWidget *
+glade_gtk_create_fixed_widget (GladeWidgetAdaptor *adaptor,
+ const gchar *first_property_name,
+ va_list var_args)
+{
+ return (GladeWidget *)g_object_new_valist (GLADE_TYPE_FIXED, first_property_name, var_args);
+}
+
typedef struct {
GtkWidget *widget;
gint position;
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 15ce5f1..e3ab25f 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -280,7 +280,8 @@ embedded in another object</_tooltip>
</properties>
</glade-widget-class>
- <glade-widget-class name="GtkBox" generic-name="box" _title="Box" fixed="True">
+ <glade-widget-class name="GtkBox" generic-name="box" _title="Box">
+ <create-widget-function>glade_gtk_create_fixed_widget</create-widget-function>
<post-create-function>glade_gtk_box_post_create</post-create-function>
<get-internal-child-function>glade_gtk_box_get_internal_child</get-internal-child-function>
<get-children-function>glade_gtk_box_get_children</get-children-function>
@@ -1192,7 +1193,8 @@ embedded in another object</_tooltip>
</glade-widget-class>
- <glade-widget-class name="GtkTable" generic-name="table" _title="Table" fixed="True">
+ <glade-widget-class name="GtkTable" generic-name="table" _title="Table">
+ <create-widget-function>glade_gtk_create_fixed_widget</create-widget-function>
<post-create-function>glade_gtk_table_post_create</post-create-function>
<child-set-property-function>glade_gtk_table_set_child_property</child-set-property-function>
<child-verify-function>glade_gtk_table_child_verify_property</child-verify-function>
@@ -1475,13 +1477,15 @@ embedded in another object</_tooltip>
</properties>
</glade-widget-class>
- <glade-widget-class name="GtkLayout" generic-name="layout" _title="Layout" fixed="True" use-placeholders="False">
+ <glade-widget-class name="GtkLayout" generic-name="layout" _title="Layout" use-placeholders="False">
+ <create-widget-function>glade_gtk_create_fixed_widget</create-widget-function>
<post-create-function>glade_gtk_fixed_layout_post_create</post-create-function>
<add-child-function>glade_gtk_fixed_layout_add_child</add-child-function>
<remove-child-function>glade_gtk_fixed_layout_remove_child</remove-child-function>
</glade-widget-class>
- <glade-widget-class name="GtkFixed" generic-name="fixed" _title="Fixed" fixed="True" use-placeholders="False">
+ <glade-widget-class name="GtkFixed" generic-name="fixed" _title="Fixed" use-placeholders="False">
+ <create-widget-function>glade_gtk_create_fixed_widget</create-widget-function>
<post-create-function>glade_gtk_fixed_layout_post_create</post-create-function>
<add-child-function>glade_gtk_fixed_layout_add_child</add-child-function>
<remove-child-function>glade_gtk_fixed_layout_remove_child</remove-child-function>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]