]> git.sur5r.net Git - glabels/commitdiff
Use GConf to store custom color history
authorJim Evins <evins@snaught.com>
Sat, 24 Oct 2009 12:53:10 +0000 (08:53 -0400)
committerJim Evins <evins@snaught.com>
Sat, 24 Oct 2009 12:53:10 +0000 (08:53 -0400)
Renamed glColorComboHistory to glColorHistoryModel and reconciled style
with glFontHistoryModel.  glColorHistoryModel now front-ends GConf to store
custom color history between sessions.

po/POTFILES.in
src/Makefile.am
src/color-combo-history.c [deleted file]
src/color-combo-history.h [deleted file]
src/color-combo-menu.c
src/color-history-model.c [new file with mode: 0644]
src/color-history-model.h [new file with mode: 0644]
src/font-history-model.c
src/font-history-model.h

index a134b2aa7584b6d31daca2fc0d59909f5dcd438a..f83e8cafeb75eb974d093df6ccca2c303fd85349 100644 (file)
@@ -1,9 +1,9 @@
 # List of source files containing translatable strings.
 
 src/bc.c
+src/bc.h
 src/bc-gnubarcode.c
 src/bc-gnubarcode.h
-src/bc.h
 src/bc-iec16022.c
 src/bc-iec16022.h
 src/bc-iec18004.c
@@ -19,17 +19,17 @@ src/cairo-label-path.h
 src/cairo-markup-path.c
 src/cairo-markup-path.h
 src/color.c
+src/color.h
 src/color-combo-button.c
 src/color-combo-button.h
 src/color-combo.c
 src/color-combo-color-menu-item.c
 src/color-combo-color-menu-item.h
 src/color-combo.h
-src/color-combo-history.c
-src/color-combo-history.h
 src/color-combo-menu.c
 src/color-combo-menu.h
-src/color.h
+src/color-history-model.c
+src/color-history-model.h
 src/color-swatch.c
 src/color-swatch.h
 src/combo-util.c
@@ -82,9 +82,9 @@ src/label-text.h
 #src/marshal.c
 #src/marshal.h
 src/merge.c
+src/merge.h
 src/merge-evolution.c
 src/merge-evolution.h
-src/merge.h
 src/merge-init.c
 src/merge-init.h
 src/merge-properties-dialog.c
@@ -120,9 +120,9 @@ src/object-editor-text-page.c
 src/pixbuf-cache.c
 src/pixbuf-cache.h
 src/prefs.c
+src/prefs.h
 src/prefs-dialog.c
 src/prefs-dialog.h
-src/prefs.h
 src/prefs-model.c
 src/prefs-model.h
 src/print.c
@@ -144,23 +144,23 @@ src/template-designer.h
 src/text-node.c
 src/text-node.h
 src/ui.c
+src/ui.h
 src/ui-commands.c
 src/ui-commands.h
-src/ui.h
 src/ui-property-bar.c
 src/ui-property-bar.h
 src/ui-sidebar.c
 src/ui-sidebar.h
 src/ui-util.c
 src/ui-util.h
+src/view.c
+src/view.h
 src/view-barcode.c
 src/view-barcode.h
 src/view-box.c
 src/view-box.h
-src/view.c
 src/view-ellipse.c
 src/view-ellipse.h
-src/view.h
 src/view-image.c
 src/view-image.h
 src/view-line.c
index b851e3dfa5ecffccbbcdbd8120a6f1d53623e584..36de5af874a8cf72be92ed68e04765259bd78746 100644 (file)
@@ -191,8 +191,8 @@ glabels_SOURCES =                   \
        color-combo-menu.h              \
        color-combo-color-menu-item.c   \
        color-combo-color-menu-item.h   \
-       color-combo-history.c           \
-       color-combo-history.h           \
+       color-history-model.c           \
+       color-history-model.h           \
        color-swatch.c                  \
        color-swatch.h                  \
        font-combo.c                    \
