[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][TOP]

KDE 2.0 menu from GNOME panel


GNOME 1.2.xからKDE 2.0β(1.92)のメニューを参照する
(いい加減な)パッチです。

GNOMEがすでにUTF-8に移行しているdistroでは必要ないはず。

--- gnome-core-1.2.1.orig/panel/menu-fentry.c   Mon Jul 31 22:26:02 2000
+++ gnome-core-1.2.1/panel/menu-fentry.c        Fri Aug  4 17:28:47 2000
@@ -18,6 +18,7 @@
 #include <limits.h>
 #include <errno.h>
 #include <gnome.h>
+#include <iconv.h>

 #include "panel-include.h"

@@ -28,6 +29,31 @@
 static GMemChunk *file_chunk = NULL;
 static GMemChunk *dir_chunk = NULL;

+char* utf8toeuc(char* utf8str) {
+  iconv_t cd;
+  const char* icode = "UTF-8";
+  const char* ocode = "EUC-JP";
+
+  int r=0;
+  size_t isize;
+  size_t osize;
+  char *inbuf;
+  char *outbuf, *result;
+
+  if( utf8str == NULL ) return NULL;
+  inbuf = utf8str;
+  cd = iconv_open( ocode, icode );
+  if( (int)cd == -1 ) return inbuf;
+
+  isize = strlen(utf8str) + 1;
+  osize = isize*3;
+  result = outbuf = (char*)malloc(osize);
+  r = iconv(cd, &utf8str, &isize, &outbuf, &osize);
+  iconv_close(cd);
+  if( r == -1 ) return inbuf;
+  return result;
+}
+
 void
 init_fr_chunks ()
 {
@@ -463,8 +489,8 @@
                                ffr->parent = dr;
                                ffr->icon = dentry->icon;
                                dentry->icon = NULL;
-                               ffr->fullname = dentry->name;
-                               ffr->comment  = g_strdup (dentry->comment);
+                               ffr->fullname = utf8toeuc(dentry->name);
+                               ffr->comment  = g_strdup (utf8toeuc(dentry->comment));
                                dentry->name = NULL;
                                ffr->goad_id =
                                        get_applet_goad_id_from_dentry(dentry);


---
Nakai