diff src/dupe.c @ 794:03614b7883ea

used new notification in dupe.c
author nadvornik
date Sat, 07 Jun 2008 07:45:08 +0000
parents a20ff446347e
children 764fd82dd099
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;
 		}
 
 }