[goffice] Namespace: hide default_color_set.



commit b409430d958e76a3adeafec2855470970ad68309
Author: Morten Welinder <terra gnome org>
Date:   Thu Mar 21 18:54:29 2013 -0400

    Namespace: hide default_color_set.

 goffice/gtk/go-color-palette.c  |    8 +++++++-
 goffice/gtk/go-color-palette.h  |    3 +++
 goffice/gtk/go-color-selector.c |   10 +++++++---
 goffice/utils/go-color.c        |   10 ++--------
 goffice/utils/go-color.h        |    9 +++++++--
 goffice/utils/go-gradient.c     |    3 +--
 6 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/goffice/gtk/go-color-palette.c b/goffice/gtk/go-color-palette.c
index b143b2d..06a6434 100644
--- a/goffice/gtk/go-color-palette.c
+++ b/goffice/gtk/go-color-palette.c
@@ -72,7 +72,8 @@ enum {
        LAST_SIGNAL
 };
 
-GONamedColor const default_color_set [] = {
+static GONamedColor const default_color_set [] = {
+       /* xgettext: See https://bugzilla.gnome.org/attachment.cgi?id=222905 */
        { GO_COLOR_FROM_RGBA (0x00, 0x00, 0x00, 0xff), N_("black")},
        { GO_COLOR_FROM_RGBA (0x99, 0x33, 0x00, 0xff), N_("light brown")},
        { GO_COLOR_FROM_RGBA (0x33, 0x33, 0x00, 0xff), N_("brown gold")},
@@ -141,6 +142,11 @@ GONamedColor const default_color_set [] = {
 
        { 0, NULL},
 };
+const GONamedColor *
+_go_color_palette_default_color_set (void)
+{
+       return default_color_set;
+}
 
 static guint go_color_palette_signals [LAST_SIGNAL] = { 0, };
 
diff --git a/goffice/gtk/go-color-palette.h b/goffice/gtk/go-color-palette.h
index e41c220..f5804a1 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);
 
+/* private */
+const GONamedColor *_go_color_palette_default_color_set (void);
+
 G_END_DECLS
 
 #endif /* __GO_COLOR_PALETTE_H__ */
diff --git a/goffice/gtk/go-color-selector.c b/goffice/gtk/go-color-selector.c
index 3951d0b..e9b8b74 100644
--- a/goffice/gtk/go-color-selector.c
+++ b/goffice/gtk/go-color-selector.c
@@ -29,8 +29,6 @@
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 
-extern GONamedColor default_color_set [];
-
 typedef struct {
        int n_swatches;
        GOColorGroup *color_group;
@@ -52,6 +50,8 @@ get_index (int n_swatches, GOColorGroup *color_group, GOColor color)
 {
        int i = 0;
        int index = -1;
+       const GONamedColor *default_color_set =
+               _go_color_palette_default_color_set ();
 
        while (default_color_set[i].name != NULL) {
                if (default_color_set[i].color == color && index < 0) {
@@ -76,6 +76,9 @@ get_index (int n_swatches, GOColorGroup *color_group, GOColor color)
 static GOColor
 get_color (int n_swatches, GOColorGroup *color_group, int index)
 {
+       const GONamedColor *default_color_set =
+               _go_color_palette_default_color_set ();
+
        if (index < 0 || index >= (n_swatches))
                index = 0;
 
@@ -287,7 +290,8 @@ go_selector_new_color (GOColor initial_color,
        state->default_color = default_color;
        state->allow_alpha = TRUE;
 
-       while (default_color_set[count].name != NULL) count ++;
+       while (_go_color_palette_default_color_set ()[count].name)
+               count++;
        state->n_swatches = count + GO_COLOR_GROUP_HISTORY_SIZE;
        state->color_group = go_color_group_fetch (group, NULL);
 
diff --git a/goffice/utils/go-color.c b/goffice/utils/go-color.c
index c8bee8a..175829e 100644
--- a/goffice/utils/go-color.c
+++ b/goffice/utils/go-color.c
@@ -1,6 +1,6 @@
 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * gog-color.c :
+ * go-color.c :
  *
  * Copyright (C) 2003-2004 Jody Goldberg (jody gnome org)
  *
@@ -21,17 +21,11 @@
  */
 
 #include <goffice/goffice-config.h>
-#include "go-color.h"
+#include <goffice/goffice.h>
 
 #include <stdio.h>
 
 /**
- * GONamedColor:
- * @color: the color.
- * @name: english name - eg. "white".
- **/
-
-/**
  * go_color_from_str :
  * @str :
  * @res :
diff --git a/goffice/utils/go-color.h b/goffice/utils/go-color.h
index d967b17..b54e2d0 100644
--- a/goffice/utils/go-color.h
+++ b/goffice/utils/go-color.h
@@ -29,9 +29,14 @@
 
 G_BEGIN_DECLS
 
+/**
+ * GONamedColor:
+ * @color: the color.
+ * @name: untranslated name - eg. "white".
+ **/
 typedef struct {
-       GOColor          color;
-       char const      *name;  /* english name - eg. "white" */
+       GOColor color;
+       char const *name;
 } GONamedColor;
 
 /*
diff --git a/goffice/utils/go-gradient.c b/goffice/utils/go-gradient.c
index bd478cd..5bd0c92 100644
--- a/goffice/utils/go-gradient.c
+++ b/goffice/utils/go-gradient.c
@@ -20,8 +20,7 @@
  */
 
 #include <goffice/goffice-config.h>
-#include "go-gradient.h"
-#include "go-color.h"
+#include <goffice/goffice.h>
 
 #ifdef GOFFICE_WITH_GTK
 #include <goffice/gtk/go-combo-pixmaps.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]