Simplify GtkColorScale private api a bit

This commit is contained in:
Matthias Clasen 2012-02-03 12:13:06 -05:00
parent 6ed16b5b41
commit 1f68d7d827
3 changed files with 20 additions and 21 deletions

View File

@ -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,

View File

@ -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),
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;
}

View File

@ -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);