SF.net SVN: geany:[5941] branches/unstable

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Sep 21 15:35:39 UTC 2011


Revision: 5941
          http://geany.svn.sourceforge.net/geany/?rev=5941&view=rev
Author:   ntrel
Date:     2011-09-21 15:35:38 +0000 (Wed, 21 Sep 2011)
Log Message:
-----------
Use GTK unsaved file dialog on Windows too because the button names 
should be specific.

Modified Paths:
--------------
    branches/unstable/ChangeLog
    branches/unstable/src/dialogs.c
    branches/unstable/src/win32.c
    branches/unstable/src/win32.h

Modified: branches/unstable/ChangeLog
===================================================================
--- branches/unstable/ChangeLog	2011-09-21 13:47:37 UTC (rev 5940)
+++ branches/unstable/ChangeLog	2011-09-21 15:35:38 UTC (rev 5941)
@@ -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>

Modified: branches/unstable/src/dialogs.c
===================================================================
--- branches/unstable/src/dialogs.c	2011-09-21 13:47:37 UTC (rev 5940)
+++ branches/unstable/src/dialogs.c	2011-09-21 15:35:38 UTC (rev 5941)
@@ -804,7 +804,6 @@
 }
 
 
-#ifndef G_OS_WIN32
 static gint run_unsaved_dialog(const gchar *msg, const gchar *msg2)
 {
 	GtkWidget *dialog, *button;
@@ -812,6 +811,7 @@
 
 	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 @@
 
 	return ret;
 }
-#endif
 
 
 gboolean dialogs_show_unsaved_file(GeanyDocument *doc)
@@ -851,12 +850,7 @@
 	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)

Modified: branches/unstable/src/win32.c
===================================================================
--- branches/unstable/src/win32.c	2011-09-21 13:47:37 UTC (rev 5940)
+++ branches/unstable/src/win32.c	2011-09-21 15:35:38 UTC (rev 5941)
@@ -735,33 +735,6 @@
 }
 
 
-/* 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)
 {

Modified: branches/unstable/src/win32.h
===================================================================
--- branches/unstable/src/win32.h	2011-09-21 13:47:37 UTC (rev 5940)
+++ branches/unstable/src/win32.h	2011-09-21 15:35:38 UTC (rev 5941)
@@ -40,8 +40,6 @@
 
 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,

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