You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.1 KiB

diff --git a/src/gldit/cairo-dock-utils.c b/src/gldit/cairo-dock-utils.c
index 76b6d6c6..3b05d22a 100644
--- a/src/gldit/cairo-dock-utils.c
+++ b/src/gldit/cairo-dock-utils.c
@@ -35,14 +35,20 @@ gchar *cairo_dock_generate_unique_filename (const gchar *cBaseName, const gchar
do
{
iPrefixNumber ++;
- g_string_printf (sFileName, "%s/%02d%s", cCairoDockDataDir, iPrefixNumber, cBaseName);
- } while (iPrefixNumber < 99 && g_file_test (sFileName->str, G_FILE_TEST_EXISTS));
+ if (iPrefixNumber < 100)
+ g_string_printf (sFileName, "%s/%02d%s", cCairoDockDataDir, iPrefixNumber, cBaseName);
+ else
+ g_string_printf (sFileName, "%s/%03d%s", cCairoDockDataDir, iPrefixNumber, cBaseName);
+
+ } while (iPrefixNumber < 1000 && g_file_test (sFileName->str, G_FILE_TEST_EXISTS));
g_string_free (sFileName, TRUE);
- if (iPrefixNumber == 99)
+ if (iPrefixNumber < 100)
+ return g_strdup_printf ("%02d%s", iPrefixNumber, cBaseName);
+ if (iPrefixNumber == 1000)
return NULL;
else
- return g_strdup_printf ("%02d%s", iPrefixNumber, cBaseName);
+ return g_strdup_printf ("%03d%s", iPrefixNumber, cBaseName);
}