SF.net SVN: geany: [628] trunk/src

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Jul 25 12:44:49 UTC 2006


Revision: 628
Author:   eht16
Date:     2006-07-25 05:44:42 -0700 (Tue, 25 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=628&view=rev

Log Message:
-----------
Removed title argument from win32_message_dialog because it is defined by the dialog type.
Added simple wrapper function win32_open_browser().

Modified Paths:
--------------
    trunk/src/utils.c
    trunk/src/win32.c
    trunk/src/win32.h
Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2006-07-25 10:13:35 UTC (rev 627)
+++ trunk/src/utils.c	2006-07-25 12:44:42 UTC (rev 628)
@@ -48,6 +48,7 @@
 #include "treeviews.h"
 #include "sciwrappers.h"
 #include "dialogs.h"
+#include "win32.h"
 
 #include "utils.h"
 
@@ -57,7 +58,7 @@
 void utils_start_browser(const gchar *uri)
 {
 #ifdef GEANY_WIN32
-	ShellExecute(NULL, "open", uri, NULL, NULL, SW_SHOWNORMAL);
+	win32_open_browser(uri);
 #else
 	const gchar *argv[3];
 

Modified: trunk/src/win32.c
===================================================================
--- trunk/src/win32.c	2006-07-25 10:13:35 UTC (rev 627)
+++ trunk/src/win32.c	2006-07-25 12:44:42 UTC (rev 628)
@@ -130,7 +130,7 @@
 		{
 			gchar error[100];
 			snprintf(error, sizeof error, "File dialog box error (%x)", (int)CommDlgExtendedError());
-			win32_message_dialog(GTK_MESSAGE_ERROR, _("Error"), error);
+			win32_message_dialog(GTK_MESSAGE_ERROR, error);
 		}
 		g_free(fname);
 		return;
@@ -146,7 +146,9 @@
 		{	// open a single file
 			if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) >= GEANY_MAX_OPEN_FILES)
 			{
-				dialogs_show_file_open_error();
+				dialogs_show_error(
+			_("You have opened too many files. There is a limit of %d concurrent open files."),
+			GEANY_MAX_OPEN_FILES);
 			}
 			else
 			{
@@ -292,7 +294,7 @@
 		{
 			gchar error[100];
 			snprintf(error, sizeof error, "File dialog box error (%x)", (int)CommDlgExtendedError());
-			win32_message_dialog(GTK_MESSAGE_ERROR, _("Error"), error);
+			win32_message_dialog(GTK_MESSAGE_ERROR, error);
 		}
 		g_strfreev(field);
 		g_free(fname);
@@ -322,19 +324,35 @@
 /* Creates a native Windows message box of the given type and returns always TRUE
  * or FALSE representing th pressed Yes or No button.
  * If type is not GTK_MESSAGE_QUESTION, it returns always TRUE. */
-gboolean win32_message_dialog(GtkMessageType type, const gchar *title, const gchar *msg)
+gboolean win32_message_dialog(GtkMessageType type, const gchar *msg)
 {
 	gboolean ret = TRUE;
 	gint rc;
 	guint t;
+	const gchar *title;
 	static wchar_t w_msg[512];
 	static wchar_t w_title[512];
 
 	switch (type)
 	{
-		case GTK_MESSAGE_ERROR:		t = MB_OK | MB_ICONERROR; break;
-		case GTK_MESSAGE_QUESTION:	t = MB_YESNO | MB_ICONQUESTION; break;
-		default:					t = MB_OK | MB_ICONINFORMATION; break;
+		case GTK_MESSAGE_ERROR:
+		{
+			t = MB_OK | MB_ICONERROR;
+			title = _("Error");
+			break;
+		}
+		case GTK_MESSAGE_QUESTION:
+		{
+			t = MB_YESNO | MB_ICONQUESTION;
+			title = _("Question");
+			break;
+		}
+		default:
+		{
+			t = MB_OK | MB_ICONINFORMATION;
+			title = _("Information");
+			break;
+		}
 	}
 
 	// convert the Unicode chars to wide chars
@@ -353,16 +371,15 @@
 
 
 /* Special dialog to ask for an action when closing an unsaved file */
-gint win32_message_dialog_unsaved(const gchar *title, const gchar *msg)
+gint win32_message_dialog_unsaved(const gchar *msg)
 {
 	static wchar_t w_msg[512];
 	static wchar_t w_title[512];
 	gint ret;
 
 	// convert the Unicode chars to wide chars
-	/// TODO test if LANG == C then possibly skip conversion
 	MultiByteToWideChar(CP_UTF8, 0, msg, -1, w_msg, sizeof(w_msg)/sizeof(w_msg[0]));
-	MultiByteToWideChar(CP_UTF8, 0, title, -1, w_title, sizeof(w_title)/sizeof(w_title[0]));
+	MultiByteToWideChar(CP_UTF8, 0, _("Question"), -1, w_title, sizeof(w_title)/sizeof(w_title[0]));
 
 	ret = MessageBoxW(NULL, w_msg, w_title, MB_YESNOCANCEL | MB_ICONQUESTION);
 	switch(ret)
@@ -375,4 +392,10 @@
 	return ret;
 }
 
+/* Just a simple wrapper function to open a browser window */
+void win32_open_browser(const gchar *uri)
+{
+	ShellExecute(NULL, "open", uri, NULL, NULL, SW_SHOWNORMAL);
+}
+
 #endif

Modified: trunk/src/win32.h
===================================================================
--- trunk/src/win32.h	2006-07-25 10:13:35 UTC (rev 627)
+++ trunk/src/win32.h	2006-07-25 12:44:42 UTC (rev 628)
@@ -21,18 +21,9 @@
  */
 
 
-
 #ifdef GEANY_WIN32
 
 
-/*void set_app_font(const char *fontname);
-
-char *default_windows_menu_fontspec(void);
-
-void try_to_get_windows_font(void);
-*/
-//gchar *win32_get_filters(void);
-
 void win32_show_pref_file_dialog(GtkEntry *item);
 
 void win32_show_file_dialog(gboolean file_open);
@@ -44,9 +35,12 @@
 /* Creates a native Windows message box of the given type and returns always TRUE
  * or FALSE representing th pressed Yes or No button.
  * If type is not GTK_MESSAGE_QUESTION, it returns always TRUE. */
-gboolean win32_message_dialog(GtkMessageType type, const gchar *title, const gchar *msg);
+gboolean win32_message_dialog(GtkMessageType type, const gchar *msg);
 
 /* Special dialog to ask for an action when closing an unsaved file */
-gint win32_message_dialog_unsaved(const gchar *title, const gchar *msg);
+gint win32_message_dialog_unsaved(const gchar *msg);
 
+/* Just a simple wrapper function to open a browser window */
+void win32_open_browser(const gchar *uri);
+
 #endif


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