Revision: 980 http://svn.sourceforge.net/geany/?rev=980&view=rev Author: ntrel Date: 2006-11-09 07:52:31 -0800 (Thu, 09 Nov 2006)
Log Message: ----------- Fix a possible bug with g_file_test when opening files at startup. Show warning message on status bar if some session files couldn't be loaded, showing debug messages for each session file that fails.
Modified Paths: -------------- trunk/ChangeLog trunk/src/keyfile.c trunk/src/main.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-11-08 21:35:05 UTC (rev 979) +++ trunk/ChangeLog 2006-11-09 15:52:31 UTC (rev 980) @@ -1,5 +1,13 @@ -2006-11-07 Nick Treleaven nick.treleaven@btinternet.com +2006-11-09 Nick Treleaven nick.treleaven@btinternet.com
+ * src/keyfile.c, src/main.c: + Fix a possible bug with g_file_test when opening files at startup. + Show warning message on status bar if some session files couldn't be + loaded, showing debug messages for each session file that fails. + + +2006-11-08 Nick Treleaven nick.treleaven@btinternet.com + * src/utils.c, src/highlighting.c, src/utils.h, src/callbacks.c, src/sci_cb.c, src/document.c, src/symbols.c, src/ui_utils.c, src/symbols.h:
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2006-11-08 21:35:05 UTC (rev 979) +++ trunk/src/keyfile.c 2006-11-09 15:52:31 UTC (rev 980) @@ -40,6 +40,7 @@ #include "encodings.h" #include "vte.h" #include "main.h" +#include "msgwindow.h"
static gchar *scribble_text = NULL; @@ -485,7 +486,7 @@ gint i; guint x, pos, y, len; gchar *file, *locale_filename, **array, *tmp; - gboolean ret = FALSE; + gboolean ret = FALSE, failure = FALSE;
i = app->tab_order_ltr ? 0 : (session_files->len - 1); while (TRUE) @@ -516,12 +517,18 @@ // try to get the locale equivalent for the filename, fallback to filename if error locale_filename = utils_get_locale_from_utf8(file);
- if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR || G_FILE_TEST_IS_SYMLINK)) + if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK)) { filetype *ft = filetypes_get_from_uid(uid); document_open_file(-1, locale_filename, pos, FALSE, ft, NULL); ret = TRUE; } + else + { + failure = TRUE; + geany_debug("Could not find file '%s'.", file); + } + g_free(locale_filename); } g_free(tmp); @@ -539,6 +546,8 @@ }
g_ptr_array_free(session_files, TRUE); + if (failure) + msgwin_status_add(_("Failed to load one or more session files.")); return ret; }
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2006-11-08 21:35:05 UTC (rev 979) +++ trunk/src/main.c 2006-11-09 15:52:31 UTC (rev 980) @@ -581,7 +581,7 @@ gint i; for(i = 1; i < argc; i++) { - if (argv[i] && g_file_test(argv[i], G_FILE_TEST_IS_REGULAR || G_FILE_TEST_IS_SYMLINK)) + if (argv[i] && g_file_test(argv[i], G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK)) { gchar *filename = get_argv_filename(argv[i]); document_open_file(-1, filename, 0, FALSE, NULL, NULL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.