* libglabels/Makefile.am:
* libglabels/str.h:
* libglabels/str.c:
Added lgl_str_utf8_casecmp().
* libglabels/libglabels-private.h:
Use lgl_str_utf8_casecmp() for UTF8_EQUAL macro -- do case insensitive comparisons.
* libglabels/db.c: (lgl_db_get_brand_list):
Use lgl_str_utf8_casecmp() to determine if we have seen brand before when building
brand list.
git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@692
f5e0f49d-192f-0410-a22d-
a8d8700d0965
+2007-11-18 Jim Evins <evins@snaught.com>
+
+ * libglabels/Makefile.am:
+ * libglabels/str.h:
+ * libglabels/str.c:
+ Added lgl_str_utf8_casecmp().
+ * libglabels/libglabels-private.h:
+ Use lgl_str_utf8_casecmp() for UTF8_EQUAL macro -- do case insensitive comparisons.
+ * libglabels/db.c: (lgl_db_get_brand_list):
+ Use lgl_str_utf8_casecmp() to determine if we have seen brand before when building
+ brand list.
+
2007-11-18 Jim Evins <evins@snaught.com>
* data/glade/template-designer.glade:
xml-template.h \
xml-template.c \
xml.h \
- xml.c
+ xml.c \
+ str.h \
+ str.c
libglabelsinclude_HEADERS = \
libglabels.h \
alias = (lglTemplateAlias *)p_alias->data;
if ( !g_list_find_custom (brands, alias->brand,
- (GCompareFunc)g_utf8_collate) )
+ (GCompareFunc)lgl_str_utf8_casecmp) )
{
brands = g_list_insert_sorted (brands,
g_strdup (alias->brand),
- (GCompareFunc)g_utf8_collate);
+ (GCompareFunc)lgl_str_utf8_casecmp);
}
}
}
#include <glib/gfileutils.h>
#include <glib/gunicode.h>
+#include "str.h"
+
/* Data system and user data directories. (must free w/ g_free()) */
#define LGL_SYSTEM_DATA_DIR g_build_filename (LIBGLABELS_TEMPLATE_DIR, NULL)
#define LGL_USER_DATA_DIR g_build_filename (g_get_home_dir (), ".glabels", NULL)
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "LibGlabels"
-#define UTF8_EQUAL(s1,s2) (!g_utf8_collate (s1, s2))
+#define UTF8_EQUAL(s1,s2) (!lgl_str_utf8_casecmp (s1, s2))
#define ASCII_EQUAL(s1,s2) (!g_ascii_strcasecmp (s1, s2))
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * (LIBGLABELS) Template library for GLABELS
+ *
+ * str.c: libGLabels string utilities
+ *
+ * Copyright (C) 2007 Jim Evins <evins@snaught.com>.
+ *
+ * This file is part of the LIBGLABELS library.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+#include <config.h>
+
+#include "str.h"
+
+
+/*===========================================*/
+/* Private types */
+/*===========================================*/
+
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+
+/*===========================================*/
+/* Functions. */
+/*===========================================*/
+
+gint
+lgl_str_utf8_casecmp (const gchar *s1,
+ const gchar *s2)
+{
+ gchar *folded_s1;
+ gchar *folded_s2;
+ gint result;
+
+ folded_s1 = g_utf8_casefold (s1, -1);
+ folded_s2 = g_utf8_casefold (s2, -1);
+
+ result = g_utf8_collate (folded_s1, folded_s2);
+
+ g_free (folded_s1);
+ g_free (folded_s2);
+
+ return result;
+}
+
+
--- /dev/null
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * (LIBGLABELS) Template library for GLABELS
+ *
+ * str.h: libGLabels string utilities header file
+ *
+ * Copyright (C) 2007 Jim Evins <evins@snaught.com>.
+ *
+ * This file is part of the LIBGLABELS library.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#ifndef __STR_H__
+#define __STR_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gint lgl_str_utf8_casecmp (const gchar *s1,
+ const gchar *s2);
+
+G_END_DECLS
+
+
+#endif /* __STR_H__ */