[gnumeric] Show the number of rows filtered by the auto filter. [#346002]



commit e25eabc87f360d7feddcaca15bd9171d7be48776
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Tue Jul 13 01:35:09 2010 -0600

    Show the number of rows filtered by the auto filter. [#346002]
    
    2010-07-13  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* gnm-filter-combo-view.c: show the number of filtered rows in
    	  the progress bar region

 NEWS                                |    1 +
 src/widgets/ChangeLog               |    5 +++++
 src/widgets/gnm-filter-combo-view.c |   27 +++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 829e614..3f23482 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,7 @@ Andreas:
 	* Add new function ARRAY. [#570689]
 	* Add new function SORT. [#59144]
 	* Add menu item to wrap SORT around an existing range.
+	* Show the number of rows filtered by the auto filter. [#346002]
 
 Jean:
 	* Fix strong/weak cursor display. [#623241]
diff --git a/src/widgets/ChangeLog b/src/widgets/ChangeLog
index 581663f..c9953d8 100644
--- a/src/widgets/ChangeLog
+++ b/src/widgets/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-13  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* gnm-filter-combo-view.c: show the number of filtered rows in
+	  the progress bar region
+
 2010-07-12  Jean Brefort  <jean brefort normalesup org>
 
 	* Makefile.am: install a self-consistent headers list.
diff --git a/src/widgets/gnm-filter-combo-view.c b/src/widgets/gnm-filter-combo-view.c
index f92f89c..3d6d444 100644
--- a/src/widgets/gnm-filter-combo-view.c
+++ b/src/widgets/gnm-filter-combo-view.c
@@ -32,10 +32,12 @@
 #include "cell.h"
 #include "sheet.h"
 #include "sheet-object-impl.h"
+#include "wbc-gtk.h"
 #include "workbook.h"
 #include "style-color.h"
 #include "sheet-control-gui.h"
 #include "../dialogs/dialogs.h"
+#include "wbc-gtk-impl.h"
 
 #include <goffice/goffice.h>
 #include <gsf/gsf-impl-utils.h>
@@ -44,6 +46,14 @@
 #include <string.h>
 
 static gboolean
+cb_fcombo_count (GnmColRowIter const *iter, gint *count)
+{
+	if (iter->cri->visible)
+		(*count)++;
+	return FALSE;
+}
+
+static gboolean
 fcombo_activate (SheetObject *so, GtkTreeView *list, WBCGtk *wbcg,
 		 G_GNUC_UNUSED gboolean button)
 {
@@ -93,9 +103,26 @@ fcombo_activate (SheetObject *so, GtkTreeView *list, WBCGtk *wbcg,
 		}
 
 		if (set_condition) {
+			gint count = 0;
+			char const *format;
+			char *text;
 			gnm_filter_set_condition (fcombo->filter, field_num,
 				cond, TRUE);
 			sheet_update (fcombo->filter->sheet);
+			colrow_foreach (&fcombo->filter->sheet->rows,
+					fcombo->filter->r.start.row + 1,
+					fcombo->filter->r.end.row,
+					(ColRowHandler) cb_fcombo_count,
+					&count);
+			format = ngettext ("%d row of %d match",
+					   "%d rows of %d match",
+					   count);
+			text = g_strdup_printf (format, count, 
+						fcombo->filter->r.end.row - 
+						fcombo->filter->r.start.row);
+			gtk_progress_bar_set_text 
+				(GTK_PROGRESS_BAR (wbcg->progress_bar), text);
+			g_free (text);
 		}
 	}
 	return TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]