[gimp] app: some code cleanup
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: some code cleanup
- Date: Tue, 23 Feb 2010 20:00:09 +0000 (UTC)
commit 7ea07c884bd7957c230fa682e8205d573505e1ef
Author: Michael Natterer <mitch gimp org>
Date: Tue Feb 23 20:59:10 2010 +0100
app: some code cleanup
- move curve creation and signal connection to a utility function
- formatting cleanup
app/core/gimpdynamicsoutput.c | 93 +++++++++++++++++++---------------------
1 files changed, 44 insertions(+), 49 deletions(-)
---
diff --git a/app/core/gimpdynamicsoutput.c b/app/core/gimpdynamicsoutput.c
index 628c4f5..a55ccea 100644
--- a/app/core/gimpdynamicsoutput.c
+++ b/app/core/gimpdynamicsoutput.c
@@ -63,18 +63,21 @@ enum
};
-static void gimp_dynamics_output_finalize (GObject *object);
-static void gimp_dynamics_output_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_dynamics_output_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-static void gimp_dynamics_output_copy_curve (GimpCurve *src,
- GimpCurve *dest);
-
+static void gimp_dynamics_output_finalize (GObject *object);
+static void gimp_dynamics_output_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_dynamics_output_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_dynamics_output_copy_curve (GimpCurve *src,
+ GimpCurve *dest);
+
+static GimpCurve *
+ gimp_dynamics_output_create_curve (GimpDynamicsOutput *output,
+ const gchar *name);
static void gimp_dynamics_output_curve_dirty (GimpCurve *curve,
GimpDynamicsOutput *output);
@@ -83,7 +86,6 @@ G_DEFINE_TYPE_WITH_CODE (GimpDynamicsOutput, gimp_dynamics_output,
GIMP_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
-
#define parent_class gimp_dynamics_output_parent_class
@@ -169,36 +171,18 @@ gimp_dynamics_output_class_init (GimpDynamicsOutputClass *klass)
static void
gimp_dynamics_output_init (GimpDynamicsOutput *output)
{
- output->pressure_curve = GIMP_CURVE (gimp_curve_new ("pressure-curve"));
- output->velocity_curve = GIMP_CURVE (gimp_curve_new ("velocity-curve"));
- output->direction_curve = GIMP_CURVE (gimp_curve_new ("direction-curve"));
- output->tilt_curve = GIMP_CURVE (gimp_curve_new ("tilt-curve"));
- output->random_curve = GIMP_CURVE (gimp_curve_new ("random-curve"));
- output->fade_curve = GIMP_CURVE (gimp_curve_new ("fade-curve"));
-
- g_signal_connect_object (output->pressure_curve, "dirty",
- G_CALLBACK (gimp_dynamics_output_curve_dirty),
- output, 0);
-
- g_signal_connect_object (output->velocity_curve, "dirty",
- G_CALLBACK (gimp_dynamics_output_curve_dirty),
- output, 0);
-
- g_signal_connect_object (output->direction_curve, "dirty",
- G_CALLBACK (gimp_dynamics_output_curve_dirty),
- output, 0);
-
- g_signal_connect_object (output->tilt_curve, "dirty",
- G_CALLBACK (gimp_dynamics_output_curve_dirty),
- output, 0);
-
- g_signal_connect_object (output->random_curve, "dirty",
- G_CALLBACK (gimp_dynamics_output_curve_dirty),
- output, 0);
-
- g_signal_connect_object (output->fade_curve, "dirty",
- G_CALLBACK (gimp_dynamics_output_curve_dirty),
- output, 0);
+ output->pressure_curve = gimp_dynamics_output_create_curve (output,
+ "pressure-curve");
+ output->velocity_curve = gimp_dynamics_output_create_curve (output,
+ "velocity-curve");
+ output->direction_curve = gimp_dynamics_output_create_curve (output,
+ "direction-curve");
+ output->tilt_curve = gimp_dynamics_output_create_curve (output,
+ "tilt-curve");
+ output->random_curve = gimp_dynamics_output_create_curve (output,
+ "random-curve");
+ output->fade_curve = gimp_dynamics_output_create_curve (output,
+ "fade-curve");
}
static void
@@ -328,7 +312,6 @@ gimp_dynamics_output_get_property (GObject *object,
g_value_set_boolean (value, output->use_fade);
break;
-
case PROP_PRESSURE_CURVE:
g_value_set_object (value, output->pressure_curve);
break;
@@ -628,10 +611,10 @@ gimp_dynamics_output_get_aspect_value (GimpDynamicsOutput *output,
}
static void
-gimp_dynamics_output_copy_curve(GimpCurve *src,
- GimpCurve *dest)
+gimp_dynamics_output_copy_curve (GimpCurve *src,
+ GimpCurve *dest)
{
- if (src && dest)
+ if (src && dest)
{
gimp_config_copy (GIMP_CONFIG (src),
GIMP_CONFIG (dest),
@@ -639,10 +622,22 @@ gimp_dynamics_output_copy_curve(GimpCurve *src,
}
}
+static GimpCurve *
+gimp_dynamics_output_create_curve (GimpDynamicsOutput *output,
+ const gchar *name)
+{
+ GimpCurve *curve = GIMP_CURVE (gimp_curve_new (name));
+
+ g_signal_connect_object (curve, "dirty",
+ G_CALLBACK (gimp_dynamics_output_curve_dirty),
+ output, 0);
+
+ return curve;
+}
+
static void
gimp_dynamics_output_curve_dirty (GimpCurve *curve,
GimpDynamicsOutput *output)
{
- g_object_notify (G_OBJECT (output), gimp_object_get_name(curve));
+ g_object_notify (G_OBJECT (output), gimp_object_get_name (curve));
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]