gok r2631 - in trunk: . gok
- From: gerdk svn gnome org
- To: svn-commits-list gnome org
- Subject: gok r2631 - in trunk: . gok
- Date: Wed, 11 Feb 2009 09:36:16 +0000 (UTC)
Author: gerdk
Date: Wed Feb 11 09:36:16 2009
New Revision: 2631
URL: http://svn.gnome.org/viewvc/gok?rev=2631&view=rev
Log:
2009-02-11 Gerd Kohlberger <gerdk svn gnome org>
Remove deprecated GLib symbols. Fixes bug #560441.
* gok/main.h: new prototype
* gok/main.c: g_strcasecmp -> gok_main_utf8_casecmp
* gok/gok-scanner.c: g_strcasecmp -> gok_main_utf8_casecmp
* gok/create-branching-keyboard.c: Fix mem leaks.
g_io_channel_close -> g_io_channel_unref
Modified:
trunk/ChangeLog
trunk/gok/create-branching-keyboard.c
trunk/gok/gok-scanner.c
trunk/gok/main.c
trunk/gok/main.h
Modified: trunk/gok/create-branching-keyboard.c
==============================================================================
--- trunk/gok/create-branching-keyboard.c (original)
+++ trunk/gok/create-branching-keyboard.c Wed Feb 11 09:36:16 2009
@@ -37,12 +37,12 @@
{
gchar *line;
guint len;
- GError *error = NULL;
gint count = 0;
GIOStatus status;
+
do
{
- status = g_io_channel_read_line (infile, &line, &len, NULL, &error);
+ status = g_io_channel_read_line (infile, &line, &len, NULL, NULL);
if (status != G_IO_STATUS_NORMAL || len < 2 ||
g_str_has_prefix (line, "#"))
{
@@ -90,9 +90,11 @@
{
gchar *buf;
gsize bytz;
+
buf = g_strconcat ("</GOK:keyboard>\n</GOK:GokFile>\n", NULL);
g_io_channel_write_chars (kbd->io, buf, -1, &bytz, NULL);
- g_io_channel_close (kbd->io);
+ g_io_channel_unref (kbd->io);
+ g_free (buf);
}
static void
@@ -198,9 +200,9 @@
int main (int argc, gchar **argv)
{
- GError *error;
GIOChannel *infile;
gint rows = 4;
+
if (argc > 2)
{
rows = atoi (argv[2]);
@@ -218,6 +220,7 @@
g_message ("using %d columns", cols);
g_io_channel_seek_position (infile, 0, G_SEEK_SET, NULL);
create_kbd_from_file (infile, argv[1], cols);
+ g_io_channel_unref (infile);
}
else
g_error ("can't open file %s for reading", argv[1]);
Modified: trunk/gok/gok-scanner.c
==============================================================================
--- trunk/gok/gok-scanner.c (original)
+++ trunk/gok/gok-scanner.c Wed Feb 11 09:36:16 2009
@@ -1766,7 +1766,7 @@
pAccessMethod = m_pAccessMethodFirst;
while (pAccessMethod != NULL)
{
- if (g_strcasecmp (pAccessMethod->Name, NameAccessMethod) == 0)
+ if (gok_main_utf8_casecmp (pAccessMethod->Name, NameAccessMethod) == 0)
{
/* found the access method */
m_pAccessMethodCurrent = pAccessMethod;
Modified: trunk/gok/main.c
==============================================================================
--- trunk/gok/main.c (original)
+++ trunk/gok/main.c Wed Feb 11 09:36:16 2009
@@ -564,21 +564,48 @@
return 0;
}
+/**
+ * gok_main_utf8_casecmp:
+ * @a: a UTF-8 encoded string
+ * @b: a UTF-8 encoded string
+ *
+ * Compares two strings for ordering using the linguistically correct
+ * rules for the current locale. Case-insensitve version.
+ *
+ * Returns: < 0 if a compares before b, 0 if they compare equal, > 0 if a compares after b.
+ **/
+gint
+gok_main_utf8_casecmp (const gchar *a, const gchar *b)
+{
+ gchar *a_fold, *b_fold;
+ gint res;
+
+ a_fold = g_utf8_casefold (a, -1);
+ b_fold = g_utf8_casefold (b, -1);
+
+ res = g_utf8_collate (a_fold, b_fold);
+
+ g_free (a_fold);
+ g_free (b_fold);
+
+ return res;
+}
+
/* private helper */
gint
comparebasenames (gconstpointer a, gconstpointer b)
{
- gchar* a_file;
- gchar* b_file;
+ gchar *a_file, *b_file;
gint returncode;
- a_file = g_path_get_basename(a);
- b_file = g_path_get_basename(b);
- returncode = g_strcasecmp(a_file, b_file);
-
+ a_file = g_path_get_basename (a);
+ b_file = g_path_get_basename (b);
+
+ returncode = gok_main_utf8_casecmp (a_file, b_file);
+
g_free (a_file);
g_free (b_file);
-
+
return returncode;
}
@@ -1709,7 +1736,7 @@
pKB = m_pKeyboardFirst;
while (pKB != NULL)
{
- if (g_strcasecmp (pKB->Name, NameKeyboard) == 0)
+ if (gok_main_utf8_casecmp (pKB->Name, NameKeyboard) == 0)
{
/* found the keyboard */
break;
Modified: trunk/gok/main.h
==============================================================================
--- trunk/gok/main.h (original)
+++ trunk/gok/main.h Wed Feb 11 09:36:16 2009
@@ -103,6 +103,7 @@
gboolean gok_main_safe_mode (void);
void gok_main_close_warning (void);
void gok_main_center_corepointer (GtkWidget *widget);
+gint gok_main_utf8_casecmp (const gchar *a, const gchar *b);
/* private */
void gok_main_app_change_listener (Accessible* pAccessible);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]