[glade3] * Made GladePropertyClass completely opaque and created loads of api and updated all sources: 20 f
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * Made GladePropertyClass completely opaque and created loads of api and updated all sources: 20 f
- Date: Sun, 2 Jan 2011 19:50:10 +0000 (UTC)
commit 6fa69cb8b1f1099395a9c2ae43ac62108a976181
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Mon Jan 3 04:56:45 2011 +0900
* Made GladePropertyClass completely opaque and created loads of api and updated all sources:
20 files changed, 1152 insertions(+), 643 deletions(-)
ChangeLog | 3 +
gladeui/glade-base-editor.c | 2 +-
gladeui/glade-command.c | 16 +-
gladeui/glade-editor-property.c | 193 ++++++-----
gladeui/glade-editor-table.c | 27 +-
gladeui/glade-editor.c | 16 +-
gladeui/glade-popup.c | 18 +-
gladeui/glade-project.c | 38 ++-
gladeui/glade-property-class.c | 569 +++++++++++++++++++++++++++--
gladeui/glade-property-class.h | 240 ++++--------
gladeui/glade-property.c | 146 +++++---
gladeui/glade-widget-adaptor.c | 159 +++-----
gladeui/glade-widget-adaptor.h | 4 -
gladeui/glade-widget.c | 81 +++--
gladeui/glade-xml-utils.h | 9 +-
plugins/gtk+/glade-accels.c | 5 +-
plugins/gtk+/glade-cell-renderer-editor.c | 51 ++--
plugins/gtk+/glade-column-types.c | 27 +-
plugins/gtk+/glade-gtk.c | 119 +++++--
plugins/gtk+/gtk+.xml.in | 73 ++---
20 files changed, 1153 insertions(+), 643 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3222a97..4848404 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,9 @@
* Made GladeWidgetAdaptor internalize *everything* into a private data structure,
21 files changed, 694 insertions(+), 670 deletions(-)
+ * Made GladePropertyClass completely opaque and created loads of api and updated all sources:
+ 20 files changed, 1152 insertions(+), 643 deletions(-)
+
2011-01-01 Tristan Van Berkom <tristanvb openismus com>
* gladeui/glade-command.[ch], Added GladeProject member to base command structure, now
diff --git a/gladeui/glade-base-editor.c b/gladeui/glade-base-editor.c
index bc4c335..90bdabc 100644
--- a/gladeui/glade-base-editor.c
+++ b/gladeui/glade-base-editor.c
@@ -1367,7 +1367,7 @@ glade_base_editor_change_type (GladeBaseEditor * editor,
{
GladeProperty *orig_prop = (GladeProperty *) l->data;
GladePropertyClass *pclass = glade_property_get_class (orig_prop);
- GladeProperty *dup_prop = glade_widget_get_property (gchild_new, pclass->id);
+ GladeProperty *dup_prop = glade_widget_get_property (gchild_new, glade_property_class_id (pclass));
glade_property_set_value (dup_prop, glade_property_inline_value (orig_prop));
l = g_list_next (l);
}
diff --git a/gladeui/glade-command.c b/gladeui/glade-command.c
index d85f3a8..4ab639a 100644
--- a/gladeui/glade-command.c
+++ b/gladeui/glade-command.c
@@ -391,11 +391,11 @@ glade_command_set_property_execute (GladeCommand * cmd)
/* Packing properties need to be refreshed here since
* they are reset when they get added to containers.
*/
- if (pclass->packing)
+ if (glade_property_class_get_is_packing (pclass))
{
GladeProperty *tmp_prop;
- tmp_prop = glade_widget_get_pack_property (widget, pclass->id);
+ tmp_prop = glade_widget_get_pack_property (widget, glade_property_class_id (pclass));
if (sdata->property != tmp_prop)
{
@@ -591,19 +591,19 @@ glade_command_set_property_description (GladeCommandSetProperty * me)
pclass = glade_property_get_class (sdata->property);
widget = glade_property_get_widget (sdata->property);
value_name = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (pclass->handle), pclass, sdata->new_value);
+ (glade_property_class_get_adaptor (pclass), pclass, sdata->new_value);
if (!value_name || strlen (value_name) > MAX_UNDO_MENU_ITEM_VALUE_LEN
|| strchr (value_name, '_'))
{
description = g_strdup_printf (_("Setting %s of %s"),
- pclass->name,
+ glade_property_class_get_name (pclass),
glade_widget_get_name (widget));
}
else
{
description = g_strdup_printf (_("Setting %s of %s to %s"),
- pclass->name,
+ glade_property_class_get_name (pclass),
glade_widget_get_name (widget),
value_name);
}
@@ -1251,9 +1251,9 @@ glade_command_transfer_props (GladeWidget * gnew, GList * saved_props)
GladeProperty *prop, *sprop = l->data;
GladePropertyClass *pclass = glade_property_get_class (sprop);
- prop = glade_widget_get_pack_property (gnew, pclass->id);
+ prop = glade_widget_get_pack_property (gnew, glade_property_class_id (pclass));
- if (prop && pclass->transfer_on_paste &&
+ if (prop && glade_property_class_transfer_on_paste (pclass) &&
glade_property_class_match (glade_property_get_class (prop), pclass))
glade_property_set_value (prop, glade_property_inline_value (sprop));
}
@@ -1340,7 +1340,7 @@ glade_command_add_execute (GladeCommandAddRemove * me)
GladeProperty *saved_prop = l->data;
GladePropertyClass *pclass = glade_property_get_class (saved_prop);
GladeProperty *widget_prop =
- glade_widget_get_pack_property (cdata->widget, pclass->id);
+ glade_widget_get_pack_property (cdata->widget, glade_property_class_id (pclass));
glade_property_get_value (saved_prop, &value);
glade_property_set_value (widget_prop, &value);
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index 5450b56..cbf26c3 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -173,9 +173,9 @@ glade_editor_property_fix_label (GladeEditorProperty * eprop)
/* refresh label */
if ((glade_property_get_state (eprop->property) & GLADE_STATE_CHANGED) != 0)
- text = g_strdup_printf ("<b>%s:</b>", eprop->klass->name);
+ text = g_strdup_printf ("<b>%s:</b>", glade_property_class_get_name (eprop->klass));
else
- text = g_strdup_printf ("%s:", eprop->klass->name);
+ text = g_strdup_printf ("%s:", glade_property_class_get_name (eprop->klass));
gtk_label_set_markup (GTK_LABEL (eprop->label), text);
g_free (text);
@@ -204,7 +204,7 @@ glade_editor_property_enabled_cb (GladeProperty * property,
gboolean enabled;
g_assert (eprop->property == property);
- if (eprop->klass->optional)
+ if (glade_property_class_optional (eprop->klass))
{
enabled = glade_property_get_enabled (property);
@@ -259,7 +259,7 @@ glade_editor_property_constructor (GType type,
/* Create hbox and possibly check button
*/
- if (eprop->klass->optional)
+ if (glade_property_class_optional (eprop->klass))
{
eprop->check = gtk_check_button_new ();
gtk_widget_show (eprop->check);
@@ -460,7 +460,7 @@ glade_editor_property_load_common (GladeEditorProperty * eprop,
/* Load initial tooltips
*/
glade_editor_property_tooltip_cb
- (property, pclass->tooltip,
+ (property, glade_property_class_get_tooltip (pclass),
glade_propert_get_insensitive_tooltip (property),
glade_property_get_support_warning (property), eprop);
@@ -609,6 +609,7 @@ glade_eprop_numeric_load (GladeEditorProperty * eprop, GladeProperty * property)
{
gfloat val = 0.0F;
GladeEPropNumeric *eprop_numeric = GLADE_EPROP_NUMERIC (eprop);
+ GParamSpec *pspec;
GValue *value;
/* Chain up first */
@@ -617,26 +618,27 @@ glade_eprop_numeric_load (GladeEditorProperty * eprop, GladeProperty * property)
if (property)
{
value = glade_property_inline_value (property);
+ pspec = glade_property_class_get_pspec (eprop->klass);
- if (G_IS_PARAM_SPEC_INT (eprop->klass->pspec))
+ if (G_IS_PARAM_SPEC_INT (pspec))
val = (gfloat) g_value_get_int (value);
- else if (G_IS_PARAM_SPEC_UINT (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_UINT (pspec))
val = (gfloat) g_value_get_uint (value);
- else if (G_IS_PARAM_SPEC_LONG (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_LONG (pspec))
val = (gfloat) g_value_get_long (value);
- else if (G_IS_PARAM_SPEC_ULONG (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_ULONG (pspec))
val = (gfloat) g_value_get_ulong (value);
- else if (G_IS_PARAM_SPEC_INT64 (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_INT64 (pspec))
val = (gfloat) g_value_get_int64 (value);
- else if (G_IS_PARAM_SPEC_UINT64 (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_UINT64 (pspec))
val = (gfloat) g_value_get_uint64 (value);
- else if (G_IS_PARAM_SPEC_DOUBLE (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_DOUBLE (pspec))
val = (gfloat) g_value_get_double (value);
- else if (G_IS_PARAM_SPEC_FLOAT (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_FLOAT (pspec))
val = g_value_get_float (value);
else
g_warning ("Unsupported type %s\n",
- g_type_name (G_PARAM_SPEC_TYPE (eprop->klass->pspec)));
+ g_type_name (G_PARAM_SPEC_TYPE (pspec)));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_numeric->spin), val);
}
}
@@ -646,39 +648,41 @@ static void
glade_eprop_numeric_changed (GtkWidget * spin, GladeEditorProperty * eprop)
{
GValue val = { 0, };
+ GParamSpec *pspec;
if (eprop->loading)
return;
- g_value_init (&val, eprop->klass->pspec->value_type);
+ pspec = glade_property_class_get_pspec (eprop->klass);
+ g_value_init (&val, pspec->value_type);
- if (G_IS_PARAM_SPEC_INT (eprop->klass->pspec))
+ if (G_IS_PARAM_SPEC_INT (pspec))
g_value_set_int (&val, gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
- else if (G_IS_PARAM_SPEC_UINT (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_UINT (pspec))
g_value_set_uint (&val, gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
- else if (G_IS_PARAM_SPEC_LONG (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_LONG (pspec))
g_value_set_long (&val, (glong) gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
- else if (G_IS_PARAM_SPEC_ULONG (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_ULONG (pspec))
g_value_set_ulong (&val, (gulong) gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
- else if (G_IS_PARAM_SPEC_INT64 (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_INT64 (pspec))
g_value_set_int64 (&val, (gint64) gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
- else if (G_IS_PARAM_SPEC_UINT64 (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_UINT64 (pspec))
g_value_set_uint64 (&val, (guint64) gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON (spin)));
- else if (G_IS_PARAM_SPEC_FLOAT (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_FLOAT (pspec))
g_value_set_float (&val, (gfloat) gtk_spin_button_get_value
(GTK_SPIN_BUTTON (spin)));
- else if (G_IS_PARAM_SPEC_DOUBLE (eprop->klass->pspec))
+ else if (G_IS_PARAM_SPEC_DOUBLE (pspec))
g_value_set_double (&val, gtk_spin_button_get_value
(GTK_SPIN_BUTTON (spin)));
else
g_warning ("Unsupported type %s\n",
- g_type_name (G_PARAM_SPEC_TYPE (eprop->klass->pspec)));
+ g_type_name (G_PARAM_SPEC_TYPE (pspec)));
glade_editor_property_commit_no_callback (eprop, &val);
g_value_unset (&val);
@@ -689,16 +693,14 @@ glade_eprop_numeric_create_input (GladeEditorProperty * eprop)
{
GladeEPropNumeric *eprop_numeric = GLADE_EPROP_NUMERIC (eprop);
GtkAdjustment *adjustment;
+ GParamSpec *pspec;
+ pspec = glade_property_class_get_pspec (eprop->klass);
adjustment = glade_property_class_make_adjustment (eprop->klass);
- eprop_numeric->spin = gtk_spin_button_new (adjustment, 4,
- G_IS_PARAM_SPEC_FLOAT (eprop->
- klass->
- pspec) ||
- G_IS_PARAM_SPEC_DOUBLE (eprop->
- klass->
- pspec) ? 2
- : 0);
+ eprop_numeric->spin =
+ gtk_spin_button_new (adjustment, 4,
+ G_IS_PARAM_SPEC_FLOAT (pspec) ||
+ G_IS_PARAM_SPEC_DOUBLE (pspec) ? 2 : 0);
gtk_widget_show (eprop_numeric->spin);
g_signal_connect (G_OBJECT (eprop_numeric->spin), "value_changed",
@@ -733,6 +735,7 @@ static void
glade_eprop_enum_load (GladeEditorProperty * eprop, GladeProperty * property)
{
GladeEPropEnum *eprop_enum = GLADE_EPROP_ENUM (eprop);
+ GParamSpec *pspec;
GEnumClass *eclass;
guint i;
gint value;
@@ -742,7 +745,8 @@ glade_eprop_enum_load (GladeEditorProperty * eprop, GladeProperty * property)
if (property)
{
- eclass = g_type_class_ref (eprop->klass->pspec->value_type);
+ pspec = glade_property_class_get_pspec (eprop->klass);
+ eclass = g_type_class_ref (pspec->value_type);
value = g_value_get_enum (glade_property_inline_value (property));
for (i = 0; i < eclass->n_values; i++)
@@ -760,6 +764,7 @@ glade_eprop_enum_changed (GtkWidget * combo_box, GladeEditorProperty * eprop)
{
gint ival;
GValue val = { 0, };
+ GParamSpec *pspec;
GladeProperty *property;
GtkTreeModel *tree_model;
GtkTreeIter iter;
@@ -772,8 +777,9 @@ glade_eprop_enum_changed (GtkWidget * combo_box, GladeEditorProperty * eprop)
gtk_tree_model_get (tree_model, &iter, 1, &ival, -1);
property = eprop->property;
+ pspec = glade_property_class_get_pspec (eprop->klass);
- g_value_init (&val, eprop->klass->pspec->value_type);
+ g_value_init (&val, pspec->value_type);
g_value_set_enum (&val, ival);
glade_editor_property_commit_no_callback (eprop, &val);
@@ -785,14 +791,16 @@ glade_eprop_enum_create_input (GladeEditorProperty * eprop)
{
GladeEPropEnum *eprop_enum = GLADE_EPROP_ENUM (eprop);
GladePropertyClass *klass;
+ GParamSpec *pspec;
GEnumClass *eclass;
GtkListStore *list_store;
GtkTreeIter iter;
GtkCellRenderer *cell_renderer;
guint i;
- klass = eprop->klass;
- eclass = g_type_class_ref (klass->pspec->value_type);
+ klass = eprop->klass;
+ pspec = glade_property_class_get_pspec (klass);
+ eclass = g_type_class_ref (pspec->value_type);
list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
@@ -801,7 +809,7 @@ glade_eprop_enum_create_input (GladeEditorProperty * eprop)
for (i = 0; i < eclass->n_values; i++)
{
const gchar *value_name =
- glade_get_displayable_value (klass->pspec->value_type,
+ glade_get_displayable_value (pspec->value_type,
eclass->values[i].value_nick);
if (value_name == NULL)
value_name = eclass->values[i].value_nick;
@@ -862,6 +870,7 @@ glade_eprop_flags_load (GladeEditorProperty * eprop, GladeProperty * property)
{
GladeEPropFlags *eprop_flags = GLADE_EPROP_FLAGS (eprop);
GFlagsClass *klass;
+ GParamSpec *pspec;
guint flag_num, value;
GString *string = g_string_new (NULL);
@@ -875,6 +884,7 @@ glade_eprop_flags_load (GladeEditorProperty * eprop, GladeProperty * property)
/* Populate the model with the flags. */
klass = g_type_class_ref (G_VALUE_TYPE (glade_property_inline_value (property)));
value = g_value_get_flags (glade_property_inline_value (property));
+ pspec = glade_property_class_get_pspec (eprop->klass);
/* Step through each of the flags in the class. */
for (flag_num = 0; flag_num < klass->n_values; flag_num++)
@@ -888,8 +898,7 @@ glade_eprop_flags_load (GladeEditorProperty * eprop, GladeProperty * property)
setting = ((value & mask) == mask) ? TRUE : FALSE;
value_name = glade_get_displayable_value
- (eprop->klass->pspec->value_type,
- klass->values[flag_num].value_nick);
+ (pspec->value_type, klass->values[flag_num].value_nick);
if (value_name == NULL)
value_name = klass->values[flag_num].value_name;
@@ -1454,6 +1463,7 @@ static void
glade_eprop_text_load (GladeEditorProperty * eprop, GladeProperty * property)
{
GladeEPropText *eprop_text = GLADE_EPROP_TEXT (eprop);
+ GParamSpec *pspec;
/* Chain up first */
editor_property_class->load (eprop, property);
@@ -1461,6 +1471,8 @@ glade_eprop_text_load (GladeEditorProperty * eprop, GladeProperty * property)
if (property == NULL)
return;
+ pspec = glade_property_class_get_pspec (eprop->klass);
+
if (GTK_IS_COMBO_BOX (eprop_text->text_entry))
{
if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (eprop_text->text_entry)))
@@ -1488,9 +1500,9 @@ glade_eprop_text_load (GladeEditorProperty * eprop, GladeProperty * property)
GtkEntry *entry = GTK_ENTRY (eprop_text->text_entry);
const gchar *text = NULL;
- if (eprop->klass->pspec->value_type == G_TYPE_STRING)
+ if (pspec->value_type == G_TYPE_STRING)
text = glade_property_make_string (property);
- else if (eprop->klass->pspec->value_type == GDK_TYPE_PIXBUF)
+ else if (pspec->value_type == GDK_TYPE_PIXBUF)
{
GObject *object = g_value_get_object (glade_property_inline_value (property));
if (object)
@@ -1505,13 +1517,13 @@ glade_eprop_text_load (GladeEditorProperty * eprop, GladeProperty * property)
buffer =
gtk_text_view_get_buffer (GTK_TEXT_VIEW (eprop_text->text_entry));
- if (eprop->klass->pspec->value_type == G_TYPE_STRV ||
- eprop->klass->pspec->value_type == G_TYPE_VALUE_ARRAY)
+ if (pspec->value_type == G_TYPE_STRV ||
+ pspec->value_type == G_TYPE_VALUE_ARRAY)
{
GladePropertyClass *pclass = glade_property_get_class (property);
gchar *text = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (pclass->handle),
- pclass, glade_property_inline_value (property));
+ (glade_property_class_get_adaptor (pclass),
+ pclass, glade_property_inline_value (property));
gtk_text_buffer_set_text (buffer, text ? text : "", -1);
g_free (text);
}
@@ -1532,11 +1544,14 @@ glade_eprop_text_changed_common (GladeEditorProperty * eprop,
const gchar * text, gboolean use_command)
{
GValue *val;
+ GParamSpec *pspec;
gchar *prop_text;
- if (eprop->klass->pspec->value_type == G_TYPE_STRV ||
- eprop->klass->pspec->value_type == G_TYPE_VALUE_ARRAY ||
- eprop->klass->pspec->value_type == GDK_TYPE_PIXBUF)
+ pspec = glade_property_class_get_pspec (eprop->klass);
+
+ if (pspec->value_type == G_TYPE_STRV ||
+ pspec->value_type == G_TYPE_VALUE_ARRAY ||
+ pspec->value_type == GDK_TYPE_PIXBUF)
{
val = glade_property_class_make_gvalue_from_string
(eprop->klass, text,
@@ -1988,21 +2003,24 @@ glade_eprop_text_create_input (GladeEditorProperty * eprop)
{
GladeEPropText *eprop_text = GLADE_EPROP_TEXT (eprop);
GladePropertyClass *klass;
+ GParamSpec *pspec;
GtkWidget *hbox;
klass = eprop->klass;
+ pspec = glade_property_class_get_pspec (klass);
hbox = gtk_hbox_new (FALSE, 0);
- if (klass->stock || klass->stock_icon)
+ if (glade_property_class_stock (klass) ||
+ glade_property_class_stock_icon (klass))
{
GtkCellRenderer *renderer;
GtkWidget *child;
GtkWidget *combo = gtk_combo_box_new_with_entry ();
eprop_text->store = (GtkTreeModel *)
- glade_eprop_text_create_store (klass->stock ? GLADE_TYPE_STOCK :
- GLADE_TYPE_STOCK_IMAGE);
+ glade_eprop_text_create_store (glade_property_class_stock (klass) ?
+ GLADE_TYPE_STOCK : GLADE_TYPE_STOCK_IMAGE);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo),
GTK_TREE_MODEL (eprop_text->store));
@@ -2020,7 +2038,7 @@ glade_eprop_text_create_input (GladeEditorProperty * eprop)
/* Dont allow custom items where an actual GTK+ stock item is expected
* (i.e. real items come with labels) */
child = gtk_bin_get_child (GTK_BIN (combo));
- if (klass->stock)
+ if (glade_property_class_stock (klass))
gtk_editable_set_editable (GTK_EDITABLE (child), FALSE);
else
gtk_editable_set_editable (GTK_EDITABLE (child), TRUE);
@@ -2033,9 +2051,9 @@ glade_eprop_text_create_input (GladeEditorProperty * eprop)
eprop_text->text_entry = combo;
}
- else if (klass->visible_lines > 1 ||
- klass->pspec->value_type == G_TYPE_STRV ||
- klass->pspec->value_type == G_TYPE_VALUE_ARRAY)
+ else if (glade_property_class_multiline (klass) ||
+ pspec->value_type == G_TYPE_STRV ||
+ pspec->value_type == G_TYPE_VALUE_ARRAY)
{
GtkWidget *swindow;
GtkTextBuffer *buffer;
@@ -2072,7 +2090,7 @@ glade_eprop_text_create_input (GladeEditorProperty * eprop)
g_signal_connect (G_OBJECT (eprop_text->text_entry), "changed",
G_CALLBACK (glade_eprop_text_changed), eprop);
- if (klass->pspec->value_type == GDK_TYPE_PIXBUF)
+ if (pspec->value_type == GDK_TYPE_PIXBUF)
{
GtkWidget *image =
gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
@@ -2089,7 +2107,7 @@ glade_eprop_text_create_input (GladeEditorProperty * eprop)
}
}
- if (klass->translatable)
+ if (glade_property_class_translatable (klass))
{
GtkWidget *button = gtk_button_new_with_label ("\342\200\246");
gtk_widget_show (button);
@@ -2600,31 +2618,32 @@ static gchar *
glade_eprop_object_dialog_title (GladeEditorProperty * eprop)
{
GladeWidgetAdaptor *adaptor;
+ GParamSpec *pspec;
const gchar *format;
- if (eprop->klass->parentless_widget)
- format = GLADE_IS_PARAM_SPEC_OBJECTS (eprop->klass->pspec) ?
+ pspec = glade_property_class_get_pspec (eprop->klass);
+
+ if (glade_property_class_parentless_widget (eprop->klass))
+ format = GLADE_IS_PARAM_SPEC_OBJECTS (pspec) ?
_("Choose parentless %s type objects in this project") :
_("Choose a parentless %s in this project");
else
- format = GLADE_IS_PARAM_SPEC_OBJECTS (eprop->klass->pspec) ?
+ format = GLADE_IS_PARAM_SPEC_OBJECTS (pspec) ?
_("Choose %s type objects in this project") :
_("Choose a %s in this project");
- if (GLADE_IS_PARAM_SPEC_OBJECTS (eprop->klass->pspec))
+ if (GLADE_IS_PARAM_SPEC_OBJECTS (pspec))
return g_strdup_printf (format, g_type_name
(glade_param_spec_objects_get_type
- (GLADE_PARAM_SPEC_OBJECTS (eprop->klass->pspec))));
+ (GLADE_PARAM_SPEC_OBJECTS (pspec))));
else if ((adaptor =
- glade_widget_adaptor_get_by_type
- (eprop->klass->pspec->value_type)) != NULL)
+ glade_widget_adaptor_get_by_type (pspec->value_type)) != NULL)
return g_strdup_printf (format, glade_widget_adaptor_get_title (adaptor));
/* Fallback on type name (which would look like "GtkButton"
* instead of "Button" and maybe not translated).
*/
- return g_strdup_printf (format, g_type_name
- (eprop->klass->pspec->value_type));
+ return g_strdup_printf (format, g_type_name (pspec->value_type));
}
@@ -2749,6 +2768,7 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
GtkWidget *action_area;
GladeProject *project;
GladeWidget *widget;
+ GParamSpec *pspec;
gchar *title = glade_eprop_object_dialog_title (eprop);
gint res;
GladeWidgetAdaptor *create_adaptor = NULL;
@@ -2756,16 +2776,15 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
widget = glade_property_get_widget (eprop->property);
project = glade_widget_get_project (widget);
- parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
+ pspec = glade_property_class_get_pspec (eprop->klass);
- if (eprop->klass->create_type)
+ if (glade_property_class_create_type (eprop->klass))
create_adaptor =
- glade_widget_adaptor_get_by_name (eprop->klass->create_type);
+ glade_widget_adaptor_get_by_name (glade_property_class_create_type (eprop->klass));
if (!create_adaptor &&
- G_TYPE_IS_INSTANTIATABLE (eprop->klass->pspec->value_type) &&
- !G_TYPE_IS_ABSTRACT (eprop->klass->pspec->value_type))
- create_adaptor =
- glade_widget_adaptor_get_by_type (eprop->klass->pspec->value_type);
+ G_TYPE_IS_INSTANTIATABLE (pspec->value_type) && !G_TYPE_IS_ABSTRACT (pspec->value_type))
+ create_adaptor = glade_widget_adaptor_get_by_type (pspec->value_type);
if (create_adaptor)
{
@@ -2847,8 +2866,8 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
tree_view = glade_eprop_object_view (TRUE);
glade_eprop_object_populate_view (project, GTK_TREE_VIEW (tree_view),
selected_list, exception_list,
- eprop->klass->pspec->value_type,
- eprop->klass->parentless_widget);
+ pspec->value_type,
+ glade_property_class_parentless_widget (eprop->klass));
g_list_free (selected_list);
g_list_free (exception_list);
@@ -2884,13 +2903,13 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
(eprop->klass, glade_widget_get_name (selected), project, widget);
/* Unparent the widget so we can reuse it for this property */
- if (eprop->klass->parentless_widget)
+ if (glade_property_class_parentless_widget (eprop->klass))
{
GObject *new_object, *old_object = NULL;
GladeWidget *new_widget;
GladeProperty *old_ref;
- if (!G_IS_PARAM_SPEC_OBJECT (eprop->klass->pspec))
+ if (!G_IS_PARAM_SPEC_OBJECT (pspec))
g_warning
("Parentless widget property should be of object type");
else
@@ -2905,7 +2924,7 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
glade_widget_get_parentless_widget_ref (new_widget)))
{
glade_command_push_group (_("Setting %s of %s to %s"),
- eprop->klass->name,
+ glade_property_class_get_name (eprop->klass),
glade_widget_get_name (widget),
glade_widget_get_name (new_widget));
glade_command_set_property (old_ref, NULL);
@@ -2932,7 +2951,7 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
/* translators: Creating 'a widget' for 'a property' of 'a widget' */
glade_command_push_group (_("Creating %s for %s of %s"),
glade_widget_adaptor_get_name (create_adaptor),
- eprop->klass->name,
+ glade_property_class_get_name (eprop->klass),
glade_widget_get_name (widget));
/* Dont bother if the user canceled the widget */
@@ -2980,7 +2999,7 @@ glade_eprop_object_load (GladeEditorProperty * eprop, GladeProperty * property)
return;
if ((obj_name = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (eprop->klass->handle),
+ (glade_property_class_get_adaptor (eprop->klass),
eprop->klass, glade_property_inline_value (property))) != NULL)
{
gtk_entry_set_text (GTK_ENTRY (eprop_object->entry), obj_name);
@@ -3050,7 +3069,7 @@ glade_eprop_objects_load (GladeEditorProperty * eprop, GladeProperty * property)
return;
if ((obj_name = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (eprop->klass->handle),
+ (glade_property_class_get_adaptor (eprop->klass),
eprop->klass, glade_property_inline_value (property))) != NULL)
{
gtk_entry_set_text (GTK_ENTRY (eprop_objects->entry), obj_name);
@@ -3092,6 +3111,7 @@ glade_eprop_objects_show_dialog (GtkWidget * dialog_button,
GtkWidget *tree_view;
GladeWidget *widget;
GladeProject *project;
+ GParamSpec *pspec;
gchar *title = glade_eprop_object_dialog_title (eprop);
gint res;
GList *selected_list = NULL, *exception_list = NULL, *selected_objects = NULL;
@@ -3099,6 +3119,7 @@ glade_eprop_objects_show_dialog (GtkWidget * dialog_button,
widget = glade_property_get_widget (eprop->property);
project = glade_widget_get_project (widget);
parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
+ pspec = glade_property_class_get_pspec (eprop->klass);
dialog = gtk_dialog_new_with_buttons (title,
GTK_WINDOW (parent),
@@ -3150,8 +3171,8 @@ glade_eprop_objects_show_dialog (GtkWidget * dialog_button,
}
glade_eprop_object_populate_view (project, GTK_TREE_VIEW (tree_view),
selected_list, exception_list,
- eprop->klass->pspec->value_type,
- eprop->klass->parentless_widget);
+ pspec->value_type,
+ glade_property_class_parentless_widget (eprop->klass));
g_list_free (selected_list);
g_list_free (exception_list);
@@ -3278,10 +3299,10 @@ glade_editor_property_load_by_widget (GladeEditorProperty * eprop,
if (widget)
{
/* properties are allowed to be missing on some internal widgets */
- if (eprop->klass->packing)
- property = glade_widget_get_pack_property (widget, eprop->klass->id);
+ if (glade_property_class_get_is_packing (eprop->klass))
+ property = glade_widget_get_pack_property (widget, glade_property_class_id (eprop->klass));
else
- property = glade_widget_get_property (widget, eprop->klass->id);
+ property = glade_widget_get_property (widget, glade_property_class_id (eprop->klass));
glade_editor_property_load (eprop, property);
diff --git a/gladeui/glade-editor-table.c b/gladeui/glade-editor-table.c
index c78a2d3..98b20d6 100644
--- a/gladeui/glade-editor-table.c
+++ b/gladeui/glade-editor-table.c
@@ -262,11 +262,15 @@ glade_editor_table_attach (GladeEditorTable * table,
static gint
property_class_comp (gconstpointer a, gconstpointer b)
{
- const GladePropertyClass *ca = a, *cb = b;
+ GladePropertyClass *ca = (GladePropertyClass *)a, *cb = (GladePropertyClass *)b;
+ GParamSpec *pa, *pb;
- if (ca->pspec->owner_type == cb->pspec->owner_type)
+ pa = glade_property_class_get_pspec (ca);
+ pb = glade_property_class_get_pspec (cb);
+
+ if (pa->owner_type == pb->owner_type)
{
- gdouble result = ca->weight - cb->weight;
+ gdouble result = glade_property_class_weight (ca) - glade_property_class_weight (cb);
/* Avoid cast to int */
if (result < 0.0)
return -1;
@@ -277,10 +281,10 @@ property_class_comp (gconstpointer a, gconstpointer b)
}
else
{
- if (g_type_is_a (ca->pspec->owner_type, cb->pspec->owner_type))
- return (ca->common || ca->packing) ? 1 : -1;
+ if (g_type_is_a (pa->owner_type, pb->owner_type))
+ return (glade_property_class_common (ca) || glade_property_class_get_is_packing (ca)) ? 1 : -1;
else
- return (ca->common || ca->packing) ? -1 : 1;
+ return (glade_property_class_common (ca) || glade_property_class_get_is_packing (ca)) ? -1 : 1;
}
}
@@ -303,9 +307,8 @@ get_sorted_properties (GladeWidgetAdaptor * adaptor, GladeEditorPageType type)
* invisible properties, allow adaptors to filter out properties from
* the GladeEditorTable using the "custom-layout" attribute.
*/
- if ((!klass->custom_layout) && GLADE_PROPERTY_CLASS_IS_TYPE (klass, type)
- && (glade_property_class_is_visible (klass) ||
- type == GLADE_PAGE_QUERY))
+ if (!glade_property_class_custom_layout (klass) && GLADE_PROPERTY_CLASS_IS_TYPE (klass, type)
+ && (glade_property_class_is_visible (klass) || type == GLADE_PAGE_QUERY))
{
list = g_list_prepend (list, klass);
}
@@ -321,11 +324,11 @@ append_item (GladeEditorTable * table,
GladeEditorProperty *property;
if (!(property = glade_widget_adaptor_create_eprop
- (GLADE_WIDGET_ADAPTOR (klass->handle),
- klass, from_query_dialog == FALSE)))
+ (glade_property_class_get_adaptor (klass), klass, from_query_dialog == FALSE)))
{
g_critical ("Unable to create editor for property '%s' of class '%s'",
- klass->id, glade_widget_adaptor_get_name (GLADE_WIDGET_ADAPTOR (klass->handle)));
+ glade_property_class_id (klass),
+ glade_widget_adaptor_get_name (glade_property_class_get_adaptor (klass)));
return NULL;
}
diff --git a/gladeui/glade-editor.c b/gladeui/glade-editor.c
index 3b8bff1..2c5d914 100644
--- a/gladeui/glade-editor.c
+++ b/gladeui/glade-editor.c
@@ -926,7 +926,7 @@ glade_editor_reset_view (GladeEditor * editor)
view_widget = gtk_tree_view_new_with_model (model);
g_object_set (G_OBJECT (view_widget), "enable-search", FALSE, NULL);
- /********************* fake invisible column *********************/
+ /********************* fake invisible column *********************/
renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer), "editable", FALSE, "visible", FALSE, NULL);
@@ -936,7 +936,7 @@ glade_editor_reset_view (GladeEditor * editor)
gtk_tree_view_column_set_visible (column, FALSE);
gtk_tree_view_set_expander_column (GTK_TREE_VIEW (view_widget), column);
- /************************ enabled column ************************/
+ /************************ enabled column ************************/
renderer = gtk_cell_renderer_toggle_new ();
g_object_set (G_OBJECT (renderer),
"mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
@@ -950,7 +950,7 @@ glade_editor_reset_view (GladeEditor * editor)
"activatable", COLUMN_NDEFAULT,
"active", COLUMN_ENABLED, "visible", COLUMN_CHILD, NULL);
- /********************* property name column *********************/
+ /********************* property name column *********************/
renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer), "editable", FALSE, NULL);
@@ -959,7 +959,7 @@ glade_editor_reset_view (GladeEditor * editor)
_("Property"), renderer,
"text", COLUMN_PROP_NAME, "weight", COLUMN_WEIGHT, NULL);
- /******************* default indicator column *******************/
+ /******************* default indicator column *******************/
renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer),
"editable", FALSE,
@@ -1018,9 +1018,9 @@ glade_editor_populate_reset_view (GladeEditor * editor, GtkTreeView * tree_view)
if (glade_property_class_is_visible (pclass) == FALSE)
continue;
- if (pclass->atk)
+ if (glade_property_class_atk (pclass))
iter = &atk_iter;
- else if (pclass->common)
+ else if (glade_property_class_common (pclass))
iter = &common_iter;
else
iter = &general_iter;
@@ -1030,7 +1030,7 @@ glade_editor_populate_reset_view (GladeEditor * editor, GtkTreeView * tree_view)
gtk_tree_store_append (model, &property_iter, iter);
gtk_tree_store_set (model, &property_iter,
COLUMN_ENABLED, !def,
- COLUMN_PROP_NAME, pclass->name,
+ COLUMN_PROP_NAME, glade_property_class_get_name (pclass),
COLUMN_PROPERTY, property,
COLUMN_WEIGHT, PANGO_WEIGHT_NORMAL,
COLUMN_CHILD, TRUE,
@@ -1063,7 +1063,7 @@ glade_editor_reset_selection_changed_cb (GtkTreeSelection * selection,
pclass = glade_property_get_class (property);
gtk_text_buffer_set_text (text_buffer,
- pclass ? pclass->tooltip : message,
+ pclass ? glade_property_class_get_tooltip (pclass) : message,
-1);
if (property)
g_object_unref (G_OBJECT (property));
diff --git a/gladeui/glade-popup.c b/gladeui/glade-popup.c
index b488307..1de6874 100644
--- a/gladeui/glade-popup.c
+++ b/gladeui/glade-popup.c
@@ -693,18 +693,20 @@ glade_popup_property_docs_cb (GtkMenuItem * item, GladeProperty * property)
{
GladeWidgetAdaptor *adaptor, *prop_adaptor;
GladePropertyClass *pclass;
- gchar *search, *book;
+ GParamSpec *pspec;
+ gchar *search, *book;
pclass = glade_property_get_class (property);
- prop_adaptor = glade_widget_adaptor_from_pclass (pclass);
- adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pclass->pspec);
- search = g_strdup_printf ("The %s property", pclass->id);
+ pspec = glade_property_class_get_pspec (pclass);
+ prop_adaptor = glade_property_class_get_adaptor (pclass);
+ adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec);
+ search = g_strdup_printf ("The %s property", glade_property_class_id (pclass));
g_object_get (adaptor, "book", &book, NULL);
glade_editor_search_doc_search (glade_app_get_editor (),
book,
- g_type_name (pclass->pspec->owner_type), search);
+ g_type_name (pspec->owner_type), search);
g_free (book);
g_free (search);
@@ -716,14 +718,16 @@ glade_popup_property_pop (GladeProperty * property, GdkEventButton * event)
GladeWidgetAdaptor *adaptor, *prop_adaptor;
GladePropertyClass *pclass;
+ GParamSpec *pspec;
GtkWidget *popup_menu;
gchar *book = NULL;
gint button;
gint event_time;
pclass = glade_property_get_class (property);
- prop_adaptor = glade_widget_adaptor_from_pclass (pclass);
- adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pclass->pspec);
+ pspec = glade_property_class_get_pspec (pclass);
+ prop_adaptor = glade_property_class_get_adaptor (pclass);
+ adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec);
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index a864cad..b522779 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -1194,16 +1194,18 @@ update_project_for_resource_path (GladeProject * project)
for (list = glade_widget_get_properties (widget); list; list = list->next)
{
GladePropertyClass *klass;
+ GParamSpec *pspec;
property = list->data;
klass = glade_property_get_class (property);
+ pspec = glade_property_class_get_pspec (klass);
/* XXX We should have a "resource" flag on properties that need
* to be loaded from the resource path, but that would require
* that they can serialize both ways (custom properties are only
* required to generate unique strings for value comparisons).
*/
- if (klass->pspec->value_type == GDK_TYPE_PIXBUF)
+ if (pspec->value_type == GDK_TYPE_PIXBUF)
{
GValue *value;
gchar *string;
@@ -1338,15 +1340,16 @@ glade_project_introspect_gtk_version (GladeProject * project)
GladeProperty *property = l->data;
GladePropertyClass *pclass = glade_property_get_class (property);
GladeWidgetAdaptor *prop_adaptor, *adaptor;
+ GParamSpec *pspec;
/* Unset properties ofcourse dont count... */
if (glade_property_original_default (property))
continue;
/* Check if this property originates from a GTK+ widget class */
- prop_adaptor = glade_widget_adaptor_from_pclass (pclass);
- adaptor =
- glade_widget_adaptor_from_pspec (prop_adaptor, pclass->pspec);
+ pspec = glade_property_class_get_pspec (pclass);
+ prop_adaptor = glade_property_class_get_adaptor (pclass);
+ adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec);
catalog = NULL;
is_gtk_adaptor = FALSE;
@@ -1359,8 +1362,8 @@ glade_project_introspect_gtk_version (GladeProject * project)
if (is_gtk_adaptor &&
!GPC_VERSION_CHECK (pclass, target_major, target_minor))
{
- target_major = pclass->version_since_major;
- target_minor = pclass->version_since_minor;
+ target_major = glade_property_class_since_major (pclass);
+ target_minor = glade_property_class_since_minor (pclass);
}
}
@@ -2053,6 +2056,7 @@ glade_project_verify_property_internal (GladeProject * project,
GladeWidgetAdaptor *adaptor, *prop_adaptor;
GladeWidget *widget;
GladePropertyClass *pclass;
+ GParamSpec *pspec;
gint target_major, target_minor;
gchar *catalog, *tooltip;
@@ -2060,12 +2064,13 @@ glade_project_verify_property_internal (GladeProject * project,
return;
pclass = glade_property_get_class (property);
- prop_adaptor = glade_widget_adaptor_from_pclass (pclass);
- adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pclass->pspec);
+ pspec = glade_property_class_get_pspec (pclass);
+ prop_adaptor = glade_property_class_get_adaptor (pclass);
+ adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec);
widget = glade_property_get_widget (property);
g_object_get (adaptor, "catalog", &catalog, NULL);
- glade_project_target_version_for_adaptor (glade_widget_get_project (widget), adaptor,
+ glade_project_target_version_for_adaptor (project, adaptor,
&target_major, &target_minor);
if (!GPC_VERSION_CHECK (pclass, target_major, target_minor))
@@ -2074,8 +2079,8 @@ glade_project_verify_property_internal (GladeProject * project,
{
tooltip = g_strdup_printf (PROP_VERSION_CONFLICT_MSGFMT,
catalog,
- pclass->version_since_major,
- pclass->version_since_minor,
+ glade_property_class_since_major (pclass),
+ glade_property_class_since_minor (pclass),
catalog, target_major, target_minor);
glade_property_set_support_warning (property, FALSE, tooltip);
@@ -2083,15 +2088,15 @@ glade_project_verify_property_internal (GladeProject * project,
}
else
g_string_append_printf (string,
- pclass->packing ?
+ glade_property_class_get_is_packing (pclass) ?
PACK_PROP_VERSION_CONFLICT_FMT :
PROP_VERSION_CONFLICT_FMT,
path_name,
- pclass->name,
+ glade_property_class_get_name (pclass),
glade_widget_adaptor_get_title (adaptor),
catalog,
- pclass->version_since_major,
- pclass->version_since_minor);
+ glade_property_class_since_major (pclass),
+ glade_property_class_since_minor (pclass));
}
else if (forwidget)
glade_property_set_support_warning (property, FALSE, NULL);
@@ -2190,7 +2195,8 @@ glade_project_verify_property (GladeProperty * property)
widget = glade_property_get_widget (property);
project = glade_widget_get_project (widget);
- glade_project_verify_property_internal (project, property, NULL, NULL, TRUE);
+ if (project)
+ glade_project_verify_property_internal (project, property, NULL, NULL, TRUE);
}
void
diff --git a/gladeui/glade-property-class.c b/gladeui/glade-property-class.c
index e4c4bc3..337a8ad 100644
--- a/gladeui/glade-property-class.c
+++ b/gladeui/glade-property-class.c
@@ -56,21 +56,154 @@
#define FLOATING_PAGE_INCREMENT 0.1F
#define FLOATING_PAGE_SIZE 0.00F
+
+struct _GladePropertyClass
+{
+ GladeWidgetAdaptor *adaptor; /* The GladeWidgetAdaptor that this property class
+ * was created for.
+ */
+
+ guint16 version_since_major; /* Version in which this property was */
+ guint16 version_since_minor; /* introduced. */
+
+ GParamSpec *pspec; /* The Parameter Specification for this property.
+ */
+
+ gchar *id; /* The id of the property. Like "label" or "xpad"
+ * this is a non-translatable string
+ */
+
+ gchar *name; /* The name of the property. Like "Label" or "X Pad"
+ * this is a translatable string
+ */
+
+ gchar *tooltip; /* The default tooltip for the property editor rows.
+ */
+
+ GValue *def; /* The default value for this property (this will exist
+ * as a copy of orig_def if not specified by the catalog)
+ */
+
+ GValue *orig_def; /* The real default value obtained through introspection.
+ * (used to decide whether we should write to the
+ * glade file or not, or to restore the loaded property
+ * correctly); all property classes have and orig_def.
+ */
+
+ guint multiline : 1; /* Whether to use multiple lines to edit this text property.
+ */
+
+ guint virt : 1; /* Whether this is a virtual property with its pspec supplied
+ * via the catalog (or hard code-paths); or FALSE if its a real
+ * GObject introspected property
+ */
+
+ guint optional : 1; /* Some properties are optional by nature like
+ * default width. It can be set or not set. A
+ * default property has a check box in the
+ * left that enables/disables the input
+ */
+
+ guint optional_default : 1; /* For optional values, what the default is */
+
+ guint construct_only : 1; /* Whether this property is G_PARAM_CONSTRUCT_ONLY or not */
+
+ guint common : 1; /* Common properties go in the common tab */
+ guint atk : 1; /* Atk properties go in the atk tab */
+ guint packing : 1; /* Packing properties go in the packing tab */
+ guint query : 1; /* Whether we should explicitly ask the user about this property
+ * when instantiating a widget with this property (through a popup
+ * dialog).
+ */
+
+ guint translatable : 1; /* The property should be translatable, which
+ * means that it needs extra parameters in the
+ * UI.
+ */
+
+ /* These three are the master switches for the glade-file output,
+ * property editor availability & live object updates in the glade environment.
+ */
+ guint save : 1; /* Whether we should save to the glade file or not
+ * (mostly just for virtual internal glade properties,
+ * also used for properties with generic pspecs that
+ * are saved in custom ways by the plugin)
+ */
+ guint save_always : 1; /* Used to make a special case exception and always
+ * save this property regardless of what the default
+ * value is (used for some special cases like properties
+ * that are assigned initial values in composite widgets
+ * or derived widget code).
+ */
+ guint visible : 1; /* Whether or not to show this property in the editor &
+ * reset dialog.
+ */
+
+ guint custom_layout : 1; /* Properties marked as custom_layout will not be included
+ * in a base #GladeEditorTable implementation (use this
+ * for properties you want to layout in custom ways in
+ * a #GladeEditable widget
+ */
+
+ guint ignore : 1; /* When true, we will not sync the object when the property
+ * changes, or load values from the object.
+ */
+
+ guint needs_sync : 1; /* Virtual properties need to be synchronized after object
+ * creation, some properties that are not virtual also need
+ * handling from the backend, if "needs-sync" is true then
+ * this property will by synced with virtual properties.
+ */
+
+ guint is_modified : 1; /* If true, this property_class has been "modified" from the
+ * the standard property by a xml file. */
+
+ guint themed_icon : 1; /* Some GParamSpecString properties reffer to icon names
+ * in the icon theme... these need to be specified in the
+ * property class definition if proper editing tools are to
+ * be used.
+ */
+ guint stock_icon : 1; /* String properties can also denote stock icons, including
+ * icons from icon factories...
+ */
+ guint stock : 1; /* ... or a narrower list of "items" from gtk builtin stock items.
+ */
+
+ guint transfer_on_paste : 1; /* If this is a packing prop,
+ * wether we should transfer it on paste.
+ */
+
+ guint parentless_widget : 1; /* True if this property should point to a parentless widget
+ * in the project
+ */
+
+ gdouble weight; /* This will determine the position of this property in
+ * the editor.
+ */
+
+ gchar *create_type; /* If this is an object property and you want the option to create
+ * one from the object selection dialog, then set the name of the
+ * concrete type here.
+ */
+};
+
/**
* glade_property_class_new:
- * @handle: A generic pointer (i.e. a #GladeWidgetClass)
+ * @adaptor: The #GladeWidgetAdaptor to create this property for
+ * @id: the id for the new property class
*
* Returns: a new #GladePropertyClass
*/
GladePropertyClass *
-glade_property_class_new (gpointer handle)
+glade_property_class_new (GladeWidgetAdaptor *adaptor,
+ const gchar *id)
{
GladePropertyClass *property_class;
- property_class = g_new0 (GladePropertyClass, 1);
- property_class->handle = handle;
+ property_class = g_slice_new0 (GladePropertyClass);
+ property_class->adaptor = adaptor;
property_class->pspec = NULL;
- property_class->id = NULL;
+ property_class->id = g_strdup (id);
property_class->name = NULL;
property_class->tooltip = NULL;
property_class->def = NULL;
@@ -98,8 +231,8 @@ glade_property_class_new (gpointer handle)
property_class->parentless_widget = FALSE;
/* Initialize them to the base version */
- property_class->version_since_major = GWA_VERSION_SINCE_MAJOR (handle);
- property_class->version_since_minor = GWA_VERSION_SINCE_MINOR (handle);
+ property_class->version_since_major = GWA_VERSION_SINCE_MAJOR (adaptor);
+ property_class->version_since_minor = GWA_VERSION_SINCE_MINOR (adaptor);
return property_class;
}
@@ -107,11 +240,13 @@ glade_property_class_new (gpointer handle)
/**
* glade_property_class_clone:
* @property_class: a #GladePropertyClass
+ * @reset_version: whether the introduction version should be reset in the clone
*
* Returns: a new #GladePropertyClass cloned from @property_class
*/
GladePropertyClass *
-glade_property_class_clone (GladePropertyClass * property_class)
+glade_property_class_clone (GladePropertyClass *property_class,
+ gboolean reset_version)
{
GladePropertyClass *clone;
@@ -122,6 +257,12 @@ glade_property_class_clone (GladePropertyClass * property_class)
/* copy ints over */
memcpy (clone, property_class, sizeof (GladePropertyClass));
+ if (reset_version)
+ {
+ clone->version_since_major = 0;
+ clone->version_since_minor = 0;
+ }
+
/* Make sure we own our strings */
clone->pspec = property_class->pspec;
clone->id = g_strdup (clone->id);
@@ -174,7 +315,8 @@ glade_property_class_free (GladePropertyClass * property_class)
g_value_unset (property_class->def);
g_free (property_class->def);
}
- g_free (property_class);
+
+ g_slice_free (GladePropertyClass, property_class);
}
@@ -904,13 +1046,13 @@ glade_property_class_get_from_gvalue (GladePropertyClass * klass,
}
-/* "need_handle": An evil trick to let us create pclasses without
+/* "need_adaptor": An evil trick to let us create pclasses without
* adaptors and editors.
*/
GladePropertyClass *
-glade_property_class_new_from_spec_full (gpointer handle,
- GParamSpec * spec,
- gboolean need_handle)
+glade_property_class_new_from_spec_full (GladeWidgetAdaptor *adaptor,
+ GParamSpec *spec,
+ gboolean need_adaptor)
{
GObjectClass *gtk_widget_class;
GladePropertyClass *property_class;
@@ -922,7 +1064,7 @@ glade_property_class_new_from_spec_full (gpointer handle,
/* Only properties that are _new_from_spec() are
* not virtual properties
*/
- property_class = glade_property_class_new (handle);
+ property_class = glade_property_class_new (adaptor, spec->name);
property_class->virt = FALSE;
property_class->pspec = spec;
@@ -930,13 +1072,12 @@ glade_property_class_new_from_spec_full (gpointer handle,
if ((spec->flags & G_PARAM_WRITABLE) == 0)
goto failed;
- property_class->id = g_strdup (spec->name);
property_class->name = g_strdup (g_param_spec_get_nick (spec));
/* Register only editable properties.
*/
- if (need_handle && !(eprop = glade_widget_adaptor_create_eprop
- (GLADE_WIDGET_ADAPTOR (handle), property_class, FALSE)))
+ if (need_adaptor && !(eprop = glade_widget_adaptor_create_eprop
+ (GLADE_WIDGET_ADAPTOR (adaptor), property_class, FALSE)))
goto failed;
/* Just created it to see if it was supported.... destroy now... */
@@ -976,16 +1117,16 @@ failed:
/**
* glade_property_class_new_from_spec:
- * @handle: A generic pointer (i.e. a #GladeWidgetClass)
+ * @adaptor: A generic pointer (i.e. a #GladeWidgetClass)
* @spec: A #GParamSpec
*
* Returns: a newly created #GladePropertyClass based on @spec
* or %NULL if its unsupported.
*/
GladePropertyClass *
-glade_property_class_new_from_spec (gpointer handle, GParamSpec * spec)
+glade_property_class_new_from_spec (GladeWidgetAdaptor *adaptor, GParamSpec * spec)
{
- return glade_property_class_new_from_spec_full (handle, spec, TRUE);
+ return glade_property_class_new_from_spec_full (adaptor, spec, TRUE);
}
/**
@@ -999,9 +1140,111 @@ gboolean
glade_property_class_is_visible (GladePropertyClass * klass)
{
g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), FALSE);
+
return klass->visible;
}
+void
+glade_property_class_set_adaptor (GladePropertyClass *property_class,
+ GladeWidgetAdaptor *adaptor)
+{
+ g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class));
+
+ property_class->adaptor = adaptor;
+}
+
+GladeWidgetAdaptor *
+glade_property_class_get_adaptor (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL);
+
+ return property_class->adaptor;
+}
+
+GParamSpec *
+glade_property_class_get_pspec (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL);
+
+ return property_class->pspec;
+}
+
+void
+glade_property_class_set_pspec (GladePropertyClass *property_class,
+ GParamSpec *pspec)
+{
+ g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class));
+
+ property_class->pspec = pspec;
+}
+
+void
+glade_property_class_set_is_packing (GladePropertyClass *property_class,
+ gboolean is_packing)
+{
+ g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class));
+
+ property_class->packing = is_packing;
+}
+
+gboolean
+glade_property_class_get_is_packing (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->packing;
+}
+
+gboolean
+glade_property_class_save (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->save;
+}
+
+gboolean
+glade_property_class_save_always (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->save_always;
+}
+
+void
+glade_property_class_set_virtual (GladePropertyClass *property_class,
+ gboolean virtual)
+{
+ g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class));
+
+ property_class->virt = virtual;
+}
+
+gboolean
+glade_property_class_get_virtual (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->virt;
+}
+
+void
+glade_property_class_set_ignore (GladePropertyClass *property_class,
+ gboolean ignore)
+{
+ g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class));
+
+ property_class->ignore = ignore;
+}
+
+gboolean
+glade_property_class_get_ignore (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->ignore;
+}
+
/**
* glade_property_class_is_object:
* @property_class: A #GladePropertyClass
@@ -1019,6 +1262,228 @@ glade_property_class_is_object (GladePropertyClass * klass)
klass->pspec->value_type != GDK_TYPE_PIXBUF));
}
+void
+glade_property_class_set_name (GladePropertyClass *property_class,
+ const gchar *name)
+{
+ g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class));
+
+ g_free (property_class->name);
+ property_class->name = g_strdup (name);
+}
+
+G_CONST_RETURN gchar *
+glade_property_class_get_name (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL);
+
+ return property_class->name;
+}
+
+void
+glade_property_class_set_tooltip (GladePropertyClass *property_class,
+ const gchar *tooltip)
+{
+ g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class));
+
+ g_free (property_class->tooltip);
+ property_class->tooltip = g_strdup (tooltip);
+}
+
+G_CONST_RETURN gchar *
+glade_property_class_get_tooltip (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL);
+
+ return property_class->tooltip;
+}
+
+void
+glade_property_class_set_construct_only (GladePropertyClass *property_class,
+ gboolean construct_only)
+{
+ g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class));
+
+ property_class->construct_only = construct_only;
+}
+
+gboolean
+glade_property_class_get_construct_only (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->construct_only;
+}
+
+G_CONST_RETURN GValue *
+glade_property_class_get_default (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL);
+
+ return property_class->def;
+}
+
+G_CONST_RETURN GValue *
+glade_property_class_get_original_default (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL);
+
+ return property_class->orig_def;
+}
+
+gboolean
+glade_property_class_translatable (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->translatable;
+}
+
+gboolean
+glade_property_class_needs_sync (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->needs_sync;
+}
+
+gboolean
+glade_property_class_query (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->query;
+}
+
+gboolean
+glade_property_class_atk (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->atk;
+}
+
+gboolean
+glade_property_class_common (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->common;
+}
+
+gboolean
+glade_property_class_parentless_widget (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->parentless_widget;
+}
+
+gboolean
+glade_property_class_optional (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->optional;
+}
+
+gboolean
+glade_property_class_optional_default (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->optional_default;
+}
+
+gboolean
+glade_property_class_multiline (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->multiline;
+}
+
+gboolean
+glade_property_class_stock (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->stock;
+}
+
+gboolean
+glade_property_class_stock_icon (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->stock_icon;
+}
+
+gboolean
+glade_property_class_transfer_on_paste (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->transfer_on_paste;
+}
+
+gboolean
+glade_property_class_custom_layout (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->custom_layout;
+}
+
+gdouble
+glade_property_class_weight (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), -1.0);
+
+ return property_class->weight;
+}
+
+G_CONST_RETURN gchar *
+glade_property_class_create_type (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL);
+
+ return property_class->create_type;
+}
+
+guint16
+glade_property_class_since_major (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), 0);
+
+ return property_class->version_since_major;
+}
+
+guint16
+glade_property_class_since_minor (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), 0);
+
+ return property_class->version_since_minor;
+}
+
+
+G_CONST_RETURN gchar *
+glade_property_class_id (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL);
+
+ return property_class->id;
+}
+
+gboolean
+glade_property_class_themed_icon (GladePropertyClass *property_class)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE);
+
+ return property_class->themed_icon;
+}
+
/**
* gpc_read_displayable_values_from_node:
* @node: a GLADE_TAG_DISPLAYABLE_VALUES node
@@ -1109,7 +1574,7 @@ gpc_read_displayable_values_from_node (GladeXmlNode * node,
if (n_values != registered_values)
g_message ("%d missing displayable value for %s::%s",
n_values - registered_values,
- glade_widget_adaptor_get_name ((GladeWidgetAdaptor *) klass->handle), klass->id);
+ glade_widget_adaptor_get_name (klass->adaptor), klass->id);
g_type_class_unref (the_class);
@@ -1552,10 +2017,9 @@ glade_property_class_update_from_node (GladeXmlNode * node,
}
}
- /* Visible lines */
- glade_xml_get_value_int (node, GLADE_TAG_VISIBLE_LINES,
- &klass->visible_lines);
-
+ klass->multiline =
+ glade_xml_get_property_boolean (node, GLADE_TAG_MULTILINE,
+ klass->multiline);
klass->construct_only =
glade_xml_get_property_boolean (node, GLADE_TAG_CONSTRUCT_ONLY,
klass->construct_only);
@@ -1709,9 +2173,9 @@ glade_property_class_compare (GladePropertyClass * klass,
* NOTE: We could add a pclass option to use the string compare vs. boxed compare...
*/
val1 =
- glade_widget_adaptor_string_from_value (klass->handle, klass, value1);
+ glade_widget_adaptor_string_from_value (klass->adaptor, klass, value1);
val2 =
- glade_widget_adaptor_string_from_value (klass->handle, klass, value2);
+ glade_widget_adaptor_string_from_value (klass->adaptor, klass, value2);
if (val1 && val2)
retval = strcmp (val1, val2);
@@ -1743,3 +2207,54 @@ glade_property_class_compare (GladePropertyClass * klass,
return retval;
}
+
+/*
+ This function assignes "weight" to each property in its natural order staring from 1.
+ If parent is 0 weight will be set for every GladePropertyClass in the list.
+ This function will not override weight if it is already set (weight >= 0.0)
+*/
+void
+glade_property_class_set_weights (GList ** properties, GType parent)
+{
+ gint normal = 0, common = 0, packing = 0;
+ GList *l;
+
+ for (l = *properties; l && l->data; l = g_list_next (l))
+ {
+ GladePropertyClass *klass = l->data;
+
+ if (klass->visible &&
+ (parent) ? parent == klass->pspec->owner_type : TRUE && !klass->atk)
+ {
+ /* Use a different counter for each tab (common, packing and normal) */
+ if (klass->common)
+ common++;
+ else if (klass->packing)
+ packing++;
+ else
+ normal++;
+
+ /* Skip if it is already set */
+ if (klass->weight >= 0.0)
+ continue;
+
+ /* Special-casing weight of properties for seperate tabs */
+ if (klass->common)
+ klass->weight = common;
+ else if (klass->packing)
+ klass->weight = packing;
+ else
+ klass->weight = normal;
+ }
+ }
+}
+
+void
+glade_property_class_load_defaults_from_spec (GladePropertyClass *property_class)
+{
+ property_class->orig_def =
+ glade_property_class_get_default_from_spec (property_class->pspec);
+
+ property_class->def =
+ glade_property_class_get_default_from_spec (property_class->pspec);
+}
diff --git a/gladeui/glade-property-class.h b/gladeui/glade-property-class.h
index e24f242..515798d 100644
--- a/gladeui/glade-property-class.h
+++ b/gladeui/glade-property-class.h
@@ -24,14 +24,15 @@ G_BEGIN_DECLS
*
* Checks if @gpc is good to be loaded as @type
*/
-#define GLADE_PROPERTY_CLASS_IS_TYPE(gpc, type) \
- (((type) == GLADE_PAGE_GENERAL && \
- !(gpc)->common && !(gpc)->packing && !(gpc)->atk) || \
- ((type) == GLADE_PAGE_COMMON && (gpc)->common) || \
- ((type) == GLADE_PAGE_PACKING && (gpc)->packing) || \
- ((type) == GLADE_PAGE_ATK && (gpc)->atk) || \
- ((type) == GLADE_PAGE_QUERY && (gpc)->query))
-
+#define GLADE_PROPERTY_CLASS_IS_TYPE(gpc, type) \
+ (((type) == GLADE_PAGE_GENERAL && \
+ !glade_property_class_common (gpc) && \
+ !glade_property_class_get_is_packing (gpc) && \
+ !glade_property_class_atk (gpc)) || \
+ ((type) == GLADE_PAGE_COMMON && glade_property_class_common (gpc)) || \
+ ((type) == GLADE_PAGE_PACKING && glade_property_class_get_is_packing (gpc)) || \
+ ((type) == GLADE_PAGE_ATK && glade_property_class_atk (gpc)) || \
+ ((type) == GLADE_PAGE_QUERY && glade_property_class_query (gpc)))
/**
* GPC_VERSION_CHECK:
@@ -43,9 +44,9 @@ G_BEGIN_DECLS
*
*/
#define GPC_VERSION_CHECK(klass, major_version, minor_version) \
- ((GLADE_PROPERTY_CLASS (klass)->version_since_major == major_version) ? \
- (GLADE_PROPERTY_CLASS (klass)->version_since_minor <= minor_version) : \
- (GLADE_PROPERTY_CLASS (klass)->version_since_major <= major_version))
+ ((glade_property_class_since_major (GLADE_PROPERTY_CLASS (klass)) == major_version) ? \
+ (glade_property_class_since_minor (GLADE_PROPERTY_CLASS (klass)) <= minor_version) : \
+ (glade_property_class_since_major (GLADE_PROPERTY_CLASS (klass)) <= major_version))
#define GPC_OBJECT_DELIMITER ", "
@@ -53,155 +54,70 @@ G_BEGIN_DECLS
typedef struct _GladePropertyClass GladePropertyClass;
-struct _GladePropertyClass
-{
-
- gpointer handle; /* The GladeWidgetAdaptor that this property class
- * was created for.
- */
-
- guint16 version_since_major; /* Version in which this property was */
- guint16 version_since_minor; /* introduced. */
-
- GParamSpec *pspec; /* The Parameter Specification for this property.
- */
-
- gchar *id; /* The id of the property. Like "label" or "xpad"
- * this is a non-translatable string
- */
-
- gchar *name; /* The name of the property. Like "Label" or "X Pad"
- * this is a translatable string
- */
-
- gchar *tooltip; /* The default tooltip for the property editor rows.
- */
-
- GValue *def; /* The default value for this property (this will exist
- * as a copy of orig_def if not specified by the catalog)
- */
-
- GValue *orig_def; /* The real default value obtained through introspection.
- * (used to decide whether we should write to the
- * glade file or not, or to restore the loaded property
- * correctly); all property classes have and orig_def.
- */
-
- gint visible_lines; /* When this pspec calls for a text editor, how many
- * lines should be visible in the editor.
- */
-
- guint virt : 1; /* Whether this is a virtual property with its pspec supplied
- * via the catalog (or hard code-paths); or FALSE if its a real
- * GObject introspected property
- */
-
- guint optional : 1; /* Some properties are optional by nature like
- * default width. It can be set or not set. A
- * default property has a check box in the
- * left that enables/disables the input
- */
-
- guint optional_default : 1; /* For optional values, what the default is */
-
- guint construct_only : 1; /* Whether this property is G_PARAM_CONSTRUCT_ONLY or not */
-
- guint common : 1; /* Common properties go in the common tab */
- guint atk : 1; /* Atk properties go in the atk tab */
- guint packing : 1; /* Packing properties go in the packing tab */
- guint query : 1; /* Whether we should explicitly ask the user about this property
- * when instantiating a widget with this property (through a popup
- * dialog).
- */
-
- guint translatable : 1; /* The property should be translatable, which
- * means that it needs extra parameters in the
- * UI.
- */
-
- /* These three are the master switches for the glade-file output,
- * property editor availability & live object updates in the glade environment.
- */
- guint save : 1; /* Whether we should save to the glade file or not
- * (mostly just for virtual internal glade properties,
- * also used for properties with generic pspecs that
- * are saved in custom ways by the plugin)
- */
- guint save_always : 1; /* Used to make a special case exception and always
- * save this property regardless of what the default
- * value is (used for some special cases like properties
- * that are assigned initial values in composite widgets
- * or derived widget code).
- */
- guint visible : 1; /* Whether or not to show this property in the editor &
- * reset dialog.
- */
-
- guint custom_layout : 1; /* Properties marked as custom_layout will not be included
- * in a base #GladeEditorTable implementation (use this
- * for properties you want to layout in custom ways in
- * a #GladeEditable widget
- */
-
- guint ignore : 1; /* When true, we will not sync the object when the property
- * changes, or load values from the object.
- */
-
- guint needs_sync : 1; /* Virtual properties need to be synchronized after object
- * creation, some properties that are not virtual also need
- * handling from the backend, if "needs-sync" is true then
- * this property will by synced with virtual properties.
- */
-
- guint is_modified : 1; /* If true, this property_class has been "modified" from the
- * the standard property by a xml file. */
-
- guint themed_icon : 1; /* Some GParamSpecString properties reffer to icon names
- * in the icon theme... these need to be specified in the
- * property class definition if proper editing tools are to
- * be used.
- */
- guint stock_icon : 1; /* String properties can also denote stock icons, including
- * icons from icon factories...
- */
- guint stock : 1; /* ... or a narrower list of "items" from gtk builtin stock items.
- */
-
- guint transfer_on_paste : 1; /* If this is a packing prop,
- * wether we should transfer it on paste.
- */
-
- guint parentless_widget : 1; /* True if this property should point to a parentless widget
- * in the project
- */
-
- gdouble weight; /* This will determine the position of this property in
- * the editor.
- */
-
- gchar *create_type; /* If this is an object property and you want the option to create
- * one from the object selection dialog, then set the name of the
- * concrete type here.
- */
-};
-
-
-GladePropertyClass *glade_property_class_new (gpointer handle);
-
-GladePropertyClass *glade_property_class_new_from_spec (gpointer handle,
- GParamSpec *spec);
-
-GladePropertyClass *glade_property_class_new_from_spec_full (gpointer handle,
- GParamSpec *spec,
- gboolean need_handle);
-
-GladePropertyClass *glade_property_class_clone (GladePropertyClass *property_class);
-
-void glade_property_class_free (GladePropertyClass *property_class);
-
-gboolean glade_property_class_is_visible (GladePropertyClass *property_class);
-
-gboolean glade_property_class_is_object (GladePropertyClass *property_class);
+
+GladePropertyClass *glade_property_class_new (GladeWidgetAdaptor *adaptor,
+ const gchar *id);
+GladePropertyClass *glade_property_class_new_from_spec (GladeWidgetAdaptor *adaptor,
+ GParamSpec *spec);
+GladePropertyClass *glade_property_class_new_from_spec_full (GladeWidgetAdaptor *adaptor,
+ GParamSpec *spec,
+ gboolean need_handle);
+GladePropertyClass *glade_property_class_clone (GladePropertyClass *property_class,
+ gboolean reset_version);
+void glade_property_class_free (GladePropertyClass *property_class);
+
+void glade_property_class_set_adaptor (GladePropertyClass *property_class,
+ GladeWidgetAdaptor *adaptor);
+GladeWidgetAdaptor *glade_property_class_get_adaptor (GladePropertyClass *property_class);
+void glade_property_class_set_pspec (GladePropertyClass *property_class,
+ GParamSpec *pspec);
+GParamSpec *glade_property_class_get_pspec (GladePropertyClass *property_class);
+void glade_property_class_set_is_packing (GladePropertyClass *property_class,
+ gboolean is_packing);
+gboolean glade_property_class_get_is_packing (GladePropertyClass *property_class);
+gboolean glade_property_class_save (GladePropertyClass *property_class);
+gboolean glade_property_class_save_always (GladePropertyClass *property_class);
+gboolean glade_property_class_is_visible (GladePropertyClass *property_class);
+gboolean glade_property_class_is_object (GladePropertyClass *property_class);
+void glade_property_class_set_virtual (GladePropertyClass *property_class,
+ gboolean virtual);
+gboolean glade_property_class_get_virtual (GladePropertyClass *property_class);
+void glade_property_class_set_ignore (GladePropertyClass *property_class,
+ gboolean ignore);
+gboolean glade_property_class_get_ignore (GladePropertyClass *property_class);
+void glade_property_class_set_name (GladePropertyClass *property_class,
+ const gchar *name);
+G_CONST_RETURN gchar *glade_property_class_get_name (GladePropertyClass *property_class);
+void glade_property_class_set_tooltip (GladePropertyClass *property_class,
+ const gchar *tooltip);
+G_CONST_RETURN gchar *glade_property_class_get_tooltip (GladePropertyClass *property_class);
+G_CONST_RETURN gchar *glade_property_class_id (GladePropertyClass *property_class);
+gboolean glade_property_class_themed_icon (GladePropertyClass *property_class);
+void glade_property_class_set_construct_only (GladePropertyClass *property_class,
+ gboolean construct_only);
+gboolean glade_property_class_get_construct_only (GladePropertyClass *property_class);
+G_CONST_RETURN GValue *glade_property_class_get_default (GladePropertyClass *property_class);
+G_CONST_RETURN GValue *glade_property_class_get_original_default (GladePropertyClass *property_class);
+gboolean glade_property_class_translatable (GladePropertyClass *property_class);
+gboolean glade_property_class_needs_sync (GladePropertyClass *property_class);
+
+gboolean glade_property_class_query (GladePropertyClass *property_class);
+gboolean glade_property_class_atk (GladePropertyClass *property_class);
+gboolean glade_property_class_common (GladePropertyClass *property_class);
+gboolean glade_property_class_parentless_widget (GladePropertyClass *property_class);
+gboolean glade_property_class_optional (GladePropertyClass *property_class);
+gboolean glade_property_class_optional_default (GladePropertyClass *property_class);
+gboolean glade_property_class_multiline (GladePropertyClass *property_class);
+gboolean glade_property_class_stock (GladePropertyClass *property_class);
+gboolean glade_property_class_stock_icon (GladePropertyClass *property_class);
+gboolean glade_property_class_transfer_on_paste (GladePropertyClass *property_class);
+gboolean glade_property_class_custom_layout (GladePropertyClass *property_class);
+gdouble glade_property_class_weight (GladePropertyClass *property_class);
+
+G_CONST_RETURN gchar *glade_property_class_create_type (GladePropertyClass *property_class);
+
+guint16 glade_property_class_since_major (GladePropertyClass *property_class);
+guint16 glade_property_class_since_minor (GladePropertyClass *property_class);
GValue *glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class,
const gchar *string,
@@ -245,6 +161,10 @@ gint glade_property_class_compare (GladePropertyC
GValue *glade_property_class_get_default_from_spec (GParamSpec *spec);
+void glade_property_class_set_weights (GList **properties, GType parent);
+
+void glade_property_class_load_defaults_from_spec (GladePropertyClass *property_class);
+
G_END_DECLS
#endif /* __GLADE_PROPERTY_CLASS_H__ */
diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c
index 4c287df..7cb36cf 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -156,9 +156,9 @@ glade_property_dup_impl (GladeProperty * template_prop, GladeWidget * widget)
g_value_init (property->priv->value, template_prop->priv->value->g_type);
/* Cannot duplicate parentless_widget property */
- if (template_prop->priv->klass->parentless_widget)
+ if (glade_property_class_parentless_widget (template_prop->priv->klass))
{
- if (!G_IS_PARAM_SPEC_OBJECT (template_prop->priv->klass->pspec))
+ if (!G_IS_PARAM_SPEC_OBJECT (glade_property_class_get_pspec (template_prop->priv->klass)))
g_warning ("Parentless widget property should be of object type");
g_value_set_object (property->priv->value, NULL);
@@ -193,7 +193,7 @@ glade_property_update_prop_refs (GladeProperty * property,
GObject *old_object, *new_object;
GList *old_list, *new_list, *list, *removed, *added;
- if (GLADE_IS_PARAM_SPEC_OBJECTS (property->priv->klass->pspec))
+ if (GLADE_IS_PARAM_SPEC_OBJECTS (glade_property_class_get_pspec (property->priv->klass)))
{
/* Make our own copies incase we're walking an
* unstable list
@@ -252,16 +252,17 @@ glade_property_verify (GladeProperty * property, const GValue * value)
parent = glade_widget_get_parent (property->priv->widget);
- if (property->priv->klass->packing && parent)
+ if (glade_property_class_get_is_packing (property->priv->klass) && parent)
ret =
glade_widget_adaptor_child_verify_property (glade_widget_get_adaptor (parent),
glade_widget_get_object (parent),
glade_widget_get_object (property->priv->widget),
- property->priv->klass->id, value);
- else if (!property->priv->klass->packing)
+ glade_property_class_id (property->priv->klass),
+ value);
+ else if (!glade_property_class_get_is_packing (property->priv->klass))
ret = glade_widget_adaptor_verify_property (glade_widget_get_adaptor (property->priv->widget),
glade_widget_get_object (property->priv->widget),
- property->priv->klass->id, value);
+ glade_property_class_id (property->priv->klass), value);
return ret;
}
@@ -316,7 +317,7 @@ glade_property_set_value_impl (GladeProperty * property, const GValue * value)
(G_VALUE_TYPE (property->priv->value), G_VALUE_TYPE (value)))
{
g_warning ("Trying to assign an incompatible value to property %s\n",
- property->priv->klass->id);
+ glade_property_class_id (property->priv->klass));
return FALSE;
}
@@ -373,7 +374,11 @@ glade_property_set_value_impl (GladeProperty * property, const GValue * value)
static void
glade_property_get_value_impl (GladeProperty * property, GValue * value)
{
- g_value_init (value, property->priv->klass->pspec->value_type);
+ GParamSpec *pspec;
+
+ pspec = glade_property_class_get_pspec (property->priv->klass);
+
+ g_value_init (value, pspec->value_type);
g_value_copy (property->priv->value, value);
}
@@ -389,7 +394,7 @@ glade_property_sync_impl (GladeProperty * property)
/* optional properties that are disabled */
property->priv->enabled == FALSE ||
/* explicit "never sync" flag */
- property->priv->klass->ignore ||
+ glade_property_class_get_ignore (property->priv->klass) ||
/* recursion guards */
property->priv->syncing >= property->priv->sync_tolerance ||
/* No widget owns this property yet */
@@ -399,9 +404,11 @@ glade_property_sync_impl (GladeProperty * property)
/* Only the properties from widget->properties should affect the runtime widget.
* (other properties may be used for convenience in the plugin).
*/
- if ((property->priv->klass->packing &&
- !glade_widget_get_pack_property (property->priv->widget, property->priv->klass->id))
- || !glade_widget_get_property (property->priv->widget, property->priv->klass->id))
+ if ((glade_property_class_get_is_packing (property->priv->klass) &&
+ !glade_widget_get_pack_property (property->priv->widget,
+ glade_property_class_id (property->priv->klass)))
+ || !glade_widget_get_property (property->priv->widget,
+ glade_property_class_id (property->priv->klass)))
return;
property->priv->syncing++;
@@ -409,28 +416,31 @@ glade_property_sync_impl (GladeProperty * property)
/* In the case of construct_only, the widget instance must be rebuilt
* to apply the property
*/
- if (property->priv->klass->construct_only && property->priv->syncing == 1)
+ if (glade_property_class_get_construct_only (property->priv->klass) &&
+ property->priv->syncing == 1)
{
/* Virtual properties can be construct only, in which
* case they are allowed to trigger a rebuild, and in
* the process are allowed to get "synced" after the
* instance is rebuilt.
*/
- if (property->priv->klass->virt)
+ if (glade_property_class_get_virtual (property->priv->klass))
property->priv->sync_tolerance++;
glade_widget_rebuild (property->priv->widget);
- if (property->priv->klass->virt)
+ if (glade_property_class_get_virtual (property->priv->klass))
property->priv->sync_tolerance--;
}
- else if (property->priv->klass->packing)
+ else if (glade_property_class_get_is_packing (property->priv->klass))
glade_widget_child_set_property (glade_widget_get_parent (property->priv->widget),
property->priv->widget,
- property->priv->klass->id, property->priv->value);
+ glade_property_class_id (property->priv->klass),
+ property->priv->value);
else
glade_widget_object_set_property (property->priv->widget,
- property->priv->klass->id, property->priv->value);
+ glade_property_class_id (property->priv->klass),
+ property->priv->value);
property->priv->syncing--;
}
@@ -440,20 +450,23 @@ glade_property_load_impl (GladeProperty * property)
{
GObject *object;
GObjectClass *oclass;
+ GParamSpec *pspec;
+
+ pspec = glade_property_class_get_pspec (property->priv->klass);
if (property->priv->widget == NULL ||
- property->priv->klass->virt ||
- property->priv->klass->packing ||
- property->priv->klass->ignore ||
- !(property->priv->klass->pspec->flags & G_PARAM_READABLE) ||
- G_IS_PARAM_SPEC_OBJECT (property->priv->klass->pspec))
+ glade_property_class_get_virtual (property->priv->klass) ||
+ glade_property_class_get_is_packing (property->priv->klass) ||
+ glade_property_class_get_ignore (property->priv->klass) ||
+ !(pspec->flags & G_PARAM_READABLE) || G_IS_PARAM_SPEC_OBJECT (pspec))
return;
object = glade_widget_get_object (property->priv->widget);
oclass = G_OBJECT_GET_CLASS (object);
- if (g_object_class_find_property (oclass, property->priv->klass->id))
- glade_widget_object_get_property (property->priv->widget, property->priv->klass->id,
+ if (g_object_class_find_property (oclass, glade_property_class_id (property->priv->klass)))
+ glade_widget_object_get_property (property->priv->widget,
+ glade_property_class_id (property->priv->klass),
property->priv->value);
}
@@ -717,16 +730,17 @@ glade_property_new (GladePropertyClass * klass,
property->priv->widget = widget;
property->priv->value = value;
- if (klass->optional)
- property->priv->enabled = klass->optional_default;
+ if (glade_property_class_optional (klass))
+ property->priv->enabled = glade_property_class_optional_default (klass);
if (property->priv->value == NULL)
{
- g_assert (klass->orig_def);
+ const GValue *orig_def =
+ glade_property_class_get_original_default (klass);
property->priv->value = g_new0 (GValue, 1);
- g_value_init (property->priv->value, klass->orig_def->g_type);
- g_value_copy (klass->orig_def, property->priv->value);
+ g_value_init (property->priv->value, orig_def->g_type);
+ g_value_copy (orig_def, property->priv->value);
}
return property;
}
@@ -748,10 +762,16 @@ glade_property_dup (GladeProperty * template_prop, GladeWidget * widget)
static void
glade_property_reset_common (GladeProperty * property, gboolean original)
{
+ const GValue *value;
+
g_return_if_fail (GLADE_IS_PROPERTY (property));
+
+ if (original)
+ value = glade_property_class_get_original_default (property->priv->klass);
+ else
+ value = glade_property_class_get_default (property->priv->klass);
- GLADE_PROPERTY_GET_KLASS (property)->set_value
- (property, (original) ? property->priv->klass->orig_def : property->priv->klass->def);
+ GLADE_PROPERTY_GET_KLASS (property)->set_value (property, value);
}
/**
@@ -781,9 +801,16 @@ glade_property_original_reset (GladeProperty * property)
static gboolean
glade_property_default_common (GladeProperty * property, gboolean orig)
{
+ const GValue *value;
+
g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE);
- return GLADE_PROPERTY_GET_KLASS (property)->equals_value
- (property, (orig) ? property->priv->klass->orig_def : property->priv->klass->def);
+
+ if (orig)
+ value = glade_property_class_get_original_default (property->priv->klass);
+ else
+ value = glade_property_class_get_default (property->priv->klass);
+
+ return GLADE_PROPERTY_GET_KLASS (property)->equals_value (property, value);
}
/**
@@ -959,11 +986,14 @@ glade_property_get_value (GladeProperty * property, GValue * value)
void
glade_property_get_default (GladeProperty * property, GValue * value)
{
+ GParamSpec *pspec;
+
g_return_if_fail (GLADE_IS_PROPERTY (property));
g_return_if_fail (value != NULL);
- g_value_init (value, property->priv->klass->pspec->value_type);
- g_value_copy (property->priv->klass->def, value);
+ pspec = glade_property_class_get_pspec (property->priv->klass);
+ g_value_init (value, pspec->value_type);
+ g_value_copy (glade_property_class_get_default (property->priv->klass), value);
}
/**
@@ -1124,23 +1154,20 @@ glade_property_write (GladeProperty * property,
glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET)))
return;
- g_assert (property->priv->klass->orig_def);
- g_assert (property->priv->klass->def);
-
/* Skip properties that are default by original pspec default
* (excepting those that specified otherwise).
*/
- if (!(property->priv->klass->save_always || property->priv->save_always) &&
+ if (!(glade_property_class_save_always (property->priv->klass) || property->priv->save_always) &&
glade_property_original_default (property))
return;
/* Escape our string and save with underscores */
- name = g_strdup (property->priv->klass->id);
+ name = g_strdup (glade_property_class_id (property->priv->klass));
glade_util_replace (name, '-', '_');
/* convert the value of this property to a string */
if (!(value = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (property->priv->klass->handle), property->priv->klass,
+ (glade_property_class_get_adaptor (property->priv->klass), property->priv->klass,
property->priv->value)))
/* make sure we keep the empty string, also... upcomming
* funcs that may not like NULL.
@@ -1163,7 +1190,7 @@ glade_property_write (GladeProperty * property,
glade_xml_set_content (prop_node, value);
/* i18n stuff */
- if (property->priv->klass->translatable)
+ if (glade_property_class_translatable (property->priv->klass))
{
if (property->priv->i18n_translatable)
glade_xml_node_set_property_string (prop_node,
@@ -1198,13 +1225,17 @@ void
glade_property_add_object (GladeProperty * property, GObject * object)
{
GList *list = NULL, *new_list = NULL;
+ GParamSpec *pspec;
g_return_if_fail (GLADE_IS_PROPERTY (property));
g_return_if_fail (G_IS_OBJECT (object));
- g_return_if_fail (GLADE_IS_PARAM_SPEC_OBJECTS (property->priv->klass->pspec) ||
- G_IS_PARAM_SPEC_OBJECT (property->priv->klass->pspec));
- if (GLADE_IS_PARAM_SPEC_OBJECTS (property->priv->klass->pspec))
+ pspec = glade_property_class_get_pspec (property->priv->klass);
+
+ g_return_if_fail (GLADE_IS_PARAM_SPEC_OBJECTS (pspec) ||
+ G_IS_PARAM_SPEC_OBJECT (pspec));
+
+ if (GLADE_IS_PARAM_SPEC_OBJECTS (pspec))
{
glade_property_get (property, &list);
new_list = g_list_copy (list);
@@ -1237,13 +1268,17 @@ void
glade_property_remove_object (GladeProperty * property, GObject * object)
{
GList *list = NULL, *new_list = NULL;
+ GParamSpec *pspec;
g_return_if_fail (GLADE_IS_PROPERTY (property));
g_return_if_fail (G_IS_OBJECT (object));
- g_return_if_fail (GLADE_IS_PARAM_SPEC_OBJECTS (property->priv->klass->pspec) ||
- G_IS_PARAM_SPEC_OBJECT (property->priv->klass->pspec));
- if (GLADE_IS_PARAM_SPEC_OBJECTS (property->priv->klass->pspec))
+ pspec = glade_property_class_get_pspec (property->priv->klass);
+
+ g_return_if_fail (GLADE_IS_PARAM_SPEC_OBJECTS (pspec) ||
+ G_IS_PARAM_SPEC_OBJECT (pspec));
+
+ if (GLADE_IS_PARAM_SPEC_OBJECTS (pspec))
{
/* If object isnt in list; list should stay in tact.
* not bothering to check for now.
@@ -1353,9 +1388,9 @@ glade_property_set_sensitive (GladeProperty * property,
g_signal_emit (G_OBJECT (property),
glade_property_signals[TOOLTIP_CHANGED],
0,
- property->priv->klass->tooltip,
- property->priv->insensitive_tooltip, property->priv->support_warning);
-
+ glade_property_class_get_tooltip (property->priv->klass),
+ property->priv->insensitive_tooltip,
+ property->priv->support_warning);
}
g_object_notify (G_OBJECT (property), "sensitive");
}
@@ -1390,8 +1425,9 @@ glade_property_set_support_warning (GladeProperty * property,
g_signal_emit (G_OBJECT (property),
glade_property_signals[TOOLTIP_CHANGED],
0,
- property->priv->klass->tooltip,
- property->priv->insensitive_tooltip, property->priv->support_warning);
+ glade_property_class_get_tooltip (property->priv->klass),
+ property->priv->insensitive_tooltip,
+ property->priv->support_warning);
glade_property_fix_state (property);
}
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index a203d39..d7f9257 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -140,47 +140,6 @@ static GHashTable *adaptor_hash = NULL;
Helper functions
*******************************************************************************/
-/*
- This function assignes "weight" to each property in its natural order staring from 1.
- If parent is 0 weight will be set for every GladePropertyClass in the list.
- This function will not override weight if it is already set (weight >= 0.0)
-*/
-static void
-gwa_properties_set_weight (GList ** properties, GType parent)
-{
- gint normal = 0, common = 0, packing = 0;
- GList *l;
-
- for (l = *properties; l && l->data; l = g_list_next (l))
- {
- GladePropertyClass *klass = l->data;
-
- if (klass->visible &&
- (parent) ? parent == klass->pspec->owner_type : TRUE && !klass->atk)
- {
- /* Use a different counter for each tab (common, packing and normal) */
- if (klass->common)
- common++;
- else if (klass->packing)
- packing++;
- else
- normal++;
-
- /* Skip if it is already set */
- if (klass->weight >= 0.0)
- continue;
-
- /* Special-casing weight of properties for seperate tabs */
- if (klass->common)
- klass->weight = common;
- else if (klass->packing)
- klass->weight = packing;
- else
- klass->weight = normal;
- }
- }
-}
-
static void
gwa_create_cursor (GladeWidgetAdaptor * adaptor)
{
@@ -411,20 +370,20 @@ gwa_clone_parent_properties (GladeWidgetAdaptor * adaptor, gboolean is_packing)
if ((parent_adaptor = gwa_get_parent_adaptor (adaptor)) != NULL)
{
+ gboolean reset_version;
+
proplist = is_packing ?
parent_adaptor->priv->packing_props : parent_adaptor->priv->properties;
+ /* Reset versioning in derived catalogs just once */
+ reset_version = strcmp (adaptor->priv->catalog, parent_adaptor->priv->catalog) != 0;
+
for (list = proplist; list; list = list->next)
{
- GladePropertyClass *pclass = glade_property_class_clone (list->data);
- pclass->handle = adaptor;
+ GladePropertyClass *pclass = glade_property_class_clone (list->data, reset_version);
+
+ glade_property_class_set_adaptor (pclass, adaptor);
- /* Reset versioning in derived catalogs just once */
- if (strcmp (adaptor->priv->catalog, parent_adaptor->priv->catalog))
- {
- pclass->version_since_major = 0;
- pclass->version_since_minor = 0;
- }
properties = g_list_prepend (properties, pclass);
}
}
@@ -509,7 +468,8 @@ gwa_setup_properties (GladeWidgetAdaptor * adaptor,
for (l = adaptor->priv->packing_props; l; l = l->next)
{
GladePropertyClass *property_class = l->data;
- property_class->packing = TRUE;
+
+ glade_property_class_set_is_packing (property_class, TRUE);
}
}
}
@@ -999,7 +959,8 @@ glade_widget_adaptor_object_write_widget (GladeWidgetAdaptor * adaptor,
GladeProperty *property = props->data;
GladePropertyClass *klass = glade_property_get_class (property);
- if (klass->save && glade_property_get_enabled (property))
+ if (glade_property_class_save (klass) &&
+ glade_property_get_enabled (property))
glade_property_write (GLADE_PROPERTY (props->data), context, node);
}
}
@@ -1111,7 +1072,8 @@ glade_widget_adaptor_object_write_child (GladeWidgetAdaptor * adaptor,
GladeProperty *property = props->data;
GladePropertyClass *klass = glade_property_get_class (property);
- if (klass->save && glade_property_get_enabled (property))
+ if (glade_property_class_save (klass) &&
+ glade_property_get_enabled (property))
glade_property_write (GLADE_PROPERTY (props->data),
context, packing_node);
}
@@ -1185,16 +1147,19 @@ glade_widget_adaptor_object_create_eprop (GladeWidgetAdaptor * adaptor,
gboolean use_command)
{
GladeEditorProperty *eprop;
- GType type = 0;
+ GParamSpec *pspec;
+ GType type = 0;
+
+ pspec = glade_property_class_get_pspec (klass);
/* Find the right type of GladeEditorProperty for this
* GladePropertyClass.
*/
- if ((type = glade_widget_adaptor_get_eprop_type (klass->pspec)) == 0)
+ if ((type = glade_widget_adaptor_get_eprop_type (pspec)) == 0)
return NULL;
/* special case for string specs that denote themed application icons. */
- if (klass->themed_icon)
+ if (glade_property_class_themed_icon (klass))
type = GLADE_TYPE_EPROP_NAMED_ICON;
/* Create and return the correct type of GladeEditorProperty */
@@ -1887,8 +1852,8 @@ gwa_update_properties_from_node (GladeWidgetAdaptor * adaptor,
for (list = *properties; list && list->data; list = list->next)
{
property_class = GLADE_PROPERTY_CLASS (list->data);
- if (property_class->id != NULL &&
- g_ascii_strcasecmp (id, property_class->id) == 0)
+ if (glade_property_class_id (property_class) != NULL &&
+ g_ascii_strcasecmp (id, glade_property_class_id (property_class)) == 0)
break;
}
@@ -1898,14 +1863,13 @@ gwa_update_properties_from_node (GladeWidgetAdaptor * adaptor,
}
else
{
- property_class = glade_property_class_new (adaptor);
- property_class->id = g_strdup (id);
+ property_class = glade_property_class_new (adaptor, id);
/* When creating new virtual packing properties,
* make sure we mark them as such here.
*/
if (is_packing)
- property_class->packing = TRUE;
+ glade_property_class_set_is_packing (property_class, TRUE);
*properties = g_list_append (*properties, property_class);
list = g_list_last (*properties);
@@ -2082,40 +2046,34 @@ gwa_update_properties_from_type (GladeWidgetAdaptor * adaptor,
for (list = *properties; list && list->data; list = list->next)
{
property_class = GLADE_PROPERTY_CLASS (list->data);
- if (property_class->id != NULL &&
- g_ascii_strcasecmp (specs[i]->name, property_class->id) == 0)
+ if (glade_property_class_id (property_class) != NULL &&
+ g_ascii_strcasecmp (specs[i]->name, glade_property_class_id (property_class)) == 0)
break;
}
if (list == NULL && (spec = pspec_dup (specs[i])))
{
- property_class = glade_property_class_new (adaptor);
- property_class->id = g_strdup (spec->name);
+ property_class = glade_property_class_new (adaptor, spec->name);
- property_class->pspec = spec;
+ glade_property_class_set_pspec (property_class, spec);
/* Make sure we can tell properties apart by there
* owning class.
*/
- property_class->pspec->owner_type = adaptor->priv->type;
+ spec->owner_type = adaptor->priv->type;
/* Disable properties by default since the does not really implement them */
- property_class->virt = TRUE;
- property_class->ignore = TRUE;
+ glade_property_class_set_virtual (property_class, TRUE);
+ glade_property_class_set_ignore (property_class, TRUE);
- property_class->tooltip = g_strdup (g_param_spec_get_blurb (spec));
- property_class->name = g_strdup (g_param_spec_get_nick (spec));
+ glade_property_class_set_tooltip (property_class, g_param_spec_get_blurb (spec));
+ glade_property_class_set_name (property_class, g_param_spec_get_nick (spec));
- if (property_class->pspec->flags & G_PARAM_CONSTRUCT_ONLY)
- property_class->construct_only = TRUE;
+ if (spec->flags & G_PARAM_CONSTRUCT_ONLY)
+ glade_property_class_set_construct_only (property_class, TRUE);
- property_class->orig_def =
- glade_property_class_get_default_from_spec (spec);
-
- property_class->def =
- glade_property_class_get_default_from_spec (spec);
-
- property_class->packing = is_packing;
+ glade_property_class_load_defaults_from_spec (property_class);
+ glade_property_class_set_is_packing (property_class, is_packing);
*properties = g_list_append (*properties, property_class);
}
@@ -2303,17 +2261,20 @@ gwa_displayable_values_check (GladeWidgetAdaptor * adaptor, gboolean packing)
for (l = p; l; l = g_list_next (l))
{
GladePropertyClass *klass = l->data;
-
- if (adaptor->priv->type == klass->pspec->owner_type && klass->visible &&
- (G_IS_PARAM_SPEC_ENUM (klass->pspec) ||
- G_IS_PARAM_SPEC_FLAGS (klass->pspec)) &&
- !glade_type_has_displayable_values (klass->pspec->value_type) &&
- klass->pspec->value_type != GLADE_TYPE_STOCK &&
- klass->pspec->value_type != GLADE_TYPE_STOCK_IMAGE)
+ GParamSpec *pspec = glade_property_class_get_pspec (klass);
+
+ if (adaptor->priv->type == pspec->owner_type &&
+ glade_property_class_is_visible (klass) &&
+ (G_IS_PARAM_SPEC_ENUM (pspec) ||
+ G_IS_PARAM_SPEC_FLAGS (pspec)) &&
+ !glade_type_has_displayable_values (pspec->value_type) &&
+ pspec->value_type != GLADE_TYPE_STOCK &&
+ pspec->value_type != GLADE_TYPE_STOCK_IMAGE)
{
/* We do not need displayable values if the property is not visible */
g_message ("No displayable values for %sproperty %s::%s",
- (packing) ? "child " : "", adaptor->priv->name, klass->id);
+ (packing) ? "child " : "", adaptor->priv->name,
+ glade_property_class_id (klass));
}
}
}
@@ -2588,8 +2549,8 @@ glade_widget_adaptor_from_catalog (GladeCatalog * catalog,
for (parent_type = adaptor->priv->type;
parent_type != 0; parent_type = g_type_parent (parent_type))
{
- gwa_properties_set_weight (&adaptor->priv->properties, parent_type);
- gwa_properties_set_weight (&adaptor->priv->packing_props, parent_type);
+ glade_property_class_set_weights (&adaptor->priv->properties, parent_type);
+ glade_property_class_set_weights (&adaptor->priv->packing_props, parent_type);
}
gwa_displayable_values_check (adaptor, FALSE);
@@ -2832,7 +2793,7 @@ glade_widget_adaptor_get_property_class (GladeWidgetAdaptor * adaptor,
for (list = adaptor->priv->properties; list && list->data; list = list->next)
{
pclass = list->data;
- if (strcmp (pclass->id, name) == 0)
+ if (strcmp (glade_property_class_id (pclass), name) == 0)
return pclass;
}
return NULL;
@@ -2858,7 +2819,7 @@ glade_widget_adaptor_get_pack_property_class (GladeWidgetAdaptor * adaptor,
for (list = adaptor->priv->packing_props; list && list->data; list = list->next)
{
pclass = list->data;
- if (strcmp (pclass->id, name) == 0)
+ if (strcmp (glade_property_class_id (pclass), name) == 0)
return pclass;
}
return NULL;
@@ -2901,9 +2862,9 @@ glade_widget_adaptor_default_params (GladeWidgetAdaptor * adaptor,
/* Ignore properties based on some criteria
*/
if (pclass == NULL || /* Unaccounted for in the builder */
- pclass->virt || /* should not be set before
- GladeWidget wrapper exists */
- pclass->ignore) /* Catalog explicitly ignores the object */
+ glade_property_class_get_virtual (pclass) || /* should not be set before
+ GladeWidget wrapper exists */
+ glade_property_class_get_ignore (pclass)) /* Catalog explicitly ignores the object */
continue;
if (construct &&
@@ -2915,7 +2876,7 @@ glade_widget_adaptor_default_params (GladeWidgetAdaptor * adaptor,
continue;
- if (g_value_type_compatible (G_VALUE_TYPE (pclass->def),
+ if (g_value_type_compatible (G_VALUE_TYPE (glade_property_class_get_default (pclass)),
pspec[i]->value_type) == FALSE)
{
g_critical ("Type mismatch on %s property of %s",
@@ -2923,12 +2884,14 @@ glade_widget_adaptor_default_params (GladeWidgetAdaptor * adaptor,
continue;
}
- if (g_param_values_cmp (pspec[i], pclass->def, pclass->orig_def) == 0)
+ if (g_param_values_cmp (pspec[i],
+ glade_property_class_get_default (pclass),
+ glade_property_class_get_original_default (pclass)) == 0)
continue;
parameter.name = pspec[i]->name; /* These are not copied/freed */
g_value_init (¶meter.value, pspec[i]->value_type);
- g_value_copy (pclass->def, ¶meter.value);
+ g_value_copy (glade_property_class_get_default (pclass), ¶meter.value);
g_array_append_val (params, parameter);
}
@@ -3369,7 +3332,7 @@ glade_widget_adaptor_query (GladeWidgetAdaptor * adaptor)
{
pclass = l->data;
- if (pclass->query)
+ if (glade_property_class_query (pclass))
return TRUE;
}
diff --git a/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h
index 751815a..42b047c 100644
--- a/gladeui/glade-widget-adaptor.h
+++ b/gladeui/glade-widget-adaptor.h
@@ -19,7 +19,6 @@ G_BEGIN_DECLS
#define GLADE_IS_WIDGET_ADAPTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_WIDGET_ADAPTOR))
#define GLADE_WIDGET_ADAPTOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_WIDGET_ADAPTOR, GladeWidgetAdaptorClass))
-typedef struct _GladeWidgetAdaptor GladeWidgetAdaptor;
typedef struct _GladeWidgetAdaptorPrivate GladeWidgetAdaptorPrivate;
typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
@@ -675,9 +674,6 @@ struct _GladeWidgetAdaptorClass
#define glade_widget_adaptor_create_widget(adaptor, query, ...) \
(glade_widget_adaptor_create_widget_real (query, "adaptor", adaptor, __VA_ARGS__));
-#define glade_widget_adaptor_from_pclass(pclass) \
- ((pclass) ? (GladeWidgetAdaptor *)((GladePropertyClass *)(pclass))->handle : NULL)
-
GType glade_widget_adaptor_get_type (void) G_GNUC_CONST;
GType glade_create_reason_get_type (void) G_GNUC_CONST;
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 0653f6e..7a372b6 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -565,9 +565,9 @@ glade_widget_template_params (GladeWidget * widget,
*/
if (!glade_property_get_enabled (glade_property) ||
pclass == NULL || /* Unaccounted for in the builder */
- pclass->virt || /* should not be set before
- GladeWidget wrapper exists */
- pclass->ignore) /* Catalog explicitly ignores the object */
+ glade_property_class_get_virtual (pclass) || /* should not be set before
+ GladeWidget wrapper exists */
+ glade_property_class_get_ignore (pclass)) /* Catalog explicitly ignores the object */
continue;
if (construct &&
@@ -578,7 +578,7 @@ glade_widget_template_params (GladeWidget * widget,
(G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)) != 0)
continue;
- if (g_value_type_compatible (G_VALUE_TYPE (pclass->def),
+ if (g_value_type_compatible (G_VALUE_TYPE (glade_property_class_get_default (pclass)),
pspec[i]->value_type) == FALSE)
{
g_critical ("Type mismatch on %s property of %s",
@@ -589,10 +589,9 @@ glade_widget_template_params (GladeWidget * widget,
if (g_param_values_cmp (pspec[i],
glade_property_inline_value (glade_property),
- pclass->orig_def) == 0)
+ glade_property_class_get_original_default (pclass)) == 0)
continue;
-
/* Not sure if it's safe to use glade_property_get_value() instead as the
* value type might differ than the real pspec
*/
@@ -689,10 +688,10 @@ glade_widget_dup_properties (GladeWidget * dest_widget, GList * template_props,
GladeProperty *prop = list->data;
GladePropertyClass *pclass = glade_property_get_class (prop);
- if (pclass->save == FALSE && as_load)
+ if (glade_property_class_save (pclass) == FALSE && as_load)
continue;
- if (pclass->parentless_widget && copy_parentless)
+ if (glade_property_class_parentless_widget (pclass) && copy_parentless)
{
GObject *object = NULL;
GladeWidget *parentless;
@@ -762,11 +761,14 @@ glade_widget_set_catalog_defaults (GList * list)
GList *l;
for (l = list; l && l->data; l = l->next)
{
- GladeProperty *prop = l->data;
+ GladeProperty *prop = l->data;
GladePropertyClass *klass = glade_property_get_class (prop);
+ GParamSpec *pspec = glade_property_class_get_pspec (klass);
- if (glade_property_equals_value (prop, klass->orig_def) &&
- g_param_values_cmp (klass->pspec, klass->orig_def, klass->def))
+ if (glade_property_equals_value (prop, glade_property_class_get_original_default (klass)) &&
+ g_param_values_cmp (pspec,
+ glade_property_class_get_original_default (klass),
+ glade_property_class_get_default (klass)))
glade_property_reset (prop);
}
}
@@ -780,7 +782,8 @@ glade_widget_sync_custom_props (GladeWidget * widget)
GladeProperty *prop = GLADE_PROPERTY (l->data);
GladePropertyClass *pclass = glade_property_get_class (prop);
- if (pclass->virt || pclass->needs_sync)
+ if (glade_property_class_get_virtual (pclass) ||
+ glade_property_class_needs_sync (pclass))
glade_property_sync (prop);
}
}
@@ -864,7 +867,7 @@ glade_widget_constructor (GType type,
GladeProperty *property = list->data;
GladePropertyClass *pclass = glade_property_get_class (property);
- if (pclass->parentless_widget)
+ if (glade_property_class_parentless_widget (pclass))
glade_property_sync (property);
}
}
@@ -1421,7 +1424,7 @@ glade_widget_copy_packing_props (GladeWidget * parent,
dup_prop = GLADE_PROPERTY (l->data);
pclass = glade_property_get_class (dup_prop);
- orig_prop = glade_widget_get_pack_property (template_widget, pclass->id);
+ orig_prop = glade_widget_get_pack_property (template_widget, glade_property_class_id (pclass));
glade_property_set_value (dup_prop, glade_property_inline_value (orig_prop));
}
@@ -1443,7 +1446,8 @@ glade_widget_set_default_packing_properties (GladeWidget * container,
if ((def =
glade_widget_adaptor_get_packing_default
- (child->priv->adaptor, container->priv->adaptor, property_class->id)) == NULL)
+ (child->priv->adaptor, container->priv->adaptor,
+ glade_property_class_id (property_class))) == NULL)
continue;
value = glade_property_class_make_gvalue_from_string (property_class,
@@ -1452,7 +1456,7 @@ glade_widget_set_default_packing_properties (GladeWidget * container,
child);
glade_widget_child_set_property (container, child,
- property_class->id, value);
+ glade_property_class_id (property_class), value);
g_value_unset (value);
g_free (value);
}
@@ -1770,7 +1774,7 @@ glade_widget_insert_children (GladeWidget * gwidget, GList * children)
GladeProperty *saved_prop = l->data;
GladePropertyClass *pclass = glade_property_get_class (saved_prop);
GladeProperty *widget_prop =
- glade_widget_get_property (gchild, pclass->id);
+ glade_widget_get_property (gchild, glade_property_class_id (pclass));
glade_property_get_value (saved_prop, &value);
glade_property_set_value (widget_prop, &value);
@@ -1796,7 +1800,7 @@ glade_widget_insert_children (GladeWidget * gwidget, GList * children)
GladeProperty *saved_prop = l->data;
GladePropertyClass *pclass = glade_property_get_class (saved_prop);
GladeProperty *widget_prop =
- glade_widget_get_pack_property (extract->widget, pclass->id);
+ glade_widget_get_pack_property (extract->widget, glade_property_class_id (pclass));
glade_property_get_value (saved_prop, &value);
glade_property_set_value (widget_prop, &value);
@@ -1850,7 +1854,9 @@ glade_widget_set_properties (GladeWidget * widget, GList * properties)
pclass = glade_property_get_class (property);
glade_property_set_widget (property, widget);
- g_hash_table_insert (widget->priv->props_hash, pclass->id, property);
+ g_hash_table_insert (widget->priv->props_hash,
+ (gchar *)glade_property_class_id (pclass),
+ property);
}
}
}
@@ -1880,7 +1886,8 @@ glade_widget_set_adaptor (GladeWidget * widget, GladeWidgetAdaptor * adaptor)
if ((property = glade_property_new (property_class,
widget, NULL)) == NULL)
{
- g_warning ("Failed to create [%s] property", property_class->id);
+ g_warning ("Failed to create [%s] property",
+ glade_property_class_id (property_class));
continue;
}
properties = g_list_prepend (properties, property);
@@ -2112,7 +2119,7 @@ glade_widget_add_prop_ref (GladeWidget * widget, GladeProperty * property)
* they cant be in the design view.
*/
pclass = glade_property_get_class (property);
- if (pclass->parentless_widget)
+ if (glade_property_class_parentless_widget (pclass))
glade_widget_hide (widget);
}
@@ -2158,7 +2165,7 @@ glade_widget_get_parentless_widget_ref (GladeWidget * widget)
property = l->data;
pclass = glade_property_get_class (property);
- if (pclass->parentless_widget)
+ if (glade_property_class_parentless_widget (pclass))
/* only one external property can point to this widget */
return property;
}
@@ -2182,7 +2189,7 @@ glade_widget_get_parentless_reffed_widgets (GladeWidget * widget)
pclass = glade_property_get_class (property);
reffed = NULL;
- if (pclass->parentless_widget)
+ if (glade_property_class_parentless_widget (pclass))
{
glade_property_get (property, &reffed);
if (reffed)
@@ -2289,7 +2296,8 @@ glade_widget_copy_properties (GladeWidget * widget,
GladePropertyClass *widget_pclass, *template_pclass = NULL;
widget_pclass = glade_property_get_class (widget_prop);
- template_prop = glade_widget_get_property (template_widget, widget_pclass->id);
+ template_prop = glade_widget_get_property (template_widget,
+ glade_property_class_id (widget_pclass));
if (template_prop)
template_pclass = glade_property_get_class (template_prop);
@@ -2301,7 +2309,7 @@ glade_widget_copy_properties (GladeWidget * widget,
if (template_pclass != NULL &&
glade_property_class_match (template_pclass, widget_pclass))
{
- if (template_pclass->parentless_widget && copy_parentless)
+ if (glade_property_class_parentless_widget (template_pclass) && copy_parentless)
{
GObject *object = NULL;
GladeWidget *parentless;
@@ -2449,11 +2457,12 @@ glade_widget_rebuild (GladeWidget * gwidget)
GladeProperty *property = l->data;
GladePropertyClass *pclass = glade_property_get_class (property);
- if (glade_property_get_widget (property) != gwidget || pclass->parentless_widget)
+ if (glade_property_get_widget (property) != gwidget ||
+ glade_property_class_parentless_widget (pclass))
{
PropertyData *prop_data;
- if (!G_IS_PARAM_SPEC_OBJECT (pclass->pspec))
+ if (!G_IS_PARAM_SPEC_OBJECT (glade_property_class_get_pspec (pclass)))
g_warning ("Parentless widget property should be of object type");
prop_data = g_new0 (PropertyData, 1);
@@ -3105,8 +3114,9 @@ glade_widget_pack_property_set_save_always (GladeWidget * widget,
* Returns: A newly allocated string representing @id_property
*/
gchar *
-glade_widget_property_string (GladeWidget * widget,
- const gchar * id_property, const GValue * value)
+glade_widget_property_string (GladeWidget *widget,
+ const gchar *id_property,
+ const GValue *value)
{
GladeProperty *property;
GladePropertyClass *pclass;
@@ -3119,7 +3129,7 @@ glade_widget_property_string (GladeWidget * widget,
{
pclass = glade_property_get_class (property);
ret_string = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (pclass->handle), pclass,
+ (glade_property_class_get_adaptor (pclass), pclass,
value ? value : glade_property_inline_value (property));
}
@@ -3153,7 +3163,7 @@ glade_widget_pack_property_string (GladeWidget * widget,
{
pclass = glade_property_get_class (property);
ret_string = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (pclass->handle), pclass,
+ (glade_property_class_get_adaptor (pclass), pclass,
value ? value : glade_property_inline_value (property));
}
@@ -3637,7 +3647,9 @@ glade_widget_set_packing_properties (GladeWidget * widget,
GladeProperty *property = list->data;
GladePropertyClass *pclass = glade_property_get_class (property);
- g_hash_table_insert (widget->priv->pack_props_hash, pclass->id, property);
+ g_hash_table_insert (widget->priv->pack_props_hash,
+ (gchar *)glade_property_class_id (pclass),
+ property);
}
/* Dont introspect on properties that are not parented yet.
@@ -3658,7 +3670,10 @@ glade_widget_set_packing_properties (GladeWidget * widget,
GValue *value = glade_property_inline_value (property);
g_value_reset (value);
- glade_widget_child_get_property (container, widget, pclass->id, value);
+ glade_widget_child_get_property (container,
+ widget,
+ glade_property_class_id (pclass),
+ value);
}
}
}
diff --git a/gladeui/glade-xml-utils.h b/gladeui/glade-xml-utils.h
index ef23d8c..626cbdc 100644
--- a/gladeui/glade-xml-utils.h
+++ b/gladeui/glade-xml-utils.h
@@ -20,9 +20,10 @@ typedef struct _GladeXmlDoc GladeXmlDoc;
/* FIXME: forward declarations to get around circular header dependencies.
*/
-typedef struct _GladeWidget GladeWidget;
-typedef struct _GladeProperty GladeProperty;
-typedef struct _GladeProject GladeProject;
+typedef struct _GladeWidget GladeWidget;
+typedef struct _GladeWidgetAdaptor GladeWidgetAdaptor;
+typedef struct _GladeProperty GladeProperty;
+typedef struct _GladeProject GladeProject;
typedef enum {
GLADE_POLICY_PROJECT_WIDE = 0, /* widget names are unique throughout the project */
@@ -158,7 +159,7 @@ typedef enum {
#define GLADE_TAG_SAVE_ALWAYS "save-always"
#define GLADE_TAG_EDITABLE "editable"
#define GLADE_TAG_IGNORE "ignore"
-#define GLADE_TAG_VISIBLE_LINES "visible-lines"
+#define GLADE_TAG_MULTILINE "multiline"
#define GLADE_TAG_RESOURCE "resource"
#define GLADE_TAG_STOCK "stock"
#define GLADE_TAG_STOCK_ICON "stock-icon"
diff --git a/plugins/gtk+/glade-accels.c b/plugins/gtk+/glade-accels.c
index e4e8c56..b9daf1c 100644
--- a/plugins/gtk+/glade-accels.c
+++ b/plugins/gtk+/glade-accels.c
@@ -202,7 +202,7 @@ glade_eprop_accel_populate_view (GladeEditorProperty * eprop,
{
GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop);
GladeSignalClass *sclass;
- GladeWidgetAdaptor *adaptor = glade_widget_adaptor_from_pclass (eprop->klass);
+ GladeWidgetAdaptor *adaptor = glade_property_class_get_adaptor (eprop->klass);
GtkTreeStore *model = (GtkTreeStore *) gtk_tree_view_get_model (view);
GtkTreeIter iter;
GladeEpropIterTab *parent_tab;
@@ -339,8 +339,7 @@ accel_edited (GtkCellRendererAccel * accel,
GtkTreeIter iter, parent_iter, new_iter;
gchar *accel_text;
GladeWidgetAdaptor *adaptor =
- glade_widget_adaptor_from_pclass (GLADE_EDITOR_PROPERTY (eprop_accel)->
- klass);
+ glade_property_class_get_adaptor (GLADE_EDITOR_PROPERTY (eprop_accel)->klass);
gboolean is_action;
if (!gtk_tree_model_get_iter_from_string (eprop_accel->model,
diff --git a/plugins/gtk+/glade-cell-renderer-editor.c b/plugins/gtk+/glade-cell-renderer-editor.c
index f6e86b7..59eaf0e 100644
--- a/plugins/gtk+/glade-cell-renderer-editor.c
+++ b/plugins/gtk+/glade-cell-renderer-editor.c
@@ -147,15 +147,12 @@ glade_cell_renderer_editor_load (GladeEditable * editable, GladeWidget * widget)
CheckTab *tab = l->data;
gboolean use_attr = FALSE;
- glade_widget_property_get (widget, tab->use_attr_pclass->id,
- &use_attr);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (tab->attributes_check), use_attr);
-
+ glade_widget_property_get (widget, glade_property_class_id (tab->use_attr_pclass), &use_attr);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tab->attributes_check), use_attr);
if (use_attr)
{
- // gtk_widget_show (tab->use_attr_label);
+ //gtk_widget_show (tab->use_attr_label);
gtk_widget_show (tab->use_attr_eprop);
//gtk_widget_hide (tab->use_prop_label);
gtk_widget_hide (tab->use_prop_eprop);
@@ -235,19 +232,19 @@ attributes_toggled (GtkWidget * widget, CheckTab * tab)
glade_command_push_group (_("Setting %s to use the %s property as an attribute"),
glade_widget_get_name (renderer_editor->loaded_widget),
- tab->pclass->id);
+ glade_property_class_id (tab->pclass));
property =
glade_widget_get_property (renderer_editor->loaded_widget,
- tab->pclass->id);
+ glade_property_class_id (tab->pclass));
glade_property_get_default (property, &value);
glade_command_set_property_value (property, &value);
g_value_unset (&value);
property =
glade_widget_get_property (renderer_editor->loaded_widget,
- tab->use_attr_pclass->id);
+ glade_property_class_id (tab->use_attr_pclass));
glade_command_set_property (property, TRUE);
glade_command_pop_group ();
@@ -258,19 +255,18 @@ attributes_toggled (GtkWidget * widget, CheckTab * tab)
{
glade_command_push_group (_("Setting %s to use the %s property directly"),
glade_widget_get_name (renderer_editor->loaded_widget),
- tab->pclass->id);
-
+ glade_property_class_id (tab->pclass));
property =
glade_widget_get_property (renderer_editor->loaded_widget,
- tab->attr_pclass->id);
+ glade_property_class_id (tab->attr_pclass));
glade_property_get_default (property, &value);
glade_command_set_property_value (property, &value);
g_value_unset (&value);
property =
glade_widget_get_property (renderer_editor->loaded_widget,
- tab->use_attr_pclass->id);
+ glade_property_class_id (tab->use_attr_pclass));
glade_command_set_property (property, FALSE);
glade_command_pop_group ();
@@ -285,11 +281,15 @@ attributes_toggled (GtkWidget * widget, CheckTab * tab)
static gint
property_class_comp (gconstpointer a, gconstpointer b)
{
- const GladePropertyClass *ca = a, *cb = b;
+ GladePropertyClass *ca = (GladePropertyClass *)a, *cb = (GladePropertyClass *)b;
+ GParamSpec *pa, *pb;
- if (ca->pspec->owner_type == cb->pspec->owner_type)
+ pa = glade_property_class_get_pspec (ca);
+ pb = glade_property_class_get_pspec (cb);
+
+ if (pa->owner_type == pb->owner_type)
{
- gdouble result = ca->weight - cb->weight;
+ gdouble result = glade_property_class_weight (ca) - glade_property_class_weight (cb);
/* Avoid cast to int */
if (result < 0.0)
return -1;
@@ -300,10 +300,10 @@ property_class_comp (gconstpointer a, gconstpointer b)
}
else
{
- if (g_type_is_a (ca->pspec->owner_type, cb->pspec->owner_type))
- return (ca->common || ca->packing) ? 1 : -1;
+ if (g_type_is_a (pa->owner_type, pb->owner_type))
+ return (glade_property_class_common (ca) || glade_property_class_get_is_packing (ca)) ? 1 : -1;
else
- return (ca->common || ca->packing) ? -1 : 1;
+ return (glade_property_class_common (ca) || glade_property_class_get_is_packing (ca)) ? -1 : 1;
}
}
@@ -368,11 +368,11 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor * adaptor,
pclass = list->data;
- if (pclass->virt)
+ if (glade_property_class_get_virtual (pclass))
continue;
- attr_name = g_strdup_printf ("attr-%s", pclass->id);
- use_attr_name = g_strdup_printf ("use-attr-%s", pclass->id);
+ attr_name = g_strdup_printf ("attr-%s", glade_property_class_id (pclass));
+ use_attr_name = g_strdup_printf ("use-attr-%s", glade_property_class_id (pclass));
attr_pclass =
glade_widget_adaptor_get_property_class (adaptor, attr_name);
@@ -382,6 +382,9 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor * adaptor,
if (attr_pclass && use_attr_pclass)
{
CheckTab *tab = g_new0 (CheckTab, 1);
+ GParamSpec *pspec;
+
+ pspec = glade_property_class_get_pspec (pclass);
tab->editor = renderer_editor;
tab->pclass = pclass;
@@ -395,8 +398,8 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor * adaptor,
tab->attributes_check = gtk_check_button_new ();
str = g_strdup_printf (_("Retrieve %s from model (type %s)"),
- pclass->name,
- g_type_name (pclass->pspec->value_type));
+ glade_property_class_get_name (pclass),
+ g_type_name (pspec->value_type));
gtk_widget_set_tooltip_text (tab->attributes_check, str);
g_free (str);
diff --git a/plugins/gtk+/glade-column-types.c b/plugins/gtk+/glade-column-types.c
index 5d6ca5d..c8d679e 100644
--- a/plugins/gtk+/glade-column-types.c
+++ b/plugins/gtk+/glade-column-types.c
@@ -62,40 +62,39 @@ column_types_store_populate_enums_flags (GtkListStore * store, gboolean enums)
{
GladeWidgetAdaptor *adaptor = list->data;
GladePropertyClass *pclass;
+ GParamSpec *pspec;
for (l = glade_widget_adaptor_get_properties (adaptor); l; l = l->next)
{
pclass = l->data;
+ pspec = glade_property_class_get_pspec (pclass);
/* special case out a few of these... */
- if (strcmp
- (g_type_name (pclass->pspec->value_type),
- "GladeGtkGnomeUIInfo") == 0 ||
- strcmp (g_type_name (pclass->pspec->value_type),
+ if (strcmp (g_type_name (pspec->value_type),
"GladeStock") == 0 ||
- strcmp (g_type_name (pclass->pspec->value_type),
+ strcmp (g_type_name (pspec->value_type),
"GladeStockImage") == 0 ||
- strcmp (g_type_name (pclass->pspec->value_type),
+ strcmp (g_type_name (pspec->value_type),
"GladeGtkImageType") == 0 ||
- strcmp (g_type_name (pclass->pspec->value_type),
+ strcmp (g_type_name (pspec->value_type),
"GladeGtkButtonType") == 0 ||
- strcmp (g_type_name (pclass->pspec->value_type),
+ strcmp (g_type_name (pspec->value_type),
"GladeGnomeDruidPagePosition") == 0 ||
- strcmp (g_type_name (pclass->pspec->value_type),
+ strcmp (g_type_name (pspec->value_type),
"GladeGnomeIconListSelectionMode") == 0 ||
- strcmp (g_type_name (pclass->pspec->value_type),
+ strcmp (g_type_name (pspec->value_type),
"GladeGnomeMessageBoxType") == 0)
continue;
- if ((enums ? G_TYPE_IS_ENUM (pclass->pspec->value_type) :
- G_TYPE_IS_FLAGS (pclass->pspec->value_type)) &&
+ if ((enums ? G_TYPE_IS_ENUM (pspec->value_type) :
+ G_TYPE_IS_FLAGS (pspec->value_type)) &&
!g_list_find_custom (types,
- g_type_name (pclass->pspec->value_type),
+ g_type_name (pspec->value_type),
(GCompareFunc) find_by_type_name))
types =
g_list_prepend (types,
g_strdup (g_type_name
- (pclass->pspec->value_type)));
+ (pspec->value_type)));
}
}
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index a3c8ae1..d606a85 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -296,6 +296,7 @@ static void
glade_gtk_parse_atk_relation (GladeProperty * property, GladeXmlNode * node)
{
GladeXmlNode *prop;
+ GladePropertyClass *pclass;
gchar *type, *target, *id, *tmp;
gchar *string = NULL;
@@ -318,9 +319,10 @@ glade_gtk_parse_atk_relation (GladeProperty * property, GladeXmlNode * node)
continue;
}
- id = glade_util_read_prop_name (type);
+ id = glade_util_read_prop_name (type);
+ pclass = glade_property_get_class (property);
- if (!strcmp (id, glade_property_get_class (property)->id))
+ if (!strcmp (id, glade_property_class_id (pclass)))
{
if (string == NULL)
string = g_strdup (target);
@@ -401,16 +403,19 @@ glade_gtk_widget_write_atk_property (GladeProperty * property,
GladeXmlNode * node)
{
GladeXmlNode *prop_node;
+ GladePropertyClass *pclass;
gchar *value;
glade_property_get (property, &value);
if (value && value[0])
{
+ pclass = glade_property_get_class (property);
+
prop_node = glade_xml_node_new (context, GLADE_TAG_A11Y_PROPERTY);
glade_xml_node_append_child (node, prop_node);
glade_xml_node_set_property_string (prop_node,
- GLADE_TAG_NAME, glade_property_get_class (property)->id);
+ GLADE_TAG_NAME, glade_property_class_id (pclass));
glade_xml_set_content (prop_node, value);
@@ -481,23 +486,26 @@ glade_gtk_widget_write_atk_relation (GladeProperty * property,
GladeXmlNode * node)
{
GladeXmlNode *prop_node;
+ GladePropertyClass *pclass;
gchar *value, **split;
gint i;
if ((value = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (glade_property_get_class (property)->handle),
+ (glade_property_class_get_adaptor (glade_property_get_class (property)),
glade_property_get_class (property), glade_property_inline_value (property))) != NULL)
{
if ((split = g_strsplit (value, GPC_OBJECT_DELIMITER, 0)) != NULL)
{
for (i = 0; split[i] != NULL; i++)
{
+ pclass = glade_property_get_class (property);
+
prop_node = glade_xml_node_new (context, GLADE_TAG_A11Y_RELATION);
glade_xml_node_append_child (node, prop_node);
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_A11Y_TYPE,
- glade_property_get_class (property)->id);
+ glade_property_class_id (pclass));
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_A11Y_TARGET,
split[i]);
@@ -532,18 +540,20 @@ glade_gtk_widget_write_atk_action (GladeProperty * property,
GladeXmlNode * node)
{
GladeXmlNode *prop_node;
+ GladePropertyClass *pclass;
gchar *value = NULL;
glade_property_get (property, &value);
if (value && value[0])
{
+ pclass = glade_property_get_class (property);
prop_node = glade_xml_node_new (context, GLADE_TAG_A11Y_ACTION);
glade_xml_node_append_child (node, prop_node);
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_A11Y_ACTION_NAME,
- &glade_property_get_class (property)->id[4]);
+ &glade_property_class_id (pclass)[4]);
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_A11Y_DESC, value);
}
@@ -630,9 +640,12 @@ glade_gtk_widget_create_eprop (GladeWidgetAdaptor * adaptor,
GladePropertyClass * klass, gboolean use_command)
{
GladeEditorProperty *eprop;
+ GParamSpec *pspec;
+
+ pspec = glade_property_class_get_pspec (klass);
/* chain up.. */
- if (klass->pspec->value_type == GLADE_TYPE_ACCEL_GLIST)
+ if (pspec->value_type == GLADE_TYPE_ACCEL_GLIST)
eprop = g_object_new (GLADE_TYPE_EPROP_ACCEL,
"property-class", klass,
"use-command", use_command, NULL);
@@ -647,7 +660,11 @@ glade_gtk_widget_string_from_value (GladeWidgetAdaptor * adaptor,
GladePropertyClass * klass,
const GValue * value)
{
- if (klass->pspec->value_type == GLADE_TYPE_ACCEL_GLIST)
+ GParamSpec *pspec;
+
+ pspec = glade_property_class_get_pspec (klass);
+
+ if (pspec->value_type == GLADE_TYPE_ACCEL_GLIST)
return glade_accels_make_string (g_value_get_boxed (value));
else
return GWA_GET_CLASS
@@ -731,8 +748,9 @@ create_command_property_list (GladeWidget * gnew, GList * saved_props)
for (l = saved_props; l; l = l->next)
{
GladeProperty *property = l->data;
+ GladePropertyClass *pclass = glade_property_get_class (property);
GladeProperty *orig_prop =
- glade_widget_get_pack_property (gnew, glade_property_get_class (property)->id);
+ glade_widget_get_pack_property (gnew, glade_property_class_id (pclass));
GCSetPropData *pdata = g_new0 (GCSetPropData, 1);
pdata->property = orig_prop;
@@ -1073,7 +1091,7 @@ glade_gtk_container_replace_child (GladeWidgetAdaptor * adaptor,
pclass = glade_widget_adaptor_get_pack_property_class
(adaptor, param_spec[i]->name);
- if (pclass && pclass->transfer_on_paste)
+ if (pclass && glade_property_class_transfer_on_paste (pclass))
continue;
}
@@ -5817,6 +5835,7 @@ glade_gtk_image_write_widget (GladeWidgetAdaptor * adaptor,
{
GladeXmlNode *prop_node;
GladeProperty *size_prop;
+ GladePropertyClass *pclass;
GtkIconSize icon_size;
gchar *value;
@@ -5833,11 +5852,12 @@ glade_gtk_image_write_widget (GladeWidgetAdaptor * adaptor,
size_prop = glade_widget_get_property (widget, "icon-size");
if (!glade_property_original_default (size_prop))
{
+ pclass = glade_property_get_class (size_prop);
prop_node = glade_xml_node_new (context, GLADE_TAG_PROPERTY);
glade_xml_node_append_child (node, prop_node);
glade_xml_node_set_property_string (prop_node, GLADE_TAG_NAME,
- glade_property_get_class (size_prop)->id);
+ glade_property_class_id (pclass));
glade_property_get (size_prop, &icon_size);
value = g_strdup_printf ("%d", icon_size);
@@ -7972,7 +7992,11 @@ glade_gtk_label_string_from_value (GladeWidgetAdaptor * adaptor,
GladePropertyClass * klass,
const GValue * value)
{
- if (klass->pspec->value_type == GLADE_TYPE_ATTR_GLIST)
+ GParamSpec *pspec;
+
+ pspec = glade_property_class_get_pspec (klass);
+
+ if (pspec->value_type == GLADE_TYPE_ATTR_GLIST)
{
GList *l, *list = g_value_get_boxed (value);
GString *string = g_string_new ("");
@@ -8002,9 +8026,12 @@ glade_gtk_label_create_eprop (GladeWidgetAdaptor * adaptor,
GladePropertyClass * klass, gboolean use_command)
{
GladeEditorProperty *eprop;
+ GParamSpec *pspec;
+
+ pspec = glade_property_class_get_pspec (klass);
/* chain up.. */
- if (klass->pspec->value_type == GLADE_TYPE_ATTR_GLIST)
+ if (pspec->value_type == GLADE_TYPE_ATTR_GLIST)
{
eprop = g_object_new (GLADE_TYPE_EPROP_ATTRS,
"property-class", klass,
@@ -9184,8 +9211,11 @@ glade_gtk_icon_factory_string_from_value (GladeWidgetAdaptor * adaptor,
const GValue * value)
{
GString *string;
+ GParamSpec *pspec;
+
+ pspec = glade_property_class_get_pspec (klass);
- if (klass->pspec->value_type == GLADE_TYPE_ICON_SOURCES)
+ if (pspec->value_type == GLADE_TYPE_ICON_SOURCES)
{
GladeIconSources *sources = g_value_get_boxed (value);
if (!sources)
@@ -9209,8 +9239,11 @@ glade_gtk_icon_factory_create_eprop (GladeWidgetAdaptor * adaptor,
gboolean use_command)
{
GladeEditorProperty *eprop;
+ GParamSpec *pspec;
- if (klass->pspec->value_type == GLADE_TYPE_ICON_SOURCES)
+ pspec = glade_property_class_get_pspec (klass);
+
+ if (pspec->value_type == GLADE_TYPE_ICON_SOURCES)
eprop = g_object_new (GLADE_TYPE_EPROP_ICON_SOURCES,
"property-class", klass,
"use-command", use_command, NULL);
@@ -9271,6 +9304,7 @@ glade_gtk_cell_renderer_sync_attributes (GObject * object)
GladeWidget *parent;
GladeWidget *gmodel;
GladeProperty *property;
+ GladePropertyClass *pclass;
gchar *attr_prop_name;
GList *l, *column_list = NULL;
gint columns = 0;
@@ -9306,13 +9340,14 @@ glade_gtk_cell_renderer_sync_attributes (GObject * object)
for (l = glade_widget_get_properties (widget); l; l = l->next)
{
property = l->data;
+ pclass = glade_property_get_class (property);
- if (strncmp (glade_property_get_class (property)->id, "attr-", attr_len) == 0)
+ if (strncmp (glade_property_class_id (pclass), "attr-", attr_len) == 0)
{
GladeProperty *attr_prop;
gint column = g_value_get_int (glade_property_inline_value (property));
- attr_prop_name = &glade_property_get_class (property)->id[attr_len];
+ attr_prop_name = (gchar *)&glade_property_class_id (pclass)[attr_len];
attr_prop = glade_widget_get_property (widget, attr_prop_name);
if (column >= 0 && column < columns)
@@ -9320,10 +9355,10 @@ glade_gtk_cell_renderer_sync_attributes (GObject * object)
GladeColumnType *column_type =
(GladeColumnType *) g_list_nth_data (column_list, column);
GType column_gtype = g_type_from_name (column_type->type_name);
+ GParamSpec *pspec = glade_property_class_get_pspec (pclass);
if (column_gtype &&
- g_value_type_transformable (column_gtype,
- glade_property_get_class (attr_prop)->pspec->value_type))
+ g_value_type_transformable (column_gtype, pspec->value_type))
gtk_cell_layout_add_attribute (layout, cell, attr_prop_name, column);
}
}
@@ -9460,13 +9495,16 @@ glade_gtk_store_create_eprop (GladeWidgetAdaptor * adaptor,
GladePropertyClass * klass, gboolean use_command)
{
GladeEditorProperty *eprop;
+ GParamSpec *pspec;
+
+ pspec = glade_property_class_get_pspec (klass);
/* chain up.. */
- if (klass->pspec->value_type == GLADE_TYPE_COLUMN_TYPE_LIST)
+ if (pspec->value_type == GLADE_TYPE_COLUMN_TYPE_LIST)
eprop = g_object_new (GLADE_TYPE_EPROP_COLUMN_TYPES,
"property-class", klass,
"use-command", use_command, NULL);
- else if (klass->pspec->value_type == GLADE_TYPE_MODEL_DATA_TREE)
+ else if (pspec->value_type == GLADE_TYPE_MODEL_DATA_TREE)
eprop = g_object_new (GLADE_TYPE_EPROP_MODEL_DATA,
"property-class", klass,
"use-command", use_command, NULL);
@@ -9558,8 +9596,11 @@ glade_gtk_store_string_from_value (GladeWidgetAdaptor * adaptor,
const GValue * value)
{
GString *string;
+ GParamSpec *pspec;
+
+ pspec = glade_property_class_get_pspec (klass);
- if (klass->pspec->value_type == GLADE_TYPE_COLUMN_TYPE_LIST)
+ if (pspec->value_type == GLADE_TYPE_COLUMN_TYPE_LIST)
{
GList *l;
string = g_string_new ("");
@@ -9572,7 +9613,7 @@ glade_gtk_store_string_from_value (GladeWidgetAdaptor * adaptor,
}
return g_string_free (string, FALSE);
}
- else if (klass->pspec->value_type == GLADE_TYPE_MODEL_DATA_TREE)
+ else if (pspec->value_type == GLADE_TYPE_MODEL_DATA_TREE)
{
GladeModelData *data;
GNode *data_tree, *row, *iter;
@@ -10002,9 +10043,9 @@ glade_gtk_cell_renderer_deep_post_create (GladeWidgetAdaptor * adaptor,
{
pclass = l->data;
- if (strncmp (pclass->id, "use-attr-", strlen ("use-attr-")) == 0)
+ if (strncmp (glade_property_class_id (pclass), "use-attr-", strlen ("use-attr-")) == 0)
{
- property = glade_widget_get_property (widget, pclass->id);
+ property = glade_widget_get_property (widget, glade_property_class_id (pclass));
glade_property_sync (property);
}
}
@@ -10019,7 +10060,7 @@ glade_gtk_cell_renderer_create_eprop (GladeWidgetAdaptor * adaptor,
{
GladeEditorProperty *eprop;
- if (strncmp (klass->id, "attr-", strlen ("attr-")) == 0)
+ if (strncmp (glade_property_class_id (klass), "attr-", strlen ("attr-")) == 0)
eprop = g_object_new (GLADE_TYPE_EPROP_CELL_ATTRIBUTE,
"property-class", klass,
"use-command", use_command, NULL);
@@ -10143,6 +10184,7 @@ glade_gtk_cell_renderer_write_properties (GladeWidget * widget,
GladeXmlNode * node)
{
GladeProperty *property, *prop;
+ GladePropertyClass *pclass;
gchar *attr_name;
GList *l;
static gint attr_len = 0;
@@ -10153,16 +10195,17 @@ glade_gtk_cell_renderer_write_properties (GladeWidget * widget,
for (l = glade_widget_get_properties (widget); l; l = l->next)
{
property = l->data;
+ pclass = glade_property_get_class (property);
- if (strncmp (glade_property_get_class (property)->id, "attr-", attr_len) == 0)
+ if (strncmp (glade_property_class_id (pclass), "attr-", attr_len) == 0)
{
gchar *use_attr_str;
gboolean use_attr = FALSE;
- use_attr_str = g_strdup_printf ("use-%s", glade_property_get_class (property)->id);
+ use_attr_str = g_strdup_printf ("use-%s", glade_property_class_id (pclass));
glade_widget_property_get (widget, use_attr_str, &use_attr);
- attr_name = &glade_property_get_class (property)->id[attr_len];
+ attr_name = (gchar *)&glade_property_class_id (pclass)[attr_len];
prop = glade_widget_get_property (widget, attr_name);
if (!use_attr && prop)
@@ -10212,14 +10255,16 @@ glade_gtk_cell_renderer_parse_finished (GladeProject * project,
for (l = glade_widget_get_properties (widget); l; l = l->next)
{
GladeProperty *switch_prop;
+ GladePropertyClass *pclass;
+
property = l->data;
+ pclass = glade_property_get_class (property);
- if (strncmp (glade_property_get_class (property)->id, "attr-", attr_len) != 0 &&
- strncmp (glade_property_get_class (property)->id, "use-attr-", use_attr_len) != 0 &&
+ if (strncmp (glade_property_class_id (pclass), "attr-", attr_len) != 0 &&
+ strncmp (glade_property_class_id (pclass), "use-attr-", use_attr_len) != 0 &&
(switch_prop =
glade_gtk_cell_renderer_attribute_switch (widget,
- glade_property_get_class (property)->id)) !=
- NULL)
+ glade_property_class_id (pclass))) != NULL)
{
if (glade_property_original_default (property))
glade_property_set (switch_prop, TRUE);
@@ -10447,6 +10492,7 @@ glade_gtk_cell_renderer_write_attributes (GladeWidget * widget,
GladeXmlNode * node)
{
GladeProperty *property;
+ GladePropertyClass *pclass;
GladeXmlNode *attrs_node;
gchar *attr_name;
GList *l;
@@ -10460,21 +10506,22 @@ glade_gtk_cell_renderer_write_attributes (GladeWidget * widget,
for (l = glade_widget_get_properties (widget); l; l = l->next)
{
property = l->data;
+ pclass = glade_property_get_class (property);
- if (strncmp (glade_property_get_class (property)->id, "attr-", attr_len) == 0)
+ if (strncmp (glade_property_class_id (pclass), "attr-", attr_len) == 0)
{
GladeXmlNode *attr_node;
gchar *column_str, *use_attr_str;
gboolean use_attr = FALSE;
- use_attr_str = g_strdup_printf ("use-%s", glade_property_get_class (property)->id);
+ use_attr_str = g_strdup_printf ("use-%s", glade_property_class_id (pclass));
glade_widget_property_get (widget, use_attr_str, &use_attr);
if (use_attr && g_value_get_int (glade_property_inline_value (property)) >= 0)
{
column_str =
g_strdup_printf ("%d", g_value_get_int (glade_property_inline_value (property)));
- attr_name = &glade_property_get_class (property)->id[attr_len];
+ attr_name = (gchar *)&glade_property_class_id (pclass)[attr_len];
attr_node = glade_xml_node_new (context, GLADE_TAG_ATTRIBUTE);
glade_xml_node_append_child (attrs_node, attr_node);
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 92e45b4..74c1bb7 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -49,9 +49,7 @@
</actions>
<properties>
- <property id="tooltip-text" since="2.12" weight="4.2" translatable="True" >
- <visible-lines>2</visible-lines>
- </property>
+ <property id="tooltip-text" since="2.12" weight="4.2" translatable="True" multiline="True" />
<property id="can-focus" common="True" save-always="True"/>
<property id="has-default" common="True" ignore="True"/>
<property id="can-default" common="True" />
@@ -113,20 +111,20 @@
</property>
<!-- Atk name and description properties -->
- <property id="AtkObject::accessible-name" _name="Accessible Name" ignore="True" atk-property="True" translatable="True" save="False">
+ <property id="AtkObject::accessible-name" _name="Accessible Name" ignore="True" atk-property="True"
+ translatable="True" save="False" multiline="True">
<parameter-spec>
<type>GParamString</type>
</parameter-spec>
<_tooltip>Object instance's name formatted for assistive technology access</_tooltip>
- <visible-lines>2</visible-lines>
</property>
- <property id="AtkObject::accessible-description" _name="Accessible Description" ignore="True" atk-property="True" translatable="True" save="False">
+ <property id="AtkObject::accessible-description" _name="Accessible Description" ignore="True"
+ atk-property="True" translatable="True" save="False" multiline="True">
<parameter-spec>
<type>GParamString</type>
</parameter-spec>
<_tooltip>Description of an object, formatted for assistive technology access</_tooltip>
- <visible-lines>2</visible-lines>
</property>
<!-- Atk relationset properties -->
@@ -469,12 +467,12 @@ embedded in another object</_tooltip>
custom-layout="True" needs-sync="True" default="False" since="2.16"/>
<!-- Atk click property -->
- <property id="atk-click" _name="Click" ignore="True" atk-property="True" save="False">
+ <property id="atk-click" _name="Click" ignore="True" atk-property="True" save="False"
+ multiline="True">
<parameter-spec>
<type>GParamString</type>
</parameter-spec>
<_tooltip>Set the description of the Click atk action</_tooltip>
- <visible-lines>2</visible-lines>
</property>
<property id="submenu" since="2.12" disabled="True"/>
</properties>
@@ -714,9 +712,7 @@ embedded in another object</_tooltip>
<type>GParamInt</type>
</parameter-spec>
</property>
- <property id="label" default="label" translatable="True" custom-layout="True">
- <visible-lines>2</visible-lines>
- </property>
+ <property id="label" default="label" translatable="True" custom-layout="True" multiline="True"/>
<property id="glade-attributes" _name="Attributes" save="False" custom-layout="True"
since="2.16">
<parameter-spec>
@@ -835,12 +831,12 @@ embedded in another object</_tooltip>
</property>
<!-- Atk activate property -->
- <property id="atk-activate" _name="Activate" ignore="True" atk-property="True" save="False">
+ <property id="atk-activate" _name="Activate" ignore="True" atk-property="True" save="False"
+ multiline="True">
<parameter-spec>
<type>GParamString</type>
</parameter-spec>
<_tooltip>Set the description of the Activate atk action</_tooltip>
- <visible-lines>2</visible-lines>
</property>
</properties>
</glade-widget-class>
@@ -873,9 +869,8 @@ embedded in another object</_tooltip>
<property id="receives-default" save-always="True"/>
<property id="image" parentless-widget="True" create-type="GtkImage" custom-layout="True"/>
<property id="use-stock" visible="False" custom-layout="True"/>
- <property id="label" default="button" translatable="True" custom-layout="True" save="False">
- <visible-lines>2</visible-lines>
- </property>
+ <property id="label" default="button" translatable="True" custom-layout="True" save="False"
+ multiline="True"/>
<property id="use-underline" custom-layout="True"/>
<property id="stock" _name="Stock Button" stock="True" save="False" custom-layout="True">
<parameter-spec>
@@ -908,30 +903,28 @@ embedded in another object</_tooltip>
<property id="use-action-appearance" _name="Use Action Appearance" custom-layout="True" default="False" since="2.16"/>
<!-- Atk click property -->
- <property id="atk-click" _name="Click" ignore="True" atk-property="True" save="False">
+ <property id="atk-click" _name="Click" ignore="True" atk-property="True" save="False" multiline="True">
<parameter-spec>
<type>GParamString</type>
</parameter-spec>
<_tooltip>Set the description of the Click atk action</_tooltip>
- <visible-lines>2</visible-lines>
</property>
<!-- Atk press property -->
- <property id="atk-press" _name="Press" ignore="True" atk-property="True" save="False">
+ <property id="atk-press" _name="Press" ignore="True" atk-property="True" save="False" multiline="True">
<parameter-spec>
<type>GParamString</type>
</parameter-spec>
<_tooltip>Set the description of the Press atk action</_tooltip>
- <visible-lines>2</visible-lines>
</property>
<!-- Atk release property -->
- <property id="atk-release" _name="Release" ignore="True" atk-property="True" save="False">
+ <property id="atk-release" _name="Release" ignore="True" atk-property="True" save="False"
+ multiline="True">
<parameter-spec>
<type>GParamString</type>
</parameter-spec>
<_tooltip>Set the description of the Release atk action</_tooltip>
- <visible-lines>2</visible-lines>
</property>
</properties>
@@ -1106,12 +1099,11 @@ embedded in another object</_tooltip>
<property id="editing-canceled" disabled="True" since="2.20"/>
<!-- Atk press property -->
- <property id="atk-press" _name="Press" ignore="True" atk-property="True" save="False">
+ <property id="atk-press" _name="Press" ignore="True" atk-property="True" save="False" multiline="True">
<parameter-spec>
<type>GParamString</type>
</parameter-spec>
<_tooltip>Set the description of the Press atk action</_tooltip>
- <visible-lines>2</visible-lines>
</property>
</properties>
</glade-widget-class>
@@ -1510,12 +1502,12 @@ embedded in another object</_tooltip>
<property id="label-widget" disabled="True"/>
<!-- Atk activate property -->
- <property id="atk-activate" _name="Activate" ignore="True" atk-property="True" save="False">
+ <property id="atk-activate" _name="Activate" ignore="True" atk-property="True" save="False"
+ multiline="True">
<parameter-spec>
<type>GParamString</type>
</parameter-spec>
<_tooltip>Set the description of the Activate atk action</_tooltip>
- <visible-lines>2</visible-lines>
</property>
</properties>
</glade-widget-class>
@@ -1552,23 +1544,14 @@ embedded in another object</_tooltip>
<glade-widget-class name="GtkAboutDialog" generic-name="aboutdialog" _title="About Dialog">
<properties>
<property id="program-name" since="2.12"/>
- <property id="copyright" translatable="True">
- <visible-lines>2</visible-lines>
- </property>
- <property id="comments" translatable="True">
- <visible-lines>2</visible-lines>
- </property>
- <property id="license" translatable="True">
- <visible-lines>2</visible-lines>
- </property>
- <property id="website-label" translatable="True">
- <visible-lines>2</visible-lines>
- </property>
+ <property id="copyright" translatable="True" multiline="True"/>
+ <property id="comments" translatable="True" multiline="True"/>
+ <property id="license" translatable="True" multiline="True"/>
+ <property id="website-label" translatable="True" multiline="True"/>
<!-- It is disputable whether this should really be translatable -->
- <property id="translator-credits" translatable="True">
+ <property id="translator-credits" translatable="True" multiline="True">
<_tooltip>You can mark this as translatable and set one name/address if you want to show a translation specific translator, otherwise you should list all translators and unmark this string for translation</_tooltip>
- <visible-lines>2</visible-lines>
</property>
</properties>
<signals>
@@ -3164,9 +3147,7 @@ embedded in another object</_tooltip>
</signals>
<properties>
- <property id="text" translatable="True">
- <visible-lines>2</visible-lines>
- </property>
+ <property id="text" translatable="True" multiline="True"/>
</properties>
</glade-widget-class>
@@ -3175,9 +3156,7 @@ embedded in another object</_tooltip>
<post-create-function>glade_gtk_entry_buffer_post_create</post-create-function>
<set-property-function>glade_gtk_entry_buffer_set_property</set-property-function>
<properties>
- <property id="text" translatable="True">
- <visible-lines>2</visible-lines>
- </property>
+ <property id="text" translatable="True" multiline="True"/>
</properties>
</glade-widget-class>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]