Commit a543e990 authored by Corentin Noël's avatar Corentin Noël Committed by Alberto Fanjul
Browse files

Rename GladePropertyClass to GladePropertyDef and declare it as boxed

parent 91a8b096
......@@ -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"/>
......
......@@ -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
......
<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[...
......
......@@ -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 \
......
......@@ -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);
}
......
......@@ -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;
......
This diff is collapsed.
......@@ -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);
......
......@@ -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)
{