[gtk+] API: colorchooser: Use GtkOrientation for orientation
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] API: colorchooser: Use GtkOrientation for orientation
- Date: Wed, 7 Mar 2012 02:11:24 +0000 (UTC)
commit 4d6a6be89795b7905f650a93b8e80beb1dc46747
Author: Benjamin Otte <otte redhat com>
Date: Wed Mar 7 03:07:02 2012 +0100
API: colorchooser: Use GtkOrientation for orientation
Unfortunately, this swaps the values from the previous state.
But it's definitely a nicer API.
gtk/gtkcolorbutton.c | 4 ++--
gtk/gtkcolorchooser.c | 8 ++++----
gtk/gtkcolorchooser.h | 4 ++--
gtk/gtkcolorchooserdialog.c | 4 ++--
gtk/gtkcolorchooserwidget.c | 8 ++++----
tests/testcolorchooser.c | 4 ++--
6 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index 194ece8..ab2821f 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -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 *);
diff --git a/gtk/gtkcolorchooser.c b/gtk/gtkcolorchooser.c
index 869f73b..532fcd3 100644
--- a/gtk/gtkcolorchooser.c
+++ b/gtk/gtkcolorchooser.c
@@ -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 *
diff --git a/gtk/gtkcolorchooser.h b/gtk/gtkcolorchooser.h
index f64d4fe..6d3a891 100644
--- a/gtk/gtkcolorchooser.h
+++ b/gtk/gtkcolorchooser.h
@@ -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);
diff --git a/gtk/gtkcolorchooserdialog.c b/gtk/gtkcolorchooserdialog.c
index 4b0b1c2..7877225 100644
--- a/gtk/gtkcolorchooserdialog.c
+++ b/gtk/gtkcolorchooserdialog.c
@@ -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
diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c
index ff51d73..92f293f 100644
--- a/gtk/gtkcolorchooserwidget.c
+++ b/gtk/gtkcolorchooserwidget.c
@@ -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
diff --git a/tests/testcolorchooser.c b/tests/testcolorchooser.c
index da6633b..4fb6354 100644
--- a/tests/testcolorchooser.c
+++ b/tests/testcolorchooser.c
@@ -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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]