MrpProperty

MrpProperty — represents a custom property in the project.

Synopsis


#include <libplanner/planner.h>


typedef             MrpProperty;
enum                MrpPropertyType;
MrpProperty*        mrp_property_new                    (const gchar *name,
                                                         MrpPropertyType type,
                                                         const gchar *label,
                                                         const gchar *description,
                                                         gboolean user_defined);
const gchar*        mrp_property_get_name               (MrpProperty *property);
MrpPropertyType     mrp_property_get_property_type      (MrpProperty *property);
void                mrp_property_set_label              (MrpProperty *property,
                                                         const gchar *label);
const gchar*        mrp_property_get_label              (MrpProperty *property);
void                mrp_property_set_description        (MrpProperty *property,
                                                         const gchar *description);
const gchar*        mrp_property_get_description        (MrpProperty *property);
void                mrp_property_set_user_defined       (MrpProperty *property,
                                                         gboolean user_defined);
gboolean            mrp_property_get_user_defined       (MrpProperty *property);
MrpProperty*        mrp_property_ref                    (MrpProperty *property);
void                mrp_property_unref                  (MrpProperty *property);
const gchar*        mrp_property_type_as_string         (MrpPropertyType type);

Description

MrpProperty is a typedef to GParamSpec. It is used to add properties to projects, resources and tasks in run time, for example by the user of a GUI application, or plugins that add functionality.

Details

MrpProperty

typedef GParamSpec MrpProperty;

Object representing a custom property in the project.


enum MrpPropertyType

typedef enum {
	MRP_PROPERTY_TYPE_NONE,
	MRP_PROPERTY_TYPE_INT,
	MRP_PROPERTY_TYPE_FLOAT,
	MRP_PROPERTY_TYPE_STRING,
	MRP_PROPERTY_TYPE_STRING_LIST,
	MRP_PROPERTY_TYPE_DATE,
	MRP_PROPERTY_TYPE_DURATION,
	MRP_PROPERTY_TYPE_COST
} MrpPropertyType;

The different types of custom properties. Cost and duration are simply float and integer values, but the extra information provided makes it possible to format the values properly in a GUI.

MRP_PROPERTY_TYPE_NONE invalid (unset type)
MRP_PROPERTY_TYPE_INT integer type
MRP_PROPERTY_TYPE_FLOAT float type
MRP_PROPERTY_TYPE_STRING string type
MRP_PROPERTY_TYPE_STRING_LIST not implemented
MRP_PROPERTY_TYPE_DATE date type
MRP_PROPERTY_TYPE_DURATION duration type
MRP_PROPERTY_TYPE_COST cost type (float)

mrp_property_new ()

MrpProperty*        mrp_property_new                    (const gchar *name,
                                                         MrpPropertyType type,
                                                         const gchar *label,
                                                         const gchar *description,
                                                         gboolean user_defined);

Creates a new MrpProperty. name must be unique in the application. user_defined specifies if the property was created by a user or a plugin or Planner itself.

name : the name of the property
type : an MrpPropertyType
label : the human readable label
description : a string describing the property
user_defined : a gboolean
Returns : a newly create property

mrp_property_get_name ()

const gchar*        mrp_property_get_name               (MrpProperty *property);

Fetches the name of property

property : an MrpProperty
Returns : the name of property

mrp_property_get_property_type ()

MrpPropertyType     mrp_property_get_property_type      (MrpProperty *property);

Fetches the type of property

property : an MrpProperty
Returns : the type of property

mrp_property_set_label ()

void                mrp_property_set_label              (MrpProperty *property,
                                                         const gchar *label);

Sets the label of property and signals the "property-changed" signal on the project property is attached to.

property : an MrpProperty
label : a string containing the new label

mrp_property_get_label ()

const gchar*        mrp_property_get_label              (MrpProperty *property);

Fetches the label of property

property : an MrpProperty
Returns : the label of property

mrp_property_set_description ()

void                mrp_property_set_description        (MrpProperty *property,
                                                         const gchar *description);

Sets the description of property and signals the "property-changed" signal on the project property is attached to.

property : an MrpProperty
description : a string containing the new description

mrp_property_get_description ()

const gchar*        mrp_property_get_description        (MrpProperty *property);

Fetches the description of property

property : an MrpProperty
Returns : the description of property

mrp_property_set_user_defined ()

void                mrp_property_set_user_defined       (MrpProperty *property,
                                                         gboolean user_defined);

Sets if property is user-defined or created by a plugin or Planner itself.

property : an MrpProperty
user_defined : if the property is user defined

mrp_property_get_user_defined ()

gboolean            mrp_property_get_user_defined       (MrpProperty *property);

Fetches if property is uesr defined or not.

property : an MrpProperty
Returns : TRUE if property is user defined, otherwise FALSE

mrp_property_ref ()

MrpProperty*        mrp_property_ref                    (MrpProperty *property);

Add a reference to property. User should call this when storing a reference to property.

property : an MrpProperty
Returns : the property

mrp_property_unref ()

void                mrp_property_unref                  (MrpProperty *property);

Remove a reference from property. If the reference count reaches 0 the property will be freed. User should not use it's reference after calling mrp_property_unref().

property : an MrpProperty

mrp_property_type_as_string ()

const gchar*        mrp_property_type_as_string         (MrpPropertyType type);

Transform a MrpPropertyTYpe into a human readable string.

type : an MrpPropertyType
Returns : a string representation of type