# HG changeset patch # User nadvornik # Date 1212791655 0 # Node ID baade53888becf7c31f8da9ab45e6652ea74c433 # Parent 99ea3d973ad3d913611871d1b79085c42d047c9a used new notification in cache_maint diff -r 99ea3d973ad3 -r baade53888be src/cache_maint.c --- a/src/cache_maint.c Fri Jun 06 22:11:03 2008 +0000 +++ b/src/cache_maint.c Fri Jun 06 22:34:15 2008 +0000 @@ -520,7 +520,7 @@ } } -void cache_maint_moved(FileData *fd) +static void cache_maint_moved(FileData *fd) { gchar *base; mode_t mode = 0755; @@ -579,7 +579,7 @@ } } -void cache_maint_removed(FileData *fd) +static void cache_maint_removed(FileData *fd) { gchar *buf; @@ -599,7 +599,7 @@ thumb_std_maint_removed(fd->path); } -void cache_maint_copied(FileData *fd) +static void cache_maint_copied(FileData *fd) { gchar *dest_base; gchar *src_cache; @@ -625,6 +625,28 @@ g_free(src_cache); } +void cache_notify_cb(FileData *fd, NotifyType type, gpointer data) +{ + if (!fd->change) return; + + switch(fd->change->type) + { + case FILEDATA_CHANGE_MOVE: + case FILEDATA_CHANGE_RENAME: + cache_maint_moved(fd); + break; + case FILEDATA_CHANGE_COPY: + cache_maint_copied(fd); + break; + case FILEDATA_CHANGE_DELETE: + cache_maint_removed(fd); + break; + case FILEDATA_CHANGE_UNSPECIFIED: + break; + } +} + + /* *------------------------------------------------------------------- * new cache maintenance utilities diff -r 99ea3d973ad3 -r baade53888be src/cache_maint.h --- a/src/cache_maint.h Fri Jun 06 22:11:03 2008 +0000 +++ b/src/cache_maint.h Fri Jun 06 22:34:15 2008 +0000 @@ -22,9 +22,7 @@ gint cache_maintain_dir(const gchar *dir, gint recursive, gint clear); #endif -void cache_maint_moved(FileData *fd); -void cache_maint_removed(FileData *fd); -void cache_maint_copied(FileData *fd); +void cache_notify_cb(FileData *fd, NotifyType type, gpointer data); void cache_manager_show(void); diff -r 99ea3d973ad3 -r baade53888be src/main.c --- a/src/main.c Fri Jun 06 22:11:03 2008 +0000 +++ b/src/main.c Fri Jun 06 22:34:15 2008 +0000 @@ -27,6 +27,7 @@ #include "ui_bookmark.h" #include "ui_fileops.h" #include "ui_utildlg.h" +#include "cache_maint.h" #include /* for keyboard values */ @@ -679,6 +680,10 @@ #if 1 log_printf("%s %s, This is an alpha release.\n", GQ_APPNAME, VERSION); #endif + + /* register global notify functions */ + file_data_register_notify_func(cache_notify_cb, NULL, NOTIFY_PRIORITY_HIGH); + parse_command_line_for_debug_option(argc, argv); options = init_options(NULL); diff -r 99ea3d973ad3 -r baade53888be src/utilops.c --- a/src/utilops.c Fri Jun 06 22:11:03 2008 +0000 +++ b/src/utilops.c Fri Jun 06 22:34:15 2008 +0000 @@ -243,7 +243,6 @@ switch (type) { case FILEDATA_CHANGE_MOVE: - cache_maint_moved(fd); collection_maint_renamed(fd); layout_maint_moved(fd, NULL); @@ -252,10 +251,8 @@ search_maint_renamed(fd); break; case FILEDATA_CHANGE_COPY: - cache_maint_copied(fd); break; case FILEDATA_CHANGE_RENAME: - cache_maint_moved(fd); collection_maint_renamed(fd); layout_maint_renamed(fd); @@ -270,7 +267,6 @@ search_maint_removed(fd); collection_maint_removed(fd); - cache_maint_removed(fd); break; case FILEDATA_CHANGE_UNSPECIFIED: /* FIXME */