![]() |
![]() |
![]() |
MateConf Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
MateConfListeners; void (*MateConfListenersCallback) (MateConfListeners *listeners
,const gchar *all_above_key
,guint cnxn_id
,gpointer listener_data
,gpointer user_data
); MateConfListeners * mateconf_listeners_new (void
); void mateconf_listeners_free (MateConfListeners *listeners
); guint mateconf_listeners_add (MateConfListeners *listeners
,const gchar *listen_point
,gpointer listener_data
,GFreeFunc destroy_notify
); void mateconf_listeners_remove (MateConfListeners *listeners
,guint cnxn_id
); void mateconf_listeners_notify (MateConfListeners *listeners
,const gchar *all_above
,MateConfListenersCallback callback
,gpointer user_data
); guint mateconf_listeners_count (MateConfListeners *listeners
); void mateconf_listeners_foreach (MateConfListeners *listeners
,MateConfListenersForeach callback
,gpointer user_data
); gboolean mateconf_listeners_get_data (MateConfListeners *listeners
,guint cnxn_id
,gpointer *listener_data_p
,const gchar **location_p
); void mateconf_listeners_remove_if (MateConfListeners *listeners
,MateConfListenersPredicate predicate
,gpointer user_data
);
A MateConfListeners object is used to store listeners who want notification of changes in a namespace section. It is a public API shared between mateconfd and the GObject convenience wrapper.
typedef struct _MateConfListeners MateConfListeners;
The MateConfListeners structure contains nothing other than a dummy pointer. Internally the data about listeners is maintained through a listener table structure, LTable which contains data like the namespace, an array to hold the listeners, count of active listeners,value to be given to the next connection and the list of connection indices to be recycled. There is also a Listener structure maintaining data pertaining to listeners.
void (*MateConfListenersCallback) (MateConfListeners *listeners
,const gchar *all_above_key
,guint cnxn_id
,gpointer listener_data
,gpointer user_data
);
This is the signature of a user function added with mateconf_listeners_notify()
. This function
is called whenever the value of a key changes.
|
a MateConfListeners. |
|
the key that has changed. |
|
the connection id got from mateconf_listeners_add() .
|
|
the data field associated with each listener. |
|
the user data to be passed to the callback. |
MateConfListeners * mateconf_listeners_new (void
);
Creates a new listener table and typecasts it to a MateConfListeners.
Returns : |
the newly allocated MateConfListeners. |
void mateconf_listeners_free (MateConfListeners *listeners
);
Destroys the listener table.
|
a MateConfListeners. |
guint mateconf_listeners_add (MateConfListeners *listeners
,const gchar *listen_point
,gpointer listener_data
,GFreeFunc destroy_notify
);
Creates a new Listener with the next available connection id and inserts it into the listener table.
The newly created listener listens for changes below and including the listen_point.Returns
the newly
assigned connection id.
|
a MateConfListeners. |
|
where to listen for changes. |
|
data to pass to function. |
|
pointer to the function to be called when the listener is destroyed. |
Returns : |
the newly assigned connection id, a guint value. |
void mateconf_listeners_remove (MateConfListeners *listeners
,guint cnxn_id
);
Removes the listener from the listener table.
|
a MateConfListeners. |
|
the connection id returned during mateconf_listeners_add() .
|
void mateconf_listeners_notify (MateConfListeners *listeners
,const gchar *all_above
,MateConfListenersCallback callback
,gpointer user_data
);
Notifies all the associated listeners that a key has changed.
|
a MateConfListeners. |
|
the key that has changed. |
|
a MateConfListenersCallback to be called. |
|
data to be passed to the callback. |
guint mateconf_listeners_count (MateConfListeners *listeners
);
Returns the number of alive listeners in the listener table.
|
a MateConfListeners |
Returns : |
the number of active listeners. |
void mateconf_listeners_foreach (MateConfListeners *listeners
,MateConfListenersForeach callback
,gpointer user_data
);
Execute a function for each of the MateConfListeners.
|
a MateConfListeners. |
|
the function to be called. |
|
a gpointer. |
gboolean mateconf_listeners_get_data (MateConfListeners *listeners
,guint cnxn_id
,gpointer *listener_data_p
,const gchar **location_p
);
Obtains the data particular to a MateConfListener.
|
a MateConfListeners. |
|
the connection id, an integer. |
|
the address for getting the listener data. |
|
a pointer to the address for getting the name. |
Returns : |
TRUE if the data could be obtained successfully, FALSE if an error occurs while retrieving the data. |
void mateconf_listeners_remove_if (MateConfListeners *listeners
,MateConfListenersPredicate predicate
,gpointer user_data
);
Remove the listener if a predicate is satisfied.
|
a MateConfListeners. |
|
the predicate checked for removal. |
|
a gpointer. |