changeset 795:a31524ae39cb

used new notification in search.c
author nadvornik
date Sat, 07 Jun 2008 08:13:22 +0000
parents 03614b7883ea
children 0be132a51f51
files src/search.c src/search.h src/utilops.c
diffstat 3 files changed, 19 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c	Sat Jun 07 07:45:08 2008 +0000
+++ b/src/search.c	Sat Jun 07 08:13:22 2008 +0000
@@ -237,6 +237,7 @@
 
 static void search_window_close(SearchData *sd);
 
+static void search_notify_cb(FileData *fd, NotifyType type, gpointer data);
 
 /*
  *-------------------------------------------------------------------
@@ -2530,6 +2531,8 @@
 	g_free(sd->search_similarity_path);
 	string_list_free(sd->search_keyword_list);
 
+	file_data_unregister_notify_func(search_notify_cb, sd);
+
 	g_free(sd);
 }
 
@@ -2817,6 +2820,8 @@
 
 	search_window_list = g_list_append(search_window_list, sd);
 
+	file_data_register_notify_func(search_notify_cb, sd, NOTIFY_PRIORITY_MEDIUM);
+
 	gtk_widget_show(sd->window);
 }
 
@@ -2859,21 +2864,21 @@
 		}
 }
 
-void search_maint_renamed(FileData *fd)
+static void search_notify_cb(FileData *fd, NotifyType type, gpointer data)
 {
-	GList *work;
-
-	work = search_window_list;
-	while (work)
+	SearchData *sd = data;
+
+	if (!fd->change) return;
+	
+	switch(fd->change->type)
 		{
-		SearchData *sd = work->data;
-		work = work->next;
-
-		search_result_change_path(sd, fd);
+		case FILEDATA_CHANGE_MOVE:
+		case FILEDATA_CHANGE_RENAME:
+		case FILEDATA_CHANGE_DELETE:
+			search_result_change_path(sd, fd);
+			break;
+		case FILEDATA_CHANGE_COPY:
+		case FILEDATA_CHANGE_UNSPECIFIED:
+			break;
 		}
 }
-
-void search_maint_removed(FileData *fd)
-{
-	search_maint_renamed(fd);
-}
--- a/src/search.h	Sat Jun 07 07:45:08 2008 +0000
+++ b/src/search.h	Sat Jun 07 08:13:22 2008 +0000
@@ -18,8 +18,4 @@
 void search_new(FileData *dir_fd, FileData *example_file);
 
 
-void search_maint_renamed(FileData *fd);
-void search_maint_removed(FileData *fd);
-
-
 #endif
--- a/src/utilops.c	Sat Jun 07 07:45:08 2008 +0000
+++ b/src/utilops.c	Sat Jun 07 08:13:22 2008 +0000
@@ -247,7 +247,6 @@
 
 			layout_maint_moved(fd, NULL);
 			view_window_maint_moved(fd);
-			search_maint_renamed(fd);
 			break;
 		case FILEDATA_CHANGE_COPY:
 			break;
@@ -256,12 +255,10 @@
 
 			layout_maint_renamed(fd);
 			view_window_maint_moved(fd);
-			search_maint_renamed(fd);
 			break;
 		case FILEDATA_CHANGE_DELETE:
 			layout_maint_removed(fd, NULL);
 			view_window_maint_removed(fd, NULL);
-			search_maint_removed(fd);
 
 			collection_maint_removed(fd);
 			break;