Commit 6fa69cb8 authored by Tristan Van Berkom's avatar Tristan Van Berkom

* Made GladePropertyClass completely opaque and created loads of api and updated all sources:

	20 files changed, 1152 insertions(+), 643 deletions(-)
parent cc8dfcfc
......@@ -22,6 +22,9 @@
* Made GladeWidgetAdaptor internalize *everything* into a private data structure,
21 files changed, 694 insertions(+), 670 deletions(-)
* Made GladePropertyClass completely opaque and created loads of api and updated all sources:
20 files changed, 1152 insertions(+), 643 deletions(-)
2011-01-01 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-command.[ch], Added GladeProject member to base command structure, now
......
......@@ -1367,7 +1367,7 @@ glade_base_editor_change_type (GladeBaseEditor * editor,
{
GladeProperty *orig_prop = (GladeProperty *) l->data;
GladePropertyClass *pclass = glade_property_get_class (orig_prop);
GladeProperty *dup_prop = glade_widget_get_property (gchild_new, pclass->id);
GladeProperty *dup_prop = glade_widget_get_property (gchild_new, glade_property_class_id (pclass));
glade_property_set_value (dup_prop, glade_property_inline_value (orig_prop));
l = g_list_next (l);
}
......
......@@ -391,11 +391,11 @@ glade_command_set_property_execute (GladeCommand * cmd)
/* Packing properties need to be refreshed here since
* they are reset when they get added to containers.
*/
if (pclass->packing)
if (glade_property_class_get_is_packing (pclass))
{
GladeProperty *tmp_prop;
tmp_prop = glade_widget_get_pack_property (widget, pclass->id);
tmp_prop = glade_widget_get_pack_property (widget, glade_property_class_id (pclass));
if (sdata->property != tmp_prop)
{
......@@ -591,19 +591,19 @@ glade_command_set_property_description (GladeCommandSetProperty * me)
pclass = glade_property_get_class (sdata->property);
widget = glade_property_get_widget (sdata->property);
value_name = glade_widget_adaptor_string_from_value
(GLADE_WIDGET_ADAPTOR (pclass->handle), pclass, sdata->new_value);
(glade_property_class_get_adaptor (pclass), pclass, sdata->new_value);
if (!value_name || strlen (value_name) > MAX_UNDO_MENU_ITEM_VALUE_LEN
|| strchr (value_name, '_'))
{
description = g_strdup_printf (_("Setting %s of %s"),
pclass->name,
glade_property_class_get_name (pclass),
glade_widget_get_name (widget));
}
else
{
description = g_strdup_printf (_("Setting %s of %s to %s"),
pclass->name,
glade_property_class_get_name (pclass),
glade_widget_get_name (widget),
value_name);
}
......@@ -1251,9 +1251,9 @@ glade_command_transfer_props (GladeWidget * gnew, GList * saved_props)
GladeProperty *prop, *sprop = l->data;
GladePropertyClass *pclass = glade_property_get_class (sprop);
prop = glade_widget_get_pack_property (gnew, pclass->id);
prop = glade_widget_get_pack_property (gnew, glade_property_class_id (pclass));
if (prop && pclass->transfer_on_paste &&
if (prop && glade_property_class_transfer_on_paste (pclass) &&
glade_property_class_match (glade_property_get_class (prop), pclass))
glade_property_set_value (prop, glade_property_inline_value (sprop));
}
......@@ -1340,7 +1340,7 @@ glade_command_add_execute (GladeCommandAddRemove * me)
GladeProperty *saved_prop = l->data;
GladePropertyClass *pclass = glade_property_get_class (saved_prop);
GladeProperty *widget_prop =
glade_widget_get_pack_property (cdata->widget, pclass->id);
glade_widget_get_pack_property (cdata->widget, glade_property_class_id (pclass));
glade_property_get_value (saved_prop, &value);
glade_property_set_value (widget_prop, &value);
......
This diff is collapsed.
......@@ -262,11 +262,15 @@ glade_editor_table_attach (GladeEditorTable * table,
static gint
property_class_comp (gconstpointer a, gconstpointer b)
{
const GladePropertyClass *ca = a, *cb = b;
GladePropertyClass *ca = (GladePropertyClass *)a, *cb = (GladePropertyClass *)b;
GParamSpec *pa, *pb;
if (ca->pspec->owner_type == cb->pspec->owner_type)
pa = glade_property_class_get_pspec (ca);
pb = glade_property_class_get_pspec (cb);
if (pa->owner_type == pb->owner_type)
{
gdouble result = ca->weight - cb->weight;
gdouble result = glade_property_class_weight (ca) - glade_property_class_weight (cb);
/* Avoid cast to int */
if (result < 0.0)
return -1;
......@@ -277,10 +281,10 @@ property_class_comp (gconstpointer a, gconstpointer b)
}
else
{
if (g_type_is_a (ca->pspec->owner_type, cb->pspec->owner_type))
return (ca->common || ca->packing) ? 1 : -1;
if (g_type_is_a (pa->owner_type, pb->owner_type))
return (glade_property_class_common (ca) || glade_property_class_get_is_packing (ca)) ? 1 : -1;
else
return (ca->common || ca->packing) ? -1 : 1;
return (glade_property_class_common (ca) || glade_property_class_get_is_packing (ca)) ? -1 : 1;
}
}
......@@ -303,9 +307,8 @@ get_sorted_properties (GladeWidgetAdaptor * adaptor, GladeEditorPageType type)
* invisible properties, allow adaptors to filter out properties from
* the GladeEditorTable using the "custom-layout" attribute.
*/
if ((!klass->custom_layout) && GLADE_PROPERTY_CLASS_IS_TYPE (klass, type)
&& (glade_property_class_is_visible (klass) ||
type == GLADE_PAGE_QUERY))
if (!glade_property_class_custom_layout (klass) && GLADE_PROPERTY_CLASS_IS_TYPE (klass, type)
&& (glade_property_class_is_visible (klass) || type == GLADE_PAGE_QUERY))
{
list = g_list_prepend (list, klass);
}
......@@ -321,11 +324,11 @@ append_item (GladeEditorTable * table,
GladeEditorProperty *property;
if (!(property = glade_widget_adaptor_create_eprop
(GLADE_WIDGET_ADAPTOR (klass->handle),
klass, from_query_dialog == FALSE)))
(glade_property_class_get_adaptor (klass), klass, from_query_dialog == FALSE)))
{
g_critical ("Unable to create editor for property '%s' of class '%s'",
klass->id, glade_widget_adaptor_get_name (GLADE_WIDGET_ADAPTOR (klass->handle)));
glade_property_class_id (klass),
glade_widget_adaptor_get_name (glade_property_class_get_adaptor (klass)));
return NULL;
}
......
......@@ -926,7 +926,7 @@ glade_editor_reset_view (GladeEditor * editor)
view_widget = gtk_tree_view_new_with_model (model);
g_object_set (G_OBJECT (view_widget), "enable-search", FALSE, NULL);
/********************* fake invisible column *********************/
/********************* fake invisible column *********************/
renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer), "editable", FALSE, "visible", FALSE, NULL);
......@@ -936,7 +936,7 @@ glade_editor_reset_view (GladeEditor * editor)
gtk_tree_view_column_set_visible (column, FALSE);
gtk_tree_view_set_expander_column (GTK_TREE_VIEW (view_widget), column);
/************************ enabled column ************************/
/************************ enabled column ************************/
renderer = gtk_cell_renderer_toggle_new ();
g_object_set (G_OBJECT (renderer),
"mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
......@@ -950,7 +950,7 @@ glade_editor_reset_view (GladeEditor * editor)
"activatable", COLUMN_NDEFAULT,
"active", COLUMN_ENABLED, "visible", COLUMN_CHILD, NULL);
/********************* property name column *********************/
/********************* property name column *********************/
renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer), "editable", FALSE, NULL);
......@@ -959,7 +959,7 @@ glade_editor_reset_view (GladeEditor * editor)
_("Property"), renderer,
"text", COLUMN_PROP_NAME, "weight", COLUMN_WEIGHT, NULL);
/******************* default indicator column *******************/
/******************* default indicator column *******************/
renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer),
"editable", FALSE,
......@@ -1018,9 +1018,9 @@ glade_editor_populate_reset_view (GladeEditor * editor, GtkTreeView * tree_view)
if (glade_property_class_is_visible (pclass) == FALSE)
continue;
if (pclass->atk)
if (glade_property_class_atk (pclass))
iter = &atk_iter;
else if (pclass->common)
else if (glade_property_class_common (pclass))
iter = &common_iter;
else
iter = &general_iter;
......@@ -1030,7 +1030,7 @@ glade_editor_populate_reset_view (GladeEditor * editor, GtkTreeView * tree_view)
gtk_tree_store_append (model, &property_iter, iter);
gtk_tree_store_set (model, &property_iter,
COLUMN_ENABLED, !def,
COLUMN_PROP_NAME, pclass->name,
COLUMN_PROP_NAME, glade_property_class_get_name (pclass),
COLUMN_PROPERTY, property,
COLUMN_WEIGHT, PANGO_WEIGHT_NORMAL,
COLUMN_CHILD, TRUE,
......@@ -1063,7 +1063,7 @@ glade_editor_reset_selection_changed_cb (GtkTreeSelection * selection,
pclass = glade_property_get_class (property);
gtk_text_buffer_set_text (text_buffer,
pclass ? pclass->tooltip : message,
pclass ? glade_property_class_get_tooltip (pclass) : message,
-1);
if (property)
g_object_unref (G_OBJECT (property));
......
......@@ -693,18 +693,20 @@ glade_popup_property_docs_cb (GtkMenuItem * item, GladeProperty * property)
{
GladeWidgetAdaptor *adaptor, *prop_adaptor;
GladePropertyClass *pclass;
gchar *search, *book;
GParamSpec *pspec;
gchar *search, *book;
pclass = glade_property_get_class (property);
prop_adaptor = glade_widget_adaptor_from_pclass (pclass);
adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pclass->pspec);
search = g_strdup_printf ("The %s property", pclass->id);
pspec = glade_property_class_get_pspec (pclass);
prop_adaptor = glade_property_class_get_adaptor (pclass);
adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec);
search = g_strdup_printf ("The %s property", glade_property_class_id (pclass));
g_object_get (adaptor, "book", &book, NULL);
glade_editor_search_doc_search (glade_app_get_editor (),
book,
g_type_name (pclass->pspec->owner_type), search);
g_type_name (pspec->owner_type), search);
g_free (book);
g_free (search);
......@@ -716,14 +718,16 @@ glade_popup_property_pop (GladeProperty * property, GdkEventButton * event)
GladeWidgetAdaptor *adaptor, *prop_adaptor;
GladePropertyClass *pclass;
GParamSpec *pspec;
GtkWidget *popup_menu;
gchar *book = NULL;
gint button;
gint event_time;
pclass = glade_property_get_class (property);
prop_adaptor = glade_widget_adaptor_from_pclass (pclass);
adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pclass->pspec);
pspec = glade_property_class_get_pspec (pclass);
prop_adaptor = glade_property_class_get_adaptor (pclass);
adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec);
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
......
......@@ -1194,16 +1194,18 @@ update_project_for_resource_path (GladeProject * project)
for (list = glade_widget_get_properties (widget); list; list = list->next)
{
GladePropertyClass *klass;
GParamSpec *pspec;
property = list->data;
klass = glade_property_get_class (property);
pspec = glade_property_class_get_pspec (klass);
/* XXX We should have a "resource" flag on properties that need
* to be loaded from the resource path, but that would require
* that they can serialize both ways (custom properties are only
* required to generate unique strings for value comparisons).
*/
if (klass->pspec->value_type == GDK_TYPE_PIXBUF)
if (pspec->value_type == GDK_TYPE_PIXBUF)
{
GValue *value;
gchar *string;
......@@ -1338,15 +1340,16 @@ glade_project_introspect_gtk_version (GladeProject * project)
GladeProperty *property = l->data;
GladePropertyClass *pclass = glade_property_get_class (property);
GladeWidgetAdaptor *prop_adaptor, *adaptor;
GParamSpec *pspec;
/* Unset properties ofcourse dont count... */
if (glade_property_original_default (property))
continue;
/* Check if this property originates from a GTK+ widget class */
prop_adaptor = glade_widget_adaptor_from_pclass (pclass);
adaptor =
glade_widget_adaptor_from_pspec (prop_adaptor, pclass->pspec);
pspec = glade_property_class_get_pspec (pclass);
prop_adaptor = glade_property_class_get_adaptor (pclass);
adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec);
catalog = NULL;
is_gtk_adaptor = FALSE;
......@@ -1359,8 +1362,8 @@ glade_project_introspect_gtk_version (GladeProject * project)
if (is_gtk_adaptor &&
!GPC_VERSION_CHECK (pclass, target_major, target_minor))
{
target_major = pclass->version_since_major;
target_minor = pclass->version_since_minor;
target_major = glade_property_class_since_major (pclass);
target_minor = glade_property_class_since_minor (pclass);
}
}
......@@ -2053,6 +2056,7 @@ glade_project_verify_property_internal (GladeProject * project,
GladeWidgetAdaptor *adaptor, *prop_adaptor;
GladeWidget *widget;
GladePropertyClass *pclass;
GParamSpec *pspec;
gint target_major, target_minor;
gchar *catalog, *tooltip;
......@@ -2060,12 +2064,13 @@ glade_project_verify_property_internal (GladeProject * project,
return;
pclass = glade_property_get_class (property);
prop_adaptor = glade_widget_adaptor_from_pclass (pclass);
adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pclass->pspec);
pspec = glade_property_class_get_pspec (pclass);
prop_adaptor = glade_property_class_get_adaptor (pclass);
adaptor = glade_widget_adaptor_from_pspec (prop_adaptor, pspec);
widget = glade_property_get_widget (property);
g_object_get (adaptor, "catalog", &catalog, NULL);
glade_project_target_version_for_adaptor (glade_widget_get_project (widget), adaptor,
glade_project_target_version_for_adaptor (project, adaptor,
&target_major, &target_minor);
if (!GPC_VERSION_CHECK (pclass, target_major, target_minor))
......@@ -2074,8 +2079,8 @@ glade_project_verify_property_internal (GladeProject * project,
{
tooltip = g_strdup_printf (PROP_VERSION_CONFLICT_MSGFMT,
catalog,
pclass->version_since_major,
pclass->version_since_minor,
glade_property_class_since_major (pclass),
glade_property_class_since_minor (pclass),
catalog, target_major, target_minor);
glade_property_set_support_warning (property, FALSE, tooltip);
......@@ -2083,15 +2088,15 @@ glade_project_verify_property_internal (GladeProject * project,
}
else
g_string_append_printf (string,
pclass->packing ?
glade_property_class_get_is_packing (pclass) ?
PACK_PROP_VERSION_CONFLICT_FMT :
PROP_VERSION_CONFLICT_FMT,
path_name,
pclass->name,
glade_property_class_get_name (pclass),
glade_widget_adaptor_get_title (adaptor),
catalog,
pclass->version_since_major,
pclass->version_since_minor);
glade_property_class_since_major (pclass),
glade_property_class_since_minor (pclass));
}
else if (forwidget)
glade_property_set_support_warning (property, FALSE, NULL);
......@@ -2190,7 +2195,8 @@ glade_project_verify_property (GladeProperty * property)
widget = glade_property_get_widget (property);
project = glade_widget_get_project (widget);
glade_project_verify_property_internal (project, property, NULL, NULL, TRUE);
if (project)
glade_project_verify_property_internal (project, property, NULL, NULL, TRUE);
}
void
......
This diff is collapsed.
......@@ -24,14 +24,15 @@ G_BEGIN_DECLS
*
* Checks if @gpc is good to be loaded as @type
*/
#define GLADE_PROPERTY_CLASS_IS_TYPE(gpc, type) \
(((type) == GLADE_PAGE_GENERAL && \
!(gpc)->common && !(gpc)->packing && !(gpc)->atk) || \
((type) == GLADE_PAGE_COMMON && (gpc)->common) || \
((type) == GLADE_PAGE_PACKING && (gpc)->packing) || \
((type) == GLADE_PAGE_ATK && (gpc)->atk) || \
((type) == GLADE_PAGE_QUERY && (gpc)->query))
#define GLADE_PROPERTY_CLASS_IS_TYPE(gpc, type) \
(((type) == GLADE_PAGE_GENERAL && \
!glade_property_class_common (gpc) && \
!glade_property_class_get_is_packing (gpc) && \
!glade_property_class_atk (gpc)) || \
((type) == GLADE_PAGE_COMMON && glade_property_class_common (gpc)) || \
((type) == GLADE_PAGE_PACKING && glade_property_class_get_is_packing (gpc)) || \
((type) == GLADE_PAGE_ATK && glade_property_class_atk (gpc)) || \
((type) == GLADE_PAGE_QUERY && glade_property_class_query (gpc)))
/**
* GPC_VERSION_CHECK:
......@@ -43,9 +44,9 @@ G_BEGIN_DECLS
*
*/
#define GPC_VERSION_CHECK(klass, major_version, minor_version) \
((GLADE_PROPERTY_CLASS (klass)->version_since_major == major_version) ? \
(GLADE_PROPERTY_CLASS (klass)->version_since_minor <= minor_version) : \
(GLADE_PROPERTY_CLASS (klass)->version_since_major <= major_version))
((glade_property_class_since_major (GLADE_PROPERTY_CLASS (klass)) == major_version) ? \
(glade_property_class_since_minor (GLADE_PROPERTY_CLASS (klass)) <= minor_version) : \
(glade_property_class_since_major (GLADE_PROPERTY_CLASS (klass)) <= major_version))
#define GPC_OBJECT_DELIMITER ", "
......@@ -53,155 +54,70 @@ G_BEGIN_DECLS
typedef struct _GladePropertyClass GladePropertyClass;
struct _GladePropertyClass
{
gpointer handle; /* The GladeWidgetAdaptor that this property class
* was created for.
*/
guint16 version_since_major; /* Version in which this property was */
guint16 version_since_minor; /* introduced. */
GParamSpec *pspec; /* The Parameter Specification for this property.
*/
gchar *id; /* The id of the property. Like "label" or "xpad"
* this is a non-translatable string
*/
gchar *name; /* The name of the property. Like "Label" or "X Pad"
* this is a translatable string
*/
gchar *tooltip; /* The default tooltip for the property editor rows.
*/
GValue *def; /* The default value for this property (this will exist
* as a copy of orig_def if not specified by the catalog)
*/
GValue *orig_def; /* The real default value obtained through introspection.
* (used to decide whether we should write to the
* glade file or not, or to restore the loaded property
* correctly); all property classes have and orig_def.
*/
gint visible_lines; /* When this pspec calls for a text editor, how many
* lines should be visible in the editor.
*/
guint virt : 1; /* Whether this is a virtual property with its pspec supplied
* via the catalog (or hard code-paths); or FALSE if its a real
* GObject introspected property
*/
guint optional : 1; /* Some properties are optional by nature like
* default width. It can be set or not set. A
* default property has a check box in the
* left that enables/disables the input
*/
guint optional_default : 1; /* For optional values, what the default is */
guint construct_only : 1; /* Whether this property is G_PARAM_CONSTRUCT_ONLY or not */
guint common : 1; /* Common properties go in the common tab */
guint atk : 1; /* Atk properties go in the atk tab */
guint packing : 1; /* Packing properties go in the packing tab */
guint query : 1; /* Whether we should explicitly ask the user about this property
* when instantiating a widget with this property (through a popup
* dialog).
*/
guint translatable : 1; /* The property should be translatable, which
* means that it needs extra parameters in the
* UI.
*/
/* These three are the master switches for the glade-file output,
* property editor availability & live object updates in the glade environment.
*/
guint save : 1; /* Whether we should save to the glade file or not
* (mostly just for virtual internal glade properties,
* also used for properties with generic pspecs that
* are saved in custom ways by the plugin)
*/
guint save_always : 1; /* Used to make a special case exception and always
* save this property regardless of what the default
* value is (used for some special cases like properties
* that are assigned initial values in composite widgets
* or derived widget code).
*/
guint visible : 1; /* Whether or not to show this property in the editor &
* reset dialog.
*/
guint custom_layout : 1; /* Properties marked as custom_layout will not be included
* in a base #GladeEditorTable implementation (use this
* for properties you want to layout in custom ways in
* a #GladeEditable widget
*/
guint ignore : 1; /* When true, we will not sync the object when the property
* changes, or load values from the object.
*/
guint needs_sync : 1; /* Virtual properties need to be synchronized after object
* creation, some properties that are not virtual also need
* handling from the backend, if "needs-sync" is true then
* this property will by synced with virtual properties.
*/
guint is_modified : 1; /* If true, this property_class has been "modified" from the
* the standard property by a xml file. */
guint themed_icon : 1; /* Some GParamSpecString properties reffer to icon names
* in the icon theme... these need to be specified in the
* property class definition if proper editing tools are to
* be used.
*/
guint stock_icon : 1; /* String properties can also denote stock icons, including
* icons from icon factories...
*/
guint stock : 1; /* ... or a narrower list of "items" from gtk builtin stock items.
*/
guint transfer_on_paste : 1; /* If this is a packing prop,
* wether we should transfer it on paste.
*/
guint parentless_widget : 1; /* True if this property should point to a parentless widget
* in the project
*/
gdouble weight; /* This will determine the position of this property in
* the editor.
*/
gchar *create_type; /* If this is an object property and you want the option to create
* one from the object selection dialog, then set the name of the
* concrete type here.
*/
};
GladePropertyClass *glade_property_class_new (gpointer handle);
GladePropertyClass *glade_property_class_new_from_spec (gpointer handle,
GParamSpec *spec);
GladePropertyClass *glade_property_class_new_from_spec_full (gpointer handle,
GParamSpec *spec,
gboolean need_handle);
GladePropertyClass *glade_property_class_clone (GladePropertyClass *property_class);
void glade_property_class_free (GladePropertyClass *property_class);
gboolean glade_property_class_is_visible (GladePropertyClass *property_class);
gboolean glade_property_class_is_object (GladePropertyClass *property_class);
GladePropertyClass *glade_property_class_new (GladeWidgetAdaptor *adaptor,
const gchar *id);
GladePropertyClass *glade_property_class_new_from_spec (GladeWidgetAdaptor *adaptor,
GParamSpec *spec);
GladePropertyClass *glade_property_class_new_from_spec_full (GladeWidgetAdaptor *adaptor,
GParamSpec *spec,
gboolean need_handle);
GladePropertyClass *glade_property_class_clone (GladePropertyClass *property_class,
gboolean reset_version);
void glade_property_class_free (GladePropertyClass *property_class);
void glade_property_class_set_adaptor (GladePropertyClass *property_class,
GladeWidgetAdaptor *adaptor);
GladeWidgetAdaptor *glade_property_class_get_adaptor (GladePropertyClass *property_class);
void glade_property_class_set_pspec (GladePropertyClass *property_class,
GParamSpec *pspec);
GParamSpec *glade_property_class_get_pspec (GladePropertyClass *property_class);
void glade_property_class_set_is_packing (GladePropertyClass *property_class,
gboolean is_packing);
gboolean glade_property_class_get_is_packing (GladePropertyClass *property_class);
gboolean glade_property_class_save (GladePropertyClass *property_class);
gboolean glade_property_class_save_always (GladePropertyClass *property_class);
gboolean glade_property_class_is_visible (GladePropertyClass *property_class);
gboolean glade_property_class_is_object (GladePropertyClass *property_class);
void glade_property_class_set_virtual (GladePropertyClass *property_class,
gboolean virtual);
gboolean glade_property_class_get_virtual (GladePropertyClass *property_class);
void glade_property_class_set_ignore (GladePropertyClass *property_class,
gboolean ignore);
gboolean glade_property_class_get_ignore (GladePropertyClass *property_class);
void glade_property_class_set_name (GladePropertyClass *property_class,
const gchar *name);
G_CONST_RETURN gchar *glade_property_class_get_name (GladePropertyClass *property_class);
void glade_property_class_set_tooltip (GladePropertyClass *property_class,
const gchar *tooltip);
G_CONST_RETURN gchar *glade_property_class_get_tooltip (GladePropertyClass *property_class);
G_CONST_RETURN gchar *glade_property_class_id (GladePropertyClass *property_class);
gboolean glade_property_class_themed_icon (GladePropertyClass *property_class);
void glade_property_class_set_construct_only (GladePropertyClass *property_class,
gboolean construct_only);
gboolean glade_property_class_get_construct_only (GladePropertyClass *property_class);
G_CONST_RETURN GValue *glade_property_class_get_default (GladePropertyClass *property_class);
G_CONST_RETURN GValue *glade_property_class_get_original_default (GladePropertyClass *property_class);
gboolean glade_property_class_translatable (GladePropertyClass *property_class);
gboolean glade_property_class_needs_sync (GladePropertyClass *property_class);
gboolean glade_property_class_query (GladePropertyClass *property_class);
gboolean glade_property_class_atk (GladePropertyClass *property_class);
gboolean glade_property_class_common (GladePropertyClass *property_class);
gboolean glade_property_class_parentless_widget (GladePropertyClass *property_class);
gboolean glade_property_class_optional (GladePropertyClass *property_class);
gboolean glade_property_class_optional_default (GladePropertyClass *property_class);
gboolean glade_property_class_multiline (GladePropertyClass *property_class);
gboolean glade_property_class_stock (GladePropertyClass *property_class);
gboolean glade_property_class_stock_icon (GladePropertyClass *property_class);
gboolean glade_property_class_transfer_on_paste (GladePropertyClass *property_class);
gboolean glade_property_class_custom_layout (GladePropertyClass *property_class);
gdouble glade_property_class_weight (GladePropertyClass *property_class);
G_CONST_RETURN gchar *glade_property_class_create_type (GladePropertyClass *property_class);
guint16 glade_property_class_since_major (GladePropertyClass *property_class);
guint16 glade_property_class_since_minor (GladePropertyClass *property_class);
GValue *glade_property_class_make_gvalue_from_string (GladePropertyClass *property_class,
const gchar *string,
......@@ -245,6 +161,10 @@ gint glade_property_class_compare (GladePropertyC
GValue *glade_property_class_get_default_from_spec (GParamSpec *spec);
void glade_property_class_set_weights (GList **properties, GType parent);
void glade_property_class_load_defaults_from_spec (GladePropertyClass *property_class);
G_END_DECLS
#endif /* __GLADE_PROPERTY_CLASS_H__ */
......@@ -156,9 +156,9 @@ glade_property_dup_impl (GladeProperty * template_prop, GladeWidget * widget)
g_value_init (property->priv->value, template_prop->priv->value->g_type);
/* Cannot duplicate parentless_widget property */
if (template_prop->priv->klass->parentless_widget)
if (glade_property_class_parentless_widget (template_prop->priv->klass))
{
if (!G_IS_PARAM_SPEC_OBJECT (template_prop->priv->klass->pspec))
if (!G_IS_PARAM_SPEC_OBJECT (glade_property_class_get_pspec (template_prop->priv->klass)))
g_warning ("Parentless widget property should be of object type");
g_value_set_object (property->priv->value, NULL);
......@@ -193,7 +193,7 @@ glade_property_update_prop_refs (GladeProperty * property,
GObject *old_object, *new_object;
GList *old_list, *new_list, *list, *removed, *added;
if (GLADE_IS_PARAM_SPEC_OBJECTS (property->priv->klass->pspec))
if (GLADE_IS_PARAM_SPEC_OBJECTS (glade_property_class_get_pspec (property->priv->klass)))
{
/* Make our own copies incase we're walking an
* unstable list
......@@ -252,16 +252,17 @@ glade_property_verify (GladeProperty * property, const GValue * value)
parent = glade_widget_get_parent (property->priv->widget);
if (property->priv->klass->packing && parent)
if (glade_property_class_get_is_packing (property->priv->klass) && parent)
ret =
glade_widget_adaptor_child_verify_property (glade_widget_get_adaptor (parent),
glade_widget_get_object (parent),
glade_widget_get_object (property->priv->widget),
property->priv->klass->id, value);
else if (!property->priv->klass->packing)
glade_property_class_id (property->priv->klass),
value);
else if (!glade_property_class_get_is_packing (property->priv->klass))
ret = glade_widget_adaptor_verify_property (glade_widget_get_adaptor (property->priv->widget),
glade_widget_get_object (property->priv->widget),
property->priv->klass->id, value);
glade_property_class_id (property->priv->klass), value);
return ret;
}
......@@ -316,7 +317,7 @@ glade_property_set_value_impl (GladeProperty * property, const GValue * value)
(G_VALUE_TYPE (property->priv->value), G_VALUE_TYPE (value)))
{
g_warning ("Trying to assign an incompatible value to property %s\n",
property->priv->klass->id);
glade_property_class_id (property->priv->klass));
return FALSE;
}
......@@ -373,7 +374,11 @@ glade_property_set_value_impl (GladeProperty * property, const GValue * value)
static void
glade_property_get_value_impl (GladeProperty * property, GValue * value)
{
g_value_init (value, property->priv->klass->pspec->value_type);
GParamSpec *pspec;
pspec = glade_property_class_get_pspec (property->priv->klass);
g_value_init (value, pspec->value_type);
g_value_copy (property->priv->value, value);
}
......@@ -389,7 +394,7 @@ glade_property_sync_impl (GladeProperty * property)
/* optional properties that are disabled */
property->priv->enabled == FALSE ||
/* explicit "never sync" flag */
property->priv->klass->ignore ||
glade_property_class_get_ignore (property->priv->klass) ||
/* recursion guards */
property->priv->syncing >= property->priv->sync_tolerance ||
/* No widget owns this property yet */
......@@ -399,9 +404,11 @@ glade_property_sync_impl (GladeProperty * property)
/* Only the properties from widget->properties should affect the runtime widget.
* (other properties may be used for convenience in the plugin).
*/
if ((property->priv->klass->packing &&
!glade_widget_get_pack_property (property->priv->widget, property->priv->klass->id))
|| !glade_widget_get_property (property->priv->widget, property->priv->klass->id))
if ((glade_property_class_get_is_packing (property->priv->klass) &&
!glade_widget_get_pack_property (property->priv->widget,
glade_property_class_id (property->priv->klass)))
|| !glade_widget_get_property (property->priv->widget,
glade_property_class_id (property->priv->klass)))
return;
property->priv->syncing++;
......@@ -409,28 +416,31 @@ glade_property_sync_impl (GladeProperty * property)
/* In the case of construct_only, the widget instance must be rebuilt
* to apply the property