aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-10-23 01:24:32 +0800
committerMilan Crha <mcrha@redhat.com>2009-10-23 01:24:32 +0800
commitbfef844d81a9f45b1d0e401e2fa845e37ceddd82 (patch)
tree0d361ec15eb6b59daa6247f43c15b1444f11d404 /widgets
parent224c0cb2b98c925365d0dbaed8e7ef1d7f5cde32 (diff)
downloadgsoc2013-evolution-bfef844d81a9f45b1d0e401e2fa845e37ceddd82.tar
gsoc2013-evolution-bfef844d81a9f45b1d0e401e2fa845e37ceddd82.tar.gz
gsoc2013-evolution-bfef844d81a9f45b1d0e401e2fa845e37ceddd82.tar.bz2
gsoc2013-evolution-bfef844d81a9f45b1d0e401e2fa845e37ceddd82.tar.lz
gsoc2013-evolution-bfef844d81a9f45b1d0e401e2fa845e37ceddd82.tar.xz
gsoc2013-evolution-bfef844d81a9f45b1d0e401e2fa845e37ceddd82.tar.zst
gsoc2013-evolution-bfef844d81a9f45b1d0e401e2fa845e37ceddd82.zip
Bug #484839 - Sort, when in threading mode, properly
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-tree-table-adapter.c45
-rw-r--r--widgets/table/e-tree-table-adapter.h5
2 files changed, 50 insertions, 0 deletions
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c
index 8d3b9a1d28..e50c6d67bd 100644
--- a/widgets/table/e-tree-table-adapter.c
+++ b/widgets/table/e-tree-table-adapter.c
@@ -45,6 +45,13 @@ G_DEFINE_TYPE (ETreeTableAdapter, etta, E_TABLE_MODEL_TYPE)
#define INCREMENT_AMOUNT 100
+enum {
+ SORTING_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint signals [LAST_SIGNAL] = { 0, };
+
typedef struct {
ETreePath path;
guint32 num_visible_children;
@@ -712,6 +719,17 @@ etta_class_init (ETreeTableAdapterClass *klass)
table_class->initialize_value = etta_initialize_value;
table_class->value_is_empty = etta_value_is_empty;
table_class->value_to_string = etta_value_to_string;
+
+ klass->sorting_changed = NULL;
+
+ signals [SORTING_CHANGED] =
+ g_signal_new ("sorting_changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETreeTableAdapterClass, sorting_changed),
+ NULL, NULL,
+ e_marshal_BOOLEAN__NONE,
+ G_TYPE_BOOLEAN, 0, G_TYPE_NONE);
}
static void
@@ -845,6 +863,17 @@ etta_sort_info_changed (ETableSortInfo *sort_info, ETreeTableAdapter *etta)
if (!etta->priv->root)
return;
+ /* the function is called also internally, with sort_info = NULL,
+ thus skip those in signal emit */
+ if (sort_info) {
+ gboolean handled = FALSE;
+
+ g_signal_emit (etta, signals [SORTING_CHANGED], 0, &handled);
+
+ if (handled)
+ return;
+ }
+
e_table_model_pre_change(E_TABLE_MODEL(etta));
resort_node(etta, etta->priv->root, TRUE);
fill_map(etta, 0, etta->priv->root);
@@ -1265,6 +1294,22 @@ e_tree_table_adapter_set_sort_info (ETreeTableAdapter *etta, ETableSortInfo *sor
e_table_model_changed(E_TABLE_MODEL(etta));
}
+ETableSortInfo *
+e_tree_table_adapter_get_sort_info (ETreeTableAdapter *etta)
+{
+ g_return_val_if_fail (etta != NULL, NULL);
+
+ return etta->priv->sort_info;
+}
+
+ETableHeader *
+e_tree_table_adapter_get_header (ETreeTableAdapter *etta)
+{
+ g_return_val_if_fail (etta != NULL, NULL);
+
+ return etta->priv->header;
+}
+
ETreePath
e_tree_table_adapter_node_get_next (ETreeTableAdapter *etta, ETreePath path)
{
diff --git a/widgets/table/e-tree-table-adapter.h b/widgets/table/e-tree-table-adapter.h
index 596a3def1f..b5fc2c0422 100644
--- a/widgets/table/e-tree-table-adapter.h
+++ b/widgets/table/e-tree-table-adapter.h
@@ -50,6 +50,9 @@ typedef struct {
typedef struct {
ETableModelClass parent_class;
+
+ /* Signals */
+ gboolean (*sorting_changed) (ETreeTableAdapter *etta);
} ETreeTableAdapterClass;
GType e_tree_table_adapter_get_type (void);
@@ -94,6 +97,8 @@ void e_tree_table_adapter_load_expanded_state_xml (ETreeTableAdapter
void e_tree_table_adapter_set_sort_info (ETreeTableAdapter *etta,
ETableSortInfo *sort_info);
+ETableSortInfo *e_tree_table_adapter_get_sort_info (ETreeTableAdapter *etta);
+ETableHeader *e_tree_table_adapter_get_header (ETreeTableAdapter *etta);
G_END_DECLS