Commit 4d6a6be8 authored by Benjamin Otte's avatar Benjamin Otte

API: colorchooser: Use GtkOrientation for orientation

Unfortunately, this swaps the values from the previous state.
But it's definitely a nicer API.
parent b83dcc26
......@@ -962,7 +962,7 @@ gtk_color_button_get_property (GObject *object,
static void
gtk_color_button_add_palette (GtkColorChooser *chooser,
gboolean horizontal,
GtkOrientation orientation,
gint colors_per_line,
gint n_colors,
GdkRGBA *colors)
......@@ -971,7 +971,7 @@ gtk_color_button_add_palette (GtkColorChooser *chooser,
if (button->priv->cs_dialog)
gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (button->priv->cs_dialog),
horizontal, colors_per_line, n_colors, colors);
orientation, colors_per_line, n_colors, colors);
}
typedef void (* get_rgba) (GtkColorChooser *, GdkRGBA *);
......
......@@ -201,8 +201,8 @@ gtk_color_chooser_set_use_alpha (GtkColorChooser *chooser,
/**
* gtk_color_chooser_add_palette:
* @chooser: a #GtkColorChooser
* @horizontal: %TRUE if the palette should be displayed in rows,
* %FALSE for columns
* @orientation: %GTK_ORIENTATION_HORIZONTAL if the palette should
* be displayed in rows, %GTK_ORIENTATION_VERTICAL for columns
* @colors_per_line: the number of colors to show in each row/column
* @n_colors: the total number of elements in @colors
* @colors: (allow-none) (array length=n_colors): the colors of the palette, or %NULL
......@@ -229,7 +229,7 @@ gtk_color_chooser_set_use_alpha (GtkColorChooser *chooser,
*/
void
gtk_color_chooser_add_palette (GtkColorChooser *chooser,
gboolean horizontal,
GtkOrientation orientation,
gint colors_per_line,
gint n_colors,
GdkRGBA *colors)
......@@ -237,7 +237,7 @@ gtk_color_chooser_add_palette (GtkColorChooser *chooser,
g_return_if_fail (GTK_IS_COLOR_CHOOSER (chooser));
if (GTK_COLOR_CHOOSER_GET_IFACE (chooser)->add_palette)
GTK_COLOR_CHOOSER_GET_IFACE (chooser)->add_palette (chooser, horizontal, colors_per_line, n_colors, colors);
GTK_COLOR_CHOOSER_GET_IFACE (chooser)->add_palette (chooser, orientation, colors_per_line, n_colors, colors);
}
cairo_pattern_t *
......
......@@ -46,7 +46,7 @@ struct _GtkColorChooserInterface
const GdkRGBA *color);
void (* add_palette) (GtkColorChooser *chooser,
gboolean horizontal,
GtkOrientation orientation,
gint colors_per_line,
gint n_colors,
GdkRGBA *colors);
......@@ -77,7 +77,7 @@ void gtk_color_chooser_set_use_alpha (GtkColorChooser *chooser,
GDK_AVAILABLE_IN_3_4
void gtk_color_chooser_add_palette (GtkColorChooser *chooser,
gboolean horizontal,
GtkOrientation orientation,
gint colors_per_line,
gint n_colors,
GdkRGBA *colors);
......
......@@ -256,7 +256,7 @@ gtk_color_chooser_dialog_set_rgba (GtkColorChooser *chooser,
static void
gtk_color_chooser_dialog_add_palette (GtkColorChooser *chooser,
gboolean horizontal,
GtkOrientation orientation,
gint colors_per_line,
gint n_colors,
GdkRGBA *colors)
......@@ -264,7 +264,7 @@ gtk_color_chooser_dialog_add_palette (GtkColorChooser *chooser,
GtkColorChooserDialog *cc = GTK_COLOR_CHOOSER_DIALOG (chooser);
gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (cc->priv->chooser),
horizontal, colors_per_line, n_colors, colors);
orientation, colors_per_line, n_colors, colors);
}
static void
......
......@@ -309,7 +309,7 @@ remove_palette (GtkColorChooserWidget *cc)
static void
add_palette (GtkColorChooserWidget *cc,
gboolean horizontal,
GtkOrientation orientation,
gint colors_per_line,
gint n_colors,
GdkRGBA *colors,
......@@ -368,7 +368,7 @@ add_palette (GtkColorChooserWidget *cc,
line = i / colors_per_line;
pos = i % colors_per_line;
if (horizontal)
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
if (pos == left)
gtk_style_context_add_class (gtk_widget_get_style_context (p), GTK_STYLE_CLASS_LEFT);
......@@ -773,7 +773,7 @@ gtk_color_chooser_widget_set_rgba (GtkColorChooser *chooser,
static void
gtk_color_chooser_widget_add_palette (GtkColorChooser *chooser,
gboolean horizontal,
GtkOrientation orientation,
gint colors_per_line,
gint n_colors,
GdkRGBA *colors)
......@@ -781,7 +781,7 @@ gtk_color_chooser_widget_add_palette (GtkColorChooser *chooser,
GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (chooser);
remove_default_palette (cc);
add_palette (cc, horizontal, colors_per_line, n_colors, colors, NULL);
add_palette (cc, orientation, colors_per_line, n_colors, colors, NULL);
}
static void
......
......@@ -80,14 +80,14 @@ main (int argc, char *argv[])
}
}
gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (dialog),
FALSE,
GTK_ORIENTATION_VERTICAL,
9, 9*9,
colors);
}
else if (g_strcmp0 (argv[i], "--no-palette") == 0)
{
gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (dialog),
FALSE, 0, 0, NULL);
GTK_ORIENTATION_VERTICAL, 0, 0, NULL);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment