Top | ![]() |
![]() |
![]() |
![]() |
void | (*GConfListenersCallback) () |
GConfListeners * | gconf_listeners_new () |
void | gconf_listeners_free () |
guint | gconf_listeners_add () |
void | gconf_listeners_remove () |
void | gconf_listeners_notify () |
guint | gconf_listeners_count () |
void | gconf_listeners_foreach () |
gboolean | gconf_listeners_get_data () |
void | gconf_listeners_remove_if () |
A GConfListeners object is used to store listeners who want notification of changes in a namespace section. It is a public API shared between gconfd and the GObject convenience wrapper.
void (*GConfListenersCallback) (GConfListeners *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 gconf_listeners_notify()
. This function
is called whenever the value of a key changes.
listeners |
||
all_above_key |
the key that has changed. |
|
cnxn_id |
the connection id got from |
|
listener_data |
the data field associated with each listener. |
|
user_data |
the user data to be passed to the callback. |
GConfListeners *
gconf_listeners_new (void
);
Creates a new listener table and typecasts it to a GConfListeners.
void
gconf_listeners_free (GConfListeners *listeners
);
Destroys the listener table.
guint gconf_listeners_add (GConfListeners *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.
void gconf_listeners_remove (GConfListeners *listeners
,guint cnxn_id
);
Removes the listener from the listener table.
void gconf_listeners_notify (GConfListeners *listeners
,const gchar *all_above
,GConfListenersCallback callback
,gpointer user_data
);
Notifies all the associated listeners that a key has changed.
listeners |
||
all_above |
the key that has changed. |
|
callback |
a GConfListenersCallback to be called. |
|
user_data |
data to be passed to the callback. |
guint
gconf_listeners_count (GConfListeners *listeners
);
Returns the number of alive listeners in the listener table.
void gconf_listeners_foreach (GConfListeners *listeners
,GConfListenersForeach callback
,gpointer user_data
);
Execute a function for each of the GConfListeners.
gboolean gconf_listeners_get_data (GConfListeners *listeners
,guint cnxn_id
,gpointer *listener_data_p
,const gchar **location_p
);
Obtains the data particular to a GConfListener.
void gconf_listeners_remove_if (GConfListeners *listeners
,GConfListenersPredicate predicate
,gpointer user_data
);
Remove the listener if a predicate is satisfied.
typedef struct _GConfListeners GConfListeners;
The GConfListeners 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.