Mercurial > geeqie
changeset 793:baade53888be
used new notification in cache_maint
author | nadvornik |
---|---|
date | Fri, 06 Jun 2008 22:34:15 +0000 |
parents | 99ea3d973ad3 |
children | 03614b7883ea |
files | src/cache_maint.c src/cache_maint.h src/main.c src/utilops.c |
diffstat | 4 files changed, 31 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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);
--- 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 <gdk/gdkkeysyms.h> /* 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);
--- 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 */