Cairo-Dock
3.4.0
|
Data Structures | |
struct | _GldiObject |
Definition of an Object. More... | |
struct | _GldiObjectManager |
Definition of an ObjectManager. More... | |
Macros | |
#define | GLDI_RUN_FIRST |
Use this in gldi_object_register_notification to be called before the core. | |
#define | GLDI_RUN_AFTER |
Use this in gldi_object_register_notification to be called after the core. | |
#define | GLDI_NOTIFICATION_INTERCEPT |
Return this in your callback to prevent the other callbacks from being called after you. | |
#define | GLDI_NOTIFICATION_LET_PASS |
Return this in your callback to let pass the notification to the other callbacks after you. | |
#define | gldi_object_notify(pObject, iNotifType,...) |
Typedefs | |
typedef gboolean(* | GldiNotificationFunc )(gpointer pUserData,...) |
Generic prototype of a notification callback. | |
Enumerations | |
enum | GldiObjectNotifications { NOTIFICATION_NEW, NOTIFICATION_DESTROY } |
signals (any object has at least these ones) More... | |
Functions | |
GldiObject * | gldi_object_new (GldiObjectManager *pMgr, gpointer attr) |
void | gldi_object_ref (GldiObject *pObject) |
void | gldi_object_unref (GldiObject *pObject) |
void | gldi_object_delete (GldiObject *pObject) |
void | gldi_object_reload (GldiObject *pObject, gboolean bReloadConfig) |
void | gldi_object_register_notification (gpointer pObject, GldiNotificationType iNotifType, GldiNotificationFunc pFunction, gboolean bRunFirst, gpointer pUserData) |
void | gldi_object_remove_notification (gpointer pObject, GldiNotificationType iNotifType, GldiNotificationFunc pFunction, gpointer pUserData) |
This class defines the Objects, the base class of libgldi. Every element in this library is an Object. An object is defined by an ObjectManager, which defines its capabilities and signals.
Any object is created with gldi_object_new and destroyed with gldi_object_unref. An object can be deleted from the current theme with gldi_object_delete. An object can be reloaded with gldi_object_reload.
You can listen for notifications on an object with gldi_object_register_notification and stop listening with gldi_object_remove_notification. To listen for notifications on any object of a given type, simply register yourself on its ObjectManager.
#define gldi_object_notify | ( | pObject, | |
iNotifType, | |||
... | |||
) |
Broadcast a notification on a given object, and on all its managers.
pObject | the object (Icon, Container, Manager, ...). |
iNotifType | type of the notification. |
... | parameters to be passed to the callbacks that have registered to this notification. |
GldiObject* gldi_object_new | ( | GldiObjectManager * | pMgr, |
gpointer | attr | ||
) |
Create a new object.
pMgr | the ObjectManager |
attr | the attributes of the object |
void gldi_object_ref | ( | GldiObject * | pObject | ) |
Take a reference on an object.
pObject | the Object |
void gldi_object_unref | ( | GldiObject * | pObject | ) |
Drop your reference on an object. If it's the last reference, the object is destroyed, otherwise nothing happens.
pObject | the Object |
void gldi_object_delete | ( | GldiObject * | pObject | ) |
Delete an object from the current theme. The object is unref'd, and won't be created again on next startup.
pObject | the Object |
void gldi_object_reload | ( | GldiObject * | pObject, |
gboolean | bReloadConfig | ||
) |
Reload an object.
pObject | the Object |
bReloadConfig | TRUE to read its config file again (if the object has one) |
void gldi_object_register_notification | ( | gpointer | pObject, |
GldiNotificationType | iNotifType, | ||
GldiNotificationFunc | pFunction, | ||
gboolean | bRunFirst, | ||
gpointer | pUserData | ||
) |
Register an action to be called when a given notification is broadcasted from a given object.
pObject | the object (Icon, Container, Manager). |
iNotifType | type of the notification. |
pFunction | callback. |
bRunFirst | GLDI_RUN_FIRST to be called before Cairo-Dock, GLDI_RUN_AFTER to be called after. |
pUserData | data to be passed as the first parameter of the callback. |
void gldi_object_remove_notification | ( | gpointer | pObject, |
GldiNotificationType | iNotifType, | ||
GldiNotificationFunc | pFunction, | ||
gpointer | pUserData | ||
) |
Remove a callback from the list of callbacks of a given object for a given notification and a given data. Note: it is safe to remove the callback when it is called, but not another one.
pObject | the object (Icon, Container, Manager) for which the action has been registered. |
iNotifType | type of the notification. |
pFunction | callback. |
pUserData | data that was registerd with the callback. |