SF.net SVN: geany:[4914] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sat May 15 11:57:41 UTC 2010
Revision: 4914
http://geany.svn.sourceforge.net/geany/?rev=4914&view=rev
Author: eht16
Date: 2010-05-15 11:57:40 +0000 (Sat, 15 May 2010)
Log Message:
-----------
Remove old code.
Pass and use also parent and title arguments to win32_show_document_open_dialog().
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/win32.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-05-15 11:47:22 UTC (rev 4913)
+++ trunk/ChangeLog 2010-05-15 11:57:40 UTC (rev 4914)
@@ -3,6 +3,10 @@
* src/win32.c:
Sort file filters for the native Windows file open dialog by name.
Don't use file filters for the native Windows Save As dialog.
+ * src/dialogs.c, src/win32.c, src/win32.h:
+ Remove old code.
+ Pass and use also parent and title arguments to
+ win32_show_document_open_dialog().
2010-05-15 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Modified: trunk/src/win32.c
===================================================================
--- trunk/src/win32.c 2010-05-15 11:47:22 UTC (rev 4913)
+++ trunk/src/win32.c 2010-05-15 11:57:40 UTC (rev 4914)
@@ -339,19 +339,23 @@
/* initial_dir can be NULL to use the current working directory.
* Returns: TRUE if the dialog was not cancelled. */
-gboolean win32_show_document_open_dialog(gboolean file_open, const gchar *initial_dir)
+gboolean win32_show_document_open_dialog(GtkWindow *parent, const gchar *title, const gchar *initial_dir)
{
OPENFILENAMEW of;
gint retval;
+ guint x;
gchar tmp[MAX_PATH];
wchar_t fname[MAX_PATH];
wchar_t w_dir[MAX_PATH];
+ wchar_t w_title[512];
fname[0] = '\0';
if (initial_dir != NULL)
MultiByteToWideChar(CP_UTF8, 0, initial_dir, -1, w_dir, sizeof(w_dir));
+ MultiByteToWideChar(CP_UTF8, 0, title, -1, w_title, sizeof(w_title));
+
/* initialise file dialog info struct */
memset(&of, 0, sizeof of);
#ifdef OPENFILENAME_SIZE_VERSION_400
@@ -359,7 +363,7 @@
#else
of.lStructSize = sizeof of;
#endif
- of.hwndOwner = GDK_WINDOW_HWND(main_widgets.window->window);
+ of.hwndOwner = GDK_WINDOW_HWND(GTK_WIDGET(parent)->window);
of.lpstrFilter = get_file_filters();
of.lpstrCustomFilter = NULL;
@@ -368,19 +372,12 @@
of.lpstrInitialDir = (initial_dir != NULL) ? w_dir : NULL;
of.nMaxFile = 2048;
of.lpstrFileTitle = NULL;
- of.lpstrTitle = NULL;
+ of.lpstrTitle = w_title;
of.lpstrDefExt = L"";
- if (file_open)
- {
- of.Flags = OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST | OFN_EXPLORER;
- retval = GetOpenFileNameW(&of);
- }
- else
- {
- of.Flags = OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST;
- retval = GetSaveFileNameW(&of);
- }
+ of.Flags = OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST | OFN_EXPLORER;
+ retval = GetOpenFileNameW(&of);
+
if (!retval)
{
if (CommDlgExtendedError())
@@ -392,48 +389,36 @@
return FALSE;
}
- if (file_open)
- {
- guint x;
+ x = of.nFileOffset - 1;
+ if (x != wcslen(fname))
+ { /* open a single file */
+ WideCharToMultiByte(CP_UTF8, 0, fname, -1, tmp, sizeof(tmp), NULL, NULL);
+ document_open_file(tmp, of.Flags & OFN_READONLY, NULL, NULL);
+ }
+ else
+ { /* open multiple files */
+ gchar file_name[MAX_PATH];
+ gchar dir_name[MAX_PATH];
- x = of.nFileOffset - 1;
- if (x != wcslen(fname))
- { /* open a single file */
- WideCharToMultiByte(CP_UTF8, 0, fname, -1, tmp, sizeof(tmp), NULL, NULL);
- document_open_file(tmp, of.Flags & OFN_READONLY, NULL, NULL);
- }
- else
- { /* open multiple files */
- gchar file_name[MAX_PATH];
- gchar dir_name[MAX_PATH];
-
- WideCharToMultiByte(CP_UTF8, 0, fname, of.nFileOffset,
- dir_name, sizeof(dir_name), NULL, NULL);
- for (; ;)
+ WideCharToMultiByte(CP_UTF8, 0, fname, of.nFileOffset,
+ dir_name, sizeof(dir_name), NULL, NULL);
+ for (; ;)
+ {
+ if (! fname[x])
{
- if (! fname[x])
- {
- if (! fname[x + 1])
- break;
+ if (! fname[x + 1])
+ break;
- WideCharToMultiByte(CP_UTF8, 0, fname + x + 1, -1,
- tmp, sizeof(tmp), NULL, NULL);
- g_snprintf(file_name, 511, "%s\\%s", dir_name, tmp);
+ WideCharToMultiByte(CP_UTF8, 0, fname + x + 1, -1,
+ tmp, sizeof(tmp), NULL, NULL);
+ g_snprintf(file_name, 511, "%s\\%s", dir_name, tmp);
- /* convert the resulting filename into UTF-8 */
- document_open_file(file_name, of.Flags & OFN_READONLY, NULL, NULL);
- }
- x++;
+ /* convert the resulting filename into UTF-8 */
+ document_open_file(file_name, of.Flags & OFN_READONLY, NULL, NULL);
}
+ x++;
}
}
- else
- {
- GeanyDocument *doc = document_get_current();
-
- WideCharToMultiByte(CP_UTF8, 0, fname, -1, tmp, sizeof(tmp), NULL, NULL);
- document_save_file_as(doc, tmp);
- }
return (retval != 0);
}
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