aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-03-20 12:51:11 +0800
committerChris Lahey <clahey@src.gnome.org>2001-03-20 12:51:11 +0800
commit79aed0f7f042554d54c1504f7401624163499c36 (patch)
treeff1f5bb3cad92531c8ca332689ddde7466b98b45
parent68a731e0a02290edf039d419bc36582023624726 (diff)
downloadgsoc2013-evolution-79aed0f7f042554d54c1504f7401624163499c36.tar
gsoc2013-evolution-79aed0f7f042554d54c1504f7401624163499c36.tar.gz
gsoc2013-evolution-79aed0f7f042554d54c1504f7401624163499c36.tar.bz2
gsoc2013-evolution-79aed0f7f042554d54c1504f7401624163499c36.tar.lz
gsoc2013-evolution-79aed0f7f042554d54c1504f7401624163499c36.tar.xz
gsoc2013-evolution-79aed0f7f042554d54c1504f7401624163499c36.tar.zst
gsoc2013-evolution-79aed0f7f042554d54c1504f7401624163499c36.zip
Upped the version number to 0.5.99.4.
2001-03-19 Christopher James Lahey <clahey@ximian.com> * configure.in: Upped the version number to 0.5.99.4. * Merged branch: 2001-03-18 Christopher James Lahey <clahey@ximian.com> * gal/widgets/e-selection-model.c, gal/widgets/e-selection-model.h: Added another semi-private function (e_selection_model_change_cursor.) 2001-03-18 Christopher James Lahey <clahey@ximian.com> * gal/widgets/e-selection-model.c, gal/widgets/e-selection-model.h: Added a couple of semi-private functions (e_selection_model_change_one_row and e_selection_model_confirm_row_count.) 2001-03-18 Christopher James Lahey <clahey@ximian.com> * tests/test-tree-1.c, tests/test-tree-3.c: Added arguments for e_tree_memory_callbacks_new of get_save_id and has_save_id to NULL. 2001-03-17 Christopher James Lahey <clahey@ximian.com> * gal/util/e-util.c (e_sort): Switched to just using qsort directly here. 2001-03-17 Christopher James Lahey <clahey@ximian.com> * gal/util/e-util.c, gal/util/e-util.h (e_bsearch, e_sort): Added e_sort and e_bsearch. They both take a closure. e_sort guarantees a stable sort. e_bsearch returns the range of matching elements including the position where an object would be if there are no matching elements. 2001-03-16 Christopher James Lahey <clahey@ximian.com> * gal/Makefile.am (libgal_la_LIBADD): Added e-tree-sorted.lo. 2001-03-14 Christopher James Lahey <clahey@ximian.com> * gal/widgets/e-selection-model-simple.c, gal/widgets/e-selection-model-simple.h: Replaced the methods insert_row and delete_row with insert_rows and delete_rows. * gal/widgets/e-selection-model.c, gal/widgets/e-selection-model.h: Replaced the methods insert_row and delete_row with insert_rows and delete_rows. 2001-03-08 Christopher James Lahey <clahey@ximian.com> * Makefile.am: Added e-table/e-table-utils.lo, e-table/e-tree-memory-callbacks.lo, e-table/e-tree-memory.lo, e-table/e-tree-scrolled.lo, e-table/e-tree-table-adapter.lo, and e-table/e-tree.lo. Removed e-table/e-tree-simple.lo. * gal/util/e-util.c, gal/util/e-util.h: Added a whole bunch of e_marshal functions for ETree. * tests/test-tree-1.c, tests/test-tree-3.c: Reworked these to use the new tree stuff. End of branch svn path=/trunk/; revision=8840
-rw-r--r--e-util/e-util.c244
-rw-r--r--e-util/e-util.h201
-rw-r--r--widgets/misc/e-selection-model-simple.c18
-rw-r--r--widgets/misc/e-selection-model-simple.h10
-rw-r--r--widgets/misc/e-selection-model.c82
-rw-r--r--widgets/misc/e-selection-model.h17
6 files changed, 448 insertions, 124 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 02092041f0..436e11b141 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -30,6 +30,7 @@
#include <string.h>
#include <locale.h>
#include <stdio.h>
+#include <stdlib.h>
#include "e-util.h"
#if 0
@@ -269,6 +270,30 @@ e_marshal_INT__INT_INT_POINTER (GtkObject * object,
func_data);
}
+typedef gint (*GtkSignal_INT__INT_POINTER_INT_POINTER) (GtkObject * object,
+ gint arg1,
+ gpointer arg2,
+ gint arg3,
+ gpointer arg4,
+ gpointer user_data);
+
+void
+e_marshal_INT__INT_POINTER_INT_POINTER (GtkObject * object,
+ GtkSignalFunc func,
+ gpointer func_data, GtkArg * args)
+{
+ GtkSignal_INT__INT_POINTER_INT_POINTER rfunc;
+ gint *return_val;
+ return_val = GTK_RETLOC_INT (args[3]);
+ rfunc = (GtkSignal_INT__INT_POINTER_INT_POINTER) func;
+ *return_val = (*rfunc) (object,
+ GTK_VALUE_INT (args[0]),
+ GTK_VALUE_POINTER (args[1]),
+ GTK_VALUE_INT (args[2]),
+ GTK_VALUE_POINTER (args[3]),
+ func_data);
+}
+
typedef void (*GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object,
GtkObject *arg1,
gdouble arg2,
@@ -361,6 +386,29 @@ e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT (GtkObject * object,
GTK_VALUE_INT (args[4]), GTK_VALUE_INT (args[5]), func_data);
}
+typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT) (GtkObject * object,
+ gint arg1,
+ gpointer arg2,
+ gint arg3,
+ gpointer arg4,
+ gpointer arg5,
+ gint arg6,
+ gint arg7,
+ gpointer user_data);
+void
+e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT (GtkObject * object,
+ GtkSignalFunc func,
+ gpointer func_data, GtkArg * args)
+{
+ GtkSignal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT rfunc;
+ rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT) func;
+ (*rfunc) (object,
+ GTK_VALUE_INT (args[0]), GTK_VALUE_POINTER (args[1]), GTK_VALUE_INT (args[2]),
+ GTK_VALUE_POINTER (args[3]),
+ GTK_VALUE_POINTER (args[4]),
+ GTK_VALUE_INT (args[5]), GTK_VALUE_INT (args[6]), func_data);
+}
+
typedef void (*GtkSignal_NONE__INT_INT_POINTER_INT) (GtkObject * object,
gint arg1,
gint arg2,
@@ -378,6 +426,24 @@ e_marshal_NONE__INT_INT_POINTER_INT (GtkObject * object,
GTK_VALUE_POINTER (args[2]), GTK_VALUE_INT (args[3]), func_data);
}
+typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER_INT) (GtkObject * object,
+ gint arg1,
+ gpointer arg2,
+ gint arg3,
+ gpointer arg4,
+ gint arg5, gpointer user_data);
+void
+e_marshal_NONE__INT_POINTER_INT_POINTER_INT (GtkObject * object,
+ GtkSignalFunc func,
+ gpointer func_data, GtkArg * args)
+{
+ GtkSignal_NONE__INT_POINTER_INT_POINTER_INT rfunc;
+ rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER_INT) func;
+ (*rfunc) (object,
+ GTK_VALUE_INT (args[0]), GTK_VALUE_POINTER (args[1]), GTK_VALUE_INT (args[2]),
+ GTK_VALUE_POINTER (args[3]), GTK_VALUE_INT (args[4]), func_data);
+}
+
typedef gboolean (*GtkSignal_BOOL__INT_INT_POINTER_INT_INT_INT) (GtkObject * object,
gint arg1,
gint arg2,
@@ -404,6 +470,34 @@ e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT (GtkObject * object,
GTK_VALUE_INT (args[5]), func_data);
}
+typedef gboolean (*GtkSignal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT) (GtkObject * object,
+ gint arg1,
+ gpointer arg2,
+ gint arg3,
+ gpointer arg4,
+ gint arg5,
+ gint arg6,
+ gint arg7,
+ gpointer user_data);
+void
+e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT (GtkObject * object,
+ GtkSignalFunc func,
+ gpointer func_data, GtkArg * args)
+{
+ GtkSignal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT rfunc;
+ gboolean *return_val;
+ return_val = GTK_RETLOC_BOOL (args[6]);
+ rfunc = (GtkSignal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT) func;
+ *return_val = (*rfunc) (object,
+ GTK_VALUE_INT (args[0]),
+ GTK_VALUE_POINTER (args[1]),
+ GTK_VALUE_INT (args[2]),
+ GTK_VALUE_POINTER (args[3]),
+ GTK_VALUE_INT (args[4]),
+ GTK_VALUE_INT (args[5]),
+ GTK_VALUE_INT (args[6]), func_data);
+}
+
typedef void (*GtkSignal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT) (GtkObject *
object,
gint arg1,
@@ -436,6 +530,38 @@ e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject * object,
GTK_VALUE_INT (args[6]), GTK_VALUE_INT (args[7]), func_data);
}
+typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT) (GtkObject *
+ object,
+ gint arg1,
+ gpointer arg2,
+ gint arg3,
+ gpointer arg4,
+ gint arg5,
+ gint arg6,
+ gpointer arg7,
+ gint arg8,
+ gint arg9,
+ gpointer user_data);
+
+void
+e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject * object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg * args)
+{
+ GtkSignal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT rfunc;
+ rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT) func;
+ (*rfunc) (object,
+ GTK_VALUE_INT (args[0]),
+ GTK_VALUE_POINTER (args[1]),
+ GTK_VALUE_INT (args[2]),
+ GTK_VALUE_POINTER (args[3]),
+ GTK_VALUE_INT (args[4]),
+ GTK_VALUE_INT (args[5]),
+ GTK_VALUE_POINTER (args[6]),
+ GTK_VALUE_INT (args[7]), GTK_VALUE_INT (args[8]), func_data);
+}
+
typedef void (*GtkSignal_NONE__POINTER_POINTER_INT) (GtkObject *, gpointer,
gpointer, gint, gpointer);
@@ -449,6 +575,19 @@ e_marshal_NONE__POINTER_POINTER_INT (GtkObject * object, GtkSignalFunc func,
GTK_VALUE_INT (args[2]), func_data);
}
+typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER) (GtkObject *, gint, gpointer,
+ gint, gpointer, gpointer);
+
+void
+e_marshal_NONE__INT_POINTER_INT_POINTER (GtkObject * object, GtkSignalFunc func,
+ gpointer func_data, GtkArg * args)
+{
+ GtkSignal_NONE__INT_POINTER_INT_POINTER rfunc;
+ rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER) func;
+ (*rfunc) (object, GTK_VALUE_INT (args[0]), GTK_VALUE_POINTER (args[1]),
+ GTK_VALUE_INT (args[2]), GTK_VALUE_POINTER (args[3]), func_data);
+}
+
typedef int (*GtkSignal_INT__POINTER_POINTER) (GtkObject *,
gpointer, gpointer,
gpointer user_data);
@@ -740,3 +879,108 @@ e_create_directory (gchar *directory)
return (return_value);
}
+
+
+/* Perform a binary search for key in base which has nmemb elements
+ of size bytes each. The comparisons are done by (*compare)(). */
+void e_bsearch (const void *key,
+ const void *base,
+ size_t nmemb,
+ size_t size,
+ ESortCompareFunc compare,
+ gpointer closure,
+ size_t *start,
+ size_t *end)
+{
+ size_t l, u, idx;
+ const void *p;
+ int comparison;
+ if (!(start || end))
+ return;
+
+ l = 0;
+ u = nmemb;
+ while (l < u) {
+ idx = (l + u) / 2;
+ p = (void *) (((const char *) base) + (idx * size));
+ comparison = (*compare) (key, p, closure);
+ if (comparison < 0)
+ u = idx;
+ else if (comparison > 0)
+ l = idx + 1;
+ else {
+ size_t lsave, usave;
+ lsave = l;
+ usave = u;
+ if (start) {
+ while (l < u) {
+ idx = (l + u) / 2;
+ p = (void *) (((const char *) base) + (idx * size));
+ comparison = (*compare) (key, p, closure);
+ if (comparison <= 0)
+ u = idx;
+ else
+ l = idx + 1;
+ }
+ *start = l;
+
+ l = lsave;
+ u = usave;
+ }
+ if (end) {
+ while (l < u) {
+ idx = (l + u) / 2;
+ p = (void *) (((const char *) base) + (idx * size));
+ comparison = (*compare) (key, p, closure);
+ if (comparison < 0)
+ u = idx;
+ else
+ l = idx + 1;
+ }
+ *end = l;
+ }
+ return;
+ }
+ }
+
+ if (start)
+ *start = l;
+ if (end)
+ *end = l;
+}
+
+static gpointer closure_closure;
+static ESortCompareFunc compare_closure;
+
+static int
+qsort_callback(const void *data1, const void *data2)
+{
+ return (*compare_closure) (data1, data2, closure_closure);
+}
+
+/* Forget it. We're just going to use qsort. I lost the need for a stable sort. */
+void
+e_sort (void *base,
+ size_t nmemb,
+ size_t size,
+ ESortCompareFunc compare,
+ gpointer closure)
+{
+ closure_closure = closure;
+ compare_closure = compare;
+ qsort(base, nmemb, size, qsort_callback);
+#if 0
+ void *base_copy;
+ int i;
+ base_copy = g_malloc(nmemb * size);
+
+ for (i = 0; i < nmemb; i++) {
+ int position;
+ e_bsearch(base + (i * size), base_copy, i, size, compare, closure, NULL, &position);
+ memmove(base_copy + (position + 1) * size, base_copy + position * size, (i - position) * size);
+ memcpy(base_copy + position * size, base + i * size, size);
+ }
+ memcpy(base, base_copy, nmemb * size);
+ g_free(base_copy);
+#endif
+}
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 77d056b051..e1e6205583 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -59,90 +59,141 @@ typedef enum {
E_FOCUS_START,
E_FOCUS_END
} EFocus;
-int g_str_compare (const void *x,
- const void *y);
-int g_int_compare (const void *x,
- const void *y);
-char *e_strdup_strip (const char *string);
-void e_free_object_list (GList *list);
-void e_free_string_list (GList *list);
-char *e_read_file (const char *filename);
-int e_write_file (const char *filename,
- const char *data,
- int flags);
-int e_mkdir_hier (const char *path,
- mode_t mode);
-
-gchar **e_strsplit (const gchar *string,
- const gchar *delimiter,
- gint max_tokens);
-gchar *e_strstrcase (const gchar *haystack,
- const gchar *needle);
-void e_filename_make_safe (gchar *string);
-gchar *e_format_number (gint number);
-gboolean e_create_directory (gchar *directory);
-void e_marshal_INT__INT_INT_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
+int g_str_compare (const void *x,
+ const void *y);
+int g_int_compare (const void *x,
+ const void *y);
+char *e_strdup_strip (const char *string);
+void e_free_object_list (GList *list);
+void e_free_string_list (GList *list);
+char *e_read_file (const char *filename);
+int e_write_file (const char *filename,
+ const char *data,
+ int flags);
+int e_mkdir_hier (const char *path,
+ mode_t mode);
+
+gchar **e_strsplit (const gchar *string,
+ const gchar *delimiter,
+ gint max_tokens);
+gchar *e_strstrcase (const gchar *haystack,
+ const gchar *needle);
+void e_filename_make_safe (gchar *string);
+gchar *e_format_number (gint number);
+gboolean e_create_directory (gchar *directory);
+
+
+typedef int (*ESortCompareFunc) (const void *first,
+ const void *second,
+ gpointer closure);
+
+void e_sort (void *base,
+ size_t nmemb,
+ size_t size,
+ ESortCompareFunc compare,
+ gpointer closure);
+void e_bsearch (const void *key,
+ const void *base,
+ size_t nmemb,
+ size_t size,
+ ESortCompareFunc compare,
+ gpointer closure,
+ size_t *start,
+ size_t *end);
+
+
+
+void e_marshal_INT__INT_INT_POINTER (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+void e_marshal_INT__INT_POINTER_INT_POINTER (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+void e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+void e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+void e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
#define e_marshal_NONE__INT_INT_POINTER_POINTER_UINT_UINT e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT
-void e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
+void e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+
+#define e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_UINT_UINT e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT
+void e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
#define e_marshal_NONE__INT_INT_POINTER_UINT e_marshal_NONE__INT_INT_POINTER_INT
-void e_marshal_NONE__INT_INT_POINTER_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
+void e_marshal_NONE__INT_INT_POINTER_INT (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
-#define e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT
-void e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
+#define e_marshal_NONE__INT_POINTER_INT_POINTER_UINT e_marshal_NONE__INT_POINTER_INT_POINTER_INT
+void e_marshal_NONE__INT_POINTER_INT_POINTER_INT (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+#define e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT
+void e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+#define e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_UINT e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT
+void e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
#define e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_UINT_UINT e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT
+void e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+
+#define e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_UINT_UINT e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT
+void e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+void e_marshal_NONE__POINTER_POINTER_INT (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+void e_marshal_NONE__INT_POINTER_INT_POINTER (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+void e_marshal_INT__POINTER_POINTER (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+void e_marshal_INT__POINTER_POINTER_POINTER (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
+void e_marshal_INT__POINTER_POINTER_POINTER_POINTER (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
-void e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__POINTER_POINTER_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-void e_marshal_INT__POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
#endif /* _E_UTIL_H_ */
diff --git a/widgets/misc/e-selection-model-simple.c b/widgets/misc/e-selection-model-simple.c
index 9a9c1e0d79..8b8329b7bb 100644
--- a/widgets/misc/e-selection-model-simple.c
+++ b/widgets/misc/e-selection-model-simple.c
@@ -74,19 +74,21 @@ esms_get_row_count (ESelectionModel *esm)
return esms->row_count;
}
-void e_selection_model_simple_insert_row (ESelectionModelSimple *esms,
- int row)
+void e_selection_model_simple_insert_rows (ESelectionModelSimple *esms,
+ int row,
+ int count)
{
- esms->row_count ++;
- e_selection_model_insert_row (E_SELECTION_MODEL(esms), row);
+ esms->row_count += count;
+ e_selection_model_insert_rows (E_SELECTION_MODEL(esms), row, count);
}
void
-e_selection_model_simple_delete_row (ESelectionModelSimple *esms,
- int row)
+e_selection_model_simple_delete_rows (ESelectionModelSimple *esms,
+ int row,
+ int count)
{
- esms->row_count --;
- e_selection_model_delete_row (E_SELECTION_MODEL(esms), row);
+ esms->row_count -= count;
+ e_selection_model_delete_rows (E_SELECTION_MODEL(esms), row, count);
}
void
diff --git a/widgets/misc/e-selection-model-simple.h b/widgets/misc/e-selection-model-simple.h
index 52e785880c..65d69d0143 100644
--- a/widgets/misc/e-selection-model-simple.h
+++ b/widgets/misc/e-selection-model-simple.h
@@ -27,10 +27,12 @@ typedef struct {
GtkType e_selection_model_simple_get_type (void);
ESelectionModelSimple *e_selection_model_simple_new (void);
-void e_selection_model_simple_insert_row (ESelectionModelSimple *esms,
- int row);
-void e_selection_model_simple_delete_row (ESelectionModelSimple *esms,
- int row);
+void e_selection_model_simple_insert_rows (ESelectionModelSimple *esms,
+ int row,
+ int count);
+void e_selection_model_simple_delete_rows (ESelectionModelSimple *esms,
+ int row,
+ int count);
void e_selection_model_simple_move_row (ESelectionModelSimple *esms,
int old_row,
int new_row);
diff --git a/widgets/misc/e-selection-model.c b/widgets/misc/e-selection-model.c
index de48bc3952..c52397ca37 100644
--- a/widgets/misc/e-selection-model.c
+++ b/widgets/misc/e-selection-model.c
@@ -27,7 +27,6 @@
static GtkObjectClass *e_selection_model_parent_class;
-static void change_one_row(ESelectionModel *selection, int row, gboolean grow);
static void esm_select_single_row (ESelectionModel *selection, int row);
enum {
@@ -48,6 +47,19 @@ enum {
ARG_CURSOR_MODE,
};
+gboolean
+e_selection_model_confirm_row_count(ESelectionModel *esm)
+{
+ if (esm->row_count < 0) {
+ esm->row_count = e_selection_model_get_row_count(esm);
+ if (esm->row_count < 0)
+ return FALSE;
+ g_free(esm->selection);
+ esm->selection = g_new0(gint, (esm->row_count + 31) / 32);
+ }
+ return TRUE;
+}
+
static void
e_selection_model_insert_row_real(ESelectionModel *esm, int row)
{
@@ -116,20 +128,26 @@ e_selection_model_delete_row_real(ESelectionModel *esm, int row)
esm->cursor_row --;
}
+/* FIXME : Improve efficiency here. */
void
-e_selection_model_delete_row(ESelectionModel *esm, int row)
+e_selection_model_delete_rows(ESelectionModel *esm, int row, int count)
{
- e_selection_model_delete_row_real(esm, row);
+ int i;
+ for (i = 0; i < count; i++)
+ e_selection_model_delete_row_real(esm, row);
gtk_signal_emit(GTK_OBJECT(esm),
e_selection_model_signals [SELECTION_CHANGED]);
gtk_signal_emit(GTK_OBJECT(esm),
e_selection_model_signals [CURSOR_CHANGED], esm->cursor_row, esm->cursor_col);
}
+/* FIXME : Improve efficiency here. */
void
-e_selection_model_insert_row(ESelectionModel *esm, int row)
+e_selection_model_insert_rows(ESelectionModel *esm, int row, int count)
{
- e_selection_model_insert_row_real(esm, row);
+ int i;
+ for (i = 0; i < count; i++)
+ e_selection_model_insert_row_real(esm, row);
gtk_signal_emit(GTK_OBJECT(esm),
e_selection_model_signals [SELECTION_CHANGED]);
gtk_signal_emit(GTK_OBJECT(esm),
@@ -150,7 +168,7 @@ e_selection_model_move_row(ESelectionModel *esm, int old_row, int new_row)
if (esm->mode == GTK_SELECTION_SINGLE)
esm_select_single_row (esm, new_row);
else
- change_one_row(esm, new_row, TRUE);
+ e_selection_model_change_one_row(esm, new_row, TRUE);
}
if (cursor) {
esm->cursor_row = new_row;
@@ -372,8 +390,8 @@ e_selection_model_foreach (ESelectionModel *selection,
#define OPERATE(object, i,mask,grow) ((grow) ? (((object)->selection[(i)]) |= ((guint32) ~(mask))) : (((object)->selection[(i)]) &= (mask)))
-static void
-change_one_row(ESelectionModel *selection, int row, gboolean grow)
+void
+e_selection_model_change_one_row(ESelectionModel *selection, int row, gboolean grow)
{
int i;
i = BOX(row);
@@ -388,7 +406,7 @@ change_selection(ESelectionModel *selection, int start, int end, gboolean grow)
if (start != end) {
if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) {
for ( i = start; i < end; i++) {
- change_one_row(selection, e_sorter_sorted_to_model(selection->sorter, i), grow);
+ e_selection_model_change_one_row(selection, e_sorter_sorted_to_model(selection->sorter, i), grow);
}
} else {
i = BOX(start);
@@ -509,13 +527,8 @@ e_selection_model_do_something (ESelectionModel *selection,
if (col == -1 && row != -1)
col = 0;
- if (selection->row_count < 0) {
- selection->row_count = e_selection_model_get_row_count(selection);
- if (selection->row_count < 0)
- return;
- g_free(selection->selection);
- selection->selection = g_new0(gint, (selection->row_count + 31) / 32);
- }
+ if (!e_selection_model_confirm_row_count(selection))
+ return;
if (selection->row_count >= 0 && row < selection->row_count) {
switch (selection->mode) {
case GTK_SELECTION_SINGLE:
@@ -635,7 +648,7 @@ move_selection (ESelectionModel *selection,
*/
gint
e_selection_model_key_press (ESelectionModel *selection,
- GdkEventKey *key)
+ GdkEventKey *key)
{
switch (key->keyval) {
case GDK_Up:
@@ -766,14 +779,9 @@ void
e_selection_model_select_all (ESelectionModel *selection)
{
int i;
-
- if (selection->row_count < 0) {
- selection->row_count = e_selection_model_get_row_count(selection);
- if (selection->row_count < 0)
- return;
- g_free (selection->selection);
- selection->selection = g_new0 (gint, (selection->row_count + 31) / 32);
- }
+
+ if (!e_selection_model_confirm_row_count(selection))
+ return;
if (!selection->selection)
selection->selection = g_new0 (gint, (selection->row_count + 31) / 32);
@@ -814,14 +822,9 @@ void
e_selection_model_invert_selection (ESelectionModel *selection)
{
int i;
-
- if (selection->row_count < 0) {
- selection->row_count = e_selection_model_get_row_count (selection);
- if (selection->row_count < 0)
+
+ if (!e_selection_model_confirm_row_count(selection))
return;
- g_free (selection->selection);
- selection->selection = g_new0 (gint, (selection->row_count + 31) / 32);
- }
if (!selection->selection)
selection->selection = g_new0 (gint, (selection->row_count + 31) / 32);
@@ -850,3 +853,18 @@ e_selection_model_get_row_count (ESelectionModel *selection)
else
return 0;
}
+
+void
+e_selection_model_change_cursor (ESelectionModel *selection, int row)
+{
+ g_return_if_fail(selection != NULL);
+ g_return_if_fail(E_IS_SELECTION_MODEL(selection));
+
+ selection->cursor_row = row;
+ if (row == -1)
+ selection->cursor_col = -1;
+ else if (selection->cursor_col == -1)
+ selection->cursor_col = 0;
+ gtk_signal_emit(GTK_OBJECT(selection),
+ e_selection_model_signals[CURSOR_CHANGED], selection->cursor_row, selection->cursor_col);
+}
diff --git a/widgets/misc/e-selection-model.h b/widgets/misc/e-selection-model.h
index 74cbcb50d2..5ba0411587 100644
--- a/widgets/misc/e-selection-model.h
+++ b/widgets/misc/e-selection-model.h
@@ -65,7 +65,6 @@ typedef struct {
} ESelectionModelClass;
GtkType e_selection_model_get_type (void);
-
gboolean e_selection_model_is_row_selected (ESelectionModel *selection,
gint n);
void e_selection_model_foreach (ESelectionModel *selection,
@@ -87,13 +86,21 @@ void e_selection_model_select_all (ESelectionModel *selection);
void e_selection_model_invert_selection (ESelectionModel *selection);
/* Private Functions */
-void e_selection_model_insert_row (ESelectionModel *esm,
- int row);
-void e_selection_model_delete_row (ESelectionModel *esm,
- int row);
+void e_selection_model_insert_rows (ESelectionModel *esm,
+ int row,
+ int count);
+void e_selection_model_delete_rows (ESelectionModel *esm,
+ int row,
+ int count);
void e_selection_model_move_row (ESelectionModel *esm,
int old_row,
int new_row);
+void e_selection_model_change_one_row (ESelectionModel *esm,
+ int row,
+ gboolean on);
+void e_selection_model_change_cursor (ESelectionModel *esm,
+ int row);
+gboolean e_selection_model_confirm_row_count (ESelectionModel *esm);
/* Virtual Function */
gint e_selection_model_get_row_count (ESelectionModel *esm);