## GalagoObject GalagoObject — The base class of the Galago object hierarchy. |

## Synopsis

                GalagoObject;
    enum        GalagoObjectFlags;
    #define     GALAGO_OBJECT_HAS_FLAG          (obj, flag)
    #define     GALAGO_OBJECT_FLAGS             (obj)
    #define     GALAGO_OBJECT_SET_FLAGS         (obj, flag)
    #define     GALAGO_OBJECT_UNSET_FLAGS       (obj, flag)
    enum        GalagoOrigin;
    #define     GALAGO_ORIGIN_IS_VALID          (origin)
    #define     GALAGO_OBJECT_IS_LOCAL          (obj)
    #define     GALAGO_OBJECT_IS_REMOTE         (obj)
    void        galago_object_destroy           (GalagoObject *object);
    const gchar* galago_object_type_get_dbus_signature
                                                (GType type);
    void        galago_object_set_dbus_path     (GalagoObject *object,
                                                 const gchar *obj_path);
    const gchar* galago_object_get_dbus_path    (const GalagoObject *object);
    void        galago_object_set_watch         (GalagoObject *object,
                                                 gboolean watch);
    gboolean    galago_object_is_watched        (const GalagoObject *object);
    GalagoOrigin galago_object_get_origin       (const GalagoObject *object);
    GalagoContext* galago_object_get_context    (const GalagoObject *object);
    void        galago_object_set_attr_string   (GalagoObject *object,
                                                 const char *name,
                                                 const char *value);
    void        galago_object_set_attr_bool     (GalagoObject *object,
                                                 const char *name,
                                                 gboolean value);
    void        galago_object_set_attr_int      (GalagoObject *object,
                                                 const char *name,
                                                 gint32 value);
    void        galago_object_set_attr_double   (GalagoObject *object,
                                                 const char *name,
                                                 gdouble value);
    void        galago_object_set_attribute     (GalagoObject *object,
                                                 const char *name,
                                                 GValue *value);
    gboolean    galago_object_remove_attribute  (GalagoObject *object,
                                                 const char *name);
    const char* galago_object_get_attr_string   (const GalagoObject *object,
                                                 const char *name);
    gboolean    galago_object_get_attr_bool     (const GalagoObject *object,
                                                 const char *name);
    gint32      galago_object_get_attr_int      (const GalagoObject *object,
                                                 const char *name);
    gdouble     galago_object_get_attr_double   (const GalagoObject *object,
                                                 const char *name);
    const GValue* galago_object_get_attribute   (const GalagoObject *object,
                                                 const char *name);
    gboolean    galago_object_get_has_attribute (const GalagoObject *object,
                                                 const char *name);
    GList*      galago_object_get_attributes    (const GalagoObject *object);

## Object Hierarchy

      GObject
       +----GalagoObject
             +----GalagoAccount
             +----GalagoContext
             +----GalagoCore
             +----GalagoImage
             +----GalagoPerson
             +----GalagoPresence
             +----GalagoService
             +----GalagoStatus

## Properties

      "context"              gpointer              : Read
      "origin"               GalagoOrigin          : Read / Write / Construct Only
      "supports-attrs"       gboolean              : Read

## Signals

    "destroy"   void        user_function      (GalagoObject *object,
                                                gpointer      user_data)      : Cleanup / No recursion / No hooks

## Description

GalagoObject is the base class for all Galago objects. Most GalagoObject subclasses can be passed around in D-BUS messages through `galago_dbus_message_iter_append_object()` and `galago_dbus_message_iter_get_object()`.

GalagoObjects may also support remote attributes. Examples of such objects are GalagoPerson and GalagoAccount.

Most GalagoObjects are managed by the libgalago, and are created by factories. In most cases, you should not call `g_object_unref()` unless you've already called `g_object_ref()`. If you wish to destroy an object, call `galago_object_destroy()`.

## Details

### GalagoObject

    typedef struct _GalagoObject GalagoObject;

The object itself. You should never access the members of this directly. Always use the public API methods and macros.

### enum GalagoObjectFlags

    typedef enum
    {
    	GALAGO_OBJECT_IN_DESTRUCTION = 1,
    	GALAGO_OBJECT_RESERVED_1     = 2,
    	GALAGO_OBJECT_RESERVED_2     = 4

    } GalagoObjectFlags;

Object flags.

