[glade3] * Made GladeProperty internalize *everything* into a private data structure, 17 files changed, 766
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * Made GladeProperty internalize *everything* into a private data structure, 17 files changed, 766
- Date: Sat, 1 Jan 2011 18:21:44 +0000 (UTC)
commit e4b450167be8e5530db04ece5b5d4493f1900bd8
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun Jan 2 03:28:18 2011 +0900
* Made GladeProperty internalize *everything* into a private data structure,
17 files changed, 766 insertions(+), 592 deletions(-)
ChangeLog | 3 +
gladeui/glade-base-editor.c | 9 +-
gladeui/glade-command.c | 122 ++++----
gladeui/glade-editor-property.c | 160 +++++-----
gladeui/glade-editor.c | 24 +-
gladeui/glade-popup.c | 21 +-
gladeui/glade-project.c | 59 ++--
gladeui/glade-property.c | 482 ++++++++++++++++++-----------
gladeui/glade-property.h | 112 +++-----
gladeui/glade-widget-adaptor.c | 12 +-
gladeui/glade-widget.c | 214 ++++++++------
plugins/gtk+/glade-accels.c | 8 +-
plugins/gtk+/glade-attributes.c | 6 +-
plugins/gtk+/glade-cell-renderer-editor.c | 6 +-
plugins/gtk+/glade-column-types.c | 13 +-
plugins/gtk+/glade-gtk.c | 95 +++---
plugins/gtk+/glade-icon-sources.c | 4 +-
plugins/gtk+/glade-model-data.c | 11 +-
18 files changed, 769 insertions(+), 592 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6f96c40..0f07467 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,9 @@
* gladeui/glade-clipboard.h, gladeui/glade-app.c: Removed clipboard->view member and
make GladeApp properly destroy the clipboard when disposing.
+ * Made GladeProperty internalize *everything* into a private data structure,
+ 17 files changed, 766 insertions(+), 592 deletions(-)
+
2010-12-31 Tristan Van Berkom <tristanvb openismus com>
* gladeui/glade-project.c: Further fixing project dispose cycle, still leaking a little
diff --git a/gladeui/glade-base-editor.c b/gladeui/glade-base-editor.c
index b3eab7b..bc4c335 100644
--- a/gladeui/glade-base-editor.c
+++ b/gladeui/glade-base-editor.c
@@ -1365,11 +1365,10 @@ glade_base_editor_change_type (GladeBaseEditor * editor,
l = glade_widget_get_packing_properties (gchild);
while (l)
{
- GladeProperty *orig_prop = (GladeProperty *) l->data;
- GladeProperty *dup_prop = glade_widget_get_property (gchild_new,
- orig_prop->klass->
- id);
- glade_property_set_value (dup_prop, orig_prop->value);
+ 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);
+ 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 17752b9..7508010 100644
--- a/gladeui/glade-command.c
+++ b/gladeui/glade-command.c
@@ -361,8 +361,10 @@ glade_command_set_property_execute (GladeCommand * cmd)
for (l = me->sdata; l; l = l->next)
{
- GValue new_value = { 0, };
- GCSetPropData *sdata = l->data;
+ GValue new_value = { 0, };
+ GCSetPropData *sdata = l->data;
+ GladePropertyClass *pclass = glade_property_get_class (sdata->property);
+ GladeWidget *widget = glade_property_get_widget (sdata->property);
g_value_init (&new_value, G_VALUE_TYPE (sdata->new_value));
@@ -375,12 +377,11 @@ glade_command_set_property_execute (GladeCommand * cmd)
{
gchar *str =
glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (sdata->property->klass->handle),
- sdata->property->klass, &new_value);
+ (GLADE_WIDGET_ADAPTOR (pclass->handle), pclass, &new_value);
g_print ("Setting %s property of %s to %s (sumode: %d)\n",
- sdata->property->klass->id,
- sdata->property->widget->name,
+ pclass->id,
+ glade_widget_get_name (widget),
str, glade_property_superuser ());
g_free (str);
@@ -390,37 +391,32 @@ 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 (sdata->property->klass->packing)
+ if (pclass->packing)
{
GladeProperty *tmp_prop;
- tmp_prop = glade_widget_get_pack_property
- (sdata->property->widget, sdata->property->klass->id);
+ tmp_prop = glade_widget_get_pack_property (widget, pclass->id);
if (sdata->property != tmp_prop)
{
g_object_unref (sdata->property);
sdata->property = g_object_ref (tmp_prop);
-
}
}
success = glade_property_set_value (sdata->property, &new_value);
- retval = retval || success;
+ retval = retval || success;
if (!me->set_once && success)
{
/* If some verify functions didnt pass on
* the first go.. we need to record the actual
- * properties here.
+ * properties here. XXX should be able to use glade_property_get_value() here
*/
- g_value_copy (sdata->property->value, sdata->new_value);
+ g_value_copy (glade_property_inline_value (sdata->property), sdata->new_value);
}
-
g_value_unset (&new_value);
-
-
}
if (me->set_once != FALSE)
@@ -466,7 +462,9 @@ glade_command_set_property_unifies (GladeCommand * this_cmd,
GladeCommand * other_cmd)
{
GladeCommandSetProperty *cmd1, *cmd2;
+ GladePropertyClass *pclass1, *pclass2;
GCSetPropData *pdata1, *pdata2;
+ GladeWidget *widget1, *widget2;
GList *list, *l;
if (!other_cmd)
@@ -477,9 +475,10 @@ glade_command_set_property_unifies (GladeCommand * this_cmd,
for (list = cmd1->sdata; list; list = list->next)
{
- pdata1 = list->data;
+ pdata1 = list->data;
+ pclass1 = glade_property_get_class (pdata1->property);
- if (glade_property_class_compare (pdata1->property->klass,
+ if (glade_property_class_compare (pclass1,
pdata1->old_value,
pdata1->new_value))
return FALSE;
@@ -501,14 +500,18 @@ glade_command_set_property_unifies (GladeCommand * this_cmd,
for (list = cmd1->sdata; list; list = list->next)
{
- pdata1 = list->data;
+ pdata1 = list->data;
+ pclass1 = glade_property_get_class (pdata1->property);
+ widget1 = glade_property_get_widget (pdata1->property);
+
for (l = cmd2->sdata; l; l = l->next)
{
- pdata2 = l->data;
+ pdata2 = l->data;
+ pclass2 = glade_property_get_class (pdata2->property);
+ widget2 = glade_property_get_widget (pdata2->property);
- if (pdata1->property->widget == pdata2->property->widget &&
- glade_property_class_match (pdata1->property->klass,
- pdata2->property->klass))
+ if (widget1 == widget2 &&
+ glade_property_class_match (pclass1, pclass2))
break;
}
@@ -517,7 +520,6 @@ glade_command_set_property_unifies (GladeCommand * this_cmd,
*/
if (l == NULL)
return FALSE;
-
}
return TRUE;
@@ -531,6 +533,7 @@ glade_command_set_property_collapse (GladeCommand * this_cmd,
{
GladeCommandSetProperty *cmd1, *cmd2;
GCSetPropData *pdata1, *pdata2;
+ GladePropertyClass *pclass1, *pclass2;
GList *list, *l;
g_return_if_fail (GLADE_IS_COMMAND_SET_PROPERTY (this_cmd) &&
@@ -542,13 +545,15 @@ glade_command_set_property_collapse (GladeCommand * this_cmd,
for (list = cmd1->sdata; list; list = list->next)
{
- pdata1 = list->data;
+ pdata1 = list->data;
+ pclass1 = glade_property_get_class (pdata1->property);
+
for (l = cmd2->sdata; l; l = l->next)
{
- pdata2 = l->data;
+ pdata2 = l->data;
+ pclass2 = glade_property_get_class (pdata2->property);
- if (glade_property_class_match (pdata1->property->klass,
- pdata2->property->klass))
+ if (glade_property_class_match (pclass1, pclass2))
{
/* Merge the GCSetPropData structs manually here
*/
@@ -575,6 +580,8 @@ glade_command_set_property_description (GladeCommandSetProperty * me)
GCSetPropData *sdata;
gchar *description = NULL;
gchar *value_name;
+ GladePropertyClass *pclass;
+ GladeWidget *widget;
g_assert (me->sdata);
@@ -582,23 +589,24 @@ glade_command_set_property_description (GladeCommandSetProperty * me)
description = g_strdup_printf (_("Setting multiple properties"));
else
{
- sdata = me->sdata->data;
+ pclass = glade_property_get_class (sdata->property);
+ widget = glade_property_get_widget (sdata->property);
+ sdata = me->sdata->data;
value_name = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (sdata->property->klass->handle),
- sdata->property->klass, sdata->new_value);
+ (GLADE_WIDGET_ADAPTOR (pclass->handle), 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"),
- sdata->property->klass->name,
- glade_widget_get_name (sdata->property->widget));
+ pclass->name,
+ glade_widget_get_name (widget));
}
else
{
description = g_strdup_printf (_("Setting %s of %s to %s"),
- sdata->property->klass->name,
- glade_widget_get_name (sdata->property->widget),
+ pclass->name,
+ glade_widget_get_name (widget),
value_name);
}
g_free (value_name);
@@ -662,6 +670,8 @@ glade_command_set_properties (GladeProperty * property,
{
GCSetPropData *sdata;
GladeProperty *prop;
+ GladeWidget *widget;
+ GladeProject *project;
GValue *ovalue, *nvalue;
GList *list = NULL;
va_list vl;
@@ -701,7 +711,9 @@ glade_command_set_properties (GladeProperty * property,
}
va_end (vl);
- glade_command_set_properties_list (glade_widget_get_project (property->widget), list);
+ widget = glade_property_get_widget (property);
+ project = glade_widget_get_project (widget);
+ glade_command_set_properties_list (project, list);
}
void
@@ -714,7 +726,7 @@ glade_command_set_property_value (GladeProperty * property,
if (glade_property_equals_value (property, pvalue))
return;
- glade_command_set_properties (property, property->value, pvalue, NULL);
+ glade_command_set_properties (property, glade_property_inline_value (property), pvalue, NULL);
}
void
@@ -726,7 +738,7 @@ glade_command_set_property (GladeProperty * property, ...)
g_return_if_fail (GLADE_IS_PROPERTY (property));
va_start (args, property);
- value = glade_property_class_make_gvalue_from_vl (property->klass, args);
+ value = glade_property_class_make_gvalue_from_vl (glade_property_get_class (property), args);
va_end (args);
glade_command_set_property_value (property, value);
@@ -1241,12 +1253,13 @@ glade_command_transfer_props (GladeWidget * gnew, GList * saved_props)
for (l = saved_props; l; l = l->next)
{
GladeProperty *prop, *sprop = l->data;
+ GladePropertyClass *pclass = glade_property_get_class (sprop);
- prop = glade_widget_get_pack_property (gnew, sprop->klass->id);
+ prop = glade_widget_get_pack_property (gnew, pclass->id);
- if (prop && sprop->klass->transfer_on_paste &&
- glade_property_class_match (prop->klass, sprop->klass))
- glade_property_set_value (prop, sprop->value);
+ if (prop && pclass->transfer_on_paste &&
+ glade_property_class_match (glade_property_get_class (prop), pclass))
+ glade_property_set_value (prop, glade_property_inline_value (sprop));
}
}
@@ -1327,11 +1340,11 @@ glade_command_add_execute (GladeCommandAddRemove * me)
/* Now that we've added, apply any packing props if nescisary. */
for (l = cdata->pack_props; l; l = l->next)
{
- GValue value = { 0, };
- GladeProperty *saved_prop = l->data;
- GladeProperty *widget_prop =
- glade_widget_get_pack_property (cdata->widget,
- saved_prop->klass->id);
+ GValue value = { 0, };
+ 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_property_get_value (saved_prop, &value);
glade_property_set_value (widget_prop, &value);
@@ -2244,9 +2257,9 @@ glade_command_set_i18n (GladeProperty * property,
g_return_if_fail (property);
/* check that something changed before continuing with the command */
- if (translatable == property->i18n_translatable &&
- !g_strcmp0 (property->i18n_context, context) &&
- !g_strcmp0 (property->i18n_comment, comment))
+ if (translatable == glade_property_i18n_get_translatable (property) &&
+ !g_strcmp0 (glade_property_i18n_get_context (property), context) &&
+ !g_strcmp0 (glade_property_i18n_get_comment (property), comment))
return;
/* load up the command */
@@ -2255,11 +2268,12 @@ glade_command_set_i18n (GladeProperty * property,
me->translatable = translatable;
me->context = g_strdup (context);
me->comment = g_strdup (comment);
- me->old_translatable = property->i18n_translatable;
- me->old_context = g_strdup (property->i18n_context);
- me->old_comment = g_strdup (property->i18n_comment);
+ me->old_translatable = glade_property_i18n_get_translatable (property);
+ me->old_context = g_strdup (glade_property_i18n_get_context (property));
+ me->old_comment = g_strdup (glade_property_i18n_get_comment (property));
- GLADE_COMMAND (me)->project = glade_widget_get_project (property->widget);
+ GLADE_COMMAND (me)->project =
+ glade_widget_get_project (glade_property_get_widget (property));
GLADE_COMMAND (me)->description =
g_strdup_printf (_("Setting i18n metadata"));;
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index 9fb9b1d..448b28c 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -94,8 +94,7 @@ glade_editor_property_commit_common (GladeEditorProperty * eprop,
/* If the value was denied by a verify function, we'll have to
* reload the real value.
*/
- if (glade_property_class_compare (eprop->property->klass,
- eprop->property->value, value) != 0)
+ if (glade_property_equals_value (eprop->property, value))
GLADE_EDITOR_PROPERTY_GET_CLASS (eprop)->load (eprop, eprop->property);
else
/* publish a value change to those interested */
@@ -143,7 +142,7 @@ glade_editor_property_sensitivity_cb (GladeProperty * property,
{
gboolean sensitive = glade_property_get_sensitive (eprop->property);
gboolean support_sensitive =
- (eprop->property->state & GLADE_STATE_SUPPORT_DISABLED) == 0;
+ (glade_property_get_state (eprop->property) & GLADE_STATE_SUPPORT_DISABLED) == 0;
gtk_widget_set_sensitive (eprop->input, sensitive && support_sensitive &&
glade_property_get_enabled (property));
@@ -170,7 +169,7 @@ glade_editor_property_fix_label (GladeEditorProperty * eprop)
return;
/* refresh label */
- if ((eprop->property->state & GLADE_STATE_CHANGED) != 0)
+ if ((glade_property_get_state (eprop->property) & GLADE_STATE_CHANGED) != 0)
text = g_strdup_printf ("<b>%s:</b>", eprop->klass->name);
else
text = g_strdup_printf ("%s:", eprop->klass->name);
@@ -178,7 +177,7 @@ glade_editor_property_fix_label (GladeEditorProperty * eprop)
g_free (text);
/* refresh icon */
- if ((eprop->property->state & GLADE_STATE_UNSUPPORTED) != 0)
+ if ((glade_property_get_state (eprop->property) & GLADE_STATE_UNSUPPORTED) != 0)
gtk_widget_show (eprop->warning);
else
gtk_widget_hide (eprop->warning);
@@ -210,7 +209,7 @@ glade_editor_property_enabled_cb (GladeProperty * property,
if (enabled == FALSE)
gtk_widget_set_sensitive (eprop->input, FALSE);
else if (glade_property_get_sensitive (property) ||
- (property->state & GLADE_STATE_SUPPORT_DISABLED) != 0)
+ (glade_property_get_state (property) & GLADE_STATE_SUPPORT_DISABLED) != 0)
gtk_widget_set_sensitive (eprop->input, TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (eprop->check), enabled);
@@ -419,6 +418,8 @@ glade_editor_property_load_common (GladeEditorProperty * eprop,
*/
if (eprop->property != property && property != NULL)
{
+ GladePropertyClass *pclass = glade_property_get_class (property);
+
eprop->property = property;
eprop->tooltip_id =
@@ -456,9 +457,9 @@ glade_editor_property_load_common (GladeEditorProperty * eprop,
/* Load initial tooltips
*/
glade_editor_property_tooltip_cb
- (property,
- property->klass->tooltip,
- property->insensitive_tooltip, property->support_warning, eprop);
+ (property, pclass->tooltip,
+ glade_propert_get_insensitive_tooltip (property),
+ glade_property_get_support_warning (property), eprop);
/* Load initial enabled state
*/
@@ -605,28 +606,31 @@ glade_eprop_numeric_load (GladeEditorProperty * eprop, GladeProperty * property)
{
gfloat val = 0.0F;
GladeEPropNumeric *eprop_numeric = GLADE_EPROP_NUMERIC (eprop);
+ GValue *value;
/* Chain up first */
editor_property_class->load (eprop, property);
if (property)
{
+ value = glade_property_inline_value (property);
+
if (G_IS_PARAM_SPEC_INT (eprop->klass->pspec))
- val = (gfloat) g_value_get_int (property->value);
+ val = (gfloat) g_value_get_int (value);
else if (G_IS_PARAM_SPEC_UINT (eprop->klass->pspec))
- val = (gfloat) g_value_get_uint (property->value);
+ val = (gfloat) g_value_get_uint (value);
else if (G_IS_PARAM_SPEC_LONG (eprop->klass->pspec))
- val = (gfloat) g_value_get_long (property->value);
+ val = (gfloat) g_value_get_long (value);
else if (G_IS_PARAM_SPEC_ULONG (eprop->klass->pspec))
- val = (gfloat) g_value_get_ulong (property->value);
+ val = (gfloat) g_value_get_ulong (value);
else if (G_IS_PARAM_SPEC_INT64 (eprop->klass->pspec))
- val = (gfloat) g_value_get_int64 (property->value);
+ val = (gfloat) g_value_get_int64 (value);
else if (G_IS_PARAM_SPEC_UINT64 (eprop->klass->pspec))
- val = (gfloat) g_value_get_uint64 (property->value);
+ val = (gfloat) g_value_get_uint64 (value);
else if (G_IS_PARAM_SPEC_DOUBLE (eprop->klass->pspec))
- val = (gfloat) g_value_get_double (property->value);
+ val = (gfloat) g_value_get_double (value);
else if (G_IS_PARAM_SPEC_FLOAT (eprop->klass->pspec))
- val = g_value_get_float (property->value);
+ val = g_value_get_float (value);
else
g_warning ("Unsupported type %s\n",
g_type_name (G_PARAM_SPEC_TYPE (eprop->klass->pspec)));
@@ -736,7 +740,7 @@ glade_eprop_enum_load (GladeEditorProperty * eprop, GladeProperty * property)
if (property)
{
eclass = g_type_class_ref (eprop->klass->pspec->value_type);
- value = g_value_get_enum (property->value);
+ value = g_value_get_enum (glade_property_inline_value (property));
for (i = 0; i < eclass->n_values; i++)
if (eclass->values[i].value == value)
@@ -866,8 +870,8 @@ glade_eprop_flags_load (GladeEditorProperty * eprop, GladeProperty * property)
if (property)
{
/* Populate the model with the flags. */
- klass = g_type_class_ref (G_VALUE_TYPE (property->value));
- value = g_value_get_flags (property->value);
+ klass = g_type_class_ref (G_VALUE_TYPE (glade_property_inline_value (property)));
+ value = g_value_get_flags (glade_property_inline_value (property));
/* Step through each of the flags in the class. */
for (flag_num = 0; flag_num < klass->n_values; flag_num++)
@@ -921,14 +925,17 @@ flag_toggled_direct (GtkCellRendererToggle * cell,
guint value = 0;
gint flag_num = 0;
GFlagsClass *klass;
+ GValue *gvalue;
GladeEPropFlags *eprop_flags = GLADE_EPROP_FLAGS (eprop);
if (!eprop->property)
return;
- klass = g_type_class_ref (G_VALUE_TYPE (eprop->property->value));
- value = g_value_get_flags (eprop->property->value);
+ gvalue = glade_property_inline_value (eprop->property);
+
+ klass = g_type_class_ref (G_VALUE_TYPE (gvalue));
+ value = g_value_get_flags (gvalue);
gtk_tree_model_get_iter_from_string (eprop_flags->model, &iter, path_string);
@@ -965,7 +972,7 @@ flag_toggled_direct (GtkCellRendererToggle * cell,
{
GValue val = { 0, };
- g_value_init (&val, G_VALUE_TYPE (eprop->property->value));
+ g_value_init (&val, G_VALUE_TYPE (gvalue));
g_value_set_flags (&val, new_value);
glade_editor_property_commit_no_callback (eprop, &val);
@@ -1141,9 +1148,7 @@ glade_eprop_color_load (GladeEditorProperty * eprop, GladeProperty * property)
if (property)
{
- if ((text = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (eprop->klass->handle),
- eprop->klass, property->value)) != NULL)
+ if ((text = glade_property_make_string (property)) != NULL)
{
gtk_entry_set_text (GTK_ENTRY (eprop_color->entry), text);
g_free (text);
@@ -1151,9 +1156,8 @@ glade_eprop_color_load (GladeEditorProperty * eprop, GladeProperty * property)
else
gtk_entry_set_text (GTK_ENTRY (eprop_color->entry), "");
- if ((color = g_value_get_boxed (property->value)) != NULL)
- gtk_color_button_set_color (GTK_COLOR_BUTTON (eprop_color->cbutton),
- color);
+ if ((color = g_value_get_boxed (glade_property_inline_value (property))) != NULL)
+ gtk_color_button_set_color (GTK_COLOR_BUTTON (eprop_color->cbutton), color);
else
{
GdkColor black = { 0, };
@@ -1246,7 +1250,7 @@ glade_eprop_named_icon_load (GladeEditorProperty * eprop,
return;
entry = GTK_ENTRY (eprop_named_icon->entry);
- text = g_value_get_string (property->value);
+ text = glade_property_make_string (property);
gtk_entry_set_text (entry, text ? text : "");
}
@@ -1458,7 +1462,7 @@ glade_eprop_text_load (GladeEditorProperty * eprop, GladeProperty * property)
{
if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (eprop_text->text_entry)))
{
- const gchar *text = g_value_get_string (property->value);
+ const gchar *text = glade_property_make_string (property);
if (!text)
text = "";
gtk_entry_set_text (GTK_ENTRY
@@ -1467,7 +1471,7 @@ glade_eprop_text_load (GladeEditorProperty * eprop, GladeProperty * property)
}
else
{
- const gchar *text = g_value_get_string (property->value);
+ const gchar *text = glade_property_make_string (property);
gint value = text ?
glade_utils_enum_value_from_string (GLADE_TYPE_STOCK, text) : 0;
@@ -1481,11 +1485,11 @@ glade_eprop_text_load (GladeEditorProperty * eprop, GladeProperty * property)
GtkEntry *entry = GTK_ENTRY (eprop_text->text_entry);
const gchar *text = NULL;
- if (G_VALUE_TYPE (property->value) == G_TYPE_STRING)
- text = g_value_get_string (property->value);
- else if (G_VALUE_TYPE (property->value) == GDK_TYPE_PIXBUF)
+ if (eprop->klass->pspec->value_type == G_TYPE_STRING)
+ text = glade_property_make_string (property);
+ else if (eprop->klass->pspec->value_type == GDK_TYPE_PIXBUF)
{
- GObject *object = g_value_get_object (property->value);
+ GObject *object = g_value_get_object (glade_property_inline_value (property));
if (object)
text = g_object_get_data (object, "GladeFileName");
}
@@ -1498,18 +1502,19 @@ glade_eprop_text_load (GladeEditorProperty * eprop, GladeProperty * property)
buffer =
gtk_text_view_get_buffer (GTK_TEXT_VIEW (eprop_text->text_entry));
- if (G_VALUE_HOLDS (property->value, G_TYPE_STRV) ||
- G_VALUE_HOLDS (property->value, G_TYPE_VALUE_ARRAY))
+ if (eprop->klass->pspec->value_type == G_TYPE_STRV ||
+ eprop->klass->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 (property->klass->handle),
- property->klass, property->value);
+ (GLADE_WIDGET_ADAPTOR (pclass->handle),
+ pclass, glade_property_inline_value (property));
gtk_text_buffer_set_text (buffer, text ? text : "", -1);
g_free (text);
}
else
{
- const gchar *text = g_value_get_string (property->value);
+ const gchar *text = glade_property_make_string (property);
gtk_text_buffer_set_text (buffer, text ? text : "", -1);
}
}
@@ -1526,14 +1531,14 @@ glade_eprop_text_changed_common (GladeEditorProperty * eprop,
GValue *val;
gchar *prop_text;
- if (eprop->property->klass->pspec->value_type == G_TYPE_STRV ||
- eprop->property->klass->pspec->value_type == G_TYPE_VALUE_ARRAY ||
- eprop->property->klass->pspec->value_type == GDK_TYPE_PIXBUF)
+ 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)
{
val = glade_property_class_make_gvalue_from_string
- (eprop->property->klass, text,
- glade_widget_get_project (eprop->property->widget),
- eprop->property->widget);
+ (eprop->klass, text,
+ glade_widget_get_project (glade_property_get_widget (eprop->property)),
+ glade_property_get_widget (eprop->property));
}
else
{
@@ -1817,7 +1822,7 @@ static void
glade_eprop_text_show_i18n_dialog (GtkWidget * entry,
GladeEditorProperty * eprop)
{
- gchar *text = g_value_dup_string (eprop->property->value);
+ gchar *text = glade_property_make_string (eprop->property);
gchar *context = g_strdup (glade_property_i18n_get_context (eprop->property));
gchar *comment = g_strdup (glade_property_i18n_get_comment (eprop->property));
gboolean translatable =
@@ -1897,7 +1902,8 @@ static void
glade_eprop_text_show_resource_dialog (GtkWidget * entry,
GladeEditorProperty * eprop)
{
- GladeProject *project = glade_widget_get_project (eprop->property->widget);
+ GladeWidget *widget = glade_property_get_widget (eprop->property);
+ GladeProject *project = glade_widget_get_project (widget);
gchar *text = NULL;
if (glade_editor_property_show_resource_dialog (project, entry, &text))
@@ -2125,7 +2131,7 @@ glade_eprop_bool_load (GladeEditorProperty * eprop, GladeProperty * property)
if (property)
{
- state = g_value_get_boolean (property->value);
+ state = g_value_get_boolean (glade_property_inline_value (property));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (eprop_bool->toggle),
state);
@@ -2207,7 +2213,7 @@ glade_eprop_unichar_load (GladeEditorProperty * eprop, GladeProperty * property)
gchar utf8st[8];
gint n;
- if ((n = g_unichar_to_utf8 (g_value_get_uint (property->value), utf8st)))
+ if ((n = g_unichar_to_utf8 (g_value_get_uint (glade_property_inline_value (property)), utf8st)))
{
utf8st[n] = '\0';
gtk_entry_set_text (entry, utf8st);
@@ -2739,17 +2745,19 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
GtkWidget *content_area;
GtkWidget *action_area;
GladeProject *project;
+ GladeWidget *widget;
gchar *title = glade_eprop_object_dialog_title (eprop);
gint res;
GladeWidgetAdaptor *create_adaptor = NULL;
GList *selected_list = NULL, *exception_list = NULL;
- project = glade_widget_get_project (eprop->property->widget);
+ widget = glade_property_get_widget (eprop->property);
+ project = glade_widget_get_project (widget);
parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
- if (eprop->property->klass->create_type)
+ if (eprop->klass->create_type)
create_adaptor =
- glade_widget_adaptor_get_by_name (eprop->property->klass->create_type);
+ glade_widget_adaptor_get_by_name (eprop->klass->create_type);
if (!create_adaptor &&
G_TYPE_IS_INSTANTIATABLE (eprop->klass->pspec->value_type) &&
!G_TYPE_IS_ABSTRACT (eprop->klass->pspec->value_type))
@@ -2826,12 +2834,12 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
- exception_list = g_list_prepend (exception_list, eprop->property->widget);
- if (g_value_get_object (eprop->property->value))
+ exception_list = g_list_prepend (exception_list, widget);
+ if (g_value_get_object (glade_property_inline_value (eprop->property)))
selected_list = g_list_prepend (selected_list,
glade_widget_get_from_gobject
(g_value_get_object
- (eprop->property->value)));
+ (glade_property_inline_value (eprop->property))));
tree_view = glade_eprop_object_view (TRUE);
glade_eprop_object_populate_view (project, GTK_TREE_VIEW (tree_view),
@@ -2866,12 +2874,11 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
GValue *value;
glade_project_selection_set (project,
- glade_widget_get_object (eprop->property->widget),
+ glade_widget_get_object (widget),
TRUE);
value = glade_property_class_make_gvalue_from_string
- (eprop->klass, glade_widget_get_name (selected),
- project, eprop->property->widget);
+ (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)
@@ -2895,8 +2902,8 @@ 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->property->klass->name,
- glade_widget_get_name (eprop->property->widget),
+ eprop->klass->name,
+ glade_widget_get_name (widget),
glade_widget_get_name (new_widget));
glade_command_set_property (old_ref, NULL);
glade_editor_property_commit (eprop, value);
@@ -2922,14 +2929,14 @@ 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"),
create_adaptor->name,
- eprop->property->klass->name,
- glade_widget_get_name (eprop->property->widget));
+ eprop->klass->name,
+ glade_widget_get_name (widget));
/* Dont bother if the user canceled the widget */
if ((new_widget =
glade_command_create (create_adaptor, NULL, NULL, project)) != NULL)
{
- glade_project_selection_set (project, glade_widget_get_object (eprop->property->widget), TRUE);
+ glade_project_selection_set (project, glade_widget_get_object (widget), TRUE);
value = glade_property_class_make_gvalue_from_string
(eprop->klass, glade_widget_get_name (new_widget), project, NULL);
@@ -2945,7 +2952,7 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
else if (res == GLADE_RESPONSE_CLEAR)
{
GValue *value = glade_property_class_make_gvalue_from_string
- (eprop->klass, NULL, project, eprop->property->widget);
+ (eprop->klass, NULL, project, glade_property_get_widget (eprop->property));
glade_editor_property_commit (eprop, value);
@@ -2971,7 +2978,7 @@ glade_eprop_object_load (GladeEditorProperty * eprop, GladeProperty * property)
if ((obj_name = glade_widget_adaptor_string_from_value
(GLADE_WIDGET_ADAPTOR (eprop->klass->handle),
- eprop->klass, property->value)) != NULL)
+ eprop->klass, glade_property_inline_value (property))) != NULL)
{
gtk_entry_set_text (GTK_ENTRY (eprop_object->entry), obj_name);
g_free (obj_name);
@@ -3041,7 +3048,7 @@ glade_eprop_objects_load (GladeEditorProperty * eprop, GladeProperty * property)
if ((obj_name = glade_widget_adaptor_string_from_value
(GLADE_WIDGET_ADAPTOR (eprop->klass->handle),
- eprop->klass, property->value)) != NULL)
+ eprop->klass, glade_property_inline_value (property))) != NULL)
{
gtk_entry_set_text (GTK_ENTRY (eprop_objects->entry), obj_name);
g_free (obj_name);
@@ -3080,14 +3087,15 @@ glade_eprop_objects_show_dialog (GtkWidget * dialog_button,
GtkWidget *dialog, *parent;
GtkWidget *vbox, *label, *sw;
GtkWidget *tree_view;
+ GladeWidget *widget;
GladeProject *project;
gchar *title = glade_eprop_object_dialog_title (eprop);
gint res;
GList *selected_list = NULL, *exception_list = NULL, *selected_objects = NULL;
- project = glade_widget_get_project (eprop->property->widget);
- parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
-
+ widget = glade_property_get_widget (eprop->property);
+ project = glade_widget_get_project (widget);
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
dialog = gtk_dialog_new_with_buttons (title,
GTK_WINDOW (parent),
@@ -3126,16 +3134,16 @@ glade_eprop_objects_show_dialog (GtkWidget * dialog_button,
tree_view = glade_eprop_object_view (FALSE);
- exception_list = g_list_prepend (exception_list, eprop->property->widget);
+ exception_list = g_list_prepend (exception_list, widget);
- if (g_value_get_object (eprop->property->value))
+ /* XXX This looks broken, do "object list" properties hold an object ? I doubt it... */
+ if (g_value_get_object (glade_property_inline_value (eprop->property)))
{
GList *l;
glade_property_get (eprop->property, &selected_objects);
for (l = selected_objects; l; l = l->next)
selected_list = g_list_prepend (selected_list,
- glade_widget_get_from_gobject (l->
- data));
+ glade_widget_get_from_gobject (l->data));
}
glade_eprop_object_populate_view (project, GTK_TREE_VIEW (tree_view),
selected_list, exception_list,
@@ -3276,7 +3284,7 @@ glade_editor_property_load_by_widget (GladeEditorProperty * eprop,
if (property)
{
- g_assert (eprop->klass == property->klass);
+ g_assert (eprop->klass == glade_property_get_class (property));
gtk_widget_show (GTK_WIDGET (eprop));
gtk_widget_show (GTK_WIDGET (eprop->item_label));
diff --git a/gladeui/glade-editor.c b/gladeui/glade-editor.c
index 60a2b02..63e15b5 100644
--- a/gladeui/glade-editor.c
+++ b/gladeui/glade-editor.c
@@ -980,6 +980,7 @@ glade_editor_populate_reset_view (GladeEditor * editor, GtkTreeView * tree_view)
GtkTreeIter property_iter, general_iter, common_iter, atk_iter, *iter;
GList *list;
GladeProperty *property;
+ GladePropertyClass *pclass;
gboolean def;
g_return_if_fail (editor->loaded_widget != NULL);
@@ -1012,13 +1013,14 @@ glade_editor_populate_reset_view (GladeEditor * editor, GtkTreeView * tree_view)
for (list = glade_widget_get_properties (editor->loaded_widget); list; list = list->next)
{
property = list->data;
+ pclass = glade_property_get_class (property);
- if (glade_property_class_is_visible (property->klass) == FALSE)
+ if (glade_property_class_is_visible (pclass) == FALSE)
continue;
- if (property->klass->atk)
+ if (pclass->atk)
iter = &atk_iter;
- else if (property->klass->common)
+ else if (pclass->common)
iter = &common_iter;
else
iter = &general_iter;
@@ -1028,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, property->klass->name,
+ COLUMN_PROP_NAME, pclass->name,
COLUMN_PROPERTY, property,
COLUMN_WEIGHT, PANGO_WEIGHT_NORMAL,
COLUMN_CHILD, TRUE,
@@ -1046,6 +1048,7 @@ glade_editor_reset_selection_changed_cb (GtkTreeSelection * selection,
GladeProperty *property = NULL;
GtkTreeModel *model = NULL;
GtkTextBuffer *text_buffer;
+ GladePropertyClass *pclass = NULL;
const gchar *message =
_("Select the properties that you want to reset to their default values");
@@ -1055,8 +1058,12 @@ glade_editor_reset_selection_changed_cb (GtkTreeSelection * selection,
{
text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (desc_view));
gtk_tree_model_get (model, &iter, COLUMN_PROPERTY, &property, -1);
+
+ if (property)
+ pclass = glade_property_get_class (property);
+
gtk_text_buffer_set_text (text_buffer,
- property ? property->klass->tooltip : message,
+ pclass ? pclass->tooltip : message,
-1);
if (property)
g_object_unref (G_OBJECT (property));
@@ -1140,13 +1147,14 @@ glade_editor_reset_properties (GList * props)
GList *list, *sdata_list = NULL;
GCSetPropData *sdata;
GladeProperty *prop;
+ GladeWidget *widget;
GladeProject *project = NULL;
for (list = props; list; list = list->next)
{
- prop = list->data;
-
- project = glade_widget_get_project (prop->widget);
+ prop = list->data;
+ widget = glade_property_get_widget (prop);
+ project = glade_widget_get_project (widget);
sdata = g_new (GCSetPropData, 1);
sdata->property = prop;
diff --git a/gladeui/glade-popup.c b/gladeui/glade-popup.c
index 930854b..8cdf716 100644
--- a/gladeui/glade-popup.c
+++ b/gladeui/glade-popup.c
@@ -722,19 +722,19 @@ static void
glade_popup_property_docs_cb (GtkMenuItem * item, GladeProperty * property)
{
GladeWidgetAdaptor *adaptor, *prop_adaptor;
+ GladePropertyClass *pclass;
gchar *search, *book;
- prop_adaptor = glade_widget_adaptor_from_pclass (property->klass);
- adaptor =
- glade_widget_adaptor_from_pspec (prop_adaptor, property->klass->pspec);
- search = g_strdup_printf ("The %s property", property->klass->id);
+ 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);
g_object_get (adaptor, "book", &book, NULL);
glade_editor_search_doc_search (glade_app_get_editor (),
- book,
- g_type_name (property->klass->pspec->
- owner_type), search);
+ book,
+ g_type_name (pclass->pspec->owner_type), search);
g_free (book);
g_free (search);
@@ -745,14 +745,15 @@ glade_popup_property_pop (GladeProperty * property, GdkEventButton * event)
{
GladeWidgetAdaptor *adaptor, *prop_adaptor;
+ GladePropertyClass *pclass;
GtkWidget *popup_menu;
gchar *book = NULL;
gint button;
gint event_time;
- prop_adaptor = glade_widget_adaptor_from_pclass (property->klass);
- adaptor =
- glade_widget_adaptor_from_pspec (prop_adaptor, property->klass->pspec);
+ pclass = glade_property_get_class (property);
+ prop_adaptor = glade_widget_adaptor_from_pclass (pclass);
+ adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pclass->pspec);
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index 9fb66f9..311eace 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -980,9 +980,12 @@ glade_project_fix_object_props (GladeProject * project)
for (ll = glade_widget_get_properties (gwidget); ll; ll = ll->next)
{
+ GladePropertyClass *klass;
+
property = GLADE_PROPERTY (ll->data);
+ klass = glade_property_get_class (property);
- if (glade_property_class_is_object (property->klass) &&
+ if (glade_property_class_is_object (klass) &&
(txt = g_object_get_data (G_OBJECT (property),
"glade-loaded-object")) != NULL)
{
@@ -990,7 +993,7 @@ glade_project_fix_object_props (GladeProject * project)
* (this magicly works for both objects & object lists)
*/
value = glade_property_class_make_gvalue_from_string
- (property->klass, txt, glade_widget_get_project (gwidget), gwidget);
+ (klass, txt, glade_widget_get_project (gwidget), gwidget);
glade_property_set_value (property, value);
@@ -1190,23 +1193,24 @@ update_project_for_resource_path (GladeProject * project)
for (list = glade_widget_get_properties (widget); list; list = list->next)
{
+ GladePropertyClass *klass;
+
property = list->data;
+ klass = glade_property_get_class (property);
/* 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 (property->klass->pspec->value_type == GDK_TYPE_PIXBUF)
+ if (klass->pspec->value_type == GDK_TYPE_PIXBUF)
{
GValue *value;
- gchar *string;
+ gchar *string;
- string = glade_property_class_make_string_from_gvalue
- (property->klass, property->value);
-
- value = glade_property_class_make_gvalue_from_string
- (property->klass, string, project, widget);
+ string = glade_property_make_string (property);
+ value = glade_property_class_make_gvalue_from_string
+ (klass, string, project, widget);
glade_property_set_value (property, value);
@@ -1332,6 +1336,7 @@ glade_project_introspect_gtk_version (GladeProject * project)
for (l = glade_widget_get_properties (widget); l; l = l->next)
{
GladeProperty *property = l->data;
+ GladePropertyClass *pclass = glade_property_get_class (property);
GladeWidgetAdaptor *prop_adaptor, *adaptor;
/* Unset properties ofcourse dont count... */
@@ -1339,10 +1344,9 @@ glade_project_introspect_gtk_version (GladeProject * project)
continue;
/* Check if this property originates from a GTK+ widget class */
- prop_adaptor = glade_widget_adaptor_from_pclass (property->klass);
+ prop_adaptor = glade_widget_adaptor_from_pclass (pclass);
adaptor =
- glade_widget_adaptor_from_pspec (prop_adaptor,
- property->klass->pspec);
+ glade_widget_adaptor_from_pspec (prop_adaptor, pclass->pspec);
catalog = NULL;
is_gtk_adaptor = FALSE;
@@ -1353,10 +1357,10 @@ glade_project_introspect_gtk_version (GladeProject * project)
/* Check GTK+ property class versions */
if (is_gtk_adaptor &&
- !GPC_VERSION_CHECK (property->klass, target_major, target_minor))
+ !GPC_VERSION_CHECK (pclass, target_major, target_minor))
{
- target_major = property->klass->version_since_major;
- target_minor = property->klass->version_since_minor;
+ target_major = pclass->version_since_major;
+ target_minor = pclass->version_since_minor;
}
}
@@ -2045,28 +2049,31 @@ glade_project_verify_property (GladeProject * project,
GString * string, gboolean forwidget)
{
GladeWidgetAdaptor *adaptor, *prop_adaptor;
+ GladeWidget *widget;
+ GladePropertyClass *pclass;
gint target_major, target_minor;
gchar *catalog, *tooltip;
if (glade_property_original_default (property) && !forwidget)
return;
- prop_adaptor = glade_widget_adaptor_from_pclass (property->klass);
- adaptor =
- glade_widget_adaptor_from_pspec (prop_adaptor, property->klass->pspec);
+ pclass = glade_property_get_class (property);
+ prop_adaptor = glade_widget_adaptor_from_pclass (pclass);
+ adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pclass->pspec);
+ widget = glade_property_get_widget (property);
g_object_get (adaptor, "catalog", &catalog, NULL);
- glade_project_target_version_for_adaptor (glade_widget_get_project (property->widget), adaptor,
+ glade_project_target_version_for_adaptor (glade_widget_get_project (widget), adaptor,
&target_major, &target_minor);
- if (!GPC_VERSION_CHECK (property->klass, target_major, target_minor))
+ if (!GPC_VERSION_CHECK (pclass, target_major, target_minor))
{
if (forwidget)
{
tooltip = g_strdup_printf (PROP_VERSION_CONFLICT_MSGFMT,
catalog,
- property->klass->version_since_major,
- property->klass->version_since_minor,
+ pclass->version_since_major,
+ pclass->version_since_minor,
catalog, target_major, target_minor);
glade_property_set_support_warning (property, FALSE, tooltip);
@@ -2074,14 +2081,14 @@ glade_project_verify_property (GladeProject * project,
}
else
g_string_append_printf (string,
- property->klass->packing ?
+ pclass->packing ?
PACK_PROP_VERSION_CONFLICT_FMT :
PROP_VERSION_CONFLICT_FMT,
path_name,
- property->klass->name,
+ pclass->name,
adaptor->title, catalog,
- property->klass->version_since_major,
- property->klass->version_since_minor);
+ pclass->version_since_major,
+ pclass->version_since_minor);
}
else if (forwidget)
glade_property_set_support_warning (property, FALSE, NULL);
diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c
index ceca641..f2fa3b5 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -55,6 +55,64 @@
#include "glade-editor.h"
#include "glade-marshallers.h"
+struct _GladePropertyPrivate {
+
+ GladePropertyClass *klass; /* A pointer to the GladeProperty that this
+ * setting specifies
+ */
+ GladeWidget *widget; /* A pointer to the GladeWidget that this
+ * GladeProperty is modifying
+ */
+
+ GladePropertyState state; /* Current property state, used by editing widgets.
+ */
+
+ GValue *value; /* The value of the property
+ */
+
+ gchar *insensitive_tooltip; /* Tooltip to display when in insensitive state
+ * (used to explain why the property is
+ * insensitive)
+ */
+
+ gchar *support_warning; /* Tooltip to display when the property
+ * has format problems
+ * (used to explain why the property is
+ * insensitive)
+ */
+ guint support_disabled : 1; /* Whether this property is disabled due
+ * to format conflicts
+ */
+
+ guint sensitive : 1; /* Whether this property is sensitive (if the
+ * property is "optional" this takes precedence).
+ */
+
+ guint enabled : 1; /* Enabled is a flag that is used for GladeProperties
+ * that have the optional flag set to let us know
+ * if this widget has this setting enabled or
+ * not. (Like default size, it can be specified or
+ * unspecified). This flag also sets the state
+ * of the property->input state for the loaded
+ * widget.
+ */
+
+ 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).
+ */
+
+ /* Used only for translatable strings. */
+ guint i18n_translatable : 1;
+ gchar *i18n_context;
+ gchar *i18n_comment;
+
+ gint syncing; /* Avoid recursion while synchronizing object with value */
+ gint sync_tolerance;
+};
+
enum
{
VALUE_CHANGED,
@@ -87,32 +145,32 @@ glade_property_dup_impl (GladeProperty * template_prop, GladeWidget * widget)
GladeProperty *property;
property = g_object_new (GLADE_TYPE_PROPERTY,
- "class", template_prop->klass,
- "i18n-translatable",
- template_prop->i18n_translatable, "i18n-context",
- template_prop->i18n_context, "i18n-comment",
- template_prop->i18n_comment, NULL);
- property->widget = widget;
- property->value = g_new0 (GValue, 1);
+ "class", template_prop->priv->klass,
+ "i18n-translatable", template_prop->priv->i18n_translatable,
+ "i18n-context", template_prop->priv->i18n_context,
+ "i18n-comment", template_prop->priv->i18n_comment,
+ NULL);
+ property->priv->widget = widget;
+ property->priv->value = g_new0 (GValue, 1);
- g_value_init (property->value, template_prop->value->g_type);
+ g_value_init (property->priv->value, template_prop->priv->value->g_type);
/* Cannot duplicate parentless_widget property */
- if (template_prop->klass->parentless_widget)
+ if (template_prop->priv->klass->parentless_widget)
{
- if (!G_IS_PARAM_SPEC_OBJECT (template_prop->klass->pspec))
+ if (!G_IS_PARAM_SPEC_OBJECT (template_prop->priv->klass->pspec))
g_warning ("Parentless widget property should be of object type");
- g_value_set_object (property->value, NULL);
+ g_value_set_object (property->priv->value, NULL);
}
else
- g_value_copy (template_prop->value, property->value);
+ g_value_copy (template_prop->priv->value, property->priv->value);
- property->enabled = template_prop->enabled;
- property->state = template_prop->state;
+ property->priv->enabled = template_prop->priv->enabled;
+ property->priv->state = template_prop->priv->state;
- glade_property_set_sensitive (property, template_prop->sensitive,
- template_prop->insensitive_tooltip);
+ glade_property_set_sensitive (property, template_prop->priv->sensitive,
+ template_prop->priv->insensitive_tooltip);
return property;
}
@@ -121,7 +179,7 @@ static gboolean
glade_property_equals_value_impl (GladeProperty * property,
const GValue * value)
{
- return !glade_property_class_compare (property->klass, property->value,
+ return !glade_property_class_compare (property->priv->klass, property->priv->value,
value);
}
@@ -135,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->klass->pspec))
+ if (GLADE_IS_PARAM_SPEC_OBJECTS (property->priv->klass->pspec))
{
/* Make our own copies incase we're walking an
* unstable list
@@ -192,18 +250,18 @@ glade_property_verify (GladeProperty * property, const GValue * value)
gboolean ret = FALSE;
GladeWidget *parent;
- parent = glade_widget_get_parent (property->widget);
+ parent = glade_widget_get_parent (property->priv->widget);
- if (property->klass->packing && parent)
+ if (property->priv->klass->packing && parent)
ret =
glade_widget_adaptor_child_verify_property (glade_widget_get_adaptor (parent),
glade_widget_get_object (parent),
- glade_widget_get_object (property->widget),
- property->klass->id, value);
- else if (!property->klass->packing)
- ret = glade_widget_adaptor_verify_property (glade_widget_get_adaptor (property->widget),
- glade_widget_get_object (property->widget),
- property->klass->id, value);
+ glade_widget_get_object (property->priv->widget),
+ property->priv->klass->id, value);
+ else if (!property->priv->klass->packing)
+ 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);
return ret;
}
@@ -211,16 +269,16 @@ glade_property_verify (GladeProperty * property, const GValue * value)
static void
glade_property_fix_state (GladeProperty * property)
{
- property->state = GLADE_STATE_NORMAL;
+ property->priv->state = GLADE_STATE_NORMAL;
if (!glade_property_original_default (property))
- property->state = GLADE_STATE_CHANGED;
+ property->priv->state = GLADE_STATE_CHANGED;
- if (property->support_warning)
- property->state |= GLADE_STATE_UNSUPPORTED;
+ if (property->priv->support_warning)
+ property->priv->state |= GLADE_STATE_UNSUPPORTED;
- if (property->support_disabled)
- property->state |= GLADE_STATE_SUPPORT_DISABLED;
+ if (property->priv->support_disabled)
+ property->priv->state |= GLADE_STATE_SUPPORT_DISABLED;
g_object_notify (G_OBJECT (property), "state");
}
@@ -229,8 +287,8 @@ glade_property_fix_state (GladeProperty * property)
static gboolean
glade_property_set_value_impl (GladeProperty * property, const GValue * value)
{
- GladeProject *project = property->widget ?
- glade_widget_get_project (property->widget) : NULL;
+ GladeProject *project = property->priv->widget ?
+ glade_widget_get_project (property->priv->widget) : NULL;
gboolean changed = FALSE;
GValue old_value = { 0, };
@@ -238,16 +296,16 @@ glade_property_set_value_impl (GladeProperty * property, const GValue * value)
{
g_print ("***************************************************\n");
g_print ("Setting %s property %s on %s ..\n",
- property->klass->packing ? "packing" : "normal",
- property->klass->id,
- property->widget ? property->widget->name : "unknown");
+ property->priv->klass->packing ? "packing" : "normal",
+ property->priv->klass->id,
+ property->priv->widget ? property->priv->widget->name : "unknown");
gchar *str1 = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (property->klass->handle),
- property->klass, property->value);
+ (GLADE_WIDGET_ADAPTOR (property->priv->klass->handle),
+ property->priv->klass, property->priv->value);
gchar *str2 = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (property->klass->handle),
- property->klass, value);
+ (GLADE_WIDGET_ADAPTOR (property->priv->klass->handle),
+ property->priv->klass, value);
g_print ("from %s to %s\n", str1, str2);
g_free (str1);
g_free (str2);
@@ -255,17 +313,17 @@ glade_property_set_value_impl (GladeProperty * property, const GValue * value)
#endif
if (!g_value_type_compatible
- (G_VALUE_TYPE (property->value), G_VALUE_TYPE (value)))
+ (G_VALUE_TYPE (property->priv->value), G_VALUE_TYPE (value)))
{
g_warning ("Trying to assign an incompatible value to property %s\n",
- property->klass->id);
+ property->priv->klass->id);
return FALSE;
}
/* Check if the backend doesnt give us permission to
* set this value.
*/
- if (glade_property_superuser () == FALSE && property->widget &&
+ if (glade_property_superuser () == FALSE && property->priv->widget &&
project && glade_project_is_loading (project) == FALSE &&
glade_property_verify (property, value) == FALSE)
{
@@ -280,33 +338,33 @@ glade_property_set_value_impl (GladeProperty * property, const GValue * value)
/* Add/Remove references from widget ref stacks here
* (before assigning the value)
*/
- if (property->widget && changed &&
- glade_property_class_is_object (property->klass))
- glade_property_update_prop_refs (property, property->value, value);
+ if (property->priv->widget && changed &&
+ glade_property_class_is_object (property->priv->klass))
+ glade_property_update_prop_refs (property, property->priv->value, value);
/* Make a copy of the old value */
- g_value_init (&old_value, G_VALUE_TYPE (property->value));
- g_value_copy (property->value, &old_value);
+ g_value_init (&old_value, G_VALUE_TYPE (property->priv->value));
+ g_value_copy (property->priv->value, &old_value);
/* Assign property first so that; if the object need be
* rebuilt, it will reflect the new value
*/
- g_value_reset (property->value);
- g_value_copy (value, property->value);
+ g_value_reset (property->priv->value);
+ g_value_copy (value, property->priv->value);
GLADE_PROPERTY_GET_KLASS (property)->sync (property);
glade_property_fix_state (property);
- if (changed && property->widget)
+ if (changed && property->priv->widget)
{
g_signal_emit (G_OBJECT (property),
glade_property_signals[VALUE_CHANGED],
- 0, &old_value, property->value);
+ 0, &old_value, property->priv->value);
- glade_project_verify_properties (property->widget);
+ glade_project_verify_properties (property->priv->widget);
}
g_value_unset (&old_value);
@@ -316,9 +374,8 @@ 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->klass->pspec->value_type);
- g_value_copy (property->value, value);
+ g_value_init (value, property->priv->klass->pspec->value_type);
+ g_value_copy (property->priv->value, value);
}
static void
@@ -329,54 +386,54 @@ glade_property_sync_impl (GladeProperty * property)
*/
if (/* the class can be NULL during object,
* construction this is just a temporary state */
- property->klass == NULL ||
+ property->priv->klass == NULL ||
/* optional properties that are disabled */
- property->enabled == FALSE ||
+ property->priv->enabled == FALSE ||
/* explicit "never sync" flag */
- property->klass->ignore ||
+ property->priv->klass->ignore ||
/* recursion guards */
- property->syncing >= property->sync_tolerance ||
+ property->priv->syncing >= property->priv->sync_tolerance ||
/* No widget owns this property yet */
- property->widget == NULL)
+ property->priv->widget == NULL)
return;
/* Only the properties from widget->properties should affect the runtime widget.
* (other properties may be used for convenience in the plugin).
*/
- if ((property->klass->packing &&
- !glade_widget_get_pack_property (property->widget, property->klass->id))
- || !glade_widget_get_property (property->widget, property->klass->id))
+ 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))
return;
- property->syncing++;
+ property->priv->syncing++;
/* In the case of construct_only, the widget instance must be rebuilt
* to apply the property
*/
- if (property->klass->construct_only && property->syncing == 1)
+ if (property->priv->klass->construct_only && 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->klass->virt)
- property->sync_tolerance++;
+ if (property->priv->klass->virt)
+ property->priv->sync_tolerance++;
- glade_widget_rebuild (property->widget);
+ glade_widget_rebuild (property->priv->widget);
- if (property->klass->virt)
- property->sync_tolerance--;
+ if (property->priv->klass->virt)
+ property->priv->sync_tolerance--;
}
- else if (property->klass->packing)
- glade_widget_child_set_property (glade_widget_get_parent (property->widget),
- property->widget,
- property->klass->id, property->value);
+ else if (property->priv->klass->packing)
+ glade_widget_child_set_property (glade_widget_get_parent (property->priv->widget),
+ property->priv->widget,
+ property->priv->klass->id, property->priv->value);
else
- glade_widget_object_set_property (property->widget,
- property->klass->id, property->value);
+ glade_widget_object_set_property (property->priv->widget,
+ property->priv->klass->id, property->priv->value);
- property->syncing--;
+ property->priv->syncing--;
}
static void
@@ -385,20 +442,20 @@ glade_property_load_impl (GladeProperty * property)
GObject *object;
GObjectClass *oclass;
- if (property->widget == NULL ||
- property->klass->virt ||
- property->klass->packing ||
- property->klass->ignore ||
- !(property->klass->pspec->flags & G_PARAM_READABLE) ||
- G_IS_PARAM_SPEC_OBJECT (property->klass->pspec))
+ 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))
return;
- object = glade_widget_get_object (property->widget);
+ object = glade_widget_get_object (property->priv->widget);
oclass = G_OBJECT_GET_CLASS (object);
- if (g_object_class_find_property (oclass, property->klass->id))
- glade_widget_object_get_property (property->widget, property->klass->id,
- property->value);
+ if (g_object_class_find_property (oclass, property->priv->klass->id))
+ glade_widget_object_get_property (property->priv->widget, property->priv->klass->id,
+ property->priv->value);
}
/*******************************************************************************
@@ -414,13 +471,13 @@ glade_property_set_real_property (GObject * object,
switch (prop_id)
{
case PROP_CLASS:
- property->klass = g_value_get_pointer (value);
+ property->priv->klass = g_value_get_pointer (value);
break;
case PROP_ENABLED:
glade_property_set_enabled (property, g_value_get_boolean (value));
break;
case PROP_SENSITIVE:
- property->sensitive = g_value_get_boolean (value);
+ property->priv->sensitive = g_value_get_boolean (value);
break;
case PROP_I18N_TRANSLATABLE:
glade_property_i18n_set_translatable (property,
@@ -448,7 +505,7 @@ glade_property_get_real_property (GObject * object,
switch (prop_id)
{
case PROP_CLASS:
- g_value_set_pointer (value, property->klass);
+ g_value_set_pointer (value, property->priv->klass);
break;
case PROP_ENABLED:
g_value_set_boolean (value, glade_property_get_enabled (property));
@@ -467,7 +524,7 @@ glade_property_get_real_property (GObject * object,
g_value_set_string (value, glade_property_i18n_get_comment (property));
break;
case PROP_STATE:
- g_value_set_int (value, property->state);
+ g_value_set_int (value, property->priv->state);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -480,19 +537,19 @@ glade_property_finalize (GObject * object)
{
GladeProperty *property = GLADE_PROPERTY (object);
- if (property->value)
+ if (property->priv->value)
{
- g_value_unset (property->value);
- g_free (property->value);
+ g_value_unset (property->priv->value);
+ g_free (property->priv->value);
}
- if (property->i18n_comment)
- g_free (property->i18n_comment);
- if (property->i18n_context)
- g_free (property->i18n_context);
- if (property->support_warning)
- g_free (property->support_warning);
- if (property->insensitive_tooltip)
- g_free (property->insensitive_tooltip);
+ if (property->priv->i18n_comment)
+ g_free (property->priv->i18n_comment);
+ if (property->priv->i18n_context)
+ g_free (property->priv->i18n_context);
+ if (property->priv->support_warning)
+ g_free (property->priv->support_warning);
+ if (property->priv->insensitive_tooltip)
+ g_free (property->priv->insensitive_tooltip);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -500,11 +557,15 @@ glade_property_finalize (GObject * object)
static void
glade_property_init (GladeProperty * property)
{
- property->enabled = TRUE;
- property->sensitive = TRUE;
- property->i18n_translatable = TRUE;
- property->i18n_comment = NULL;
- property->sync_tolerance = 1;
+ property->priv = G_TYPE_INSTANCE_GET_PRIVATE (property,
+ GLADE_TYPE_PROPERTY,
+ GladePropertyPrivate);
+
+ property->priv->enabled = TRUE;
+ property->priv->sensitive = TRUE;
+ property->priv->i18n_translatable = TRUE;
+ property->priv->i18n_comment = NULL;
+ property->priv->sync_tolerance = 1;
}
static void
@@ -600,7 +661,7 @@ glade_property_klass_init (GladePropertyKlass * prop_class)
G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING);
-
+ g_type_class_add_private (prop_class, sizeof (GladePropertyPrivate));
}
GType
@@ -653,20 +714,20 @@ glade_property_new (GladePropertyClass * klass,
g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), NULL);
property = (GladeProperty *) g_object_new (GLADE_TYPE_PROPERTY, NULL);
- property->klass = klass;
- property->widget = widget;
- property->value = value;
+ property->priv->klass = klass;
+ property->priv->widget = widget;
+ property->priv->value = value;
if (klass->optional)
- property->enabled = klass->optional_default;
+ property->priv->enabled = klass->optional_default;
- if (property->value == NULL)
+ if (property->priv->value == NULL)
{
g_assert (klass->orig_def);
- property->value = g_new0 (GValue, 1);
- g_value_init (property->value, klass->orig_def->g_type);
- g_value_copy (klass->orig_def, property->value);
+ 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);
}
return property;
}
@@ -691,7 +752,7 @@ glade_property_reset_common (GladeProperty * property, gboolean original)
g_return_if_fail (GLADE_IS_PROPERTY (property));
GLADE_PROPERTY_GET_KLASS (property)->set_value
- (property, (original) ? property->klass->orig_def : property->klass->def);
+ (property, (original) ? property->priv->klass->orig_def : property->priv->klass->def);
}
/**
@@ -723,7 +784,7 @@ glade_property_default_common (GladeProperty * property, gboolean orig)
{
g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE);
return GLADE_PROPERTY_GET_KLASS (property)->equals_value
- (property, (orig) ? property->klass->orig_def : property->klass->def);
+ (property, (orig) ? property->priv->klass->orig_def : property->priv->klass->def);
}
/**
@@ -779,7 +840,7 @@ glade_property_equals_va_list (GladeProperty * property, va_list vl)
g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE);
- value = glade_property_class_make_gvalue_from_vl (property->klass, vl);
+ value = glade_property_class_make_gvalue_from_vl (property->priv->klass, vl);
ret = GLADE_PROPERTY_GET_KLASS (property)->equals_value (property, value);
@@ -842,7 +903,7 @@ glade_property_set_va_list (GladeProperty * property, va_list vl)
g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE);
- value = glade_property_class_make_gvalue_from_vl (property->klass, vl);
+ value = glade_property_class_make_gvalue_from_vl (property->priv->klass, vl);
success = GLADE_PROPERTY_GET_KLASS (property)->set_value (property, value);
@@ -902,8 +963,8 @@ glade_property_get_default (GladeProperty * property, GValue * value)
g_return_if_fail (GLADE_IS_PROPERTY (property));
g_return_if_fail (value != NULL);
- g_value_init (value, property->klass->pspec->value_type);
- g_value_copy (property->klass->def, value);
+ g_value_init (value, property->priv->klass->pspec->value_type);
+ g_value_copy (property->priv->klass->def, value);
}
/**
@@ -917,7 +978,7 @@ void
glade_property_get_va_list (GladeProperty * property, va_list vl)
{
g_return_if_fail (GLADE_IS_PROPERTY (property));
- glade_property_class_set_vl_from_gvalue (property->klass, property->value,
+ glade_property_class_set_vl_from_gvalue (property->priv->klass, property->priv->value,
vl);
}
@@ -998,7 +1059,7 @@ glade_property_read (GladeProperty * property,
if (!(value = glade_xml_get_content (prop)))
return;
- if (glade_property_class_is_object (property->klass))
+ if (glade_property_class_is_object (property->priv->klass))
{
/* we must synchronize this directly after loading this project
* (i.e. lookup the actual objects after they've been parsed and
@@ -1010,7 +1071,7 @@ glade_property_read (GladeProperty * property,
else
{
gvalue = glade_property_class_make_gvalue_from_string
- (property->klass, value, project, property->widget);
+ (property->priv->klass, value, project, property->priv->widget);
GLADE_PROPERTY_GET_KLASS (property)->set_value (property, gvalue);
@@ -1020,7 +1081,7 @@ glade_property_read (GladeProperty * property,
/* If an optional property is specified in the
* glade file, its enabled
*/
- property->enabled = TRUE;
+ property->priv->enabled = TRUE;
}
translatable =
@@ -1057,31 +1118,31 @@ glade_property_write (GladeProperty * property,
g_return_if_fail (GLADE_IS_PROPERTY (property));
g_return_if_fail (node != NULL);
- project = glade_widget_get_project (property->widget);
+ project = glade_widget_get_project (property->priv->widget);
/* This code should work the same for <packing> and <widget> */
if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_PACKING) ||
glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET)))
return;
- g_assert (property->klass->orig_def);
- g_assert (property->klass->def);
+ 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->klass->save_always || property->save_always) &&
+ if (!(property->priv->klass->save_always || property->priv->save_always) &&
glade_property_original_default (property))
return;
/* Escape our string and save with underscores */
- name = g_strdup (property->klass->id);
+ name = g_strdup (property->priv->klass->id);
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->klass->handle), property->klass,
- property->value)))
+ (GLADE_WIDGET_ADAPTOR (property->priv->klass->handle), property->priv->klass,
+ property->priv->value)))
/* make sure we keep the empty string, also... upcomming
* funcs that may not like NULL.
*/
@@ -1103,22 +1164,22 @@ glade_property_write (GladeProperty * property,
glade_xml_set_content (prop_node, value);
/* i18n stuff */
- if (property->klass->translatable)
+ if (property->priv->klass->translatable)
{
- if (property->i18n_translatable)
+ if (property->priv->i18n_translatable)
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_TRANSLATABLE,
GLADE_XML_TAG_I18N_TRUE);
- if (property->i18n_context)
+ if (property->priv->i18n_context)
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_CONTEXT,
- property->i18n_context);
+ property->priv->i18n_context);
- if (property->i18n_comment)
+ if (property->priv->i18n_comment)
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_COMMENT,
- property->i18n_comment);
+ property->priv->i18n_comment);
}
g_free (name);
g_free (value);
@@ -1141,10 +1202,10 @@ glade_property_add_object (GladeProperty * property, GObject * object)
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->klass->pspec) ||
- G_IS_PARAM_SPEC_OBJECT (property->klass->pspec));
+ 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->klass->pspec))
+ if (GLADE_IS_PARAM_SPEC_OBJECTS (property->priv->klass->pspec))
{
glade_property_get (property, &list);
new_list = g_list_copy (list);
@@ -1180,10 +1241,10 @@ glade_property_remove_object (GladeProperty * property, GObject * object)
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->klass->pspec) ||
- G_IS_PARAM_SPEC_OBJECT (property->klass->pspec));
+ 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->klass->pspec))
+ if (GLADE_IS_PARAM_SPEC_OBJECTS (property->priv->klass->pspec))
{
/* If object isnt in list; list should stay in tact.
* not bothering to check for now.
@@ -1205,15 +1266,24 @@ glade_property_remove_object (GladeProperty * property, GObject * object)
}
}
+GladePropertyClass *
+glade_property_get_class (GladeProperty *property)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY (property), NULL);
+
+ return property->priv->klass;
+}
+
+
/* Parameters for translatable properties. */
void
glade_property_i18n_set_comment (GladeProperty * property, const gchar * str)
{
g_return_if_fail (GLADE_IS_PROPERTY (property));
- if (property->i18n_comment)
- g_free (property->i18n_comment);
+ if (property->priv->i18n_comment)
+ g_free (property->priv->i18n_comment);
- property->i18n_comment = g_strdup (str);
+ property->priv->i18n_comment = g_strdup (str);
g_object_notify (G_OBJECT (property), "i18n-comment");
}
@@ -1221,17 +1291,17 @@ G_CONST_RETURN gchar *
glade_property_i18n_get_comment (GladeProperty * property)
{
g_return_val_if_fail (GLADE_IS_PROPERTY (property), NULL);
- return property->i18n_comment;
+ return property->priv->i18n_comment;
}
void
glade_property_i18n_set_context (GladeProperty * property, const gchar * str)
{
g_return_if_fail (GLADE_IS_PROPERTY (property));
- if (property->i18n_context)
- g_free (property->i18n_context);
+ if (property->priv->i18n_context)
+ g_free (property->priv->i18n_context);
- property->i18n_context = g_strdup (str);
+ property->priv->i18n_context = g_strdup (str);
g_object_notify (G_OBJECT (property), "i18n-context");
}
@@ -1239,7 +1309,7 @@ G_CONST_RETURN gchar *
glade_property_i18n_get_context (GladeProperty * property)
{
g_return_val_if_fail (GLADE_IS_PROPERTY (property), NULL);
- return property->i18n_context;
+ return property->priv->i18n_context;
}
void
@@ -1247,7 +1317,7 @@ glade_property_i18n_set_translatable (GladeProperty * property,
gboolean translatable)
{
g_return_if_fail (GLADE_IS_PROPERTY (property));
- property->i18n_translatable = translatable;
+ property->priv->i18n_translatable = translatable;
g_object_notify (G_OBJECT (property), "i18n-translatable");
}
@@ -1255,7 +1325,7 @@ gboolean
glade_property_i18n_get_translatable (GladeProperty * property)
{
g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE);
- return property->i18n_translatable;
+ return property->priv->i18n_translatable;
}
void
@@ -1267,35 +1337,43 @@ glade_property_set_sensitive (GladeProperty * property,
/* reason is only why we're disableing it */
if (sensitive == FALSE)
{
- if (property->insensitive_tooltip)
- g_free (property->insensitive_tooltip);
- property->insensitive_tooltip = g_strdup (reason);
+ if (property->priv->insensitive_tooltip)
+ g_free (property->priv->insensitive_tooltip);
+ property->priv->insensitive_tooltip = g_strdup (reason);
}
- if (property->sensitive != sensitive)
+ if (property->priv->sensitive != sensitive)
{
- property->sensitive = sensitive;
+ property->priv->sensitive = sensitive;
/* Clear it */
if (sensitive)
- property->insensitive_tooltip =
- (g_free (property->insensitive_tooltip), NULL);
+ property->priv->insensitive_tooltip =
+ (g_free (property->priv->insensitive_tooltip), NULL);
g_signal_emit (G_OBJECT (property),
glade_property_signals[TOOLTIP_CHANGED],
0,
- property->klass->tooltip,
- property->insensitive_tooltip, property->support_warning);
+ property->priv->klass->tooltip,
+ property->priv->insensitive_tooltip, property->priv->support_warning);
}
g_object_notify (G_OBJECT (property), "sensitive");
}
+G_CONST_RETURN gchar *
+glade_propert_get_insensitive_tooltip (GladeProperty *property)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY (property), NULL);
+
+ return property->priv->insensitive_tooltip;
+}
+
gboolean
glade_property_get_sensitive (GladeProperty * property)
{
g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE);
- return property->sensitive;
+ return property->priv->sensitive;
}
void
@@ -1304,21 +1382,29 @@ glade_property_set_support_warning (GladeProperty * property,
{
g_return_if_fail (GLADE_IS_PROPERTY (property));
- if (property->support_warning)
- g_free (property->support_warning);
- property->support_warning = g_strdup (reason);
+ if (property->priv->support_warning)
+ g_free (property->priv->support_warning);
+ property->priv->support_warning = g_strdup (reason);
- property->support_disabled = disable;
+ property->priv->support_disabled = disable;
g_signal_emit (G_OBJECT (property),
glade_property_signals[TOOLTIP_CHANGED],
0,
- property->klass->tooltip,
- property->insensitive_tooltip, property->support_warning);
+ property->priv->klass->tooltip,
+ property->priv->insensitive_tooltip, property->priv->support_warning);
glade_property_fix_state (property);
}
+G_CONST_RETURN gchar *
+glade_property_get_support_warning (GladeProperty *property)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY (property), NULL);
+
+ return property->priv->support_warning;
+}
+
/**
* glade_property_set_save_always:
@@ -1336,7 +1422,7 @@ glade_property_set_save_always (GladeProperty * property, gboolean setting)
{
g_return_if_fail (GLADE_IS_PROPERTY (property));
- property->save_always = setting;
+ property->priv->save_always = setting;
}
/**
@@ -1351,7 +1437,7 @@ glade_property_get_save_always (GladeProperty * property)
{
g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE);
- return property->save_always;
+ return property->priv->save_always;
}
void
@@ -1359,7 +1445,7 @@ glade_property_set_enabled (GladeProperty * property, gboolean enabled)
{
g_return_if_fail (GLADE_IS_PROPERTY (property));
- property->enabled = enabled;
+ property->priv->enabled = enabled;
if (enabled)
glade_property_sync (property);
@@ -1372,7 +1458,49 @@ gboolean
glade_property_get_enabled (GladeProperty * property)
{
g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE);
- return property->enabled;
+ return property->priv->enabled;
+}
+
+gchar *
+glade_property_make_string (GladeProperty *property)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY (property), NULL);
+
+ return glade_property_class_make_string_from_gvalue (property->priv->klass,
+ property->priv->value);
+}
+
+void
+glade_property_set_widget (GladeProperty *property,
+ GladeWidget *widget)
+{
+ g_return_if_fail (GLADE_IS_PROPERTY (property));
+
+ property->priv->widget = widget;
+}
+
+GladeWidget *
+glade_property_get_widget (GladeProperty *property)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY (property), NULL);
+
+ return property->priv->widget;
+}
+
+GValue *
+glade_property_inline_value (GladeProperty *property)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY (property), NULL);
+
+ return property->priv->value;
+}
+
+GladePropertyState
+glade_property_get_state (GladeProperty *property)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY (property), 0);
+
+ return property->priv->state;
}
diff --git a/gladeui/glade-property.h b/gladeui/glade-property.h
index 1c1ef84..b4d7019 100644
--- a/gladeui/glade-property.h
+++ b/gladeui/glade-property.h
@@ -12,13 +12,14 @@ G_BEGIN_DECLS
#define GLADE_IS_PROPERTY_KLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_PROPERTY))
#define GLADE_PROPERTY_GET_KLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_PROPERTY, GladePropertyKlass))
-typedef struct _GladePropertyKlass GladePropertyKlass;
+typedef struct _GladePropertyKlass GladePropertyKlass;
+typedef struct _GladePropertyPrivate GladePropertyPrivate;
typedef enum {
- GLADE_STATE_NORMAL = 0,
- GLADE_STATE_CHANGED = (1 << 0),
- GLADE_STATE_UNSUPPORTED = (1 << 1),
- GLADE_STATE_SUPPORT_DISABLED = (1 << 2)
+ GLADE_STATE_NORMAL = 0,
+ GLADE_STATE_CHANGED = (1 << 0),
+ GLADE_STATE_UNSUPPORTED = (1 << 1),
+ GLADE_STATE_SUPPORT_DISABLED = (1 << 2)
} GladePropertyState;
/* A GladeProperty is an instance of a GladePropertyClass.
@@ -27,81 +28,28 @@ typedef enum {
*/
struct _GladeProperty
{
- GObject parent_instance;
-
- GladePropertyClass *klass; /* A pointer to the GladeProperty that this
- * setting specifies
- */
- GladeWidget *widget; /* A pointer to the GladeWidget that this
- * GladeProperty is modifying
- */
-
- GladePropertyState state; /* Current property state, used by editing widgets.
- */
-
- GValue *value; /* The value of the property
- */
-
- gchar *insensitive_tooltip; /* Tooltip to display when in insensitive state
- * (used to explain why the property is
- * insensitive)
- */
-
- gchar *support_warning; /* Tooltip to display when the property
- * has format problems
- * (used to explain why the property is
- * insensitive)
- */
- guint support_disabled : 1; /* Whether this property is disabled due
- * to format conflicts
- */
-
- guint sensitive : 1; /* Whether this property is sensitive (if the
- * property is "optional" this takes precedence).
- */
-
- guint enabled : 1; /* Enabled is a flag that is used for GladeProperties
- * that have the optional flag set to let us know
- * if this widget has this setting enabled or
- * not. (Like default size, it can be specified or
- * unspecified). This flag also sets the state
- * of the property->input state for the loaded
- * widget.
- */
-
- 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).
- */
-
- /* Used only for translatable strings. */
- guint i18n_translatable : 1;
- gchar *i18n_context;
- gchar *i18n_comment;
-
- gint syncing; /* Avoid recursion while synchronizing object with value */
- gint sync_tolerance;
+ GObject parent_instance;
+
+ GladePropertyPrivate *priv;
};
struct _GladePropertyKlass
{
- GObjectClass parent_class;
-
- /* Class methods */
- GladeProperty * (* dup) (GladeProperty *, GladeWidget *);
- gboolean (* equals_value) (GladeProperty *, const GValue *);
- gboolean (* set_value) (GladeProperty *, const GValue *);
- void (* get_value) (GladeProperty *, GValue *);
- void (* sync) (GladeProperty *);
- void (* load) (GladeProperty *);
-
- /* Signals */
- void (* value_changed) (GladeProperty *, GValue *, GValue *);
- void (* tooltip_changed) (GladeProperty *, const gchar *,
- const gchar *, const gchar *);
+ GObjectClass parent_class;
+
+ /* Class methods */
+ GladeProperty * (* dup) (GladeProperty *, GladeWidget *);
+ gboolean (* equals_value) (GladeProperty *, const GValue *);
+ gboolean (* set_value) (GladeProperty *, const GValue *);
+ void (* get_value) (GladeProperty *, GValue *);
+ void (* sync) (GladeProperty *);
+ void (* load) (GladeProperty *);
+
+ /* Signals */
+ void (* value_changed) (GladeProperty *, GValue *, GValue *);
+ void (* tooltip_changed) (GladeProperty *, const gchar *,
+ const gchar *, const gchar *);
};
@@ -167,13 +115,17 @@ void glade_property_write (GladeProperty
GladeXmlContext *context,
GladeXmlNode *node);
+GladePropertyClass *glade_property_get_class (GladeProperty *property);
+
void glade_property_set_sensitive (GladeProperty *property,
gboolean sensitive,
const gchar *reason);
+G_CONST_RETURN gchar *glade_propert_get_insensitive_tooltip(GladeProperty *property);
void glade_property_set_support_warning (GladeProperty *property,
gboolean disable,
const gchar *reason);
+G_CONST_RETURN gchar *glade_property_get_support_warning (GladeProperty *property);
gboolean glade_property_get_sensitive (GladeProperty *property);
@@ -190,6 +142,16 @@ void glade_property_set_enabled (GladeProperty
gboolean glade_property_get_enabled (GladeProperty *property);
+gchar *glade_property_make_string (GladeProperty *property);
+
+GladeWidget *glade_property_get_widget (GladeProperty *property);
+void glade_property_set_widget (GladeProperty *property,
+ GladeWidget *widget);
+
+GValue *glade_property_inline_value (GladeProperty *property);
+
+GladePropertyState glade_property_get_state (GladeProperty *property);
+
void glade_property_i18n_set_comment (GladeProperty *property,
const gchar *str);
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index 30ed4af..4fdef08 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -968,8 +968,10 @@ glade_widget_adaptor_object_write_widget (GladeWidgetAdaptor * adaptor,
/* Write the properties */
for (props = glade_widget_get_properties (widget); props; props = props->next)
{
- if (GLADE_PROPERTY (props->data)->klass->save &&
- GLADE_PROPERTY (props->data)->enabled)
+ GladeProperty *property = props->data;
+ GladePropertyClass *klass = glade_property_get_class (property);
+
+ if (klass->save && glade_property_get_enabled (property))
glade_property_write (GLADE_PROPERTY (props->data), context, node);
}
}
@@ -1078,8 +1080,10 @@ glade_widget_adaptor_object_write_child (GladeWidgetAdaptor * adaptor,
for (props = glade_widget_get_packing_properties (widget); props; props = props->next)
{
- if (GLADE_PROPERTY (props->data)->klass->save &&
- GLADE_PROPERTY (props->data)->enabled)
+ GladeProperty *property = props->data;
+ GladePropertyClass *klass = glade_property_get_class (property);
+
+ if (klass->save && glade_property_get_enabled (property))
glade_property_write (GLADE_PROPERTY (props->data),
context, packing_node);
}
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 6642d99..55d97f3 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -560,11 +560,12 @@ glade_widget_template_params (GladeWidget * widget,
glade_widget_get_property (widget, pspec[i]->name)) == NULL)
continue;
- pclass = glade_property->klass;
+ pclass = glade_property_get_class (glade_property);
/* Ignore properties based on some criteria
*/
- if (!glade_property_get_enabled (glade_property) || pclass == NULL || /* Unaccounted for in the builder */
+ 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 */
@@ -587,13 +588,17 @@ glade_widget_template_params (GladeWidget * widget,
}
if (g_param_values_cmp (pspec[i],
- glade_property->value, pclass->orig_def) == 0)
+ glade_property_inline_value (glade_property),
+ pclass->orig_def) == 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
+ */
parameter.name = pspec[i]->name; /* These are not copied/freed */
g_value_init (¶meter.value, pspec[i]->value_type);
- g_value_copy (glade_property->value, ¶meter.value);
+ g_value_copy (glade_property_inline_value (glade_property), ¶meter.value);
g_array_append_val (params, parameter);
}
@@ -681,13 +686,13 @@ glade_widget_dup_properties (GladeWidget * dest_widget, GList * template_props,
for (list = template_props; list && list->data; list = list->next)
{
- GladeProperty *prop = list->data;
+ GladeProperty *prop = list->data;
+ GladePropertyClass *pclass = glade_property_get_class (prop);
- if (prop->klass->save == FALSE && as_load)
+ if (pclass->save == FALSE && as_load)
continue;
-
- if (prop->klass->parentless_widget && copy_parentless)
+ if (pclass->parentless_widget && copy_parentless)
{
GObject *object = NULL;
GladeWidget *parentless;
@@ -743,7 +748,7 @@ glade_widget_remove_property (GladeWidget * widget, const gchar * id_property)
if ((prop = glade_widget_get_property (widget, id_property)) != NULL)
{
widget->priv->properties = g_list_remove (widget->priv->properties, prop);
- g_hash_table_remove (widget->priv->props_hash, prop->klass->id);
+ g_hash_table_remove (widget->priv->props_hash, id_property);
g_object_unref (prop);
}
else
@@ -758,7 +763,7 @@ glade_widget_set_catalog_defaults (GList * list)
for (l = list; l && l->data; l = l->next)
{
GladeProperty *prop = l->data;
- GladePropertyClass *klass = prop->klass;
+ GladePropertyClass *klass = glade_property_get_class (prop);
if (glade_property_equals_value (prop, klass->orig_def) &&
g_param_values_cmp (klass->pspec, klass->orig_def, klass->def))
@@ -772,11 +777,11 @@ glade_widget_sync_custom_props (GladeWidget * widget)
GList *l;
for (l = widget->priv->properties; l && l->data; l = l->next)
{
- GladeProperty *prop = GLADE_PROPERTY (l->data);
+ GladeProperty *prop = GLADE_PROPERTY (l->data);
+ GladePropertyClass *pclass = glade_property_get_class (prop);
- if (prop->klass->virt || prop->klass->needs_sync)
+ if (pclass->virt || pclass->needs_sync)
glade_property_sync (prop);
-
}
}
@@ -854,8 +859,10 @@ glade_widget_constructor (GType type,
{
for (list = gwidget->priv->properties; list; list = list->next)
{
- GladeProperty *property = list->data;
- if (property->klass->parentless_widget)
+ GladeProperty *property = list->data;
+ GladePropertyClass *pclass = glade_property_get_class (property);
+
+ if (pclass->parentless_widget)
glade_property_sync (property);
}
}
@@ -930,7 +937,9 @@ glade_widget_finalize (GObject * object)
static void
reset_object_property (GladeProperty * property, GladeProject * project)
{
- if (glade_property_class_is_object (property->klass))
+ GladePropertyClass *pclass = glade_property_get_class (property);
+
+ if (glade_property_class_is_object (pclass))
glade_property_reset (property);
}
@@ -1406,10 +1415,13 @@ glade_widget_copy_packing_props (GladeWidget * parent,
for (l = child->priv->packing_properties; l && l->data; l = l->next)
{
- dup_prop = GLADE_PROPERTY (l->data);
- orig_prop =
- glade_widget_get_pack_property (template_widget, dup_prop->klass->id);
- glade_property_set_value (dup_prop, orig_prop->value);
+ GladePropertyClass *pclass;
+
+ dup_prop = GLADE_PROPERTY (l->data);
+ pclass = glade_property_get_class (dup_prop);
+ orig_prop = glade_widget_get_pack_property (template_widget, pclass->id);
+
+ glade_property_set_value (dup_prop, glade_property_inline_value (orig_prop));
}
}
@@ -1752,10 +1764,11 @@ glade_widget_insert_children (GladeWidget * gwidget, GList * children)
/* Set the properties after inserting the children */
for (l = extract->properties; l; l = l->next)
{
- GValue value = { 0, };
- GladeProperty *saved_prop = l->data;
- GladeProperty *widget_prop =
- glade_widget_get_property (gchild, saved_prop->klass->id);
+ GValue value = { 0, };
+ GladeProperty *saved_prop = l->data;
+ GladePropertyClass *pclass = glade_property_get_class (saved_prop);
+ GladeProperty *widget_prop =
+ glade_widget_get_property (gchild, pclass->id);
glade_property_get_value (saved_prop, &value);
glade_property_set_value (widget_prop, &value);
@@ -1777,11 +1790,11 @@ glade_widget_insert_children (GladeWidget * gwidget, GList * children)
for (l = extract->properties; l; l = l->next)
{
- GValue value = { 0, };
- GladeProperty *saved_prop = l->data;
- GladeProperty *widget_prop =
- glade_widget_get_pack_property (extract->widget,
- saved_prop->klass->id);
+ GValue value = { 0, };
+ 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_property_get_value (saved_prop, &value);
glade_property_set_value (widget_prop, &value);
@@ -1828,11 +1841,14 @@ glade_widget_set_properties (GladeWidget * widget, GList * properties)
for (list = properties; list; list = list->next)
{
+ GladePropertyClass *pclass;
+
property = list->data;
- property->widget = widget;
- g_hash_table_insert (widget->priv->props_hash, property->klass->id,
- property);
+ pclass = glade_property_get_class (property);
+ glade_property_set_widget (property, widget);
+
+ g_hash_table_insert (widget->priv->props_hash, pclass->id, property);
}
}
}
@@ -2019,14 +2035,13 @@ glade_widget_show (GladeWidget * widget)
if ((property = glade_widget_get_parentless_widget_ref (widget)) != NULL)
{
/* will never happen, paranoid check to avoid endless recursion. */
- if (property->widget != widget)
- glade_widget_show (property->widget);
+ if (glade_property_get_widget (property) != widget)
+ glade_widget_show (glade_property_get_widget (property));
return;
}
view =
- glade_design_view_get_from_project (glade_widget_get_project
- (widget));
+ glade_design_view_get_from_project (glade_widget_get_project (widget));
if (!view)
return;
@@ -2098,6 +2113,8 @@ glade_widget_hide (GladeWidget * widget)
void
glade_widget_add_prop_ref (GladeWidget * widget, GladeProperty * property)
{
+ GladePropertyClass *pclass;
+
g_return_if_fail (GLADE_IS_WIDGET (widget));
g_return_if_fail (GLADE_IS_PROPERTY (property));
@@ -2107,7 +2124,8 @@ glade_widget_add_prop_ref (GladeWidget * widget, GladeProperty * property)
/* parentless widget reffed widgets are added to thier reffering widgets.
* they cant be in the design view.
*/
- if (property->klass->parentless_widget)
+ pclass = glade_property_get_class (property);
+ if (pclass->parentless_widget)
glade_widget_hide (widget);
}
@@ -2142,16 +2160,18 @@ glade_widget_list_prop_refs (GladeWidget *widget)
GladeProperty *
glade_widget_get_parentless_widget_ref (GladeWidget * widget)
{
- GList *l;
- GladeProperty *property;
+ GladePropertyClass *pclass;
+ GladeProperty *property;
+ GList *l;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
for (l = widget->priv->prop_refs; l && l->data; l = l->next)
{
- property = GLADE_PROPERTY (l->data);
+ property = l->data;
+ pclass = glade_property_get_class (property);
- if (property->klass->parentless_widget)
+ if (pclass->parentless_widget)
/* only one external property can point to this widget */
return property;
}
@@ -2162,18 +2182,20 @@ glade_widget_get_parentless_widget_ref (GladeWidget * widget)
GList *
glade_widget_get_parentless_reffed_widgets (GladeWidget * widget)
{
- GObject *reffed = NULL;
- GladeProperty *property = NULL;
- GList *l, *widgets = NULL;
+ GladeProperty *property = NULL;
+ GladePropertyClass *pclass;
+ GObject *reffed = NULL;
+ GList *l, *widgets = NULL;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
for (l = widget->priv->properties; l && l->data; l = l->next)
{
- property = GLADE_PROPERTY (l->data);
+ property = l->data;
+ pclass = glade_property_get_class (property);
reffed = NULL;
- if (property->klass->parentless_widget)
+ if (pclass->parentless_widget)
{
glade_property_get (property, &reffed);
if (reffed)
@@ -2277,18 +2299,22 @@ glade_widget_copy_properties (GladeWidget * widget,
{
GladeProperty *widget_prop = GLADE_PROPERTY (l->data);
GladeProperty *template_prop;
+ 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);
+ if (template_prop)
+ template_pclass = glade_property_get_class (template_prop);
/* Check if they share the same class definition, different
* properties may have the same name (support for
* copying properties across "not-quite" compatible widget
* classes, like GtkImageMenuItem --> GtkCheckMenuItem).
*/
- if ((template_prop =
- glade_widget_get_property (template_widget,
- widget_prop->klass->id)) != NULL &&
- glade_property_class_match (template_prop->klass, widget_prop->klass))
+ if (template_pclass != NULL &&
+ glade_property_class_match (template_pclass, widget_pclass))
{
- if (template_prop->klass->parentless_widget && copy_parentless)
+ if (template_pclass->parentless_widget && copy_parentless)
{
GObject *object = NULL;
GladeWidget *parentless;
@@ -2307,7 +2333,7 @@ glade_widget_copy_properties (GladeWidget * widget,
glade_property_set (widget_prop, NULL);
}
else
- glade_property_set_value (widget_prop, template_prop->value);
+ glade_property_set_value (widget_prop, glade_property_inline_value (template_prop));
}
}
}
@@ -2433,22 +2459,22 @@ glade_widget_rebuild (GladeWidget * gwidget)
for (l = save_properties; l; l = l->next)
{
- GladeProperty *property = GLADE_PROPERTY (l->data);
- if (property->widget != gwidget || property->klass->parentless_widget)
+ GladeProperty *property = l->data;
+ GladePropertyClass *pclass = glade_property_get_class (property);
+
+ if (glade_property_get_widget (property) != gwidget || pclass->parentless_widget)
{
PropertyData *prop_data;
- if (!G_IS_PARAM_SPEC_OBJECT (property->klass->pspec))
+ if (!G_IS_PARAM_SPEC_OBJECT (pclass->pspec))
g_warning ("Parentless widget property should be of object type");
prop_data = g_new0 (PropertyData, 1);
prop_data->property = property;
- if (property->widget == gwidget)
- {
- g_value_init (&prop_data->value, property->value->g_type);
- g_value_copy (property->value, &prop_data->value);
- }
+ if (glade_property_get_widget (property) == gwidget)
+ glade_property_get_value (property, &prop_data->value);
+
restore_properties = g_list_prepend (restore_properties, prop_data);
glade_property_set (property, NULL);
}
@@ -2459,8 +2485,7 @@ glade_widget_rebuild (GladeWidget * gwidget)
* and children from it
*/
old_object = g_object_ref (glade_widget_get_object (gwidget));
- new_object =
- glade_widget_build_object (gwidget, gwidget, GLADE_CREATE_REBUILD);
+ new_object = glade_widget_build_object (gwidget, gwidget, GLADE_CREATE_REBUILD);
/* Only call this once the object has a proper GladeWidget */
glade_widget_adaptor_post_create (adaptor, new_object, GLADE_CREATE_REBUILD);
@@ -2501,7 +2526,7 @@ glade_widget_rebuild (GladeWidget * gwidget)
PropertyData *prop_data = l->data;
GladeProperty *property = prop_data->property;
- if (property->widget == gwidget)
+ if (glade_property_get_widget (property) == gwidget)
{
glade_property_set_value (property, &prop_data->value);
g_value_unset (&prop_data->value);
@@ -3096,16 +3121,20 @@ gchar *
glade_widget_property_string (GladeWidget * widget,
const gchar * id_property, const GValue * value)
{
- GladeProperty *property;
- gchar *ret_string = NULL;
+ GladeProperty *property;
+ GladePropertyClass *pclass;
+ gchar *ret_string = NULL;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
g_return_val_if_fail (id_property != NULL, NULL);
if ((property = glade_widget_get_property (widget, id_property)) != NULL)
- ret_string = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (property->klass->handle),
- property->klass, value ? value : property->value);
+ {
+ pclass = glade_property_get_class (property);
+ ret_string = glade_widget_adaptor_string_from_value
+ (GLADE_WIDGET_ADAPTOR (pclass->handle), pclass,
+ value ? value : glade_property_inline_value (property));
+ }
return ret_string;
}
@@ -3126,16 +3155,20 @@ glade_widget_pack_property_string (GladeWidget * widget,
const gchar * id_property,
const GValue * value)
{
- GladeProperty *property;
- gchar *ret_string = NULL;
+ GladeProperty *property;
+ GladePropertyClass *pclass;
+ gchar *ret_string = NULL;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
g_return_val_if_fail (id_property != NULL, NULL);
if ((property = glade_widget_get_pack_property (widget, id_property)) != NULL)
- ret_string = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (property->klass->handle),
- property->klass, value ? value : property->value);
+ {
+ pclass = glade_property_get_class (property);
+ ret_string = glade_widget_adaptor_string_from_value
+ (GLADE_WIDGET_ADAPTOR (pclass->handle), pclass,
+ value ? value : glade_property_inline_value (property));
+ }
return ret_string;
}
@@ -3614,15 +3647,17 @@ glade_widget_set_packing_properties (GladeWidget * widget,
/* update the quick reference hash table */
for (list = widget->priv->packing_properties; list && list->data; list = list->next)
{
- GladeProperty *property = list->data;
- g_hash_table_insert (widget->priv->pack_props_hash, property->klass->id,
- property);
+ GladeProperty *property = list->data;
+ GladePropertyClass *pclass = glade_property_get_class (property);
+
+ g_hash_table_insert (widget->priv->pack_props_hash, pclass->id, property);
}
/* Dont introspect on properties that are not parented yet.
*/
if (glade_widget_adaptor_has_child (container->priv->adaptor,
- container->priv->object, widget->priv->object))
+ container->priv->object,
+ widget->priv->object))
{
glade_widget_set_default_packing_properties (container, widget);
@@ -3630,10 +3665,13 @@ glade_widget_set_packing_properties (GladeWidget * widget,
for (list = widget->priv->packing_properties;
list && list->data; list = list->next)
{
- GladeProperty *property = list->data;
- g_value_reset (property->value);
- glade_widget_child_get_property
- (container, widget, property->klass->id, property->value);
+ /* XXX Ugly dangerous code, plays with the property value inline */
+ GladeProperty *property = list->data;
+ GladePropertyClass *pclass = glade_property_get_class (property);
+ GValue *value = glade_property_inline_value (property);
+
+ g_value_reset (value);
+ glade_widget_child_get_property (container, widget, pclass->id, value);
}
}
}
@@ -4293,18 +4331,20 @@ glade_widget_create_editor_property (GladeWidget * widget,
gboolean packing, gboolean use_command)
{
GladeEditorProperty *eprop;
- GladeProperty *p;
+ GladeProperty *prop;
+ GladePropertyClass *pclass;
if (packing)
- p = glade_widget_get_pack_property (widget, property);
+ prop = glade_widget_get_pack_property (widget, property);
else
- p = glade_widget_get_property (widget, property);
+ prop = glade_widget_get_property (widget, property);
- g_return_val_if_fail (GLADE_IS_PROPERTY (p), NULL);
+ g_return_val_if_fail (GLADE_IS_PROPERTY (prop), NULL);
+ pclass = glade_property_get_class (prop);
eprop = glade_widget_adaptor_create_eprop (widget->priv->adaptor,
- p->klass, use_command);
- glade_editor_property_load (eprop, p);
+ pclass, use_command);
+ glade_editor_property_load (eprop, prop);
return eprop;
}
diff --git a/plugins/gtk+/glade-accels.c b/plugins/gtk+/glade-accels.c
index bd32252..4cd5cdc 100644
--- a/plugins/gtk+/glade-accels.c
+++ b/plugins/gtk+/glade-accels.c
@@ -140,7 +140,7 @@ typedef struct
typedef struct
{
GtkTreeIter *iter;
- gchar *name; /* <-- dont free */
+ const gchar *name; /* <-- dont free */
} GladeEpropIterTab;
GLADE_MAKE_EPROP (GladeEPropAccel, glade_eprop_accel)
@@ -173,7 +173,7 @@ glade_eprop_accel_load (GladeEditorProperty * eprop, GladeProperty * property)
return;
if ((accels =
- glade_accels_make_string (g_value_get_boxed (property->value))) != NULL)
+ glade_accels_make_string (g_value_get_boxed (glade_property_inline_value (property)))) != NULL)
{
gtk_entry_set_text (GTK_ENTRY (eprop_accel->entry), accels);
g_free (accels);
@@ -210,7 +210,7 @@ glade_eprop_accel_populate_view (GladeEditorProperty * eprop,
GList *list, *l, *found, *accelerators;
gchar *name, *accel_text;
- accelerators = g_value_get_boxed (eprop->property->value);
+ accelerators = g_value_get_boxed (glade_property_inline_value (eprop->property));
/* First make parent iters...
*/
@@ -505,7 +505,7 @@ glade_eprop_accel_show_dialog (GtkWidget * dialog_button,
GList *accelerators = NULL;
gint res;
- project = glade_widget_get_project (eprop->property->widget);
+ project = glade_widget_get_project (glade_property_get_widget (eprop->property));
parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
dialog = gtk_dialog_new_with_buttons (_("Choose accelerator keys..."),
diff --git a/plugins/gtk+/glade-attributes.c b/plugins/gtk+/glade-attributes.c
index 63b7cff..7587dd9 100644
--- a/plugins/gtk+/glade-attributes.c
+++ b/plugins/gtk+/glade-attributes.c
@@ -951,7 +951,7 @@ glade_eprop_attrs_populate_view (GladeEditorProperty * eprop,
GladeAttribute *gattr;
gchar *text;
- attributes = g_value_get_boxed (eprop->property->value);
+ attributes = g_value_get_boxed (glade_property_inline_value (eprop->property));
append_empty_row (model, PANGO_ATTR_LANGUAGE);
append_empty_row (model, PANGO_ATTR_STYLE);
@@ -1012,12 +1012,12 @@ glade_eprop_attrs_show_dialog (GtkWidget * dialog_button,
GList *old_attributes;
gint res;
- project = glade_widget_get_project (eprop->property->widget);
+ project = glade_widget_get_project (glade_property_get_widget (eprop->property));
parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
/* Keep a copy for commit time... */
- old_attributes = g_value_dup_boxed (eprop->property->value);
+ old_attributes = g_value_dup_boxed (glade_property_inline_value (eprop->property));
dialog = gtk_dialog_new_with_buttons (_("Setup Text Attributes"),
GTK_WINDOW (parent),
diff --git a/plugins/gtk+/glade-cell-renderer-editor.c b/plugins/gtk+/glade-cell-renderer-editor.c
index f8e257e..62b3c01 100644
--- a/plugins/gtk+/glade-cell-renderer-editor.c
+++ b/plugins/gtk+/glade-cell-renderer-editor.c
@@ -534,7 +534,7 @@ glade_eprop_cell_attribute_load (GladeEditorProperty * eprop,
gtk_list_store_clear (store);
/* Generate model and set active iter */
- if ((gmodel = glade_cell_renderer_get_model (property->widget)) != NULL)
+ if ((gmodel = glade_cell_renderer_get_model (glade_property_get_widget (property))) != NULL)
{
GList *columns = NULL, *l;
@@ -557,7 +557,7 @@ glade_eprop_cell_attribute_load (GladeEditorProperty * eprop,
}
gtk_combo_box_set_active (GTK_COMBO_BOX (eprop_attribute->combo),
- CLAMP (g_value_get_int (property->value) +
+ CLAMP (g_value_get_int (glade_property_inline_value (property)) +
1, 0, g_list_length (columns) + 1));
gtk_widget_set_sensitive (eprop_attribute->combo, TRUE);
@@ -571,7 +571,7 @@ glade_eprop_cell_attribute_load (GladeEditorProperty * eprop,
}
gtk_spin_button_set_value (GTK_SPIN_BUTTON (eprop_attribute->spin),
- (gdouble) g_value_get_int (property->value));
+ (gdouble) g_value_get_int (glade_property_inline_value (property)));
}
}
diff --git a/plugins/gtk+/glade-column-types.c b/plugins/gtk+/glade-column-types.c
index 6ddd1c6..4ac8a5c 100644
--- a/plugins/gtk+/glade-column-types.c
+++ b/plugins/gtk+/glade-column-types.c
@@ -285,7 +285,7 @@ eprop_column_adjust_rows (GladeEditorProperty * eprop, GList * columns)
{
GladeColumnType *column;
GNode *data_tree = NULL;
- GladeWidget *widget = eprop->property->widget;
+ GladeWidget *widget = glade_property_get_widget (eprop->property);
GList *list;
GladeProperty *property;
gint idx;
@@ -344,7 +344,7 @@ eprop_column_append (GladeEditorProperty * eprop,
eprop_types->adding_column = TRUE;
glade_command_push_group (_("Setting columns on %s"),
- glade_widget_get_name (eprop->property->widget));
+ glade_widget_get_name (glade_property_get_widget (eprop->property)));
g_value_init (&value, GLADE_TYPE_COLUMN_TYPE_LIST);
g_value_take_boxed (&value, columns);
@@ -392,8 +392,7 @@ eprop_treeview_key_press (GtkWidget * treeview,
glade_column_type_free (column);
glade_command_push_group (_("Setting columns on %s"),
- glade_widget_get_name (eprop->property->
- widget));
+ glade_widget_get_name (glade_property_get_widget (eprop->property)));
eprop_types->want_focus = TRUE;
@@ -458,7 +457,7 @@ columns_changed_idle (GladeEditorProperty * eprop)
g_list_free (columns);
glade_command_push_group (_("Setting columns on %s"),
- glade_widget_get_name (eprop->property->widget));
+ glade_widget_get_name (glade_property_get_widget (eprop->property)));
g_value_init (&value, GLADE_TYPE_COLUMN_TYPE_LIST);
g_value_take_boxed (&value, g_list_reverse (new_list));
@@ -677,7 +676,7 @@ column_name_edited (GtkCellRendererText * cell,
column_name = g_strdup (column_name);
glade_command_push_group (_("Setting columns on %s"),
- glade_widget_get_name (eprop->property->widget));
+ glade_widget_get_name (glade_property_get_widget (eprop->property)));
eprop_types->want_focus = TRUE;
@@ -686,7 +685,7 @@ column_name_edited (GtkCellRendererText * cell,
glade_editor_property_commit (eprop, &value);
g_value_unset (&value);
- property = glade_widget_get_property (eprop->property->widget, "data");
+ property = glade_widget_get_property (glade_property_get_widget (eprop->property), "data");
glade_property_get (property, &data_tree);
if (data_tree)
{
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 28d4100..fc0b9e4 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -243,7 +243,7 @@ glade_gtk_parse_atk_props (GladeWidget * widget, GladeXmlNode * node)
/* Set the parsed value on the property ... */
gvalue = glade_property_class_make_gvalue_from_string
- (property->klass, value, glade_widget_get_project (widget), widget);
+ (glade_property_get_class (property), value, glade_widget_get_project (widget), widget);
glade_property_set_value (property, gvalue);
g_value_unset (gvalue);
g_free (gvalue);
@@ -320,7 +320,7 @@ glade_gtk_parse_atk_relation (GladeProperty * property, GladeXmlNode * node)
id = glade_util_read_prop_name (type);
- if (!strcmp (id, property->klass->id))
+ if (!strcmp (id, glade_property_get_class (property)->id))
{
if (string == NULL)
string = g_strdup (target);
@@ -410,20 +410,24 @@ glade_gtk_widget_write_atk_property (GladeProperty * property,
glade_xml_node_append_child (node, prop_node);
glade_xml_node_set_property_string (prop_node,
- GLADE_TAG_NAME, property->klass->id);
+ GLADE_TAG_NAME, glade_property_get_class (property)->id);
glade_xml_set_content (prop_node, value);
- /* XXX Do context !!! */
- if (property->i18n_translatable)
+ if (glade_property_i18n_get_translatable (property))
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_TRANSLATABLE,
GLADE_XML_TAG_I18N_TRUE);
- if (property->i18n_comment)
+ if (glade_property_i18n_get_comment (property))
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_COMMENT,
- property->i18n_comment);
+ glade_property_i18n_get_comment (property));
+
+ if (glade_property_i18n_get_context (property))
+ glade_xml_node_set_property_string (prop_node,
+ GLADE_TAG_CONTEXT,
+ glade_property_i18n_get_context (property));
}
}
@@ -481,8 +485,8 @@ glade_gtk_widget_write_atk_relation (GladeProperty * property,
gint i;
if ((value = glade_widget_adaptor_string_from_value
- (GLADE_WIDGET_ADAPTOR (property->klass->handle),
- property->klass, property->value)) != NULL)
+ (GLADE_WIDGET_ADAPTOR (glade_property_get_class (property)->handle),
+ glade_property_get_class (property), glade_property_inline_value (property))) != NULL)
{
if ((split = g_strsplit (value, GPC_OBJECT_DELIMITER, 0)) != NULL)
{
@@ -493,7 +497,7 @@ glade_gtk_widget_write_atk_relation (GladeProperty * property,
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_A11Y_TYPE,
- property->klass->id);
+ glade_property_get_class (property)->id);
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_A11Y_TARGET,
split[i]);
@@ -539,7 +543,7 @@ glade_gtk_widget_write_atk_action (GladeProperty * property,
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_A11Y_ACTION_NAME,
- &property->klass->id[4]);
+ &glade_property_get_class (property)->id[4]);
glade_xml_node_set_property_string (prop_node,
GLADE_TAG_A11Y_DESC, value);
}
@@ -595,7 +599,7 @@ glade_gtk_write_accels (GladeWidget * widget,
if (!(property = glade_widget_get_property (widget, "accelerator")))
return;
- for (list = g_value_get_boxed (property->value); list; list = list->next)
+ for (list = g_value_get_boxed (glade_property_inline_value (property)); list; list = list->next)
{
GladeAccelInfo *accel = list->data;
@@ -728,7 +732,7 @@ create_command_property_list (GladeWidget * gnew, GList * saved_props)
{
GladeProperty *property = l->data;
GladeProperty *orig_prop =
- glade_widget_get_pack_property (gnew, property->klass->id);
+ glade_widget_get_pack_property (gnew, glade_property_get_class (property)->id);
GCSetPropData *pdata = g_new0 (GCSetPropData, 1);
pdata->property = orig_prop;
@@ -1567,7 +1571,7 @@ glade_gtk_box_get_first_blank (GtkBox * box)
gint gwidget_position;
GladeProperty *property =
glade_widget_get_pack_property (gwidget, "position");
- gwidget_position = g_value_get_int (property->value);
+ gwidget_position = g_value_get_int (glade_property_inline_value (property));
if (gwidget_position > position)
break;
@@ -3515,7 +3519,7 @@ glade_gtk_notebook_get_first_blank_page (GtkNotebook * notebook)
{
GladeProperty *property =
glade_widget_get_property (gwidget, "position");
- gint gwidget_position = g_value_get_int (property->value);
+ gint gwidget_position = g_value_get_int (glade_property_inline_value (property));
if ((gwidget_position - position) > 0)
return position;
@@ -4512,7 +4516,7 @@ glade_gtk_entry_set_property (GladeWidgetAdaptor * adaptor,
}
else if (GPC_VERSION_CHECK
- (property->klass, gtk_major_version, gtk_minor_version + 1))
+ (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1))
GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object, id, value);
}
@@ -4545,7 +4549,7 @@ glade_gtk_entry_read_widget (GladeWidgetAdaptor * adaptor,
property = glade_widget_get_property (widget, "buffer");
/* Only default to the buffer setting if the project version supports it. */
- if (GPC_VERSION_CHECK (property->klass, target_major, target_minor))
+ if (GPC_VERSION_CHECK (glade_property_get_class (property), target_major, target_minor))
{
glade_widget_property_set (widget, "use-entry-buffer", TRUE);
glade_property_sync (property);
@@ -5209,8 +5213,8 @@ glade_gtk_dialog_write_responses (GladeWidget * widget,
glade_xml_node_append_child (node, widget_node);
str =
- glade_property_class_make_string_from_gvalue (property->klass,
- property->value);
+ glade_property_class_make_string_from_gvalue (glade_property_get_class (property),
+ glade_property_inline_value (property));
glade_xml_node_set_property_string (widget_node, GLADE_TAG_RESPONSE, str);
glade_xml_set_content (widget_node, glade_widget_get_name (action_widget));
@@ -5706,7 +5710,7 @@ glade_gtk_button_set_property (GladeWidgetAdaptor * adaptor,
id, value);
sync_use_appearance (widget);
}
- else if (GPC_VERSION_CHECK (property->klass, gtk_major_version, gtk_minor_version + 1))
+ else if (GPC_VERSION_CHECK (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1))
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value);
}
@@ -5832,7 +5836,7 @@ glade_gtk_image_write_widget (GladeWidgetAdaptor * adaptor,
glade_xml_node_append_child (node, prop_node);
glade_xml_node_set_property_string (prop_node, GLADE_TAG_NAME,
- size_prop->klass->id);
+ glade_property_get_class (size_prop)->id);
glade_property_get (size_prop, &icon_size);
value = g_strdup_printf ("%d", icon_size);
@@ -6593,7 +6597,7 @@ glade_gtk_menu_item_set_property (GladeWidgetAdaptor * adaptor,
else if (!strcmp (id, "label"))
glade_gtk_menu_item_set_label (object, value);
else if (GPC_VERSION_CHECK
- (property->klass, gtk_major_version, gtk_minor_version + 1))
+ (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1))
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id,
value);
}
@@ -7237,7 +7241,7 @@ glade_gtk_tool_item_set_property (GladeWidgetAdaptor * adaptor,
evaluate_activatable_property_sensitivity (object, id, value);
if (GPC_VERSION_CHECK
- (property->klass, gtk_major_version, gtk_minor_version + 1))
+ (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1))
GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id,
value);
}
@@ -7868,7 +7872,8 @@ glade_gtk_label_read_widget (GladeWidgetAdaptor * adaptor,
/* sync label property after a load... */
prop = glade_widget_get_property (widget, "label");
- glade_gtk_label_set_label (glade_widget_get_object (widget), prop->value);
+ glade_gtk_label_set_label (glade_widget_get_object (widget),
+ glade_property_inline_value (prop));
/* Resolve "label-content-mode" virtual control property */
if (!glade_widget_property_original_default (widget, "use-markup"))
@@ -8088,7 +8093,7 @@ glade_gtk_entry_buffer_set_property (GladeWidgetAdaptor * adaptor,
}
else if (GPC_VERSION_CHECK
- (property->klass, gtk_major_version, gtk_minor_version + 1))
+ (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1))
GWA_GET_CLASS (G_TYPE_OBJECT)->set_property (adaptor, object, id, value);
}
@@ -8151,7 +8156,7 @@ glade_gtk_text_buffer_set_property (GladeWidgetAdaptor * adaptor,
}
else if (GPC_VERSION_CHECK
- (property->klass, gtk_major_version, gtk_minor_version + 1))
+ (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1))
GWA_GET_CLASS (G_TYPE_OBJECT)->set_property (adaptor, object, id, value);
}
@@ -9301,12 +9306,12 @@ glade_gtk_cell_renderer_sync_attributes (GObject * object)
{
property = l->data;
- if (strncmp (property->klass->id, "attr-", attr_len) == 0)
+ if (strncmp (glade_property_get_class (property)->id, "attr-", attr_len) == 0)
{
GladeProperty *attr_prop;
- gint column = g_value_get_int (property->value);
+ gint column = g_value_get_int (glade_property_inline_value (property));
- attr_prop_name = &property->klass->id[attr_len];
+ attr_prop_name = &glade_property_get_class (property)->id[attr_len];
attr_prop = glade_widget_get_property (widget, attr_prop_name);
if (column >= 0 && column < columns)
@@ -9317,10 +9322,8 @@ glade_gtk_cell_renderer_sync_attributes (GObject * object)
if (column_gtype &&
g_value_type_transformable (column_gtype,
- attr_prop->klass->pspec->
- value_type))
- gtk_cell_layout_add_attribute (layout, cell, attr_prop_name,
- column);
+ glade_property_get_class (attr_prop)->pspec->value_type))
+ gtk_cell_layout_add_attribute (layout, cell, attr_prop_name, column);
}
}
}
@@ -9484,7 +9487,7 @@ glade_gtk_store_columns_changed (GladeProperty * property,
prop_refs = glade_widget_list_prop_refs (store);
for (l = prop_refs; l; l = l->next)
{
- GladeWidget *referring_widget = GLADE_PROPERTY (l->data)->widget;
+ GladeWidget *referring_widget = glade_property_get_widget (GLADE_PROPERTY (l->data));
GObject *referring_object = glade_widget_get_object (referring_widget);
if (GTK_IS_CELL_LAYOUT (referring_object))
@@ -9636,7 +9639,7 @@ glade_gtk_store_write_columns (GladeWidget * widget,
columns_node = glade_xml_node_new (context, GLADE_TAG_COLUMNS);
- for (l = g_value_get_boxed (prop->value); l; l = g_list_next (l))
+ for (l = g_value_get_boxed (glade_property_inline_value (prop)); l; l = g_list_next (l))
{
GladeColumnType *data = l->data;
GladeXmlNode *column_node, *comment_node;
@@ -10150,15 +10153,15 @@ glade_gtk_cell_renderer_write_properties (GladeWidget * widget,
{
property = l->data;
- if (strncmp (property->klass->id, "attr-", attr_len) == 0)
+ if (strncmp (glade_property_get_class (property)->id, "attr-", attr_len) == 0)
{
gchar *use_attr_str;
gboolean use_attr = FALSE;
- use_attr_str = g_strdup_printf ("use-%s", property->klass->id);
+ use_attr_str = g_strdup_printf ("use-%s", glade_property_get_class (property)->id);
glade_widget_property_get (widget, use_attr_str, &use_attr);
- attr_name = &property->klass->id[attr_len];
+ attr_name = &glade_property_get_class (property)->id[attr_len];
prop = glade_widget_get_property (widget, attr_name);
if (!use_attr && prop)
@@ -10210,11 +10213,11 @@ glade_gtk_cell_renderer_parse_finished (GladeProject * project,
GladeProperty *switch_prop;
property = l->data;
- if (strncmp (property->klass->id, "attr-", attr_len) != 0 &&
- strncmp (property->klass->id, "use-attr-", use_attr_len) != 0 &&
+ 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 &&
(switch_prop =
glade_gtk_cell_renderer_attribute_switch (widget,
- property->klass->id)) !=
+ glade_property_get_class (property)->id)) !=
NULL)
{
if (glade_property_original_default (property))
@@ -10457,20 +10460,20 @@ glade_gtk_cell_renderer_write_attributes (GladeWidget * widget,
{
property = l->data;
- if (strncmp (property->klass->id, "attr-", attr_len) == 0)
+ if (strncmp (glade_property_get_class (property)->id, "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", property->klass->id);
+ use_attr_str = g_strdup_printf ("use-%s", glade_property_get_class (property)->id);
glade_widget_property_get (widget, use_attr_str, &use_attr);
- if (use_attr && g_value_get_int (property->value) >= 0)
+ if (use_attr && g_value_get_int (glade_property_inline_value (property)) >= 0)
{
column_str =
- g_strdup_printf ("%d", g_value_get_int (property->value));
- attr_name = &property->klass->id[attr_len];
+ g_strdup_printf ("%d", g_value_get_int (glade_property_inline_value (property)));
+ attr_name = &glade_property_get_class (property)->id[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+/glade-icon-sources.c b/plugins/gtk+/glade-icon-sources.c
index d6a2931..fd8bc98 100644
--- a/plugins/gtk+/glade-icon-sources.c
+++ b/plugins/gtk+/glade-icon-sources.c
@@ -479,8 +479,8 @@ value_filename_edited (GtkCellRendererText * cell,
/* get new pixbuf value... */
value = glade_utils_value_from_string (GDK_TYPE_PIXBUF, new_text,
- glade_widget_get_project (eprop->property->widget),
- eprop->property->widget);
+ glade_widget_get_project (glade_property_get_widget (eprop->property)),
+ glade_property_get_widget (eprop->property));
pixbuf = g_value_get_object (value);
diff --git a/plugins/gtk+/glade-model-data.c b/plugins/gtk+/glade-model-data.c
index 90b1a5e..de3c63d 100644
--- a/plugins/gtk+/glade-model-data.c
+++ b/plugins/gtk+/glade-model-data.c
@@ -388,7 +388,7 @@ glade_eprop_model_data_add_row (GladeEditorProperty * eprop)
GList *columns = NULL;
glade_property_get (eprop->property, &node);
- glade_widget_property_get (eprop->property->widget, "columns", &columns);
+ glade_widget_property_get (glade_property_get_widget (eprop->property), "columns", &columns);
if (!columns)
return;
@@ -749,13 +749,14 @@ value_text_edited (GtkCellRendererText * cell,
glade_get_value_from_displayable
(G_VALUE_TYPE (&data->value),
new_text),
- glade_widget_get_project (eprop->property->widget),
- eprop->property->widget);
+ glade_widget_get_project
+ (glade_property_get_widget (eprop->property)),
+ glade_property_get_widget (eprop->property));
else
value =
glade_utils_value_from_string (G_VALUE_TYPE (&data->value), new_text,
- glade_widget_get_project (eprop->property->widget),
- eprop->property->widget);
+ glade_widget_get_project (glade_property_get_widget (eprop->property)),
+ glade_property_get_widget (eprop->property));
g_value_copy (value, &data->value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]