[gimp] app: move GimpFilteredContainer's match logic to a utility function
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: move GimpFilteredContainer's match logic to a utility function
- Date: Thu, 24 Mar 2011 12:11:34 +0000 (UTC)
commit b590804212e54522b8bfe254f2c83cb6f6e4b61f
Author: Michael Natterer <mitch gimp org>
Date: Thu Mar 24 13:10:43 2011 +0100
app: move GimpFilteredContainer's match logic to a utility function
app/core/gimpfilteredcontainer.c | 102 +++++++++++++++++++-------------------
1 files changed, 51 insertions(+), 51 deletions(-)
---
diff --git a/app/core/gimpfilteredcontainer.c b/app/core/gimpfilteredcontainer.c
index 7bcec47..59ca612 100644
--- a/app/core/gimpfilteredcontainer.c
+++ b/app/core/gimpfilteredcontainer.c
@@ -37,35 +37,36 @@ enum
};
-static void gimp_filtered_container_constructed (GObject *object);
-static void gimp_filtered_container_dispose (GObject *object);
-static void gimp_filtered_container_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_filtered_container_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void gimp_filtered_container_real_src_add (GimpFilteredContainer *filtered_container,
- GimpObject *object);
-static void gimp_filtered_container_real_src_remove (GimpFilteredContainer *filtered_container,
- GimpObject *object);
-static void gimp_filtered_container_real_src_freeze (GimpFilteredContainer *filtered_container);
-static void gimp_filtered_container_real_src_thaw (GimpFilteredContainer *filtered_container);
-
-static void gimp_filtered_container_filter (GimpFilteredContainer *filtered_container);
-static void gimp_filtered_container_src_add (GimpContainer *src_container,
- GimpObject *obj,
- GimpFilteredContainer *filtered_container);
-static void gimp_filtered_container_src_remove (GimpContainer *src_container,
- GimpObject *obj,
- GimpFilteredContainer *filtered_container);
-static void gimp_filtered_container_src_freeze (GimpContainer *src_container,
- GimpFilteredContainer *filtered_container);
-static void gimp_filtered_container_src_thaw (GimpContainer *src_container,
- GimpFilteredContainer *filtered_container);
+static void gimp_filtered_container_constructed (GObject *object);
+static void gimp_filtered_container_dispose (GObject *object);
+static void gimp_filtered_container_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_filtered_container_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_filtered_container_real_src_add (GimpFilteredContainer *filtered_container,
+ GimpObject *object);
+static void gimp_filtered_container_real_src_remove (GimpFilteredContainer *filtered_container,
+ GimpObject *object);
+static void gimp_filtered_container_real_src_freeze (GimpFilteredContainer *filtered_container);
+static void gimp_filtered_container_real_src_thaw (GimpFilteredContainer *filtered_container);
+
+static gboolean gimp_filtered_container_object_matches (GimpFilteredContainer *filtered_container,
+ GimpObject *object);
+static void gimp_filtered_container_src_add (GimpContainer *src_container,
+ GimpObject *obj,
+ GimpFilteredContainer *filtered_container);
+static void gimp_filtered_container_src_remove (GimpContainer *src_container,
+ GimpObject *obj,
+ GimpFilteredContainer *filtered_container);
+static void gimp_filtered_container_src_freeze (GimpContainer *src_container,
+ GimpFilteredContainer *filtered_container);
+static void gimp_filtered_container_src_thaw (GimpContainer *src_container,
+ GimpFilteredContainer *filtered_container);
G_DEFINE_TYPE (GimpFilteredContainer, gimp_filtered_container, GIMP_TYPE_LIST)
@@ -237,8 +238,7 @@ static void
gimp_filtered_container_real_src_add (GimpFilteredContainer *filtered_container,
GimpObject *object)
{
- if (! filtered_container->filter_func ||
- filtered_container->filter_func (object, filtered_container->filter_data))
+ if (gimp_filtered_container_object_matches (filtered_container, object))
{
gimp_container_add (GIMP_CONTAINER (filtered_container), object);
}
@@ -248,8 +248,7 @@ static void
gimp_filtered_container_real_src_remove (GimpFilteredContainer *filtered_container,
GimpObject *object)
{
- if (! filtered_container->filter_func ||
- filtered_container->filter_func (object, filtered_container->filter_data))
+ if (gimp_filtered_container_object_matches (filtered_container, object))
{
gimp_container_remove (GIMP_CONTAINER (filtered_container), object);
}
@@ -264,7 +263,19 @@ gimp_filtered_container_real_src_freeze (GimpFilteredContainer *filtered_contain
static void
gimp_filtered_container_real_src_thaw (GimpFilteredContainer *filtered_container)
{
- gimp_filtered_container_filter (filtered_container);
+ GList *list;
+
+ for (list = GIMP_LIST (filtered_container->src_container)->list;
+ list;
+ list = g_list_next (list))
+ {
+ GimpObject *object = list->data;
+
+ if (gimp_filtered_container_object_matches (filtered_container, object))
+ {
+ gimp_container_add (GIMP_CONTAINER (filtered_container), object);
+ }
+ }
}
/**
@@ -302,24 +313,13 @@ gimp_filtered_container_new (GimpContainer *src_container,
NULL);
}
-static void
-gimp_filtered_container_filter (GimpFilteredContainer *filtered_container)
+static gboolean
+gimp_filtered_container_object_matches (GimpFilteredContainer *filtered_container,
+ GimpObject *object)
{
- GList *list;
-
- for (list = GIMP_LIST (filtered_container->src_container)->list;
- list;
- list = g_list_next (list))
- {
- GimpObject *child = list->data;
-
- if (! filtered_container->filter_func ||
- filtered_container->filter_func (child,
- filtered_container->filter_data))
- {
- gimp_container_add (GIMP_CONTAINER (filtered_container), child);
- }
- }
+ return (! filtered_container->filter_func ||
+ filtered_container->filter_func (object,
+ filtered_container->filter_data));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]