changeset 596:f8c93e1d728d

use some of the new functions in filedata.c
author nadvornik
date Tue, 06 May 2008 20:24:16 +0000
parents 15766932414c
children 5da092a6a92a
files src/filedata.c src/filedata.h src/utilops.c src/view_file_list.c
diffstat 4 files changed, 24 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/src/filedata.c	Tue May 06 17:00:55 2008 +0000
+++ b/src/filedata.c	Tue May 06 20:24:16 2008 +0000
@@ -440,19 +440,6 @@
 	return strncmp(fd1->name, fd2->name, len1);
 }
 
-void file_data_do_change(FileData *fd)
-{
-//FIXME sidecars
-	g_assert(fd->change);
-	g_free(fd->path);
-	g_hash_table_remove(file_data_pool, fd->original_path);
-	g_free(fd->original_path);
-	file_data_set_path(fd, fd->change->dest);
-	fd->original_path = g_strdup(fd->change->dest);
-	g_hash_table_insert(file_data_pool, fd->original_path, fd);
-
-}
-
 gboolean file_data_add_change_info(FileData *fd, FileDataChangeType type, const gchar *src, const gchar *dest)
 {
 
@@ -523,23 +510,6 @@
 	return 0;
 }
 
-gchar *sidecar_file_data_list_to_string(FileData *fd)
-{
-	GList *work;
-	GString *result = g_string_new("");
-
-	work = fd->sidecar_files;
-	while (work)
-		{
-		FileData *sfd = work->data;
-		result = g_string_append(result, "+ ");
-		result = g_string_append(result, sfd->extension);
-		work = work->next;
-		if (work) result = g_string_append_c(result, ' ');
-		}
-
-	return g_string_free(result, FALSE);
-}
 
 /*
  *-----------------------------------------------------------------------------
@@ -897,7 +867,23 @@
 
 
 /* return list of sidecar file extensions in a string */
-gchar *file_data_sc_list_to_string(FileData *fd); // now gchar *sidecar_file_data_list_to_string(FileData *fd)
+gchar *file_data_sc_list_to_string(FileData *fd)
+{
+	GList *work;
+	GString *result = g_string_new("");
+
+	work = fd->sidecar_files;
+	while (work)
+		{
+		FileData *sfd = work->data;
+		result = g_string_append(result, "+ ");
+		result = g_string_append(result, sfd->extension);
+		work = work->next;
+		if (work) result = g_string_append_c(result, ' ');
+		}
+
+	return g_string_free(result, FALSE);
+}
 
 
 /* disables / enables grouping for particular file, sends UPDATE notification */
@@ -1173,7 +1159,7 @@
 		case FILEDATA_CHANGE_DELETE:
 			return file_data_perform_delete(fd);
 		case FILEDATA_CHANGE_UPDATE:
-			/* notring to do here */
+			/* nothing to do here */
 			break;
 		}
 	return TRUE;
@@ -1218,7 +1204,7 @@
 		}
 }
 
-gint file_data_sc_apply_ci(FileData *fd) // now file_data_do_change
+gint file_data_sc_apply_ci(FileData *fd)
 {
 	GList *work;
 	FileDataChangeType type = fd->change->type;
--- a/src/filedata.h	Tue May 06 17:00:55 2008 +0000
+++ b/src/filedata.h	Tue May 06 20:24:16 2008 +0000
@@ -24,12 +24,9 @@
 FileData *file_data_ref(FileData *fd);
 void file_data_unref(FileData *fd);
 
-void file_data_do_change(FileData *fd);
 gboolean file_data_add_change_info(FileData *fd, FileDataChangeType type, const gchar *src, const gchar *dest);
 void file_data_change_info_free(FileDataChangeInfo *fdci, FileData *fd);
 
-gchar *sidecar_file_data_list_to_string(FileData *fd);
-
 gint filelist_sort_compare_filedata(FileData *fa, FileData *fb);
 gint filelist_sort_compare_filedata_full(FileData *fa, FileData *fb, SortType method, gint ascend);
 GList *filelist_sort(GList *list, SortType method, gint ascend);
--- a/src/utilops.c	Tue May 06 17:00:55 2008 +0000
+++ b/src/utilops.c	Tue May 06 20:24:16 2008 +0000
@@ -396,7 +396,7 @@
 		FileData *fd = list->data;
 		if (!(flags & EDITOR_ERROR_MASK))
 			{
-			file_data_do_change(fd);
+			file_data_sc_apply_ci(fd);
 			file_maint_moved(fd, NULL);
 			}
 		file_data_change_info_free(NULL, fd);
@@ -421,7 +421,7 @@
 
 	if (ok)
 		{
-		file_data_do_change(fd);
+		file_data_sc_apply_ci(fd);
 		file_maint_moved(fd, NULL);
 		}
 
@@ -445,7 +445,7 @@
 		FileData *fd = list->data;
 		if (!(flags & EDITOR_ERROR_MASK))
 			{
-			file_data_do_change(fd);
+			file_data_sc_apply_ci(fd);
 			file_maint_renamed(fd);
 			}
 		file_data_change_info_free(NULL, fd);
@@ -468,7 +468,7 @@
 
 	if (ok)
 		{
-		file_data_do_change(fd);
+		file_data_sc_apply_ci(fd);
 		file_maint_renamed(fd);
 		}
 
--- a/src/view_file_list.c	Tue May 06 17:00:55 2008 +0000
+++ b/src/view_file_list.c	Tue May 06 20:24:16 2008 +0000
@@ -962,7 +962,7 @@
 	gchar *sidecars = NULL;
 
 	if (fd->sidecar_files)
-		sidecars = sidecar_file_data_list_to_string(fd);
+		sidecars = file_data_sc_list_to_string(fd);
 	size = text_from_size(fd->size);
 
 	gtk_tree_store_set(store, iter, FILE_COLUMN_POINTER, fd,