SF.net SVN: geany: [1345] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Wed Feb 28 12:08:40 UTC 2007
Revision: 1345
http://svn.sourceforge.net/geany/?rev=1345&view=rev
Author: ntrel
Date: 2007-02-28 04:08:40 -0800 (Wed, 28 Feb 2007)
Log Message:
-----------
Show number of matches when using Find All or Find in Files.
Add msgwin_msg_add_fmt().
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/msgwindow.c
trunk/src/msgwindow.h
trunk/src/search.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-02-27 15:06:17 UTC (rev 1344)
+++ trunk/ChangeLog 2007-02-28 12:08:40 UTC (rev 1345)
@@ -1,3 +1,16 @@
+2007-02-28 Nick Treleaven <nick.treleaven at btinternet.com>
+
+ * src/msgwindow.c, src/msgwindow.h, src/search.c:
+ Show number of matches when using Find All or Find in Files.
+ Add msgwin_msg_add_fmt().
+
+
+2007-02-27 Nick Treleaven <nick.treleaven at btinternet.com>
+
+ * src/filetypes.c:
+ Use utils_strv_new() for all filetype patterns.
+
+
2007-02-26 Enrico Tröger <enrico.troeger at uvena.de>
* src/tools.c: Fixed wrong sensitiveness of custom commands menu items.
Modified: trunk/src/msgwindow.c
===================================================================
--- trunk/src/msgwindow.c 2007-02-27 15:06:17 UTC (rev 1344)
+++ trunk/src/msgwindow.c 2007-02-28 12:08:40 UTC (rev 1345)
@@ -248,6 +248,19 @@
}
+void msgwin_msg_add_fmt(gint line, gint idx, const gchar *format, ...)
+{
+ gchar string[512];
+ va_list args;
+
+ va_start(args, format);
+ g_vsnprintf(string, 512, format, args);
+ va_end(args);
+
+ msgwin_msg_add(line, idx, string);
+}
+
+
// adds string to the msg treeview
void msgwin_msg_add(gint line, gint idx, const gchar *string)
{
@@ -782,8 +795,7 @@
*filename = NULL;
*line = -1;
- g_return_if_fail(msgwindow.find_in_files_dir != NULL);
- if (string == NULL) return;
+ if (string == NULL || msgwindow.find_in_files_dir == NULL) return;
// conflict:3:conflicting types for `foo'
data.string = string;
Modified: trunk/src/msgwindow.h
===================================================================
--- trunk/src/msgwindow.h 2007-02-27 15:06:17 UTC (rev 1344)
+++ trunk/src/msgwindow.h 2007-02-28 12:08:40 UTC (rev 1345)
@@ -69,6 +69,9 @@
void msgwin_show_hide(gboolean show);
+
+void msgwin_msg_add_fmt(gint line, gint idx, const gchar *format, ...) G_GNUC_PRINTF (3, 4);
+
void msgwin_msg_add(gint line, gint idx, const gchar *string);
void msgwin_compiler_add_fmt(gint msg_color, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
@@ -77,6 +80,7 @@
void msgwin_status_add(const gchar *format, ...) G_GNUC_PRINTF (1, 2);
+
void msgwin_menu_add_common_items(GtkMenu *menu);
gboolean msgwin_goto_compiler_file_line();
Modified: trunk/src/search.c
===================================================================
--- trunk/src/search.c 2007-02-27 15:06:17 UTC (rev 1344)
+++ trunk/src/search.c 2007-02-28 12:08:40 UTC (rev 1345)
@@ -1269,20 +1269,31 @@
static void search_close_pid(GPid child_pid, gint status, gpointer user_data)
{
#ifdef G_OS_UNIX
- gchar *msg = _("Search failed.");
+ const gchar *msg = _("Search failed.");
if (WIFEXITED(status))
{
switch (WEXITSTATUS(status))
{
- case 0: msg = _("Search completed."); break;
- case 1: msg = _("No matches found."); break;
- default: break;
+ case 0:
+ {
+ gint count = gtk_tree_model_iter_n_children(
+ GTK_TREE_MODEL(msgwindow.store_msg), NULL) - 1;
+
+ msgwin_msg_add_fmt(-1, -1, _("Search completed with %d matches."), count);
+ ui_set_statusbar(_("Search completed with %d matches."), count);
+ break;
+ }
+ case 1:
+ msg = _("No matches found.");
+ default:
+ msgwin_msg_add(-1, -1, msg);
+ ui_set_statusbar("%s", msg);
+ break;
}
}
+#endif
- msgwin_msg_add(-1, -1, msg);
-#endif
utils_beep();
g_spawn_close_pid(child_pid);
}
@@ -1290,7 +1301,7 @@
static gint find_document_usage(gint idx, const gchar *search_text, gint flags)
{
- gchar *buffer, *short_file_name, *string;
+ gchar *buffer, *short_file_name;
gint pos, line, count = 0;
struct TextToFind ttf;
@@ -1311,12 +1322,12 @@
short_file_name = g_strdup(GEANY_STRING_UNTITLED);
else
short_file_name = g_path_get_basename(doc_list[idx].file_name);
- string = g_strdup_printf("%s:%d : %s", short_file_name, line + 1, g_strstrip(buffer));
- msgwin_msg_add(line + 1, idx, string);
+ msgwin_msg_add_fmt(line + 1, idx,
+ "%s:%d : %s", short_file_name, line + 1, g_strstrip(buffer));
+
g_free(buffer);
g_free(short_file_name);
- g_free(string);
ttf.chrg.cpMin = ttf.chrgText.cpMax + 1;
count++;
}
@@ -1351,11 +1362,16 @@
if (! found) // no matches were found
{
- gchar *text = g_strdup_printf(_("No matches found for '%s'."), search_text);
- ui_set_statusbar("%s", text);
- msgwin_msg_add(-1, -1, text);
- g_free(text);
+ ui_set_statusbar(_("No matches found for '%s'."), search_text);
+ msgwin_msg_add_fmt(-1, -1, _("No matches found for '%s'."), search_text);
}
+ else
+ {
+ gint count = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(msgwindow.store_msg), NULL);
+
+ ui_set_statusbar(_("Found %d matches for '%s'."), count, search_text);
+ msgwin_msg_add_fmt(-1, -1, _("Found %d matches for '%s'."), count, search_text);
+ }
}
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