Kaydet (Commit) a80bab9e authored tarafından Nick Treleaven's avatar Nick Treleaven

Use GTK unsaved file dialog on Windows too because the button names

should be specific.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/unstable@5941 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst b4bdd530
......@@ -3,6 +3,9 @@
* src/build.c:
Use #ifdef SYNC_SPAWN instead of G_OS_WIN32 for easier testing with
glib's asynchronous spawning (currently doesn't work on Windows).
* src/win32.c, src/win32.h, src/dialogs.c:
Use GTK unsaved file dialog on Windows too because the button names
should be specific.
2011-09-20 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
......
......@@ -804,7 +804,6 @@ void dialogs_show_msgbox_with_secondary(GtkMessageType type, const gchar *text,
}
#ifndef G_OS_WIN32
static gint run_unsaved_dialog(const gchar *msg, const gchar *msg2)
{
GtkWidget *dialog, *button;
......@@ -812,6 +811,7 @@ static gint run_unsaved_dialog(const gchar *msg, const gchar *msg2)
dialog = gtk_message_dialog_new(GTK_WINDOW(main_widgets.window), GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", msg);
gtk_window_set_title(GTK_WINDOW(dialog), _("Question"));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s", msg2);
gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
......@@ -828,7 +828,6 @@ static gint run_unsaved_dialog(const gchar *msg, const gchar *msg2)
return ret;
}
#endif
gboolean dialogs_show_unsaved_file(GeanyDocument *doc)
......@@ -851,12 +850,7 @@ gboolean dialogs_show_unsaved_file(GeanyDocument *doc)
msg2 = _("Do you want to save it before closing?");
g_free(short_fn);
#ifdef G_OS_WIN32
setptr(msg, g_strconcat(msg, "\n", msg2, NULL));
ret = win32_message_dialog_unsaved(msg);
#else
ret = run_unsaved_dialog(msg, msg2);
#endif
g_free(msg);
switch (ret)
......
......@@ -735,33 +735,6 @@ gint win32_check_write_permission(const gchar *dir)
}
/* Special dialog to ask for an action when closing an unsaved file */
gint win32_message_dialog_unsaved(const gchar *msg)
{
static wchar_t w_msg[512];
static wchar_t w_title[512];
HWND parent_hwnd = NULL;
gint ret;
/* convert the Unicode chars to wide chars */
MultiByteToWideChar(CP_UTF8, 0, msg, -1, w_msg, G_N_ELEMENTS(w_msg));
MultiByteToWideChar(CP_UTF8, 0, _("Question"), -1, w_title, G_N_ELEMENTS(w_title));
if (main_widgets.window != NULL)
parent_hwnd = GDK_WINDOW_HWND(main_widgets.window->window);
ret = MessageBoxW(parent_hwnd, w_msg, w_title, MB_YESNOCANCEL | MB_ICONQUESTION);
switch (ret)
{
case IDYES: ret = GTK_RESPONSE_YES; break;
case IDNO: ret = GTK_RESPONSE_NO; break;
case IDCANCEL: ret = GTK_RESPONSE_CANCEL; break;
}
return ret;
}
/* Just a simple wrapper function to open a browser window */
void win32_open_browser(const gchar *uri)
{
......
......@@ -40,8 +40,6 @@ void win32_show_color_dialog(const gchar *colour);
gboolean win32_message_dialog(GtkWidget *parent, GtkMessageType type, const gchar *msg);
gint win32_message_dialog_unsaved(const gchar *msg);
void win32_open_browser(const gchar *uri);
gchar *win32_show_project_open_dialog(GtkWidget *parent, const gchar *title,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment