[uim-commit] r454 - trunk/helper
tkng at freedesktop.org
tkng at freedesktop.org
Mon Jan 31 23:30:53 PST 2005
Author: tkng
Date: 2005-01-31 23:30:50 -0800 (Mon, 31 Jan 2005)
New Revision: 454
Modified:
trunk/helper/toolbar-common-gtk.c
Log:
* helper/toolbar-comnon-gtk.c: A bit clean up.
-(get_charset): New function.
Modified: trunk/helper/toolbar-common-gtk.c
===================================================================
--- trunk/helper/toolbar-common-gtk.c 2005-02-01 06:40:50 UTC (rev 453)
+++ trunk/helper/toolbar-common-gtk.c 2005-02-01 07:30:50 UTC (rev 454)
@@ -125,7 +125,22 @@
g_source_remove(read_tag);
}
+static gchar *
+get_charset(gchar *line)
+{
+ gchar **splitted;
+ splitted = g_strsplit(line, "=", 0);
+
+ if(splitted && splitted[0] && strcmp("charset", splitted[0]) == 0) {
+ g_strfreev(splitted);
+ return g_strdup(splitted[1]);
+ } else {
+ g_strfreev(splitted);
+ return NULL;
+ }
+}
+
static void
helper_applet_prop_list_update(gchar **tmp)
{
@@ -135,16 +150,8 @@
gchar **tmp2 = NULL;
gchar *charset = NULL;
- tmp2 = g_strsplit(tmp[1], "=", 0);
+ charset = get_charset(tmp[1]);
- if(tmp2 && tmp2[0] && tmp2[1] && strcmp("charset", tmp2[0]) == 0) {
- charset = g_strdup(tmp2[1]);
- g_strfreev(tmp2);
- } else {
- g_strfreev(tmp2);
- return;
- }
-
if(menu_buttons) {
g_list_foreach(menu_buttons, button_destroy, NULL);
g_list_free(menu_buttons);
@@ -241,20 +248,8 @@
gchar **pair = NULL;
gchar *charset = NULL;
- if(lines && lines[1] ) {
- pair = g_strsplit(lines[1], "=", 0);
- } else {
- return;
- }
+ charset = get_charset(lines[1]);
- if(pair && pair[0] && pair[1] && strcmp("charset", pair[0]) == 0) {
- charset = g_strdup(pair[1]);
- g_strfreev(pair);
- } else {
- g_strfreev(pair);
- return;
- }
-
while(lines[i] && strcmp("", lines[i]) != 0) {
i++;
}
More information about the Uim-commit
mailing list