`GALAGO_OBJECT_IN_DESTRUCTION` | The object is currently being destroyed. This is used internally.
`GALAGO_OBJECT_RESERVED_1` | Reserved for future use.
`GALAGO_OBJECT_RESERVED_2` | Reserved for future use.

### GALAGO_OBJECT_HAS_FLAG()

    #define     GALAGO_OBJECT_HAS_FLAG(obj, flag)

Returns whether or not the object has the specified flag set.

`obj` : | The GalagoObject.
`flag` : | The flag to check for.

### GALAGO_OBJECT_FLAGS()

    #define     GALAGO_OBJECT_FLAGS(obj)

Returns the flags belonging to an object.

`obj` : | The GalagoObject.

### GALAGO_OBJECT_SET_FLAGS()

    #define     GALAGO_OBJECT_SET_FLAGS(obj, flag)

Sets one or more flags on an object.

`obj` : | The GalagoObject.
`flag` : | A bitmask of flags to set.

### GALAGO_OBJECT_UNSET_FLAGS()

    #define     GALAGO_OBJECT_UNSET_FLAGS(obj, flag)

Unsets one or more flags on an object.

`obj` : | The GalagoObject.
`flag` : | A bitmask of flags to unset.

### enum GalagoOrigin

    typedef enum
    {
    	GALAGO_LOCAL = 0,
    	GALAGO_REMOTE

    } GalagoOrigin;

The origin of an object.

`GALAGO_LOCAL` | The object is local to the calling application or library.
`GALAGO_REMOTE` | The object is remote and created from another process.

### GALAGO_ORIGIN_IS_VALID()

    #define     GALAGO_ORIGIN_IS_VALID(origin)

Returns whether or not a numeric value is a valid GalagoOrigin value.

`origin` : | The value to test against.

### GALAGO_OBJECT_IS_LOCAL()

    #define     GALAGO_OBJECT_IS_LOCAL(obj)

Returns `TRUE` if an object is local. This is the same as comparing the result of `galago_object_get_origin()` to `GALAGO_LOCAL`.

`obj` : | The GalagoObject.

### GALAGO_OBJECT_IS_REMOTE()

    #define     GALAGO_OBJECT_IS_REMOTE(obj)

Returns `TRUE` if an object is remote. This is the same as comparing the result of `galago_object_get_origin()` to `GALAGO_REMOTE`.

`obj` : | The GalagoObject.

### galago_object_destroy ()

    void        galago_object_destroy           (GalagoObject *object);

Emits the "destroy" signal for an object, and attempts to dispose of it. The memory for the object won't actually be deleted until the reference count drops to 0.

`object` : | The object to destroy.

### galago_object_type_get_dbus_signature ()

    const gchar* galago_object_type_get_dbus_signature
                                                (GType type);

Returns the D-BUS signature of the object type.

`type` : | The object GType.
Returns : | The signature string, or NULL.

### galago_object_set_dbus_path ()

    void        galago_object_set_dbus_path     (GalagoObject *object,
                                                 const gchar *obj_path);

Sets the D-BUS object path of an object.

`object` : | The object.
`obj_path` : | The object path.

### galago_object_get_dbus_path ()

    const gchar* galago_object_get_dbus_path    (const GalagoObject *object);

Returns the D-BUS object path of an object.

`object` : | The object.
Returns : | The object path.

### galago_object_set_watch ()

    void        galago_object_set_watch         (GalagoObject *object,
                                                 gboolean watch);

Sets whether or not this object is watched for events.

`object` : | The object.
`watch` : | `TRUE` if this object should be watched, or `FALSE`.

### galago_object_is_watched ()

    gboolean    galago_object_is_watched        (const GalagoObject *object);

Returns whether or not an object is watched for events.

`object` : | The object.
Returns : | `TRUE` if this object is being watched, or `FALSE`.

### galago_object_get_origin ()

    GalagoOrigin galago_object_get_origin       (const GalagoObject *object);

Returns the object's origin.

`object` : | The object.
Returns : | The object's origin

### galago_object_get_context ()

    GalagoContext* galago_object_get_context    (const GalagoObject *object);

Returns the object's context.

`object` : | The object.
Returns : | The object's context.

### galago_object_set_attr_string ()

    void        galago_object_set_attr_string   (GalagoObject *object,
                                                 const char *name,
                                                 const char *value);

Sets a string attribute on an object.

