Skip to content

Commit

Permalink
refresh thumbnails on file change
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvornik committed Jul 3, 2008
1 parent 579c42a commit 4fa28d6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "ui_fileops.h"
#include "ui_utildlg.h"
#include "cache_maint.h"
#include "thumb.h"

#include <gdk/gdkkeysyms.h> /* for keyboard values */

Expand Down Expand Up @@ -689,6 +690,7 @@ int main(int argc, char *argv[])

/* register global notify functions */
file_data_register_notify_func(cache_notify_cb, NULL, NOTIFY_PRIORITY_HIGH);
file_data_register_notify_func(thumb_notify_cb, NULL, NOTIFY_PRIORITY_HIGH);
file_data_register_notify_func(collect_manager_notify_cb, NULL, NOTIFY_PRIORITY_LOW);

parse_command_line_for_debug_option(argc, argv);
Expand Down
12 changes: 12 additions & 0 deletions src/thumb.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,18 @@ gint thumb_from_xpm_d(const char **data, gint max_w, gint max_h, GdkPixmap **pix
}
#endif


/* release thumb_pixbuf on file change - this forces reload. */
void thumb_notify_cb(FileData *fd, NotifyType type, gpointer data)
{
if (type != NOTIFY_TYPE_INTERNAL && fd->thumb_pixbuf)
{
g_object_unref(fd->thumb_pixbuf);
fd->thumb_pixbuf = NULL;
}
}


/*
*-----------------------------------------------------------------------------
* xvpics thumbnail support, read-only (private)
Expand Down
1 change: 1 addition & 0 deletions src/thumb.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ void thumb_loader_free(ThumbLoader *tl);

GdkPixbuf *thumb_loader_get_pixbuf(ThumbLoader *tl);

void thumb_notify_cb(FileData *fd, NotifyType type, gpointer data);

#endif

0 comments on commit 4fa28d6

Please sign in to comment.