Module gwy :: Class Resource
[show private | hide private]
[frames | no frames]

Class Resource


The Resource struct contains private data only and should be accessed using the functions below.
Method Summary
  build_filename()
Builds file name a resource should be saved to.
  data_changed()
Emits signal "data-changed" on a resource.
  data_saved()
Clears is_modified flag of a resource.
  get_is_modifiable()
Returns: True if resource is modifiable, False if it's fixed (system)
  get_is_preferred()
Returns: True if resource is preferred, False otherwise.
  get_name()
Returns: Name of resource.
  is_used()
Tells whether a resource is currently in use.
  release()
Releases a resource.
  set_is_preferred(is_preferred)
Sets preferability of a resource.
  UNIMPLEMENTED_dump()
Dumps a resource to a textual (human readable) form.
  use()
Starts using a resource.

Method Details

build_filename()

Builds file name a resource should be saved to.

If the resource has not been newly created, renamed, or system it was probably loaded from file of the same name.
Returns:
Resource file name as a newly allocated string that must be freed by caller.

data_changed()

Emits signal "data-changed" on a resource.

It can be called only on non-constant resources. The default handler sets is_modified flag on the resource.

Mostly useful in resource implementation.

data_saved()

Clears is_modified flag of a resource.

Since: 2.8

get_is_modifiable()

Returns: True if resource is modifiable, False if it's fixed (system)
Returns:
True if resource is modifiable, False if it's fixed (system) resource.

get_is_preferred()

Returns: True if resource is preferred, False otherwise.
Returns:
True if resource is preferred, False otherwise.

get_name()

Returns: Name of resource. The string is owned by resource and must not
Returns:
Name of resource. The string is owned by resource and must not be modfied or freed.

is_used()

Tells whether a resource is currently in use.

See Resource.use() for details.
Returns:
True if resource is in use, False otherwise.

release()

Releases a resource.

When the number of resource uses drops to zero, it frees all auxiliary data and returns back to `latent' form. In addition, it calls g_object_unref() on it. See Resource.use() for more.

set_is_preferred(is_preferred)

Sets preferability of a resource.
Parameters:
is_preferred - True to make resource preferred, False to make it not preferred. (bool)

UNIMPLEMENTED_dump()

Dumps a resource to a textual (human readable) form.
Returns:
Textual resource representation.

use()

Starts using a resource.

Call to this function is necessary to use a resource properly. It makes the resource to create any auxiliary structures that consume considerable amount of memory and perform other initialization to ready-to-use form.

When a resource is no longer used, it should be released with Resource.release().

In addition, it calls g_object_ref() on the resource.

Resources usually exist through almost whole program lifetime from GObject perspective, but from the viewpoint of use this method is the constructor and Resource.release() is the destructor.

Generated by Epydoc 2.1 on Tue Dec 30 04:01:41 2008 http://epydoc.sf.net