Cairo-Dock  3.4.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cairo-dock-object.h File Reference

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

GldiObjectgldi_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)
 

Detailed Description

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.

Macro Definition Documentation

#define gldi_object_notify (   pObject,
  iNotifType,
  ... 
)

Broadcast a notification on a given object, and on all its managers.

Parameters
pObjectthe object (Icon, Container, Manager, ...).
iNotifTypetype of the notification.
...parameters to be passed to the callbacks that have registered to this notification.

Enumeration Type Documentation

signals (any object has at least these ones)

Enumerator
NOTIFICATION_NEW 

notification called when an object has been created. data : the object

NOTIFICATION_DESTROY 

notification called when the object is going to be destroyed. data : the object

Function Documentation

GldiObject* gldi_object_new ( GldiObjectManager pMgr,
gpointer  attr 
)

Create a new object.

Parameters
pMgrthe ObjectManager
attrthe attributes of the object
Returns
the new object, with a reference of 1; use gldi_object_unref to destroy it
void gldi_object_ref ( GldiObject pObject)

Take a reference on an object.

Parameters
pObjectthe 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.

Parameters
pObjectthe 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.

Parameters
pObjectthe Object
void gldi_object_reload ( GldiObject pObject,
gboolean  bReloadConfig 
)

Reload an object.

Parameters
pObjectthe Object
bReloadConfigTRUE 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.

Parameters
pObjectthe object (Icon, Container, Manager).
iNotifTypetype of the notification.
pFunctioncallback.
bRunFirstGLDI_RUN_FIRST to be called before Cairo-Dock, GLDI_RUN_AFTER to be called after.
pUserDatadata 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.

Parameters
pObjectthe object (Icon, Container, Manager) for which the action has been registered.
iNotifTypetype of the notification.
pFunctioncallback.
pUserDatadata that was registerd with the callback.