diff options
author | Corentin Noël <corentin@elementary.io> | 2019-06-18 07:31:45 +0000 |
---|---|---|
committer | Alberto Fanjul <albertofanjul@gmail.com> | 2019-06-18 07:31:45 +0000 |
commit | a543e99069b693d96e68eb8e00a2dce00a1946a7 (patch) | |
tree | af1f0429370af555ca4ff0f7d67e06c4dbdfb8ef | |
parent | 91a8b096a745194d27b3bf27d6b20ef7440e766d (diff) | |
download | glade-a543e99069b693d96e68eb8e00a2dce00a1946a7.tar.gz |
Rename GladePropertyClass to GladePropertyDef and declare it as boxed
59 files changed, 1665 insertions, 1635 deletions
diff --git a/doc/gladeui-docs.xml b/doc/gladeui-docs.xml index 04ea42fa..85e28bcb 100644 --- a/doc/gladeui-docs.xml +++ b/doc/gladeui-docs.xml @@ -41,7 +41,7 @@ <xi:include href="xml/gw-action-class.xml"/> <xi:include href="xml/glade-fixed.xml"/> <xi:include href="xml/glade-property.xml"/> - <xi:include href="xml/glade-property-class.xml"/> + <xi:include href="xml/glade-property-def.xml"/> <xi:include href="xml/glade-command.xml"/> <xi:include href="xml/glade-clipboard.xml"/> <xi:include href="xml/glade-base-editor.xml"/> diff --git a/doc/gladeui-sections.txt b/doc/gladeui-sections.txt index 2ca9d60d..8ccaa000 100644 --- a/doc/gladeui-sections.txt +++ b/doc/gladeui-sections.txt @@ -253,8 +253,8 @@ glade_widget_adaptor_create_internal glade_widget_adaptor_create_widget_real glade_widget_adaptor_get_by_name glade_widget_adaptor_get_by_type -glade_widget_adaptor_get_property_class -glade_widget_adaptor_get_pack_property_class +glade_widget_adaptor_get_property_def +glade_widget_adaptor_get_pack_property_def glade_widget_adaptor_default_params glade_widget_adaptor_post_create glade_widget_adaptor_get_internal_child @@ -376,76 +376,79 @@ GladeDesignViewPrivate </SECTION> <SECTION> -<FILE>glade-property-class</FILE> +<FILE>glade-property-def</FILE> GPC_OBJECT_DELIMITER GPC_PROPERTY_NAMELEN -<TITLE>GladePropertyClass</TITLE> -GladePropertyClass -glade_property_class_new -glade_property_class_new_from_spec -glade_property_class_clone -glade_property_class_free -glade_property_class_is_visible -glade_property_class_is_object -glade_property_class_make_gvalue_from_string -glade_property_class_make_string_from_gvalue -glade_property_class_make_gvalue_from_vl -glade_property_class_set_vl_from_gvalue -glade_property_class_make_gvalue -glade_property_class_get_from_gvalue -glade_property_class_update_from_node -glade_property_class_make_adjustment -glade_property_class_match -glade_property_class_void_value -glade_property_class_atk -glade_property_class_common -glade_property_class_compare -glade_property_class_create_type -glade_property_class_custom_layout -glade_property_class_deprecated -glade_property_class_get_adaptor -glade_property_class_get_construct_only -glade_property_class_get_default -glade_property_class_get_default_from_spec -glade_property_class_get_ignore -glade_property_class_get_is_packing -glade_property_class_get_name -glade_property_class_get_original_default -glade_property_class_get_pspec -glade_property_class_get_tooltip -glade_property_class_get_virtual -glade_property_class_id -glade_property_class_load_defaults_from_spec -glade_property_class_multiline -glade_property_class_needs_sync -glade_property_class_new_from_spec_full -glade_property_class_optional -glade_property_class_optional_default -glade_property_class_parentless_widget -glade_property_class_query -glade_property_class_save -glade_property_class_save_always -glade_property_class_set_adaptor -glade_property_class_set_construct_only -glade_property_class_set_ignore -glade_property_class_set_is_packing -glade_property_class_set_name -glade_property_class_set_pspec -glade_property_class_set_tooltip -glade_property_class_set_virtual -glade_property_class_set_weights -glade_property_class_since_major -glade_property_class_since_minor -glade_property_class_stock -glade_property_class_stock_icon -glade_property_class_themed_icon -glade_property_class_transfer_on_paste -glade_property_class_translatable -glade_property_class_weight +<TITLE>GladePropertyDef</TITLE> +GladePropertyDef +glade_property_def_new +glade_property_def_new_from_spec +glade_property_def_clone +glade_property_def_free +glade_property_def_is_visible +glade_property_def_is_object +glade_property_def_make_flags_from_string +glade_property_def_make_gvalue_from_string +glade_property_def_make_string_from_gvalue +glade_property_def_make_gvalue_from_vl +glade_property_def_set_vl_from_gvalue +glade_property_def_make_gvalue +glade_property_def_get_from_gvalue +glade_property_def_update_from_node +glade_property_def_make_adjustment +glade_property_def_match +glade_property_def_void_value +glade_property_def_atk +glade_property_def_common +glade_property_def_compare +glade_property_def_create_type +glade_property_def_custom_layout +glade_property_def_deprecated +glade_property_def_get_adaptor +glade_property_def_get_construct_only +glade_property_def_get_default +glade_property_def_get_default_from_spec +glade_property_def_get_ignore +glade_property_def_get_is_packing +glade_property_def_get_name +glade_property_def_get_original_default +glade_property_def_get_pspec +glade_property_def_get_tooltip +glade_property_def_get_virtual +glade_property_def_id +glade_property_def_load_defaults_from_spec +glade_property_def_multiline +glade_property_def_needs_sync +glade_property_def_new_from_spec_full +glade_property_def_optional +glade_property_def_optional_default +glade_property_def_parentless_widget +glade_property_def_query +glade_property_def_save +glade_property_def_save_always +glade_property_def_set_adaptor +glade_property_def_set_construct_only +glade_property_def_set_ignore +glade_property_def_set_is_packing +glade_property_def_set_name +glade_property_def_set_pspec +glade_property_def_set_tooltip +glade_property_def_set_virtual +glade_property_def_set_weights +glade_property_def_since_major +glade_property_def_since_minor +glade_property_def_stock +glade_property_def_stock_icon +glade_property_def_themed_icon +glade_property_def_transfer_on_paste +glade_property_def_translatable +glade_property_def_weight <SUBSECTION Standard> -GLADE_PROPERTY_CLASS -GLADE_IS_PROPERTY_CLASS -GLADE_PROPERTY_CLASS_IS_TYPE +GLADE_TYPE_PROPERTY_DEF +glade_property_def_get_type +GLADE_PROPERTY_DEF +GLADE_IS_PROPERTY_DEF +GLADE_PROPERTY_DEF_IS_TYPE </SECTION> <SECTION> @@ -549,7 +552,7 @@ glade_editor_property_commit_no_callback glade_editor_property_get_custom_text glade_editor_property_get_disable_check glade_editor_property_get_item_label -glade_editor_property_get_pclass +glade_editor_property_get_property_def glade_editor_property_get_property glade_editor_property_loading glade_editor_property_set_custom_text @@ -1019,7 +1022,7 @@ glade_property_superuser glade_property_make_string glade_property_set_support_warning glade_property_set_widget -glade_property_get_class +glade_property_get_def glade_property_get_state glade_property_get_support_warning glade_property_get_widget @@ -1307,6 +1310,7 @@ glade_xml_context_free glade_xml_context_new_from_path glade_xml_context_get_doc <SUBSECTION Standard> +glade_xml_node_get_type GLADE_XML_CONTEXT GLADE_XML_IS_CONTEXT CAST_BAD @@ -1353,6 +1357,9 @@ GLADE_TAG_ADD_CHILD_FUNCTION GLADE_TAG_ADD_CHILD_VERIFY_FUNCTION GLADE_TAG_ANARCHIST GLADE_TAG_ATK_PROPERTY +GLADE_TAG_BIND_FLAGS +GLADE_TAG_BIND_PROPERTY +GLADE_TAG_BIND_SOURCE GLADE_TAG_BOOK GLADE_TAG_BUILDER_SINCE GLADE_TAG_CHILD_ACTION_ACTIVATE_FUNCTION diff --git a/doc/properties.sgml b/doc/properties.sgml index 2acc0b46..8e3e6a80 100644 --- a/doc/properties.sgml +++ b/doc/properties.sgml @@ -1,19 +1,19 @@ <refentry id="properties" revision="8 Feb 2006"> <refmeta> - <refentrytitle>Property Class Definitions</refentrytitle> + <refentrytitle>Property Definitions</refentrytitle> <refmiscinfo>Glade UI</refmiscinfo> </refmeta> <refnamediv> - <refname>Property Classes</refname> + <refname>Property Definitions</refname> <refpurpose> -How to augment or define a #GladePropertyClass +How to augment or define a #GladePropertyDef </refpurpose> </refnamediv> <refsect1> - <title>Property Class Configuration</title> + <title>Property Definition Configuration</title> <para> -Properties are introspected at load time and loaded into #GladePropertyClass structures. +Properties are introspected at load time and loaded into #GladePropertyDef structures. The behaviour of properties can be modified by the catalog and fake properties can be added for editing purposes. Here is an example of the xml form: <programlisting><![CDATA[... diff --git a/gladeui/Makefile.am b/gladeui/Makefile.am index 55a240bc..a650addc 100644 --- a/gladeui/Makefile.am +++ b/gladeui/Makefile.am @@ -118,7 +118,7 @@ libgladeui_2_la_SOURCES = \ glade-project.c \ glade-project-properties.c \ glade-property.c \ - glade-property-class.c \ + glade-property-def.c \ glade-property-label.c \ glade-property-shell.c \ glade-signal.c \ @@ -178,7 +178,7 @@ libgladeuiinclude_HEADERS = \ glade-placeholder.h \ glade-project.h \ glade-property.h \ - glade-property-class.h \ + glade-property-def.h \ glade-property-label.h \ glade-property-shell.h \ glade-signal.h \ diff --git a/gladeui/glade-base-editor.c b/gladeui/glade-base-editor.c index 28df0750..18601fdc 100644 --- a/gladeui/glade-base-editor.c +++ b/gladeui/glade-base-editor.c @@ -1408,9 +1408,9 @@ glade_base_editor_change_type (GladeBaseEditor *editor, l = glade_widget_get_packing_properties (gchild); while (l) { - GladeProperty *orig_prop = (GladeProperty *) l->data; - GladePropertyClass *pclass = glade_property_get_class (orig_prop); - GladeProperty *dup_prop = glade_widget_get_property (gchild_new, glade_property_class_id (pclass)); + GladeProperty *orig_prop = (GladeProperty *) l->data; + GladePropertyDef *pdef = glade_property_get_def (orig_prop); + GladeProperty *dup_prop = glade_widget_get_property (gchild_new, glade_property_def_id (pdef)); 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 b92db245..abc039bb 100644 --- a/gladeui/glade-command.c +++ b/gladeui/glade-command.c @@ -41,7 +41,7 @@ #include "glade-palette.h" #include "glade-command.h" #include "glade-property.h" -#include "glade-property-class.h" +#include "glade-property-def.h" #include "glade-debug.h" #include "glade-placeholder.h" #include "glade-clipboard.h" @@ -441,23 +441,23 @@ glade_command_property_enabled_collapse (GladeCommand *this_cmd, GladeCommandPropertyEnabled *this = GLADE_COMMAND_PROPERTY_ENABLED (this_cmd); GladeCommandPropertyEnabled *other = GLADE_COMMAND_PROPERTY_ENABLED (other_cmd); GladeWidget *widget; - GladePropertyClass *pclass; + GladePropertyDef *pdef; this->new_enabled = other->new_enabled; widget = glade_property_get_widget (this->property); - pclass = glade_property_get_class (this->property); + pdef = glade_property_get_def (this->property); g_free (this_cmd->priv->description); if (this->new_enabled) this_cmd->priv->description = g_strdup_printf (_("Enabling property %s on widget %s"), - glade_property_class_get_name (pclass), + glade_property_def_get_name (pdef), glade_widget_get_name (widget)); else this_cmd->priv->description = g_strdup_printf (_("Disabling property %s on widget %s"), - glade_property_class_get_name (pclass), + glade_property_def_get_name (pdef), glade_widget_get_name (widget)); } @@ -477,7 +477,7 @@ glade_command_set_property_enabled (GladeProperty *property, GladeCommandPropertyEnabled *me; GladeCommand *cmd; GladeWidget *widget; - GladePropertyClass *pclass; + GladePropertyDef *pdef; gboolean old_enabled; /* Sanity checks */ @@ -487,8 +487,8 @@ glade_command_set_property_enabled (GladeProperty *property, g_return_if_fail (GLADE_IS_WIDGET (widget)); /* Only applies to optional properties */ - pclass = glade_property_get_class (property); - g_return_if_fail (glade_property_class_optional (pclass)); + pdef = glade_property_get_def (property); + g_return_if_fail (glade_property_def_optional (pdef)); /* Fetch current state */ old_enabled = glade_property_get_enabled (property); @@ -508,12 +508,12 @@ glade_command_set_property_enabled (GladeProperty *property, if (enabled) cmd->priv->description = g_strdup_printf (_("Enabling property %s on widget %s"), - glade_property_class_get_name (pclass), + glade_property_def_get_name (pdef), glade_widget_get_name (widget)); else cmd->priv->description = g_strdup_printf (_("Disabling property %s on widget %s"), - glade_property_class_get_name (pclass), + glade_property_def_get_name (pdef), glade_widget_get_name (widget)); glade_command_check_group (GLADE_COMMAND (me)); @@ -573,10 +573,10 @@ glade_command_set_property_execute (GladeCommand *cmd) for (l = me->sdata; l; l = l->next) { - GValue new_value = { 0, }; - GCSetPropData *sdata = l->data; - GladePropertyClass *pclass = glade_property_get_class (sdata->property); - GladeWidget *widget = glade_property_get_widget (sdata->property); + GValue new_value = { 0, }; + GCSetPropData *sdata = l->data; + GladePropertyDef *pdef = glade_property_get_def (sdata->property); + GladeWidget *widget = glade_property_get_widget (sdata->property); g_value_init (&new_value, G_VALUE_TYPE (sdata->new_value)); @@ -590,10 +590,10 @@ glade_command_set_property_execute (GladeCommand *cmd) { gchar *str = glade_widget_adaptor_string_from_value - (glade_property_class_get_adaptor (pclass), pclass, &new_value); + (glade_property_def_get_adaptor (pdef), pdef, &new_value); g_print ("Setting %s property of %s to %s (sumode: %d)\n", - glade_property_class_id (pclass), + glade_property_def_id (pdef), glade_widget_get_name (widget), str, glade_property_superuser ()); @@ -604,11 +604,11 @@ glade_command_set_property_execute (GladeCommand *cmd) /* Packing properties need to be refreshed here since * they are reset when they get added to containers. */ - if (glade_property_class_get_is_packing (pclass)) + if (glade_property_def_get_is_packing (pdef)) { GladeProperty *tmp_prop; - tmp_prop = glade_widget_get_pack_property (widget, glade_property_class_id (pclass)); + tmp_prop = glade_widget_get_pack_property (widget, glade_property_def_id (pdef)); if (sdata->property != tmp_prop) { @@ -618,7 +618,7 @@ glade_command_set_property_execute (GladeCommand *cmd) } /* Make sure the target object has a name for object properties */ - if (glade_property_class_is_object (pclass)) + if (glade_property_def_is_object (pdef)) { GObject *pobject = g_value_get_object (&new_value); GladeWidget *pwidget; @@ -685,7 +685,7 @@ glade_command_set_property_unifies (GladeCommand *this_cmd, GladeCommand *other_cmd) { GladeCommandSetProperty *cmd1, *cmd2; - GladePropertyClass *pclass1, *pclass2; + GladePropertyDef *pdef1, *pdef2; GCSetPropData *pdata1, *pdata2; GladeWidget *widget1, *widget2; GList *list, *l; @@ -699,11 +699,11 @@ glade_command_set_property_unifies (GladeCommand *this_cmd, for (list = cmd1->sdata; list; list = list->next) { pdata1 = list->data; - pclass1 = glade_property_get_class (pdata1->property); + pdef1 = glade_property_get_def (pdata1->property); - if (glade_property_class_compare (pclass1, - pdata1->old_value, - pdata1->new_value)) + if (glade_property_def_compare (pdef1, + pdata1->old_value, + pdata1->new_value)) return FALSE; } return TRUE; @@ -724,17 +724,17 @@ glade_command_set_property_unifies (GladeCommand *this_cmd, for (list = cmd1->sdata; list; list = list->next) { pdata1 = list->data; - pclass1 = glade_property_get_class (pdata1->property); + pdef1 = glade_property_get_def (pdata1->property); widget1 = glade_property_get_widget (pdata1->property); for (l = cmd2->sdata; l; l = l->next) { pdata2 = l->data; - pclass2 = glade_property_get_class (pdata2->property); + pdef2 = glade_property_get_def (pdata2->property); widget2 = glade_property_get_widget (pdata2->property); if (widget1 == widget2 && - glade_property_class_match (pclass1, pclass2)) + glade_property_def_match (pdef1, pdef2)) break; } @@ -756,7 +756,7 @@ glade_command_set_property_collapse (GladeCommand *this_cmd, { GladeCommandSetProperty *cmd1, *cmd2; GCSetPropData *pdata1, *pdata2; - GladePropertyClass *pclass1, *pclass2; + GladePropertyDef *pdef1, *pdef2; GList *list, *l; g_return_if_fail (GLADE_IS_COMMAND_SET_PROPERTY (this_cmd) && @@ -769,14 +769,14 @@ glade_command_set_property_collapse (GladeCommand *this_cmd, for (list = cmd1->sdata; list; list = list->next) { pdata1 = list->data; - pclass1 = glade_property_get_class (pdata1->property); + pdef1 = glade_property_get_def (pdata1->property); for (l = cmd2->sdata; l; l = l->next) { pdata2 = l->data; - pclass2 = glade_property_get_class (pdata2->property); + pdef2 = glade_property_get_def (pdata2->property); - if (glade_property_class_match (pclass1, pclass2)) + if (glade_property_def_match (pdef1, pdef2)) { /* Merge the GCSetPropData structs manually here */ @@ -801,7 +801,7 @@ glade_command_set_property_description (GladeCommandSetProperty *me) GCSetPropData *sdata; gchar *description = NULL; gchar *value_name; - GladePropertyClass *pclass; + GladePropertyDef *pdef; GladeWidget *widget; g_assert (me->sdata); @@ -811,22 +811,22 @@ glade_command_set_property_description (GladeCommandSetProperty *me) else { sdata = me->sdata->data; - pclass = glade_property_get_class (sdata->property); + pdef = glade_property_get_def (sdata->property); widget = glade_property_get_widget (sdata->property); value_name = glade_widget_adaptor_string_from_value - (glade_property_class_get_adaptor (pclass), pclass, sdata->new_value); + (glade_property_def_get_adaptor (pdef), pdef, 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"), - glade_property_class_get_name (pclass), + glade_property_def_get_name (pdef), glade_widget_get_name (widget)); } else { description = g_strdup_printf (_("Setting %s of %s to %s"), - glade_property_class_get_name (pclass), + glade_property_def_get_name (pdef), glade_widget_get_name (widget), value_name); } @@ -963,7 +963,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 (glade_property_get_class (property), args); + value = glade_property_def_make_gvalue_from_vl (glade_property_get_def (property), args); va_end (args); glade_command_set_property_value (property, value); @@ -1484,12 +1484,12 @@ 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); + GladePropertyDef *pdef = glade_property_get_def (sprop); - prop = glade_widget_get_pack_property (gnew, glade_property_class_id (pclass)); + prop = glade_widget_get_pack_property (gnew, glade_property_def_id (pdef)); - if (prop && glade_property_class_transfer_on_paste (pclass) && - glade_property_class_match (glade_property_get_class (prop), pclass)) + if (prop && glade_property_def_transfer_on_paste (pdef) && + glade_property_def_match (glade_property_get_def (prop), pdef)) glade_property_set_value (prop, glade_property_inline_value (sprop)); } } @@ -1570,11 +1570,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; - GladePropertyClass *pclass = glade_property_get_class (saved_prop); - GladeProperty *widget_prop = - glade_widget_get_pack_property (cdata->widget, glade_property_class_id (pclass)); + GValue value = { 0, }; + GladeProperty *saved_prop = l->data; + GladePropertyDef *pdef = glade_property_get_def (saved_prop); + GladeProperty *widget_prop = + glade_widget_get_pack_property (cdata->widget, glade_property_def_id (pdef)); glade_property_get_value (saved_prop, &value); glade_property_set_value (widget_prop, &value); @@ -1900,7 +1900,7 @@ glade_command_break_references_for_widget (GladeWidget *widget, GList *widgets) { property = l->data; - if (glade_property_class_is_object (property->klass) && + if (glade_property_def_is_object (property->klass) && property->klass->parentless_widget == FALSE) { GList *obj_list; diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c index c7203e6e..4a15fb76 100644 --- a/gladeui/glade-editor-property.c +++ b/gladeui/glade-editor-property.c @@ -28,7 +28,7 @@ * @Short_Description: A generic widget to edit a #GladeProperty. * * The #GladeEditorProperty is a factory that will create the correct - * control for the #GladePropertyClass it was created for and provides + * control for the #GladePropertyDef it was created for and provides * a simple unified api to them. */ @@ -57,7 +57,7 @@ enum { PROP_0, - PROP_PROPERTY_CLASS, + PROP_PROPERTY_DEFINITION, PROP_USE_COMMAND, PROP_DISABLE_CHECK, PROP_CUSTOM_TEXT @@ -82,7 +82,7 @@ static guint glade_eprop_signals[LAST_SIGNAL] = { 0, }; struct _GladeEditorPropertyPrivate { - GladePropertyClass *klass; /* The property class this GladeEditorProperty was created for */ + GladePropertyDef *property_def; /* The property definition this GladeEditorProperty was created for */ GladeProperty *property; /* The currently loaded property */ GtkWidget *item_label; /* A GladePropertyLabel, if one was constructed */ @@ -199,7 +199,7 @@ glade_editor_property_commit_common (GladeEditorProperty *eprop, * FIXME: find a better way to set focus? * make gtk_widget_grab_focus(eprop->priv->input) work? */ - if (glade_property_class_get_construct_only (eprop->priv->klass)) + if (glade_property_def_get_construct_only (eprop->priv->property_def)) { gboolean focus_set = FALSE; gtk_container_foreach (GTK_CONTAINER (eprop->priv->input), @@ -315,12 +315,18 @@ glade_editor_property_get_item_label (GladeEditorProperty *eprop) return eprop->priv->item_label; } -GladePropertyClass * -glade_editor_property_get_pclass (GladeEditorProperty *eprop) +/** + * glade_editor_property_get_property_def: + * @eprop: a #GladeEditorProperty + * + * Returns: (transfer none): the #GladePropertyDef + */ +GladePropertyDef * +glade_editor_property_get_property_def (GladeEditorProperty *eprop) { g_return_val_if_fail (GLADE_IS_EDITOR_PROPERTY (eprop), NULL); - return eprop->priv->klass; + return eprop->priv->property_def; } /** @@ -406,7 +412,7 @@ glade_editor_property_enabled_cb (GladeProperty *property, gboolean enabled; g_assert (eprop->priv->property == property); - if (glade_property_class_optional (eprop->priv->klass)) + if (glade_property_def_optional (eprop->priv->property_def)) { enabled = glade_property_get_enabled (property); @@ -448,7 +454,7 @@ glade_editor_property_constructed (GObject *object) /* Create hbox and possibly check button */ - if (glade_property_class_optional (eprop->priv->klass)) + if (glade_property_def_optional (eprop->priv->property_def)) { eprop->priv->check = gtk_check_button_new (); gtk_widget_set_focus_on_click (eprop->priv->check, FALSE); @@ -512,8 +518,8 @@ glade_editor_property_set_property (GObject *object, switch (prop_id) { - case PROP_PROPERTY_CLASS: - eprop->priv->klass = g_value_get_pointer (value); + case PROP_PROPERTY_DEFINITION: + eprop->priv->property_def = g_value_get_pointer (value); break; case PROP_USE_COMMAND: eprop->priv->use_command = g_value_get_boolean (value); @@ -540,8 +546,8 @@ glade_editor_property_real_get_property (GObject *object, switch (prop_id) { - case PROP_PROPERTY_CLASS: - g_value_set_pointer (value, eprop->priv->klass); + case PROP_PROPERTY_DEFINITION: + g_value_set_pointer (value, eprop->priv->property_def); break; case PROP_USE_COMMAND: g_value_set_boolean (value, eprop->priv->use_command); @@ -614,7 +620,7 @@ glade_editor_property_load_common (GladeEditorProperty *eprop, */ if (eprop->priv->property != property && property != NULL) { - GladePropertyClass *pclass = glade_property_get_class (property); + GladePropertyDef *pclass = glade_property_get_def (property); eprop->priv->property = property; @@ -648,7 +654,7 @@ glade_editor_property_load_common (GladeEditorProperty *eprop, /* Load initial tooltips */ glade_editor_property_tooltip_cb - (property, glade_property_class_get_tooltip (pclass), + (property, glade_property_def_get_tooltip (pclass), glade_propert_get_insensitive_tooltip (property), glade_property_get_support_warning (property), eprop); @@ -732,10 +738,10 @@ glade_editor_property_class_init (GladeEditorPropertyClass *eprop_class) /* Properties */ g_object_class_install_property - (object_class, PROP_PROPERTY_CLASS, + (object_class, PROP_PROPERTY_DEFINITION, g_param_spec_pointer - ("property-class", _("Property Class"), - _("The GladePropertyClass this GladeEditorProperty was created for"), + ("property-def", _("Property Definition"), + _("The GladePropertyDef this GladeEditorProperty was created for"), G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property @@ -806,7 +812,7 @@ glade_eprop_numeric_load (GladeEditorProperty *eprop, GladeProperty *property) if (property) { value = glade_property_inline_value (property); - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); if (G_IS_PARAM_SPEC_INT (pspec)) val = g_value_get_int (value); @@ -872,7 +878,7 @@ glade_eprop_numeric_changed (GtkWidget *spin, GladeEditorProperty *eprop) if (eprop->priv->loading) return; - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); g_value_init (&val, pspec->value_type); glade_eprop_numeric_value_set (&val, gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin))); @@ -885,7 +891,7 @@ glade_eprop_numeric_force_update (GtkSpinButton *spin, GladeEditorProperty *eprop) { GladeProperty *prop = glade_editor_property_get_property (eprop); - GladePropertyClass *klass = glade_property_get_class (prop); + GladePropertyDef *property_def = glade_property_get_def (prop); GValue *val, newval = G_VALUE_INIT; gdouble value; gchar *text; @@ -912,7 +918,7 @@ glade_eprop_numeric_force_update (GtkSpinButton *spin, * is removed, so selecting and inserting text will have * an appended 0). */ - if (glade_property_class_compare (klass, val, &newval)) + if (glade_property_def_compare (property_def, val, &newval)) { gdouble min, max; @@ -959,8 +965,8 @@ glade_eprop_numeric_create_input (GladeEditorProperty *eprop) GtkAdjustment *adjustment; GParamSpec *pspec; - pspec = glade_property_class_get_pspec (eprop->priv->klass); - adjustment = glade_property_class_make_adjustment (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); + adjustment = glade_property_def_make_adjustment (eprop->priv->property_def); eprop_numeric->spin = gtk_spin_button_new (adjustment, 0.01, G_IS_PARAM_SPEC_FLOAT (pspec) || @@ -1032,7 +1038,7 @@ glade_eprop_enum_load (GladeEditorProperty *eprop, GladeProperty *property) if (property) { - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); eclass = g_type_class_ref (pspec->value_type); value = g_value_get_enum (glade_property_inline_value (property)); @@ -1062,7 +1068,7 @@ glade_eprop_enum_changed (GtkWidget *combo_box, GladeEditorProperty *eprop) gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &iter); gtk_tree_model_get (tree_model, &iter, 1, &ival, -1); - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); g_value_init (&val, pspec->value_type); g_value_set_enum (&val, ival); @@ -1075,7 +1081,7 @@ static GtkWidget * glade_eprop_enum_create_input (GladeEditorProperty *eprop) { GladeEPropEnum *eprop_enum = GLADE_EPROP_ENUM (eprop); - GladePropertyClass *klass; + GladePropertyDef *property_def; GParamSpec *pspec; GEnumClass *eclass; GtkListStore *list_store; @@ -1083,8 +1089,8 @@ glade_eprop_enum_create_input (GladeEditorProperty *eprop) GtkCellRenderer *cell_renderer; guint i; - klass = eprop->priv->klass; - pspec = glade_property_class_get_pspec (klass); + property_def = eprop->priv->property_def; + pspec = glade_property_def_get_pspec (property_def); eclass = g_type_class_ref (pspec->value_type); list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT); @@ -1184,7 +1190,7 @@ glade_eprop_flags_load (GladeEditorProperty *eprop, GladeProperty *property) /* Populate the model with the flags. */ klass = g_type_class_ref (G_VALUE_TYPE (glade_property_inline_value (property))); value = g_value_get_flags (glade_property_inline_value (property)); - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); /* Step through each of the flags in the class. */ for (flag_num = 0; flag_num < klass->n_values; flag_num++) @@ -1447,7 +1453,7 @@ glade_eprop_color_load (GladeEditorProperty *eprop, GladeProperty *property) /* Chain up first */ editor_property_class->load (eprop, property); - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); if (property) { @@ -1532,7 +1538,7 @@ glade_eprop_color_changed (GtkWidget *button, GladeEditorProperty *eprop) if (eprop->priv->loading) return; - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); g_value_init (&value, pspec->value_type); gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &rgba); @@ -1571,7 +1577,7 @@ glade_eprop_color_create_input (GladeEditorProperty *eprop) GtkWidget *hbox; GParamSpec *pspec; - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_halign (hbox, GTK_ALIGN_START); @@ -1863,7 +1869,7 @@ glade_eprop_text_load (GladeEditorProperty *eprop, GladeProperty *property) if (property == NULL) return; - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); if (GTK_IS_COMBO_BOX (eprop_text->text_entry)) { @@ -1911,9 +1917,9 @@ glade_eprop_text_load (GladeEditorProperty *eprop, GladeProperty *property) if (pspec->value_type == G_TYPE_STRV || pspec->value_type == value_array_type) { - GladePropertyClass *pclass = glade_property_get_class (property); + GladePropertyDef *pclass = glade_property_get_def (property); gchar *text = glade_widget_adaptor_string_from_value - (glade_property_class_get_adaptor (pclass), + (glade_property_def_get_adaptor (pclass), pclass, glade_property_inline_value (property)); gchar *old_text = text_buffer_get_text (buffer); @@ -1960,7 +1966,7 @@ glade_eprop_text_changed_common (GladeEditorProperty *eprop, value_array_type = G_TYPE_VALUE_ARRAY; G_GNUC_END_IGNORE_DEPRECATIONS; - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); if (pspec->value_type == G_TYPE_STRV || pspec->value_type == value_array_type || @@ -1970,7 +1976,7 @@ glade_eprop_text_changed_common (GladeEditorProperty *eprop, { GladeWidget *gwidget = glade_property_get_widget (eprop->priv->property); - val = glade_property_class_make_gvalue_from_string (eprop->priv->klass, + val = glade_property_def_make_gvalue_from_string (eprop->priv->property_def, text, glade_widget_get_project (gwidget)); } @@ -2294,7 +2300,7 @@ glade_eprop_text_show_resource_dialog (GladeEditorProperty *eprop) if (glade_editor_property_show_resource_dialog (project, GTK_WIDGET (eprop), &text)) { - GParamSpec *pspec = glade_property_class_get_pspec (eprop->priv->klass); + GParamSpec *pspec = glade_property_def_get_pspec (eprop->priv->property_def); if (G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_FILE) { @@ -2404,7 +2410,7 @@ static GtkWidget * glade_eprop_text_create_input (GladeEditorProperty *eprop) { GladeEPropText *eprop_text = GLADE_EPROP_TEXT (eprop); - GladePropertyClass *klass; + GladePropertyDef *property_def; GParamSpec *pspec; GtkWidget *hbox; GType value_array_type; @@ -2414,13 +2420,13 @@ glade_eprop_text_create_input (GladeEditorProperty *eprop) value_array_type = G_TYPE_VALUE_ARRAY; G_GNUC_END_IGNORE_DEPRECATIONS; - klass = eprop->priv->klass; - pspec = glade_property_class_get_pspec (klass); + property_def = eprop->priv->property_def; + pspec = glade_property_def_get_pspec (property_def); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - if (glade_property_class_stock (klass) || - glade_property_class_stock_icon (klass)) + if (glade_property_def_stock (property_def) || + glade_property_def_stock_icon (property_def)) { GtkCellRenderer *renderer; GtkWidget *child; @@ -2432,7 +2438,7 @@ glade_eprop_text_create_input (GladeEditorProperty *eprop) glade_util_remove_scroll_events (combo); eprop_text->store = (GtkTreeModel *) - glade_eprop_text_create_store (glade_property_class_stock (klass) ? + glade_eprop_text_create_store (glade_property_def_stock (property_def) ? GLADE_TYPE_STOCK : GLADE_TYPE_STOCK_IMAGE); gtk_combo_box_set_model (GTK_COMBO_BOX (combo), @@ -2451,7 +2457,7 @@ glade_eprop_text_create_input (GladeEditorProperty *eprop) /* Dont allow custom items where an actual GTK+ stock item is expected * (i.e. real items come with labels) */ child = gtk_bin_get_child (GTK_BIN (combo)); - if (glade_property_class_stock (klass)) + if (glade_property_def_stock (property_def)) gtk_editable_set_editable (GTK_EDITABLE (child), FALSE); else gtk_editable_set_editable (GTK_EDITABLE (child), TRUE); @@ -2464,7 +2470,7 @@ glade_eprop_text_create_input (GladeEditorProperty *eprop) eprop_text->text_entry = combo; } - else if (glade_property_class_multiline (klass) || + else if (glade_property_def_multiline (property_def) || pspec->value_type == G_TYPE_STRV || pspec->value_type == value_array_type) { @@ -2522,7 +2528,7 @@ glade_eprop_text_create_input (GladeEditorProperty *eprop) } } - if (glade_property_class_translatable (klass)) + if (glade_property_def_translatable (property_def)) { if (GTK_IS_ENTRY (eprop_text->text_entry)) { @@ -2679,18 +2685,18 @@ static GtkWidget * glade_eprop_check_create_input (GladeEditorProperty *eprop) { GladeEPropCheck *eprop_check = GLADE_EPROP_CHECK (eprop); - GladePropertyClass *pclass; + GladePropertyDef *pclass; GtkWidget *label; - pclass = eprop->priv->klass; + pclass = eprop->priv->property_def; /* Add the property label as the check button's child */ label = glade_editor_property_get_item_label (eprop); glade_property_label_set_property_name (GLADE_PROPERTY_LABEL (label), - glade_property_class_id (pclass)); + glade_property_def_id (pclass)); glade_property_label_set_packing (GLADE_PROPERTY_LABEL (label), - glade_property_class_get_is_packing (pclass)); + glade_property_def_get_is_packing (pclass)); glade_property_label_set_append_colon (GLADE_PROPERTY_LABEL (label), FALSE); glade_property_label_set_custom_text (GLADE_PROPERTY_LABEL (label), eprop->priv->custom_text); @@ -3146,8 +3152,8 @@ glade_eprop_object_dialog_title (GladeEditorProperty *eprop) gboolean parentless; GParamSpec *pspec; - parentless = glade_property_class_parentless_widget (eprop->priv->klass); - pspec = glade_property_class_get_pspec (eprop->priv->klass); + parentless = glade_property_def_parentless_widget (eprop->priv->property_def); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); if (GLADE_IS_PARAM_SPEC_OBJECTS (pspec)) { @@ -3298,11 +3304,11 @@ glade_eprop_object_show_dialog (GladeEditorProperty *eprop) widget = glade_property_get_widget (eprop->priv->property); project = glade_widget_get_project (widget); parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop)); - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); - if (glade_property_class_create_type (eprop->priv->klass)) + if (glade_property_def_create_type (eprop->priv->property_def)) create_adaptor = - glade_widget_adaptor_get_by_name (glade_property_class_create_type (eprop->priv->klass)); + glade_widget_adaptor_get_by_name (glade_property_def_create_type (eprop->priv->property_def)); if (!create_adaptor && G_TYPE_IS_INSTANTIATABLE (pspec->value_type) && !G_TYPE_IS_ABSTRACT (pspec->value_type)) create_adaptor = glade_widget_adaptor_get_by_type (pspec->value_type); @@ -3367,7 +3373,7 @@ glade_eprop_object_show_dialog (GladeEditorProperty *eprop) glade_eprop_object_populate_view (project, GTK_TREE_VIEW (tree_view), selected_list, exception_list, pspec->value_type, - glade_property_class_parentless_widget (eprop->priv->klass)); + glade_property_def_parentless_widget (eprop->priv->property_def)); g_list_free (selected_list); g_list_free (exception_list); @@ -3401,20 +3407,20 @@ glade_eprop_object_show_dialog (GladeEditorProperty *eprop) glade_widget_get_object (widget), TRUE); - value = glade_property_class_make_gvalue_from_string - (eprop->priv->klass, glade_widget_get_name (selected), project); + value = glade_property_def_make_gvalue_from_string + (eprop->priv->property_def, glade_widget_get_name (selected), project); glade_property_get (eprop->priv->property, &old_object); new_object = g_value_get_object (value); new_widget = glade_widget_get_from_gobject (new_object); glade_command_push_group (_("Setting %s of %s to %s"), - glade_property_class_get_name (eprop->priv->klass), + glade_property_def_get_name (eprop->priv->property_def), glade_widget_get_name (widget), glade_widget_get_name (new_widget)); /* Unparent the widget so we can reuse it for this property */ - if (glade_property_class_parentless_widget (eprop->priv->klass)) + if (glade_property_def_parentless_widget (eprop->priv->property_def)) { GladeProperty *old_ref; @@ -3452,7 +3458,7 @@ glade_eprop_object_show_dialog (GladeEditorProperty *eprop) /* translators: Creating 'a widget' for 'a property' of 'a widget' */ glade_command_push_group (_("Creating %s for %s of %s"), glade_widget_adaptor_get_display_name (create_adaptor), - glade_property_class_get_name (eprop->priv->klass), + glade_property_def_get_name (eprop->priv->property_def), glade_widget_get_name (widget)); /* Dont bother if the user canceled the widget */ @@ -3481,7 +3487,7 @@ glade_eprop_object_show_dialog (GladeEditorProperty *eprop) else if (res == GLADE_RESPONSE_CLEAR) { GValue *value = - glade_property_class_make_gvalue_from_string (eprop->priv->klass, NULL, project); + glade_property_def_make_gvalue_from_string (eprop->priv->property_def, NULL, project); glade_editor_property_commit (eprop, value); @@ -3506,8 +3512,8 @@ glade_eprop_object_load (GladeEditorProperty *eprop, GladeProperty *property) return; if ((obj_name = glade_widget_adaptor_string_from_value - (glade_property_class_get_adaptor (eprop->priv->klass), - eprop->priv->klass, glade_property_inline_value (property))) != NULL) + (glade_property_def_get_adaptor (eprop->priv->property_def), + eprop->priv->property_def, glade_property_inline_value (property))) != NULL) { gtk_entry_set_text (GTK_ENTRY (eprop_object->entry), obj_name); g_free (obj_name); @@ -3574,8 +3580,8 @@ glade_eprop_objects_load (GladeEditorProperty *eprop, GladeProperty *property) return; if ((obj_name = glade_widget_adaptor_string_from_value - (glade_property_class_get_adaptor (eprop->priv->klass), - eprop->priv->klass, glade_property_inline_value (property))) != NULL) + (glade_property_def_get_adaptor (eprop->priv->property_def), + eprop->priv->property_def, glade_property_inline_value (property))) != NULL) { gtk_entry_set_text (GTK_ENTRY (eprop_objects->entry), obj_name); g_free (obj_name); @@ -3629,7 +3635,7 @@ glade_eprop_objects_show_dialog (GladeEditorProperty *eprop) widget = glade_property_get_widget (eprop->priv->property); project = glade_widget_get_project (widget); parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop)); - pspec = glade_property_class_get_pspec (eprop->priv->klass); + pspec = glade_property_def_get_pspec (eprop->priv->property_def); dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (parent), @@ -3679,7 +3685,7 @@ glade_eprop_objects_show_dialog (GladeEditorProperty *eprop) glade_eprop_object_populate_view (project, GTK_TREE_VIEW (tree_view), selected_list, exception_list, glade_param_spec_objects_get_type (GLADE_PARAM_SPEC_OBJECTS (pspec)), - glade_property_class_parentless_widget (eprop->priv->klass)); + glade_property_def_parentless_widget (eprop->priv->property_def)); g_list_free (selected_list); g_list_free (exception_list); @@ -3703,7 +3709,7 @@ glade_eprop_objects_show_dialog (GladeEditorProperty *eprop) if (selected) { glade_command_push_group (_("Setting %s of %s"), - glade_property_class_get_name (eprop->priv->klass), + glade_property_def_get_name (eprop->priv->property_def), glade_widget_get_name (widget)); /* Make sure the selected widgets have names now @@ -3717,7 +3723,7 @@ glade_eprop_objects_show_dialog (GladeEditorProperty *eprop) } } - value = glade_property_class_make_gvalue (eprop->priv->klass, selected); + value = glade_property_def_make_gvalue (eprop->priv->property_def, selected); glade_editor_property_commit (eprop, value); if (selected) @@ -3728,7 +3734,7 @@ glade_eprop_objects_show_dialog (GladeEditorProperty *eprop) } else if (res == GLADE_RESPONSE_CLEAR) { - GValue *value = glade_property_class_make_gvalue (eprop->priv->klass, NULL); + GValue *value = glade_property_def_make_gvalue (eprop->priv->property_def, NULL); glade_editor_property_commit (eprop, value); @@ -3818,10 +3824,10 @@ glade_editor_property_load_by_widget (GladeEditorProperty *eprop, if (widget) { /* properties are allowed to be missing on some internal widgets */ - if (glade_property_class_get_is_packing (eprop->priv->klass)) - property = glade_widget_get_pack_property (widget, glade_property_class_id (eprop->priv->klass)); + if (glade_property_def_get_is_packing (eprop->priv->property_def)) + property = glade_widget_get_pack_property (widget, glade_property_def_id (eprop->priv->property_def)); else - property = glade_widget_get_property (widget, glade_property_class_id (eprop->priv->klass)); + property = glade_widget_get_property (widget, glade_property_def_id (eprop->priv->property_def)); glade_editor_property_load (eprop, property); @@ -3830,7 +3836,7 @@ glade_editor_property_load_by_widget (GladeEditorProperty *eprop, if (property) { - g_assert (eprop->priv->klass == glade_property_get_class (property)); + g_assert (eprop->priv->property_def == glade_property_get_def (property)); gtk_widget_show (GTK_WIDGET (eprop)); diff --git a/gladeui/glade-editor-property.h b/gladeui/glade-editor-property.h index a90a893b..3398fc16 100644 --- a/gladeui/glade-editor-property.h +++ b/gladeui/glade-editor-property.h @@ -116,7 +116,7 @@ void glade_editor_property_set_disable_check (GladeEditorProper gboolean glade_editor_property_get_disable_check (GladeEditorProperty *eprop); GtkWidget *glade_editor_property_get_item_label (GladeEditorProperty *eprop); -GladePropertyClass *glade_editor_property_get_pclass (GladeEditorProperty *eprop); +GladePropertyDef *glade_editor_property_get_property_def (GladeEditorProperty *eprop); GladeProperty *glade_editor_property_get_property (GladeEditorProperty *eprop); gboolean glade_editor_property_loading (GladeEditorProperty *eprop); diff --git a/gladeui/glade-editor-table.c b/gladeui/glade-editor-table.c index 034a2231..6ab4c9f2 100644 --- a/gladeui/glade-editor-table.c +++ b/gladeui/glade-editor-table.c @@ -454,15 +454,15 @@ glade_editor_table_attach (GladeEditorTable * table, static gint property_class_comp (gconstpointer a, gconstpointer b) { - GladePropertyClass *ca = (GladePropertyClass *)a, *cb = (GladePropertyClass *)b; + GladePropertyDef *ca = (GladePropertyDef *)a, *cb = (GladePropertyDef *)b; GParamSpec *pa, *pb; const gchar *name_a, *name_b; - pa = glade_property_class_get_pspec (ca); - pb = glade_property_class_get_pspec (cb); + pa = glade_property_def_get_pspec (ca); + pb = glade_property_def_get_pspec (cb); - name_a = glade_property_class_id (ca); - name_b = glade_property_class_id (cb); + name_a = glade_property_def_id (ca); + name_b = glade_property_def_id (cb); /* Special case for the 'name' property, it *always* comes first. */ if (strcmp (name_a, "name") == 0) @@ -472,7 +472,7 @@ property_class_comp (gconstpointer a, gconstpointer b) /* Properties of the same class are sorted in the same level */ else if (pa->owner_type == pb->owner_type) { - gdouble result = glade_property_class_weight (ca) - glade_property_class_weight (cb); + gdouble result = glade_property_def_weight (ca) - glade_property_def_weight (cb); /* Avoid cast to int */ if (result < 0.0) return -1; @@ -485,9 +485,9 @@ property_class_comp (gconstpointer a, gconstpointer b) else { if (g_type_is_a (pa->owner_type, pb->owner_type)) - return (glade_property_class_common (ca) || glade_property_class_get_is_packing (ca)) ? 1 : -1; + return (glade_property_def_common (ca) || glade_property_def_get_is_packing (ca)) ? 1 : -1; else - return (glade_property_class_common (ca) || glade_property_class_get_is_packing (ca)) ? -1 : 1; + return (glade_property_def_common (ca) || glade_property_def_get_is_packing (ca)) ? -1 : 1; } } @@ -504,18 +504,18 @@ get_sorted_properties (GladeWidgetAdaptor *adaptor, GladeEditorPageType type) for (l = properties; l; l = g_list_next (l)) { - GladePropertyClass *klass = l->data; + GladePropertyDef *def = l->data; /* Collect properties in our domain, query dialogs are allowed editor * invisible (or custom-layout) properties, allow adaptors to filter * out properties from the GladeEditorTable using the "custom-layout" attribute. */ - if (GLADE_PROPERTY_CLASS_IS_TYPE (klass, type) && + if (GLADE_PROPERTY_DEF_IS_TYPE (def, type) && (type == GLADE_PAGE_QUERY || - (!glade_property_class_custom_layout (klass) && - glade_property_class_is_visible (klass)))) + (!glade_property_def_custom_layout (def) && + glade_property_def_is_visible (def)))) { - list = g_list_prepend (list, klass); + list = g_list_prepend (list, def); } } @@ -523,19 +523,19 @@ get_sorted_properties (GladeWidgetAdaptor *adaptor, GladeEditorPageType type) } static GladeEditorProperty * -append_item (GladeEditorTable *table, - GladePropertyClass *klass, - gboolean from_query_dialog) +append_item (GladeEditorTable *table, + GladePropertyDef *def, + gboolean from_query_dialog) { GladeEditorProperty *property; GtkWidget *label; if (!(property = glade_widget_adaptor_create_eprop - (glade_property_class_get_adaptor (klass), klass, from_query_dialog == FALSE))) + (glade_property_def_get_adaptor (def), def, from_query_dialog == FALSE))) { g_critical ("Unable to create editor for property '%s' of class '%s'", - glade_property_class_id (klass), - glade_widget_adaptor_get_name (glade_property_class_get_adaptor (klass))); + glade_property_def_id (def), + glade_widget_adaptor_get_name (glade_property_def_get_adaptor (def))); return NULL; } @@ -559,15 +559,15 @@ append_items (GladeEditorTable *table, GladeEditorPageType type) { GladeEditorProperty *property; - GladePropertyClass *property_class; + GladePropertyDef *property_def; GList *list, *sorted_list; sorted_list = get_sorted_properties (adaptor, type); for (list = sorted_list; list != NULL; list = list->next) { - property_class = (GladePropertyClass *) list->data; + property_def = (GladePropertyDef *) list->data; - property = append_item (table, property_class, type == GLADE_PAGE_QUERY); + property = append_item (table, property_def, type == GLADE_PAGE_QUERY); table->priv->properties = g_list_prepend (table->priv->properties, property); } g_list_free (sorted_list); diff --git a/gladeui/glade-editor.c b/gladeui/glade-editor.c index 450df1b1..d98c869c 100644 --- a/gladeui/glade-editor.c +++ b/gladeui/glade-editor.c @@ -44,7 +44,7 @@ #include "glade-editor.h" #include "glade-signal-editor.h" #include "glade-property.h" -#include "glade-property-class.h" +#include "glade-property-def.h" #include "glade-command.h" #include "glade-debug.h" #include "glade-marshallers.h" @@ -935,7 +935,7 @@ glade_editor_populate_reset_view (GladeWidget *widget, GtkTreeView *tree_view) GtkTreeIter property_iter, general_iter, common_iter, atk_iter, *iter; GList *list; GladeProperty *property; - GladePropertyClass *pclass; + GladePropertyDef *pdef; gboolean def; g_return_if_fail (widget != NULL); @@ -968,14 +968,14 @@ glade_editor_populate_reset_view (GladeWidget *widget, GtkTreeView *tree_view) for (list = glade_widget_get_properties (widget); list; list = list->next) { property = list->data; - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); - if (glade_property_class_is_visible (pclass) == FALSE) + if (glade_property_def_is_visible (pdef) == FALSE) continue; - if (glade_property_class_atk (pclass)) + if (glade_property_def_atk (pdef)) iter = &atk_iter; - else if (glade_property_class_common (pclass)) + else if (glade_property_def_common (pdef)) iter = &common_iter; else iter = &general_iter; @@ -985,7 +985,7 @@ glade_editor_populate_reset_view (GladeWidget *widget, GtkTreeView *tree_view) gtk_tree_store_append (model, &property_iter, iter); gtk_tree_store_set (model, &property_iter, COLUMN_ENABLED, !def, - COLUMN_PROP_NAME, glade_property_class_get_name (pclass), + COLUMN_PROP_NAME, glade_property_def_get_name (pdef), COLUMN_PROPERTY, property, COLUMN_WEIGHT, PANGO_WEIGHT_NORMAL, COLUMN_CHILD, TRUE, @@ -1003,7 +1003,7 @@ glade_editor_reset_selection_changed_cb (GtkTreeSelection *selection, GladeProperty *property = NULL; GtkTreeModel *model = NULL; GtkTextBuffer *text_buffer; - GladePropertyClass *pclass = NULL; + GladePropertyDef *pdef = NULL; const gchar *message = _("Select the properties that you want to reset to their default values"); @@ -1015,10 +1015,10 @@ glade_editor_reset_selection_changed_cb (GtkTreeSelection *selection, gtk_tree_model_get (model, &iter, COLUMN_PROPERTY, &property, -1); if (property) - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); gtk_text_buffer_set_text (text_buffer, - pclass ? glade_property_class_get_tooltip (pclass) : message, + pdef ? glade_property_def_get_tooltip (pdef) : message, -1); if (property) g_object_unref (G_OBJECT (property)); diff --git a/gladeui/glade-popup.c b/gladeui/glade-popup.c index ecab7125..7745b0ad 100644 --- a/gladeui/glade-popup.c +++ b/gladeui/glade-popup.c @@ -578,15 +578,15 @@ static void glade_popup_property_docs_cb (GtkMenuItem *item, GladeProperty *property) { GladeWidgetAdaptor *adaptor, *prop_adaptor; - GladePropertyClass *pclass; + GladePropertyDef *pdef; GParamSpec *pspec; gchar *search; - pclass = glade_property_get_class (property); - pspec = glade_property_class_get_pspec (pclass); - prop_adaptor = glade_property_class_get_adaptor (pclass); + pdef = glade_property_get_def (property); + pspec = glade_property_def_get_pspec (pdef); + prop_adaptor = glade_property_def_get_adaptor (pdef); adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec); - search = g_strdup_printf ("The \"%s\" property", glade_property_class_id (pclass)); + search = g_strdup_printf ("The \"%s\" property", glade_property_def_id (pdef)); glade_app_search_docs (glade_widget_adaptor_get_book (adaptor), g_type_name (pspec->owner_type), search); @@ -599,15 +599,15 @@ glade_popup_property_pop (GladeProperty *property, GdkEventButton *event) { GladeWidgetAdaptor *adaptor, *prop_adaptor; - GladePropertyClass *pclass; + GladePropertyDef *pdef; GParamSpec *pspec; GtkWidget *popup_menu; gint button; gint event_time; - pclass = glade_property_get_class (property); - pspec = glade_property_class_get_pspec (pclass); - prop_adaptor = glade_property_class_get_adaptor (pclass); + pdef = glade_property_get_def (property); + pspec = glade_property_def_get_pspec (pdef); + prop_adaptor = glade_property_def_get_adaptor (pdef); adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec); g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor)); @@ -617,7 +617,7 @@ glade_popup_property_pop (GladeProperty *property, GdkEventButton *event) glade_popup_append_item (popup_menu, _("Set default value"), TRUE, glade_popup_clear_property_cb, property); - if (!glade_property_class_get_virtual (pclass) && + if (!glade_property_def_get_virtual (pdef) && glade_widget_adaptor_get_book (adaptor) && glade_util_have_devhelp ()) { diff --git a/gladeui/glade-private.h b/gladeui/glade-private.h index a57ab8e8..f2dde177 100644 --- a/gladeui/glade-private.h +++ b/gladeui/glade-private.h @@ -30,6 +30,7 @@ #include "glade-widget.h" #include "glade-project-properties.h" +#include "glade-property-def.h" G_BEGIN_DECLS @@ -76,6 +77,10 @@ _glade_project_properties_get_license_data (GladeProjectProperties *props, gchar **copyright, gchar **authors); +/* glade-property-def.c */ +void +_glade_property_def_reset_version (GladePropertyDef *property_def); + /* glade-utils.c */ void _glade_util_dialog_set_hig (GtkDialog *dialog); diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c index 323360ba..f723870c 100644 --- a/gladeui/glade-project.c +++ b/gladeui/glade-project.c @@ -1212,12 +1212,12 @@ glade_project_model_get_value (GtkTreeModel *model, else if ((ref_prop = glade_widget_get_parentless_widget_ref (widget)) != NULL) { - GladePropertyClass *pclass = glade_property_get_class (ref_prop); - GladeWidget *ref_widget = glade_property_get_widget (ref_prop); + GladePropertyDef *pdef = glade_property_get_def (ref_prop); + GladeWidget *ref_widget = glade_property_get_widget (ref_prop); /* translators: refers to a property named '%s' of widget '%s' */ str = g_strdup_printf (_("(%s of %s)"), - glade_property_class_get_name (pclass), + glade_property_def_get_name (pdef), glade_widget_get_name (ref_widget)); } @@ -1389,19 +1389,19 @@ glade_project_fix_object_props (GladeProject *project) for (ll = glade_widget_get_properties (gwidget); ll; ll = ll->next) { - GladePropertyClass *klass; + GladePropertyDef *def; property = GLADE_PROPERTY (ll->data); - klass = glade_property_get_class (property); + def = glade_property_get_def (property); - if (glade_property_class_is_object (klass) && + if (glade_property_def_is_object (def) && (txt = g_object_get_data (G_OBJECT (property), "glade-loaded-object")) != NULL) { /* Parse the object list and set the property to it * (this magicly works for both objects & object lists) */ - value = glade_property_class_make_gvalue_from_string (klass, txt, project); + value = glade_property_def_make_gvalue_from_string (def, txt, project); glade_property_set_value (property, value); @@ -1598,12 +1598,12 @@ update_project_for_resource_path (GladeProject *project) for (list = glade_widget_get_properties (widget); list; list = list->next) { - GladePropertyClass *klass; - GParamSpec *pspec; + GladePropertyDef *def; + GParamSpec *pspec; property = list->data; - klass = glade_property_get_class (property); - pspec = glade_property_class_get_pspec (klass); + def = glade_property_get_def (property); + pspec = glade_property_def_get_pspec (def); /* XXX We should have a "resource" flag on properties that need * to be loaded from the resource path, but that would require @@ -1617,7 +1617,7 @@ update_project_for_resource_path (GladeProject *project) gchar *string; string = glade_property_make_string (property); - value = glade_property_class_make_gvalue_from_string (klass, string, project); + value = glade_property_def_make_gvalue_from_string (def, string, project); glade_property_set_value (property, value); @@ -1851,7 +1851,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); + GladePropertyDef *pdef = glade_property_get_def (property); GladeWidgetAdaptor *prop_adaptor, *adaptor; GParamSpec *pspec; @@ -1860,8 +1860,8 @@ glade_project_introspect_gtk_version (GladeProject *project) continue; /* Check if this property originates from a GTK+ widget class */ - pspec = glade_property_class_get_pspec (pclass); - prop_adaptor = glade_property_class_get_adaptor (pclass); + pspec = glade_property_def_get_pspec (pdef); + prop_adaptor = glade_property_def_get_adaptor (pdef); adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec); catalog = NULL; @@ -1873,10 +1873,10 @@ glade_project_introspect_gtk_version (GladeProject *project) /* Check GTK+ property class versions */ if (is_gtk_adaptor && - !GPC_VERSION_CHECK (pclass, target_major, target_minor)) + !GPC_VERSION_CHECK (pdef, target_major, target_minor)) { - target_major = glade_property_class_since_major (pclass); - target_minor = glade_property_class_since_minor (pclass); + target_major = glade_property_def_since_major (pdef); + target_minor = glade_property_def_since_minor (pdef); } } @@ -2464,14 +2464,14 @@ glade_project_widget_hard_depends (GladeWidget *widget, GladeWidget *another) for (l = _glade_widget_peek_prop_refs (another); l; l = g_list_next (l)) { - GladePropertyClass *klass; + GladePropertyDef *def; /* If one of the properties that reference @another is * owned by @widget then @widget depends on @another */ if (glade_property_get_widget (l->data) == widget && - (klass = glade_property_get_class (l->data)) && - glade_property_class_get_construct_only (klass)) + (def = glade_property_get_def (l->data)) && + glade_property_def_get_construct_only (def)) return TRUE; } @@ -2830,9 +2830,9 @@ update_project_resource_path (GladeProject *project, gchar *path) for (list = glade_widget_get_properties (widget); list; list = list->next) { - GladeProperty *property = list->data; - GladePropertyClass *klass = glade_property_get_class (property); - GParamSpec *pspec = glade_property_class_get_pspec (klass); + GladeProperty *property = list->data; + GladePropertyDef *def = glade_property_get_def (property); + GParamSpec *pspec = glade_property_def_get_pspec (def); if (pspec->value_type == GDK_TYPE_PIXBUF) { @@ -2873,9 +2873,9 @@ sync_project_resource_path (GladeProject *project) for (list = glade_widget_get_properties (widget); list; list = list->next) { - GladeProperty *property = list->data; - GladePropertyClass *klass = glade_property_get_class (property); - GParamSpec *pspec = glade_property_class_get_pspec (klass); + GladeProperty *property = list->data; + GladePropertyDef *def = glade_property_get_def (property); + GParamSpec *pspec = glade_property_def_get_pspec (def); if (pspec->value_type == GDK_TYPE_PIXBUF) { @@ -2888,9 +2888,9 @@ sync_project_resource_path (GladeProject *project) continue; filename = g_object_get_data (pixbuf, "GladeFileName"); - value = glade_property_class_make_gvalue_from_string (klass, - filename, - project); + value = glade_property_def_make_gvalue_from_string (def, + filename, + project); glade_property_set_value (property, value); g_value_unset (value); g_free (value); @@ -3145,7 +3145,7 @@ glade_project_verify_property_internal (GladeProject *project, GladeVerifyFlags flags) { GladeWidgetAdaptor *adaptor, *prop_adaptor; - GladePropertyClass *pclass; + GladePropertyDef *pdef; GParamSpec *pspec; gint target_major, target_minor; gchar *catalog, *tooltip; @@ -3158,9 +3158,9 @@ glade_project_verify_property_internal (GladeProject *project, if (!forwidget && (glade_property_get_state (property) & GLADE_STATE_CHANGED) == 0) return; - pclass = glade_property_get_class (property); - pspec = glade_property_class_get_pspec (pclass); - prop_adaptor = glade_property_class_get_adaptor (pclass); + pdef = glade_property_get_def (property); + pspec = glade_property_def_get_pspec (pdef); + prop_adaptor = glade_property_def_get_adaptor (pdef); adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec); g_object_get (adaptor, "catalog", &catalog, NULL); @@ -3168,10 +3168,10 @@ glade_project_verify_property_internal (GladeProject *project, &target_major, &target_minor); if ((flags & GLADE_VERIFY_VERSIONS) != 0 && - !GPC_VERSION_CHECK (pclass, target_major, target_minor)) + !GPC_VERSION_CHECK (pdef, target_major, target_minor)) { GLADE_NOTE (VERIFY, g_print ("VERIFY: Property '%s' of adaptor %s not available in version %d.%d\n", - glade_property_class_id (pclass), + glade_property_def_id (pclass), glade_widget_adaptor_get_name (adaptor), target_major, target_minor)); @@ -3179,8 +3179,8 @@ glade_project_verify_property_internal (GladeProject *project, { tooltip = g_strdup_printf (PROP_VERSION_CONFLICT_MSGFMT, catalog, - glade_property_class_since_major (pclass), - glade_property_class_since_minor (pclass), + glade_property_def_since_major (pdef), + glade_property_def_since_minor (pdef), catalog, target_major, target_minor); glade_property_set_support_warning (property, FALSE, tooltip); @@ -3188,21 +3188,21 @@ glade_project_verify_property_internal (GladeProject *project, } else g_string_append_printf (string, - glade_property_class_get_is_packing (pclass) ? + glade_property_def_get_is_packing (pdef) ? PACK_PROP_VERSION_CONFLICT_FMT : PROP_VERSION_CONFLICT_FMT, path_name, - glade_property_class_get_name (pclass), + glade_property_def_get_name (pdef), glade_widget_adaptor_get_title (adaptor), catalog, - glade_property_class_since_major (pclass), - glade_property_class_since_minor (pclass)); + glade_property_def_since_major (pdef), + glade_property_def_since_minor (pdef)); } else if ((flags & GLADE_VERIFY_DEPRECATIONS) != 0 && - glade_property_class_deprecated (pclass)) + glade_property_def_deprecated (pdef)) { GLADE_NOTE (VERIFY, g_print ("VERIFY: Property '%s' of adaptor %s is deprecated\n", - glade_property_class_id (pclass), + glade_property_def_id (pdef), glade_widget_adaptor_get_name (adaptor))); if (forwidget) @@ -3211,7 +3211,7 @@ glade_project_verify_property_internal (GladeProject *project, g_string_append_printf (string, PROP_DEPRECATED_FMT, path_name, - glade_property_class_get_name (pclass), + glade_property_def_get_name (pdef), glade_widget_adaptor_get_title (adaptor)); } else if (forwidget) diff --git a/gladeui/glade-property-class.h b/gladeui/glade-property-class.h deleted file mode 100644 index c5c362e3..00000000 --- a/gladeui/glade-property-class.h +++ /dev/null @@ -1,171 +0,0 @@ -#ifndef __GLADE_PROPERTY_CLASS_H__ -#define __GLADE_PROPERTY_CLASS_H__ - -#include <glib.h> -#include <glib-object.h> -#include <gtk/gtk.h> - -#include <gladeui/glade-xml-utils.h> - -G_BEGIN_DECLS - -/* The GladePropertyClass structure parameters of a GladeProperty. - * All entries in the GladeEditor are GladeProperties (except signals) - * All GladeProperties are associated with a GParamSpec. - */ -#define GLADE_PROPERTY_CLASS(gpc) ((GladePropertyClass *) gpc) -#define GLADE_IS_PROPERTY_CLASS(gpc) (gpc != NULL) - - -/** - * GLADE_PROPERTY_CLASS_IS_TYPE: - * @gpc: A #GladePropertyClass - * @type: The #GladeEditorPageType to query - * - * Checks if @gpc is good to be loaded as @type - */ -#define GLADE_PROPERTY_CLASS_IS_TYPE(gpc, type) \ - (((type) == GLADE_PAGE_GENERAL && \ - !glade_property_class_common (gpc) && \ - !glade_property_class_get_is_packing (gpc) && \ - !glade_property_class_atk (gpc)) || \ - ((type) == GLADE_PAGE_COMMON && glade_property_class_common (gpc)) || \ - ((type) == GLADE_PAGE_PACKING && glade_property_class_get_is_packing (gpc)) || \ - ((type) == GLADE_PAGE_ATK && glade_property_class_atk (gpc)) || \ - ((type) == GLADE_PAGE_QUERY && glade_property_class_query (gpc))) - -/** - * GPC_VERSION_CHECK: - * @klass: A #GladePropertyClass - * @major_version: The major version to check - * @minor_version: The minor version to check - * - * Evaluates to %TRUE if @klass is available in its owning library version-@major_verion.@minor_version. - * - */ -#define GPC_VERSION_CHECK(klass, major_version, minor_version) \ - ((glade_property_class_since_major (GLADE_PROPERTY_CLASS (klass)) == major_version) ? \ - (glade_property_class_since_minor (GLADE_PROPERTY_CLASS (klass)) <= minor_version) : \ - (glade_property_class_since_major (GLADE_PROPERTY_CLASS (klass)) <= major_version)) - - -#define GPC_OBJECT_DELIMITER ", " -#define GPC_PROPERTY_NAMELEN 512 /* Enough space for a property name I think */ - -typedef struct _GladePropertyClass GladePropertyClass; - - -GladePropertyClass *glade_property_class_new (GladeWidgetAdaptor *adaptor, - const gchar *id); -GladePropertyClass *glade_property_class_new_from_spec (GladeWidgetAdaptor *adaptor, - GParamSpec *spec); -GladePropertyClass *glade_property_class_new_from_spec_full (GladeWidgetAdaptor *adaptor, - GParamSpec *spec, - gboolean need_handle); -GladePropertyClass *glade_property_class_clone (GladePropertyClass *property_class, - gboolean reset_version); -void glade_property_class_free (GladePropertyClass *property_class); - -void glade_property_class_set_adaptor (GladePropertyClass *property_class, - GladeWidgetAdaptor *adaptor); -GladeWidgetAdaptor *glade_property_class_get_adaptor (GladePropertyClass *property_class); -void glade_property_class_set_pspec (GladePropertyClass *property_class, - GParamSpec *pspec); -GParamSpec *glade_property_class_get_pspec (GladePropertyClass *property_class); -void glade_property_class_set_is_packing (GladePropertyClass *property_class, - gboolean is_packing); -gboolean glade_property_class_get_is_packing (GladePropertyClass *property_class); -gboolean glade_property_class_save (GladePropertyClass *property_class); -gboolean glade_property_class_save_always (GladePropertyClass *property_class); -gboolean glade_property_class_is_visible (GladePropertyClass *property_class); -gboolean glade_property_class_is_object (GladePropertyClass *property_class); -void glade_property_class_set_virtual (GladePropertyClass *property_class, - gboolean value); -gboolean glade_property_class_get_virtual (GladePropertyClass *property_class); -void glade_property_class_set_ignore (GladePropertyClass *property_class, - gboolean ignore); -gboolean glade_property_class_get_ignore (GladePropertyClass *property_class); -void glade_property_class_set_name (GladePropertyClass *property_class, - const gchar *name); -G_CONST_RETURN gchar *glade_property_class_get_name (GladePropertyClass *property_class); -void glade_property_class_set_tooltip (GladePropertyClass *property_class, - const gchar *tooltip); -G_CONST_RETURN gchar *glade_property_class_get_tooltip (GladePropertyClass *property_class); -G_CONST_RETURN gchar *glade_property_class_id (GladePropertyClass *property_class); -gboolean glade_property_class_themed_icon (GladePropertyClass *property_class); -void glade_property_class_set_construct_only (GladePropertyClass *property_class, - gboolean construct_only); -gboolean glade_property_class_get_construct_only (GladePropertyClass *property_class); -G_CONST_RETURN GValue *glade_property_class_get_default (GladePropertyClass *property_class); -G_CONST_RETURN GValue *glade_property_class_get_original_default (GladePropertyClass *property_class); -gboolean glade_property_class_translatable (GladePropertyClass *property_class); -gboolean glade_property_class_needs_sync (GladePropertyClass *property_class); - -gboolean glade_property_class_query (GladePropertyClass *property_class); -gboolean glade_property_class_atk (GladePropertyClass *property_class); -gboolean glade_property_class_common (GladePropertyClass *property_class); -gboolean glade_property_class_parentless_widget (GladePropertyClass *property_class); -gboolean glade_property_class_optional (GladePropertyClass *property_class); -gboolean glade_property_class_optional_default (GladePropertyClass *property_class); -gboolean glade_property_class_multiline (GladePropertyClass *property_class); -gboolean glade_property_class_stock (GladePropertyClass *property_class); -gboolean glade_property_class_stock_icon (GladePropertyClass *property_class); -gboolean glade_property_class_transfer_on_paste (GladePropertyClass *property_class); -gboolean glade_property_class_custom_layout (GladePropertyClass *property_class); -gdouble glade_property_class_weight (GladePropertyClass *property_class); - -G_CONST_RETURN gchar *glade_property_class_create_type (GladePropertyClass *property_class); - -guint16 glade_property_class_since_major (GladePropertyClass *property_class); -guint16 glade_property_class_since_minor (GladePropertyClass *property_class); -gboolean glade_property_class_deprecated (GladePropertyClass *property_class); - -GValue *glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class, - const gchar *string, - GladeProject *project); - -gchar *glade_property_class_make_string_from_gvalue (GladePropertyClass *property_class, - const GValue *value); - -GValue *glade_property_class_make_gvalue_from_vl (GladePropertyClass *property_class, - va_list vl); - -void glade_property_class_set_vl_from_gvalue (GladePropertyClass *klass, - GValue *value, - va_list vl); - -GValue *glade_property_class_make_gvalue (GladePropertyClass *klass, - ...); - -void glade_property_class_get_from_gvalue (GladePropertyClass *klass, - GValue *value, - ...); - -gboolean glade_property_class_update_from_node (GladeXmlNode *node, - GType object_type, - GladePropertyClass **property_class, - const gchar *domain); - -GtkAdjustment *glade_property_class_make_adjustment (GladePropertyClass *property_class); - -gboolean glade_property_class_match (GladePropertyClass *klass, - GladePropertyClass *comp); - -gboolean glade_property_class_void_value (GladePropertyClass *klass, - GValue *value); - -gint glade_property_class_compare (GladePropertyClass *klass, - const GValue *value1, - const GValue *value2); - -GValue *glade_property_class_get_default_from_spec (GParamSpec *spec); - -void glade_property_class_set_weights (GList **properties, GType parent); - -void glade_property_class_load_defaults_from_spec (GladePropertyClass *property_class); - -guint glade_property_class_make_flags_from_string (GType type, - const char *string); -G_END_DECLS - -#endif /* __GLADE_PROPERTY_CLASS_H__ */ diff --git a/gladeui/glade-property-class.c b/gladeui/glade-property-def.c index ba668d54..7d60b693 100644 --- a/gladeui/glade-property-class.c +++ b/gladeui/glade-property-def.c @@ -25,11 +25,11 @@ #endif /** - * SECTION:glade-property-class - * @Title: GladePropertyClass - * @Short_Description: Property Class-wide metadata. + * SECTION:glade-property-def + * @Title: GladePropertyDef + * @Short_Description: Property Definition metadata. * - * #GladePropertyClass is a structure based on a #GParamSpec and parameters + * #GladePropertyDef is a structure based on a #GParamSpec and parameters * from the Glade catalog files and describes how properties are to be handled * in Glade; it also provides an interface to convert #GValue to strings and * va_lists etc (back and forth). @@ -42,7 +42,7 @@ #include "glade.h" #include "glade-widget.h" #include "glade-property.h" -#include "glade-property-class.h" +#include "glade-property-def.h" #include "glade-editor-property.h" #include "glade-displayable-values.h" #include "glade-debug.h" @@ -56,7 +56,7 @@ #define FLOATING_PAGE_SIZE 0.00F -struct _GladePropertyClass +struct _GladePropertyDef { GladeWidgetAdaptor *adaptor; /* The GladeWidgetAdaptor that this property class * was created for. @@ -154,7 +154,7 @@ struct _GladePropertyClass * this property will by synced with virtual properties. */ - guint is_modified : 1; /* If true, this property_class has been "modified" from the + guint is_modified : 1; /* If true, this property_def has been "modified" from the * the standard property by a xml file. */ guint themed_icon : 1; /* Some GParamSpecString properties reffer to icon names @@ -188,147 +188,141 @@ struct _GladePropertyClass */ }; +G_DEFINE_BOXED_TYPE (GladePropertyDef, glade_property_def, glade_property_def_clone, glade_property_def_free) + /** - * glade_property_class_new: + * glade_property_def_new: * @adaptor: The #GladeWidgetAdaptor to create this property for * @id: the id for the new property class * - * Returns: a new #GladePropertyClass + * Returns: a new #GladePropertyDef */ -GladePropertyClass * -glade_property_class_new (GladeWidgetAdaptor *adaptor, +GladePropertyDef * +glade_property_def_new (GladeWidgetAdaptor *adaptor, const gchar *id) { - GladePropertyClass *property_class; - - property_class = g_slice_new0 (GladePropertyClass); - property_class->adaptor = adaptor; - property_class->pspec = NULL; - property_class->id = g_strdup (id); - property_class->name = NULL; - property_class->tooltip = NULL; - property_class->def = NULL; - property_class->orig_def = NULL; - property_class->query = FALSE; - property_class->optional = FALSE; - property_class->optional_default = FALSE; - property_class->is_modified = FALSE; - property_class->common = FALSE; - property_class->packing = FALSE; - property_class->atk = FALSE; - property_class->visible = TRUE; - property_class->custom_layout = FALSE; - property_class->save = TRUE; - property_class->save_always = FALSE; - property_class->ignore = FALSE; - property_class->needs_sync = FALSE; - property_class->themed_icon = FALSE; - property_class->stock = FALSE; - property_class->stock_icon = FALSE; - property_class->translatable = FALSE; - property_class->virt = TRUE; - property_class->transfer_on_paste = FALSE; - property_class->weight = -1.0; - property_class->parentless_widget = FALSE; - property_class->create_type = NULL; + GladePropertyDef *property_def; + + property_def = g_slice_new0 (GladePropertyDef); + property_def->adaptor = adaptor; + property_def->pspec = NULL; + property_def->id = g_strdup (id); + property_def->name = NULL; + property_def->tooltip = NULL; + property_def->def = NULL; + property_def->orig_def = NULL; + property_def->query = FALSE; + property_def->optional = FALSE; + property_def->optional_default = FALSE; + property_def->is_modified = FALSE; + property_def->common = FALSE; + property_def->packing = FALSE; + property_def->atk = FALSE; + property_def->visible = TRUE; + property_def->custom_layout = FALSE; + property_def->save = TRUE; + property_def->save_always = FALSE; + property_def->ignore = FALSE; + property_def->needs_sync = FALSE; + property_def->themed_icon = FALSE; + property_def->stock = FALSE; + property_def->stock_icon = FALSE; + property_def->translatable = FALSE; + property_def->virt = TRUE; + property_def->transfer_on_paste = FALSE; + property_def->weight = -1.0; + property_def->parentless_widget = FALSE; + property_def->create_type = NULL; /* Initialize property versions & deprecated to adaptor */ - property_class->version_since_major = GWA_VERSION_SINCE_MAJOR (adaptor); - property_class->version_since_minor = GWA_VERSION_SINCE_MINOR (adaptor); - property_class->deprecated = GWA_DEPRECATED (adaptor); + property_def->version_since_major = GWA_VERSION_SINCE_MAJOR (adaptor); + property_def->version_since_minor = GWA_VERSION_SINCE_MINOR (adaptor); + property_def->deprecated = GWA_DEPRECATED (adaptor); - return property_class; + return property_def; } /** - * glade_property_class_clone: - * @property_class: a #GladePropertyClass - * @reset_version: whether the introduction version should be reset in the clone + * glade_property_def_clone: + * @property_def: a #GladePropertyDef * - * Returns: a new #GladePropertyClass cloned from @property_class + * Returns: (transfer full): a new #GladePropertyDef cloned from @property_def */ -GladePropertyClass * -glade_property_class_clone (GladePropertyClass *property_class, - gboolean reset_version) +GladePropertyDef * +glade_property_def_clone (GladePropertyDef *property_def) { - GladePropertyClass *clone; + GladePropertyDef *clone; - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), NULL); - clone = g_new0 (GladePropertyClass, 1); + clone = g_new0 (GladePropertyDef, 1); /* copy ints over */ - memcpy (clone, property_class, sizeof (GladePropertyClass)); - - if (reset_version) - { - clone->version_since_major = 0; - clone->version_since_minor = 0; - } + memcpy (clone, property_def, sizeof (GladePropertyDef)); /* Make sure we own our strings */ - clone->pspec = property_class->pspec; + clone->pspec = property_def->pspec; clone->id = g_strdup (clone->id); clone->name = g_strdup (clone->name); clone->tooltip = g_strdup (clone->tooltip); - if (G_IS_VALUE (property_class->def)) + if (G_IS_VALUE (property_def->def)) { clone->def = g_new0 (GValue, 1); - g_value_init (clone->def, property_class->pspec->value_type); - g_value_copy (property_class->def, clone->def); + g_value_init (clone->def, property_def->pspec->value_type); + g_value_copy (property_def->def, clone->def); } - if (G_IS_VALUE (property_class->orig_def)) + if (G_IS_VALUE (property_def->orig_def)) { clone->orig_def = g_new0 (GValue, 1); - g_value_init (clone->orig_def, property_class->pspec->value_type); - g_value_copy (property_class->orig_def, clone->orig_def); + g_value_init (clone->orig_def, property_def->pspec->value_type); + g_value_copy (property_def->orig_def, clone->orig_def); } - if (property_class->create_type) - clone->create_type = g_strdup (property_class->create_type); + if (property_def->create_type) + clone->create_type = g_strdup (property_def->create_type); return clone; } /** - * glade_property_class_free: - * @property_class: a #GladePropertyClass + * glade_property_def_free: + * @property_def: a #GladePropertyDef * - * Frees @klass and its associated memory. + * Frees @property_def and its associated memory. */ void -glade_property_class_free (GladePropertyClass * property_class) +glade_property_def_free (GladePropertyDef *property_def) { - if (property_class == NULL) + if (property_def == NULL) return; - g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class)); + g_return_if_fail (GLADE_IS_PROPERTY_DEF (property_def)); - g_clear_pointer (&property_class->id, g_free); - g_clear_pointer (&property_class->name, g_free); - g_clear_pointer (&property_class->tooltip, g_free); - if (property_class->orig_def) + g_clear_pointer (&property_def->id, g_free); + g_clear_pointer (&property_def->name, g_free); + g_clear_pointer (&property_def->tooltip, g_free); + if (property_def->orig_def) { - if (G_VALUE_TYPE (property_class->orig_def) != 0) - g_value_unset (property_class->orig_def); - g_clear_pointer (&property_class->orig_def, g_free); + if (G_VALUE_TYPE (property_def->orig_def) != 0) + g_value_unset (property_def->orig_def); + g_clear_pointer (&property_def->orig_def, g_free); } - if (property_class->def) + if (property_def->def) { - if (G_VALUE_TYPE (property_class->def) != 0) - g_value_unset (property_class->def); - g_clear_pointer (&property_class->def, g_free); + if (G_VALUE_TYPE (property_def->def) != 0) + g_value_unset (property_def->def); + g_clear_pointer (&property_def->def, g_free); } - g_clear_pointer (&property_class->create_type, g_free); - g_slice_free (GladePropertyClass, property_class); + g_clear_pointer (&property_def->create_type, g_free); + g_slice_free (GladePropertyDef, property_def); } GValue * -glade_property_class_get_default_from_spec (GParamSpec * spec) +glade_property_def_get_default_from_spec (GParamSpec * spec) { GValue *value; value = g_new0 (GValue, 1); @@ -339,7 +333,7 @@ glade_property_class_get_default_from_spec (GParamSpec * spec) static gchar * -glade_property_class_make_string_from_enum (GType etype, gint eval) +glade_property_def_make_string_from_enum (GType etype, gint eval) { GEnumClass *eclass; gchar *string = NULL; @@ -359,7 +353,7 @@ glade_property_class_make_string_from_enum (GType etype, gint eval) } static gchar * -glade_property_class_make_string_from_flags (GladePropertyClass * klass, +glade_property_def_make_string_from_flags (GladePropertyDef * property_def, guint fvals, gboolean displayables) { GFlagsClass *fclass; @@ -368,7 +362,7 @@ glade_property_class_make_string_from_flags (GladePropertyClass * klass, gchar *retval; g_return_val_if_fail ((fclass = - g_type_class_ref (klass->pspec->value_type)) != NULL, + g_type_class_ref (property_def->pspec->value_type)) != NULL, NULL); string = g_string_new (""); @@ -380,7 +374,7 @@ glade_property_class_make_string_from_flags (GladePropertyClass * klass, fvals &= ~fvalue->value; if (displayables) - val_str = glade_get_displayable_value (klass->pspec->value_type, + val_str = glade_get_displayable_value (property_def->pspec->value_type, fvalue->value_name); if (string->str[0]) @@ -402,8 +396,8 @@ glade_property_class_make_string_from_flags (GladePropertyClass * klass, } static gchar * -glade_property_class_make_string_from_object (GladePropertyClass * - property_class, GObject * object) +glade_property_def_make_string_from_object (GladePropertyDef *property_def, + GObject *object) { GladeWidget *gwidget; gchar *string = NULL, *filename; @@ -411,12 +405,12 @@ glade_property_class_make_string_from_object (GladePropertyClass * if (!object) return NULL; - if (property_class->pspec->value_type == GDK_TYPE_PIXBUF) + if (property_def->pspec->value_type == GDK_TYPE_PIXBUF) { if ((filename = g_object_get_data (object, "GladeFileName")) != NULL) string = g_strdup (filename); } - else if (property_class->pspec->value_type == G_TYPE_FILE) + else if (property_def->pspec->value_type == G_TYPE_FILE) { if ((filename = g_object_get_data (object, "GladeFileURI")) != NULL) string = g_strdup (filename); @@ -431,8 +425,8 @@ glade_property_class_make_string_from_object (GladePropertyClass * } static gchar * -glade_property_class_make_string_from_objects (GladePropertyClass * - property_class, GList * objects) +glade_property_def_make_string_from_objects (GladePropertyDef * + property_def, GList * objects) { GObject *object; GList *list; @@ -443,7 +437,7 @@ glade_property_class_make_string_from_objects (GladePropertyClass * object = list->data; obj_str = - glade_property_class_make_string_from_object (property_class, object); + glade_property_def_make_string_from_object (property_def, object); if (string == NULL) string = obj_str; @@ -479,15 +473,15 @@ glade_dtostr (double number, gdouble epsilon) } /** - * glade_property_class_make_string_from_gvalue: - * @property_class: A #GladePropertyClass + * glade_property_def_make_string_from_gvalue: + * @property_def: A #GladePropertyDef * @value: A #GValue * * Returns: A newly allocated string representation of @value */ gchar * -glade_property_class_make_string_from_gvalue (GladePropertyClass * - property_class, +glade_property_def_make_string_from_gvalue (GladePropertyDef * + property_def, const GValue * value) { gchar *string = NULL, **strv; @@ -496,19 +490,19 @@ glade_property_class_make_string_from_gvalue (GladePropertyClass * GdkRGBA *rgba; GList *objects; - if (G_IS_PARAM_SPEC_ENUM (property_class->pspec)) + if (G_IS_PARAM_SPEC_ENUM (property_def->pspec)) { gint eval = g_value_get_enum (value); - string = glade_property_class_make_string_from_enum - (property_class->pspec->value_type, eval); + string = glade_property_def_make_string_from_enum + (property_def->pspec->value_type, eval); } - else if (G_IS_PARAM_SPEC_FLAGS (property_class->pspec)) + else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec)) { guint flags = g_value_get_flags (value); - string = glade_property_class_make_string_from_flags - (property_class, flags, FALSE); + string = glade_property_def_make_string_from_flags + (property_def, flags, FALSE); } - else if (G_IS_PARAM_SPEC_VALUE_ARRAY (property_class->pspec)) + else if (G_IS_PARAM_SPEC_VALUE_ARRAY (property_def->pspec)) { GValueArray *value_array = g_value_get_boxed (value); @@ -528,87 +522,87 @@ glade_property_class_make_string_from_gvalue (GladePropertyClass * g_string_free (gstring, FALSE); } } - else if (G_IS_PARAM_SPEC_BOXED (property_class->pspec)) + else if (G_IS_PARAM_SPEC_BOXED (property_def->pspec)) { - if (property_class->pspec->value_type == GDK_TYPE_COLOR) + if (property_def->pspec->value_type == GDK_TYPE_COLOR) { color = g_value_get_boxed (value); if (color) string = g_strdup_printf ("#%04x%04x%04x", color->red, color->green, color->blue); } - else if (property_class->pspec->value_type == GDK_TYPE_RGBA) + else if (property_def->pspec->value_type == GDK_TYPE_RGBA) { rgba = g_value_get_boxed (value); if (rgba) string = gdk_rgba_to_string (rgba); } - else if (property_class->pspec->value_type == G_TYPE_STRV) + else if (property_def->pspec->value_type == G_TYPE_STRV) { strv = g_value_get_boxed (value); if (strv) string = g_strjoinv ("\n", strv); } } - else if (G_IS_PARAM_SPEC_INT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_INT (property_def->pspec)) string = g_strdup_printf ("%d", g_value_get_int (value)); - else if (G_IS_PARAM_SPEC_UINT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_UINT (property_def->pspec)) string = g_strdup_printf ("%u", g_value_get_uint (value)); - else if (G_IS_PARAM_SPEC_LONG (property_class->pspec)) + else if (G_IS_PARAM_SPEC_LONG (property_def->pspec)) string = g_strdup_printf ("%ld", g_value_get_long (value)); - else if (G_IS_PARAM_SPEC_ULONG (property_class->pspec)) + else if (G_IS_PARAM_SPEC_ULONG (property_def->pspec)) string = g_strdup_printf ("%lu", g_value_get_ulong (value)); - else if (G_IS_PARAM_SPEC_INT64 (property_class->pspec)) + else if (G_IS_PARAM_SPEC_INT64 (property_def->pspec)) string = g_strdup_printf ("%" G_GINT64_FORMAT, g_value_get_int64 (value)); - else if (G_IS_PARAM_SPEC_UINT64 (property_class->pspec)) + else if (G_IS_PARAM_SPEC_UINT64 (property_def->pspec)) string = g_strdup_printf ("%" G_GUINT64_FORMAT, g_value_get_uint64 (value)); - else if (G_IS_PARAM_SPEC_FLOAT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_FLOAT (property_def->pspec)) string = glade_dtostr (g_value_get_float (value), - ((GParamSpecFloat *)property_class->pspec)->epsilon); - else if (G_IS_PARAM_SPEC_DOUBLE (property_class->pspec)) + ((GParamSpecFloat *)property_def->pspec)->epsilon); + else if (G_IS_PARAM_SPEC_DOUBLE (property_def->pspec)) string = glade_dtostr (g_value_get_double (value), - ((GParamSpecDouble *)property_class->pspec)->epsilon); - else if (G_IS_PARAM_SPEC_STRING (property_class->pspec)) + ((GParamSpecDouble *)property_def->pspec)->epsilon); + else if (G_IS_PARAM_SPEC_STRING (property_def->pspec)) { string = g_value_dup_string (value); } - else if (G_IS_PARAM_SPEC_CHAR (property_class->pspec)) + else if (G_IS_PARAM_SPEC_CHAR (property_def->pspec)) string = g_strdup_printf ("%c", g_value_get_schar (value)); - else if (G_IS_PARAM_SPEC_UCHAR (property_class->pspec)) + else if (G_IS_PARAM_SPEC_UCHAR (property_def->pspec)) string = g_strdup_printf ("%c", g_value_get_uchar (value)); - else if (G_IS_PARAM_SPEC_UNICHAR (property_class->pspec)) + else if (G_IS_PARAM_SPEC_UNICHAR (property_def->pspec)) { int len; string = g_malloc (7); len = g_unichar_to_utf8 (g_value_get_uint (value), string); string[len] = '\0'; } - else if (G_IS_PARAM_SPEC_BOOLEAN (property_class->pspec)) + else if (G_IS_PARAM_SPEC_BOOLEAN (property_def->pspec)) string = g_strdup_printf ("%s", g_value_get_boolean (value) ? GLADE_TAG_TRUE : GLADE_TAG_FALSE); - else if (G_IS_PARAM_SPEC_VARIANT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_VARIANT (property_def->pspec)) { GVariant *variant; if ((variant = g_value_get_variant (value))) string = g_variant_print (variant, TRUE); } - else if (G_IS_PARAM_SPEC_OBJECT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_OBJECT (property_def->pspec)) { object = g_value_get_object (value); string = - glade_property_class_make_string_from_object (property_class, object); + glade_property_def_make_string_from_object (property_def, object); } - else if (GLADE_IS_PARAM_SPEC_OBJECTS (property_class->pspec)) + else if (GLADE_IS_PARAM_SPEC_OBJECTS (property_def->pspec)) { objects = g_value_get_boxed (value); string = - glade_property_class_make_string_from_objects (property_class, + glade_property_def_make_string_from_objects (property_def, objects); } else g_critical ("Unsupported pspec type %s (value -> string)", - g_type_name (G_PARAM_SPEC_TYPE (property_class->pspec))); + g_type_name (G_PARAM_SPEC_TYPE (property_def->pspec))); return string; } @@ -616,7 +610,7 @@ glade_property_class_make_string_from_gvalue (GladePropertyClass * /* This is copied exactly from libglade. I've just renamed the function. */ guint -glade_property_class_make_flags_from_string (GType type, const char *string) +glade_property_def_make_flags_from_string (GType type, const char *string) { GFlagsClass *fclass; gchar *endptr, *prevptr; @@ -699,7 +693,7 @@ glade_property_class_make_flags_from_string (GType type, const char *string) /* This is copied exactly from libglade. I've just renamed the function. */ static gint -glade_property_class_make_enum_from_string (GType type, const char *string) +glade_property_def_make_enum_from_string (GType type, const char *string) { GEnumClass *eclass; GEnumValue *ev; @@ -723,8 +717,8 @@ glade_property_class_make_enum_from_string (GType type, const char *string) } static GObject * -glade_property_class_make_object_from_string (GladePropertyClass * - property_class, +glade_property_def_make_object_from_string (GladePropertyDef * + property_def, const gchar * string, GladeProject * project) { @@ -734,7 +728,7 @@ glade_property_class_make_object_from_string (GladePropertyClass * if (string == NULL || project == NULL) return NULL; - if (property_class->pspec->value_type == GDK_TYPE_PIXBUF) + if (property_def->pspec->value_type == GDK_TYPE_PIXBUF) { GdkPixbuf *pixbuf; @@ -761,7 +755,7 @@ glade_property_class_make_object_from_string (GladePropertyClass * g_free (fullpath); } - else if (property_class->pspec->value_type == G_TYPE_FILE) + else if (property_def->pspec->value_type == G_TYPE_FILE) { GFile *file; @@ -785,8 +779,8 @@ glade_property_class_make_object_from_string (GladePropertyClass * } static GList * -glade_property_class_make_objects_from_string (GladePropertyClass * - property_class, +glade_property_def_make_objects_from_string (GladePropertyDef * + property_def, const gchar * string, GladeProject * project) { @@ -800,7 +794,7 @@ glade_property_class_make_objects_from_string (GladePropertyClass * for (i = 0; split[i]; i++) { if ((object = - glade_property_class_make_object_from_string (property_class, + glade_property_def_make_object_from_string (property_def, split[i], project)) != NULL) objects = g_list_prepend (objects, object); @@ -811,16 +805,16 @@ glade_property_class_make_objects_from_string (GladePropertyClass * } /** - * glade_property_class_make_gvalue_from_string: - * @property_class: A #GladePropertyClass + * glade_property_def_make_gvalue_from_string: + * @property_def: A #GladePropertyDef * @string: a string representation of this property * @project: the #GladeProject that the property should be resolved for * - * Returns: A #GValue created based on the @property_class + * Returns: A #GValue created based on the @property_def * and @string criteria. */ GValue * -glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class, +glade_property_def_make_gvalue_from_string (GladePropertyDef *property_def, const gchar *string, GladeProject *project) { @@ -829,21 +823,21 @@ glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class GdkColor color = { 0, }; GdkRGBA rgba = { 0, }; - g_value_init (value, property_class->pspec->value_type); + g_value_init (value, property_def->pspec->value_type); - if (G_IS_PARAM_SPEC_ENUM (property_class->pspec)) + if (G_IS_PARAM_SPEC_ENUM (property_def->pspec)) { - gint eval = glade_property_class_make_enum_from_string - (property_class->pspec->value_type, string); + gint eval = glade_property_def_make_enum_from_string + (property_def->pspec->value_type, string); g_value_set_enum (value, eval); } - else if (G_IS_PARAM_SPEC_FLAGS (property_class->pspec)) + else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec)) { - guint flags = glade_property_class_make_flags_from_string - (property_class->pspec->value_type, string); + guint flags = glade_property_def_make_flags_from_string + (property_def->pspec->value_type, string); g_value_set_flags (value, flags); } - else if (G_IS_PARAM_SPEC_VALUE_ARRAY (property_class->pspec)) + else if (G_IS_PARAM_SPEC_VALUE_ARRAY (property_def->pspec)) { GValueArray *value_array; GValue str_value = { 0, }; @@ -868,55 +862,55 @@ glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class g_value_take_boxed (value, value_array); g_strfreev (strv); } - else if (G_IS_PARAM_SPEC_BOXED (property_class->pspec)) + else if (G_IS_PARAM_SPEC_BOXED (property_def->pspec)) { - if (property_class->pspec->value_type == GDK_TYPE_COLOR) + if (property_def->pspec->value_type == GDK_TYPE_COLOR) { if (gdk_color_parse (string, &color)) g_value_set_boxed (value, &color); else g_warning ("could not parse colour name `%s'", string); } - else if (property_class->pspec->value_type == GDK_TYPE_RGBA) + else if (property_def->pspec->value_type == GDK_TYPE_RGBA) { if (gdk_rgba_parse (&rgba, string)) g_value_set_boxed (value, &rgba); else g_warning ("could not parse rgba colour name `%s'", string); } - else if (property_class->pspec->value_type == G_TYPE_STRV) + else if (property_def->pspec->value_type == G_TYPE_STRV) { strv = g_strsplit (string, "\n", 0); g_value_take_boxed (value, strv); } } - else if (G_IS_PARAM_SPEC_VARIANT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_VARIANT (property_def->pspec)) g_value_take_variant (value, g_variant_parse (NULL, string, NULL, NULL, NULL)); - else if (G_IS_PARAM_SPEC_INT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_INT (property_def->pspec)) g_value_set_int (value, g_ascii_strtoll (string, NULL, 10)); - else if (G_IS_PARAM_SPEC_UINT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_UINT (property_def->pspec)) g_value_set_uint (value, g_ascii_strtoull (string, NULL, 10)); - else if (G_IS_PARAM_SPEC_LONG (property_class->pspec)) + else if (G_IS_PARAM_SPEC_LONG (property_def->pspec)) g_value_set_long (value, g_ascii_strtoll (string, NULL, 10)); - else if (G_IS_PARAM_SPEC_ULONG (property_class->pspec)) + else if (G_IS_PARAM_SPEC_ULONG (property_def->pspec)) g_value_set_ulong (value, g_ascii_strtoull (string, NULL, 10)); - else if (G_IS_PARAM_SPEC_INT64 (property_class->pspec)) + else if (G_IS_PARAM_SPEC_INT64 (property_def->pspec)) g_value_set_int64 (value, g_ascii_strtoll (string, NULL, 10)); - else if (G_IS_PARAM_SPEC_UINT64 (property_class->pspec)) + else if (G_IS_PARAM_SPEC_UINT64 (property_def->pspec)) g_value_set_uint64 (value, g_ascii_strtoull (string, NULL, 10)); - else if (G_IS_PARAM_SPEC_FLOAT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_FLOAT (property_def->pspec)) g_value_set_float (value, (float) g_ascii_strtod (string, NULL)); - else if (G_IS_PARAM_SPEC_DOUBLE (property_class->pspec)) + else if (G_IS_PARAM_SPEC_DOUBLE (property_def->pspec)) g_value_set_double (value, g_ascii_strtod (string, NULL)); - else if (G_IS_PARAM_SPEC_STRING (property_class->pspec)) + else if (G_IS_PARAM_SPEC_STRING (property_def->pspec)) g_value_set_string (value, string); - else if (G_IS_PARAM_SPEC_CHAR (property_class->pspec)) + else if (G_IS_PARAM_SPEC_CHAR (property_def->pspec)) g_value_set_schar (value, string[0]); - else if (G_IS_PARAM_SPEC_UCHAR (property_class->pspec)) + else if (G_IS_PARAM_SPEC_UCHAR (property_def->pspec)) g_value_set_uchar (value, string[0]); - else if (G_IS_PARAM_SPEC_UNICHAR (property_class->pspec)) + else if (G_IS_PARAM_SPEC_UNICHAR (property_def->pspec)) g_value_set_uint (value, g_utf8_get_char (string)); - else if (G_IS_PARAM_SPEC_BOOLEAN (property_class->pspec)) + else if (G_IS_PARAM_SPEC_BOOLEAN (property_def->pspec)) { gboolean val; if (glade_utils_boolean_from_string (string, &val)) @@ -925,104 +919,104 @@ glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class g_value_set_boolean (value, val); } - else if (G_IS_PARAM_SPEC_OBJECT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_OBJECT (property_def->pspec)) { GObject *object = - glade_property_class_make_object_from_string (property_class, string, project); + glade_property_def_make_object_from_string (property_def, string, project); g_value_set_object (value, object); } - else if (GLADE_IS_PARAM_SPEC_OBJECTS (property_class->pspec)) + else if (GLADE_IS_PARAM_SPEC_OBJECTS (property_def->pspec)) { GList *objects = - glade_property_class_make_objects_from_string (property_class, string, project); + glade_property_def_make_objects_from_string (property_def, string, project); g_value_take_boxed (value, objects); } else g_critical ("Unsupported pspec type %s (string -> value)", - g_type_name (G_PARAM_SPEC_TYPE (property_class->pspec))); + g_type_name (G_PARAM_SPEC_TYPE (property_def->pspec))); return value; } /** - * glade_property_class_make_gvalue_from_vl: - * @property_class: A #GladePropertyClass + * glade_property_def_make_gvalue_from_vl: + * @property_def: A #GladePropertyDef * @vl: a #va_list holding one argument of the correct type - * specified by @property_class + * specified by @property_def * - * Returns: A #GValue created based on the @property_class + * Returns: A #GValue created based on the @property_def * and a @vl arg of the correct type. */ GValue * -glade_property_class_make_gvalue_from_vl (GladePropertyClass * klass, - va_list vl) +glade_property_def_make_gvalue_from_vl (GladePropertyDef *property_def, + va_list vl) { GValue *value; - g_return_val_if_fail (klass != NULL, NULL); + g_return_val_if_fail (property_def != NULL, NULL); value = g_new0 (GValue, 1); - g_value_init (value, klass->pspec->value_type); + g_value_init (value, property_def->pspec->value_type); - if (G_IS_PARAM_SPEC_ENUM (klass->pspec)) + if (G_IS_PARAM_SPEC_ENUM (property_def->pspec)) g_value_set_enum (value, va_arg (vl, gint)); - else if (G_IS_PARAM_SPEC_FLAGS (klass->pspec)) + else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec)) g_value_set_flags (value, va_arg (vl, gint)); - else if (G_IS_PARAM_SPEC_INT (klass->pspec)) + else if (G_IS_PARAM_SPEC_INT (property_def->pspec)) g_value_set_int (value, va_arg (vl, gint)); - else if (G_IS_PARAM_SPEC_UINT (klass->pspec)) + else if (G_IS_PARAM_SPEC_UINT (property_def->pspec)) g_value_set_uint (value, va_arg (vl, guint)); - else if (G_IS_PARAM_SPEC_LONG (klass->pspec)) + else if (G_IS_PARAM_SPEC_LONG (property_def->pspec)) g_value_set_long (value, va_arg (vl, glong)); - else if (G_IS_PARAM_SPEC_ULONG (klass->pspec)) + else if (G_IS_PARAM_SPEC_ULONG (property_def->pspec)) g_value_set_ulong (value, va_arg (vl, gulong)); - else if (G_IS_PARAM_SPEC_INT64 (klass->pspec)) + else if (G_IS_PARAM_SPEC_INT64 (property_def->pspec)) g_value_set_int64 (value, va_arg (vl, gint64)); - else if (G_IS_PARAM_SPEC_UINT64 (klass->pspec)) + else if (G_IS_PARAM_SPEC_UINT64 (property_def->pspec)) g_value_set_uint64 (value, va_arg (vl, guint64)); - else if (G_IS_PARAM_SPEC_FLOAT (klass->pspec)) + else if (G_IS_PARAM_SPEC_FLOAT (property_def->pspec)) g_value_set_float (value, (gfloat) va_arg (vl, gdouble)); - else if (G_IS_PARAM_SPEC_DOUBLE (klass->pspec)) + else if (G_IS_PARAM_SPEC_DOUBLE (property_def->pspec)) g_value_set_double (value, va_arg (vl, gdouble)); - else if (G_IS_PARAM_SPEC_STRING (klass->pspec)) + else if (G_IS_PARAM_SPEC_STRING (property_def->pspec)) g_value_set_string (value, va_arg (vl, gchar *)); - else if (G_IS_PARAM_SPEC_CHAR (klass->pspec)) + else if (G_IS_PARAM_SPEC_CHAR (property_def->pspec)) g_value_set_schar (value, (gchar) va_arg (vl, gint)); - else if (G_IS_PARAM_SPEC_UCHAR (klass->pspec)) + else if (G_IS_PARAM_SPEC_UCHAR (property_def->pspec)) g_value_set_uchar (value, (guchar) va_arg (vl, guint)); - else if (G_IS_PARAM_SPEC_UNICHAR (klass->pspec)) + else if (G_IS_PARAM_SPEC_UNICHAR (property_def->pspec)) g_value_set_uint (value, va_arg (vl, gunichar)); - else if (G_IS_PARAM_SPEC_BOOLEAN (klass->pspec)) + else if (G_IS_PARAM_SPEC_BOOLEAN (property_def->pspec)) g_value_set_boolean (value, va_arg (vl, gboolean)); - else if (G_IS_PARAM_SPEC_OBJECT (klass->pspec)) + else if (G_IS_PARAM_SPEC_OBJECT (property_def->pspec)) g_value_set_object (value, va_arg (vl, gpointer)); else if (G_VALUE_HOLDS_BOXED (value)) g_value_set_boxed (value, va_arg (vl, gpointer)); else g_critical ("Unsupported pspec type %s (vl -> string)", - g_type_name (G_PARAM_SPEC_TYPE (klass->pspec))); + g_type_name (G_PARAM_SPEC_TYPE (property_def->pspec))); return value; } /** - * glade_property_class_make_gvalue: - * @klass: A #GladePropertyClass - * @...: an argument of the correct type specified by @property_class + * glade_property_def_make_gvalue: + * @property_def: A #GladePropertyDef + * @...: an argument of the correct type specified by @property_def * - * Returns: A #GValue created based on the @property_class + * Returns: A #GValue created based on the @property_def * and the provided argument. */ GValue * -glade_property_class_make_gvalue (GladePropertyClass * klass, ...) +glade_property_def_make_gvalue (GladePropertyDef * property_def, ...) { GValue *value; va_list vl; - g_return_val_if_fail (klass != NULL, NULL); + g_return_val_if_fail (property_def != NULL, NULL); - va_start (vl, klass); - value = glade_property_class_make_gvalue_from_vl (klass, vl); + va_start (vl, property_def); + value = glade_property_def_make_gvalue_from_vl (property_def, vl); va_end (vl); return value; @@ -1030,67 +1024,67 @@ glade_property_class_make_gvalue (GladePropertyClass * klass, ...) /** - * glade_property_class_set_vl_from_gvalue: - * @klass: A #GladePropertyClass + * glade_property_def_set_vl_from_gvalue: + * @property_def: A #GladePropertyDef * @value: A #GValue to set * @vl: a #va_list holding one argument of the correct type - * specified by @klass + * specified by @property_def * * - * Sets @vl from @value based on @klass criteria. + * Sets @vl from @value based on @property_def criteria. */ void -glade_property_class_set_vl_from_gvalue (GladePropertyClass * klass, +glade_property_def_set_vl_from_gvalue (GladePropertyDef * property_def, GValue * value, va_list vl) { - g_return_if_fail (klass != NULL); + g_return_if_fail (property_def != NULL); g_return_if_fail (value != NULL); /* The argument is a pointer of the specified type, cast the pointer and assign * the value using the proper g_value_get_ variation. */ - if (G_IS_PARAM_SPEC_ENUM (klass->pspec)) + if (G_IS_PARAM_SPEC_ENUM (property_def->pspec)) *(gint *) (va_arg (vl, gint *)) = g_value_get_enum (value); - else if (G_IS_PARAM_SPEC_FLAGS (klass->pspec)) + else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec)) *(gint *) (va_arg (vl, gint *)) = g_value_get_flags (value); - else if (G_IS_PARAM_SPEC_INT (klass->pspec)) + else if (G_IS_PARAM_SPEC_INT (property_def->pspec)) *(gint *) (va_arg (vl, gint *)) = g_value_get_int (value); - else if (G_IS_PARAM_SPEC_UINT (klass->pspec)) + else if (G_IS_PARAM_SPEC_UINT (property_def->pspec)) *(guint *) (va_arg (vl, guint *)) = g_value_get_uint (value); - else if (G_IS_PARAM_SPEC_LONG (klass->pspec)) + else if (G_IS_PARAM_SPEC_LONG (property_def->pspec)) *(glong *) (va_arg (vl, glong *)) = g_value_get_long (value); - else if (G_IS_PARAM_SPEC_ULONG (klass->pspec)) + else if (G_IS_PARAM_SPEC_ULONG (property_def->pspec)) *(gulong *) (va_arg (vl, gulong *)) = g_value_get_ulong (value); - else if (G_IS_PARAM_SPEC_INT64 (klass->pspec)) + else if (G_IS_PARAM_SPEC_INT64 (property_def->pspec)) *(gint64 *) (va_arg (vl, gint64 *)) = g_value_get_int64 (value); - else if (G_IS_PARAM_SPEC_UINT64 (klass->pspec)) + else if (G_IS_PARAM_SPEC_UINT64 (property_def->pspec)) *(guint64 *) (va_arg (vl, guint64 *)) = g_value_get_uint64 (value); - else if (G_IS_PARAM_SPEC_FLOAT (klass->pspec)) + else if (G_IS_PARAM_SPEC_FLOAT (property_def->pspec)) *(gfloat *) (va_arg (vl, gdouble *)) = g_value_get_float (value); - else if (G_IS_PARAM_SPEC_DOUBLE (klass->pspec)) + else if (G_IS_PARAM_SPEC_DOUBLE (property_def->pspec)) *(gdouble *) (va_arg (vl, gdouble *)) = g_value_get_double (value); - else if (G_IS_PARAM_SPEC_STRING (klass->pspec)) + else if (G_IS_PARAM_SPEC_STRING (property_def->pspec)) *(gchar **) (va_arg (vl, gchar *)) = (gchar *) g_value_get_string (value); - else if (G_IS_PARAM_SPEC_CHAR (klass->pspec)) + else if (G_IS_PARAM_SPEC_CHAR (property_def->pspec)) *(gchar *) (va_arg (vl, gint *)) = g_value_get_schar (value); - else if (G_IS_PARAM_SPEC_UCHAR (klass->pspec)) + else if (G_IS_PARAM_SPEC_UCHAR (property_def->pspec)) *(guchar *) (va_arg (vl, guint *)) = g_value_get_uchar (value); - else if (G_IS_PARAM_SPEC_UNICHAR (klass->pspec)) + else if (G_IS_PARAM_SPEC_UNICHAR (property_def->pspec)) *(guint *) (va_arg (vl, gunichar *)) = g_value_get_uint (value); - else if (G_IS_PARAM_SPEC_BOOLEAN (klass->pspec)) + else if (G_IS_PARAM_SPEC_BOOLEAN (property_def->pspec)) *(gboolean *) (va_arg (vl, gboolean *)) = g_value_get_boolean (value); - else if (G_IS_PARAM_SPEC_OBJECT (klass->pspec)) + else if (G_IS_PARAM_SPEC_OBJECT (property_def->pspec)) *(gpointer *) (va_arg (vl, gpointer *)) = g_value_get_object (value); else if (G_VALUE_HOLDS_BOXED (value)) *(gpointer *) (va_arg (vl, gpointer *)) = g_value_get_boxed (value); else g_critical ("Unsupported pspec type %s (string -> vl)", - g_type_name (G_PARAM_SPEC_TYPE (klass->pspec))); + g_type_name (G_PARAM_SPEC_TYPE (property_def->pspec))); } /** - * glade_property_class_get_from_gvalue: - * @klass: A #GladePropertyClass + * glade_property_def_get_from_gvalue: + * @property_def: A #GladePropertyDef * @value: A #GValue to set * @...: a return location of the correct type * @@ -1098,16 +1092,16 @@ glade_property_class_set_vl_from_gvalue (GladePropertyClass * klass, * Assignes the provided return location to @value */ void -glade_property_class_get_from_gvalue (GladePropertyClass *klass, +glade_property_def_get_from_gvalue (GladePropertyDef *property_def, GValue *value, ...) { va_list vl; - g_return_if_fail (klass != NULL); + g_return_if_fail (property_def != NULL); va_start (vl, value); - glade_property_class_set_vl_from_gvalue (klass, value, vl); + glade_property_def_set_vl_from_gvalue (property_def, value, vl); va_end (vl); } @@ -1115,13 +1109,13 @@ glade_property_class_get_from_gvalue (GladePropertyClass *klass, /* "need_adaptor": An evil trick to let us create pclasses without * adaptors and editors. */ -GladePropertyClass * -glade_property_class_new_from_spec_full (GladeWidgetAdaptor *adaptor, +GladePropertyDef * +glade_property_def_new_from_spec_full (GladeWidgetAdaptor *adaptor, GParamSpec *spec, gboolean need_adaptor) { GObjectClass *gtk_widget_class; - GladePropertyClass *property_class; + GladePropertyDef *property_def; GladeEditorProperty *eprop = NULL; g_return_val_if_fail (spec != NULL, NULL); @@ -1130,20 +1124,20 @@ glade_property_class_new_from_spec_full (GladeWidgetAdaptor *adaptor, /* Only properties that are _new_from_spec() are * not virtual properties */ - property_class = glade_property_class_new (adaptor, spec->name); - property_class->virt = FALSE; - property_class->pspec = spec; + property_def = glade_property_def_new (adaptor, spec->name); + property_def->virt = FALSE; + property_def->pspec = spec; /* We only use the writable properties */ if ((spec->flags & G_PARAM_WRITABLE) == 0) goto failed; - property_class->name = g_strdup (g_param_spec_get_nick (spec)); + property_def->name = g_strdup (g_param_spec_get_nick (spec)); /* Register only editable properties. */ if (need_adaptor && !(eprop = glade_widget_adaptor_create_eprop - (GLADE_WIDGET_ADAPTOR (adaptor), property_class, FALSE))) + (GLADE_WIDGET_ADAPTOR (adaptor), property_def, FALSE))) goto failed; /* Just created it to see if it was supported.... destroy now... */ @@ -1155,429 +1149,438 @@ glade_property_class_new_from_spec_full (GladeWidgetAdaptor *adaptor, */ if (g_object_class_find_property (gtk_widget_class, g_param_spec_get_name (spec)) != NULL) - property_class->common = TRUE; + property_def->common = TRUE; /* Flag the construct only properties */ if (spec->flags & G_PARAM_CONSTRUCT_ONLY) - property_class->construct_only = TRUE; + property_def->construct_only = TRUE; - if (!property_class->id || !property_class->name) + if (!property_def->id || !property_def->name) { g_critical ("No name or id for " - "glade_property_class_new_from_spec, failed."); + "glade_property_def_new_from_spec, failed."); goto failed; } - property_class->tooltip = g_strdup (g_param_spec_get_blurb (spec)); - property_class->orig_def = glade_property_class_get_default_from_spec (spec); - property_class->def = glade_property_class_get_default_from_spec (spec); + property_def->tooltip = g_strdup (g_param_spec_get_blurb (spec)); + property_def->orig_def = glade_property_def_get_default_from_spec (spec); + property_def->def = glade_property_def_get_default_from_spec (spec); g_type_class_unref (gtk_widget_class); - return property_class; + return property_def; failed: - glade_property_class_free (property_class); + glade_property_def_free (property_def); g_type_class_unref (gtk_widget_class); return NULL; } /** - * glade_property_class_new_from_spec: + * glade_property_def_new_from_spec: * @adaptor: A generic pointer (i.e. a #GladeWidgetClass) * @spec: A #GParamSpec * - * Returns: a newly created #GladePropertyClass based on @spec + * Returns: a newly created #GladePropertyDef based on @spec * or %NULL if its unsupported. */ -GladePropertyClass * -glade_property_class_new_from_spec (GladeWidgetAdaptor *adaptor, GParamSpec *spec) +GladePropertyDef * +glade_property_def_new_from_spec (GladeWidgetAdaptor *adaptor, GParamSpec *spec) { - return glade_property_class_new_from_spec_full (adaptor, spec, TRUE); + return glade_property_def_new_from_spec_full (adaptor, spec, TRUE); } /** - * glade_property_class_is_visible: - * @property_class: A #GladePropertyClass + * glade_property_def_is_visible: + * @property_def: A #GladePropertyDef * * * Returns: whether or not to show this property in the editor */ gboolean -glade_property_class_is_visible (GladePropertyClass *klass) +glade_property_def_is_visible (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return klass->visible; + return property_def->visible; } /** - * glade_property_class_set_adaptor: - * @property_class: A #GladePropertyClass + * glade_property_def_set_adaptor: + * @property_def: A #GladePropertyDef * @adaptor: (transfer full): A #GladeWidgetAdaptor */ void -glade_property_class_set_adaptor (GladePropertyClass *property_class, +glade_property_def_set_adaptor (GladePropertyDef *property_def, GladeWidgetAdaptor *adaptor) { - g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class)); + g_return_if_fail (GLADE_IS_PROPERTY_DEF (property_def)); - property_class->adaptor = adaptor; + property_def->adaptor = adaptor; } /** - * glade_property_class_get_adaptor: - * @property_class: A #GladePropertyClass + * glade_property_def_get_adaptor: + * @property_def: A #GladePropertyDef * - * Returns: (transfer none): The #GladeWidgetAdaptor associated with the @property_class + * Returns: (transfer none): The #GladeWidgetAdaptor associated with the @property_def */ GladeWidgetAdaptor * -glade_property_class_get_adaptor (GladePropertyClass *property_class) +glade_property_def_get_adaptor (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), NULL); - return property_class->adaptor; + return property_def->adaptor; } /** - * glade_property_class_get_pspec: - * @property_class: A #GladePropertyClass + * glade_property_def_get_pspec: + * @property_def: A #GladePropertyDef * - * Returns: (transfer none): The #GParamSpec associated with the @property_class + * Returns: (transfer none): The #GParamSpec associated with the @property_def */ GParamSpec * -glade_property_class_get_pspec (GladePropertyClass *property_class) +glade_property_def_get_pspec (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), NULL); - return property_class->pspec; + return property_def->pspec; } /** - * glade_property_class_set_pspec: - * @property_class: A #GladePropertyClass + * glade_property_def_set_pspec: + * @property_def: A #GladePropertyDef * @pspec: (transfer full): A #GParamSpec */ void -glade_property_class_set_pspec (GladePropertyClass *property_class, +glade_property_def_set_pspec (GladePropertyDef *property_def, GParamSpec *pspec) { - g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class)); + g_return_if_fail (GLADE_IS_PROPERTY_DEF (property_def)); - property_class->pspec = pspec; + property_def->pspec = pspec; } void -glade_property_class_set_is_packing (GladePropertyClass *property_class, +glade_property_def_set_is_packing (GladePropertyDef *property_def, gboolean is_packing) { - g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class)); + g_return_if_fail (GLADE_IS_PROPERTY_DEF (property_def)); - property_class->packing = is_packing; + property_def->packing = is_packing; } gboolean -glade_property_class_get_is_packing (GladePropertyClass *property_class) +glade_property_def_get_is_packing (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->packing; + return property_def->packing; } gboolean -glade_property_class_save (GladePropertyClass *property_class) +glade_property_def_save (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->save; + return property_def->save; } gboolean -glade_property_class_save_always (GladePropertyClass *property_class) +glade_property_def_save_always (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->save_always; + return property_def->save_always; } void -glade_property_class_set_virtual (GladePropertyClass *property_class, +glade_property_def_set_virtual (GladePropertyDef *property_def, gboolean value) { - g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class)); + g_return_if_fail (GLADE_IS_PROPERTY_DEF (property_def)); - property_class->virt = value; + property_def->virt = value; } gboolean -glade_property_class_get_virtual (GladePropertyClass *property_class) +glade_property_def_get_virtual (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->virt; + return property_def->virt; } void -glade_property_class_set_ignore (GladePropertyClass *property_class, +glade_property_def_set_ignore (GladePropertyDef *property_def, gboolean ignore) { - g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class)); + g_return_if_fail (GLADE_IS_PROPERTY_DEF (property_def)); - property_class->ignore = ignore; + property_def->ignore = ignore; } gboolean -glade_property_class_get_ignore (GladePropertyClass *property_class) +glade_property_def_get_ignore (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->ignore; + return property_def->ignore; } /** - * glade_property_class_is_object: - * @property_class: A #GladePropertyClass + * glade_property_def_is_object: + * @property_def: A #GladePropertyDef * * Returns: whether or not this is an object property * that refers to another object in this project. */ gboolean -glade_property_class_is_object (GladePropertyClass *klass) +glade_property_def_is_object (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return (GLADE_IS_PARAM_SPEC_OBJECTS (klass->pspec) || - (G_IS_PARAM_SPEC_OBJECT (klass->pspec) && - klass->pspec->value_type != GDK_TYPE_PIXBUF && - klass->pspec->value_type != G_TYPE_FILE)); + return (GLADE_IS_PARAM_SPEC_OBJECTS (property_def->pspec) || + (G_IS_PARAM_SPEC_OBJECT (property_def->pspec) && + property_def->pspec->value_type != GDK_TYPE_PIXBUF && + property_def->pspec->value_type != G_TYPE_FILE)); } void -glade_property_class_set_name (GladePropertyClass *property_class, +glade_property_def_set_name (GladePropertyDef *property_def, const gchar *name) { - g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class)); + g_return_if_fail (GLADE_IS_PROPERTY_DEF (property_def)); - g_free (property_class->name); - property_class->name = g_strdup (name); + g_free (property_def->name); + property_def->name = g_strdup (name); } G_CONST_RETURN gchar * -glade_property_class_get_name (GladePropertyClass *property_class) +glade_property_def_get_name (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), NULL); - return property_class->name; + return property_def->name; } void -glade_property_class_set_tooltip (GladePropertyClass *property_class, +glade_property_def_set_tooltip (GladePropertyDef *property_def, const gchar *tooltip) { - g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class)); + g_return_if_fail (GLADE_IS_PROPERTY_DEF (property_def)); - g_free (property_class->tooltip); - property_class->tooltip = g_strdup (tooltip); + g_free (property_def->tooltip); + property_def->tooltip = g_strdup (tooltip); } G_CONST_RETURN gchar * -glade_property_class_get_tooltip (GladePropertyClass *property_class) +glade_property_def_get_tooltip (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), NULL); - return property_class->tooltip; + return property_def->tooltip; } void -glade_property_class_set_construct_only (GladePropertyClass *property_class, +glade_property_def_set_construct_only (GladePropertyDef *property_def, gboolean construct_only) { - g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class)); + g_return_if_fail (GLADE_IS_PROPERTY_DEF (property_def)); - property_class->construct_only = construct_only; + property_def->construct_only = construct_only; } gboolean -glade_property_class_get_construct_only (GladePropertyClass *property_class) +glade_property_def_get_construct_only (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->construct_only; + return property_def->construct_only; } G_CONST_RETURN GValue * -glade_property_class_get_default (GladePropertyClass *property_class) +glade_property_def_get_default (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), NULL); - return property_class->def; + return property_def->def; } G_CONST_RETURN GValue * -glade_property_class_get_original_default (GladePropertyClass *property_class) +glade_property_def_get_original_default (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), NULL); - return property_class->orig_def; + return property_def->orig_def; } gboolean -glade_property_class_translatable (GladePropertyClass *property_class) +glade_property_def_translatable (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->translatable; + return property_def->translatable; } gboolean -glade_property_class_needs_sync (GladePropertyClass *property_class) +glade_property_def_needs_sync (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->needs_sync; + return property_def->needs_sync; } gboolean -glade_property_class_query (GladePropertyClass *property_class) +glade_property_def_query (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->query; + return property_def->query; } gboolean -glade_property_class_atk (GladePropertyClass *property_class) +glade_property_def_atk (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->atk; + return property_def->atk; } gboolean -glade_property_class_common (GladePropertyClass *property_class) +glade_property_def_common (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->common; + return property_def->common; } gboolean -glade_property_class_parentless_widget (GladePropertyClass *property_class) +glade_property_def_parentless_widget (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->parentless_widget; + return property_def->parentless_widget; } gboolean -glade_property_class_optional (GladePropertyClass *property_class) +glade_property_def_optional (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->optional; + return property_def->optional; } gboolean -glade_property_class_optional_default (GladePropertyClass *property_class) +glade_property_def_optional_default (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->optional_default; + return property_def->optional_default; } gboolean -glade_property_class_multiline (GladePropertyClass *property_class) +glade_property_def_multiline (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->multiline; + return property_def->multiline; } gboolean -glade_property_class_stock (GladePropertyClass *property_class) +glade_property_def_stock (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->stock; + return property_def->stock; } gboolean -glade_property_class_stock_icon (GladePropertyClass *property_class) +glade_property_def_stock_icon (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->stock_icon; + return property_def->stock_icon; } gboolean -glade_property_class_transfer_on_paste (GladePropertyClass *property_class) +glade_property_def_transfer_on_paste (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->transfer_on_paste; + return property_def->transfer_on_paste; } gboolean -glade_property_class_custom_layout (GladePropertyClass *property_class) +glade_property_def_custom_layout (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->custom_layout; + return property_def->custom_layout; } gdouble -glade_property_class_weight (GladePropertyClass *property_class) +glade_property_def_weight (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), -1.0); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), -1.0); - return property_class->weight; + return property_def->weight; } G_CONST_RETURN gchar * -glade_property_class_create_type (GladePropertyClass *property_class) +glade_property_def_create_type (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), NULL); - return property_class->create_type; + return property_def->create_type; } guint16 -glade_property_class_since_major (GladePropertyClass *property_class) +glade_property_def_since_major (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), 0); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), 0); - return property_class->version_since_major; + return property_def->version_since_major; } guint16 -glade_property_class_since_minor (GladePropertyClass *property_class) +glade_property_def_since_minor (GladePropertyDef *property_def) +{ + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), 0); + + return property_def->version_since_minor; +} + +void +_glade_property_def_reset_version (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), 0); + g_return_if_fail (GLADE_IS_PROPERTY_DEF (property_def)); - return property_class->version_since_minor; + property_def->version_since_major = 0; + property_def->version_since_minor = 0; } gboolean -glade_property_class_deprecated (GladePropertyClass *property_class) +glade_property_def_deprecated (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->deprecated; + return property_def->deprecated; } G_CONST_RETURN gchar * -glade_property_class_id (GladePropertyClass *property_class) +glade_property_def_id (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), NULL); - return property_class->id; + return property_def->id; } gboolean -glade_property_class_themed_icon (GladePropertyClass *property_class) +glade_property_def_themed_icon (GladePropertyDef *property_def) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (property_class), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - return property_class->themed_icon; + return property_def->themed_icon; } /** @@ -1590,16 +1593,16 @@ glade_property_class_themed_icon (GladePropertyClass *property_class) */ static void gpc_read_displayable_values_from_node (GladeXmlNode *node, - GladePropertyClass *klass, + GladePropertyDef *property_def, const gchar *domain) { - gpointer the_class = g_type_class_ref (klass->pspec->value_type); + gpointer the_class = g_type_class_ref (property_def->pspec->value_type); GladeXmlNode *child; GEnumValue *enum_values = NULL; GFlagsValue *flags_values = NULL; gint n_values, registered_values = 0; - if (G_IS_PARAM_SPEC_ENUM (klass->pspec)) + if (G_IS_PARAM_SPEC_ENUM (property_def->pspec)) { GEnumClass *eclass = the_class; enum_values = eclass->values; @@ -1639,34 +1642,34 @@ gpc_read_displayable_values_from_node (GladeXmlNode *node, for (i = 0; i < n_values; i++) { /* is it a match ?? */ - if ((G_IS_PARAM_SPEC_ENUM (klass->pspec) && + if ((G_IS_PARAM_SPEC_ENUM (property_def->pspec) && (strcmp (id, enum_values[i].value_name) == 0 || strcmp (id, enum_values[i].value_nick) == 0)) || - (G_IS_PARAM_SPEC_FLAGS (klass->pspec) && + (G_IS_PARAM_SPEC_FLAGS (property_def->pspec) && (strcmp (id, flags_values[i].value_name) == 0 || strcmp (id, flags_values[i].value_nick) == 0))) { registered_values++; - if (G_IS_PARAM_SPEC_ENUM (klass->pspec)) + if (G_IS_PARAM_SPEC_ENUM (property_def->pspec)) { enum_val = &enum_values[i]; - glade_register_displayable_value (klass->pspec->value_type, + glade_register_displayable_value (property_def->pspec->value_type, enum_val->value_nick, domain, name); if (disabled) - glade_displayable_value_set_disabled (klass->pspec->value_type, + glade_displayable_value_set_disabled (property_def->pspec->value_type, enum_val->value_nick, TRUE); } else { flags_val = &flags_values[i]; - glade_register_displayable_value (klass->pspec->value_type, + glade_register_displayable_value (property_def->pspec->value_type, flags_val->value_nick, domain, name); if (disabled) - glade_displayable_value_set_disabled (klass->pspec->value_type, + glade_displayable_value_set_disabled (property_def->pspec->value_type, flags_val->value_nick, TRUE); } @@ -1681,88 +1684,88 @@ gpc_read_displayable_values_from_node (GladeXmlNode *node, if (n_values != registered_values) g_message ("%d missing displayable value for %s::%s", n_values - registered_values, - glade_widget_adaptor_get_name (klass->adaptor), klass->id); + glade_widget_adaptor_get_name (property_def->adaptor), property_def->id); g_type_class_unref (the_class); } /** - * glade_property_class_make_adjustment: - * @property_class: a pointer to the property class + * glade_property_def_make_adjustment: + * @property_def: a pointer to the property class * * Creates and appropriate GtkAdjustment for use in the editor * * Returns: (transfer full): An appropriate #GtkAdjustment for use in the Property editor */ GtkAdjustment * -glade_property_class_make_adjustment (GladePropertyClass *property_class) +glade_property_def_make_adjustment (GladePropertyDef *property_def) { GtkAdjustment *adjustment; gdouble min = 0, max = 0, def = 0; gboolean float_range = FALSE; - g_return_val_if_fail (property_class != NULL, NULL); - g_return_val_if_fail (property_class->pspec != NULL, NULL); + g_return_val_if_fail (property_def != NULL, NULL); + g_return_val_if_fail (property_def->pspec != NULL, NULL); - if (G_IS_PARAM_SPEC_INT (property_class->pspec)) + if (G_IS_PARAM_SPEC_INT (property_def->pspec)) { - min = (gdouble) ((GParamSpecInt *) property_class->pspec)->minimum; - max = (gdouble) ((GParamSpecInt *) property_class->pspec)->maximum; - def = (gdouble) ((GParamSpecInt *) property_class->pspec)->default_value; + min = (gdouble) ((GParamSpecInt *) property_def->pspec)->minimum; + max = (gdouble) ((GParamSpecInt *) property_def->pspec)->maximum; + def = (gdouble) ((GParamSpecInt *) property_def->pspec)->default_value; } - else if (G_IS_PARAM_SPEC_UINT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_UINT (property_def->pspec)) { - min = (gdouble) ((GParamSpecUInt *) property_class->pspec)->minimum; - max = (gdouble) ((GParamSpecUInt *) property_class->pspec)->maximum; - def = (gdouble) ((GParamSpecUInt *) property_class->pspec)->default_value; + min = (gdouble) ((GParamSpecUInt *) property_def->pspec)->minimum; + max = (gdouble) ((GParamSpecUInt *) property_def->pspec)->maximum; + def = (gdouble) ((GParamSpecUInt *) property_def->pspec)->default_value; } - else if (G_IS_PARAM_SPEC_LONG (property_class->pspec)) + else if (G_IS_PARAM_SPEC_LONG (property_def->pspec)) { - min = (gdouble) ((GParamSpecLong *) property_class->pspec)->minimum; - max = (gdouble) ((GParamSpecLong *) property_class->pspec)->maximum; - def = (gdouble) ((GParamSpecLong *) property_class->pspec)->default_value; + min = (gdouble) ((GParamSpecLong *) property_def->pspec)->minimum; + max = (gdouble) ((GParamSpecLong *) property_def->pspec)->maximum; + def = (gdouble) ((GParamSpecLong *) property_def->pspec)->default_value; } - else if (G_IS_PARAM_SPEC_ULONG (property_class->pspec)) + else if (G_IS_PARAM_SPEC_ULONG (property_def->pspec)) { - min = (gdouble) ((GParamSpecULong *) property_class->pspec)->minimum; - max = (gdouble) ((GParamSpecULong *) property_class->pspec)->maximum; + min = (gdouble) ((GParamSpecULong *) property_def->pspec)->minimum; + max = (gdouble) ((GParamSpecULong *) property_def->pspec)->maximum; def = - (gdouble) ((GParamSpecULong *) property_class->pspec)->default_value; + (gdouble) ((GParamSpecULong *) property_def->pspec)->default_value; } - else if (G_IS_PARAM_SPEC_INT64 (property_class->pspec)) + else if (G_IS_PARAM_SPEC_INT64 (property_def->pspec)) { - min = (gdouble) ((GParamSpecInt64 *) property_class->pspec)->minimum; - max = (gdouble) ((GParamSpecInt64 *) property_class->pspec)->maximum; + min = (gdouble) ((GParamSpecInt64 *) property_def->pspec)->minimum; + max = (gdouble) ((GParamSpecInt64 *) property_def->pspec)->maximum; def = - (gdouble) ((GParamSpecInt64 *) property_class->pspec)->default_value; + (gdouble) ((GParamSpecInt64 *) property_def->pspec)->default_value; } - else if (G_IS_PARAM_SPEC_UINT64 (property_class->pspec)) + else if (G_IS_PARAM_SPEC_UINT64 (property_def->pspec)) { - min = (gdouble) ((GParamSpecUInt64 *) property_class->pspec)->minimum; - max = (gdouble) ((GParamSpecUInt64 *) property_class->pspec)->maximum; + min = (gdouble) ((GParamSpecUInt64 *) property_def->pspec)->minimum; + max = (gdouble) ((GParamSpecUInt64 *) property_def->pspec)->maximum; def = - (gdouble) ((GParamSpecUInt64 *) property_class->pspec)->default_value; + (gdouble) ((GParamSpecUInt64 *) property_def->pspec)->default_value; } - else if (G_IS_PARAM_SPEC_FLOAT (property_class->pspec)) + else if (G_IS_PARAM_SPEC_FLOAT (property_def->pspec)) { float_range = TRUE; - min = ((GParamSpecFloat *) property_class->pspec)->minimum; - max = ((GParamSpecFloat *) property_class->pspec)->maximum; - def = ((GParamSpecFloat *) property_class->pspec)->default_value; + min = ((GParamSpecFloat *) property_def->pspec)->minimum; + max = ((GParamSpecFloat *) property_def->pspec)->maximum; + def = ((GParamSpecFloat *) property_def->pspec)->default_value; } - else if (G_IS_PARAM_SPEC_DOUBLE (property_class->pspec)) + else if (G_IS_PARAM_SPEC_DOUBLE (property_def->pspec)) { float_range = TRUE; - min = (gdouble) ((GParamSpecDouble *) property_class->pspec)->minimum; - max = (gdouble) ((GParamSpecDouble *) property_class->pspec)->maximum; + min = (gdouble) ((GParamSpecDouble *) property_def->pspec)->minimum; + max = (gdouble) ((GParamSpecDouble *) property_def->pspec)->maximum; def = - (gdouble) ((GParamSpecDouble *) property_class->pspec)->default_value; + (gdouble) ((GParamSpecDouble *) property_def->pspec)->default_value; } else { g_critical ("Can't make adjustment for pspec type %s", - g_type_name (G_PARAM_SPEC_TYPE (property_class->pspec))); + g_type_name (G_PARAM_SPEC_TYPE (property_def->pspec))); } adjustment = (GtkAdjustment *) gtk_adjustment_new (def, min, max, @@ -1780,8 +1783,8 @@ glade_property_class_make_adjustment (GladePropertyClass *property_class) static GParamSpec * -glade_property_class_parse_specifications (GladePropertyClass *klass, - GladeXmlNode *spec_node) +glade_property_def_parse_specifications (GladePropertyDef *property_def, + GladeXmlNode *spec_node) { gchar *string; GType spec_type = 0, value_type = 0; @@ -1954,35 +1957,35 @@ glade_property_class_parse_specifications (GladePropertyClass *klass, /** - * glade_property_class_update_from_node: + * glade_property_def_update_from_node: * @node: the property node * @object_type: the #GType of the owning object - * @property_class: a pointer to the property class + * @property_def_ref: (inout) (nullable): a pointer to the property class * @domain: the domain to translate catalog strings from * - * Updates the @property_class with the contents of the node in the xml + * Updates the @property_def_ref with the contents of the node in the xml * file. Only the values found in the xml file are overridden. * - * Returns: %TRUE on success. @property_class is set to NULL if the property + * Returns: %TRUE on success. @property_def_ref is set to NULL if the property * has Disabled="TRUE". */ gboolean -glade_property_class_update_from_node (GladeXmlNode *node, - GType object_type, - GladePropertyClass **property_class, - const gchar *domain) +glade_property_def_update_from_node (GladeXmlNode *node, + GType object_type, + GladePropertyDef **property_def_ref, + const gchar *domain) { - GladePropertyClass *klass; + GladePropertyDef *property_def; GParamSpec *pspec = NULL; gchar *buf, *translated; GladeXmlNode *child, *spec_node; - g_return_val_if_fail (property_class != NULL, FALSE); + g_return_val_if_fail (property_def_ref != NULL, FALSE); /* for code cleanliness... */ - klass = *property_class; + property_def = *property_def_ref; - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); g_return_val_if_fail (glade_xml_node_verify (node, GLADE_TAG_PROPERTY), FALSE); @@ -1996,15 +1999,15 @@ glade_property_class_update_from_node (GladeXmlNode *node, { /* Its easier for us to keep disabled properties around and * only virtually disable them */ - klass->query = FALSE; - klass->ignore = TRUE; - klass->save = FALSE; - klass->visible = FALSE; + property_def->query = FALSE; + property_def->ignore = TRUE; + property_def->save = FALSE; + property_def->visible = FALSE; } if ((spec_node = glade_xml_search_child (node, GLADE_TAG_SPECIFICATIONS)) != NULL) - pspec = glade_property_class_parse_specifications (klass, spec_node); + pspec = glade_property_def_parse_specifications (property_def, spec_node); else if ((buf = glade_xml_get_value_string (node, GLADE_TAG_SPEC)) != NULL) { pspec = glade_utils_get_pspec_from_funcname (buf); @@ -2014,76 +2017,76 @@ glade_property_class_update_from_node (GladeXmlNode *node, /* ... get the tooltip from the pspec ... */ if (pspec != NULL) { - klass->pspec = pspec; + property_def->pspec = pspec; /* Make sure we can tell properties apart by there * owning class. */ - klass->pspec->owner_type = object_type; + property_def->pspec->owner_type = object_type; /* We overrode the pspec, now it *is* a virtual property. */ - klass->virt = TRUE; + property_def->virt = TRUE; - if (strcmp (g_param_spec_get_blurb (klass->pspec), "dummy") != 0) + if (strcmp (g_param_spec_get_blurb (property_def->pspec), "dummy") != 0) { - g_free (klass->tooltip); - klass->tooltip = g_strdup (g_param_spec_get_blurb (klass->pspec)); + g_free (property_def->tooltip); + property_def->tooltip = g_strdup (g_param_spec_get_blurb (property_def->pspec)); } - if (klass->name == NULL || - strcmp (g_param_spec_get_nick (klass->pspec), "dummy") != 0) + if (property_def->name == NULL || + strcmp (g_param_spec_get_nick (property_def->pspec), "dummy") != 0) { - g_free (klass->name); - klass->name = g_strdup (g_param_spec_get_nick (klass->pspec)); + g_free (property_def->name); + property_def->name = g_strdup (g_param_spec_get_nick (property_def->pspec)); } - if (klass->pspec->flags & G_PARAM_CONSTRUCT_ONLY) - klass->construct_only = TRUE; + if (property_def->pspec->flags & G_PARAM_CONSTRUCT_ONLY) + property_def->construct_only = TRUE; - if (klass->orig_def) + if (property_def->orig_def) { - g_value_unset (klass->orig_def); - g_free (klass->orig_def); + g_value_unset (property_def->orig_def); + g_free (property_def->orig_def); } - klass->orig_def = - glade_property_class_get_default_from_spec (klass->pspec); + property_def->orig_def = + glade_property_def_get_default_from_spec (property_def->pspec); - if (klass->def) + if (property_def->def) { - g_value_unset (klass->def); - g_free (klass->def); + g_value_unset (property_def->def); + g_free (property_def->def); } - klass->def = glade_property_class_get_default_from_spec (klass->pspec); + property_def->def = glade_property_def_get_default_from_spec (property_def->pspec); } - else if (!klass->pspec) + else if (!property_def->pspec) { /* If catalog file didn't specify a pspec function * and this property isn't found by introspection * we simply delete it from the list always. */ - glade_property_class_free (klass); - *property_class = NULL; + glade_property_def_free (property_def); + *property_def_ref = NULL; return TRUE; } /* Get the default */ if ((buf = glade_xml_get_property_string (node, GLADE_TAG_DEFAULT)) != NULL) { - if (klass->def) + if (property_def->def) { - g_value_unset (klass->def); - g_free (klass->def); + g_value_unset (property_def->def); + g_free (property_def->def); } - klass->def = - glade_property_class_make_gvalue_from_string (klass, buf, NULL); + property_def->def = + glade_property_def_make_gvalue_from_string (property_def, buf, NULL); - if (klass->virt) + if (property_def->virt) { - g_value_unset (klass->orig_def); - g_free (klass->orig_def); - klass->orig_def = - glade_property_class_make_gvalue_from_string (klass, buf, NULL); + g_value_unset (property_def->orig_def); + g_free (property_def->orig_def); + property_def->orig_def = + glade_property_def_make_gvalue_from_string (property_def, buf, NULL); } g_free (buf); @@ -2092,124 +2095,124 @@ glade_property_class_update_from_node (GladeXmlNode *node, /* If needed, update the name... */ if ((buf = glade_xml_get_property_string (node, GLADE_TAG_NAME)) != NULL) { - g_free (klass->name); + g_free (property_def->name); translated = dgettext (domain, buf); if (buf != translated) { /* translated is owned by gettext */ - klass->name = g_strdup (translated); + property_def->name = g_strdup (translated); g_free (buf); } else { - klass->name = buf; + property_def->name = buf; } } /* ...and the tooltip */ if ((buf = glade_xml_get_value_string (node, GLADE_TAG_TOOLTIP)) != NULL) { - g_free (klass->tooltip); + g_free (property_def->tooltip); translated = dgettext (domain, buf); if (buf != translated) { /* translated is owned by gettext */ - klass->tooltip = g_strdup (translated); + property_def->tooltip = g_strdup (translated); g_free (buf); } else { - klass->tooltip = buf; + property_def->tooltip = buf; } } - klass->multiline = + property_def->multiline = glade_xml_get_property_boolean (node, GLADE_TAG_MULTILINE, - klass->multiline); - klass->construct_only = + property_def->multiline); + property_def->construct_only = glade_xml_get_property_boolean (node, GLADE_TAG_CONSTRUCT_ONLY, - klass->construct_only); - klass->translatable = + property_def->construct_only); + property_def->translatable = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSLATABLE, - klass->translatable); - klass->common = - glade_xml_get_property_boolean (node, GLADE_TAG_COMMON, klass->common); - klass->optional = + property_def->translatable); + property_def->common = + glade_xml_get_property_boolean (node, GLADE_TAG_COMMON, property_def->common); + property_def->optional = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL, - klass->optional); - klass->query = - glade_xml_get_property_boolean (node, GLADE_TAG_QUERY, klass->query); - klass->save = - glade_xml_get_property_boolean (node, GLADE_TAG_SAVE, klass->save); - klass->visible = - glade_xml_get_property_boolean (node, GLADE_TAG_VISIBLE, klass->visible); - klass->custom_layout = + property_def->optional); + property_def->query = + glade_xml_get_property_boolean (node, GLADE_TAG_QUERY, property_def->query); + property_def->save = + glade_xml_get_property_boolean (node, GLADE_TAG_SAVE, property_def->save); + property_def->visible = + glade_xml_get_property_boolean (node, GLADE_TAG_VISIBLE, property_def->visible); + property_def->custom_layout = glade_xml_get_property_boolean (node, GLADE_TAG_CUSTOM_LAYOUT, - klass->custom_layout); - klass->ignore = - glade_xml_get_property_boolean (node, GLADE_TAG_IGNORE, klass->ignore); - klass->needs_sync = + property_def->custom_layout); + property_def->ignore = + glade_xml_get_property_boolean (node, GLADE_TAG_IGNORE, property_def->ignore); + property_def->needs_sync = glade_xml_get_property_boolean (node, GLADE_TAG_NEEDS_SYNC, - klass->needs_sync); - klass->themed_icon = + property_def->needs_sync); + property_def->themed_icon = glade_xml_get_property_boolean (node, GLADE_TAG_THEMED_ICON, - klass->themed_icon); - klass->stock = - glade_xml_get_property_boolean (node, GLADE_TAG_STOCK, klass->stock); - klass->stock_icon = + property_def->themed_icon); + property_def->stock = + glade_xml_get_property_boolean (node, GLADE_TAG_STOCK, property_def->stock); + property_def->stock_icon = glade_xml_get_property_boolean (node, GLADE_TAG_STOCK_ICON, - klass->stock_icon); - klass->weight = - glade_xml_get_property_double (node, GLADE_TAG_WEIGHT, klass->weight); - klass->transfer_on_paste = + property_def->stock_icon); + property_def->weight = + glade_xml_get_property_double (node, GLADE_TAG_WEIGHT, property_def->weight); + property_def->transfer_on_paste = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSFER_ON_PASTE, - klass->transfer_on_paste); - klass->save_always = + property_def->transfer_on_paste); + property_def->save_always = glade_xml_get_property_boolean (node, GLADE_TAG_SAVE_ALWAYS, - klass->save_always); - klass->parentless_widget = + property_def->save_always); + property_def->parentless_widget = glade_xml_get_property_boolean (node, GLADE_TAG_PARENTLESS_WIDGET, - klass->parentless_widget); + property_def->parentless_widget); glade_xml_get_property_version (node, GLADE_TAG_VERSION_SINCE, - &klass->version_since_major, - &klass->version_since_minor); + &property_def->version_since_major, + &property_def->version_since_minor); - klass->deprecated = + property_def->deprecated = glade_xml_get_property_boolean (node, GLADE_TAG_DEPRECATED, - klass->deprecated); + property_def->deprecated); if ((buf = glade_xml_get_property_string (node, GLADE_TAG_CREATE_TYPE)) != NULL) { - g_clear_pointer (&klass->create_type, g_free); - klass->create_type = buf; + g_clear_pointer (&property_def->create_type, g_free); + property_def->create_type = buf; } /* If this property's value is an enumeration or flag then we try to get the displayable values */ - if ((G_IS_PARAM_SPEC_ENUM (klass->pspec) || - G_IS_PARAM_SPEC_FLAGS (klass->pspec)) && + if ((G_IS_PARAM_SPEC_ENUM (property_def->pspec) || + G_IS_PARAM_SPEC_FLAGS (property_def->pspec)) && (child = glade_xml_search_child (node, GLADE_TAG_DISPLAYABLE_VALUES))) - gpc_read_displayable_values_from_node (child, klass, domain); + gpc_read_displayable_values_from_node (child, property_def, domain); /* Right now allowing the backend to specify that some properties * go in the atk tab, ideally this shouldnt be needed. */ - klass->atk = - glade_xml_get_property_boolean (node, GLADE_TAG_ATK_PROPERTY, klass->atk); + property_def->atk = + glade_xml_get_property_boolean (node, GLADE_TAG_ATK_PROPERTY, property_def->atk); - if (klass->optional) - klass->optional_default = + if (property_def->optional) + property_def->optional_default = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL_DEFAULT, - klass->optional_default); + property_def->optional_default); /* notify that we changed the property class */ - klass->is_modified = TRUE; + property_def->is_modified = TRUE; return TRUE; } @@ -2217,44 +2220,44 @@ glade_property_class_update_from_node (GladeXmlNode *node, /** - * glade_property_class_match: - * @klass: a #GladePropertyClass - * @comp: a #GladePropertyClass + * glade_property_def_match: + * @property_def: a #GladePropertyDef + * @comp: a #GladePropertyDef * - * Returns: whether @klass and @comp are a match or not + * Returns: whether @property_def and @comp are a match or not * (properties in seperate decendant heirarchies that * have the same name are not matches). */ gboolean -glade_property_class_match (GladePropertyClass *klass, - GladePropertyClass *comp) +glade_property_def_match (GladePropertyDef *property_def, + GladePropertyDef *comp) { - g_return_val_if_fail (klass != NULL, FALSE); + g_return_val_if_fail (property_def != NULL, FALSE); g_return_val_if_fail (comp != NULL, FALSE); - return (strcmp (klass->id, comp->id) == 0 && - klass->packing == comp->packing && - klass->pspec->owner_type == comp->pspec->owner_type); + return (strcmp (property_def->id, comp->id) == 0 && + property_def->packing == comp->packing && + property_def->pspec->owner_type == comp->pspec->owner_type); } /** - * glade_property_class_void_value: - * @klass: a #GladePropertyClass - * @value: a GValue of correct type for @klass + * glade_property_def_void_value: + * @property_def: a #GladePropertyDef + * @value: a GValue of correct type for @property_def * - * Returns: Whether @value for this @klass is voided; a voided value + * Returns: Whether @value for this @property_def is voided; a voided value * can be a %NULL value for boxed or object type param specs. */ gboolean -glade_property_class_void_value (GladePropertyClass *klass, GValue *value) +glade_property_def_void_value (GladePropertyDef *property_def, GValue *value) { - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), FALSE); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), FALSE); - if (G_IS_PARAM_SPEC_OBJECT (klass->pspec) && + if (G_IS_PARAM_SPEC_OBJECT (property_def->pspec) && g_value_get_object (value) == NULL) return TRUE; - else if (G_IS_PARAM_SPEC_BOXED (klass->pspec) && + else if (G_IS_PARAM_SPEC_BOXED (property_def->pspec) && g_value_get_boxed (value) == NULL) return TRUE; @@ -2262,24 +2265,24 @@ glade_property_class_void_value (GladePropertyClass *klass, GValue *value) } /** - * glade_property_class_compare: - * @klass: a #GladePropertyClass - * @value1: a GValue of correct type for @klass - * @value2: a GValue of correct type for @klass + * glade_property_def_compare: + * @property_def: a #GladePropertyDef + * @value1: a GValue of correct type for @property_def + * @value2: a GValue of correct type for @property_def * - * Compares value1 with value2 according to @klass. + * Compares value1 with value2 according to @property_def. * * Returns: -1, 0 or +1, if value1 is found to be less than, * equal to or greater than value2, respectively. */ gint -glade_property_class_compare (GladePropertyClass *klass, - const GValue *value1, - const GValue *value2) +glade_property_def_compare (GladePropertyDef *property_def, + const GValue *value1, + const GValue *value2) { gint retval; - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), -1); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (property_def), -1); /* GLib does not know how to compare a boxed real value */ if (G_VALUE_HOLDS_BOXED (value1) || G_VALUE_HOLDS_BOXED (value2)) @@ -2292,9 +2295,9 @@ glade_property_class_compare (GladePropertyClass *klass, * NOTE: We could add a pclass option to use the string compare vs. boxed compare... */ val1 = - glade_widget_adaptor_string_from_value (klass->adaptor, klass, value1); + glade_widget_adaptor_string_from_value (property_def->adaptor, property_def, value1); val2 = - glade_widget_adaptor_string_from_value (klass->adaptor, klass, value2); + glade_widget_adaptor_string_from_value (property_def->adaptor, property_def, value2); if (val1 && val2) retval = strcmp (val1, val2); @@ -2306,7 +2309,7 @@ glade_property_class_compare (GladePropertyClass *klass, } else { - if (G_IS_PARAM_SPEC_STRING (klass->pspec)) + if (G_IS_PARAM_SPEC_STRING (property_def->pspec)) { const gchar *value_str1, *value_str2; @@ -2321,64 +2324,64 @@ glade_property_class_compare (GladePropertyClass *klass, else if (value_str2 == NULL && value_str1 && value_str1[0] == '\0') return 0; } - retval = g_param_values_cmp (klass->pspec, value1, value2); + retval = g_param_values_cmp (property_def->pspec, value1, value2); } return retval; } /** - * glade_property_class_set_weights: - * @properties: (element-type GladePropertyClass): a list of #GladePropertyClass + * glade_property_def_set_weights: + * @properties: (element-type GladePropertyDef): a list of #GladePropertyDef * @parent: the #GType of the parent * * This function assignes "weight" to each property in its natural order staring from 1. - * If parent is 0 weight will be set for every #GladePropertyClass in the list. + * If parent is 0 weight will be set for every #GladePropertyDef in the list. * This function will not override weight if it is already set (weight >= 0.0) */ void -glade_property_class_set_weights (GList **properties, GType parent) +glade_property_def_set_weights (GList **properties, GType parent) { gint normal = 0, common = 0, packing = 0; GList *l; for (l = *properties; l && l->data; l = g_list_next (l)) { - GladePropertyClass *klass = l->data; + GladePropertyDef *property_def = l->data; - if (klass->visible && - (parent) ? parent == klass->pspec->owner_type : TRUE && !klass->atk) + if (property_def->visible && + (parent) ? parent == property_def->pspec->owner_type : TRUE && !property_def->atk) { /* Use a different counter for each tab (common, packing and normal) */ - if (klass->common) + if (property_def->common) common++; - else if (klass->packing) + else if (property_def->packing) packing++; else normal++; /* Skip if it is already set */ - if (klass->weight >= 0.0) + if (property_def->weight >= 0.0) continue; /* Special-casing weight of properties for seperate tabs */ - if (klass->common) - klass->weight = common; - else if (klass->packing) - klass->weight = packing; + if (property_def->common) + property_def->weight = common; + else if (property_def->packing) + property_def->weight = packing; else - klass->weight = normal; + property_def->weight = normal; } } } void -glade_property_class_load_defaults_from_spec (GladePropertyClass *property_class) +glade_property_def_load_defaults_from_spec (GladePropertyDef *property_def) { - property_class->orig_def = - glade_property_class_get_default_from_spec (property_class->pspec); + property_def->orig_def = + glade_property_def_get_default_from_spec (property_def->pspec); - property_class->def = - glade_property_class_get_default_from_spec (property_class->pspec); + property_def->def = + glade_property_def_get_default_from_spec (property_def->pspec); } diff --git a/gladeui/glade-property-def.h b/gladeui/glade-property-def.h new file mode 100644 index 00000000..2c5c0b69 --- /dev/null +++ b/gladeui/glade-property-def.h @@ -0,0 +1,172 @@ +#ifndef __GLADE_PROPERTY_DEF_H__ +#define __GLADE_PROPERTY_DEF_H__ + +#include <glib.h> +#include <glib-object.h> +#include <gtk/gtk.h> + +#include <gladeui/glade-xml-utils.h> + +G_BEGIN_DECLS + +#define GLADE_TYPE_PROPERTY_DEF glade_property_def_get_type () + +/* The GladePropertyDef structure parameters of a GladeProperty. + * All entries in the GladeEditor are GladeProperties (except signals) + * All GladeProperties are associated with a GParamSpec. + */ +#define GLADE_PROPERTY_DEF(gpc) ((GladePropertyDef *) gpc) +#define GLADE_IS_PROPERTY_DEF(gpc) (gpc != NULL) + +/** + * GLADE_PROPERTY_DEF_IS_TYPE: + * @gpc: A #GladePropertyDef + * @type: The #GladeEditorPageType to query + * + * Checks if @gpc is good to be loaded as @type + */ +#define GLADE_PROPERTY_DEF_IS_TYPE(gpc, type) \ + (((type) == GLADE_PAGE_GENERAL && \ + !glade_property_def_common (gpc) && \ + !glade_property_def_get_is_packing (gpc) && \ + !glade_property_def_atk (gpc)) || \ + ((type) == GLADE_PAGE_COMMON && glade_property_def_common (gpc)) || \ + ((type) == GLADE_PAGE_PACKING && glade_property_def_get_is_packing (gpc)) || \ + ((type) == GLADE_PAGE_ATK && glade_property_def_atk (gpc)) || \ + ((type) == GLADE_PAGE_QUERY && glade_property_def_query (gpc))) + +/** + * GPC_VERSION_CHECK: + * @def: A #GladePropertyDef + * @major_version: The major version to check + * @minor_version: The minor version to check + * + * Evaluates to %TRUE if @def is available in its owning library version-@major_verion.@minor_version. + * + */ +#define GPC_VERSION_CHECK(def, major_version, minor_version) \ + ((glade_property_def_since_major (GLADE_PROPERTY_DEF (def)) == major_version) ? \ + (glade_property_def_since_minor (GLADE_PROPERTY_DEF (def)) <= minor_version) : \ + (glade_property_def_since_major (GLADE_PROPERTY_DEF (def)) <= major_version)) + + +#define GPC_OBJECT_DELIMITER ", " +#define GPC_PROPERTY_NAMELEN 512 /* Enough space for a property name I think */ + +typedef struct _GladePropertyDef GladePropertyDef; + +GType glade_property_def_get_type (void) G_GNUC_CONST; +GladePropertyDef *glade_property_def_new (GladeWidgetAdaptor *adaptor, + const gchar *id); +GladePropertyDef *glade_property_def_new_from_spec (GladeWidgetAdaptor *adaptor, + GParamSpec *spec); +GladePropertyDef *glade_property_def_new_from_spec_full (GladeWidgetAdaptor *adaptor, + GParamSpec *spec, + gboolean need_handle); +GladePropertyDef *glade_property_def_clone (GladePropertyDef *property_def); +void glade_property_def_free (GladePropertyDef *property_def); + +void glade_property_def_set_adaptor (GladePropertyDef *property_def, + GladeWidgetAdaptor *adaptor); +GladeWidgetAdaptor *glade_property_def_get_adaptor (GladePropertyDef *property_def); +void glade_property_def_set_pspec (GladePropertyDef *property_def, + GParamSpec *pspec); +GParamSpec *glade_property_def_get_pspec (GladePropertyDef *property_def); +void glade_property_def_set_is_packing (GladePropertyDef *property_def, + gboolean is_packing); +gboolean glade_property_def_get_is_packing (GladePropertyDef *property_def); +gboolean glade_property_def_save (GladePropertyDef *property_def); +gboolean glade_property_def_save_always (GladePropertyDef *property_def); +gboolean glade_property_def_is_visible (GladePropertyDef *property_def); +gboolean glade_property_def_is_object (GladePropertyDef *property_def); +void glade_property_def_set_virtual (GladePropertyDef *property_def, + gboolean value); +gboolean glade_property_def_get_virtual (GladePropertyDef *property_def); +void glade_property_def_set_ignore (GladePropertyDef *property_def, + gboolean ignore); +gboolean glade_property_def_get_ignore (GladePropertyDef *property_def); +void glade_property_def_set_name (GladePropertyDef *property_def, + const gchar *name); +G_CONST_RETURN gchar *glade_property_def_get_name (GladePropertyDef *property_def); +void glade_property_def_set_tooltip (GladePropertyDef *property_def, + const gchar *tooltip); +G_CONST_RETURN gchar *glade_property_def_get_tooltip (GladePropertyDef *property_def); +G_CONST_RETURN gchar *glade_property_def_id (GladePropertyDef *property_def); +gboolean glade_property_def_themed_icon (GladePropertyDef *property_def); +void glade_property_def_set_construct_only (GladePropertyDef *property_def, + gboolean construct_only); +gboolean glade_property_def_get_construct_only (GladePropertyDef *property_def); +G_CONST_RETURN GValue *glade_property_def_get_default (GladePropertyDef *property_def); +G_CONST_RETURN GValue *glade_property_def_get_original_default (GladePropertyDef *property_def); +gboolean glade_property_def_translatable (GladePropertyDef *property_def); +gboolean glade_property_def_needs_sync (GladePropertyDef *property_def); + +gboolean glade_property_def_query (GladePropertyDef *property_def); +gboolean glade_property_def_atk (GladePropertyDef *property_def); +gboolean glade_property_def_common (GladePropertyDef *property_def); +gboolean glade_property_def_parentless_widget (GladePropertyDef *property_def); +gboolean glade_property_def_optional (GladePropertyDef *property_def); +gboolean glade_property_def_optional_default (GladePropertyDef *property_def); +gboolean glade_property_def_multiline (GladePropertyDef *property_def); +gboolean glade_property_def_stock (GladePropertyDef *property_def); +gboolean glade_property_def_stock_icon (GladePropertyDef *property_def); +gboolean glade_property_def_transfer_on_paste (GladePropertyDef *property_def); +gboolean glade_property_def_custom_layout (GladePropertyDef *property_def); +gdouble glade_property_def_weight (GladePropertyDef *property_def); + +G_CONST_RETURN gchar *glade_property_def_create_type (GladePropertyDef *property_def); + +guint16 glade_property_def_since_major (GladePropertyDef *property_def); +guint16 glade_property_def_since_minor (GladePropertyDef *property_def); +gboolean glade_property_def_deprecated (GladePropertyDef *property_def); + +GValue *glade_property_def_make_gvalue_from_string (GladePropertyDef *property_def, + const gchar *string, + GladeProject *project); + +gchar *glade_property_def_make_string_from_gvalue (GladePropertyDef *property_def, + const GValue *value); + +GValue *glade_property_def_make_gvalue_from_vl (GladePropertyDef *property_def, + va_list vl); + +void glade_property_def_set_vl_from_gvalue (GladePropertyDef *property_def, + GValue *value, + va_list vl); + +GValue *glade_property_def_make_gvalue (GladePropertyDef *property_def, + ...); + +void glade_property_def_get_from_gvalue (GladePropertyDef *property_def, + GValue *value, + ...); + +gboolean glade_property_def_update_from_node (GladeXmlNode *node, + GType object_type, + GladePropertyDef **property_def_ref, + const gchar *domain); + +GtkAdjustment *glade_property_def_make_adjustment (GladePropertyDef *property_def); + +gboolean glade_property_def_match (GladePropertyDef *property_def, + GladePropertyDef *comp); + +gboolean glade_property_def_void_value (GladePropertyDef *property_def, + GValue *value); + +gint glade_property_def_compare (GladePropertyDef *property_def, + const GValue *value1, + const GValue *value2); + +GValue *glade_property_def_get_default_from_spec (GParamSpec *spec); + +void glade_property_def_set_weights (GList **properties, + GType parent); + +void glade_property_def_load_defaults_from_spec (GladePropertyDef *property_def); + +guint glade_property_def_make_flags_from_string (GType type, + const char *string); +G_END_DECLS + +#endif /* __GLADE_PROPERTY_DEF_H__ */ diff --git a/gladeui/glade-property-label.c b/gladeui/glade-property-label.c index 5fb71789..06e995f6 100644 --- a/gladeui/glade-property-label.c +++ b/gladeui/glade-property-label.c @@ -580,10 +580,10 @@ glade_property_label_set_custom_tooltip (GladePropertyLabel *label, if (priv->property) { - GladePropertyClass *pclass = glade_property_get_class (priv->property); + GladePropertyDef *pdef = glade_property_get_def (priv->property); glade_property_label_tooltip_cb - (priv->property, glade_property_class_get_tooltip (pclass), + (priv->property, glade_property_def_get_tooltip (pdef), glade_propert_get_insensitive_tooltip (priv->property), glade_property_get_support_warning (priv->property), label); } @@ -648,7 +648,7 @@ glade_property_label_set_property (GladePropertyLabel *label, /* Connect new */ if (priv->property) { - GladePropertyClass *pclass = glade_property_get_class (priv->property); + GladePropertyDef *pdef = glade_property_get_def (priv->property); priv->tooltip_id = g_signal_connect (G_OBJECT (priv->property), @@ -676,7 +676,7 @@ glade_property_label_set_property (GladePropertyLabel *label, /* Load initial tooltips */ glade_property_label_tooltip_cb - (property, glade_property_class_get_tooltip (pclass), + (property, glade_property_def_get_tooltip (pdef), glade_propert_get_insensitive_tooltip (property), glade_property_get_support_warning (property), label); @@ -692,14 +692,14 @@ glade_property_label_set_property (GladePropertyLabel *label, { if (priv->append_colon) { - gchar *text = g_strdup_printf ("%s:", glade_property_class_get_name (pclass)); + gchar *text = g_strdup_printf ("%s:", glade_property_def_get_name (pdef)); gtk_label_set_text (GTK_LABEL (priv->label), text); g_free (text); } else { gtk_label_set_text (GTK_LABEL (priv->label), - glade_property_class_get_name (pclass)); + glade_property_def_get_name (pdef)); } } } diff --git a/gladeui/glade-property-label.h b/gladeui/glade-property-label.h index 745336e2..2bef9eb9 100644 --- a/gladeui/glade-property-label.h +++ b/gladeui/glade-property-label.h @@ -23,7 +23,7 @@ #include <gtk/gtk.h> #include <gladeui/glade-xml-utils.h> -#include <gladeui/glade-property-class.h> +#include <gladeui/glade-property-def.h> #include <gladeui/glade-property.h> G_BEGIN_DECLS diff --git a/gladeui/glade-property-shell.c b/gladeui/glade-property-shell.c index 66242527..7d4c2269 100644 --- a/gladeui/glade-property-shell.c +++ b/gladeui/glade-property-shell.c @@ -355,7 +355,7 @@ glade_property_shell_load (GladeEditable *editable, /* Need to rebuild the internal editor */ if (priv->adaptor != adaptor) { - GladePropertyClass *pclass = NULL; + GladePropertyDef *pdef = NULL; GladeEditorProperty *eprop = NULL; priv->adaptor = adaptor; @@ -363,18 +363,18 @@ glade_property_shell_load (GladeEditable *editable, if (adaptor) { if (priv->packing) - pclass = glade_widget_adaptor_get_pack_property_class (priv->adaptor, - priv->property_name); + pdef = glade_widget_adaptor_get_pack_property_def (priv->adaptor, + priv->property_name); else - pclass = glade_widget_adaptor_get_property_class (priv->adaptor, - priv->property_name); + pdef = glade_widget_adaptor_get_property_def (priv->adaptor, + priv->property_name); } /* Be forgiving, allow usage of properties that wont work, so that * some editors can include properties for subclasses, and hide * those properties if they're not applicable */ - if (pclass == NULL) + if (pdef == NULL) { priv->property_editor = NULL; } @@ -382,7 +382,7 @@ glade_property_shell_load (GladeEditable *editable, else if (g_type_is_a (priv->editor_type, GLADE_TYPE_EDITOR_PROPERTY)) { eprop = g_object_new (priv->editor_type, - "property-class", pclass, + "property-def", pdef, "use-command", priv->use_command, NULL); } diff --git a/gladeui/glade-property-shell.h b/gladeui/glade-property-shell.h index 6c083e51..dfb42c59 100644 --- a/gladeui/glade-property-shell.h +++ b/gladeui/glade-property-shell.h @@ -23,7 +23,7 @@ #include <gtk/gtk.h> #include <gladeui/glade-xml-utils.h> -#include <gladeui/glade-property-class.h> +#include <gladeui/glade-property-def.h> #include <gladeui/glade-property.h> G_BEGIN_DECLS diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c index 20b1c7b7..7c5f324c 100644 --- a/gladeui/glade-property.c +++ b/gladeui/glade-property.c @@ -34,8 +34,8 @@ * a #GladeProperty to interface with, #GladeProperty provides a means * to handle properties in the runtime environment. * - * A #GladeProperty can be seen as an instance of a #GladePropertyClass, - * the #GladePropertyClass describes how a #GladeProperty will function. + * A #GladeProperty can be seen as an instance of a #GladePropertyDef, + * the #GladePropertyDef describes how a #GladeProperty will function. */ #include <stdio.h> @@ -47,7 +47,7 @@ #include "glade.h" #include "glade-widget.h" #include "glade-property.h" -#include "glade-property-class.h" +#include "glade-property-def.h" #include "glade-project.h" #include "glade-widget-adaptor.h" #include "glade-debug.h" @@ -57,7 +57,7 @@ struct _GladePropertyPrivate { - GladePropertyClass *klass; /* A pointer to the GladeProperty that this + GladePropertyDef *def; /* A pointer to the GladeProperty that this * setting specifies */ GladeWidget *widget; /* A pointer to the GladeWidget that this @@ -162,7 +162,7 @@ glade_property_dup_impl (GladeProperty *template_prop, GladeWidget *widget) GladeProperty *property; property = g_object_new (GLADE_TYPE_PROPERTY, - "class", template_prop->priv->klass, + "class", template_prop->priv->def, "i18n-translatable", template_prop->priv->i18n_translatable, "i18n-context", template_prop->priv->i18n_context, "i18n-comment", template_prop->priv->i18n_comment, @@ -173,9 +173,9 @@ glade_property_dup_impl (GladeProperty *template_prop, GladeWidget *widget) g_value_init (property->priv->value, template_prop->priv->value->g_type); /* Cannot duplicate parentless_widget property */ - if (glade_property_class_parentless_widget (template_prop->priv->klass)) + if (glade_property_def_parentless_widget (template_prop->priv->def)) { - if (!G_IS_PARAM_SPEC_OBJECT (glade_property_class_get_pspec (template_prop->priv->klass))) + if (!G_IS_PARAM_SPEC_OBJECT (glade_property_def_get_pspec (template_prop->priv->def))) g_warning ("Parentless widget property should be of object type"); g_value_set_object (property->priv->value, NULL); @@ -196,7 +196,7 @@ static gboolean glade_property_equals_value_impl (GladeProperty *property, const GValue *value) { - return !glade_property_class_compare (property->priv->klass, property->priv->value, + return !glade_property_def_compare (property->priv->def, property->priv->value, value); } @@ -210,7 +210,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 (glade_property_class_get_pspec (property->priv->klass))) + if (GLADE_IS_PARAM_SPEC_OBJECTS (glade_property_def_get_pspec (property->priv->def))) { /* Make our own copies incase we're walking an * unstable list @@ -269,17 +269,17 @@ glade_property_verify (GladeProperty *property, const GValue *value) parent = glade_widget_get_parent (property->priv->widget); - if (glade_property_class_get_is_packing (property->priv->klass) && parent) + if (glade_property_def_get_is_packing (property->priv->def) && parent) ret = glade_widget_adaptor_child_verify_property (glade_widget_get_adaptor (parent), glade_widget_get_object (parent), glade_widget_get_object (property->priv->widget), - glade_property_class_id (property->priv->klass), + glade_property_def_id (property->priv->def), value); - else if (!glade_property_class_get_is_packing (property->priv->klass)) + else if (!glade_property_def_get_is_packing (property->priv->def)) ret = glade_widget_adaptor_verify_property (glade_widget_get_adaptor (property->priv->widget), glade_widget_get_object (property->priv->widget), - glade_property_class_id (property->priv->klass), value); + glade_property_def_id (property->priv->def), value); return ret; } @@ -293,7 +293,7 @@ glade_property_fix_state (GladeProperty *property) * they are optional and enabled, optional enabled properties * are saved regardless of default value */ - if (glade_property_class_optional (property->priv->klass)) + if (glade_property_def_optional (property->priv->def)) { if (glade_property_get_enabled (property)) property->priv->state |= GLADE_STATE_CHANGED; @@ -331,16 +331,16 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value) if (glade_get_debug_flags () & GLADE_DEBUG_PROPERTIES) { g_print ("PROPERTY: Setting %s property %s on %s ", - glade_property_class_get_is_packing (property->priv->klass) ? "packing" : "normal", - glade_property_class_id (property->priv->klass), + glade_property_def_get_is_packing (property->priv->def) ? "packing" : "normal", + glade_property_def_id (property->priv->def), property->priv->widget ? glade_widget_get_name (property->priv->widget) : "unknown"); gchar *str1 = - glade_widget_adaptor_string_from_value (glade_property_class_get_adaptor (property->priv->klass), - property->priv->klass, property->priv->value); + glade_widget_adaptor_string_from_value (glade_property_def_get_adaptor (property->priv->def), + property->priv->def, property->priv->value); gchar *str2 = - glade_widget_adaptor_string_from_value (glade_property_class_get_adaptor (property->priv->klass), - property->priv->klass, value); + glade_widget_adaptor_string_from_value (glade_property_def_get_adaptor (property->priv->def), + property->priv->def, value); g_print ("from %s to %s\n", str1, str2); g_free (str1); g_free (str2); @@ -350,7 +350,7 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value) if (!g_value_type_compatible (G_VALUE_TYPE (property->priv->value), G_VALUE_TYPE (value))) { g_warning ("Trying to assign an incompatible value to property %s\n", - glade_property_class_id (property->priv->klass)); + glade_property_def_id (property->priv->def)); return FALSE; } @@ -372,7 +372,7 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value) * (before assigning the value) */ if (property->priv->widget && changed && - glade_property_class_is_object (property->priv->klass)) + glade_property_def_is_object (property->priv->def)) glade_property_update_prop_refs (property, property->priv->value, value); /* Check pre-changed warning state */ @@ -409,7 +409,7 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value) } /* Special case parentless widget properties */ - if (glade_property_class_parentless_widget (property->priv->klass)) + if (glade_property_def_parentless_widget (property->priv->def)) { GladeWidget *gobj; GObject *obj; @@ -432,7 +432,7 @@ glade_property_get_value_impl (GladeProperty *property, GValue *value) { GParamSpec *pspec; - pspec = glade_property_class_get_pspec (property->priv->klass); + pspec = glade_property_def_get_pspec (property->priv->def); g_value_init (value, pspec->value_type); g_value_copy (property->priv->value, value); @@ -442,7 +442,7 @@ static void glade_property_sync_impl (GladeProperty *property) { GladePropertyPrivate *priv = property->priv; - GladePropertyClass *klass = priv->klass; + GladePropertyDef *def = priv->def; const GValue *value; const gchar *id; @@ -451,21 +451,21 @@ glade_property_sync_impl (GladeProperty *property) */ if (/* the class can be NULL during object, * construction this is just a temporary state */ - klass == NULL || + def == NULL || /* explicit "never sync" flag */ - glade_property_class_get_ignore (klass) || + glade_property_def_get_ignore (def) || /* recursion guards */ priv->syncing >= priv->sync_tolerance || /* No widget owns this property yet */ priv->widget == NULL) return; - id = glade_property_class_id (klass); + id = glade_property_def_id (def); /* Only the properties from widget->properties should affect the runtime widget. * (other properties may be used for convenience in the plugin). */ - if ((glade_property_class_get_is_packing (klass) && + if ((glade_property_def_get_is_packing (def) && !glade_widget_get_pack_property (priv->widget, id)) || !glade_widget_get_property (priv->widget, id)) return; @@ -473,27 +473,27 @@ glade_property_sync_impl (GladeProperty *property) priv->syncing++; /* optional properties that are disabled get the default runtime value */ - value = (priv->enabled) ? priv->value : glade_property_class_get_default (klass); + value = (priv->enabled) ? priv->value : glade_property_def_get_default (def); /* In the case of construct_only, the widget instance must be rebuilt * to apply the property */ - if (glade_property_class_get_construct_only (klass) && priv->syncing == 1) + if (glade_property_def_get_construct_only (def) && 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 (glade_property_class_get_virtual (klass)) + if (glade_property_def_get_virtual (def)) priv->sync_tolerance++; glade_widget_rebuild (priv->widget); - if (glade_property_class_get_virtual (klass)) + if (glade_property_def_get_virtual (def)) priv->sync_tolerance--; } - else if (glade_property_class_get_is_packing (klass)) + else if (glade_property_def_get_is_packing (def)) glade_widget_child_set_property (glade_widget_get_parent (priv->widget), priv->widget, id, value); else @@ -509,21 +509,21 @@ glade_property_load_impl (GladeProperty *property) GObjectClass *oclass; GParamSpec *pspec; - pspec = glade_property_class_get_pspec (property->priv->klass); + pspec = glade_property_def_get_pspec (property->priv->def); if (property->priv->widget == NULL || - glade_property_class_get_virtual (property->priv->klass) || - glade_property_class_get_is_packing (property->priv->klass) || - glade_property_class_get_ignore (property->priv->klass) || + glade_property_def_get_virtual (property->priv->def) || + glade_property_def_get_is_packing (property->priv->def) || + glade_property_def_get_ignore (property->priv->def) || !(pspec->flags & G_PARAM_READABLE) || G_IS_PARAM_SPEC_OBJECT (pspec)) return; object = glade_widget_get_object (property->priv->widget); oclass = G_OBJECT_GET_CLASS (object); - if (g_object_class_find_property (oclass, glade_property_class_id (property->priv->klass))) + if (g_object_class_find_property (oclass, glade_property_def_id (property->priv->def))) glade_widget_object_get_property (property->priv->widget, - glade_property_class_id (property->priv->klass), + glade_property_def_id (property->priv->def), property->priv->value); } @@ -541,7 +541,7 @@ glade_property_set_real_property (GObject *object, switch (prop_id) { case PROP_CLASS: - property->priv->klass = g_value_get_pointer (value); + property->priv->def = g_value_get_pointer (value); break; case PROP_ENABLED: glade_property_set_enabled (property, g_value_get_boolean (value)); @@ -579,7 +579,7 @@ glade_property_get_real_property (GObject *object, switch (prop_id) { case PROP_CLASS: - g_value_set_pointer (value, property->priv->klass); + g_value_set_pointer (value, property->priv->def); break; case PROP_ENABLED: g_value_set_boolean (value, glade_property_get_enabled (property)); @@ -674,7 +674,7 @@ glade_property_klass_init (GladePropertyKlass * prop_class) properties[PROP_CLASS] = g_param_spec_pointer ("class", _("Class"), - _("The GladePropertyClass for this property"), + _("The GladePropertyDef for this property"), G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE); properties[PROP_ENABLED] = @@ -786,7 +786,7 @@ glade_property_get_type (void) *******************************************************************************/ /** * glade_property_new: - * @klass: A #GladePropertyClass defining this property + * @def: A #GladePropertyDef defining this property * @widget: The #GladeWidget this property is created for * @value: The initial #GValue of the property or %NULL * (the #GladeProperty will assume ownership of @value) @@ -798,26 +798,26 @@ glade_property_get_type (void) * Returns: The newly created #GladeProperty */ GladeProperty * -glade_property_new (GladePropertyClass *klass, - GladeWidget *widget, - GValue *value) +glade_property_new (GladePropertyDef *def, + GladeWidget *widget, + GValue *value) { GladeProperty *property; - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (def), NULL); property = (GladeProperty *) g_object_new (GLADE_TYPE_PROPERTY, NULL); - property->priv->klass = klass; + property->priv->def = def; property->priv->widget = widget; property->priv->value = value; - if (glade_property_class_optional (klass)) - property->priv->enabled = glade_property_class_optional_default (klass); + if (glade_property_def_optional (def)) + property->priv->enabled = glade_property_def_optional_default (def); if (property->priv->value == NULL) { const GValue *orig_def = - glade_property_class_get_original_default (klass); + glade_property_def_get_original_default (def); property->priv->value = g_new0 (GValue, 1); g_value_init (property->priv->value, orig_def->g_type); @@ -849,9 +849,9 @@ glade_property_reset_common (GladeProperty *property, gboolean original) g_return_if_fail (GLADE_IS_PROPERTY (property)); if (original) - value = glade_property_class_get_original_default (property->priv->klass); + value = glade_property_def_get_original_default (property->priv->def); else - value = glade_property_class_get_default (property->priv->klass); + value = glade_property_def_get_default (property->priv->def); GLADE_PROPERTY_GET_KLASS (property)->set_value (property, value); } @@ -888,9 +888,9 @@ glade_property_default_common (GladeProperty *property, gboolean orig) g_return_val_if_fail (GLADE_IS_PROPERTY (property), FALSE); if (orig) - value = glade_property_class_get_original_default (property->priv->klass); + value = glade_property_def_get_original_default (property->priv->def); else - value = glade_property_class_get_default (property->priv->klass); + value = glade_property_def_get_default (property->priv->def); return GLADE_PROPERTY_GET_KLASS (property)->equals_value (property, value); } @@ -948,7 +948,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->priv->klass, vl); + value = glade_property_def_make_gvalue_from_vl (property->priv->def, vl); ret = GLADE_PROPERTY_GET_KLASS (property)->equals_value (property, value); @@ -1011,7 +1011,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->priv->klass, vl); + value = glade_property_def_make_gvalue_from_vl (property->priv->def, vl); success = GLADE_PROPERTY_GET_KLASS (property)->set_value (property, value); @@ -1073,9 +1073,9 @@ glade_property_get_default (GladeProperty *property, GValue *value) g_return_if_fail (GLADE_IS_PROPERTY (property)); g_return_if_fail (value != NULL); - pspec = glade_property_class_get_pspec (property->priv->klass); + pspec = glade_property_def_get_pspec (property->priv->def); g_value_init (value, pspec->value_type); - g_value_copy (glade_property_class_get_default (property->priv->klass), value); + g_value_copy (glade_property_def_get_default (property->priv->def), value); } /** @@ -1089,7 +1089,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->priv->klass, property->priv->value, + glade_property_def_set_vl_from_gvalue (property->priv->def, property->priv->value, vl); } @@ -1177,7 +1177,7 @@ glade_property_read (GladeProperty *property, */ property->priv->enabled = TRUE; - if (glade_property_class_is_object (property->priv->klass)) + if (glade_property_def_is_object (property->priv->def)) { /* we must synchronize this directly after loading this project * (i.e. lookup the actual objects after they've been parsed and @@ -1189,7 +1189,7 @@ glade_property_read (GladeProperty *property, else { gvalue = - glade_property_class_make_gvalue_from_string (property->priv->klass, value, project); + glade_property_def_make_gvalue_from_string (property->priv->def, value, project); GLADE_PROPERTY_GET_KLASS (property)->set_value (property, gvalue); @@ -1206,7 +1206,7 @@ glade_property_read (GladeProperty *property, property->priv->bind_property = glade_xml_get_property_string (prop, GLADE_TAG_BIND_PROPERTY); bind_flags = glade_xml_get_property_string (prop, GLADE_TAG_BIND_FLAGS); if (bind_flags) - property->priv->bind_flags = glade_property_class_make_flags_from_string (G_TYPE_BINDING_FLAGS, bind_flags); + property->priv->bind_flags = glade_property_def_make_flags_from_string (G_TYPE_BINDING_FLAGS, bind_flags); glade_property_i18n_set_translatable (property, translatable); glade_property_i18n_set_comment (property, comment); @@ -1250,8 +1250,8 @@ glade_property_write (GladeProperty *property, return; /* There can be a couple of reasons to forcefully save a property */ - save_always = (glade_property_class_save_always (property->priv->klass) || property->priv->save_always); - save_always = save_always || (glade_property_class_optional (property->priv->klass) && property->priv->enabled); + save_always = (glade_property_def_save_always (property->priv->def) || property->priv->save_always); + save_always = save_always || (glade_property_def_optional (property->priv->def) && property->priv->enabled); /* Skip properties that are default by original pspec default and that have no bound property * (excepting those that specified otherwise). @@ -1260,12 +1260,12 @@ glade_property_write (GladeProperty *property, return; /* Escape our string and save with underscores */ - name = g_strdup (glade_property_class_id (property->priv->klass)); + name = g_strdup (glade_property_def_id (property->priv->def)); glade_util_replace (name, '-', '_'); /* convert the value of this property to a string */ if (!(value = glade_widget_adaptor_string_from_value - (glade_property_class_get_adaptor (property->priv->klass), property->priv->klass, + (glade_property_def_get_adaptor (property->priv->def), property->priv->def, property->priv->value))) /* make sure we keep the empty string, also... upcomming * funcs that may not like NULL. @@ -1281,7 +1281,7 @@ glade_property_write (GladeProperty *property, glade_xml_set_content (prop_node, value); /* i18n stuff */ - if (glade_property_class_translatable (property->priv->klass)) + if (glade_property_def_translatable (property->priv->def)) { if (property->priv->i18n_translatable) glade_xml_node_set_property_string (prop_node, @@ -1362,7 +1362,7 @@ glade_property_add_object (GladeProperty *property, GObject *object) g_return_if_fail (GLADE_IS_PROPERTY (property)); g_return_if_fail (G_IS_OBJECT (object)); - pspec = glade_property_class_get_pspec (property->priv->klass); + pspec = glade_property_def_get_pspec (property->priv->def); g_return_if_fail (GLADE_IS_PARAM_SPEC_OBJECTS (pspec) || G_IS_PARAM_SPEC_OBJECT (pspec)); @@ -1405,7 +1405,7 @@ glade_property_remove_object (GladeProperty *property, GObject *object) g_return_if_fail (GLADE_IS_PROPERTY (property)); g_return_if_fail (G_IS_OBJECT (object)); - pspec = glade_property_class_get_pspec (property->priv->klass); + pspec = glade_property_def_get_pspec (property->priv->def); g_return_if_fail (GLADE_IS_PARAM_SPEC_OBJECTS (pspec) || G_IS_PARAM_SPEC_OBJECT (pspec)); @@ -1432,12 +1432,20 @@ glade_property_remove_object (GladeProperty *property, GObject *object) } } -GladePropertyClass * -glade_property_get_class (GladeProperty *property) +/** + * glade_property_get_def: + * @property: a #GladeProperty + * + * Get the #GladePropertyDef this property was created for. + * + * Returns: (transfer none): a #GladePropertyDef + */ +GladePropertyDef * +glade_property_get_def (GladeProperty *property) { g_return_val_if_fail (GLADE_IS_PROPERTY (property), NULL); - return property->priv->klass; + return property->priv->def; } @@ -1521,7 +1529,7 @@ glade_property_set_sensitive (GladeProperty *property, g_signal_emit (G_OBJECT (property), glade_property_signals[TOOLTIP_CHANGED], 0, - glade_property_class_get_tooltip (property->priv->klass), + glade_property_def_get_tooltip (property->priv->def), property->priv->insensitive_tooltip, property->priv->support_warning); } @@ -1564,7 +1572,7 @@ glade_property_set_support_warning (GladeProperty *property, g_signal_emit (G_OBJECT (property), glade_property_signals[TOOLTIP_CHANGED], 0, - glade_property_class_get_tooltip (property->priv->klass), + glade_property_def_get_tooltip (property->priv->def), property->priv->insensitive_tooltip, property->priv->support_warning); @@ -1668,7 +1676,7 @@ 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, + return glade_property_def_make_string_from_gvalue (property->priv->def, property->priv->value); } diff --git a/gladeui/glade-property.h b/gladeui/glade-property.h index 112f39d8..127f7c18 100644 --- a/gladeui/glade-property.h +++ b/gladeui/glade-property.h @@ -22,8 +22,8 @@ typedef enum { GLADE_STATE_SUPPORT_DISABLED = (1 << 2) } GladePropertyState; -/* A GladeProperty is an instance of a GladePropertyClass. - * There will be one GladePropertyClass for "GtkLabel->label" but one +/* A GladeProperty is an instance of a GladePropertyDef. + * There will be one GladePropertyDef for "GtkLabel->label" but one * GladeProperty for each GtkLabel in the GladeProject. */ struct _GladeProperty @@ -61,7 +61,7 @@ struct _GladePropertyKlass GType glade_property_get_type (void) G_GNUC_CONST; -GladeProperty *glade_property_new (GladePropertyClass *klass, +GladeProperty *glade_property_new (GladePropertyDef *def, GladeWidget *widget, GValue *value); @@ -121,7 +121,7 @@ void glade_property_write (GladeProperty GladeXmlContext *context, GladeXmlNode *node); -GladePropertyClass *glade_property_get_class (GladeProperty *property); +GladePropertyDef *glade_property_get_def (GladeProperty *property); void glade_property_set_sensitive (GladeProperty *property, gboolean sensitive, diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c index 2c220d3a..8a3b478b 100644 --- a/gladeui/glade-signal-editor.c +++ b/gladeui/glade-signal-editor.c @@ -291,12 +291,12 @@ glade_signal_editor_detail_suggestions (GladeSignalEditor *editor, for (i = 0, l = properties; l; l = g_list_next (l)) { - GladePropertyClass *prop = l->data; + GladePropertyDef *pdef = l->data; - if (!glade_property_class_is_visible (prop) || - glade_property_class_get_virtual (prop)) continue; + if (!glade_property_def_is_visible (pdef) || + glade_property_def_get_virtual (pdef)) continue; - suggestions[i++] = g_strdup (glade_property_class_id (prop)); + suggestions[i++] = g_strdup (glade_property_def_id (pdef)); } suggestions[i] = NULL; diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c index d83e780d..6148561a 100644 --- a/gladeui/glade-utils.c +++ b/gladeui/glade-utils.c @@ -37,7 +37,7 @@ #include "glade-widget.h" #include "glade-widget-adaptor.h" #include "glade-property.h" -#include "glade-property-class.h" +#include "glade-property-def.h" #include "glade-clipboard.h" #include "glade-private.h" @@ -1407,11 +1407,11 @@ glade_utils_flags_string_from_value_displayable (GType flags_type, gint value) } -/* A hash table of generically created property classes for +/* A hash table of generically created property definitions for * fundamental types, so we can easily use glade's conversion * system without using properties (only GTypes) */ -static GHashTable *generic_property_classes = NULL; +static GHashTable *generic_property_definitions = NULL; static gboolean @@ -1427,20 +1427,20 @@ utils_gtype_hash (gconstpointer v) } -static GladePropertyClass * -pclass_from_gtype (GType type) +static GladePropertyDef * +pdef_from_gtype (GType type) { - GladePropertyClass *property_class = NULL; + GladePropertyDef *property_def = NULL; GParamSpec *pspec = NULL; - if (!generic_property_classes) - generic_property_classes = + if (!generic_property_definitions) + generic_property_definitions = g_hash_table_new_full (utils_gtype_hash, utils_gtype_equal, g_free, - (GDestroyNotify) glade_property_class_free); + (GDestroyNotify) glade_property_def_free); - property_class = g_hash_table_lookup (generic_property_classes, &type); + property_def = g_hash_table_lookup (generic_property_definitions, &type); - if (!property_class) + if (!property_def) { /* Support enum and flag types, and a hardcoded list of fundamental types */ if (type == G_TYPE_CHAR) @@ -1508,16 +1508,16 @@ pclass_from_gtype (GType type) if (pspec) { - if ((property_class = - glade_property_class_new_from_spec_full (NULL, pspec, + if ((property_def = + glade_property_def_new_from_spec_full (NULL, pspec, FALSE)) != NULL) { /* XXX If we ever free the hash table, property classes wont touch * the allocated pspecs, so they would theoretically be leaked. */ - g_hash_table_insert (generic_property_classes, + g_hash_table_insert (generic_property_definitions, g_memdup (&type, sizeof (GType)), - property_class); + property_def); } else g_warning ("Unable to create property class for type %s", @@ -1527,7 +1527,7 @@ pclass_from_gtype (GType type) g_warning ("No generic conversion support for type %s", g_type_name (type)); } - return property_class; + return property_def; } /** @@ -1546,13 +1546,13 @@ glade_utils_value_from_string (GType type, const gchar *string, GladeProject *project) { - GladePropertyClass *pclass; + GladePropertyDef *pdef; g_return_val_if_fail (type != G_TYPE_INVALID, NULL); g_return_val_if_fail (string != NULL, NULL); - if ((pclass = pclass_from_gtype (type)) != NULL) - return glade_property_class_make_gvalue_from_string (pclass, string, project); + if ((pdef = pdef_from_gtype (type)) != NULL) + return glade_property_def_make_gvalue_from_string (pdef, string, project); return NULL; } @@ -1617,12 +1617,12 @@ glade_utils_boolean_from_string (const gchar *string, gboolean *value) gchar * glade_utils_string_from_value (const GValue *value) { - GladePropertyClass *pclass; + GladePropertyDef *pdef; g_return_val_if_fail (value != NULL, NULL); - if ((pclass = pclass_from_gtype (G_VALUE_TYPE (value))) != NULL) - return glade_property_class_make_string_from_gvalue (pclass, value); + if ((pdef = pdef_from_gtype (G_VALUE_TYPE (value))) != NULL) + return glade_property_def_make_string_from_gvalue (pdef, value); return NULL; } diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c index d0a471ba..f3f0200d 100644 --- a/gladeui/glade-widget-adaptor.c +++ b/gladeui/glade-widget-adaptor.c @@ -35,7 +35,6 @@ #include "glade.h" #include "glade-widget-adaptor.h" #include "glade-xml-utils.h" -#include "glade-property-class.h" #include "glade-signal.h" #include "glade-marshallers.h" #include "glade-accumulators.h" @@ -69,19 +68,19 @@ struct _GladeWidgetAdaptorPrivate gchar *missing_icon; /* the name of the missing icon if it was not found */ gchar *title; /* Translated class name used in the UI */ - GList *properties; /* List of GladePropertyClass objects. + GList *properties; /* List of GladePropertyDef objects. * [see glade-property.h] this list contains * properties about the widget that we are going * to modify. Like "title", "label", "rows" . * Each property creates an input in the propety * editor. */ - GList *packing_props; /* List of GladePropertyClass objects that describe + GList *packing_props; /* List of GladePropertyDef objects that describe * properties for child objects packing definition - * note there may be more than one type of child supported * by a widget and thus they may have different sets * of properties for each type - this association is - * managed on the GladePropertyClass proper. + * managed on the GladePropertyDef proper. */ GList *signals; /* List of GladeSignalDef objects */ GList *child_packings; /* Default packing property values */ @@ -398,11 +397,13 @@ gwa_clone_parent_properties (GladeWidgetAdaptor *adaptor, gboolean is_packing) for (list = proplist; list; list = list->next) { - GladePropertyClass *pclass = glade_property_class_clone (list->data, reset_version); + GladePropertyDef *pdef = glade_property_def_clone (list->data); + if (reset_version) + _glade_property_def_reset_version (pdef); - glade_property_class_set_adaptor (pclass, adaptor); + glade_property_def_set_adaptor (pdef, adaptor); - properties = g_list_prepend (properties, pclass); + properties = g_list_prepend (properties, pdef); } } @@ -416,7 +417,7 @@ gwa_setup_introspected_props_from_pspecs (GladeWidgetAdaptor *adaptor, gboolean is_packing) { GladeWidgetAdaptor *parent_adaptor = gwa_get_parent_adaptor (adaptor); - GladePropertyClass *property_class; + GladePropertyDef *property_def; gint i; GList *list = NULL; @@ -425,15 +426,15 @@ gwa_setup_introspected_props_from_pspecs (GladeWidgetAdaptor *adaptor, if (parent_adaptor == NULL || /* Dont create it if it already exists */ (!is_packing && - !glade_widget_adaptor_get_property_class (parent_adaptor, - specs[i]->name)) || + !glade_widget_adaptor_get_property_def (parent_adaptor, + specs[i]->name)) || (is_packing && - !glade_widget_adaptor_get_pack_property_class (parent_adaptor, - specs[i]->name))) + !glade_widget_adaptor_get_pack_property_def (parent_adaptor, + specs[i]->name))) { - if ((property_class = - glade_property_class_new_from_spec (adaptor, specs[i])) != NULL) - list = g_list_prepend (list, property_class); + if ((property_def = + glade_property_def_new_from_spec (adaptor, specs[i])) != NULL) + list = g_list_prepend (list, property_def); } } @@ -479,7 +480,7 @@ gwa_setup_properties (GladeWidgetAdaptor *adaptor, if (is_packing) { /* We have to mark packing properties from GladeWidgetAdaptor - * because GladePropertyClass doesnt have a valid parent GType + * because GladePropertyDef doesnt have a valid parent GType * to introspect it. * * (which could be used to call gtk_container_class_find_child_property() @@ -487,9 +488,9 @@ gwa_setup_properties (GladeWidgetAdaptor *adaptor, */ for (l = adaptor->priv->packing_props; l; l = l->next) { - GladePropertyClass *property_class = l->data; + GladePropertyDef *property_def = l->data; - glade_property_class_set_is_packing (property_class, TRUE); + glade_property_def_set_is_packing (property_def, TRUE); } } } @@ -726,11 +727,11 @@ glade_widget_adaptor_finalize (GObject *object) /* Free properties and signals */ g_list_free_full (adaptor->priv->properties, - (GDestroyNotify) glade_property_class_free); + (GDestroyNotify) glade_property_def_free); adaptor->priv->properties = NULL; g_list_free_full (adaptor->priv->packing_props, - (GDestroyNotify) glade_property_class_free); + (GDestroyNotify) glade_property_def_free); adaptor->priv->packing_props = NULL; g_list_free_full (adaptor->priv->signals, @@ -1063,10 +1064,10 @@ glade_widget_adaptor_object_write_widget (GladeWidgetAdaptor *adaptor, /* Write the properties */ for (props = glade_widget_get_properties (widget); props; props = props->next) { - GladeProperty *property = props->data; - GladePropertyClass *klass = glade_property_get_class (property); + GladeProperty *property = props->data; + GladePropertyDef *def = glade_property_get_def (property); - if (glade_property_class_save (klass) && + if (glade_property_def_save (def) && glade_property_get_enabled (property)) glade_property_write (GLADE_PROPERTY (props->data), context, node); } @@ -1185,10 +1186,10 @@ glade_widget_adaptor_object_write_child (GladeWidgetAdaptor *adaptor, for (props = glade_widget_get_packing_properties (widget); props; props = props->next) { - GladeProperty *property = props->data; - GladePropertyClass *klass = glade_property_get_class (property); + GladeProperty *property = props->data; + GladePropertyDef *def = glade_property_get_def (property); - if (glade_property_class_save (klass) && + if (glade_property_def_save (def) && glade_property_get_enabled (property)) glade_property_write (GLADE_PROPERTY (props->data), context, packing_node); @@ -1265,28 +1266,28 @@ glade_widget_adaptor_get_eprop_type (GParamSpec *pspec) static GladeEditorProperty * glade_widget_adaptor_object_create_eprop (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, gboolean use_command) { GladeEditorProperty *eprop; GParamSpec *pspec; GType type = 0; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); /* Find the right type of GladeEditorProperty for this - * GladePropertyClass. + * GladePropertyDef. */ if ((type = glade_widget_adaptor_get_eprop_type (pspec)) == 0) return NULL; /* special case for string specs that denote themed application icons. */ - if (glade_property_class_themed_icon (klass)) + if (glade_property_def_themed_icon (def)) type = GLADE_TYPE_EPROP_NAMED_ICON; /* Create and return the correct type of GladeEditorProperty */ eprop = g_object_new (type, - "property-class", klass, + "property-def", def, "use-command", use_command, NULL); return eprop; @@ -1294,10 +1295,10 @@ glade_widget_adaptor_object_create_eprop (GladeWidgetAdaptor *adaptor, static gchar * glade_widget_adaptor_object_string_from_value (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, const GValue *value) { - return glade_property_class_make_string_from_gvalue (klass, value); + return glade_property_def_make_string_from_gvalue (def, value); } static GladeEditable * @@ -1843,7 +1844,7 @@ glade_widget_adaptor_get_book (GladeWidgetAdaptor *adaptor) * glade_widget_adaptor_get_properties: * @adaptor: A #GladeWidgetAdaptor * - * Returns: (transfer none) (element-type GladePropertyClass): a list of #GladePropertyClass + * Returns: (transfer none) (element-type GladePropertyDef): a list of #GladePropertyDef */ G_CONST_RETURN GList * glade_widget_adaptor_get_properties (GladeWidgetAdaptor *adaptor) @@ -1857,7 +1858,7 @@ glade_widget_adaptor_get_properties (GladeWidgetAdaptor *adaptor) * glade_widget_adaptor_get_packing_props: * @adaptor: A #GladeWidgetAdaptor * - * Returns: (transfer none) (element-type GladePropertyClass): a list of #GladePropertyClass + * Returns: (transfer none) (element-type GladePropertyDef): a list of #GladePropertyDef */ G_CONST_RETURN GList * glade_widget_adaptor_get_packing_props (GladeWidgetAdaptor *adaptor) @@ -2061,7 +2062,7 @@ gwa_update_properties_from_node (GladeWidgetAdaptor *adaptor, { gchar *id; GList *list; - GladePropertyClass *property_class; + GladePropertyDef *property_def; gboolean updated; if (!glade_xml_node_verify (child, GLADE_TAG_PROPERTY)) @@ -2078,34 +2079,34 @@ gwa_update_properties_from_node (GladeWidgetAdaptor *adaptor, /* find the property in our list, if not found append a new property */ for (list = *properties; list && list->data; list = list->next) { - property_class = GLADE_PROPERTY_CLASS (list->data); - if (glade_property_class_id (property_class) != NULL && - g_ascii_strcasecmp (id, glade_property_class_id (property_class)) == 0) + property_def = GLADE_PROPERTY_DEF (list->data); + if (glade_property_def_id (property_def) != NULL && + g_ascii_strcasecmp (id, glade_property_def_id (property_def)) == 0) break; } if (list) { - property_class = GLADE_PROPERTY_CLASS (list->data); + property_def = GLADE_PROPERTY_DEF (list->data); } else { - property_class = glade_property_class_new (adaptor, id); + property_def = glade_property_def_new (adaptor, id); /* When creating new virtual packing properties, * make sure we mark them as such here. */ if (is_packing) - glade_property_class_set_is_packing (property_class, TRUE); + glade_property_def_set_is_packing (property_def, TRUE); - *properties = g_list_append (*properties, property_class); + *properties = g_list_append (*properties, property_def); list = g_list_last (*properties); } - if ((updated = glade_property_class_update_from_node (child, - adaptor->priv->type, - &property_class, - domain)) == FALSE) + if ((updated = glade_property_def_update_from_node (child, + adaptor->priv->type, + &property_def, + domain)) == FALSE) { g_warning ("failed to update %s property of %s from xml", id, adaptor->priv->name); @@ -2114,7 +2115,7 @@ gwa_update_properties_from_node (GladeWidgetAdaptor *adaptor, } /* if this pointer was set to null, its a property we dont handle. */ - if (!property_class) + if (!property_def) *properties = g_list_delete_link (*properties, list); g_free (id); @@ -2269,24 +2270,24 @@ gwa_update_properties_from_type (GladeWidgetAdaptor *adaptor, for (i = 0; i < n_specs; i++) { - GladePropertyClass *property_class; + GladePropertyDef *property_def; GList *list; /* find the property in our list, if not found append a new property */ for (list = *properties; list && list->data; list = list->next) { - property_class = GLADE_PROPERTY_CLASS (list->data); - if (glade_property_class_id (property_class) != NULL && - g_ascii_strcasecmp (specs[i]->name, glade_property_class_id (property_class)) == 0) + property_def = GLADE_PROPERTY_DEF (list->data); + if (glade_property_def_id (property_def) != NULL && + g_ascii_strcasecmp (specs[i]->name, glade_property_def_id (property_def)) == 0) break; } if (list == NULL && (specs[i]->flags & G_PARAM_WRITABLE) && (spec = pspec_dup (specs[i]))) { - property_class = glade_property_class_new (adaptor, spec->name); + property_def = glade_property_def_new (adaptor, spec->name); - glade_property_class_set_pspec (property_class, spec); + glade_property_def_set_pspec (property_def, spec); /* Make sure we can tell properties apart by there * owning class. @@ -2294,19 +2295,19 @@ gwa_update_properties_from_type (GladeWidgetAdaptor *adaptor, spec->owner_type = adaptor->priv->type; /* Disable properties by default since the does not really implement them */ - glade_property_class_set_virtual (property_class, TRUE); - glade_property_class_set_ignore (property_class, TRUE); + glade_property_def_set_virtual (property_def, TRUE); + glade_property_def_set_ignore (property_def, TRUE); - glade_property_class_set_tooltip (property_class, g_param_spec_get_blurb (spec)); - glade_property_class_set_name (property_class, g_param_spec_get_nick (spec)); + glade_property_def_set_tooltip (property_def, g_param_spec_get_blurb (spec)); + glade_property_def_set_name (property_def, g_param_spec_get_nick (spec)); if (spec->flags & G_PARAM_CONSTRUCT_ONLY) - glade_property_class_set_construct_only (property_class, TRUE); + glade_property_def_set_construct_only (property_def, TRUE); - glade_property_class_load_defaults_from_spec (property_class); - glade_property_class_set_is_packing (property_class, is_packing); + glade_property_def_load_defaults_from_spec (property_def); + glade_property_def_set_is_packing (property_def, is_packing); - *properties = g_list_append (*properties, property_class); + *properties = g_list_append (*properties, property_def); } } @@ -2530,11 +2531,11 @@ gwa_displayable_values_check (GladeWidgetAdaptor *adaptor, gboolean packing) for (l = p; l; l = g_list_next (l)) { - GladePropertyClass *klass = l->data; - GParamSpec *pspec = glade_property_class_get_pspec (klass); + GladePropertyDef *def = l->data; + GParamSpec *pspec = glade_property_def_get_pspec (def); if (adaptor->priv->type == pspec->owner_type && - glade_property_class_is_visible (klass) && + glade_property_def_is_visible (def) && (G_IS_PARAM_SPEC_ENUM (pspec) || G_IS_PARAM_SPEC_FLAGS (pspec)) && !glade_type_has_displayable_values (pspec->value_type) && @@ -2545,7 +2546,7 @@ gwa_displayable_values_check (GladeWidgetAdaptor *adaptor, gboolean packing) if (g_getenv (GLADE_ENV_TESTING) == NULL) g_message ("No displayable values for %sproperty %s::%s", (packing) ? "child " : "", adaptor->priv->name, - glade_property_class_id (klass)); + glade_property_def_id (def)); } } } @@ -2941,8 +2942,8 @@ glade_widget_adaptor_from_catalog (GladeCatalog *catalog, for (parent_type = adaptor->priv->type; parent_type != 0; parent_type = g_type_parent (parent_type)) { - glade_property_class_set_weights (&adaptor->priv->properties, parent_type); - glade_property_class_set_weights (&adaptor->priv->packing_props, parent_type); + glade_property_def_set_weights (&adaptor->priv->properties, parent_type); + glade_property_def_set_weights (&adaptor->priv->packing_props, parent_type); } gwa_displayable_values_check (adaptor, FALSE); @@ -3165,52 +3166,51 @@ glade_widget_adaptor_from_pspec (GladeWidgetAdaptor *adaptor, } /** - * glade_widget_adaptor_get_property_class: + * glade_widget_adaptor_get_property_def: * @adaptor: a #GladeWidgetAdaptor * @name: a string * - * Retrieves the #GladePropertyClass for @name in @adaptor + * Retrieves the #GladePropertyDef for @name in @adaptor * - * Returns: A #GladePropertyClass object + * Returns: (transfer none) (nullable): A #GladePropertyDef object */ -GladePropertyClass * -glade_widget_adaptor_get_property_class (GladeWidgetAdaptor *adaptor, - const gchar *name) +GladePropertyDef * +glade_widget_adaptor_get_property_def (GladeWidgetAdaptor *adaptor, + const gchar *name) { GList *list; - GladePropertyClass *pclass; + GladePropertyDef *pdef; for (list = adaptor->priv->properties; list && list->data; list = list->next) { - pclass = list->data; - if (strcmp (glade_property_class_id (pclass), name) == 0) - return pclass; + pdef = list->data; + if (strcmp (glade_property_def_id (pdef), name) == 0) + return pdef; } return NULL; } /** - * glade_widget_adaptor_get_pack_property_class: + * glade_widget_adaptor_get_pack_property_def: * @adaptor: a #GladeWidgetAdaptor * @name: a string * - * Retrieves the #GladePropertyClass for @name in - * @adaptor's child properties + * Retrieves the #GladePropertyDef for @name in @adaptor's child properties * - * Returns: A #GladePropertyClass object + * Returns: (transfer none) (nullable): A #GladePropertyDef object */ -GladePropertyClass * -glade_widget_adaptor_get_pack_property_class (GladeWidgetAdaptor *adaptor, - const gchar *name) +GladePropertyDef * +glade_widget_adaptor_get_pack_property_def (GladeWidgetAdaptor *adaptor, + const gchar *name) { GList *list; - GladePropertyClass *pclass; + GladePropertyDef *pdef; for (list = adaptor->priv->packing_props; list && list->data; list = list->next) { - pclass = list->data; - if (strcmp (glade_property_class_id (pclass), name) == 0) - return pclass; + pdef = list->data; + if (strcmp (glade_property_def_id (pdef), name) == 0) + return pdef; } return NULL; } @@ -3221,7 +3221,8 @@ glade_widget_adaptor_get_pack_property_class (GladeWidgetAdaptor *adaptor, * @construct: whether to return construct params or not construct params * @n_params: return location if any defaults are specified for this class. * - * Returns: A list of params for use in g_object_newv () + * Returns: (array length=n_params) (element-type GParameter) (transfer full): + * A list of params for use in g_object_newv () */ GParameter * glade_widget_adaptor_default_params (GladeWidgetAdaptor *adaptor, @@ -3231,7 +3232,7 @@ glade_widget_adaptor_default_params (GladeWidgetAdaptor *adaptor, GArray *params; GObjectClass *oclass; GParamSpec **pspec; - GladePropertyClass *pclass; + GladePropertyDef *pdef; guint n_props, i; g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); @@ -3247,15 +3248,14 @@ glade_widget_adaptor_default_params (GladeWidgetAdaptor *adaptor, { GParameter parameter = { 0, }; - pclass = glade_widget_adaptor_get_property_class - (adaptor, pspec[i]->name); + pdef = glade_widget_adaptor_get_property_def (adaptor, pspec[i]->name); /* Ignore properties based on some criteria */ - if (pclass == NULL || /* Unaccounted for in the builder */ - glade_property_class_get_virtual (pclass) || /* should not be set before - GladeWidget wrapper exists */ - glade_property_class_get_ignore (pclass)) /* Catalog explicitly ignores the object */ + if (pdef == NULL || /* Unaccounted for in the builder */ + glade_property_def_get_virtual (pdef) || /* should not be set before + GladeWidget wrapper exists */ + glade_property_def_get_ignore (pdef)) /* Catalog explicitly ignores the object */ continue; if (construct && @@ -3267,7 +3267,7 @@ glade_widget_adaptor_default_params (GladeWidgetAdaptor *adaptor, continue; - if (g_value_type_compatible (G_VALUE_TYPE (glade_property_class_get_default (pclass)), + if (g_value_type_compatible (G_VALUE_TYPE (glade_property_def_get_default (pdef)), pspec[i]->value_type) == FALSE) { g_critical ("Type mismatch on %s property of %s", @@ -3276,13 +3276,13 @@ glade_widget_adaptor_default_params (GladeWidgetAdaptor *adaptor, } if (g_param_values_cmp (pspec[i], - glade_property_class_get_default (pclass), - glade_property_class_get_original_default (pclass)) == 0) + glade_property_def_get_default (pdef), + glade_property_def_get_original_default (pdef)) == 0) continue; parameter.name = pspec[i]->name; /* These are not copied/freed */ g_value_init (¶meter.value, pspec[i]->value_type); - g_value_copy (glade_property_class_get_default (pclass), ¶meter.value); + g_value_copy (glade_property_def_get_default (pdef), ¶meter.value); g_array_append_val (params, parameter); } @@ -3802,7 +3802,7 @@ glade_widget_adaptor_replace_child (GladeWidgetAdaptor *adaptor, gboolean glade_widget_adaptor_query (GladeWidgetAdaptor *adaptor) { - GladePropertyClass *pclass; + GladePropertyDef *pdef; GList *l; g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), FALSE); @@ -3812,9 +3812,9 @@ glade_widget_adaptor_query (GladeWidgetAdaptor *adaptor) for (l = adaptor->priv->properties; l; l = l->next) { - pclass = l->data; + pdef = l->data; - if (glade_property_class_query (pclass)) + if (glade_property_def_query (pdef)) return TRUE; } @@ -4355,29 +4355,29 @@ glade_widget_adaptor_write_child (GladeWidgetAdaptor *adaptor, /** * glade_widget_adaptor_create_eprop: * @adaptor: A #GladeWidgetAdaptor - * @klass: The #GladePropertyClass to be edited + * @def: The #GladePropertyDef to be edited * @use_command: whether to use the GladeCommand interface * to commit property changes * - * Creates a GladeEditorProperty to edit @klass + * Creates a GladeEditorProperty to edit @def * * Returns: (transfer full): A newly created #GladeEditorProperty */ GladeEditorProperty * glade_widget_adaptor_create_eprop (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, gboolean use_command) { GladeEditorProperty *eprop; g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (def), NULL); eprop = GLADE_WIDGET_ADAPTOR_GET_CLASS - (adaptor)->create_eprop (adaptor, klass, use_command); + (adaptor)->create_eprop (adaptor, def, use_command); /* XXX we really need to print a g_error() here, exept we are * now using this func to test for unsupported properties - * at init time from glade-property-class */ + * at init time from glade-property-def */ return eprop; } @@ -4387,12 +4387,12 @@ glade_widget_adaptor_create_eprop (GladeWidgetAdaptor *adaptor, /** * glade_widget_adaptor_create_eprop_by_name: * @adaptor: A #GladeWidgetAdaptor - * @property_id: the string if of the coresponding #GladePropertyClass to be edited + * @property_id: the string if of the coresponding #GladePropertyDef to be edited * @packing: whether this reffers to a packing property * @use_command: whether to use the GladeCommand interface * to commit property changes * - * Creates a #GladeEditorProperty to edit #GladePropertyClass @name in @adaptor + * Creates a #GladeEditorProperty to edit #GladePropertyDef @name in @adaptor * * Returns: (transfer full): A newly created #GladeEditorProperty */ @@ -4402,26 +4402,26 @@ glade_widget_adaptor_create_eprop_by_name (GladeWidgetAdaptor *adaptor, gboolean packing, gboolean use_command) { - GladePropertyClass *klass; + GladePropertyDef *def; g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); g_return_val_if_fail (property_id && property_id[0], NULL); if (packing) - klass = glade_widget_adaptor_get_pack_property_class (adaptor, property_id); + def = glade_widget_adaptor_get_pack_property_def (adaptor, property_id); else - klass = glade_widget_adaptor_get_property_class (adaptor, property_id); + def = glade_widget_adaptor_get_property_def (adaptor, property_id); - g_return_val_if_fail (klass != NULL, NULL); + g_return_val_if_fail (def != NULL, NULL); return GLADE_WIDGET_ADAPTOR_GET_CLASS - (adaptor)->create_eprop (adaptor, klass, use_command); + (adaptor)->create_eprop (adaptor, def, use_command); } /** * glade_widget_adaptor_string_from_value: * @adaptor: A #GladeWidgetAdaptor - * @klass: The #GladePropertyClass + * @def: The #GladePropertyDef * @value: The #GValue to convert to a string * * For normal properties this is used to serialize @@ -4432,15 +4432,15 @@ glade_widget_adaptor_create_eprop_by_name (GladeWidgetAdaptor *adaptor, */ gchar * glade_widget_adaptor_string_from_value (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, const GValue *value) { g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL); - g_return_val_if_fail (GLADE_IS_PROPERTY_CLASS (klass), NULL); + g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (def), NULL); g_return_val_if_fail (value != NULL, NULL); return GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->string_from_value (adaptor, - klass, + def, value); } diff --git a/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h index 490de1eb..e90affb4 100644 --- a/gladeui/glade-widget-adaptor.h +++ b/gladeui/glade-widget-adaptor.h @@ -2,7 +2,7 @@ #define _GLADE_WIDGET_ADAPTOR_H_ #include <gladeui/glade-xml-utils.h> -#include <gladeui/glade-property-class.h> +#include <gladeui/glade-property-def.h> #include <gladeui/glade-editor-property.h> #include <gladeui/glade-signal-def.h> #include <gladeui/glade-catalog.h> @@ -237,7 +237,7 @@ typedef GladeWidget * (* GladeCreateWidgetFunc) (GladeWidgetAdaptor *adaptor, * This delagate function is used to apply the property value on * the runtime object. * - * Sets @value on @object for a given #GladePropertyClass + * Sets @value on @object for a given #GladePropertyDef */ typedef void (* GladeSetPropertyFunc) (GladeWidgetAdaptor *adaptor, GObject *object, @@ -251,7 +251,7 @@ typedef void (* GladeSetPropertyFunc) (GladeWidgetAdaptor *adaptor, * @property_name: The property identifier * @value: The #GValue * - * Gets @value on @object for a given #GladePropertyClass + * Gets @value on @object for a given #GladePropertyDef */ typedef void (* GladeGetPropertyFunc) (GladeWidgetAdaptor *adaptor, GObject *object, @@ -568,7 +568,7 @@ typedef void (* GladeWriteWidgetFunc) (GladeWidgetAdaptor *adaptor, /** * GladeCreateEPropFunc: * @adaptor: A #GladeWidgetAdaptor - * @klass: The #GladePropertyClass to be edited + * @def: The #GladePropertyDef to be edited * @use_command: whether to use the GladeCommand interface * to commit property changes * @@ -577,13 +577,13 @@ typedef void (* GladeWriteWidgetFunc) (GladeWidgetAdaptor *adaptor, * Returns: A newly created #GladeEditorProperty */ typedef GladeEditorProperty *(* GladeCreateEPropFunc) (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, gboolean use_command); /** * GladeStringFromValueFunc: * @adaptor: A #GladeWidgetAdaptor - * @klass: The #GladePropertyClass + * @def: The #GladePropertyDef * @value: The #GValue to convert to a string * * For normal properties this is used to serialize @@ -594,7 +594,7 @@ typedef GladeEditorProperty *(* GladeCreateEPropFunc) (GladeWidgetAdaptor *adapt * Returns: A newly allocated string representation of @value */ typedef gchar *(* GladeStringFromValueFunc) (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, const GValue *value); @@ -778,10 +778,10 @@ GladeWidgetAdaptor *glade_widget_adaptor_get_by_type (GType GladeWidgetAdaptor *glade_widget_adaptor_from_pspec (GladeWidgetAdaptor *adaptor, GParamSpec *pspec); -GladePropertyClass *glade_widget_adaptor_get_property_class (GladeWidgetAdaptor *adaptor, +GladePropertyDef *glade_widget_adaptor_get_property_def (GladeWidgetAdaptor *adaptor, const gchar *name); -GladePropertyClass *glade_widget_adaptor_get_pack_property_class (GladeWidgetAdaptor *adaptor, - const gchar *name); +GladePropertyDef *glade_widget_adaptor_get_pack_property_def (GladeWidgetAdaptor *adaptor, + const gchar *name); GParameter *glade_widget_adaptor_default_params (GladeWidgetAdaptor *adaptor, gboolean construct, @@ -901,7 +901,7 @@ void glade_widget_adaptor_write_child (GladeWidgetAdapto GladeXmlNode *node); GladeEditorProperty *glade_widget_adaptor_create_eprop (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, gboolean use_command); GladeEditorProperty *glade_widget_adaptor_create_eprop_by_name (GladeWidgetAdaptor *adaptor, const gchar *property_id, @@ -909,7 +909,7 @@ GladeEditorProperty *glade_widget_adaptor_create_eprop_by_name (GladeWidgetAdap gboolean use_command); gchar *glade_widget_adaptor_string_from_value (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, const GValue *value); GladeEditable *glade_widget_adaptor_create_editable (GladeWidgetAdaptor *adaptor, GladeEditorPageType type); diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c index af904484..fbce9f2b 100644 --- a/gladeui/glade-widget.c +++ b/gladeui/glade-widget.c @@ -47,7 +47,7 @@ #include "glade-private.h" #include "glade-marshallers.h" #include "glade-property.h" -#include "glade-property-class.h" +#include "glade-property-def.h" #include "glade-placeholder.h" #include "glade-signal.h" #include "glade-popup.h" @@ -104,8 +104,8 @@ struct _GladeWidgetPrivate { */ GList *properties; /* A list of GladeProperty. A GladeProperty is an - * instance of a GladePropertyClass. If a - * GladePropertyClass for a gtkbutton is label, its + * instance of a GladePropertyDef. If a + * GladePropertyDef for a gtkbutton is label, its * property is "Ok". */ @@ -586,7 +586,7 @@ glade_widget_template_params (GladeWidget *widget, GObjectClass *oclass; GParamSpec **pspec; GladeProperty *glade_property; - GladePropertyClass *pclass; + GladePropertyDef *pdef; guint n_props, i; g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL); @@ -608,15 +608,15 @@ glade_widget_template_params (GladeWidget *widget, glade_widget_get_property (widget, pspec[i]->name)) == NULL) continue; - pclass = glade_property_get_class (glade_property); + pdef = glade_property_get_def (glade_property); /* Ignore properties based on some criteria */ if (!glade_property_get_enabled (glade_property) || - pclass == NULL || /* Unaccounted for in the builder */ - glade_property_class_get_virtual (pclass) || /* should not be set before - GladeWidget wrapper exists */ - glade_property_class_get_ignore (pclass)) /* Catalog explicitly ignores the object */ + pdef == NULL || /* Unaccounted for in the builder */ + glade_property_def_get_virtual (pdef) || /* should not be set before + GladeWidget wrapper exists */ + glade_property_def_get_ignore (pdef)) /* Catalog explicitly ignores the object */ continue; if (construct && @@ -627,7 +627,7 @@ glade_widget_template_params (GladeWidget *widget, (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)) != 0) continue; - if (g_value_type_compatible (G_VALUE_TYPE (glade_property_class_get_default (pclass)), + if (g_value_type_compatible (G_VALUE_TYPE (glade_property_def_get_default (pdef)), pspec[i]->value_type) == FALSE) { g_critical ("Type mismatch on %s property of %s", @@ -643,7 +643,7 @@ glade_widget_template_params (GladeWidget *widget, if (pspec[i]->owner_type == glade_widget_adaptor_get_object_type (adaptor) && g_param_values_cmp (pspec[i], glade_property_inline_value (glade_property), - glade_property_class_get_original_default (pclass)) == 0) + glade_property_def_get_original_default (pdef)) == 0) continue; /* Not sure if it's safe to use glade_property_get_value() instead as the @@ -743,13 +743,13 @@ glade_widget_dup_properties (GladeWidget *dest_widget, for (list = template_props; list && list->data; list = list->next) { - GladeProperty *prop = list->data; - GladePropertyClass *pclass = glade_property_get_class (prop); + GladeProperty *prop = list->data; + GladePropertyDef *pdef = glade_property_get_def (prop); - if (glade_property_class_save (pclass) == FALSE && as_load) + if (glade_property_def_save (pdef) == FALSE && as_load) continue; - if (glade_property_class_parentless_widget (pclass) && copy_parentless) + if (glade_property_def_parentless_widget (pdef) && copy_parentless) { GObject *object = NULL; GladeWidget *parentless; @@ -819,14 +819,14 @@ glade_widget_set_catalog_defaults (GList *list) GList *l; for (l = list; l && l->data; l = l->next) { - GladeProperty *prop = l->data; - GladePropertyClass *klass = glade_property_get_class (prop); - GParamSpec *pspec = glade_property_class_get_pspec (klass); + GladeProperty *prop = l->data; + GladePropertyDef *def = glade_property_get_def (prop); + GParamSpec *pspec = glade_property_def_get_pspec (def); - if (glade_property_equals_value (prop, glade_property_class_get_original_default (klass)) && + if (glade_property_equals_value (prop, glade_property_def_get_original_default (def)) && g_param_values_cmp (pspec, - glade_property_class_get_original_default (klass), - glade_property_class_get_default (klass))) + glade_property_def_get_original_default (def), + glade_property_def_get_default (def))) glade_property_reset (prop); } } @@ -837,11 +837,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); - GladePropertyClass *pclass = glade_property_get_class (prop); + GladeProperty *prop = GLADE_PROPERTY (l->data); + GladePropertyDef *pdef = glade_property_get_def (prop); - if (glade_property_class_get_virtual (pclass) || - glade_property_class_needs_sync (pclass)) + if (glade_property_def_get_virtual (pdef) || + glade_property_def_needs_sync (pdef)) glade_property_sync (prop); } } @@ -900,10 +900,10 @@ glade_widget_constructor (GType type, { for (list = gwidget->priv->properties; list; list = list->next) { - GladeProperty *property = list->data; - GladePropertyClass *pclass = glade_property_get_class (property); + GladeProperty *property = list->data; + GladePropertyDef *pdef = glade_property_get_def (property); - if (glade_property_class_parentless_widget (pclass)) + if (glade_property_def_parentless_widget (pdef)) glade_property_sync (property); } } @@ -987,9 +987,9 @@ glade_widget_finalize (GObject *object) static void reset_object_property (GladeProperty *property, GladeProject *project) { - GladePropertyClass *pclass = glade_property_get_class (property); + GladePropertyDef *pdef = glade_property_get_def (property); - if (glade_property_class_is_object (pclass)) + if (glade_property_def_is_object (pdef)) glade_property_reset (property); } @@ -1571,11 +1571,11 @@ glade_widget_copy_packing_props (GladeWidget *parent, for (l = child->priv->packing_properties; l && l->data; l = l->next) { - GladePropertyClass *pclass; + GladePropertyDef *pdef; dup_prop = GLADE_PROPERTY (l->data); - pclass = glade_property_get_class (dup_prop); - orig_prop = glade_widget_get_pack_property (template_widget, glade_property_class_id (pclass)); + pdef = glade_property_get_def (dup_prop); + orig_prop = glade_widget_get_pack_property (template_widget, glade_property_def_id (pdef)); glade_property_set_value (dup_prop, glade_property_inline_value (orig_prop)); } @@ -1585,7 +1585,7 @@ static void glade_widget_set_default_packing_properties (GladeWidget *container, GladeWidget *child) { - GladePropertyClass *property_class; + GladePropertyDef *property_def; const GList *l; for (l = glade_widget_adaptor_get_packing_props (container->priv->adaptor); l; l = l->next) @@ -1593,19 +1593,19 @@ glade_widget_set_default_packing_properties (GladeWidget *container, const gchar *def; GValue *value; - property_class = l->data; + property_def = l->data; if ((def = glade_widget_adaptor_get_packing_default (child->priv->adaptor, container->priv->adaptor, - glade_property_class_id (property_class))) == NULL) + glade_property_def_id (property_def))) == NULL) continue; - value = glade_property_class_make_gvalue_from_string (property_class, + value = glade_property_def_make_gvalue_from_string (property_def, def, child->priv->project); glade_widget_child_set_property (container, child, - glade_property_class_id (property_class), value); + glade_property_def_id (property_def), value); g_value_unset (value); g_free (value); } @@ -1890,11 +1890,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; - GladePropertyClass *pclass = glade_property_get_class (saved_prop); - GladeProperty *widget_prop = - glade_widget_get_property (gchild, glade_property_class_id (pclass)); + GValue value = { 0, }; + GladeProperty *saved_prop = l->data; + GladePropertyDef *pdef = glade_property_get_def (saved_prop); + GladeProperty *widget_prop = + glade_widget_get_property (gchild, glade_property_def_id (pdef)); glade_property_get_value (saved_prop, &value); glade_property_set_value (widget_prop, &value); @@ -1916,11 +1916,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; - GladePropertyClass *pclass = glade_property_get_class (saved_prop); - GladeProperty *widget_prop = - glade_widget_get_pack_property (extract->widget, glade_property_class_id (pclass)); + GValue value = { 0, }; + GladeProperty *saved_prop = l->data; + GladePropertyDef *pdef = glade_property_get_def (saved_prop); + GladeProperty *widget_prop = + glade_widget_get_pack_property (extract->widget, glade_property_def_id (pdef)); glade_property_get_value (saved_prop, &value); glade_property_set_value (widget_prop, &value); @@ -1967,15 +1967,15 @@ glade_widget_set_properties (GladeWidget *widget, GList *properties) for (list = properties; list; list = list->next) { - GladePropertyClass *pclass; + GladePropertyDef *pdef; property = list->data; - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); glade_property_set_widget (property, widget); g_hash_table_insert (widget->priv->props_hash, - (gchar *)glade_property_class_id (pclass), + (gchar *)glade_property_def_id (pdef), property); } } @@ -1984,10 +1984,10 @@ glade_widget_set_properties (GladeWidget *widget, GList *properties) static void glade_widget_set_adaptor (GladeWidget *widget, GladeWidgetAdaptor *adaptor) { - GladePropertyClass *property_class; - GladeProperty *property; - const GList *list; - GList *properties = NULL; + GladePropertyDef *property_def; + GladeProperty *property; + const GList *list; + GList *properties = NULL; g_return_if_fail (GLADE_IS_WIDGET (widget)); g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor)); @@ -2002,12 +2002,12 @@ glade_widget_set_adaptor (GladeWidget *widget, GladeWidgetAdaptor *adaptor) { for (list = glade_widget_adaptor_get_properties (adaptor); list; list = list->next) { - property_class = GLADE_PROPERTY_CLASS (list->data); - if ((property = glade_property_new (property_class, + property_def = GLADE_PROPERTY_DEF (list->data); + if ((property = glade_property_new (property_def, widget, NULL)) == NULL) { g_warning ("Failed to create [%s] property", - glade_property_class_id (property_class)); + glade_property_def_id (property_def)); continue; } properties = g_list_prepend (properties, property); @@ -2027,19 +2027,19 @@ static GList * glade_widget_create_packing_properties (GladeWidget *container, GladeWidget *widget) { - GladePropertyClass *property_class; - GladeProperty *property; - const GList *list; - GList *packing_props = NULL; + GladePropertyDef *property_def; + GladeProperty *property; + const GList *list; + GList *packing_props = NULL; - /* XXX TODO: by checking with some GladePropertyClass metadata, decide + /* XXX TODO: by checking with some GladePropertyDef metadata, decide * which packing properties go on which type of children. */ for (list = glade_widget_adaptor_get_packing_props (container->priv->adaptor); list && list->data; list = list->next) { - property_class = list->data; - property = glade_property_new (property_class, widget, NULL); + property_def = list->data; + property = glade_property_new (property_def, widget, NULL); packing_props = g_list_prepend (packing_props, property); } @@ -2144,7 +2144,7 @@ glade_widget_hide (GladeWidget *widget) void glade_widget_add_prop_ref (GladeWidget *widget, GladeProperty *property) { - GladePropertyClass *pclass; + GladePropertyDef *pdef; g_return_if_fail (GLADE_IS_WIDGET (widget)); g_return_if_fail (GLADE_IS_PROPERTY (property)); @@ -2155,8 +2155,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. */ - pclass = glade_property_get_class (property); - if (glade_property_class_parentless_widget (pclass)) + pdef = glade_property_get_def (property); + if (glade_property_def_parentless_widget (pdef)) { GladeProject *project = glade_widget_get_project (widget); @@ -2180,15 +2180,15 @@ glade_widget_add_prop_ref (GladeWidget *widget, GladeProperty *property) void glade_widget_remove_prop_ref (GladeWidget *widget, GladeProperty *property) { - GladePropertyClass *pclass; + GladePropertyDef *pdef; g_return_if_fail (GLADE_IS_WIDGET (widget)); g_return_if_fail (GLADE_IS_PROPERTY (property)); widget->priv->prop_refs = g_list_remove (widget->priv->prop_refs, property); - pclass = glade_property_get_class (property); - if (glade_property_class_parentless_widget (pclass)) + pdef = glade_property_get_def (property); + if (glade_property_def_parentless_widget (pdef)) { GladeProject *project = glade_widget_get_project (widget); @@ -2228,18 +2228,18 @@ glade_widget_has_prop_refs (GladeWidget *widget) GladeProperty * glade_widget_get_parentless_widget_ref (GladeWidget *widget) { - GladePropertyClass *pclass; - GladeProperty *property; - GList *l; + GladePropertyDef *pdef; + 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 = l->data; - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); - if (glade_property_class_parentless_widget (pclass)) + if (glade_property_def_parentless_widget (pdef)) /* only one external property can point to this widget */ return property; } @@ -2255,20 +2255,20 @@ glade_widget_get_parentless_widget_ref (GladeWidget *widget) GList * glade_widget_get_parentless_reffed_widgets (GladeWidget *widget) { - GladeProperty *property = NULL; - GladePropertyClass *pclass; - GObject *reffed = NULL; - GList *l, *widgets = NULL; + GladeProperty *property = NULL; + GladePropertyDef *pdef; + 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 = l->data; - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); reffed = NULL; - if (glade_property_class_parentless_widget (pclass)) + if (glade_property_def_parentless_widget (pdef)) { glade_property_get (property, &reffed); if (reffed) @@ -2375,23 +2375,23 @@ glade_widget_copy_properties (GladeWidget *widget, { GladeProperty *widget_prop = GLADE_PROPERTY (l->data); GladeProperty *template_prop; - GladePropertyClass *widget_pclass, *template_pclass = NULL; + GladePropertyDef *widget_pdef, *template_pdef = NULL; - widget_pclass = glade_property_get_class (widget_prop); + widget_pdef = glade_property_get_def (widget_prop); template_prop = glade_widget_get_property (template_widget, - glade_property_class_id (widget_pclass)); + glade_property_def_id (widget_pdef)); if (template_prop) - template_pclass = glade_property_get_class (template_prop); + template_pdef = glade_property_get_def (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_pclass != NULL && - glade_property_class_match (template_pclass, widget_pclass)) + if (template_pdef != NULL && + glade_property_def_match (template_pdef, widget_pdef)) { - if (glade_property_class_parentless_widget (template_pclass) && copy_parentless) + if (glade_property_def_parentless_widget (template_pdef) && copy_parentless) { GObject *object = NULL; GladeWidget *parentless; @@ -2580,15 +2580,15 @@ glade_widget_rebuild (GladeWidget *gwidget) for (l = save_properties; l; l = l->next) { - GladeProperty *property = l->data; - GladePropertyClass *pclass = glade_property_get_class (property); + GladeProperty *property = l->data; + GladePropertyDef *pdef = glade_property_get_def (property); if (glade_property_get_widget (property) != gwidget || - glade_property_class_parentless_widget (pclass)) + glade_property_def_parentless_widget (pdef)) { PropertyData *prop_data; - if (!G_IS_PARAM_SPEC_OBJECT (glade_property_class_get_pspec (pclass))) + if (!G_IS_PARAM_SPEC_OBJECT (glade_property_def_get_pspec (pdef))) g_warning ("Parentless widget property should be of object type"); prop_data = g_new0 (PropertyData, 1); @@ -3301,18 +3301,18 @@ glade_widget_property_string (GladeWidget *widget, const gchar *id_property, const GValue *value) { - GladeProperty *property; - GladePropertyClass *pclass; - gchar *ret_string = NULL; + GladeProperty *property; + GladePropertyDef *pdef; + 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) { - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); ret_string = glade_widget_adaptor_string_from_value - (glade_property_class_get_adaptor (pclass), pclass, + (glade_property_def_get_adaptor (pdef), pdef, value ? value : glade_property_inline_value (property)); } @@ -3335,18 +3335,18 @@ glade_widget_pack_property_string (GladeWidget *widget, const gchar *id_property, const GValue *value) { - GladeProperty *property; - GladePropertyClass *pclass; - gchar *ret_string = NULL; + GladeProperty *property; + GladePropertyDef *pdef; + 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) { - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); ret_string = glade_widget_adaptor_string_from_value - (glade_property_class_get_adaptor (pclass), pclass, + (glade_property_def_get_adaptor (pdef), pdef, value ? value : glade_property_inline_value (property)); } @@ -3883,11 +3883,11 @@ 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; - GladePropertyClass *pclass = glade_property_get_class (property); + GladeProperty *property = list->data; + GladePropertyDef *pdef = glade_property_get_def (property); g_hash_table_insert (widget->priv->pack_props_hash, - (gchar *)glade_property_class_id (pclass), + (gchar *)glade_property_def_id (pdef), property); } @@ -3904,14 +3904,14 @@ glade_widget_set_packing_properties (GladeWidget *widget, list && list->data; list = list->next) { /* 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); + GladeProperty *property = list->data; + GladePropertyDef *pdef = glade_property_get_def (property); + GValue *value = glade_property_inline_value (property); g_value_reset (value); glade_widget_child_get_property (container, widget, - glade_property_class_id (pclass), + glade_property_def_id (pdef), value); } } @@ -4802,7 +4802,7 @@ glade_widget_create_editor_property (GladeWidget *widget, { GladeEditorProperty *eprop; GladeProperty *prop; - GladePropertyClass *pclass; + GladePropertyDef *pdef; if (packing) prop = glade_widget_get_pack_property (widget, property); @@ -4810,10 +4810,10 @@ glade_widget_create_editor_property (GladeWidget *widget, prop = glade_widget_get_property (widget, property); g_return_val_if_fail (GLADE_IS_PROPERTY (prop), NULL); - pclass = glade_property_get_class (prop); + pdef = glade_property_get_def (prop); eprop = glade_widget_adaptor_create_eprop (widget->priv->adaptor, - pclass, use_command); + pdef, use_command); glade_editor_property_load (eprop, prop); return eprop; @@ -4942,7 +4942,7 @@ glade_widget_verify (GladeWidget *widget) for (l = warn_properties; l; l = g_list_next (l)) { GladeProperty *property = l->data; - GladePropertyClass *pclass = glade_property_get_class (property); + GladePropertyDef *pdef = glade_property_get_def (property); if (l->prev == NULL) { @@ -4954,7 +4954,7 @@ glade_widget_verify (GladeWidget *widget) else g_string_append (string, ", "); - g_string_append (string, glade_property_class_get_name (pclass)); + g_string_append (string, glade_property_def_get_name (pdef)); } /* New line if printing both */ diff --git a/gladeui/glade-xml-utils.c b/gladeui/glade-xml-utils.c index 8bcb8304..e7857a97 100644 --- a/gladeui/glade-xml-utils.c +++ b/gladeui/glade-xml-utils.c @@ -953,7 +953,7 @@ glade_xml_load_sym_from_node (GladeXmlNode *node_in, * plenty of dialog boxes. Ideally, we should collect these errors, * and show all of them at the end of the load process. * - * I dont know who wrote the above in glade-property-class.c, but + * I dont know who wrote the above in glade-property-def.c, but * its a good point... makeing a bugzilla entry. * -Tristan * diff --git a/gladeui/glade.h b/gladeui/glade.h index 1846e9d2..69291bea 100644 --- a/gladeui/glade.h +++ b/gladeui/glade.h @@ -24,7 +24,7 @@ #include <gladeui/glade-xml-utils.h> #include <gladeui/glade-widget-adaptor.h> #include <gladeui/glade-widget.h> -#include <gladeui/glade-property-class.h> +#include <gladeui/glade-property-def.h> #include <gladeui/glade-property-shell.h> #include <gladeui/glade-property.h> #include <gladeui/glade-signal-def.h> diff --git a/gladeui/meson.build b/gladeui/meson.build index 3df9cdee..f0f5bc50 100644 --- a/gladeui/meson.build +++ b/gladeui/meson.build @@ -42,7 +42,7 @@ headers = files( 'glade-placeholder.h', 'glade-project.h', 'glade-property.h', - 'glade-property-class.h', + 'glade-property-def.h', 'glade-property-label.h', 'glade-property-shell.h', 'glade-signal.h', @@ -116,7 +116,7 @@ sources = files( 'glade-project.c', 'glade-project-properties.c', 'glade-property.c', - 'glade-property-class.c', + 'glade-property-def.c', 'glade-property-label.c', 'glade-property-shell.c', 'glade-signal.c', diff --git a/plugins/gtk+/glade-accels.c b/plugins/gtk+/glade-accels.c index 71bfc4d7..cb0c4308 100644 --- a/plugins/gtk+/glade-accels.c +++ b/plugins/gtk+/glade-accels.c @@ -202,9 +202,9 @@ glade_eprop_accel_populate_view (GladeEditorProperty * eprop, { GladeEPropAccel *eprop_accel = GLADE_EPROP_ACCEL (eprop); GladeSignalDef *sdef; - GladePropertyClass *pclass = glade_editor_property_get_pclass (eprop); + GladePropertyDef *pdef = glade_editor_property_get_property_def (eprop); GladeProperty *property = glade_editor_property_get_property (eprop); - GladeWidgetAdaptor *adaptor = glade_property_class_get_adaptor (pclass); + GladeWidgetAdaptor *adaptor = glade_property_def_get_adaptor (pdef); GtkTreeStore *model = (GtkTreeStore *) gtk_tree_view_get_model (view); GtkTreeIter iter; GladeEpropIterTab *parent_tab; @@ -343,15 +343,15 @@ accel_edited (GtkCellRendererAccel * accel, gboolean key_was_set; GtkTreeIter iter, parent_iter, new_iter; gchar *accel_text; - GladePropertyClass *pclass; + GladePropertyDef *pdef; GladeWidgetAdaptor *adaptor; gboolean is_action; G_GNUC_BEGIN_IGNORE_DEPRECATIONS GType type_action = GTK_TYPE_ACTION; G_GNUC_END_IGNORE_DEPRECATIONS - pclass = glade_editor_property_get_pclass (GLADE_EDITOR_PROPERTY (eprop_accel)); - adaptor = glade_property_class_get_adaptor (pclass); + pdef = glade_editor_property_get_property_def (GLADE_EDITOR_PROPERTY (eprop_accel)); + adaptor = glade_property_def_get_adaptor (pdef); if (!gtk_tree_model_get_iter_from_string (eprop_accel->model, &iter, path_string)) diff --git a/plugins/gtk+/glade-cell-renderer-editor.c b/plugins/gtk+/glade-cell-renderer-editor.c index bec12d8e..23df948e 100644 --- a/plugins/gtk+/glade-cell-renderer-editor.c +++ b/plugins/gtk+/glade-cell-renderer-editor.c @@ -41,9 +41,9 @@ typedef struct GladeCellRendererEditor *editor; GtkWidget *attributes_check; - GladePropertyClass *pclass; - GladePropertyClass *attr_pclass; - GladePropertyClass *use_attr_pclass; + GladePropertyDef *pdef; + GladePropertyDef *attr_pdef; + GladePropertyDef *use_attr_pdef; GtkWidget *use_prop_label; GtkWidget *use_attr_label; @@ -101,7 +101,7 @@ glade_cell_renderer_editor_load (GladeEditable * editable, GladeWidget * widget) CheckTab *tab = l->data; gboolean use_attr = FALSE; - glade_widget_property_get (widget, glade_property_class_id (tab->use_attr_pclass), &use_attr); + glade_widget_property_get (widget, glade_property_def_id (tab->use_attr_pdef), &use_attr); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tab->attributes_check), use_attr); if (use_attr) @@ -190,17 +190,17 @@ attributes_toggled (GtkWidget * widget, CheckTab * tab) glade_command_push_group (_("Setting %s to use the %s property as an attribute"), glade_widget_get_name (gwidget), - glade_property_class_id (tab->pclass)); + glade_property_def_id (tab->pdef)); property = - glade_widget_get_property (gwidget, glade_property_class_id (tab->pclass)); + glade_widget_get_property (gwidget, glade_property_def_id (tab->pdef)); glade_property_get_default (property, &value); glade_command_set_property_value (property, &value); g_value_unset (&value); property = - glade_widget_get_property (gwidget, glade_property_class_id (tab->use_attr_pclass)); + glade_widget_get_property (gwidget, glade_property_def_id (tab->use_attr_pdef)); glade_command_set_property (property, TRUE); glade_command_pop_group (); @@ -211,16 +211,16 @@ attributes_toggled (GtkWidget * widget, CheckTab * tab) { glade_command_push_group (_("Setting %s to use the %s property directly"), glade_widget_get_name (gwidget), - glade_property_class_id (tab->pclass)); + glade_property_def_id (tab->pdef)); property = - glade_widget_get_property (gwidget, glade_property_class_id (tab->attr_pclass)); + glade_widget_get_property (gwidget, glade_property_def_id (tab->attr_pdef)); glade_property_get_default (property, &value); glade_command_set_property_value (property, &value); g_value_unset (&value); property = - glade_widget_get_property (gwidget, glade_property_class_id (tab->use_attr_pclass)); + glade_widget_get_property (gwidget, glade_property_def_id (tab->use_attr_pdef)); glade_command_set_property (property, FALSE); glade_command_pop_group (); @@ -233,17 +233,17 @@ attributes_toggled (GtkWidget * widget, CheckTab * tab) } static gint -property_class_comp (gconstpointer a, gconstpointer b) +property_def_comp (gconstpointer a, gconstpointer b) { - GladePropertyClass *ca = (GladePropertyClass *)a, *cb = (GladePropertyClass *)b; + GladePropertyDef *ca = (GladePropertyDef *)a, *cb = (GladePropertyDef *)b; GParamSpec *pa, *pb; - pa = glade_property_class_get_pspec (ca); - pb = glade_property_class_get_pspec (cb); + pa = glade_property_def_get_pspec (ca); + pb = glade_property_def_get_pspec (cb); if (pa->owner_type == pb->owner_type) { - gdouble result = glade_property_class_weight (ca) - glade_property_class_weight (cb); + gdouble result = glade_property_def_weight (ca) - glade_property_def_weight (cb); /* Avoid cast to int */ if (result < 0.0) return -1; @@ -255,9 +255,9 @@ property_class_comp (gconstpointer a, gconstpointer b) else { if (g_type_is_a (pa->owner_type, pb->owner_type)) - return (glade_property_class_common (ca) || glade_property_class_get_is_packing (ca)) ? 1 : -1; + return (glade_property_def_common (ca) || glade_property_def_get_is_packing (ca)) ? 1 : -1; else - return (glade_property_class_common (ca) || glade_property_class_get_is_packing (ca)) ? -1 : 1; + return (glade_property_def_common (ca) || glade_property_def_get_is_packing (ca)) ? -1 : 1; } } @@ -269,15 +269,15 @@ get_sorted_properties (GladeWidgetAdaptor * adaptor, GladeEditorPageType type) for (l = glade_widget_adaptor_get_properties (adaptor); l; l = l->next) { - GladePropertyClass *klass = l->data; + GladePropertyDef *def = l->data; - if (GLADE_PROPERTY_CLASS_IS_TYPE (klass, type) && - (glade_property_class_is_visible (klass))) + if (GLADE_PROPERTY_DEF_IS_TYPE (def, type) && + (glade_property_def_is_visible (def))) { - list = g_list_prepend (list, klass); + list = g_list_prepend (list, def); } } - return g_list_sort (list, property_class_comp); + return g_list_sort (list, property_def_comp); } @@ -287,7 +287,7 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor * adaptor, { GladeCellRendererEditor *renderer_editor; GladeEditorProperty *eprop; - GladePropertyClass *pclass, *attr_pclass, *use_attr_pclass; + GladePropertyDef *pdef, *attr_pdef, *use_attr_pdef; GList *list, *sorted; GtkWidget *hbox_left, *hbox_right, *grid; gchar *str; @@ -320,32 +320,32 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor * adaptor, gchar *attr_name; gchar *use_attr_name; - pclass = list->data; + pdef = list->data; /* "stock-size" is a normal property, but we virtualize it to use the GtkIconSize enumeration */ - if (glade_property_class_get_virtual (pclass) && - strcmp (glade_property_class_id (pclass), "stock-size") != 0) + if (glade_property_def_get_virtual (pdef) && + strcmp (glade_property_def_id (pdef), "stock-size") != 0) continue; - attr_name = g_strdup_printf ("attr-%s", glade_property_class_id (pclass)); - use_attr_name = g_strdup_printf ("use-attr-%s", glade_property_class_id (pclass)); + attr_name = g_strdup_printf ("attr-%s", glade_property_def_id (pdef)); + use_attr_name = g_strdup_printf ("use-attr-%s", glade_property_def_id (pdef)); - attr_pclass = - glade_widget_adaptor_get_property_class (adaptor, attr_name); - use_attr_pclass = - glade_widget_adaptor_get_property_class (adaptor, use_attr_name); + attr_pdef = + glade_widget_adaptor_get_property_def (adaptor, attr_name); + use_attr_pdef = + glade_widget_adaptor_get_property_def (adaptor, use_attr_name); - if (attr_pclass && use_attr_pclass) + if (attr_pdef && use_attr_pdef) { CheckTab *tab = g_new0 (CheckTab, 1); GParamSpec *pspec; - pspec = glade_property_class_get_pspec (pclass); + pspec = glade_property_def_get_pspec (pdef); tab->editor = renderer_editor; - tab->pclass = pclass; - tab->attr_pclass = attr_pclass; - tab->use_attr_pclass = use_attr_pclass; + tab->pdef = pdef; + tab->attr_pdef = attr_pdef; + tab->use_attr_pdef = use_attr_pdef; /* Label appearance... */ hbox_left = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); @@ -354,7 +354,7 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor * adaptor, tab->attributes_check = gtk_check_button_new (); str = g_strdup_printf (_("Retrieve %s from model (type %s)"), - glade_property_class_get_name (pclass), + glade_property_def_get_name (pdef), g_type_name (pspec->value_type)); gtk_widget_set_tooltip_text (tab->attributes_check, str); g_free (str); @@ -363,7 +363,7 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor * adaptor, FALSE, 4); /* Edit property */ - eprop = glade_widget_adaptor_create_eprop (adaptor, pclass, TRUE); + eprop = glade_widget_adaptor_create_eprop (adaptor, pdef, TRUE); gtk_box_pack_start (GTK_BOX (hbox_left), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 4); gtk_box_pack_start (GTK_BOX (hbox_right), GTK_WIDGET (eprop), FALSE, @@ -376,7 +376,7 @@ glade_cell_renderer_editor_new (GladeWidgetAdaptor * adaptor, /* Edit attribute */ eprop = - glade_widget_adaptor_create_eprop (adaptor, attr_pclass, TRUE); + glade_widget_adaptor_create_eprop (adaptor, attr_pdef, TRUE); gtk_box_pack_start (GTK_BOX (hbox_right), GTK_WIDGET (eprop), FALSE, FALSE, 4); renderer_editor->properties = @@ -584,7 +584,7 @@ glade_eprop_cell_attribute_create_input (GladeEditorProperty * eprop) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); - adjustment = glade_property_class_make_adjustment (glade_editor_property_get_pclass (eprop)); + adjustment = glade_property_def_make_adjustment (glade_editor_property_get_property_def (eprop)); eprop_attribute->spin = gtk_spin_button_new (adjustment, 1.0, 0); eprop_attribute->columns = diff --git a/plugins/gtk+/glade-column-types.c b/plugins/gtk+/glade-column-types.c index 38df1330..7daf767d 100644 --- a/plugins/gtk+/glade-column-types.c +++ b/plugins/gtk+/glade-column-types.c @@ -61,13 +61,13 @@ column_types_store_populate_enums_flags (GtkListStore * store, gboolean enums) for (list = adaptors; list; list = list->next) { GladeWidgetAdaptor *adaptor = list->data; - GladePropertyClass *pclass; + GladePropertyDef *pdef; GParamSpec *pspec; for (l = glade_widget_adaptor_get_properties (adaptor); l; l = l->next) { - pclass = l->data; - pspec = glade_property_class_get_pspec (pclass); + pdef = l->data; + pspec = glade_property_def_get_pspec (pdef); /* special case out a few of these... */ if (strcmp (g_type_name (pspec->value_type), diff --git a/plugins/gtk+/glade-eprop-enum-int.c b/plugins/gtk+/glade-eprop-enum-int.c index be281c94..29ece34f 100644 --- a/plugins/gtk+/glade-eprop-enum-int.c +++ b/plugins/gtk+/glade-eprop-enum-int.c @@ -429,13 +429,13 @@ glade_eprop_enum_int_set_property (GObject *object, } GladeEditorProperty * -glade_eprop_enum_int_new (GladePropertyClass *pclass, +glade_eprop_enum_int_new (GladePropertyDef *pdef, GType type, gboolean use_command) { GladeEditorProperty *eprop = g_object_new (GLADE_TYPE_EPROP_ENUM_INT, - "property-class", pclass, + "property-def", pdef, "use-command", use_command, "type", type, NULL); diff --git a/plugins/gtk+/glade-eprop-enum-int.h b/plugins/gtk+/glade-eprop-enum-int.h index dcf63386..b119db8e 100644 --- a/plugins/gtk+/glade-eprop-enum-int.h +++ b/plugins/gtk+/glade-eprop-enum-int.h @@ -22,9 +22,9 @@ typedef struct { GladeEditorPropertyClass eprop_class; } GladeEPropEnumIntClass; -GladeEditorProperty *glade_eprop_enum_int_new (GladePropertyClass *pclass, - GType type, - gboolean use_command); +GladeEditorProperty *glade_eprop_enum_int_new (GladePropertyDef *pdef, + GType type, + gboolean use_command); G_END_DECLS diff --git a/plugins/gtk+/glade-gtk-action-widgets.c b/plugins/gtk+/glade-gtk-action-widgets.c index 7cbdff95..47e8db0d 100644 --- a/plugins/gtk+/glade-gtk-action-widgets.c +++ b/plugins/gtk+/glade-gtk-action-widgets.c @@ -128,7 +128,7 @@ glade_gtk_action_widgets_write_responses (GladeWidget *widget, glade_xml_node_append_child (node, widget_node); str = - glade_property_class_make_string_from_gvalue (glade_property_get_class (property), + glade_property_def_make_string_from_gvalue (glade_property_get_def (property), glade_property_inline_value (property)); glade_xml_node_set_property_string (widget_node, GLADE_TAG_RESPONSE, str); diff --git a/plugins/gtk+/glade-gtk-adjustment.c b/plugins/gtk+/glade-gtk-adjustment.c index 44ce9bfd..a7a16561 100644 --- a/plugins/gtk+/glade-gtk-adjustment.c +++ b/plugins/gtk+/glade-gtk-adjustment.c @@ -71,8 +71,8 @@ static gint get_prop_precision (GladeWidget *widget, gchar *property) { GladeProperty *prop = glade_widget_get_property (widget, property); - GladePropertyClass *klass = glade_property_get_class (prop); - GParamSpec *pspec = glade_property_class_get_pspec (klass); + GladePropertyDef *def = glade_property_get_def (prop); + GParamSpec *pspec = glade_property_def_get_pspec (def); GValue value = G_VALUE_INIT; glade_property_get_value (prop, &value); diff --git a/plugins/gtk+/glade-gtk-button.c b/plugins/gtk+/glade-gtk-button.c index b4e87d16..f5e691e9 100644 --- a/plugins/gtk+/glade-gtk-button.c +++ b/plugins/gtk+/glade-gtk-button.c @@ -188,8 +188,8 @@ glade_gtk_button_post_create (GladeWidgetAdaptor *adaptor, static inline gboolean glade_gtk_lock_button_is_own_property (GladeProperty *property) { - GladePropertyClass *klass = glade_property_get_class (property); - GParamSpec *spec = glade_property_class_get_pspec (klass); + GladePropertyDef *def = glade_property_get_def (property); + GParamSpec *spec = glade_property_def_get_pspec (def); return (spec->owner_type == GTK_TYPE_LOCK_BUTTON); } @@ -238,7 +238,7 @@ glade_gtk_button_set_property (GladeWidgetAdaptor *adaptor, id, value); glade_gtk_sync_use_appearance (widget); } - else if (GPC_VERSION_CHECK (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1)) + else if (GPC_VERSION_CHECK (glade_property_get_def (property), gtk_major_version, gtk_minor_version + 1)) GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value); /* GtkLockButton hides itself after setting a property so we need to make sure @@ -327,18 +327,18 @@ glade_gtk_button_write_widget (GladeWidgetAdaptor *adaptor, GladeEditorProperty * glade_gtk_button_create_eprop (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, gboolean use_command) { GladeEditorProperty *eprop; - if (strcmp (glade_property_class_id(klass), "response-id")==0) + if (strcmp (glade_property_def_id(def), "response-id")==0) { - eprop = glade_eprop_enum_int_new (klass, GTK_TYPE_RESPONSE_TYPE, use_command); + eprop = glade_eprop_enum_int_new (def, GTK_TYPE_RESPONSE_TYPE, use_command); } else eprop = GWA_GET_CLASS - (GTK_TYPE_WIDGET)->create_eprop (adaptor, klass, use_command); + (GTK_TYPE_WIDGET)->create_eprop (adaptor, def, use_command); return eprop; } diff --git a/plugins/gtk+/glade-gtk-cell-layout.c b/plugins/gtk+/glade-gtk-cell-layout.c index 0ee762a7..80469a2a 100644 --- a/plugins/gtk+/glade-gtk-cell-layout.c +++ b/plugins/gtk+/glade-gtk-cell-layout.c @@ -262,7 +262,7 @@ glade_gtk_cell_renderer_write_attributes (GladeWidget *widget, GladeXmlNode *node) { GladeProperty *property; - GladePropertyClass *pclass; + GladePropertyDef *pdef; GladeXmlNode *attrs_node; gchar *attr_name; GList *l; @@ -276,22 +276,22 @@ glade_gtk_cell_renderer_write_attributes (GladeWidget *widget, for (l = glade_widget_get_properties (widget); l; l = l->next) { property = l->data; - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); - if (strncmp (glade_property_class_id (pclass), "attr-", attr_len) == 0) + if (strncmp (glade_property_def_id (pdef), "attr-", attr_len) == 0) { GladeXmlNode *attr_node; gchar *column_str, *use_attr_str; gboolean use_attr = FALSE; - use_attr_str = g_strdup_printf ("use-%s", glade_property_class_id (pclass)); + use_attr_str = g_strdup_printf ("use-%s", glade_property_def_id (pdef)); glade_widget_property_get (widget, use_attr_str, &use_attr); if (use_attr && g_value_get_int (glade_property_inline_value (property)) >= 0) { column_str = g_strdup_printf ("%d", g_value_get_int (glade_property_inline_value (property))); - attr_name = (gchar *)&glade_property_class_id (pclass)[attr_len]; + attr_name = (gchar *)&glade_property_def_id (pdef)[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-gtk-cell-renderer.c b/plugins/gtk+/glade-gtk-cell-renderer.c index 38fcb7d0..ee0ffdff 100644 --- a/plugins/gtk+/glade-gtk-cell-renderer.c +++ b/plugins/gtk+/glade-gtk-cell-renderer.c @@ -60,7 +60,7 @@ glade_gtk_cell_renderer_deep_post_create (GladeWidgetAdaptor *adaptor, GObject *object, GladeCreateReason reason) { - GladePropertyClass *pclass; + GladePropertyDef *pdef; GladeProperty *property; GladeWidget *widget; const GList *l; @@ -69,11 +69,11 @@ glade_gtk_cell_renderer_deep_post_create (GladeWidgetAdaptor *adaptor, for (l = glade_widget_adaptor_get_properties (adaptor); l; l = l->next) { - pclass = l->data; + pdef = l->data; - if (strncmp (glade_property_class_id (pclass), "use-attr-", strlen ("use-attr-")) == 0) + if (strncmp (glade_property_def_id (pdef), "use-attr-", strlen ("use-attr-")) == 0) { - property = glade_widget_get_property (widget, glade_property_class_id (pclass)); + property = glade_widget_get_property (widget, glade_property_def_id (pdef)); glade_property_sync (property); } } @@ -83,18 +83,18 @@ glade_gtk_cell_renderer_deep_post_create (GladeWidgetAdaptor *adaptor, GladeEditorProperty * glade_gtk_cell_renderer_create_eprop (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, gboolean use_command) { GladeEditorProperty *eprop; - if (strncmp (glade_property_class_id (klass), "attr-", strlen ("attr-")) == 0) + if (strncmp (glade_property_def_id (def), "attr-", strlen ("attr-")) == 0) eprop = g_object_new (GLADE_TYPE_EPROP_CELL_ATTRIBUTE, - "property-class", klass, + "property-def", def, "use-command", use_command, NULL); else eprop = GWA_GET_CLASS - (G_TYPE_OBJECT)->create_eprop (adaptor, klass, use_command); + (G_TYPE_OBJECT)->create_eprop (adaptor, def, use_command); return eprop; } @@ -212,7 +212,7 @@ glade_gtk_cell_renderer_write_properties (GladeWidget *widget, GladeXmlNode *node) { GladeProperty *property, *prop; - GladePropertyClass *pclass; + GladePropertyDef *pdef; gchar *attr_name; GList *l; static gint attr_len = 0; @@ -223,17 +223,17 @@ glade_gtk_cell_renderer_write_properties (GladeWidget *widget, for (l = glade_widget_get_properties (widget); l; l = l->next) { property = l->data; - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); - if (strncmp (glade_property_class_id (pclass), "attr-", attr_len) == 0) + if (strncmp (glade_property_def_id (pdef), "attr-", attr_len) == 0) { gchar *use_attr_str; gboolean use_attr = FALSE; - use_attr_str = g_strdup_printf ("use-%s", glade_property_class_id (pclass)); + use_attr_str = g_strdup_printf ("use-%s", glade_property_def_id (pdef)); glade_widget_property_get (widget, use_attr_str, &use_attr); - attr_name = (gchar *)&glade_property_class_id (pclass)[attr_len]; + attr_name = (gchar *)&glade_property_def_id (pdef)[attr_len]; prop = glade_widget_get_property (widget, attr_name); if (!use_attr && prop) @@ -290,16 +290,16 @@ glade_gtk_cell_renderer_parse_finished (GladeProject *project, for (l = glade_widget_get_properties (widget); l; l = l->next) { GladeProperty *switch_prop; - GladePropertyClass *pclass; + GladePropertyDef *pdef; property = l->data; - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); - if (strncmp (glade_property_class_id (pclass), "attr-", attr_len) != 0 && - strncmp (glade_property_class_id (pclass), "use-attr-", use_attr_len) != 0 && + if (strncmp (glade_property_def_id (pdef), "attr-", attr_len) != 0 && + strncmp (glade_property_def_id (pdef), "use-attr-", use_attr_len) != 0 && (switch_prop = glade_gtk_cell_renderer_attribute_switch (widget, - glade_property_class_id (pclass))) != NULL) + glade_property_def_id (pdef))) != NULL) { if (glade_property_original_default (property)) glade_property_set (switch_prop, TRUE); @@ -350,7 +350,7 @@ glade_gtk_cell_renderer_sync_attributes (GObject *object) GladeWidget *parent; GladeWidget *gmodel; GladeProperty *property; - GladePropertyClass *pclass; + GladePropertyDef *pdef; gchar *attr_prop_name; GList *l, *column_list = NULL; gint columns = 0; @@ -386,20 +386,20 @@ glade_gtk_cell_renderer_sync_attributes (GObject *object) for (l = glade_widget_get_properties (widget); l; l = l->next) { property = l->data; - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); - if (strncmp (glade_property_class_id (pclass), "attr-", attr_len) == 0) + if (strncmp (glade_property_def_id (pdef), "attr-", attr_len) == 0) { gint column = g_value_get_int (glade_property_inline_value (property)); - attr_prop_name = (gchar *)&glade_property_class_id (pclass)[attr_len]; + attr_prop_name = (gchar *)&glade_property_def_id (pdef)[attr_len]; if (column >= 0 && column < columns) { GladeColumnType *column_type = (GladeColumnType *) g_list_nth_data (column_list, column); GType column_gtype = g_type_from_name (column_type->type_name); - GParamSpec *pspec = glade_property_class_get_pspec (pclass); + GParamSpec *pspec = glade_property_def_get_pspec (pdef); if (column_gtype && g_value_type_transformable (column_gtype, pspec->value_type)) diff --git a/plugins/gtk+/glade-gtk-combo-box-text.c b/plugins/gtk+/glade-gtk-combo-box-text.c index d1aed871..99548462 100644 --- a/plugins/gtk+/glade-gtk-combo-box-text.c +++ b/plugins/gtk+/glade-gtk-combo-box-text.c @@ -60,33 +60,33 @@ glade_gtk_combo_box_text_post_create (GladeWidgetAdaptor *adaptor, GladeEditorProperty * glade_gtk_combo_box_text_create_eprop (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, - gboolean use_command) + GladePropertyDef *def, + gboolean use_command) { GladeEditorProperty *eprop; GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); if (pspec->value_type == GLADE_TYPE_STRING_LIST) { - eprop = glade_eprop_string_list_new (klass, use_command, TRUE, TRUE); + eprop = glade_eprop_string_list_new (def, use_command, TRUE, TRUE); } else eprop = GWA_GET_CLASS - (GTK_TYPE_WIDGET)->create_eprop (adaptor, klass, use_command); + (GTK_TYPE_WIDGET)->create_eprop (adaptor, def, use_command); return eprop; } gchar * glade_gtk_combo_box_text_string_from_value (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, const GValue *value) { GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); if (pspec->value_type == GLADE_TYPE_STRING_LIST) { @@ -96,7 +96,7 @@ glade_gtk_combo_box_text_string_from_value (GladeWidgetAdaptor *adaptor, } else return GWA_GET_CLASS - (GTK_TYPE_COMBO_BOX)->string_from_value (adaptor, klass, value); + (GTK_TYPE_COMBO_BOX)->string_from_value (adaptor, def, value); } void diff --git a/plugins/gtk+/glade-gtk-container.c b/plugins/gtk+/glade-gtk-container.c index 50d600ca..3066884f 100644 --- a/plugins/gtk+/glade-gtk-container.c +++ b/plugins/gtk+/glade-gtk-container.c @@ -103,7 +103,7 @@ glade_gtk_container_replace_child (GladeWidgetAdaptor *adaptor, GtkWidget *new_widget) { GParamSpec **param_spec; - GladePropertyClass *pclass; + GladePropertyDef *pdef; GValue *value; guint nproperties; guint i; @@ -134,10 +134,10 @@ glade_gtk_container_replace_child (GladeWidgetAdaptor *adaptor, */ if (GLADE_IS_PLACEHOLDER (new_widget)) { - pclass = glade_widget_adaptor_get_pack_property_class + pdef = glade_widget_adaptor_get_pack_property_def (adaptor, param_spec[i]->name); - if (pclass && glade_property_class_transfer_on_paste (pclass)) + if (pdef && glade_property_def_transfer_on_paste (pdef)) continue; } diff --git a/plugins/gtk+/glade-gtk-entry-buffer.c b/plugins/gtk+/glade-gtk-entry-buffer.c index d7001154..bdb5f219 100644 --- a/plugins/gtk+/glade-gtk-entry-buffer.c +++ b/plugins/gtk+/glade-gtk-entry-buffer.c @@ -84,6 +84,6 @@ glade_gtk_entry_buffer_set_property (GladeWidgetAdaptor * adaptor, } else if (GPC_VERSION_CHECK - (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1)) + (glade_property_get_def (property), gtk_major_version, gtk_minor_version + 1)) GWA_GET_CLASS (G_TYPE_OBJECT)->set_property (adaptor, object, id, value); } diff --git a/plugins/gtk+/glade-gtk-entry.c b/plugins/gtk+/glade-gtk-entry.c index 94098739..3c2813ee 100644 --- a/plugins/gtk+/glade-gtk-entry.c +++ b/plugins/gtk+/glade-gtk-entry.c @@ -211,7 +211,7 @@ glade_gtk_entry_set_property (GladeWidgetAdaptor *adaptor, GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object, id, value); } else if (GPC_VERSION_CHECK - (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1)) + (glade_property_get_def (property), gtk_major_version, gtk_minor_version + 1)) GWA_GET_CLASS (GTK_TYPE_WIDGET)->set_property (adaptor, object, id, value); } @@ -246,7 +246,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 (glade_property_get_class (property), target_major, target_minor)) + if (GPC_VERSION_CHECK (glade_property_get_def (property), target_major, target_minor)) { glade_widget_property_set (widget, "use-entry-buffer", TRUE); glade_property_sync (property); diff --git a/plugins/gtk+/glade-gtk-icon-factory.c b/plugins/gtk+/glade-gtk-icon-factory.c index a9c7aaff..6b54f074 100644 --- a/plugins/gtk+/glade-gtk-icon-factory.c +++ b/plugins/gtk+/glade-gtk-icon-factory.c @@ -426,13 +426,13 @@ G_GNUC_END_IGNORE_DEPRECATIONS gchar * glade_gtk_icon_factory_string_from_value (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, const GValue *value) { GString *string; GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); if (pspec->value_type == GLADE_TYPE_ICON_SOURCES) { @@ -448,27 +448,27 @@ glade_gtk_icon_factory_string_from_value (GladeWidgetAdaptor *adaptor, } else return GWA_GET_CLASS - (G_TYPE_OBJECT)->string_from_value (adaptor, klass, value); + (G_TYPE_OBJECT)->string_from_value (adaptor, def, value); } GladeEditorProperty * glade_gtk_icon_factory_create_eprop (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, gboolean use_command) { GladeEditorProperty *eprop; GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); if (pspec->value_type == GLADE_TYPE_ICON_SOURCES) eprop = g_object_new (GLADE_TYPE_EPROP_ICON_SOURCES, - "property-class", klass, + "property-def", def, "use-command", use_command, NULL); else eprop = GWA_GET_CLASS - (G_TYPE_OBJECT)->create_eprop (adaptor, klass, use_command); + (G_TYPE_OBJECT)->create_eprop (adaptor, def, use_command); return eprop; } diff --git a/plugins/gtk+/glade-gtk-label.c b/plugins/gtk+/glade-gtk-label.c index 0ec20c39..68dc3100 100644 --- a/plugins/gtk+/glade-gtk-label.c +++ b/plugins/gtk+/glade-gtk-label.c @@ -495,12 +495,12 @@ glade_gtk_label_write_widget (GladeWidgetAdaptor *adaptor, gchar * glade_gtk_label_string_from_value (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, const GValue *value) { GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); if (pspec->value_type == GLADE_TYPE_ATTR_GLIST) { @@ -523,30 +523,30 @@ glade_gtk_label_string_from_value (GladeWidgetAdaptor *adaptor, } else return GWA_GET_CLASS - (GTK_TYPE_WIDGET)->string_from_value (adaptor, klass, value); + (GTK_TYPE_WIDGET)->string_from_value (adaptor, def, value); } GladeEditorProperty * glade_gtk_label_create_eprop (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, gboolean use_command) { GladeEditorProperty *eprop; GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); /* chain up.. */ if (pspec->value_type == GLADE_TYPE_ATTR_GLIST) { eprop = g_object_new (GLADE_TYPE_EPROP_ATTRS, - "property-class", klass, + "property-def", def, "use-command", use_command, NULL); } else eprop = GWA_GET_CLASS - (GTK_TYPE_WIDGET)->create_eprop (adaptor, klass, use_command); + (GTK_TYPE_WIDGET)->create_eprop (adaptor, def, use_command); return eprop; } diff --git a/plugins/gtk+/glade-gtk-list-store.c b/plugins/gtk+/glade-gtk-list-store.c index 71a0c049..b30b58a1 100644 --- a/plugins/gtk+/glade-gtk-list-store.c +++ b/plugins/gtk+/glade-gtk-list-store.c @@ -143,26 +143,26 @@ glade_gtk_store_set_property (GladeWidgetAdaptor *adaptor, GladeEditorProperty * glade_gtk_store_create_eprop (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, gboolean use_command) { GladeEditorProperty *eprop; GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); /* chain up.. */ if (pspec->value_type == GLADE_TYPE_COLUMN_TYPE_LIST) eprop = g_object_new (GLADE_TYPE_EPROP_COLUMN_TYPES, - "property-class", klass, + "property-def", def, "use-command", use_command, NULL); else if (pspec->value_type == GLADE_TYPE_MODEL_DATA_TREE) eprop = g_object_new (GLADE_TYPE_EPROP_MODEL_DATA, - "property-class", klass, + "property-def", def, "use-command", use_command, NULL); else eprop = GWA_GET_CLASS - (G_TYPE_OBJECT)->create_eprop (adaptor, klass, use_command); + (G_TYPE_OBJECT)->create_eprop (adaptor, def, use_command); return eprop; } @@ -246,13 +246,13 @@ glade_gtk_store_create_editable (GladeWidgetAdaptor *adaptor, gchar * glade_gtk_store_string_from_value (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, const GValue *value) { GString *string; GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); if (pspec->value_type == GLADE_TYPE_COLUMN_TYPE_LIST) { @@ -320,7 +320,7 @@ glade_gtk_store_string_from_value (GladeWidgetAdaptor *adaptor, } else return GWA_GET_CLASS - (G_TYPE_OBJECT)->string_from_value (adaptor, klass, value); + (G_TYPE_OBJECT)->string_from_value (adaptor, def, value); } static void diff --git a/plugins/gtk+/glade-gtk-menu-item.c b/plugins/gtk+/glade-gtk-menu-item.c index 40dd4ba9..30167ebb 100644 --- a/plugins/gtk+/glade-gtk-menu-item.c +++ b/plugins/gtk+/glade-gtk-menu-item.c @@ -223,7 +223,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 - (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1)) + (glade_property_get_def (property), gtk_major_version, gtk_minor_version + 1)) GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value); } diff --git a/plugins/gtk+/glade-gtk-progress-bar.c b/plugins/gtk+/glade-gtk-progress-bar.c index 3a8f16eb..4297bbb9 100644 --- a/plugins/gtk+/glade-gtk-progress-bar.c +++ b/plugins/gtk+/glade-gtk-progress-bar.c @@ -64,6 +64,6 @@ glade_gtk_progress_bar_set_property (GladeWidgetAdaptor *adaptor, } } - if (GPC_VERSION_CHECK (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1)) + if (GPC_VERSION_CHECK (glade_property_get_def (property), gtk_major_version, gtk_minor_version + 1)) GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value); } diff --git a/plugins/gtk+/glade-gtk-recent-chooser-menu.c b/plugins/gtk+/glade-gtk-recent-chooser-menu.c index d1aa8961..2bf3be35 100644 --- a/plugins/gtk+/glade-gtk-recent-chooser-menu.c +++ b/plugins/gtk+/glade-gtk-recent-chooser-menu.c @@ -46,6 +46,6 @@ glade_gtk_recent_chooser_menu_set_property (GladeWidgetAdaptor *adaptor, GladeWidget *widget = glade_widget_get_from_gobject (object); GladeProperty *property = glade_widget_get_property (widget, id); - if (GPC_VERSION_CHECK (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1)) + if (GPC_VERSION_CHECK (glade_property_get_def (property), gtk_major_version, gtk_minor_version + 1)) GWA_GET_CLASS (GTK_TYPE_MENU)->set_property (adaptor, object, id, value); } diff --git a/plugins/gtk+/glade-gtk-recent-file-filter.c b/plugins/gtk+/glade-gtk-recent-file-filter.c index cc334860..417272c7 100644 --- a/plugins/gtk+/glade-gtk-recent-file-filter.c +++ b/plugins/gtk+/glade-gtk-recent-file-filter.c @@ -133,33 +133,33 @@ glade_gtk_filter_write_strings (GladeWidget *widget, GladeEditorProperty * glade_gtk_recent_file_filter_create_eprop (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, gboolean use_command) { GladeEditorProperty *eprop; GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); if (pspec->value_type == GLADE_TYPE_STRING_LIST) { - eprop = glade_eprop_string_list_new (klass, use_command, FALSE, FALSE); + eprop = glade_eprop_string_list_new (def, use_command, FALSE, FALSE); } else eprop = GWA_GET_CLASS - (G_TYPE_OBJECT)->create_eprop (adaptor, klass, use_command); + (G_TYPE_OBJECT)->create_eprop (adaptor, def, use_command); return eprop; } gchar * glade_gtk_recent_file_filter_string_from_value (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, const GValue *value) { GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); if (pspec->value_type == GLADE_TYPE_STRING_LIST) { @@ -169,7 +169,7 @@ glade_gtk_recent_file_filter_string_from_value (GladeWidgetAdaptor *adaptor, } else return GWA_GET_CLASS - (G_TYPE_OBJECT)->string_from_value (adaptor, klass, value); + (G_TYPE_OBJECT)->string_from_value (adaptor, def, value); } void diff --git a/plugins/gtk+/glade-gtk-scale.c b/plugins/gtk+/glade-gtk-scale.c index e134c5b0..23dd7cd8 100644 --- a/plugins/gtk+/glade-gtk-scale.c +++ b/plugins/gtk+/glade-gtk-scale.c @@ -64,6 +64,6 @@ glade_gtk_scale_set_property (GladeWidgetAdaptor *adaptor, } } - if (GPC_VERSION_CHECK (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1)) + if (GPC_VERSION_CHECK (glade_property_get_def (property), gtk_major_version, gtk_minor_version + 1)) GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value); } diff --git a/plugins/gtk+/glade-gtk-scrolled-window.c b/plugins/gtk+/glade-gtk-scrolled-window.c index 3b160e5d..302b12c2 100644 --- a/plugins/gtk+/glade-gtk-scrolled-window.c +++ b/plugins/gtk+/glade-gtk-scrolled-window.c @@ -56,7 +56,7 @@ glade_gtk_scrolled_window_set_property (GladeWidgetAdaptor *adaptor, glade_widget_property_set_sensitive (widget, "window-placement", FALSE, _("This property is disabled")); } - else if (GPC_VERSION_CHECK (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1)) + else if (GPC_VERSION_CHECK (glade_property_get_def (property), gtk_major_version, gtk_minor_version + 1)) GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value); } diff --git a/plugins/gtk+/glade-gtk-text-buffer.c b/plugins/gtk+/glade-gtk-text-buffer.c index bda4e4a8..0886de5f 100644 --- a/plugins/gtk+/glade-gtk-text-buffer.c +++ b/plugins/gtk+/glade-gtk-text-buffer.c @@ -80,6 +80,6 @@ glade_gtk_text_buffer_set_property (GladeWidgetAdaptor * adaptor, } else if (GPC_VERSION_CHECK - (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1)) + (glade_property_get_def (property), gtk_major_version, gtk_minor_version + 1)) GWA_GET_CLASS (G_TYPE_OBJECT)->set_property (adaptor, object, id, value); } diff --git a/plugins/gtk+/glade-gtk-tool-item.c b/plugins/gtk+/glade-gtk-tool-item.c index 520ef53d..859613e2 100644 --- a/plugins/gtk+/glade-gtk-tool-item.c +++ b/plugins/gtk+/glade-gtk-tool-item.c @@ -67,7 +67,7 @@ glade_gtk_tool_item_set_property (GladeWidgetAdaptor *adaptor, GladeProperty *property = glade_widget_get_property (gwidget, id); if (GPC_VERSION_CHECK - (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1)) + (glade_property_get_def (property), gtk_major_version, gtk_minor_version + 1)) GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value); } diff --git a/plugins/gtk+/glade-gtk-tree-view.c b/plugins/gtk+/glade-gtk-tree-view.c index 043c75e4..c800d72b 100644 --- a/plugins/gtk+/glade-gtk-tree-view.c +++ b/plugins/gtk+/glade-gtk-tree-view.c @@ -306,6 +306,6 @@ glade_gtk_treeview_set_property (GladeWidgetAdaptor *adaptor, glade_widget_property_set_sensitive (widget, "expander-column", FALSE, _("Expanders are not shown")); } - if (GPC_VERSION_CHECK (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1)) + if (GPC_VERSION_CHECK (glade_property_get_def (property), gtk_major_version, gtk_minor_version + 1)) GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id, value); } diff --git a/plugins/gtk+/glade-gtk-widget.c b/plugins/gtk+/glade-gtk-widget.c index 3ecf9e6b..84097d17 100644 --- a/plugins/gtk+/glade-gtk-widget.c +++ b/plugins/gtk+/glade-gtk-widget.c @@ -87,7 +87,7 @@ static void glade_gtk_parse_atk_relation (GladeProperty *property, GladeXmlNode *node) { GladeXmlNode *prop; - GladePropertyClass *pclass; + GladePropertyDef *pdef; gchar *type, *target, *id, *tmp; gchar *string = NULL; @@ -110,10 +110,10 @@ glade_gtk_parse_atk_relation (GladeProperty *property, GladeXmlNode *node) continue; } - id = glade_util_read_prop_name (type); - pclass = glade_property_get_class (property); + id = glade_util_read_prop_name (type); + pdef = glade_property_get_def (property); - if (!strcmp (id, glade_property_class_id (pclass))) + if (!strcmp (id, glade_property_def_id (pdef))) { if (string == NULL) string = g_strdup (target); @@ -206,8 +206,8 @@ glade_gtk_parse_atk_props (GladeWidget *widget, GladeXmlNode *node) } /* Set the parsed value on the property ... */ - gvalue = glade_property_class_make_gvalue_from_string - (glade_property_get_class (property), value, glade_widget_get_project (widget)); + gvalue = glade_property_def_make_gvalue_from_string + (glade_property_get_def (property), value, glade_widget_get_project (widget)); glade_property_set_value (property, gvalue); g_value_unset (gvalue); g_free (gvalue); @@ -349,13 +349,13 @@ glade_gtk_widget_write_atk_property (GladeProperty *property, if (value && value[0]) { - GladePropertyClass *pclass = glade_property_get_class (property); + GladePropertyDef *pdef = glade_property_get_def (property); GladeXmlNode *prop_node = glade_xml_node_new (context, GLADE_TAG_A11Y_PROPERTY); glade_xml_node_append_child (node, prop_node); glade_xml_node_set_property_string (prop_node, - GLADE_TAG_NAME, glade_property_class_id (pclass)); + GLADE_TAG_NAME, glade_property_def_id (pdef)); glade_xml_set_content (prop_node, value); @@ -437,26 +437,26 @@ glade_gtk_widget_write_atk_relation (GladeProperty *property, GladeXmlNode *node) { GladeXmlNode *prop_node; - GladePropertyClass *pclass; + GladePropertyDef *pdef; gchar *value, **split; gint i; if ((value = glade_widget_adaptor_string_from_value - (glade_property_class_get_adaptor (glade_property_get_class (property)), - glade_property_get_class (property), glade_property_inline_value (property))) != NULL) + (glade_property_def_get_adaptor (glade_property_get_def (property)), + glade_property_get_def (property), glade_property_inline_value (property))) != NULL) { if ((split = g_strsplit (value, GPC_OBJECT_DELIMITER, 0)) != NULL) { for (i = 0; split[i] != NULL; i++) { - pclass = glade_property_get_class (property); + pdef = glade_property_get_def (property); prop_node = glade_xml_node_new (context, GLADE_TAG_A11Y_RELATION); glade_xml_node_append_child (node, prop_node); glade_xml_node_set_property_string (prop_node, GLADE_TAG_A11Y_TYPE, - glade_property_class_id (pclass)); + glade_property_def_id (pdef)); glade_xml_node_set_property_string (prop_node, GLADE_TAG_A11Y_TARGET, split[i]); @@ -494,13 +494,13 @@ glade_gtk_widget_write_atk_action (GladeProperty *property, if (value && value[0]) { - GladePropertyClass *pclass = glade_property_get_class (property); + GladePropertyDef *pdef = glade_property_get_def (property); GladeXmlNode *prop_node = glade_xml_node_new (context, GLADE_TAG_A11Y_ACTION); glade_xml_node_append_child (node, prop_node); glade_xml_node_set_property_string (prop_node, GLADE_TAG_A11Y_ACTION_NAME, - &glade_property_class_id (pclass)[4]); + &glade_property_def_id (pdef)[4]); glade_xml_node_set_property_string (prop_node, GLADE_TAG_A11Y_DESC, value); } @@ -623,24 +623,24 @@ glade_gtk_widget_write_widget_after (GladeWidgetAdaptor *adaptor, GladeEditorProperty * glade_gtk_widget_create_eprop (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, gboolean use_command) { GladeEditorProperty *eprop; GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); /* chain up.. */ if (pspec->value_type == GLADE_TYPE_ACCEL_GLIST) eprop = g_object_new (GLADE_TYPE_EPROP_ACCEL, - "property-class", klass, + "property-def", def, "use-command", use_command, NULL); else if (pspec->value_type == GLADE_TYPE_STRING_LIST) - eprop = glade_eprop_string_list_new (klass, use_command, FALSE, FALSE); + eprop = glade_eprop_string_list_new (def, use_command, FALSE, FALSE); else eprop = GWA_GET_CLASS - (G_TYPE_OBJECT)->create_eprop (adaptor, klass, use_command); + (G_TYPE_OBJECT)->create_eprop (adaptor, def, use_command); return eprop; } @@ -662,12 +662,12 @@ glade_gtk_widget_create_editable (GladeWidgetAdaptor *adaptor, gchar * glade_gtk_widget_string_from_value (GladeWidgetAdaptor *adaptor, - GladePropertyClass *klass, + GladePropertyDef *def, const GValue *value) { GParamSpec *pspec; - pspec = glade_property_class_get_pspec (klass); + pspec = glade_property_def_get_pspec (def); if (pspec->value_type == GLADE_TYPE_ACCEL_GLIST) return glade_accels_make_string (g_value_get_boxed (value)); @@ -679,7 +679,7 @@ glade_gtk_widget_string_from_value (GladeWidgetAdaptor *adaptor, } else return GWA_GET_CLASS - (G_TYPE_OBJECT)->string_from_value (adaptor, klass, value); + (G_TYPE_OBJECT)->string_from_value (adaptor, def, value); } static void @@ -797,9 +797,9 @@ create_command_property_list (GladeWidget *gnew, GList *saved_props) for (l = saved_props; l; l = l->next) { GladeProperty *property = l->data; - GladePropertyClass *pclass = glade_property_get_class (property); + GladePropertyDef *pdef = glade_property_get_def (property); GladeProperty *orig_prop = - glade_widget_get_pack_property (gnew, glade_property_class_id (pclass)); + glade_widget_get_pack_property (gnew, glade_property_def_id (pdef)); GCSetPropData *pdata = g_new0 (GCSetPropData, 1); pdata->property = orig_prop; diff --git a/plugins/gtk+/glade-string-list.c b/plugins/gtk+/glade-string-list.c index 454e23de..d45240c6 100644 --- a/plugins/gtk+/glade-string-list.c +++ b/plugins/gtk+/glade-string-list.c @@ -757,14 +757,14 @@ glade_eprop_string_list_create_input (GladeEditorProperty *eprop) } GladeEditorProperty * -glade_eprop_string_list_new (GladePropertyClass *pclass, +glade_eprop_string_list_new (GladePropertyDef *pdef, gboolean use_command, gboolean translatable, gboolean with_id) { GladeEditorProperty *eprop = g_object_new (GLADE_TYPE_EPROP_STRING_LIST, - "property-class", pclass, + "property-def", pdef, "use-command", use_command, NULL); diff --git a/plugins/gtk+/glade-string-list.h b/plugins/gtk+/glade-string-list.h index 355bc451..bfbfe02f 100644 --- a/plugins/gtk+/glade-string-list.h +++ b/plugins/gtk+/glade-string-list.h @@ -36,10 +36,10 @@ GList *glade_string_list_append (GList *list, gchar *glade_string_list_to_string (GList *list); -GladeEditorProperty *glade_eprop_string_list_new (GladePropertyClass *pclass, - gboolean use_command, - gboolean translatable, - gboolean with_id); +GladeEditorProperty *glade_eprop_string_list_new (GladePropertyDef *pdef, + gboolean use_command, + gboolean translatable, + gboolean with_id); G_END_DECLS |