diff --git a/src/color-combo-history.c b/src/color-combo-history.c
deleted file mode 100644 (file)
index 31eacf4..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- *  color-combo-history.c
- *  Copyright (C) 2008  Jim Evins <evins@snaught.com>.
- *
- *  This file is part of gLabels.
- *
- *  gLabels is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  gLabels is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-#include "color-combo-history.h"
-
-#include "color.h"
-
-
-/*========================================================*/
-/* Private types.                                         */
-/*========================================================*/
-
-/** GL_COLOR_COMBO_HISTORY Private fields */
-struct _glColorComboHistoryPrivate {
-
-        guint       max_n;
-
-        guint       n;
-        guint      *color;
-};
-
-
-/*========================================================*/
-/* Private globals.                                       */
-/*========================================================*/
-
-
-/*========================================================*/
-/* Private function prototypes.                           */
-/*========================================================*/
-
-static void gl_color_combo_history_finalize      (GObject             *object);
-
-
-/*****************************************************************************/
-/* Object infrastructure.                                                    */
-/*****************************************************************************/
-G_DEFINE_TYPE (glColorComboHistory, gl_color_combo_history, G_TYPE_OBJECT);
-
-
-/*****************************************************************************/
-/* Class Init Function.                                                      */
-/*****************************************************************************/
-static void
-gl_color_combo_history_class_init (glColorComboHistoryClass *class)
-{
-        GObjectClass              *gobject_class = (GObjectClass *) class;
-
-        gl_color_combo_history_parent_class = g_type_class_peek_parent (class);
-
-        gobject_class->finalize = gl_color_combo_history_finalize;
-}
-
-
-/*****************************************************************************/
-/* Object Instance Init Function.                                            */
-/*****************************************************************************/
-static void
-gl_color_combo_history_init (glColorComboHistory *this)
-{
-        this->priv = g_new0 (glColorComboHistoryPrivate, 1);
-}
-
-
-/*****************************************************************************/
-/* Finalize Method.                                                          */
-/*****************************************************************************/
-static void
-gl_color_combo_history_finalize (GObject *object)
-{
-        glColorComboHistory    *this;
-
-        g_return_if_fail (object && IS_GL_COLOR_COMBO_HISTORY (object));
-        this = GL_COLOR_COMBO_HISTORY (object);
-
-        g_free (this->priv->color);
-        g_free (this->priv);
-
-        G_OBJECT_CLASS (gl_color_combo_history_parent_class)->finalize (object);
-}
-
-
-/*****************************************************************************/
-/** New Object Generator.                                                    */
-/*****************************************************************************/
-glColorComboHistory *
-gl_color_combo_history_new (guint n)
-{
-        glColorComboHistory *this;
-
-        this = g_object_new (TYPE_GL_COLOR_COMBO_HISTORY, NULL);
-
-        this->priv->max_n = n;
-        this->priv->n     = 0;
-        if (n > 0)
-        {
-                this->priv->color = g_new0 (guint, n);
-        }
-
-        return this;
-}
-
-
-/*****************************************************************************/
-/* Add color to history.                                                     */
-/*****************************************************************************/
-void
-gl_color_combo_history_add_color (glColorComboHistory *this,
-                                  guint                color)
-{
-        guint i;
-
-        /*
-         * First check for duplicate color.
-         */
-        for ( i=0; i < this->priv->n; i++ )
-        {
-                if ( this->priv->color[i] == color )
-                {
-                        return;
-                }
-        }
-
-        /*
-         * Simple case.
-         */
-        if ( this->priv->n < this->priv->max_n )
-        {
-                this->priv->color[ this->priv->n ] = color;
-                this->priv->n++;
-
-                return;
-        }
-
-        /* Move colors down, dropping oldest. */
-        for ( i=0; i < (this->priv->n - 1); i++ )
-        {
-                this->priv->color[i] = this->priv->color[i+1];
-        }
-        this->priv->color[ this->priv->n - 1 ] = color;
-}
-
-/*****************************************************************************/
-/* Get color.                                                                */
-/*****************************************************************************/
-guint
-gl_color_combo_history_get_color (glColorComboHistory *this,
-                                  guint                i)
-{
-        return this->priv->color[i];
-}
-
-
-
-/*
- * Local Variables:       -- emacs
- * mode: C                -- emacs
- * c-basic-offset: 8      -- emacs
- * tab-width: 8           -- emacs
- * indent-tabs-mode: nil  -- emacs
- * End:                   -- emacs
- */
diff --git a/src/color-combo-history.h b/src/color-combo-history.h
deleted file mode 100644 (file)
index a5439a3..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *  color-combo-history.h
- *  Copyright (C) 2008  Jim Evins <evins@snaught.com>.
- *
- *  This file is part of gLabels.
- *
- *  gLabels is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  gLabels is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __GL_COLOR_COMBO_HISTORY_H__
-#define __GL_COLOR_COMBO_HISTORY_H__
-
-
-#include <glib-object.h>
-
-
-G_BEGIN_DECLS
-
-/* Utility Macros */
-#define TYPE_GL_COLOR_COMBO_HISTORY              (gl_color_combo_history_get_type ())
-#define GL_COLOR_COMBO_HISTORY(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GL_COLOR_COMBO_HISTORY, glColorComboHistory))
-#define GL_COLOR_COMBO_HISTORY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GL_COLOR_COMBO_HISTORY, glColorComboHistoryClass))
-#define IS_GL_COLOR_COMBO_HISTORY(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GL_COLOR_COMBO_HISTORY))
-#define IS_GL_COLOR_COMBO_HISTORY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GL_COLOR_COMBO_HISTORY))
-#define GL_COLOR_COMBO_HISTORY_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), TYPE_GL_COLOR_COMBO_HISTORY, glColorComboHistoryClass))
-
-
-/* Type definitions */
-typedef struct _glColorComboHistory          glColorComboHistory;
-typedef struct _glColorComboHistoryPrivate   glColorComboHistoryPrivate;
-typedef struct _glColorComboHistoryClass     glColorComboHistoryClass;
-
-
-/** GL_COLOR_COMBO_HISTORY Object */
-struct _glColorComboHistory {
-        GObject                        parent;
-
-        glColorComboHistoryPrivate    *priv;
-};
-
-/** GL_COLOR_COMBO_HISTORY Class */
-struct _glColorComboHistoryClass {
-        GObjectClass                   parent_class;
-};
-
-
-GType                gl_color_combo_history_get_type  (void) G_GNUC_CONST;
-
-glColorComboHistory *gl_color_combo_history_new       (guint                n);
-
-void                 gl_color_combo_history_add_color (glColorComboHistory *this,
-                                                       guint                color);
-
-guint                gl_color_combo_history_get_color (glColorComboHistory *this,
-                                                       guint                i);
-
-
-G_END_DECLS
-
-#endif /* __GL_COLOR_COMBO_HISTORY_H__ */
-
-
-
-/*
- * Local Variables:       -- emacs
- * mode: C                -- emacs
- * c-basic-offset: 8      -- emacs
- * tab-width: 8           -- emacs
- * indent-tabs-mode: nil  -- emacs
- * End:                   -- emacs
- */
index 01e3b77d4d9259c56b2b679b99c584d8f596a83b..7e2bf15599ac9fa6575c003ced877f2a190b0469 100644 (file)
@@ -26,7 +26,7 @@
 #include <gtk/gtk.h>
 
 #include "color-combo-color-menu-item.h"
