[PATCH] Fix template duplicate numbering



From bug 307252 [1]:

"when having more than on template on the desktop makes numbering silly.
It puts the number in mime type, eg. text.txt, text.txt 1, text.txt 2
etc. It breaks the file assoiation."

Proposed patch attached.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=307252

-- 
Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-file-operations.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file-operations.c,v
retrieving revision 1.191
diff -u -p -r1.191 nautilus-file-operations.c
--- libnautilus-private/nautilus-file-operations.c	1 Jul 2005 15:39:07 -0000	1.191
+++ libnautilus-private/nautilus-file-operations.c	2 Jul 2005 15:01:54 -0000
@@ -2284,6 +2284,7 @@ new_file_transfer_callback (GnomeVFSAsyn
 {
 	NewFileTransferState *state;
 	char *temp_string;
+	char **temp_strings;
 	char *uri;
 	
 	state = (NewFileTransferState *) data;
@@ -2329,10 +2330,20 @@ new_file_transfer_callback (GnomeVFSAsyn
 					 progress_info->duplicate_name,
 					 progress_info->duplicate_count);
 			} else {
-				progress_info->duplicate_name = g_strdup_printf
-					("%s%%20%d", 
-					 progress_info->duplicate_name,
-					 progress_info->duplicate_count);
+				temp_strings = g_strsplit (temp_string, ".", 2);
+				if (temp_strings[1] != NULL) {
+					progress_info->duplicate_name = g_strdup_printf
+						("%s%%20%d.%s", 
+						 temp_strings[0],
+						 progress_info->duplicate_count,
+						 temp_strings[1]);
+				} else {
+					progress_info->duplicate_name = g_strdup_printf
+						("%s%%20%d", 
+						 progress_info->duplicate_name,
+						 progress_info->duplicate_count);
+				}
+				g_strfreev (temp_strings);
 			}
 			g_free (temp_string);
 			return GNOME_VFS_XFER_ERROR_ACTION_SKIP;

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]