changeset 797:799d035b9994

use new notification in img-view
author nadvornik
date Sat, 07 Jun 2008 09:36:12 +0000
parents 0be132a51f51
children 5055b5b0d75d
files src/img-view.c src/img-view.h src/utilops.c
diffstat 3 files changed, 22 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/src/img-view.c	Sat Jun 07 09:10:01 2008 +0000
+++ b/src/img-view.c	Sat Jun 07 09:36:12 2008 +0000
@@ -68,6 +68,7 @@
 
 static void view_window_dnd_init(ViewWindow *vw);
 
+static void view_window_notify_cb(FileData *fd, NotifyType type, gpointer data);
 
 /*
  *-----------------------------------------------------------------------------
@@ -805,6 +806,9 @@
 	fullscreen_stop(vw->fs);
 
 	filelist_free(vw->list);
+
+	file_data_unregister_notify_func(view_window_notify_cb, vw);
+
 	g_free(vw);
 }
 
@@ -925,6 +929,8 @@
 
 	view_window_list = g_list_append(view_window_list, vw);
 
+	file_data_register_notify_func(view_window_notify_cb, vw, NOTIFY_PRIORITY_LOW);
+
 	return vw;
 }
 
@@ -1602,7 +1608,7 @@
  *-----------------------------------------------------------------------------
  */
 
-static void view_real_removed(ViewWindow *vw, FileData *fd, GList *ignore_list)
+static void view_real_removed(ViewWindow *vw, FileData *fd)
 {
 	ImageWindow *imd;
 	FileData *image_fd;
@@ -1683,65 +1689,23 @@
 	image_osd_update(imd);
 }
 
-static void view_real_moved(ViewWindow *vw, FileData *fd)
+static void view_window_notify_cb(FileData *fd, NotifyType type, gpointer data)
 {
-/*
-	ImageWindow *imd;
-	const gchar *image_path;
+	ViewWindow *vw = data;
 
-	imd = view_window_active_image(vw);
-*/
-/*
-	image_path = image_get_path(imd);
-
-	if (image_path && strcmp(image_path, fd->change->source) == 0)
-		{
-		image_set_fd(imd, dest);
-		}
-*/
-/*
-	if (vw->list)
+	if (!fd->change) return;
+	
+	switch(fd->change->type)
 		{
-		GList *work;
-		work = vw->list;
-		while (work)
-			{
-			gchar *chk_path;
-
-			chk_path = work->data;
-
-			if (strcmp(chk_path, source) == 0)
-				{
-				work->data = g_strdup(dest);
-				g_free(chk_path);
-				}
-
-			work = work->next;
-			}
-		}
-*/
-}
-
-void view_window_maint_removed(FileData *fd, GList *ignore_list)
-{
-	GList *work = view_window_list;
-	while (work)
-		{
-		ViewWindow *vw = work->data;
-		work = work->next;
-
-		view_real_removed(vw, fd, ignore_list);
+		case FILEDATA_CHANGE_MOVE:
+		case FILEDATA_CHANGE_RENAME:
+			break;
+		case FILEDATA_CHANGE_COPY:
+			break;
+		case FILEDATA_CHANGE_DELETE:
+			view_real_removed(vw, fd);
+			break;
+		case FILEDATA_CHANGE_UNSPECIFIED:
+			break;
 		}
 }
-
-void view_window_maint_moved(FileData *fd)
-{
-	GList *work = view_window_list;
-	while (work)
-		{
-		ViewWindow *vw = work->data;
-		work = work->next;
-
-		view_real_moved(vw, fd);
-		}
-}
--- a/src/img-view.h	Sat Jun 07 09:10:01 2008 +0000
+++ b/src/img-view.h	Sat Jun 07 09:36:12 2008 +0000
@@ -23,8 +23,6 @@
 
 gint view_window_find_image(ImageWindow *imd, gint *index, gint *total);
 
-void view_window_maint_removed(FileData *fd, GList *ignore_list);
-void view_window_maint_moved(FileData *fd);
 
 
 #endif
--- a/src/utilops.c	Sat Jun 07 09:10:01 2008 +0000
+++ b/src/utilops.c	Sat Jun 07 09:36:12 2008 +0000
@@ -245,17 +245,14 @@
 		case FILEDATA_CHANGE_MOVE:
 			collection_maint_renamed(fd);
 
-			view_window_maint_moved(fd);
 			break;
 		case FILEDATA_CHANGE_COPY:
 			break;
 		case FILEDATA_CHANGE_RENAME:
 			collection_maint_renamed(fd);
 
-			view_window_maint_moved(fd);
 			break;
 		case FILEDATA_CHANGE_DELETE:
-			view_window_maint_removed(fd, NULL);
 
 			collection_maint_removed(fd);
 			break;