[goffice] GOColorPalette: allow querying the default colours.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] GOColorPalette: allow querying the default colours.
- Date: Mon, 9 Apr 2018 23:58:56 +0000 (UTC)
commit c12bb8f6548e9a0e387082661c84c81de7ac0422
Author: Morten Welinder <terra gnome org>
Date: Mon Apr 9 19:58:25 2018 -0400
GOColorPalette: allow querying the default colours.
goffice/gtk/go-color-palette.c | 14 ++++++++++++++
goffice/gtk/go-color-palette.h | 3 +++
2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/goffice/gtk/go-color-palette.c b/goffice/gtk/go-color-palette.c
index e8e1a1b..4549ab8 100644
--- a/goffice/gtk/go-color-palette.c
+++ b/goffice/gtk/go-color-palette.c
@@ -144,6 +144,20 @@ static GONamedColor const default_color_set [] = {
{ 0, NULL},
};
+
+gboolean
+go_color_palette_query (int n, GONamedColor *color)
+{
+ if (n < 0 || n >= (int)G_N_ELEMENTS (default_color_set) - 1)
+ return FALSE;
+
+ color->name = _(default_color_set[n].name);
+ color->color = default_color_set[n].color;
+ return TRUE;
+}
+
+
+
const GONamedColor *
_go_color_palette_default_color_set (void)
{
diff --git a/goffice/gtk/go-color-palette.h b/goffice/gtk/go-color-palette.h
index f5804a1..6a584e2 100644
--- a/goffice/gtk/go-color-palette.h
+++ b/goffice/gtk/go-color-palette.h
@@ -60,6 +60,9 @@ GOColor go_color_palette_get_current_color (GOColorPalette *p,
gboolean *is_default, gboolean *is_custom);
void go_color_palette_set_allow_alpha (GOColorPalette *p, gboolean allow_alpha);
+/* static */
+gboolean go_color_palette_query (int n, GONamedColor *color);
+
/* private */
const GONamedColor *_go_color_palette_default_color_set (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]