File src/gnome/object_types.c

Functions

local _free_structure (w) The given structure should be freed; it has no reference counting and therefore an _unref function does not exist.
local _gvalue_free (p) Free a GValue.
local _malloc_handler (w, op, flags) Handler for objects that are allocated by this library using g_slice_alloc, and that don't have refcounting.
local _plain_handler (w, op, flags) Handler for objects that don't need memory management or refcounting; it is the fallback for non-allocated objects.
lg_dec_refcount (L, w) Decrease the Gdk/Gtk/GObject reference counter by one.
lg_get_object_type (L, w) Retrieve the struct object_type for the given object.
lg_get_refcount (L, w) Return the reference counter of the Gtk object associated with this object structure.
lg_guess_object_type (L, w, flags) Determine the mm_type for a new object proxy object.
lg_inc_refcount (L, w, flags) Increase the reference counter of the object by 1.
lg_init_object (L) Initialize the object type handlers defined in this module.
lg_register_object_type (name, handler) Register an object type.


Functions

local _free_structure (w)
The given structure should be freed; it has no reference counting and therefore an _unref function does not exist. Try to find a _free function and call it; otherwise, just g_slice_free() it.

Parameters

  • w: Pointer to the object to be freed.
local _gvalue_free (p)
Free a GValue. It might contain a string, for example, meaning additional allocated memory. This is freed.

Parameters

  • p:
local _malloc_handler (w, op, flags)
Handler for objects that are allocated by this library using g_slice_alloc, and that don't have refcounting. They exist attached to their Lua object proxy and are freed when the proxy is freed.

Parameters

  • w:
  • op:
  • flags:
local _plain_handler (w, op, flags)
Handler for objects that don't need memory management or refcounting; it is the fallback for non-allocated objects. GSList: the start as well as any item of such a list has the same type. Therefore, they can't be free()d automatically. use list:free() for that.

Parameters

  • w: A object
  • op: Type of operation to perform
  • flags: If FLAG_ALLOCATED is set, rather not use this handler, else yes.

Return value:

For op==WIDGET_SCORE, the score, i.e. how well this handler would be for the given object.
lg_dec_refcount (L, w)
Decrease the Gdk/Gtk/GObject reference counter by one. This is done when the Lua object representing it is garbage collected.

Parameters

  • L:
  • w: The object
lg_get_object_type (L, w)
Retrieve the struct object_type for the given object.

Parameters

  • L:
  • w: A object

Return value:

The object_type, or NULL on error. In this case, an error is printed on stderr, too.
lg_get_refcount (L, w)
Return the reference counter of the Gtk object associated with this object structure. Not all objects have such a counter. A negative value indicates an error.

Parameters

  • L:
  • w:
lg_guess_object_type (L, w, flags)
Determine the mm_type for a new object proxy object. This type determines how the memory of this object is managed - is reference counting used, should it be free()d or nothing done, etc.

Parameters

  • L: Lua State
  • w: The new object
  • flags: any of the FLAG_xxx constants: FLAG_NEW_OBJECT, FLAG_ALLOCATED
lg_inc_refcount (L, w, flags)
Increase the reference counter of the object by 1. If FLAG_NEW_OBJECT is set, then this is a "new" object, just created by the appropriate function. This may require not increasing the refcount, or doing something else (think about floating references).

Parameters

  • L:
  • w:
  • flags:
lg_init_object (L)
Initialize the object type handlers defined in this module. There currently is one more (in channel.c).

Parameters

  • L:
lg_register_object_type (name, handler)
Register an object type. Widgets have types (maybe a better name could be found?) that govern how their memory is managed. To make the library more extensible, they are registered at initialization.

Parameters

  • name: Short name for this object type (for debugging output)
  • handler: A function to handle various tasks

Return value:

The type_nr assigned to this object type.

Valid XHTML 1.0!