[uim-commit] r456 - trunk/helper

tkng at freedesktop.org tkng at freedesktop.org
Tue Feb 1 00:41:48 PST 2005


Author: tkng
Date: 2005-02-01 00:41:45 -0800 (Tue, 01 Feb 2005)
New Revision: 456

Modified:
   trunk/helper/toolbar-common-gtk.c
Log:
* helper/toolbar-common-gtk.c:
 -(convert_charset): New function.


Modified: trunk/helper/toolbar-common-gtk.c
===================================================================
--- trunk/helper/toolbar-common-gtk.c	2005-02-01 08:20:23 UTC (rev 455)
+++ trunk/helper/toolbar-common-gtk.c	2005-02-01 08:41:45 UTC (rev 456)
@@ -199,6 +199,19 @@
   }
 }
 
+static gchar *
+convert_charset(const gchar *charset, const gchar *line)
+{
+  if(charset == NULL) {
+    return NULL;
+  }
+  return g_convert(line, strlen(line),
+		   "UTF-8", charset, 
+		   NULL, /* gsize *bytes_read */
+		   NULL, /*size *bytes_written */
+		   NULL); /* GError **error*/
+}
+
 static void
 helper_applet_prop_list_update(gchar **tmp)
 {
@@ -216,20 +229,16 @@
   }
 
   while(tmp[i] && strcmp("", tmp[i]) != 0) {
-    if (charset) {
-      gchar *utf8_str;
-      utf8_str = g_convert(tmp[i], strlen(tmp[i]),
-			   "UTF-8", charset, 
-			   NULL, /* gsize *bytes_read */
-			   NULL, /*size *bytes_written */
-			   NULL); /* GError **error*/
+    gchar *utf8_str;
+    utf8_str = convert_charset(charset, tmp[i]);
 
+    if(utf8_str != NULL) {
       tmp2 = g_strsplit(utf8_str, "\t", 0);
       g_free(utf8_str);
     } else {
       tmp2 = g_strsplit(tmp[i], "\t", 0);
     }
-
+    
     if(tmp2 && tmp2[0]) {
       if(strcmp("branch", tmp2[0]) == 0) {
 	if(tmp_button) {



More information about the Uim-commit mailing list