# 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
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
#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
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
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
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 \
+++ /dev/null
-/*
- * 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
- */
+++ /dev/null
-/*
- * 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
- */
#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"
};
-static glColorComboHistory *custom_color_history = NULL;
+static glColorHistoryModel *custom_color_history = NULL;
/*===========================================*/
*/
if ( !custom_color_history )
{
- custom_color_history = gl_color_combo_history_new (PALETTE_COLS);
+ custom_color_history = gl_color_history_model_new (PALETTE_COLS);
}
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)
{
(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,
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);
--- /dev/null
+/*
+ * 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
+ */
--- /dev/null
+/*
+ * 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
+ */
#define BASE_KEY "/apps/glabels"
#define RECENT_FONTS_KEY BASE_KEY "/recent-fonts"
+
/*========================================================*/
/* Private types. */
/*========================================================*/
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);
* Signals
*/
void (*changed) (glFontHistoryModel *this,
- gpointer user_data);
-
+ gpointer user_data);
};