SF.net SVN: geany: [2238] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Fri Feb 8 11:19:46 UTC 2008
Revision: 2238
http://geany.svn.sourceforge.net/geany/?rev=2238&view=rev
Author: eht16
Date: 2008-02-08 03:19:45 -0800 (Fri, 08 Feb 2008)
Log Message:
-----------
Fix crash on Windows when a project could not be opened. Remove prefix from win32_get_file_filters() and win32_get_filters(). Fix some encoding problems with filenames retrieved from the native Windows file dialogs.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/project.c
trunk/src/win32.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-02-07 20:53:20 UTC (rev 2237)
+++ trunk/ChangeLog 2008-02-08 11:19:45 UTC (rev 2238)
@@ -1,3 +1,13 @@
+2008-02-08 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/project.c:
+ Fix crash on Windows when a project could not be opened.
+ * src/win32.c:
+ Remove prefix from win32_get_file_filters() and win32_get_filters().
+ Fix some encoding problems with filenames retrieved from the native
+ Windows file dialogs.
+
+
2008-02-07 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* plugins/Makefile.am: Fix typo (thanks Slava Semushin for reporting).
Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c 2008-02-07 20:53:20 UTC (rev 2237)
+++ trunk/src/project.c 2008-02-08 11:19:45 UTC (rev 2238)
@@ -247,7 +247,7 @@
{
SHOW_ERR1(_("Project file \"%s\" could not be loaded."), file);
}
- if (project_prefs.project_session)
+ else if (project_prefs.project_session)
{
configuration_open_files();
// open a new file if no other file was opened
Modified: trunk/src/win32.c
===================================================================
--- trunk/src/win32.c 2008-02-07 20:53:20 UTC (rev 2237)
+++ trunk/src/win32.c 2008-02-08 11:19:45 UTC (rev 2238)
@@ -56,7 +56,7 @@
-static gchar *win32_get_file_filters()
+static gchar *get_file_filters()
{
gchar *string;
gint i, j, len;
@@ -97,7 +97,7 @@
}
-static gchar *win32_get_filters(gboolean project_files)
+static gchar *get_filters(gboolean project_files)
{
gchar *string;
gint i, len;
@@ -188,7 +188,11 @@
// convert the strange Windows folder list item something into an usual path string ;-)
if (pidl != NULL && SHGetPathFromIDList(pidl, fname))
+ {
+ // convert the resulting filename into UTF-8 (from whatever encoding it has at this moment)
+ setptr(fname, g_locale_to_utf8(fname, -1, NULL, NULL, NULL));
return fname;
+ }
else
{
g_free(fname);
@@ -209,7 +213,7 @@
OPENFILENAME of;
gint retval;
gchar *fname = g_malloc(2048);
- gchar *filters = win32_get_filters(project_file_filter);
+ gchar *filters = get_filters(project_file_filter);
gchar *dir = get_dir(initial_dir);
fname[0] = '\0';
@@ -256,7 +260,8 @@
g_free(fname);
return NULL;
}
-
+ // convert the resulting filename into UTF-8 (from whatever encoding it has at this moment)
+ setptr(fname, g_locale_to_utf8(fname, -1, NULL, NULL, NULL));
return fname;
}
@@ -268,7 +273,7 @@
OPENFILENAME of;
gint retval;
gchar *fname = g_malloc(2048);
- gchar *filters = win32_get_file_filters();
+ gchar *filters = get_file_filters();
fname[0] = '\0';
@@ -323,6 +328,10 @@
x = of.nFileOffset - 1;
if (x != strlen(fname))
{ // open a single file
+
+ // convert the resulting filename into UTF-8
+ setptr(fname, g_locale_to_utf8(fname, -1, NULL, NULL, NULL));
+
document_open_file(fname, of.Flags & OFN_READONLY, NULL, NULL);
}
else
@@ -333,10 +342,15 @@
{
if (! fname[x])
{
+ gchar *utf8_filename;
if (! fname[x+1]) break;
g_snprintf(file_name, 254, "%s\\%s", fname, fname + x + 1);
- document_open_file(file_name, of.Flags & OFN_READONLY, NULL, NULL);
+
+ // convert the resulting filename into UTF-8
+ utf8_filename = g_locale_to_utf8(file_name, -1, NULL, NULL, NULL);
+ document_open_file(utf8_filename, of.Flags & OFN_READONLY, NULL, NULL);
+ g_free(utf8_filename);
}
x++;
}
@@ -346,7 +360,8 @@
else
{
gint idx = document_get_cur_idx();
- doc_list[idx].file_name = g_strdup(fname);
+ // convert the resulting filename into UTF-8
+ doc_list[idx].file_name = g_locale_to_utf8(fname, -1, NULL, NULL, NULL);
document_save_file(idx, TRUE);
}
g_free(fname);
@@ -424,7 +439,7 @@
gint retval;
gchar *fname = g_malloc(512);
gchar **field, *filename, *tmp;
- gchar *filters = win32_get_filters(FALSE);
+ gchar *filters = get_filters(FALSE);
fname[0] = '\0';
@@ -457,7 +472,7 @@
of.lpstrInitialDir = NULL;
of.lpstrTitle = NULL;
of.lpstrDefExt = "exe";
- of.Flags = OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_EXPLORER;
+ of.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_EXPLORER;
retval = GetOpenFileName(&of);
g_free(filters);
@@ -479,7 +494,8 @@
{
tmp = g_strdup(fname);
if (g_strv_length(field) > 1)
- // haha, pfad- und dateinamen mit leerzeichen??
+ // add the command line args of the old command
+ /// TODO this fails badly when the old command contained spaces, we need quoting here
filename = g_strconcat(tmp, " ", field[1], NULL);
else
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list