-#include "color-combo-history.h"
+#include "color-history-model.h"
 #include "color.h"
 #include "marshal.h"
 
@@ -122,7 +122,7 @@ static ColorTableEntry color_table[] =
 
 };
 
-static glColorComboHistory *custom_color_history = NULL;
+static glColorHistoryModel *custom_color_history = NULL;
 
 
 /*===========================================*/
@@ -195,7 +195,7 @@ gl_color_combo_menu_init (glColorComboMenu *this)
          */
         if ( !custom_color_history )
         {
-                custom_color_history = gl_color_combo_history_new (PALETTE_COLS);
+                custom_color_history = gl_color_history_model_new (PALETTE_COLS);
         }
 
 
@@ -307,7 +307,7 @@ load_custom_color_history (glColorComboMenu *this)
 
         for ( i=0; i < PALETTE_COLS; i++ )
         {
-                color = gl_color_combo_history_get_color (custom_color_history, i);
+                color = gl_color_history_model_get_color (custom_color_history, i);
 
                 if (color)
                 {
@@ -386,7 +386,7 @@ custom_menu_item_activate_cb (glColorComboMenu *this)
                                               (color.green >>8),
                                               (color.blue  >>8));
 
-                gl_color_combo_history_add_color (custom_color_history,
+                gl_color_history_model_add_color (custom_color_history,
                                                   this->priv->color);
 
                 g_signal_emit (this, signals[COLOR_CHANGED], 0,
@@ -431,8 +431,7 @@ history_menu_item_activate_cb (GtkMenuItem      *item,
 
         i = gl_color_combo_color_menu_item_get_id (GL_COLOR_COMBO_COLOR_MENU_ITEM (item));
 
-        this->priv->color = gl_color_combo_history_get_color (custom_color_history,
-                                                              i);
+        this->priv->color = gl_color_history_model_get_color (custom_color_history, i);
 
         g_signal_emit (this, signals[COLOR_CHANGED], 0,
                        this->priv->color, FALSE);
diff --git a/src/color-history-model.c b/src/color-history-model.c
new file mode 100644 (file)
index 0000000..cf11a80
--- /dev/null
@@ -0,0 +1,275 @@
+/*
+ *  color-history-model.c
+ *  Copyright (C) 2008-2009  Jim Evins <evins@snaught.com>.
+ *
+ *  This file is part of gLabels.
+ *
+ *  gLabels is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  gLabels is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "color-history-model.h"
+
+#include <gconf/gconf-client.h>
+
+#include "marshal.h"
+
+
+#define BASE_KEY          "/apps/glabels"
+#define RECENT_COLORS_KEY  BASE_KEY "/recent-colors"
+
+
+/*========================================================*/
+/* Private types.                                         */
+/*========================================================*/
+
+/** GL_COLOR_HISTORY_MODEL Private fields */
+struct _glColorHistoryModelPrivate {
+
+       GConfClient *gconf_client;
+
+        guint        max_n;
+};
+
+enum {
+       CHANGED,
+       LAST_SIGNAL
+};
+
+
+/*========================================================*/
+/* Private globals.                                       */
+/*========================================================*/
+
+static guint signals[LAST_SIGNAL] = {0};
+
+
+/*========================================================*/
+/* Private function prototypes.                           */
+/*========================================================*/
+
+static void gl_color_history_model_finalize     (GObject             *object);
+
+static void conf_notify_cb                      (GConfClient         *client,
+                                                 guint                cnxn_id,
+                                                 GConfEntry          *entry,
+                                                 glColorHistoryModel *this);
+
+static GSList *get_color_list                   (glColorHistoryModel *this);
+
+
+/*****************************************************************************/
+/* Object infrastructure.                                                    */
+/*****************************************************************************/
+G_DEFINE_TYPE (glColorHistoryModel, gl_color_history_model, G_TYPE_OBJECT);
+
+
+/*****************************************************************************/
+/* Class Init Function.                                                      */
+/*****************************************************************************/
+static void
+gl_color_history_model_class_init (glColorHistoryModelClass *class)
+{
+        GObjectClass  *gobject_class = (GObjectClass *) class;
+
+        gl_color_history_model_parent_class = g_type_class_peek_parent (class);
+
+        gobject_class->finalize = gl_color_history_model_finalize;
+
+       signals[CHANGED] =
+               g_signal_new ("changed",
+                             G_OBJECT_CLASS_TYPE (gobject_class),
+                             G_SIGNAL_RUN_LAST,
+                             G_STRUCT_OFFSET (glColorHistoryModelClass, changed),
+                             NULL, NULL,
+                             gl_marshal_VOID__VOID,
+                             G_TYPE_NONE,
+                             0);
+}
+
+
+/*****************************************************************************/
+/* Object Instance Init Function.                                            */
+/*****************************************************************************/
+static void
+gl_color_history_model_init (glColorHistoryModel *this)
+{
+        this->priv = g_new0 (glColorHistoryModelPrivate, 1);
+
+        this->priv->gconf_client = gconf_client_get_default ();
+
+        g_return_if_fail (this->priv->gconf_client != NULL);
+
+        gconf_client_add_dir (this->priv->gconf_client,
+                              BASE_KEY,
+                              GCONF_CLIENT_PRELOAD_ONELEVEL,
+                              NULL);
+
+        gconf_client_notify_add (this->priv->gconf_client,
+                                 RECENT_COLORS_KEY,
+                                 (GConfClientNotifyFunc)conf_notify_cb, this,
+                                 NULL, NULL);
+}
+
+
+/*****************************************************************************/
+/* Finalize Method.                                                          */
+/*****************************************************************************/
+static void
+gl_color_history_model_finalize (GObject *object)
+{
+        glColorHistoryModel   *this;
+
+        g_return_if_fail (object && IS_GL_COLOR_HISTORY_MODEL (object));
+        this = GL_COLOR_HISTORY_MODEL (object);
+
+        g_object_unref (G_OBJECT(this->priv->gconf_client));
+        g_free (this->priv);
+
+        G_OBJECT_CLASS (gl_color_history_model_parent_class)->finalize (object);
+}
+
+
+/*****************************************************************************/
+/** New Object Generator.                                                    */
+/*****************************************************************************/
+glColorHistoryModel *
+gl_color_history_model_new (guint n)
+{
+        glColorHistoryModel *this;
+
+        this = g_object_new (TYPE_GL_COLOR_HISTORY_MODEL, NULL);
+
+        this->priv->max_n = n;
+
+        return this;
+}
+
+
+/*****************************************************************************/
+/* Add color to history.                                                      */
+/*****************************************************************************/
+void
+gl_color_history_model_add_color (glColorHistoryModel *this,
+                                  guint                color)
+{
+        GSList  *list = NULL;
+        GSList  *old_list;
+        GSList  *p;
+
+        /*
+         * Start new list with this color.
+         */
+        list = g_slist_append (list, GINT_TO_POINTER (color));
+
+        /*
+         * Transfer old list to new list, ignoring any duplicate of this color
+         */
+        old_list = get_color_list (this);
+        for ( p = old_list; p; p=p->next )
+        {
+                if ( color != (guint)GPOINTER_TO_INT (p->data) )
+                {
+                        list = g_slist_append (list, p->data);
+                }
+        }
+        g_slist_free (old_list);
+
+        /*
+         * Truncate list to maximum size
+         */
+        while (g_slist_length (list) > this->priv->max_n)
+        {
+                p = g_slist_last (list);
+                list = g_slist_remove_link (list, p);
+                g_slist_free_1 (p);
+        }
+
+        /*
+         * Update conf
+         */
+        gconf_client_set_list (this->priv->gconf_client,
+                               RECENT_COLORS_KEY,
+                               GCONF_VALUE_INT,
+                               list,
+                               NULL);
+}
+
+
+/*****************************************************************************/
+/* GConf notify callback.                                                    */
+/*****************************************************************************/
+static void
+conf_notify_cb (GConfClient         *client,
+                guint                cnxn_id,
+                GConfEntry          *entry,
+                glColorHistoryModel  *this)
+{
+        g_signal_emit (G_OBJECT(this), signals[CHANGED], 0);
+}
+
+
+/*****************************************************************************/
+/* Get list of colors.                                                       */
+/*****************************************************************************/
+static GSList *
+get_color_list (glColorHistoryModel *this)
+{
+        GSList *list;
+
+        /*
+         * Get color list.
+         */
+       list = gconf_client_get_list (this->priv->gconf_client,
+                                      RECENT_COLORS_KEY,
+                                      GCONF_VALUE_INT,
+                                      NULL);
+        return list;
+}
+
+
+/*****************************************************************************/
+/* Get color.                                                                */
+/*****************************************************************************/
+guint
+gl_color_history_model_get_color (glColorHistoryModel *this,
+                                  guint                i)
+{
+        guint   color = 0;
+        GSList *list;
+        GSList *p;
+
+        list = get_color_list (this);
+        p = g_slist_nth (list, i);
+        if (p)
+        {
+                color = GPOINTER_TO_INT (p->data);
+        }
+        g_slist_free (list);
+
+        return color;
+}
+
+
+
+
+/*
+ * Local Variables:       -- emacs
+ * mode: C                -- emacs
+ * c-basic-offset: 8      -- emacs
+ * tab-width: 8           -- emacs
+ * indent-tabs-mode: nil  -- emacs
+ * End:                   -- emacs
+ */
diff --git a/src/color-history-model.h b/src/color-history-model.h
new file mode 100644 (file)
index 0000000..765ba99
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ *  color-history-model.h
+ *  Copyright (C) 2008-2009  Jim Evins <evins@snaught.com>.
+ *
+ *  This file is part of gLabels.
+ *
+ *  gLabels is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  gLabels is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with gLabels.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GL_COLOR_HISTORY_MODEL_H__
+#define __GL_COLOR_HISTORY_MODEL_H__
+
+
+#include <glib-object.h>
+
+
+G_BEGIN_DECLS
+
+/* Utility Macros */
+#define TYPE_GL_COLOR_HISTORY_MODEL              (gl_color_history_model_get_type ())
+#define GL_COLOR_HISTORY_MODEL(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GL_COLOR_HISTORY_MODEL, glColorHistoryModel))
+#define GL_COLOR_HISTORY_MODEL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GL_COLOR_HISTORY_MODEL, glColorHistoryModelClass))
+#define IS_GL_COLOR_HISTORY_MODEL(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GL_COLOR_HISTORY_MODEL))
+#define IS_GL_COLOR_HISTORY_MODEL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GL_COLOR_HISTORY_MODEL))
+#define GL_COLOR_HISTORY_MODEL_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), TYPE_GL_COLOR_HISTORY_MODEL, glColorHistoryModelClass))
+
+
+/* Type definitions */
+typedef struct _glColorHistoryModel          glColorHistoryModel;
+typedef struct _glColorHistoryModelPrivate   glColorHistoryModelPrivate;
+typedef struct _glColorHistoryModelClass     glColorHistoryModelClass;
+
+
+/** GL_COLOR_HISTORY_MODEL Object */
+struct _glColorHistoryModel {
+        GObject                        parent;
+
+        glColorHistoryModelPrivate    *priv;
+};
+
+/** GL_COLOR_HISTORY_MODEL Class */
+struct _glColorHistoryModelClass {
+        GObjectClass                   parent_class;
+
+        /*
+         * Signals
+         */
+        void (*changed)     (glColorHistoryModel *this,
+                             gpointer             user_data);
+
+};
+
+
+GType                gl_color_history_model_get_type  (void) G_GNUC_CONST;
+
+glColorHistoryModel *gl_color_history_model_new       (guint                n);
+
+void                 gl_color_history_model_add_color (glColorHistoryModel *this,
+                                                       guint                color);
+
+guint                gl_color_history_model_get_color (glColorHistoryModel *this,
+                                                       guint                i);
+
+
+G_END_DECLS
+
+#endif /* __GL_COLOR_HISTORY_MODEL_H__ */
+
+
+
+/*
+ * Local Variables:       -- emacs
+ * mode: C                -- emacs
+ * c-basic-offset: 8      -- emacs
+ * tab-width: 8           -- emacs
+ * indent-tabs-mode: nil  -- emacs
+ * End:                   -- emacs
+ */
index e7037d150e61b8035e3039a1c157316833de6890..29471d7e2fcbbb6de2a6b9768f70a1a58ed3ff06 100644 (file)
@@ -31,6 +31,7 @@
 #define BASE_KEY          "/apps/glabels"
 #define RECENT_FONTS_KEY  BASE_KEY "/recent-fonts"
 
+
 /*========================================================*/
 /* Private types.                                         */
 /*========================================================*/
@@ -129,7 +130,6 @@ static void
 gl_font_history_model_finalize (GObject *object)
 {
         glFontHistoryModel    *this;
-        GSList                *p;
 
         g_return_if_fail (object && IS_GL_FONT_HISTORY_MODEL (object));
         this = GL_FONT_HISTORY_MODEL (object);
index c9b8c48ef59d0b9d8774f376cdad1110962d8de4..690c3c77b4e6987ca068761ee8e5ea51a396ea66 100644 (file)
@@ -57,8 +57,7 @@ struct _glFontHistoryModelClass {
          * Signals
          */
         void (*changed)     (glFontHistoryModel     *this,
-                             gpointer           user_data);
-
+                             gpointer                user_data);
 
 };