[gtk+/wip/colorchooser-v2: 33/40] Simplify GtkColorScale private api a bit
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/colorchooser-v2: 33/40] Simplify GtkColorScale private api a bit
- Date: Tue, 7 Feb 2012 17:47:15 +0000 (UTC)
commit 48d8da8b52a0b97c3f93c4f95933c0cb24b6c803
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Feb 3 12:13:06 2012 -0500
Simplify GtkColorScale private api a bit
gtk/gtkcoloreditor.c | 18 ++++++------------
gtk/gtkcolorscale.c | 18 ++++++++++++------
gtk/gtkcolorscale.h | 5 ++---
3 files changed, 20 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtkcoloreditor.c b/gtk/gtkcoloreditor.c
index 99e3c53..1e5146c 100644
--- a/gtk/gtkcoloreditor.c
+++ b/gtk/gtkcoloreditor.c
@@ -396,23 +396,17 @@ gtk_color_editor_init (GtkColorEditor *editor)
g_signal_connect (editor->priv->entry, "focus-out-event",
G_CALLBACK (entry_focus_out), editor);
- editor->priv->h_slider = slider = g_object_new (GTK_TYPE_COLOR_SCALE,
- "adjustment", editor->priv->h_adj,
- "draw-value", FALSE,
- "orientation", GTK_ORIENTATION_VERTICAL,
- NULL);
- gtk_color_scale_set_type (GTK_COLOR_SCALE (slider), GTK_COLOR_SCALE_HUE);
+ editor->priv->h_slider = slider = gtk_color_scale_new (editor->priv->h_adj,
+ GTK_COLOR_SCALE_HUE);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (slider), GTK_ORIENTATION_VERTICAL);
if (gtk_widget_get_direction (slider) == GTK_TEXT_DIR_RTL)
gtk_style_context_add_class (gtk_widget_get_style_context (slider), GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE);
else
gtk_style_context_add_class (gtk_widget_get_style_context (slider), GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW);
- editor->priv->a_slider = slider = g_object_new (GTK_TYPE_COLOR_SCALE,
- "adjustment", editor->priv->a_adj,
- "draw-value", FALSE,
- "orientation", GTK_ORIENTATION_HORIZONTAL,
- NULL);
- gtk_color_scale_set_type (GTK_COLOR_SCALE (slider), GTK_COLOR_SCALE_ALPHA);
+ editor->priv->a_slider = slider = gtk_color_scale_new (editor->priv->a_adj,
+ GTK_COLOR_SCALE_ALPHA);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (slider), GTK_ORIENTATION_HORIZONTAL);
gtk_style_context_add_class (gtk_widget_get_style_context (slider), GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE);
editor->priv->sv_plane = gtk_color_plane_new (editor->priv->h_adj,
diff --git a/gtk/gtkcolorscale.c b/gtk/gtkcolorscale.c
index 9e8401e..a5cbae5 100644
--- a/gtk/gtkcolorscale.c
+++ b/gtk/gtkcolorscale.c
@@ -309,7 +309,7 @@ gtk_color_scale_set_color (GtkColorScale *scale,
gtk_widget_queue_draw (GTK_WIDGET (scale));
}
-void
+static void
gtk_color_scale_set_type (GtkColorScale *scale,
GtkColorScaleType type)
{
@@ -333,10 +333,16 @@ gtk_color_scale_set_type (GtkColorScale *scale,
}
GtkWidget *
-gtk_color_scale_new (void)
+gtk_color_scale_new (GtkAdjustment *adjustment,
+ GtkColorScaleType type)
{
- return (GtkWidget *) g_object_new (GTK_TYPE_COLOR_SCALE,
- "adjustment", gtk_adjustment_new (0, 0, 1, 0.01, 0.1, 0),
- "draw-value", FALSE,
- NULL);
+ GtkWidget *scale;
+
+ scale = (GtkWidget *) g_object_new (GTK_TYPE_COLOR_SCALE,
+ "adjustment", adjustment,
+ "draw-value", FALSE,
+ NULL);
+ gtk_color_scale_set_type (GTK_COLOR_SCALE (scale), type);
+
+ return scale;
}
diff --git a/gtk/gtkcolorscale.h b/gtk/gtkcolorscale.h
index f5d28ba..767b010 100644
--- a/gtk/gtkcolorscale.h
+++ b/gtk/gtkcolorscale.h
@@ -68,10 +68,9 @@ G_GNUC_INTERNAL
GType gtk_color_scale_get_type (void) G_GNUC_CONST;
G_GNUC_INTERNAL
-GtkWidget * gtk_color_scale_new (void);
-G_GNUC_INTERNAL
-void gtk_color_scale_set_type (GtkColorScale *scale,
+GtkWidget * gtk_color_scale_new (GtkAdjustment *adjustment,
GtkColorScaleType type);
+
G_GNUC_INTERNAL
void gtk_color_scale_set_color (GtkColorScale *scale,
const GdkRGBA *color);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]