`object` : | The object.
`name` : | The name of the attribute to set.
`value` : | The value of the attribute.

### galago_object_set_attr_bool ()

    void        galago_object_set_attr_bool     (GalagoObject *object,
                                                 const char *name,
                                                 gboolean value);

Sets a boolean attribute on an object.

`object` : | The object.
`name` : | The name of the attribute to set.
`value` : | The value of the attribute.

### galago_object_set_attr_int ()

    void        galago_object_set_attr_int      (GalagoObject *object,
                                                 const char *name,
                                                 gint32 value);

Sets an integer attribute on an object.

`object` : | The object.
`name` : | The name of the attribute to set.
`value` : | The value of the attribute.

### galago_object_set_attr_double ()

    void        galago_object_set_attr_double   (GalagoObject *object,
                                                 const char *name,
                                                 gdouble value);

Sets a double attribute on an object.

`object` : | The object.
`name` : | The name of the attribute to set.
`value` : | The value of the attribute.

### galago_object_set_attribute ()

    void        galago_object_set_attribute     (GalagoObject *object,
                                                 const char *name,
                                                 GValue *value);

Sets an attribute on an object.

This is limited to string, boolean, and integer value types.

`object` : | The object.
`name` : | The name of the attribute to set.
`value` : | The value of the attribute.

### galago_object_remove_attribute ()

    gboolean    galago_object_remove_attribute  (GalagoObject *object,
                                                 const char *name);

Removes an attribute on an object.

`object` : | The object
`name` : | The name of the attribute to remove
Returns : | `TRUE` if the attribute was removed, or `FALSE`.

### galago_object_get_attr_string ()

    const char* galago_object_get_attr_string   (const GalagoObject *object,
                                                 const char *name);

Returns the value of a string attribute on an object.

`object` : | The object.
`name` : | The name of the attribute.
Returns : | The attribute value, or NULL.

### galago_object_get_attr_bool ()

    gboolean    galago_object_get_attr_bool     (const GalagoObject *object,
                                                 const char *name);

Returns the value of a boolean attribute on an object.

`object` : | The object.
`name` : | The name of the attribute.
Returns : | The attribute value.

### galago_object_get_attr_int ()

    gint32      galago_object_get_attr_int      (const GalagoObject *object,
                                                 const char *name);

Returns the value of an integer attribute on an object.

`object` : | The object.
`name` : | The name of the attribute.
Returns : | The attribute value.

### galago_object_get_attr_double ()

    gdouble     galago_object_get_attr_double   (const GalagoObject *object,
                                                 const char *name);

Returns the value of a double attribute on an object.

`object` : | The object.
`name` : | The name of the attribute.
Returns : | The attribute value.

### galago_object_get_attribute ()

    const GValue* galago_object_get_attribute   (const GalagoObject *object,
                                                 const char *name);

Returns the value of an attribute on an object.

`object` : | The object.
`name` : | The name of the attribute.
Returns : | The attribute value, or NULL.

### galago_object_get_has_attribute ()

    gboolean    galago_object_get_has_attribute (const GalagoObject *object,
                                                 const char *name);

Returns whether or not an object has a specific attribute set.

`object` : | The object.
`name` : | The name of the attribute.
Returns : | `TRUE` if the attribute is set, or `FALSE`.

### galago_object_get_attributes ()

    GList*      galago_object_get_attributes    (const GalagoObject *object);

Returns the list of attributes in an object, represented by GalagoKeyValue structs.

`object` : | The object.
Returns : | The attributes in the object. Each one is a GalagoKeyValue.

## Property Details

### The "`context`" property

      "context"              gpointer              : Read

The GalagoContext this object belongs to.

### The "`origin`" property

      "origin"               GalagoOrigin          : Read / Write / Construct Only

The object's origin.

Default value: GALAGO_LOCAL

### The "`supports-attrs`" property

      "supports-attrs"       gboolean              : Read

Indicates if this object supports remote attributes.

Default value: FALSE

## Signal Details

### The "destroy" signal

    void        user_function                  (GalagoObject *object,
                                                gpointer      user_data)      : Cleanup / No recursion / No hooks

Emitted when the object is undergoing a dispose. Signals that anything holding a reference to this object should release the reference. This may or may not end with the object being finalized, depending on whether there are any references left after this is emitted.

`object` : | The object which received the signal.
`user_data` : | user data set when the signal handler was connected.

## See Also

GObject