changeset 787:a2209b1f769d

use new notification in vficon
author nadvornik
date Thu, 05 Jun 2008 18:43:44 +0000
parents a20ff446347e
children 477dba06deb6
files src/layout.c src/view_file.c src/view_file.h src/view_file_icon.c src/view_file_icon.h src/view_file_list.h
diffstat 6 files changed, 42 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/layout.c	Thu Jun 05 09:24:42 2008 +0000
+++ b/src/layout.c	Thu Jun 05 18:43:44 2008 +0000
@@ -2016,7 +2016,7 @@
 {
 	if (lw->image) layout_image_maint_renamed(lw, fd);
 
-	if (lw->vf && vf_maint_renamed(lw->vf, fd))
+//	if (lw->vf && vf_maint_renamed(lw->vf, fd))
 		layout_real_time_update(lw);
 		
 }
@@ -2025,7 +2025,7 @@
 {
 	if (lw->image) layout_image_maint_removed(lw, fd);
 
-	if (lw->vf && vf_maint_removed(lw->vf, fd, ignore_list))
+//	if (lw->vf && vf_maint_removed(lw->vf, fd, ignore_list))
 		layout_real_time_update(lw);
 }
 
@@ -2033,7 +2033,7 @@
 {
 	if (lw->image) layout_image_maint_moved(lw, fd);
 
-	if (lw->vf && vf_maint_moved(lw->vf, fd, ignore_list))
+//	if (lw->vf && vf_maint_moved(lw->vf, fd, ignore_list))
 		layout_real_time_update(lw);
 }
 
--- a/src/view_file.c	Thu Jun 05 09:24:42 2008 +0000
+++ b/src/view_file.c	Thu Jun 05 18:43:44 2008 +0000
@@ -742,12 +742,14 @@
 	vf->layout = layout;
 }
 
+#if 0
 /*
  *-----------------------------------------------------------------------------
  * maintenance (for rename, move, remove)
  *-----------------------------------------------------------------------------
  */
 
+
 gint vf_maint_renamed(ViewFile *vf, FileData *fd)
 {
 	gint ret = FALSE;
@@ -786,3 +788,4 @@
 
 	return ret;
 }
+#endif
\ No newline at end of file
--- a/src/view_file.h	Thu Jun 05 09:24:42 2008 +0000
+++ b/src/view_file.h	Thu Jun 05 18:43:44 2008 +0000
@@ -61,9 +61,4 @@
 void vf_select_marked(ViewFile *vf, gint mark);
 void vf_mark_selected(ViewFile *vf, gint mark, gint value);
 
-gint vf_maint_renamed(ViewFile *vf, FileData *fd);
-gint vf_maint_removed(ViewFile *vf, FileData *fd, GList *ignore_list);
-gint vf_maint_moved(ViewFile *vf, FileData *fd, GList *ignore_list);
-
-
 #endif /* VIEW_FILE_H */
--- a/src/view_file_icon.c	Thu Jun 05 09:24:42 2008 +0000
+++ b/src/view_file_icon.c	Thu Jun 05 18:43:44 2008 +0000
@@ -65,6 +65,7 @@
 	FileData *fd;
 };
 
+static void vficon_notify_cb(FileData *fd, gpointer data);
 static gint vficon_index_by_id(ViewFile *vf, IconData *in_id);
 
 static IconData *vficon_icon_data(ViewFile *vf, FileData *fd)
@@ -2233,6 +2234,8 @@
 	ViewFile *vf = data;
 
 	if (VFICON_INFO(vf, sync_idle_id) != -1) g_source_remove(VFICON_INFO(vf, sync_idle_id));
+	
+	file_data_unregister_notify_func(vficon_notify_cb, vf);
 
 	tip_unschedule(vf);
 
@@ -2298,6 +2301,8 @@
 	/* force VFICON_INFO(vf, columns) to be at least 1 (sane) - this will be corrected in the size_cb */
 	vficon_populate_at_new_size(vf, 1, 1, FALSE);
 
+	file_data_register_notify_func(vficon_notify_cb, vf);
+
 	return vf;
 }
 
@@ -2369,7 +2374,10 @@
 		}
 }
 
-gint vficon_maint_renamed(ViewFile *vf, FileData *fd)
+static gint vficon_maint_removed(ViewFile *vf, FileData *fd, GList *ignore_list);
+
+
+static gint vficon_maint_renamed(ViewFile *vf, FileData *fd)
 {
 	gint ret = FALSE;
 	gint row;
@@ -2404,7 +2412,7 @@
 	return ret;
 }
 
-gint vficon_maint_removed(ViewFile *vf, FileData *fd, GList *ignore_list)
+static gint vficon_maint_removed(ViewFile *vf, FileData *fd, GList *ignore_list)
 {
 	gint row;
 	gint new_row = -1;
@@ -2530,7 +2538,7 @@
 	return TRUE;
 }
 
-gint vficon_maint_moved(ViewFile *vf, FileData *fd, GList *ignore_list)
+static gint vficon_maint_moved(ViewFile *vf, FileData *fd, GList *ignore_list)
 {
 	gint ret = FALSE;
 	gchar *buf;
@@ -2548,3 +2556,28 @@
 
 	return ret;
 }
+
+static void vficon_notify_cb(FileData *fd, gpointer data)
+{
+	ViewFile *vf = data;
+
+	if (!fd->change) return;
+	
+	switch(fd->change->type)
+		{
+		case FILEDATA_CHANGE_MOVE:
+			vficon_maint_moved(vf, fd, NULL);
+			break;
+		case FILEDATA_CHANGE_COPY:
+			break;
+		case FILEDATA_CHANGE_RENAME:
+			vficon_maint_renamed(vf, fd);
+			break;
+		case FILEDATA_CHANGE_DELETE:
+			vficon_maint_removed(vf, fd, NULL);
+			break;
+		case FILEDATA_CHANGE_UNSPECIFIED:
+			break;
+		}
+
+}
--- a/src/view_file_icon.h	Thu Jun 05 09:24:42 2008 +0000
+++ b/src/view_file_icon.h	Thu Jun 05 18:43:44 2008 +0000
@@ -53,9 +53,4 @@
 void vficon_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode);
 void vficon_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode);
 
-gint vficon_maint_renamed(ViewFile *vf, FileData *fd);
-gint vficon_maint_removed(ViewFile *vf, FileData *fd, GList *ignore_list);
-gint vficon_maint_moved(ViewFile *vf, FileData *fd, GList *ignore_list);
-
-
 #endif
--- a/src/view_file_list.h	Thu Jun 05 09:24:42 2008 +0000
+++ b/src/view_file_list.h	Thu Jun 05 18:43:44 2008 +0000
@@ -60,13 +60,6 @@
 void vflist_select_marked(ViewFile *vf, gint mark);
 void vflist_mark_selected(ViewFile *vf, gint mark, gint value);
 
-/*
-gint vflist_maint_renamed(ViewFile *vf, FileData *fd);
-gint vflist_maint_removed(ViewFile *vf, FileData *fd, GList *ignore_list);
-gint vflist_maint_moved(ViewFile *vf, FileData *fd, GList *ignore_list);
-*/
-
 void vflist_color_set(ViewFile *vf, FileData *fd, gint color_set);
 
-
 #endif