aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-21 07:18:45 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-21 07:18:45 +0800
commit475a5d499cb4953967ebbdc0cb29ee42b62a4c43 (patch)
tree8ef19368acfd1876138c86cf7fef5e547fb269e2
parent44d8831822efabcb53cca846f433a97f94024250 (diff)
downloadgsoc2013-evolution-475a5d499cb4953967ebbdc0cb29ee42b62a4c43.tar.gz
gsoc2013-evolution-475a5d499cb4953967ebbdc0cb29ee42b62a4c43.tar.zst
gsoc2013-evolution-475a5d499cb4953967ebbdc0cb29ee42b62a4c43.zip
Added e_table_selection_model_selected_count.
2000-08-20 Christopher James Lahey <clahey@helixcode.com> * e-table-selection-model.c: Added e_table_selection_model_selected_count. svn path=/trunk/; revision=4893
-rw-r--r--widgets/e-table/ChangeLog5
-rw-r--r--widgets/e-table/e-table-selection-model.c26
-rw-r--r--widgets/e-table/e-table-selection-model.h1
-rw-r--r--widgets/table/e-table-selection-model.c26
-rw-r--r--widgets/table/e-table-selection-model.h1
5 files changed, 59 insertions, 0 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 50eaa6e38a..e3572bbede 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,8 @@
+2000-08-20 Christopher James Lahey <clahey@helixcode.com>
+
+ * e-table-selection-model.c: Added
+ e_table_selection_model_selected_count.
+
2000-08-19 Lauris Kaplinski <lauris@helixcode.com>
* e-cell-text.c: Use EFont wrapper
diff --git a/widgets/e-table/e-table-selection-model.c b/widgets/e-table/e-table-selection-model.c
index 09b1d6bf93..9079ce8623 100644
--- a/widgets/e-table/e-table-selection-model.c
+++ b/widgets/e-table/e-table-selection-model.c
@@ -472,3 +472,29 @@ e_table_selection_model_clear(ETableSelectionModel *selection)
gtk_signal_emit(GTK_OBJECT(selection),
e_table_selection_model_signals [SELECTION_CHANGED]);
}
+
+#define PART(x,n) (((x) & (0x01010101 << n)) >> n)
+#define SECTION(x, n) (((x) >> (n * 8)) & 0xff)
+
+gint
+e_table_selection_model_selected_count (ETableSelectionModel *selection)
+{
+ gint count;
+ int i;
+ int last;
+
+ count = 0;
+
+ last = BOX(selection->row_count - 1);
+
+ for (i = 0; i <= last; i++) {
+ int j;
+ guint32 thiscount = 0;
+ for (j = 0; j < 8; j++)
+ thiscount += PART(selection->selection[i], j);
+ for (j = 0; j < 4; j++)
+ count += SECTION(thiscount, j);
+ }
+
+ return count;
+}
diff --git a/widgets/e-table/e-table-selection-model.h b/widgets/e-table/e-table-selection-model.h
index 6b57ab56f0..6d7b25ed3d 100644
--- a/widgets/e-table/e-table-selection-model.h
+++ b/widgets/e-table/e-table-selection-model.h
@@ -63,6 +63,7 @@ void e_table_selection_model_maybe_do_something (ETableSelectionM
guint col,
GdkModifierType state);
void e_table_selection_model_clear (ETableSelectionModel *selection);
+gint e_table_selection_model_selected_count (ETableSelectionModel *selection);
ETableSelectionModel *e_table_selection_model_new (void);
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c
index 09b1d6bf93..9079ce8623 100644
--- a/widgets/table/e-table-selection-model.c
+++ b/widgets/table/e-table-selection-model.c
@@ -472,3 +472,29 @@ e_table_selection_model_clear(ETableSelectionModel *selection)
gtk_signal_emit(GTK_OBJECT(selection),
e_table_selection_model_signals [SELECTION_CHANGED]);
}
+
+#define PART(x,n) (((x) & (0x01010101 << n)) >> n)
+#define SECTION(x, n) (((x) >> (n * 8)) & 0xff)
+
+gint
+e_table_selection_model_selected_count (ETableSelectionModel *selection)
+{
+ gint count;
+ int i;
+ int last;
+
+ count = 0;
+
+ last = BOX(selection->row_count - 1);
+
+ for (i = 0; i <= last; i++) {
+ int j;
+ guint32 thiscount = 0;
+ for (j = 0; j < 8; j++)
+ thiscount += PART(selection->selection[i], j);
+ for (j = 0; j < 4; j++)
+ count += SECTION(thiscount, j);
+ }
+
+ return count;
+}
diff --git a/widgets/table/e-table-selection-model.h b/widgets/table/e-table-selection-model.h
index 6b57ab56f0..6d7b25ed3d 100644
--- a/widgets/table/e-table-selection-model.h
+++ b/widgets/table/e-table-selection-model.h
@@ -63,6 +63,7 @@ void e_table_selection_model_maybe_do_something (ETableSelectionM
guint col,
GdkModifierType state);
void e_table_selection_model_clear (ETableSelectionModel *selection);
+gint e_table_selection_model_selected_count (ETableSelectionModel *selection);
ETableSelectionModel *e_table_selection_model_new (void);