## MrpObject

MrpObject — libplanner base class.

## Functions

void | mrp_object_removed ()
void | mrp_object_changed ()
void | mrp_object_set ()
void | mrp_object_get ()
void | mrp_object_set_property ()
void | mrp_object_get_property ()
void | mrp_object_set_valist ()
void | mrp_object_get_valist ()
GList * | mrp_object_get_properties ()
guint | mrp_object_get_id ()
gboolean | mrp_object_set_id ()
gpointer | mrp_object_get_project ()

## Properties

MrpProject * | project | Read / Write

## Signals

void | prop-changed | Has Details
void | removed | Run Last

## Types and Values

#define | MRP_TYPE_OBJECT
struct | MrpObjectClass
| MrpObject

## Object Hierarchy

        GObject
        ╰── MrpObject
            ├── MrpAssignment
            ├── MrpCalendar
            ├── MrpGroup
            ├── MrpProject
            ├── MrpRelation
            ├── MrpResource
            ╰── MrpTask

## Includes

    #include <libplanner/mrp-object.h>

## Description

MrpObject extends GObject. Most of `libplanner` entities are MrpObject instances. Others are GBoxed like MrpInterval or GEnum like MrpTaskType. MrpApplication is a GObject.

MrpObject has no constructor.

MrpObject instances belong to a project.

MrpObject has properties.

MrpApplication can associate pointers to ids. MrpObject uses the mechanism to register with MrpApplication, gaining an id. `mrp_application_id_get_data()` retrieves an MrpObject given its id.

MrpObject signals removal and modification.

## Functions

### mrp_object_removed ()

    void
    mrp_object_removed (MrpObject *object);

Emits the “removed” signal. This means that any references to the object should be dropped, since the object is removed from the project.

#### Parameters

object | an MrpObject |

### mrp_object_changed ()

    void
    mrp_object_changed (MrpObject *object);

Emits the “needs-saving-changed” on the project `object` belongs to, indicating that the project has unsaved changes.

#### Parameters

object | an MrpObject |

### mrp_object_set ()

    void
    mrp_object_set (gpointer object,
                    const gchar *first_property_name,
                    ...);

MrpObject can have custom properties, which are added runtime, for example by a user or plugin. `mrp_object_set()` allows you to set these the value of those properties. It also handles the regular GObject properties, so you can use it to set both custom properties and regular properties at the same time.

#### Parameters

object | an MrpObject |
first_property_name | the name of the first property to set |
... | first value to set, followed by additional name/value pairs to set, NULL terminated |

### mrp_object_get ()

    void
    mrp_object_get (gpointer object,
                    const gchar *first_property_name,
                    ...);

Retrieves the values of a variable number of custom properties or regular properties from an object. See `mrp_object_set()`.

#### Parameters

object | an MrpProject |
first_property_name | the name of the first property to get |
... | first value to get, followed by additional name/value pairs to get, NULL terminated |

### mrp_object_set_property ()

    void
    mrp_object_set_property (MrpObject *object,
                             MrpProperty *property,
                             GValue *value);

Sets a custom property. This is mostly for language bindings. C programmers should use mrp_object_set instead.

#### Parameters

object | an MrpObject |
property | the property to set |
value | the value to set |

### mrp_object_get_property ()

    void
    mrp_object_get_property (MrpObject *object,
                             MrpProperty *property,
                             GValue *value);

Gets a custom property. This is mostly for language bindings. C programmers should use mrp_object_get instead.

#### Parameters

object | an MrpObject |
property | the property to get |
value | the value to get |

### mrp_object_set_valist ()

    void
    mrp_object_set_valist (MrpObject *object,
                           const gchar *first_property_name,
                           va_list var_args);

va_list version of `mrp_object_set()`.

#### Parameters

object | an MrpObject |
first_property_name | the name of the first property to set |
var_args | va_list of arguments |

### mrp_object_get_valist ()

    void
    mrp_object_get_valist (MrpObject *object,
                           const gchar *first_property_name,
                           va_list var_args);

va_list version of `mrp_object_get()`.

#### Parameters

object | an MrpObject |
first_property_name | the name of the first property to get |
var_args | va_list of arguments |

### mrp_object_get_properties ()

    GList *
    mrp_object_get_properties (MrpObject *object);

Retrieves the list of custom properties for the type of `object` .

#### Parameters

object | an MrpObject |

#### Returns

A list of MrpProperty, must not be changed or freed.

### mrp_object_get_id ()

    guint
    mrp_object_get_id (MrpObject *object);

Retrieves the unique object id in the application

#### Parameters

object | an MrpObject |

#### Returns

0 if fails, object id if everything is OK.

### mrp_object_set_id ()

    gboolean
    mrp_object_set_id (MrpObject *object,
                       guint id);

Change the unique object id in the application. This function must be called only from Undo/Redo operations.

#### Parameters

object | an MrpObject |
id | an id |

#### Returns

FALSE if fails, TRUE is everything is OK.

### mrp_object_get_project ()

    gpointer
    mrp_object_get_project (MrpObject *object);

to which project does `object` belongs to?

#### Parameters

object | a libplanner object |

#### Returns

The project `object` belongs to

## Types and Values

### MRP_TYPE_OBJECT

    #define MRP_TYPE_OBJECT         (mrp_object_get_type ())

### struct MrpObjectClass

    struct MrpObjectClass {
            GObjectClass parent_class;

            /* Signals */
            void (*removed)        (MrpObject   *object);
    	void (*prop_changed)   (MrpObject   *object,
    				MrpProperty *property,
    				GValue      *new_value);
    };

### MrpObject

    typedef struct _MrpObject MrpObject;

The base class for objects in libmrproject.

## Property Details

### The `“project”` property

      “project”                  MrpProject *

The project this object belongs to.

Owner: MrpObject

Flags: Read / Write

## Signal Details

### The `“prop-changed”` signal

    void
    user_function (MrpObject *object,
                   gpointer   property,
                   GValue    *new_value,
                   gpointer   user_data)

emitted when `property` changes.

#### Parameters

object | a libplanner object. |
property | the property that changed. |
new_value | the new value. |
user_data | user data set when the signal handler was connected. |

Flags: Has Details

### The `“removed”` signal

    void
    user_function (MrpObject *object,
                   gpointer   user_data)

emitted when `object` is removed.

#### Parameters

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

Flags: Run Last