glade3 r2073 - in trunk: . gladeui
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r2073 - in trunk: . gladeui
- Date: Mon, 29 Dec 2008 18:14:35 +0000 (UTC)
Author: tvb
Date: Mon Dec 29 18:14:35 2008
New Revision: 2073
URL: http://svn.gnome.org/viewvc/glade3?rev=2073&view=rev
Log:
* gladeui/glade-widget-adator.c, gladeui/glade-property-class.[ch]:
Converted pclass booleans to bitfields, now disabled property classes
are kept around so that we dont screw up inheritance.
* gladeui/glade-catalog.[ch]: Fixed version types to guint16.
Modified:
trunk/ChangeLog
trunk/gladeui/glade-catalog.c
trunk/gladeui/glade-catalog.h
trunk/gladeui/glade-property-class.c
trunk/gladeui/glade-property-class.h
trunk/gladeui/glade-widget-adaptor.c
Modified: trunk/gladeui/glade-catalog.c
==============================================================================
--- trunk/gladeui/glade-catalog.c (original)
+++ trunk/gladeui/glade-catalog.c Mon Dec 29 18:14:35 2008
@@ -35,8 +35,8 @@
struct _GladeCatalog
{
- gint major_version; /* The catalog version */
- gint minor_version;
+ guint16 major_version; /* The catalog version */
+ guint16 minor_version;
GList *targetable_versions; /* list of suitable version targets */
@@ -622,7 +622,7 @@
}
-gint
+guint16
glade_catalog_get_major_version (GladeCatalog *catalog)
{
g_return_val_if_fail (GLADE_IS_CATALOG (catalog), 0);
@@ -630,7 +630,7 @@
return catalog->major_version;
}
-gint
+guint16
glade_catalog_get_minor_version (GladeCatalog *catalog)
{
g_return_val_if_fail (GLADE_IS_CATALOG (catalog), 0);
Modified: trunk/gladeui/glade-catalog.h
==============================================================================
--- trunk/gladeui/glade-catalog.h (original)
+++ trunk/gladeui/glade-catalog.h Mon Dec 29 18:14:35 2008
@@ -79,8 +79,8 @@
GList *glade_catalog_get_targets (GladeCatalog *catalog);
-gint glade_catalog_get_major_version (GladeCatalog *catalog);
-gint glade_catalog_get_minor_version (GladeCatalog *catalog);
+guint16 glade_catalog_get_major_version (GladeCatalog *catalog);
+guint16 glade_catalog_get_minor_version (GladeCatalog *catalog);
GList *glade_catalog_get_widget_groups (GladeCatalog *catalog);
Modified: trunk/gladeui/glade-property-class.c
==============================================================================
--- trunk/gladeui/glade-property-class.c (original)
+++ trunk/gladeui/glade-property-class.c Mon Dec 29 18:14:35 2008
@@ -1456,16 +1456,14 @@
if (!buf)
return FALSE;
g_free (buf);
-
- /* If Disabled="TRUE" we set *property_class to NULL, but we return TRUE.
- * The caller may want to remove this property from its list.
- */
if (glade_xml_get_property_boolean (node, GLADE_TAG_DISABLED, FALSE))
{
- glade_property_class_free (klass);
- *property_class = NULL;
- return TRUE;
+ /* Its easier for us to keep disabled properties around and
+ * only virtually disable them */
+ klass->ignore = TRUE;
+ klass->save = FALSE;
+ klass->visible = FALSE;
}
if ((spec_node = glade_xml_search_child (node, GLADE_TAG_SPECIFICATIONS)) != NULL)
@@ -1515,8 +1513,7 @@
{
/* If catalog file didn't specify a pspec function
* and this property isn't found by introspection
- * we simply handle it as a property that has been
- * disabled.
+ * we simply delete it from the list always.
*/
glade_property_class_free (klass);
*property_class = NULL;
Modified: trunk/gladeui/glade-property-class.h
==============================================================================
--- trunk/gladeui/glade-property-class.h (original)
+++ trunk/gladeui/glade-property-class.h Mon Dec 29 18:14:35 2008
@@ -46,17 +46,12 @@
* was created for.
*/
-
guint16 version_since_major; /* Version in which this property was */
guint16 version_since_minor; /* introduced. */
guint16 builder_since_major; /* Version in which this property became */
guint16 builder_since_minor; /* available in GtkBuilder format */
- /* For catalogs that support libglade: */
- gboolean libglade_only; /* Mark special libglade virtual properties */
- gboolean libglade_unsupported;/* Mark properties that are not available in libglade */
-
GParamSpec *pspec; /* The Parameter Specification for this property.
*/
@@ -71,11 +66,6 @@
gchar *tooltip; /* The default tooltip for the property editor rows.
*/
- gboolean virt; /* 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
- */
-
GValue *def; /* The default value for this property (this will exist
* as a copy of orig_def if not specified by the catalog)
*/
@@ -94,95 +84,103 @@
* to be of possible use in plugin code.
*/
+ gint visible_lines; /* When this pspec calls for a text editor, how many
+ * lines should be visible in the editor.
+ */
- gboolean optional; /* 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
- */
+ /* For catalogs that support libglade: */
+ guint libglade_only : 1; /* Mark special libglade virtual properties */
+ guint libglade_unsupported : 1;/* Mark properties that are not available in libglade */
- gboolean optional_default; /* For optional values, what the default is */
+ 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
+ */
- gboolean construct_only; /* Whether this property is G_PARAM_CONSTRUCT_ONLY or not */
+ 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 */
- gboolean common; /* Common properties go in the common tab */
- gboolean atk; /* Atk properties go in the atk tab */
- gboolean packing; /* Packing properties go in the packing tab */
- gboolean query; /* Whether we should explicitly ask the user about this property
- * when instantiating a widget with this property (through a popup
- * dialog).
- */
+ 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).
+ */
- gboolean translatable; /* The property should be translatable, which
- * means that it needs extra parameters in the
- * UI.
+ 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.
+ */
- gint visible_lines; /* When this pspec calls for a text editor, how many
- * lines should be visible in the editor.
+ 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.
*/
- /* These three are the master switches for the glade-file output,
- * property editor availability & live object updates in the glade environment.
- */
- gboolean save; /* 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)
- */
- gboolean save_always; /* 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 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.
*/
- gboolean visible; /* Whether or not to show this property in the editor &
- * reset dialog.
- */
- gboolean custom_layout; /* 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 is_modified : 1; /* If true, this property_class has been "modified" from the
+ * the standard property by a xml file. */
- gboolean ignore; /* When true, we will not sync the object when the property
- * changes, or load values from the object.
- */
-
- gboolean needs_sync; /* 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 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...
*/
-
- gboolean is_modified; /* If true, this property_class has been "modified" from the
- * the standard property by a xml file. */
-
- gboolean themed_icon; /* 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 : 1; /* ... or a narrower list of "items" from gtk builtin stock items.
*/
- gboolean stock_icon; /* String properties can also denote stock icons, including
- * icons from icon factories...
- */
- gboolean stock; /* ... or a narrower list of "items" from gtk builtin stock items.
- */
- gboolean transfer_on_paste; /* If this is a packing prop,
- * wether we should transfer it on paste.
- */
+ 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.
*/
- gboolean parentless_widget; /* True if this property should point to a parentless widget
- * in the project
- */
-
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.
Modified: trunk/gladeui/glade-widget-adaptor.c
==============================================================================
--- trunk/gladeui/glade-widget-adaptor.c (original)
+++ trunk/gladeui/glade-widget-adaptor.c Mon Dec 29 18:14:35 2008
@@ -415,40 +415,17 @@
for (i = 0; i < n_specs; i++)
{
- GType class_type;
- gboolean found;
-
- /* Only create properties that dont exist on the adaptor yet */
- for (found = FALSE, class_type = adaptor->type;
- ((!parent_adaptor && class_type != 0) ||
- ( parent_adaptor && class_type != parent_adaptor->type));
- class_type = g_type_parent (class_type))
- if (specs[i]->owner_type == class_type ||
- (G_TYPE_IS_INTERFACE (specs[i]->owner_type) &&
- glade_util_class_implements_interface (class_type, specs[i]->owner_type)))
- {
- found = TRUE;
- break;
- }
-
- if (found &&
- (property_class =
- glade_property_class_new_from_spec (adaptor, specs[i])) != NULL)
- list = g_list_prepend (list, property_class);
-
-
-
-/* if (parent_adaptor == NULL || */
-/* /\* Dont create it if the pspec owner is not us. *\/ */
-/* (!is_packing && !glade_widget_adaptor_get_property_class (parent_adaptor, */
-/* specs[i]->name)) || */
-/* (is_packing && !glade_widget_adaptor_get_pack_property_class (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 (parent_adaptor == NULL ||
+ /* Dont create it if it already exists */
+ (!is_packing && !glade_widget_adaptor_get_property_class (parent_adaptor,
+ specs[i]->name)) ||
+ (is_packing && !glade_widget_adaptor_get_pack_property_class (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 (is_packing)
@@ -1845,7 +1822,7 @@
continue;
}
- /* the property has Disabled=TRUE ... */
+ /* if this pointer was set to null, its a property we dont handle. */
if (!property_class)
*properties = g_list_delete_link (*properties, list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]