Monitoring

Monitoring

Synopsis

#include <libxfce4menu/libxfce4menu.h>

                    XfceMenuMonitorVTable;
void                xfce_menu_monitor_set_vtable        (XfceMenuMonitorVTable *vtable,
                                                         gpointer user_data);

Description

Details

XfceMenuMonitorVTable

typedef struct {
  gpointer (*monitor_file)      (XfceMenu    *menu,
                                 const gchar *filename,
                                 gpointer     user_data);

  gpointer (*monitor_directory) (XfceMenu    *menu,
                                 const gchar *filename,
                                 gpointer     user_data);

  void     (*remove_monitor)    (XfceMenu    *menu,
                                 gpointer     monitor_handle);
} XfceMenuMonitorVTable;

This structure can be used by clients of the libxfce4menu API to register functions which will be called whenever monitoring a certain file or directory becomes necessary. This way libxfce4menu only has to manage the monitor handles and leaves the monitoring implementations to the client.

This mechanism was invented because the two main API clients, Thunar and xfdesktop are already linked to ThunarVFS which has monitoring capabilities.


xfce_menu_monitor_set_vtable ()

void                xfce_menu_monitor_set_vtable        (XfceMenuMonitorVTable *vtable,
                                                         gpointer user_data);

Sets the functions to be called when monitoring a file or directory becomes necessary. See XfceMenuMonitorVTable for more detailled information. Be careful with redefining the XfceMenuMonitorVTable (e.g. don't redefine it while there are any XfceMenu's around).

In order to change the user data, just pass the same XfceMenuMonitorVTable as you did before. Pass NULL to clear the vtable (e.g. if you want to disable monitoring support).

vtable :

a XfceMenuMonitorVTable

user_data :

custom pointer to be passed to the vtable functions.