PageRenderTime 37ms CodeModel.GetById 19ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gobject/library/g_object.e

http://github.com/tybor/Liberty
Specman e | 1598 lines | 451 code | 345 blank | 802 comment | 8 complexity | f6f99415bd86c242bcabeb25591b9264 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1indexing
   2	description: "The base object type of gobject library"
   3	long:  "[
   4				Currently the only wrapped features are those explicitly necessary to
   5				wrap GTK+ 2.x GObject is the fundamental type providing the common
   6				attributes and methods for all object types in GTK+, Pango and other
   7				libraries based on GObject. The GObject class provides methods for
   8				object construction and destruction, property access methods, and signal
   9				support. Signals are described in detail in Signals(3).
  10			]"
  11	copyright: "(C) 2005 Paolo Redaelli "
  12	license: "LGPL v2 or later"
  13
  14deferred class G_OBJECT
  15	-- GObject is the fundamental type providing the common attributes
  16	-- and methods for all object types in GTK+, Pango and other
  17	-- libraries based on GObject. The GObject class provides methods
  18	-- for object construction and destruction, property access
  19	-- methods, and signal support. 
  20
  21	-- TODO: provide Eiffellied descriptio for signals.
  22
  23	-- The initial reference a GObject is created with is flagged as a
  24	-- floating reference. This means that it is not specifically
  25	-- claimed to be "owned" by any code portion. The main motivation
  26	-- for providing floating references is C convenience. In
  27	-- particular, it allowes code to be written as:
  28
  29	-- TODO: Eiffelize Example 1.
  30
  31	--    container = create_container();
  32	--    container_add_child (container, create_child());
  33
  34	-- If container_add_child() will g_object_ref_sink() the
  35	-- passed in child, no reference of the newly created child
  36	-- is leaked. Without floating references,
  37	-- container_add_child() can only g_object_ref() the new
  38	-- child, so to implement this code without reference leaks,
  39	-- it would have to be written as:
  40
  41	-- TODO: Eiffelize Example 2.
  42
  43	--    Child *child;
  44	--    container = create_container();
  45	--    child = create_child();
  46	--    container_add_child (container, child);
  47	--    g_object_unref (child);
  48
  49	-- The floating reference can be converted into an ordinary
  50	-- reference by calling g_object_ref_sink(). For already
  51	-- sunken objects (objects that don't have a floating
  52	-- reference anymore), g_object_ref_sink() is equivalent to
  53	-- g_object_ref() and returns a new reference. Since floating
  54	-- references are useful allmost exclusively for C
  55	-- convenience, language bindings that provide automated
  56	-- reference and memory ownership maintenance (such as smart
  57	-- pointers or garbage collection) therefore don't need to
  58	-- expose floating references in their API.
  59
  60	-- Some object implementations may need to save an objects
  61	-- floating state across certain code portions (an example is
  62	-- GtkMenu), to achive this, the following sequence can be
  63	-- used:
  64
  65	-- Example 3.
  66
  67	-- /* save floating state */
  68	-- gboolean was_floating = g_object_is_floating (object);
  69	-- g_object_ref_sink (object);
  70	-- /* protected code portion */
  71	-- ...;
  72	-- /* restore floating state */
  73	-- if (was_floating)
  74	--   g_object_force_floating (object);
  75	-- g_obejct_unref (object); /* release previously acquired reference */
  76
  77inherit
  78   C_STRUCT
  79      redefine
  80         from_external_pointer
  81      end
  82   
  83	REFERENCE_COUNTED
  84		redefine
  85			dispose
  86		end
  87
  88insert
  89	GLIB_MEMORY_ALLOCATION export {} all end
  90	GOBJECT_EXTERNALS
  91	GVALUE_EXTERNALS
  92	SHARED_EIFFEL_KEY
  93	G_SIGNALS
  94
  95	-- Features inserted to implement smart_get_property and smart_set_property
  96	G_PARAM_SPEC_EXTERNALS export {} all end
  97	G_TYPE_EXTERNALS
  98
  99	POINTER_HANDLING -- to get `address_of' and `content_of'
 100
 101feature
 102
 103	store_eiffel_wrapper is
 104			-- Store a pointer to Current into the underlying
 105			-- gobject. This pointer will be used to retrieve the Eiffel
 106			-- wrapper object when a C feature returns a generic object
 107			-- (i.e. the preview widget set in GTK_FILE_CHOOSER). 
 108			
 109			-- It also take care of storing an hidden pointer to the 
 110			-- underlying GobjectClass
 111		require not_stored: not is_eiffel_wrapper_stored
 112		do
 113			g_object_set_qdata (handle, eiffel_key.quark, to_pointer)
 114			-- g_object_set_qdata is called directly to avoid an
 115			-- invariant check when passing Current as argument. Using
 116			-- the Eiffel method "set_qdata (eiffel_key, Current)" easily
 117			-- trigger a "fake" invariant violation.
 118
 119			-- Precursor -- To allow usage of the wrapped object with C
 120			-- data structures that are not aware of the specificities of
 121			-- G_OBJECT.
 122
 123			-- Note: it is necessary to call Precursor AFTER having
 124			-- called g_object_set_qdata. Since we have re-defined the
 125			-- feature `is_eiffel_wrapper_stored' that appears into a
 126			-- postcondition to use `has_qdata', we must satisfy that 
 127			-- postcondition before calling Precursor.
 128		ensure 
 129			stored: is_eiffel_wrapper_stored
 130			main_wrapper: is_main_wrapper
 131		end
 132
 133	unstore_eiffel_wrapper is
 134			-- Remove the pointer to Current stored into the underlying
 135			-- gobject. Note: a precondition like "require stored:
 136			-- is_eiffel_wrapper_stored" is not necessary; an unnecessary
 137			-- call to this feature should not be harmful
 138		require is_main_wrapper
 139		do
 140			--Precursor
 141			g_object_set_qdata (handle, eiffel_key.quark, default_pointer)
 142		ensure not_stored: not is_eiffel_wrapper_stored
 143		end
 144
 145	is_eiffel_wrapper_stored: BOOLEAN is
 146			-- Has a pointer to the Current Eiffel wrapper been stored
 147			-- into the underlying GObject's qdata property with the
 148			-- GQuark `eiffel_key' (which is currently "eiffel-wrapper")?
 149		do
 150			Result := has_qdata (eiffel_key)
 151		end
 152
 153	is_main_wrapper: BOOLEAN is
 154			-- Is Current the wrapper G_OBJECT linked from the underlying
 155			-- GObject?
 156		do
 157			Result := g_object_get_qdata(handle,eiffel_key.quark)=to_pointer
 158		end
 159
 160feature {WRAPPER} -- GObject type system implementation.
 161
 162	type: like g_type is
 163		do
 164			Result := g_object_type (handle)
 165		end
 166
 167	type_name: STRING is
 168		do
 169			create {CONST_STRING} Result.from_external (g_object_type_name (handle))
 170		end
 171
 172feature {WRAPPER, WRAPPER_HANDLER} -- Object creation
 173	-- There are several low-level features used to create an effective heir of G_OBJECT. 
 174
 175	-- main_wrapper_from is used to create long-lived wrappers that will be
 176	-- used extensively, stored into collections; those Eiffel wrapper are the
 177	-- one that will be returned by a G_OBJECT_FACTORY when asked for a GObject
 178	-- that have already been wrapped. 
 179	
 180	-- transient, short-lived wrapper could be created with secondary_wrapper_from.
 181
 182	-- When you do not know if the Gobject you're wrapping has already been
 183	-- wrapped you can either use secondary_wrapper or from_external_pointer.
 184	-- from_external_pointer will check if there is already a wrapper for the
 185	-- wrappee GObject. If it is not the case the G_OBJECT being created
 186	-- becomes the main wrapper.
 187
 188	main_wrapper_from (an_external_pointer: POINTER) is
 189			-- Create a "main" wrapper from `an_external_pointer'. A
 190			-- "main" wrapper is the Eiffel object linked to in the
 191			-- underlying Gobject, whose reference is stored in a qdata
 192			-- property with the `eiffel_key' Gquark key.
 193
 194			-- "main" wrappers are used when the object will be used for a long
 195			-- time, for example in collections
 196		require
 197			called_on_creation: is_null
 198			not_null_pointer: an_external_pointer.is_not_null
 199			no_other_wrappers_exists: not (create {G_OBJECT_EXPANDED_FACTORY [like Current]}).has_eiffel_wrapper_stored (an_external_pointer)
 200		do
 201			handle := an_external_pointer
 202			ref
 203			store_eiffel_wrapper
 204		end
 205
 206	unreffed_main_wrapper_from (an_external_pointer: POINTER) is
 207			-- Create a "main" wrapper from `an_external_pointer'. The
 208			-- underlying GObject is not ref-fed; it is useful when a
 209			-- particular C function returns an already referenced
 210			-- pointer.
 211		require
 212			called_on_creation: is_null
 213			pointer_not_null: an_external_pointer.is_not_null
 214			no_other_wrappers_exists: not (create {G_OBJECT_EXPANDED_FACTORY [like Current]}).has_eiffel_wrapper_stored (an_external_pointer)
 215		do
 216			handle := an_external_pointer
 217			store_eiffel_wrapper
 218		end
 219
 220	secondary_wrapper_from (an_external_pointer: POINTER) is
 221			-- Create a non-main wrapper from `an_external_pointer'.
 222		require
 223			called_on_creation: is_null
 224			pointer_not_null: an_external_pointer.is_not_null
 225		do
 226			handle := an_external_pointer
 227			ref
 228		ensure
 229			is_secondary_wrapper: not is_main_wrapper
 230		end
 231
 232 
 233	from_external_pointer (a_ptr: POINTER) is
 234		require
 235			called_on_creation: is_null
 236			pointer_not_null: a_ptr.is_not_null
 237			-- not_existing_wrapper: not (create {G_OBJECT_FACTORY[like Current]}).has_eiffel_wrapper_stored (a_ptr)
 238		do
 239			Precursor (a_ptr)
 240			if not is_eiffel_wrapper_stored then store_eiffel_wrapper end
 241			ref -- add a reference to the underlying g_object
 242		end
 243
 244	from_external_pointer_no_ref (a_ptr: POINTER) is
 245			-- create a new wrapper for a GObject, without ref-ing it.
 246			-- This is useful when some C function returns an already
 247			-- reffed pointer to a Gobject. In this case the Eiffel
 248			-- wrapper must not call ref at creation time, just unref at 
 249			-- dispose time.
 250		require
 251			called_on_creation: is_null
 252			pointer_not_null: a_ptr.is_not_null
 253			-- not_existing_wrapper: not (create {G_OBJECT_EXPANDED_FACTORY [like Current]}).has_eiffel_wrapper_stored (a_ptr)
 254		do
 255			handle := a_ptr
 256			if not is_eiffel_wrapper_stored then store_eiffel_wrapper end
 257		end
 258
 259feature -- Disposing
 260
 261	dispose is
 262			-- Dispose the g_object, calling unref and setting its handle to default_pointer.
 263		
 264			-- TODO: once the iusse explained in the debug tense in the implementation is 
 265			-- solved put a "require is_a_gobject: g_is_object (handle)" precondition
 266		do
 267			-- Note: when Eiffel disposes a G_OBJECT it just unrefs it and
 268			-- cleans its handle. The actual reclaiming of the memory
 269			-- allocated on the C side is left to the gobject runtime.
 270			check is_g_object end 
 271			if is_main_wrapper then 
 272				debug
 273					std_error.put_line("G_OBJECT.dispose: disposing the main wrapper of a "+type_name)
 274				end
 275				unstore_eiffel_wrapper
 276			else
 277				debug
 278					std_error.put_line("G_OBJECT.dispose: not disposing "+to_pointer.out+" not a main wrapper of a "+type_name)
 279				end
 280			end
 281			debug print(once "Unreffing a "+generating_type+"%N") end
 282			unref
 283			-- There are some shared G_OBJECTS that we shouldn't unref.
 284			-- Check for example pango_cairo_font_map_get_default
 285			handle := default_pointer
 286		end
 287
 288feature {} -- Disposing helper
 289	is_g_object: BOOLEAN is
 290			-- Is current handle a pointer to a g_object?
 291		do
 292			Result := (g_is_object (handle) /= 0)
 293		end
 294
 295feature -- Reference count
 296
 297	ref is
 298			-- Increases the reference count of object.
 299		local ptr: POINTER
 300		do
 301			ptr := g_object_ref (handle)
 302				check
 303					ptr_equals_handle: ptr = handle
 304				end
 305		end
 306
 307	unref is
 308			-- Decreases the reference count if object. When its reference count
 309			-- drops to 0, the object is finalized (i.e. its memory is freed).
 310		do
 311			g_object_unref (handle)
 312		end
 313
 314feature -- Data storing and retrieving
 315
 316	get_data (a_key: STRING): ANY is
 317			-- Gets a named field from the objects table of associations (see
 318			-- set_data).  `a_key': name of the key for that association; Void if no
 319			-- `a_key' field is present
 320		require valid_key: a_key /= Void
 321		local ptr: POINTER
 322		do
 323			-- Note: wrappers that needs to store C pointers and do other low-level
 324			-- stuff are invited to use g_object_get_data directly
 325			-- Note: Perhaps it is better to use GQuarks and g_object_get_qdata
 326			ptr := g_object_get_data (handle, a_key.to_external)
 327			if ptr.is_not_null then Result:=ptr.to_any end
 328		end
 329
 330	set_data (a_key: STRING; data: ANY) is
 331			-- Store a reference to `data' under the name `a_key'. Each object
 332			-- carries around a table of associations from strings to pointers. If
 333			-- the object already had an association with that name, the old
 334			-- association will be destroyed.
 335			
 336			-- a_key : 	name of the key
 337			-- data : 	data to associate with that key
 338		require
 339			valid_key: a_key /= Void
 340		do
 341			-- Note: a_key is not duplicated since g_object_set_data requires a const
 342			-- gchar *;
 343			g_object_set_data (handle,a_key.to_external, data.to_pointer)
 344		end
 345
 346	steal_data (a_key: STRING): ANY is
 347			-- Remove a specified datum from the object's data associations, --
 348			-- without invoking the association's destroy handler. Void if there's
 349			-- no data with `a_key'
 350		require valid_key: a_key /= Void
 351		local ptr: POINTER
 352		do
 353			ptr := g_object_steal_data (handle, a_key.to_external)
 354			if ptr.is_not_null then Result:=ptr.to_any end
 355		end
 356
 357feature -- Quark-based data storing and retrieving
 358
 359	has_qdata (a_key: G_QUARK): BOOLEAN is
 360			-- Is `a_key' field present in table of associations (see
 361			-- set_qdata)? `a_key': a GQuark, naming the user data
 362			-- pointer
 363		do
 364			Result := (g_object_get_qdata (handle, a_key.quark).is_not_null)
 365		end
 366
 367	get_qdata (a_key: G_QUARK): ANY is
 368			-- Gets a named field from the objects table of associations
 369			-- (see set_data). `a_key': a GQuark, naming the user data
 370			-- pointer; Void if no `a_key' field is present
 371		local ptr: POINTER
 372		do
 373			ptr := g_object_get_qdata (handle, a_key.quark)
 374			if ptr.is_not_null then Result:=ptr.to_any end
 375		end
 376
 377	set_qdata (a_key: G_QUARK; data: ANY) is
 378			-- Store a reference to `data' under the GQuark `a_key'. Each
 379			-- object carries around a table of associations from strings
 380			-- to pointers. If the object already had an association with
 381			-- that name, the old association will be destroyed.
 382
 383			-- a_key : 	name of the key
 384			-- data : 	data to associate with that key
 385		do
 386			g_object_set_qdata (handle,a_key.quark, data.to_pointer)
 387		end
 388
 389feature -- Properties notifying
 390
 391	notify (a_property_name: STRING) is
 392		-- Emits a "notify" signal for the property `a_property_name' on
 393		-- object.
 394		do
 395			g_object_notify (handle, a_property_name.to_external)
 396		end
 397
 398	freeze_notify is
 399			-- Stops emission of "notify" signals on object. The signals are queued
 400			-- until thaw_notify is called on object.  This is necessary for
 401			-- accessors that modify multiple properties to prevent premature
 402			-- notification while the object is still being modified.
 403		do
 404			g_object_freeze_notify (handle)
 405		end
 406
 407	thaw_notify is
 408			-- Causes all queued "notify" signals on object to be
 409			-- emitted. Reverts the effect of a previous call to
 410			-- freeze_notify.
 411		do
 412			g_object_thaw_notify (handle)
 413		end
 414
 415feature -- Properties query
 416
 417	find_property (a_property_name: STRING): G_PARAM_SPEC is
 418			-- Find the parameter's spec for `a_property_name'. Void if
 419			-- the class doesn't have a property of that name.
 420		require valid_name: a_property_name /= Void
 421		local
 422			param_spec_ptr: POINTER
 423		do
 424			param_spec_ptr:=g_object_class_find_property (g_object_get_class(handle),a_property_name.to_external)
 425			if param_spec_ptr.is_not_null then
 426				create Result.from_external_pointer (param_spec_ptr)
 427			end
 428		end
 429
 430	has_property (a_property_name: STRING): BOOLEAN is
 431			-- Does Current has a property named `a_property_name'?
 432		require valid_name: a_property_name /= Void
 433		do
 434			Result:= (g_object_class_find_property
 435						 (g_object_get_class(handle),a_property_name.to_external).is_not_null)
 436		end
 437
 438	properties: COLLECTION[G_PARAM_SPEC] is
 439			-- The properties of the G_OBJECT
 440		local 
 441			a_length, another_length: INTEGER; 
 442			c_array_ptr: POINTER;
 443			another: C_ARRAY[G_PARAM_SPEC]
 444		do
 445			not_yet_implemented
 446			-- if hidden_properties=Void then
 447			-- 	create {C_ARRAY[G_PARAM_SPEC]} 
 448			-- 	hidden_properties.from_external_array
 449			-- 	(g_object_class_list_properties(g_object_get_class(handle), $a_length),
 450			-- 	 a_length, g_param_spec_factory)
 451			-- end
 452			-- Result:=hidden_properties
 453			-- debug
 454			-- 	create another.from_external_array
 455			-- 	(g_object_class_list_properties(g_object_get_class(handle), $another_length),
 456			-- 	 another_length, g_param_spec_factory)
 457			-- 	check -- the assumption that list properties is "stable" over time.
 458			-- 		-- Using a cached, hidden properties collection requires 
 459			-- 		-- that the actual properties are the same. Having a 
 460			-- 		-- caching factory allows to use same_items of the 
 461			-- 		-- result, after having created another copy of.
 462			-- 		Result.same_items(another)
 463			-- 	end
 464			-- end
 465		end
 466
 467feature -- Property getter/setter
 468
 469	set_properties (some_properties: COLLECTION [TUPLE[STRING,G_VALUE]]) is
 470		require
 471			no_void_property_names: --TODO
 472			no_void_property_values: --TODO
 473		local iter: ITERATOR [TUPLE[STRING,G_VALUE]]
 474		do
 475			freeze_notify
 476			iter := some_properties.get_new_iterator
 477			from iter.start until iter.is_off
 478			loop
 479				-- Note: The original C implementation of this feature
 480				-- retrieve the G_PARAM_SPEC linked to each property and
 481				-- then checks:
 482				
 483				-- * if theres a property with that name
 484				-- * it the property is writable
 485				-- * if the property is settable only at creation time
 486				
 487				-- I'm not sure that an Eiffel implementation should 
 488				-- implement this, because it should be already checked 
 489				-- by Gobject. Paolo 2006-07-06
 490				check
 491					name_not_void: iter.item.item_1 /= Void
 492					value_not_void: iter.item.item_2 /= Void
 493				end
 494				set_property (iter.item.item_1, iter.item.item_2)
 495				iter.next
 496			end
 497		end
 498
 499	smart_set_property (a_parameter_specification: G_PARAM_SPEC; a_value: G_VALUE) is
 500			-- Sets the property specified by 
 501			-- `a_parameter_specification' on Current object to 
 502			-- `a_value'.
 503			
 504			-- Smart Eiffel-specific reimplementation of the original
 505			-- GObject feature. All the logic and checks related to
 506			-- correctness is handled throught static typing and
 507			-- preconditions.
 508		require
 509			parameter_specification_not_void: a_parameter_specification /= Void
 510			has_property:  has_property(a_parameter_specification.name)
 511			is_writable: a_parameter_specification.is_writable
 512			not_at_construction_time_only: not (a_parameter_specification.is_set_only_at_construction)
 513			value_not_void: a_value /= Void
 514			correct_value_type: a_parameter_specification.validate(a_value) or
 515									  True -- It is convertible
 516			not_redirected: -- TODO not find_property(a_property_name).is_redirected
 517		-- local redirect: POINTER
 518		do
 519			-- Note: here we work directly with pointers to the C data
 520			-- structure, to avoid yet another layer of
 521			-- abstraction/reindirection and its performance loss. We are
 522			-- seeking performance and we assume to be enabled to fiddle
 523			-- with low-level details.
 524
 525			-- Note: The original C implementation uses this (private)
 526			-- data structure; code dealing with it is left here
 527			-- commented for later inspection: GObjectNotifyQueue
 528			-- *nqueue;
 529			
 530			
 531			-- NOTE: avoiding ref, since we already has a reference
 532
 533			-- nqueue = g_object_notify_queue_freeze (object,
 534			-- &property_notify_context);
 535			freeze_notify
 536			-- redirect := g_param_spec_get_redirect_target (pspec)
 537			-- if redirect.is_not_null then pspec := redirect end 
 538
 539			--   /* provide a copy to work from, convert (if necessary) and validate */
 540			--   g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
 541			--   if (!g_value_transform (value, &tmp_value))
 542			--     g_warning ("unable to set property `%s' of type `%s' from value of type `%s'",
 543			-- 	       pspec->name,
 544			-- 	       g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
 545			-- 	       G_VALUE_TYPE_NAME (value));
 546			--   else if (g_param_value_validate (pspec, &tmp_value) && !(pspec->flags & G_PARAM_LAX_VALIDATION))
 547			--     {
 548			--       gchar *contents = g_strdup_value_contents (value);
 549
 550			--       g_warning ("value \"%s\" of type `%s' is invalid or out of range for property `%s' of type `%s'",
 551			-- 		 contents,
 552			-- 		 G_VALUE_TYPE_NAME (value),
 553			-- 		 pspec->name,
 554			-- 		 g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
 555			--       g_free (contents);
 556			--     }
 557			--   else
 558			--     {
 559
 560			-- The following code calls the underlying C "virtual" call;
 561			-- it mimicks "class->set_property (object, param_id,
 562			-- &tmp_value, pspec);"
 563			invoke_set_property (a_parameter_specification.owner_class,
 564										handle,
 565										a_parameter_specification.param_id, a_value.handle,
 566										a_parameter_specification.handle)
 567			-- g_object_notify_queue_add (object, nqueue, pspec);
 568			-- g_object_notify_queue_thaw (object, nqueue);
 569			-- NOTE: avoiding unref, since we didn't acquire any above			
 570			thaw_notify
 571		ensure
 572			value_set: -- a_value.is_equal (get_property(a_property_name))
 573		end
 574
 575	set_property (a_property_name: STRING; a_value: G_VALUE) is
 576			-- Sets `a_property_name' property on Current object to 
 577			-- `a_value'. This feature uses the underlying C 
 578			-- implementation which is slower, since it always makes 
 579			-- many checks.
 580		require
 581			valid_name: a_property_name /= Void
 582			has_property: has_property (a_property_name)
 583			is_writable: find_property (a_property_name).is_writable
 584			valid_value: a_value /= Void
 585			correct_value_type: a_value.is_a (find_property (a_property_name).value_gtype)
 586		do
 587			g_object_set_property (handle, a_property_name.to_external, a_value.handle)
 588		ensure
 589			value_set: -- TODO: a_value.is_equal (get_property(a_property_name))
 590		end
 591
 592	property, get_property (a_property_name: STRING): G_VALUE is
 593			-- Gets the property name `a_property_name' of an object.
 594
 595			-- Note: The underlying C implementation has the following
 596			-- "preconditions" that are not compiled-in in optimized
 597			-- code:
 598
 599			-- * handle is a GObject
 600
 601			-- * property name C-string is not a NULL pointer
 602
 603			-- * the GValue passed in should be a GValue....
 604
 605			-- It also always check that:
 606			
 607			-- * There's a property with that name
 608
 609			-- * the property is readable
 610
 611			-- * the value passed in is of the same type of the property
 612			--   or it is convertible into a correct type
 613
 614			-- All those checkes are made for each and every access to
 615			-- any property, beside the fact that the actual property
 616			-- getter is usually a big switch statement hidded under
 617			-- another 2 layers of calls.
 618
 619			-- Isn't it nicely inefficient, it is?
 620
 621			-- In this Eiffel wrapper the first checks are statically
 622			-- enforced, while second group of checks can be handled by
 623			-- preconditions and it is duty of the caller to check them
 624			-- if necessary. The very last check is automatically 
 625			-- followed 
 626
 627			-- Therefore this implementation will directly
 628			-- call the hidden virtual call, i.e.: "class->get_property
 629			-- (object, param_id, value, pspec);" see gobject/gobject.c
 630			-- function "object_get_property" for further
 631			-- informations. Paolo 2006-07-25
 632		require
 633			valid_name: a_property_name /= Void
 634			has_property: has_property (a_property_name)
 635			is_readable: find_property (a_property_name).is_readable
 636		local gvalue_ptr: POINTER; parameter_specification: G_PARAM_SPEC
 637		do
 638			parameter_specification := find_property(a_property_name)
 639			create Result.with_gtype (parameter_specification.value_gtype)
 640			g_object_get_property (handle,a_property_name.to_external, Result.handle)
 641			-- while (name) { GValue value = { 0, }; GParamSpec *pspec;
 642			-- gchar *error;
 643			--       pspec = g_param_spec_pool_lookup (pspec_pool,
 644			-- 					name,
 645			-- 					G_OBJECT_TYPE (object),
 646			-- 					TRUE);
 647			--       if (!pspec)
 648			-- 	{
 649			-- 	  g_warning ("%s: object class `%s' has no property named `%s'",
 650			-- 		     G_STRFUNC,
 651			-- 		     G_OBJECT_TYPE_NAME (object),
 652			-- 		     name);
 653			-- 	  break;
 654			-- 	}
 655			--       if (!(pspec->flags & G_PARAM_READABLE))
 656			-- 	{
 657			-- 	  g_warning ("%s: property `%s' of object class `%s' is not readable",
 658			-- 		     G_STRFUNC,
 659			-- 		     pspec->name,
 660			-- 		     G_OBJECT_TYPE_NAME (object));
 661			-- 	  break;
 662			-- 	}
 663		
 664			--       g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
 665		
 666			--       object_get_property (object, pspec, &value);
 667		
 668			--       G_VALUE_LCOPY (&value, var_args, 0, &error);
 669			--       if (error)
 670			-- 	{
 671			-- 	  g_warning ("%s: %s", G_STRFUNC, error);
 672			-- 	  g_free (error);
 673			-- 	  g_value_unset (&value);
 674			-- 	  break;
 675			-- 	}
 676		
 677			--       g_value_unset (&value);
 678		
 679			--       name = va_arg (var_args, gchar*);
 680			--     }
 681
 682			--   g_object_unref (object);  
 683		ensure
 684			not_void: Result /= Void
 685			correct_type: Result.is_a (find_property(a_property_name).value_gtype)
 686		end
 687
 688feature -- String property
 689
 690	set_string_property (a_property_name, a_string: STRING) is
 691		require
 692			name_not_void: a_property_name /= Void
 693			string_not_void: a_string /= Void
 694		do
 695			hidden_gvalue.turn_to_string; hidden_gvalue.set_string (a_string)
 696			g_object_set_property (handle,a_property_name.to_external, hidden_gvalue.handle)
 697		end
 698
 699	string_property, get_string_property (a_property_name: STRING): STRING is
 700			-- the string property named `a_property_name' of an object. Can be
 701			-- Void. TODO: this is complemetely untested!  Test it, for
 702			-- example in GTK_CELL_RENDERER_PROGRESS
 703		require
 704			valid_name: a_property_name /= Void
 705			has_property: has_property (a_property_name)
 706			is_string_property: find_property (a_property_name).is_string
 707		local ptr: POINTER
 708		do
 709			hidden_gvalue.turn_to_string
 710			g_object_get_property (handle,a_property_name.to_external,hidden_gvalue.handle)
 711			Result := hidden_gvalue.string
 712		end
 713
 714feature -- integer property
 715
 716	set_integer_property (a_property_name: STRING; a_value: INTEGER) is
 717			-- Set property with `a_name' to `a_value'
 718		require
 719			valid_name: a_property_name /= Void
 720			property_exists: has_property (a_property_name)
 721			is_writable: find_property (a_property_name).is_writable
 722			is_integer_property: find_property (a_property_name).is_integer
 723		do
 724			hidden_gvalue.turn_to_integer
 725			hidden_gvalue.set_integer (a_value)
 726			g_object_set_property (handle, a_property_name.to_external, hidden_gvalue.handle)
 727		end
 728
 729	integer_property (a_property_name: STRING): INTEGER is
 730			-- the integer property named `a_property_name' of an object.
 731		require
 732			valid_name: a_property_name /= Void
 733			has_property: has_property (a_property_name)
 734			is_string_property: find_property (a_property_name).is_integer
 735		do
 736			hidden_gvalue.turn_to_integer
 737			g_object_get_property (handle,a_property_name.to_external,hidden_gvalue.handle)
 738			Result := hidden_gvalue.integer
 739		end
 740feature -- double/REAL_64 property
 741
 742	set_real_64_property, set_double_property (a_property_name: STRING; a_value: REAL_64) is
 743			-- Set property with `a_name' to `a_value'
 744		require
 745			valid_name: a_property_name /= Void
 746			property_exists: has_property (a_property_name)
 747			is_writable: find_property (a_property_name).is_writable
 748			is_double_property: find_property (a_property_name).is_real_64
 749		do
 750			hidden_gvalue.turn_to_real_64
 751			hidden_gvalue.set_real_64 (a_value)
 752			g_object_set_property (handle, a_property_name.to_external, hidden_gvalue.handle)
 753		end
 754
 755	real_64_property, double_property (a_property_name: STRING): REAL_64 is
 756			-- the double property named `a_property_name' of an object.
 757		require
 758			valid_name: a_property_name /= Void
 759			has_property: has_property (a_property_name)
 760			is_real_64_property: find_property (a_property_name).is_real_64
 761		do
 762			hidden_gvalue.turn_to_real_64
 763			g_object_get_property (handle,a_property_name.to_external,hidden_gvalue.handle)
 764			Result := hidden_gvalue.real_64
 765		end
 766
 767	real_64_property_from_pspec, double_property_from_pspec (a_parameter_specification: G_PARAM_SPEC): REAL_64 is
 768			-- the double property with `a_parameter_specification'. This
 769			-- feature is faster than the plain `double_property'
 770			-- because the latter retrieves the parameter specification
 771			-- from the name given. Storing the specification in a once
 772			-- feature hasten property retrieving.
 773
 774			-- TODO: I'm unsure but I suspect that this feature still has
 775			-- sub-optimal performance because it still creates a new
 776			-- G_VALUE each time. I would help if G_VALUE is expanded and
 777			-- holds the actual GValue C structure like an expanded
 778			-- feature. This way the G_VALUE would be created on the
 779			-- stack, obtaining better performances.
 780
 781			-- Note: the previous TODO should have been implemented in
 782			-- may 2007
 783		require
 784			specification_not_void: a_parameter_specification /= Void
 785		do
 786			hidden_gvalue.turn_to_real_64
 787			invoke_get_property (a_parameter_specification.owner_class, handle,
 788										a_parameter_specification.param_id, hidden_gvalue.handle,
 789										a_parameter_specification.handle)
 790			Result := hidden_gvalue.real_64
 791		end
 792		
 793feature -- float/REAL_32 property
 794
 795	set_real_32_property, set_float_property (a_property_name: STRING; a_value: REAL_32) is
 796			-- Set property with `a_name' to `a_value'
 797		require
 798			valid_name: a_property_name /= Void
 799			property_exists: has_property (a_property_name)
 800			is_writable: find_property (a_property_name).is_writable
 801			is_float_property: find_property (a_property_name).is_real_32
 802		do
 803			hidden_gvalue.turn_to_real_32
 804			hidden_gvalue.set_real_32 (a_value)
 805			g_object_set_property (handle, a_property_name.to_external, hidden_gvalue.handle)
 806		end
 807
 808	real_32_property, float_property (a_property_name: STRING): REAL_32 is
 809			-- the float property named `a_property_name' of an object.
 810		require
 811			valid_name: a_property_name /= Void
 812			has_property: has_property (a_property_name)
 813			is_real_32_property: find_property (a_property_name).is_real_32
 814		do
 815			hidden_gvalue.turn_to_real_32
 816			g_object_get_property (handle,a_property_name.to_external,hidden_gvalue.handle)
 817			Result := hidden_gvalue.real_32
 818		end
 819
 820	real_32_property_from_pspec, float_property_from_pspec (a_parameter_specification: G_PARAM_SPEC): REAL_32 is
 821			-- the float property with `a_parameter_specification'. This
 822			-- feature is faster than the plain `float_property'
 823			-- because the latter retrieves the parameter specification
 824			-- from the name given. Storing the specification in a once
 825			-- feature hasten property retrieving.
 826
 827			-- TODO: I'm unsure but I suspect that this feature still has
 828			-- sub-optimal performance because it still creates a new
 829			-- G_VALUE each time. I would help if G_VALUE is expanded and
 830			-- holds the actual GValue C structure like an expanded
 831			-- feature. This way the G_VALUE would be created on the
 832			-- stack, obtaining better performances.
 833
 834			-- Note: the previous TODO should have been implemented in
 835			-- may 2007
 836		require
 837			specification_not_void: a_parameter_specification /= Void
 838		do
 839			hidden_gvalue.turn_to_real_32
 840			invoke_get_property (a_parameter_specification.owner_class, handle,
 841										a_parameter_specification.param_id, hidden_gvalue.handle,
 842										a_parameter_specification.handle)
 843			Result := hidden_gvalue.real_32
 844		end
 845	
 846feature -- boolean property
 847
 848	set_boolean_property (a_property_name: STRING; a_value: BOOLEAN) is
 849			-- Set boolean property with `a_name' to `a_value'
 850		require
 851			valid_name: a_property_name /= Void
 852			property_exists: has_property (a_property_name)
 853			is_writable: find_property (a_property_name).is_writable
 854			is_integer_property: find_property (a_property_name).is_boolean
 855		do
 856			hidden_gvalue.turn_to_boolean; hidden_gvalue.set_boolean (a_value)
 857			g_object_set_property (handle, a_property_name.to_external, hidden_gvalue.handle)
 858		end
 859
 860	boolean_property (a_property_name: STRING): BOOLEAN is
 861			-- the boolean property named `a_property_name' of an object. 
 862		require
 863			valid_name: a_property_name /= Void
 864			has_property: has_property (a_property_name)
 865			is_string_property: find_property (a_property_name).is_boolean
 866		do
 867			hidden_gvalue.turn_to_boolean
 868			g_object_get_property (handle, a_property_name.to_external, hidden_gvalue.handle)
 869			Result := hidden_gvalue.boolean
 870		end
 871
 872	boolean_property_from_pspec (a_parameter_specification: G_PARAM_SPEC): BOOLEAN is
 873			-- the boolean property with `a_parameter_specification'. This
 874			-- feature is faster than the plain `boolean_property'
 875			-- because the latter retrieves the parameter specification
 876			-- from the name given. Storing the specification in a once
 877			-- feature hasten property retrieving.
 878
 879			-- TODO: I'm unsure but I suspect that this feature still has
 880			-- sub-optimal performance because it still creates a new
 881			-- G_VALUE each time. I would help if G_VALUE is expanded and
 882			-- holds the actual GValue C structure like an expanded
 883			-- feature. This way the G_VALUE would be created on the
 884			-- stack, obtaining better performances.
 885
 886			-- Note: the previous TODO should have been implemented in
 887			-- may 2007
 888		require
 889			specification_not_void: a_parameter_specification /= Void
 890		do
 891			hidden_gvalue.turn_to_boolean
 892			invoke_get_property (a_parameter_specification.owner_class, handle,
 893										a_parameter_specification.param_id, hidden_gvalue.handle,
 894										a_parameter_specification.handle)
 895			Result := hidden_gvalue.boolean
 896		end
 897
 898feature -- enum property
 899	set_enum_property (a_property_name: STRING; a_value: INTEGER) is
 900			-- Set the enumeration property with `a_name' to `a_value'. 
 901		require
 902			valid_name: a_property_name /= Void
 903			property_exists: has_property (a_property_name)
 904			is_writable: find_property (a_property_name).is_writable
 905			is_enum_property: find_property (a_property_name).is_enum
 906		do
 907			hidden_gvalue.turn_to_integer
 908			hidden_gvalue.set_integer (a_value)
 909			g_object_set_property (handle, a_property_name.to_external,hidden_gvalue.handle)
 910		end
 911
 912	enum_property (a_property_name: STRING): INTEGER is
 913			-- the enumeration property named `a_property_name' of an object.
 914		require
 915			valid_name: a_property_name /= Void
 916			has_property: has_property (a_property_name)
 917			is_string_property: find_property (a_property_name).is_enum
 918		do
 919			hidden_gvalue.turn_to_integer
 920			g_object_get_property (handle,a_property_name.to_external,hidden_gvalue.handle)
 921			Result:=hidden_gvalue.integer
 922		end
 923
 924feature {} -- Unwrapped API
 925--    ----------------------------------------------------------------------------------------------------------------
 926
 927--   GObjectClass
 928
 929--  typedef struct {
 930--    GTypeClass   g_type_class;
 931
 932--    /* overridable methods */
 933--    GObject*   (*constructor)     (GType                  type,
 934--                                   guint                  n_construct_properties,
 935--                                   GObjectConstructParam *construct_properties);
 936--    void       (*set_property)            (GObject        *object,
 937--                                           guint           property_id,
 938--                                           const GValue   *value,
 939--                                           GParamSpec     *pspec);
 940--    void       (*get_property)            (GObject        *object,
 941--                                           guint           property_id,
 942--                                           GValue         *value,
 943--                                           GParamSpec     *pspec);
 944--    void       (*dispose)                 (GObject        *object);
 945--    void       (*finalize)                (GObject        *object);
 946
 947--    /* seldomly overidden */
 948--    void       (*dispatch_properties_changed) (GObject      *object,
 949--                                               guint         n_pspecs,
 950--                                               GParamSpec  **pspecs);
 951
 952--    /* signals */
 953--    void       (*notify)                  (GObject        *object,
 954--                                           GParamSpec     *pspec);
 955--  } GObjectClass;
 956
 957--    The class structure for the GObject type.
 958
 959--    Example 4. Implementing singletons using a constructor
 960
 961--  static MySingleton *the_singleton = NULL;
 962
 963--  static GObject*
 964--  my_singleton_constructor (GType                  type,
 965--                            guint                  n_construct_params,
 966--                            GObjectConstructParam *construct_params)
 967--  {
 968--    GObject *object;
 969
 970--    if (!the_singleton)
 971--      {
 972--        object = G_OBJECT_CLASS (parent_class)->constructor (type,
 973--                                                             n_construct_params,
 974--                                                             construct_params);
 975--        the_singleton = MY_SINGLETON (object);
 976--      }
 977--    else
 978--      object = g_object_ref (G_OBJECT (the_singleton));
 979
 980--    return object;
 981--  }
 982
 983--    GTypeClass g_type_class;       the parent class
 984--    constructor ()                 the constructor function is called by g_object_new() to complete the object
 985--                                   initialization after all the construction properties are set. The first thing a
 986--                                   constructor implementation must do is chain up to the constructor of the parent
 987--                                   class. Overriding constructor should be rarely needed, e.g. to handle construct
 988--                                   properties, or to implement singletons.
 989--    set_property ()                the generic setter for all properties of this type. Should be overridden for
 990--                                   every type with properties. Implementations of set_property don't need to emit
 991--                                   property change notification explicitly, this is handled by the type system.
 992--    get_property ()                the generic getter for all properties of this type. Should be overridden for
 993--                                   every type with properties.
 994--    dispose ()                     the dispose function is supposed to drop all references to other objects, but
 995--                                   keep the instance otherwise intact, so that client method invocations still work.
 996--                                   It may be run multiple times (due to reference loops). Before returning, dispose
 997--                                   should chain up to the dispose method of the parent class.
 998--    finalize ()                    instance finalization function, should finish the finalization of the instance
 999--                                   begun in dispose and chain up to the finalize method of the parent class.
1000--    dispatch_properties_changed () emits property change notification for a bunch of properties. Overriding
1001--                                   dispatch_properties_changed should be rarely needed.
1002--    notify ()                      the class closure for the notify signal
1003
1004--    ----------------------------------------------------------------------------------------------------------------
1005
1006--   GObjectConstructParam
1007
1008--  typedef struct {
1009--    GParamSpec *pspec;
1010--    GValue     *value;
1011--  } GObjectConstructParam;
1012
1013--    The GObjectConstructParam struct is an auxiliary structure used to hand GParamSpec/GValue pairs to the
1014--    constructor of a GObjectClass.
1015
1016--    GParamSpec *pspec; the GParamSpec of the construct parameter
1017--    GValue *value;     the value to set the parameter to
1018
1019--    ----------------------------------------------------------------------------------------------------------------
1020
1021--   GObjectGetPropertyFunc ()
1022
1023--  void        (*GObjectGetPropertyFunc)       (GObject *object,
1024--                                               guint property_id,
1025--                                               GValue *value,
1026--                                               GParamSpec *pspec);
1027
1028--    The type of the get_property function of GObjectClass.
1029
1030--    object :      a GObject
1031--    property_id : the numeric id under which the property was registered with g_object_class_install_property().
1032--    value :       a GValue to return the property value in
1033--    pspec :       the GParamSpec describing the property
1034
1035--    ----------------------------------------------------------------------------------------------------------------
1036
1037--   GObjectSetPropertyFunc ()
1038
1039--  void        (*GObjectSetPropertyFunc)       (GObject *object,
1040--                                               guint property_id,
1041--                                               const GValue *value,
1042--                                               GParamSpec *pspec);
1043
1044--    The type of the set_property function of GObjectClass.
1045
1046--    object :      a GObject
1047--    property_id : the numeric id under which the property was registered with g_object_class_install_property().
1048--    value :       the new value for the property
1049--    pspec :       the GParamSpec describing the property
1050
1051--    ----------------------------------------------------------------------------------------------------------------
1052
1053--   GObjectFinalizeFunc ()
1054
1055--  void        (*GObjectFinalizeFunc)          (GObject *object);
1056
1057--    The type of the finalize function of GObjectClass.
1058
1059--    object : the GObject being finalized
1060
1061--    ----------------------------------------------------------------------------------------------------------------
1062
1063--   G_TYPE_IS_OBJECT()
1064
1065--  #define G_TYPE_IS_OBJECT(type)      (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT)
1066
1067--    Returns a boolean value of FALSE or TRUE indicating whether the passed in type id is a G_TYPE_OBJECT or derived
1068--    from it.
1069
1070--    type :    Type id to check for is a G_TYPE_OBJECT relationship.
1071--    Returns : FALSE or TRUE, indicating whether type is a G_TYPE_OBJECT.
1072
1073--    ----------------------------------------------------------------------------------------------------------------
1074
1075--   G_OBJECT()
1076
1077--  #define G_OBJECT(object)            (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject))
1078
1079--    Casts a GObject or derived pointer into a (GObject*) pointer. Depending on the current debugging level, this
1080--    function may invoke certain runtime checks to identify invalid casts.
1081
1082--    object : Object which is subject to casting.
1083
1084--    ----------------------------------------------------------------------------------------------------------------
1085
1086--   G_IS_OBJECT()
1087
1088--  #define G_IS_OBJECT(object)         (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_OBJECT))
1089
1090--    Checks whether a valid GTypeInstance pointer is of type G_TYPE_OBJECT.
1091
1092--    object : Instance to check for being a G_TYPE_OBJECT.
1093
1094--    ----------------------------------------------------------------------------------------------------------------
1095
1096--   G_OBJECT_CLASS()
1097
1098--  #define G_OBJECT_CLASS(class)       (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_OBJECT, GObjectClass))
1099
1100--    Casts a derived GObjectClass structure into a GObjectClass structure.
1101
1102--    class : a valid GObjectClass
1103
1104--    ----------------------------------------------------------------------------------------------------------------
1105
1106--   G_IS_OBJECT_CLASS()
1107
1108--  #define G_IS_OBJECT_CLASS(class)    (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_OBJECT))
1109
1110--    Checks whether class "is a" valid GObjectClass structure of type G_TYPE_OBJECT or derived.
1111
1112--    class : a GObjectClass
1113
1114--    ----------------------------------------------------------------------------------------------------------------
1115
1116--   G_OBJECT_GET_CLASS()
1117
1118--  #define G_OBJECT_GET_CLASS(object)  (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_OBJECT, GObjectClass))
1119
1120--    Returns the class structure associated to a GObject instance.
1121
1122--    object : a GObject instance.
1123
1124--    ----------------------------------------------------------------------------------------------------------------
1125
1126--   G_OBJECT_TYPE()
1127
1128--  #define G_OBJECT_TYPE(object)       (G_TYPE_FROM_INSTANCE (object))
1129
1130--    Return the type id of an object.
1131
1132--    object :  Object to return the type id for.
1133--    Returns : Type id of object.
1134
1135--    ----------------------------------------------------------------------------------------------------------------
1136
1137--   G_OBJECT_TYPE_NAME()
1138
1139--  #define G_OBJECT_TYPE_NAME(object)  (g_type_name (G_OBJECT_TYPE (object)))
1140
1141--    Returns the name of an object's type.
1142
1143--    object :  Object to return the type name for.
1144--    Returns : Type name of object. The string is owned by the type system and should not be freed.
1145
1146--    ----------------------------------------------------------------------------------------------------------------
1147
1148--   G_OBJECT_CLASS_TYPE()
1149
1150--  #define G_OBJECT_CLASS_TYPE(class)  (G_TYPE_FROM_CLASS (class))
1151
1152--    Return the type id of a class structure.
1153
1154--    class :   a valid GObjectClass
1155--    Returns : Type id of class.
1156
1157--    ----------------------------------------------------------------------------------------------------------------
1158
1159--   G_OBJECT_CLASS_NAME()
1160
1161--  #define G_OBJECT_CLASS_NAME(class)  (g_type_name (G_OBJECT_CLASS_TYPE (class)))
1162
1163--    Return the name of a class structure's type.
1164
1165--    class :   a valid GObjectClass
1166--    Returns : Type name of class. The string is owned by the type system and should not be freed.
1167
1168--    ----------------------------------------------------------------------------------------------------------------
1169
1170--   g_object_class_install_property ()
1171
1172--  void        g_object_class_install_property (GObjectClass *oclass,
1173--                                               guint property_id,
1174--                                               GParamSpec *pspec);
1175
1176--    Installs a new property. This is usually done in the class initializer.
1177
1178--    oclass :      a GObjectClass
1179--    property_id : the id for the new property
1180--    pspec :       the GParamSpec for the new property
1181
1182--    ----------------------------------------------------------------------------------------------------------------
1183
1184--   g_object_class_list_properties ()
1185
1186--  GParamSpec** g_object_class_list_properties (GObjectClass *oclass,
1187--                                               guint *n_properties);
1188
1189--    Returns an array of GParamSpec* for all properties of a class.
1190
1191--    oclass :       a GObjectClass
1192--    n_properties : return location for the length of the returned array
1193--    Returns :      an array of GParamSpec* which should be freed after use
1194
1195--    ----------------------------------------------------------------------------------------------------------------
1196
1197--   g_object_class_override_property ()
1198
1199--  void        g_object_class_override_property
1200--                                              (GObjectClass *oclass,
1201--                                               guint property_id,
1202--                                               const gchar *name);
1203
1204--    Registers property_id as referring to a property with the name name in a parent class or in an interface
1205--    implemented by oclass. This allows this class to override a property implementation in a parent class or to
1206--    provide the implementation of a property from an interface.
1207
1208--   Note
1209
1210--    Internally, overriding is implemented by creating a property of type GParamSpecOverride; generally operations
1211--    that query the properties of the object class, such as g_object_class_find_property() or
1212--    g_object_class_list_properties() will return the overridden property. However, in one case, the
1213--    construct_properties argument of the constructor virtual function, the GParamSpecOverride is passed instead, so
1214--    that the param_id field of the GParamSpec will be correct. For virtually all uses, this makes no difference. If
1215--    you need to get the overridden property, you can call g_param_spec_get_redirect_target().
1216
1217--    oclass :      a GObjectClass
1218--    property_id : the new property ID
1219--    name :        the name of a property registered in a parent class or in an interface of this class.
1220
1221--    ----------------------------------------------------------------------------------------------------------------
1222
1223--   g_object_interface_install_property ()
1224
1225--  void        g_object_interface_install_property
1226--                                              (gpointer g_iface,
1227--                                               GParamSpec *pspec);
1228
1229--    Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types.
1230--    Adding a property to an interface forces all objects classes with that interface to have a compatible property.
1231--    The compatible property could be a newly created GParamSpec, but normally g_object_class_override_property()
1232--    will be used so that the object class only needs to provide an implementation and inherits the property
1233--    description, default value, bounds, and so forth from the interface property.
1234
1235--    This function is meant to be called from the interface's default vtable initialization function (the class_init
1236--    member of GTypeInfo.) It must not be called after after class_init has been called for any object types
1237--    implementing this interface.
1238
1239--    g_iface : any interface vtable for the interface, or the default vtable for the interface.
1240--    pspec :   the GParamSpec for the new property
1241
1242--    Since 2.4
1243
1244--    ----------------------------------------------------------------------------------------------------------------
1245
1246--   g_object_interface_find_property ()
1247
1248--  GParamSpec* g_object_interface_find_property
1249--                                              (gpointer g_iface,
1250--                                               const gchar *property_name);
1251
1252--    Find the GParamSpec with the given name for an interface. Generally, the interface vtable passed in as g_iface
1253--    will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been
1254--    loaded, g_type_default_interface_peek().
1255
1256--    g_iface :       any interface vtable for the interface, or the default vtable for the interface
1257--    property_name : name of a property to lookup.
1258--    Returns :       the GParamSpec for the property of the interface with the name property_name, or NULL if no such
1259--                    property exists.
1260
1261--    Since 2.4
1262
1263--    ----------------------------------------------------------------------------------------------------------------
1264
1265--   g_object_interface_list_properties ()
1266
1267--  GParamSpec** g_object_interface_list_properties
1268--                                              (gpointer g_iface,
1269--                                               guint *n_properties_p);
1270
1271--    Lists the properties of an interface.Generally, the interface vtable passed in as g_iface will be the default
1272--    vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded,
1273--    g_type_default_interface_peeā€¦

Large files files are truncated, but you can click here to view the full file