several improvements

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@209 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2006-02-22 00:41:57 +00:00
parent 86d1c102d4
commit 257b71ebd2

View File

@ -1,7 +1,7 @@
/* /*
* win32.c - this file is part of Geany, a fast and lightweight IDE * win32.c - this file is part of Geany, a fast and lightweight IDE
* *
* Copyright 2005 Enrico Troeger <enrico.troeger@uvena.de> * Copyright 2006 Enrico Troeger <enrico.troeger@uvena.de>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -132,7 +132,7 @@ void try_to_get_windows_font (void)
} }
*/ */
gchar *win32_get_filters(gboolean exe) static gchar *win32_get_filters(gboolean exe)
{ {
gchar *string = ""; gchar *string = "";
gint i, len; gint i, len;
@ -171,6 +171,7 @@ void win32_show_file_dialog(gboolean file_open)
OPENFILENAME of; OPENFILENAME of;
gint retval; gint retval;
gchar *fname = g_malloc(2048); gchar *fname = g_malloc(2048);
gchar *current_dir = utils_get_current_file_dir();
fname[0] = '\0'; fname[0] = '\0';
@ -187,12 +188,11 @@ void win32_show_file_dialog(gboolean file_open)
of.lpstrFilter = filters; of.lpstrFilter = filters;
of.lpstrCustomFilter = NULL; of.lpstrCustomFilter = NULL;
of.nFilterIndex = 1; of.nFilterIndex = GEANY_FILETYPES_ALL + 1;
of.lpstrFile = fname; of.lpstrFile = fname;
of.lpstrInitialDir = current_dir;
of.nMaxFile = 2048; of.nMaxFile = 2048;
of.lpstrFileTitle = NULL; of.lpstrFileTitle = NULL;
//of.lpstrInitialDir = g_get_home_dir();
of.lpstrInitialDir = NULL;
of.lpstrTitle = NULL; of.lpstrTitle = NULL;
of.lpstrDefExt = "c"; of.lpstrDefExt = "c";
if (file_open) if (file_open)
@ -206,6 +206,8 @@ void win32_show_file_dialog(gboolean file_open)
retval = GetSaveFileName(&of); retval = GetSaveFileName(&of);
} }
g_free(current_dir);
if (!retval) if (!retval)
{ {
if (CommDlgExtendedError()) if (CommDlgExtendedError())
@ -232,8 +234,7 @@ void win32_show_file_dialog(gboolean file_open)
} }
else else
{ {
document_open_file(-1, fname, 0, of.Flags & OFN_READONLY); document_open_file(-1, fname, 0, of.Flags & OFN_READONLY, NULL);
dialogs_show_info("%s", utils_btoa(of.Flags & OFN_READONLY));
} }
} }
else else
@ -247,7 +248,7 @@ void win32_show_file_dialog(gboolean file_open)
break; break;
g_snprintf(file_name, 254, "%s\\%s", fname, fname + x + 1); g_snprintf(file_name, 254, "%s\\%s", fname, fname + x + 1);
document_open_file(-1, file_name, 0, of.Flags & OFN_READONLY); document_open_file(-1, file_name, 0, of.Flags & OFN_READONLY, NULL);
} }
x++; x++;
} }
@ -255,7 +256,6 @@ void win32_show_file_dialog(gboolean file_open)
} }
else else
{ {
//dialogs_show_info(fname);
gint idx = document_get_cur_idx(); gint idx = document_get_cur_idx();
doc_list[idx].file_name = g_strdup(fname); doc_list[idx].file_name = g_strdup(fname);
document_save_file(idx); document_save_file(idx);
@ -386,7 +386,7 @@ void win32_show_pref_file_dialog(GtkEntry *item)
{ {
tmp = g_strdup(fname); tmp = g_strdup(fname);
if (g_strv_length(field) > 1) if (g_strv_length(field) > 1)
// haha, pfad- und dateinamen miz leerzeichen?? // haha, pfad- und dateinamen mit leerzeichen??
filename = g_strconcat(tmp, " ", field[1], NULL); filename = g_strconcat(tmp, " ", field[1], NULL);
else else
{ {