diff options
author | Jannis Pohlmann <info@sten-net.de> | 2007-03-24 22:40:49 +0000 |
---|---|---|
committer | Jannis Pohlmann <info@sten-net.de> | 2007-03-24 22:40:49 +0000 |
commit | e67b27ad4e307cc4d4bfc2962a891967ed6233a7 (patch) | |
tree | 9d76c1dd66e37542c05a89a052d5710610228e96 /tests | |
parent | ddd6873908882078a64ec93a2e8ae044fae2e2ee (diff) | |
download | garcon-e67b27ad4e307cc4d4bfc2962a891967ed6233a7.tar.gz |
* libxfce4menu/Makefile.am, libxfce4menu/xfce-menu.c,
libxfce4menu/xfce-menu-monitor.{c,h}: Add monitoring support
by making it possible for library clients to define a vtable
with functions to be called whenever monitoring a file or
directory becomes necessary. This way Thunar and xfdesktop
can use ThunarVFS for monitoring and I don't need to care
about how they do it. Note: xfce_menu_monitor_notify_change()
is missing but will be adedd as soon as possible.
* tests/test-display-menu.c: Add some dummy code for testing
the monitoring system.
* docs/reference/: Updated and reorganized API docs.
git-svn-id: https://svn.xfce.org/svn/xfce/libxfce4menu/trunk@25281 a0aa69c2-05f4-0310-b83c-d5d913b14636
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-display-menu.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/test-display-menu.c b/tests/test-display-menu.c index 6f0daa7..34067fc 100644 --- a/tests/test-display-menu.c +++ b/tests/test-display-menu.c @@ -49,6 +49,57 @@ static XfceMenu *root = NULL; +/* Pseudo monitor handler */ +static guint pseudo_monitor_handler = 0; + + + +static gpointer +monitor_file (XfceMenu *menu, + const gchar *filename, + gpointer user_data) +{ + g_debug ("%s: monitoring file %s", xfce_menu_element_get_name (XFCE_MENU_ELEMENT (menu)), filename); + return GUINT_TO_POINTER (++pseudo_monitor_handler); +} + + + +static gpointer +monitor_directory (XfceMenu *menu, + const gchar *filename, + gpointer user_data) +{ + g_debug ("%s: monitoring directory %s", xfce_menu_element_get_name (XFCE_MENU_ELEMENT (menu)), filename); + return GUINT_TO_POINTER (++pseudo_monitor_handler); +} + + + +static void +remove_monitor (XfceMenu *menu, + gpointer monitor_handle) +{ + g_debug ("%s: removing monitor %d", xfce_menu_element_get_name (XFCE_MENU_ELEMENT (menu)), GPOINTER_TO_UINT (monitor_handle)); +} + + + +static void +initialize_monitoring (void) +{ + XfceMenuMonitorVTable vtable = { + monitor_file, + monitor_directory, + remove_monitor, + }; + + /* Pass VTable to the menu library */ + xfce_menu_monitor_set_vtable (&vtable, NULL); +} + + + static void execute_item_command (GtkWidget *widget, XfceMenuItem *item) @@ -330,6 +381,9 @@ main (int argc, /* Initialize the menu library */ xfce_menu_init ("XFCE"); + /* Set up menu monitoring */ + initialize_monitoring (); + /* Initialize GTK+ */ gtk_init (&argc, &argv); |