Rework search_close_pid() and let it handle the case when the grep command was killed externally.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3253 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2008-11-19 17:31:54 +00:00
parent 6e727352f1
commit 800780e2b7
2 changed files with 35 additions and 23 deletions

View File

@ -1,3 +1,10 @@
2008-11-19 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/search.c:
Rework search_close_pid() and let it handle the case when the grep
command was killed externally.
2008-11-18 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> 2008-11-18 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/notebook.c: * src/notebook.c:

View File

@ -1428,34 +1428,39 @@ static void search_close_pid(GPid child_pid, gint status, gpointer user_data)
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
const gchar *msg = _("Search failed (see Help->Debug Messages for details)."); const gchar *msg = _("Search failed (see Help->Debug Messages for details).");
gint color = COLOR_DARK_RED; gint color = COLOR_DARK_RED;
gint exit_status = 1;
if (WIFEXITED(status)) if (WIFEXITED(status))
{ {
switch (WEXITSTATUS(status)) exit_status = WEXITSTATUS(status);
{ }
case 0: else if (WIFSIGNALED(status))
{ {
gint count = gtk_tree_model_iter_n_children( exit_status = -1;
GTK_TREE_MODEL(msgwindow.store_msg), NULL) - 1; g_warning("Find in Files: The command failed unexpectedly (signal received).");
}
msgwin_msg_add_fmt(COLOR_BLUE, -1, NULL, switch (exit_status)
ngettext("Search completed with %d match.", {
"Search completed with %d matches.", count), case 0:
count); {
ui_set_statusbar(FALSE, gint count = gtk_tree_model_iter_n_children(
ngettext("Search completed with %d match.", GTK_TREE_MODEL(msgwindow.store_msg), NULL) - 1;
"Search completed with %d matches.", count), gchar *text = ngettext(
count); "Search completed with %d match.",
break; "Search completed with %d matches.", count);
}
case 1: msgwin_msg_add_fmt(COLOR_BLUE, -1, NULL, text, count);
msg = _("No matches found."); ui_set_statusbar(FALSE, text, count);
color = COLOR_BLUE; break;
default:
msgwin_msg_add(color, -1, NULL, msg);
ui_set_statusbar(FALSE, "%s", msg);
break;
} }
case 1:
msg = _("No matches found.");
color = COLOR_BLUE;
default:
msgwin_msg_add(color, -1, NULL, msg);
ui_set_statusbar(FALSE, "%s", msg);
break;
} }
#endif #endif