aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-06-21 02:13:32 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-06-21 03:31:53 +0800
commit7435afa54cb79587a95ee55f2e1e31eb39ee671e (patch)
tree4ab1e0438383a73843d4aa6e6767f090a1dbf987 /e-util
parentb63340b736b9ef505d5ae53452b4636eff7133f6 (diff)
downloadgsoc2013-evolution-7435afa54cb79587a95ee55f2e1e31eb39ee671e.tar
gsoc2013-evolution-7435afa54cb79587a95ee55f2e1e31eb39ee671e.tar.gz
gsoc2013-evolution-7435afa54cb79587a95ee55f2e1e31eb39ee671e.tar.bz2
gsoc2013-evolution-7435afa54cb79587a95ee55f2e1e31eb39ee671e.tar.lz
gsoc2013-evolution-7435afa54cb79587a95ee55f2e1e31eb39ee671e.tar.xz
gsoc2013-evolution-7435afa54cb79587a95ee55f2e1e31eb39ee671e.tar.zst
gsoc2013-evolution-7435afa54cb79587a95ee55f2e1e31eb39ee671e.zip
ESorter cleanups.
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-sorter.c149
-rw-r--r--e-util/e-sorter.h2
2 files changed, 72 insertions, 79 deletions
diff --git a/e-util/e-sorter.c b/e-util/e-sorter.c
index 935304a8fb..062a44d915 100644
--- a/e-util/e-sorter.c
+++ b/e-util/e-sorter.c
@@ -20,142 +20,135 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
#include "e-sorter.h"
-#define d(x)
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-G_DEFINE_TYPE (
- ESorter,
- e_sorter,
- G_TYPE_OBJECT)
-
-static gint es_model_to_sorted (ESorter *es, gint row);
-static gint es_sorted_to_model (ESorter *es, gint row);
-static void es_get_model_to_sorted_array (ESorter *es, gint **array, gint *count);
-static void es_get_sorted_to_model_array (ESorter *es, gint **array, gint *count);
-static gboolean es_needs_sorting (ESorter *es);
+G_DEFINE_TYPE (ESorter, e_sorter, G_TYPE_OBJECT)
-static void
-e_sorter_class_init (ESorterClass *class)
+static gint
+sorter_model_to_sorted (ESorter *sorter,
+ gint row)
{
- class->model_to_sorted = es_model_to_sorted;
- class->sorted_to_model = es_sorted_to_model;
- class->get_model_to_sorted_array = es_get_model_to_sorted_array;
- class->get_sorted_to_model_array = es_get_sorted_to_model_array;
- class->needs_sorting = es_needs_sorting;
+ return row;
}
-static void
-e_sorter_init (ESorter *es)
+static gint
+sorter_sorted_to_model (ESorter *sorter,
+ gint row)
{
+ return row;
}
-ESorter *
-e_sorter_new (void)
+static void
+sorter_get_model_to_sorted_array (ESorter *sorter,
+ gint **array,
+ gint *count)
{
- ESorter *es = g_object_new (E_TYPE_SORTER, NULL);
-
- return es;
}
-static gint
-es_model_to_sorted (ESorter *es,
- gint row)
+static void
+sorter_get_sorted_to_model_array (ESorter *sorter,
+ gint **array,
+ gint *count)
{
- return row;
}
-static gint
-es_sorted_to_model (ESorter *es,
- gint row)
+static gboolean
+sorter_needs_sorting (ESorter *sorter)
{
- return row;
+ return FALSE;
}
static void
-es_get_model_to_sorted_array (ESorter *es,
- gint **array,
- gint *count)
+e_sorter_class_init (ESorterClass *class)
{
+ class->model_to_sorted = sorter_model_to_sorted;
+ class->sorted_to_model = sorter_sorted_to_model;
+ class->get_model_to_sorted_array = sorter_get_model_to_sorted_array;
+ class->get_sorted_to_model_array = sorter_get_sorted_to_model_array;
+ class->needs_sorting = sorter_needs_sorting;
}
static void
-es_get_sorted_to_model_array (ESorter *es,
- gint **array,
- gint *count)
+e_sorter_init (ESorter *sorter)
{
}
-static gboolean
-es_needs_sorting (ESorter *es)
+ESorter *
+e_sorter_new (void)
{
- return FALSE;
+ return g_object_new (E_TYPE_SORTER, NULL);
}
gint
-e_sorter_model_to_sorted (ESorter *es,
+e_sorter_model_to_sorted (ESorter *sorter,
gint row)
{
- g_return_val_if_fail (es != NULL, -1);
+ ESorterClass *class;
+
+ g_return_val_if_fail (E_IS_SORTER (sorter), -1);
g_return_val_if_fail (row >= 0, -1);
- if (E_SORTER_GET_CLASS (es)->model_to_sorted)
- return E_SORTER_GET_CLASS (es)->model_to_sorted (es, row);
- else
- return -1;
+ class = E_SORTER_GET_CLASS (sorter);
+ g_return_val_if_fail (class->model_to_sorted != NULL, -1);
+
+ return class->model_to_sorted (sorter, row);
}
gint
-e_sorter_sorted_to_model (ESorter *es,
+e_sorter_sorted_to_model (ESorter *sorter,
gint row)
{
- g_return_val_if_fail (es != NULL, -1);
+ ESorterClass *class;
+
+ g_return_val_if_fail (E_IS_SORTER (sorter), -1);
g_return_val_if_fail (row >= 0, -1);
- if (E_SORTER_GET_CLASS (es)->sorted_to_model)
- return E_SORTER_GET_CLASS (es)->sorted_to_model (es, row);
- else
- return -1;
+ class = E_SORTER_GET_CLASS (sorter);
+ g_return_val_if_fail (class->sorted_to_model != NULL, -1);
+
+ return class->sorted_to_model (sorter, row);
}
void
-e_sorter_get_model_to_sorted_array (ESorter *es,
+e_sorter_get_model_to_sorted_array (ESorter *sorter,
gint **array,
gint *count)
{
- g_return_if_fail (es != NULL);
+ ESorterClass *class;
+
+ g_return_if_fail (E_IS_SORTER (sorter));
- if (E_SORTER_GET_CLASS (es)->get_model_to_sorted_array)
- E_SORTER_GET_CLASS (es)->get_model_to_sorted_array (es, array, count);
+ class = E_SORTER_GET_CLASS (sorter);
+ g_return_if_fail (class->get_model_to_sorted_array != NULL);
+
+ class->get_model_to_sorted_array (sorter, array, count);
}
void
-e_sorter_get_sorted_to_model_array (ESorter *es,
+e_sorter_get_sorted_to_model_array (ESorter *sorter,
gint **array,
gint *count)
{
- g_return_if_fail (es != NULL);
+ ESorterClass *class;
+
+ g_return_if_fail (E_IS_SORTER (sorter));
- if (E_SORTER_GET_CLASS (es)->get_sorted_to_model_array)
- E_SORTER_GET_CLASS (es)->get_sorted_to_model_array (es, array, count);
+ class = E_SORTER_GET_CLASS (sorter);
+ g_return_if_fail (class->get_sorted_to_model_array != NULL);
+
+ class->get_sorted_to_model_array (sorter, array, count);
}
gboolean
-e_sorter_needs_sorting (ESorter *es)
+e_sorter_needs_sorting (ESorter *sorter)
{
- g_return_val_if_fail (es != NULL, FALSE);
+ ESorterClass *class;
+
+ g_return_val_if_fail (E_IS_SORTER (sorter), FALSE);
- if (E_SORTER_GET_CLASS (es)->needs_sorting)
- return E_SORTER_GET_CLASS (es)->needs_sorting (es);
- else
- return FALSE;
+ class = E_SORTER_GET_CLASS (sorter);
+ g_return_val_if_fail (class->needs_sorting != NULL, FALSE);
+
+ return class->needs_sorting (sorter);
}
+
diff --git a/e-util/e-sorter.h b/e-util/e-sorter.h
index 45f8c53af1..6949cb0eda 100644
--- a/e-util/e-sorter.h
+++ b/e-util/e-sorter.h
@@ -75,7 +75,7 @@ struct _ESorterClass {
gint **array,
gint *count);
- gboolean (*needs_sorting) (ESorter *sorter);
+ gboolean (*needs_sorting) (ESorter *sorter);
};
GType e_sorter_get_type (void) G_GNUC_CONST;