SF.net SVN: geany:[4191] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Sep 15 18:00:33 UTC 2009


Revision: 4191
          http://geany.svn.sourceforge.net/geany/?rev=4191&view=rev
Author:   ntrel
Date:     2009-09-15 18:00:32 +0000 (Tue, 15 Sep 2009)

Log Message:
-----------
Show Find in Files stderr output in messages window instead of
debug window so that invalid regex messages can be seen easily.
Combine FIF stdout and stderr callback code.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/search.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-09-14 17:28:07 UTC (rev 4190)
+++ trunk/ChangeLog	2009-09-15 18:00:32 UTC (rev 4191)
@@ -1,3 +1,11 @@
+2009-09-15  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/search.c:
+   Show Find in Files stderr output in messages window instead of
+   debug window so that invalid regex messages can be seen easily.
+   Combine FIF stdout and stderr callback code.
+
+
 2009-09-14  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/utils.c:

Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c	2009-09-14 17:28:07 UTC (rev 4190)
+++ trunk/src/search.c	2009-09-15 18:00:32 UTC (rev 4191)
@@ -1480,12 +1480,11 @@
 }
 
 
-static gboolean search_read_io(GIOChannel *source, GIOCondition condition, gpointer data)
+static gboolean read_fif_io(GIOChannel *source, GIOCondition condition, gchar *enc, gint msg_color)
 {
 	if (condition & (G_IO_IN | G_IO_PRI))
 	{
 		gchar *msg, *utf8_msg;
-		gchar *enc = data;
 
 		while (g_io_channel_read_line(source, &msg, NULL, NULL, NULL) && msg)
 		{
@@ -1505,7 +1504,7 @@
 			else
 				utf8_msg = msg;
 
-			msgwin_msg_add_string(COLOR_BLACK, -1, NULL, utf8_msg);
+			msgwin_msg_add_string(msg_color, -1, NULL, utf8_msg);
 
 			if (utf8_msg != msg)
 				g_free(utf8_msg);
@@ -1519,42 +1518,15 @@
 }
 
 
-static gboolean search_read_io_stderr(GIOChannel *source, GIOCondition condition, gpointer data)
+static gboolean search_read_io(GIOChannel *source, GIOCondition condition, gpointer data)
 {
-	if (condition & (G_IO_IN | G_IO_PRI))
-	{
-		gchar *msg, *utf8_msg;
-		gchar *enc = data;
+	return read_fif_io(source, condition, data, COLOR_BLACK);
+}
 
-		while (g_io_channel_read_line(source, &msg, NULL, NULL, NULL) && msg)
-		{
-			utf8_msg = NULL;
 
-			g_strstrip(msg);
-			/* enc is NULL when encoding is set to UTF-8, so we can skip any conversion */
-			if (enc != NULL)
-			{
-				if (! g_utf8_validate(msg, -1, NULL))
-				{
-					utf8_msg = g_convert(msg, -1, "UTF-8", enc, NULL, NULL, NULL);
-				}
-				if (utf8_msg == NULL)
-					utf8_msg = msg;
-			}
-			else
-				utf8_msg = msg;
-
-			g_warning("Find in Files: %s", utf8_msg);
-
-			if (utf8_msg != msg)
-				g_free(utf8_msg);
-			g_free(msg);
-		}
-	}
-	if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL))
-		return FALSE;
-
-	return TRUE;
+static gboolean search_read_io_stderr(GIOChannel *source, GIOCondition condition, gpointer data)
+{
+	return read_fif_io(source, condition, data, COLOR_DARK_RED);
 }
 
 
@@ -1562,8 +1534,7 @@
 {
 	/* TODO: port this also to Windows API */
 #ifdef G_OS_UNIX
-	const gchar *msg = _("Search failed (see Help->Debug Messages for details).");
-	gint color = COLOR_DARK_RED;
+	const gchar *msg = _("Search failed.");
 	gint exit_status = 1;
 
 	if (WIFEXITED(status))
@@ -1592,9 +1563,8 @@
 		}
 		case 1:
 			msg = _("No matches found.");
-			color = COLOR_BLUE;
 		default:
-			msgwin_msg_add_string(color, -1, NULL, msg);
+			msgwin_msg_add_string(COLOR_BLUE, -1, NULL, msg);
 			ui_set_statusbar(FALSE, "%s", msg);
 			break;
 	}


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