changeset 794:03614b7883ea

used new notification in dupe.c
author nadvornik
date Sat, 07 Jun 2008 07:45:08 +0000
parents baade53888be
children a31524ae39cb
files src/dupe.c src/dupe.h src/utilops.c
diffstat 3 files changed, 23 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/dupe.c	Fri Jun 06 22:34:15 2008 +0000
+++ b/src/dupe.c	Sat Jun 07 07:45:08 2008 +0000
@@ -82,6 +82,8 @@
 
 static void dupe_dnd_init(DupeWindow *dw);
 
+static void dupe_notify_cb(FileData *fd, NotifyType type, gpointer data);
+
 /*
  * ------------------------------------------------------------------
  * Window updates
@@ -3081,6 +3083,8 @@
 
 	dupe_list_free(dw->second_list);
 
+	file_data_unregister_notify_func(dupe_notify_cb, dw);
+
 	g_free(dw);
 }
 
@@ -3273,6 +3277,8 @@
 
 	dupe_window_list = g_list_append(dupe_window_list, dw);
 
+	file_data_register_notify_func(dupe_notify_cb, dw, NOTIFY_PRIORITY_MEDIUM);
+
 	return dw;
 }
 
@@ -3556,31 +3562,25 @@
  *-------------------------------------------------------------------
  */
 
-void dupe_maint_removed(FileData *fd)
+static void dupe_notify_cb(FileData *fd, NotifyType type, gpointer data)
 {
-	GList *work;
-
-	work = dupe_window_list;
-	while (work)
+	DupeWindow *dw = data;
+
+	if (!fd->change) return;
+	
+	switch(fd->change->type)
 		{
-		DupeWindow *dw = work->data;
-		work = work->next;
-
-		while (dupe_item_remove_by_path(dw, fd->path));
-		}
-}
-
-void dupe_maint_renamed(FileData *fd)
-{
-	GList *work;
-
-	work = dupe_window_list;
-	while (work)
-		{
-		DupeWindow *dw = work->data;
-		work = work->next;
-
-		dupe_item_update_fd(dw, fd);
+		case FILEDATA_CHANGE_MOVE:
+		case FILEDATA_CHANGE_RENAME:
+			dupe_item_update_fd(dw, fd);
+			break;
+		case FILEDATA_CHANGE_COPY:
+			break;
+		case FILEDATA_CHANGE_DELETE:
+			while (dupe_item_remove_by_path(dw, fd->path));
+			break;
+		case FILEDATA_CHANGE_UNSPECIFIED:
+			break;
 		}
 
 }
--- a/src/dupe.h	Fri Jun 06 22:34:15 2008 +0000
+++ b/src/dupe.h	Sat Jun 07 07:45:08 2008 +0000
@@ -120,10 +120,6 @@
 void dupe_window_add_collection(DupeWindow *dw, CollectionData *collection);
 void dupe_window_add_files(DupeWindow *dw, GList *list, gint recurse);
 
-void dupe_maint_removed(FileData *fd);
-void dupe_maint_renamed(FileData *fd);
-
-
 /* cell max with/height hack utility */
 void cell_renderer_height_override(GtkCellRenderer *renderer);
 
--- a/src/utilops.c	Fri Jun 06 22:34:15 2008 +0000
+++ b/src/utilops.c	Sat Jun 07 07:45:08 2008 +0000
@@ -247,7 +247,6 @@
 
 			layout_maint_moved(fd, NULL);
 			view_window_maint_moved(fd);
-			dupe_maint_renamed(fd);
 			search_maint_renamed(fd);
 			break;
 		case FILEDATA_CHANGE_COPY:
@@ -257,13 +256,11 @@
 
 			layout_maint_renamed(fd);
 			view_window_maint_moved(fd);
-			dupe_maint_renamed(fd);
 			search_maint_renamed(fd);
 			break;
 		case FILEDATA_CHANGE_DELETE:
 			layout_maint_removed(fd, NULL);
 			view_window_maint_removed(fd, NULL);
-			dupe_maint_removed(fd);
 			search_maint_removed(fd);
 
 			collection_maint_removed(fd);