![]() |
![]() |
![]() |
Libplanner Reference Manual | ![]() |
---|---|---|---|---|
#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);
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.
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.
invalid (unset type) | |
integer type | |
float type | |
string type | |
not implemented | |
date type | |
duration type | |
cost type (float) |
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.
|
the name of the property |
|
an MrpPropertyType |
|
the human readable label |
|
a string describing the property |
|
a gboolean |
Returns : |
a newly create property |
const gchar* mrp_property_get_name (MrpProperty *property);
Fetches the name of property
|
an MrpProperty |
Returns : |
the name of property
|
MrpPropertyType mrp_property_get_property_type (MrpProperty *property);
Fetches the type of property
|
an MrpProperty |
Returns : |
the type of property
|
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.
|
an MrpProperty |
|
a string containing the new label |
const gchar* mrp_property_get_label (MrpProperty *property);
Fetches the label of property
|
an MrpProperty |
Returns : |
the label of property
|
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.
|
an MrpProperty |
|
a string containing the new description |
const gchar* mrp_property_get_description (MrpProperty *property);
Fetches the description of property
|
an MrpProperty |
Returns : |
the description of property
|
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.
|
an MrpProperty |
|
if the property is user defined |
gboolean mrp_property_get_user_defined (MrpProperty *property);
Fetches if property
is uesr defined or not.
|
an MrpProperty |
Returns : |
TRUE if property is user defined, otherwise FALSE
|
MrpProperty* mrp_property_ref (MrpProperty *property);
Add a reference to property
. User should call this when storing a reference
to property
.
|
an MrpProperty |
Returns : |
the property |
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()
.
|
an MrpProperty |
const gchar* mrp_property_type_as_string (MrpPropertyType type);
Transform a MrpPropertyTYpe into a human readable string.
|
an MrpPropertyType |
Returns : |
a string representation of type
|