SF.net SVN: geany:[4573] branches/geany-0.18.1

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Jan 28 13:35:57 UTC 2010


Revision: 4573
          http://geany.svn.sourceforge.net/geany/?rev=4573&view=rev
Author:   ntrel
Date:     2010-01-28 13:35:54 +0000 (Thu, 28 Jan 2010)

Log Message:
-----------
Backport (avoiding string change):
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:
--------------
    branches/geany-0.18.1/ChangeLog
    branches/geany-0.18.1/src/search.c

Modified: branches/geany-0.18.1/ChangeLog
===================================================================
--- branches/geany-0.18.1/ChangeLog	2010-01-28 13:13:50 UTC (rev 4572)
+++ branches/geany-0.18.1/ChangeLog	2010-01-28 13:35:54 UTC (rev 4573)
@@ -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: branches/geany-0.18.1/src/search.c
===================================================================
--- branches/geany-0.18.1/src/search.c	2010-01-28 13:13:50 UTC (rev 4572)
+++ branches/geany-0.18.1/src/search.c	2010-01-28 13:35:54 UTC (rev 4573)
@@ -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);
 }
 
 
@@ -1563,7 +1535,6 @@
 	/* 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;
 	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