2004年12月22日星期三

考虑是否要结束cygnome2项目

今日给cygnome2的群组发了个邮件,说我正在考虑是否要宣判cygnome-2的死刑。

为我一直没有时间来更新它;而同时因为gnome2包在cygwin官方版本的引入,原来的包又不能成功地运行,老有人报告这样那样的问题。所以现在的是
等整个gnome2桌面在cygwin官方版本中出现,但问题是进度似乎太慢了一点,最近一个月已经几乎停滞了——难道他们不打算引入桌面部分的包?

Hi, all

key point (if you're not patient enough):
- The co-existence of the some packages (such as gtk, ORBit) in this project and in cygwin net release could cause a lot of compatibility problems
- There's no need any longer to keep this project
- I'm considering freezing this project.

Recently, I got some issue report such as
"Can't find gdk_threads_lock in cyggdk DLL"
"cyggdk_pixbuf-2.0-0.dll error"
"Gnome2 cyglinc-1.dll missing"
etc.

Most of these problems are caused by the fact that you installed some base Gnome2 packages from cygwin net release and other stuff from our project.

Our packages are based on Gnome 2.4, and because of short of hands, we couldn't keep these packages up-to-date. And with Gerrit P. Haase's and Yaakov Selkowitz's efforts, Gnome2 packages are getting into cygwin net release. Surely, their work are based on the recent releases, i.e. starting from Gnome 2.6, and some of they have been updated to Gnome 2.8.

For example, in Gnome 2.4, linc is a standalone package, thus we have cyglinc-1.dll in our project, and it is used by some other packages. But in Gnome 2.6, the source code of linc is included in ORBit, and linc is no longer a standalone library. Now cygwin net release got latest release of ORBit included (with cygwin's setup.exe, you'll upgrade to that version automatically). If now you want to use our gnome-session, you know, you're doomed to encounter the problem such as "cyglinc-1.dll missing".

And there're a lot problems like this.

But I think putting Gnome2 packages into cygwin net release is in right direction, as it would attact more people to get into this porting work, which would improve the patches. And when these patches getting into upstream release, perhaps cygwin would become an official platform that Gnome would support, just like that kde would do.

Thus I think there is no need to maintain this project (If there's some, that must be that s the progress that Gnome2 packages getting into cygwin net release is too slow, that some of you are not patient enough to wait, thus you want to use our gnome-desktop on new glib/gtk/ORBit packages from cygwin net release, which is not easy:-( screen.width/2)this.width=screen.width/2
}" vspace="2" border="0" />

Another reason is that, even some of you think there's worthiness for this project, I don't have enough time to do maintain about 60 packages. The patches done on Gnome 2.4 are far from stable (GConf would cause application hangs, the UI would hang there even if the application quitted, and so on, and so on)

OK, now I would freeze this project. The setup.ini would be removed.ini, i.e. it won't be available for cygwin setup.exe any longer. But you can download binary packages manually.

Sorry for the inconvenience brought to you.

CyGNOME-2 project administrator
Yang Guilong

Powered by ScribeFire.

2004年12月17日星期五

html2rtf.pl的超级链接支持

终于忍受不了html2rtf.pl,改了一下,添加了对URL的支持,在Word/Word和AbiWord都可以正确显示成超级链接(hyperlink),但wordpad似乎有自己的显示方式: 显示成了: text ,保存后超级链接会丢失

line: 257 处添加如下代码:

# now href
urlobj_data1 = "{field{*fldinst {fs24insrsid13071880 hichaf1dbchaf13lochf1 hichaf1dbchaf13lochf1n HYPERLINK";
urlobj_data2 = "hichaf1dbchaf13lochf1 }{fs24insrsid13071880charrsid13071880 {*datafield 00d0c9ea79f9bace118c8200aa004ba90b0200000003000000e0c9ea79f9bace118c8200aa004ba90b5a0000";
# urlobj_data3 is the URL(unicode) in hex code. e.g. http://www.zope.org/Members/Brian/PythonNet/
urlobj_data3 = "0068007400740070003a002f002f007700770077002e007a006f00700065002e006f00720067002f004d0065006d0062006500720073002f0042007200690061006e002f0050007900740068006f006e004e00650074002f";
urlobj_data4 = "000000}}}{fldrslt {cs15fs24ulcf2insrsid13071880charrsid13071880 hichaf1dbchaf13lochf1 ";
instream =~ s/]*>/urlobj_data1 "1" urlobj_data2&url_str2hex(1)urlobj_data4/ig;
instream =~ s//}}}/ig

其中url_str2hex的实现如下,随便放在什么地方

# input: http://
# output: 0068007400740070003a002f002f
sub url_str2hex {
local(s);
s = _[0];

out = "";
i=0;
while(i
ch = substr(s, i, 1);
#printf "%04xn", ord(ch);
out = out.sprintf("%04x", ord(ch));
i ++;
}
printf out;
return out;
}


html2rtf.pl的网址: http://fresh.t-systems-sfr.com/unix/src/www/.warix/html2rtf.pl.html

2004年11月19日星期五

Cygwin: 搞定XFCE 4.2rc1

前两日搞定将xfce 4.2rc1(4.1.99.1)移植到cygwin的补丁,在原来4.2beta1(4.1.90)上做的,并没有改多少,但一些补丁修了一下。

因为搬家后在家里没有电脑用了,也就没有办法提供编译好的版本了,目前只有补丁,可从我的主页下载
xfce4-4.2rc1-cygwin-patches.zip

xffm还是没有做(在4.2beta1就没有做,因为它似乎越来越难移植了,可执行文件与共享库、插件之间代码分工混乱之极,我还是用我的rox吧,反正还有mc或者windows自己的文件管理工具).

xfce4-print和xfce4-mixer不能完全工作──虽然两者都可以编译通过。

2004年11月18日星期四

How to convert Friends.doc into a CHM file (1)

Part1: Friends.doc -> friends.htm -> friends-thin.htm

1. Open Friends.doc with MS Word and save it into a html file (friends.html). I used Office XP,
and due the garbage info added by M Word, the output file is about 28M!

2. Write a simple script (friends-diet.html) to get rid of the garbage attributes
generated by evil M word, include 'class', 'style' and 'lang' etc.
This would cut the size 75% off!
#!/bin/python

from sgmllib import SGMLParser
import htmlentitydefs
import os, sys

class FriendsDiet(SGMLParser):
def reset(self):
self.output=open("friends-thin.html", "w"[img]/images/wink.gif[/img]
SGMLParser.reset(self)

def unknown_starttag(self, tag, attrs):
if tag=='p':
self.output.write("
n"[img]/images/wink.gif[/img]

elif tag=='span' or tag=='o':
pass
elif tag=='o:SmartTagType' or tag=='SmartTagType':
print "Ignore",tag
pass
else:
strattrs=""
for key, value in attrs:
if (key!='class' and key!='style' and key!='lang' and key[0:5]!='xmlns'):
strattrs = strattrs + ' %s="%s"' % (key, value)

self.output.write("<%s%s>" % (tag, strattrs))

if tag=='body':
self.output.write('n')

def unknown_endtag(self, tag):
if tag!='span' and tag!='p' and tag[0:2]!='o:':
self.output.write("n" % tag)

def handle_data(self, text):
if text.strip()!='':
self.output.write(text+"n"[img]/images/wink.gif[/img]

def handle_charref(self, ref):
self.output.write("&#%s;" % ref)

def handle_entityref(self, ref):
semicolon=""
if htmlentitydefs.entitydefs.has_key(ref):
semicolon=";"
self.output.write("&%s%s" % (ref, semicolon))

if __name__=='__main__':
import sys
parser=FriendsDiet()
#fh=open(sys.argv[1], "r"[img]/images/wink.gif[/img]
fh=open("friends.htm", "r"[img]/images/wink.gif[/img]
content=fh.read()
parser.feed(content)
fh.close()
parser.close()

2004年11月16日星期二

gwhereviewer.py: 用PyGTK2写的gwhere数据文件查看工具

用PyGTK2写了一个gwhere的数据文件的查看工具。
gwhere是一个disk catalog工具,类似于gtktalog以及windows上的WhereIsIt。

我的远期目标是写一个完整的disk catalog工具,数据格式上兼容gwhere,但脚本的方式可以让我轻松地扩展description提取器。

下载脚本: gwhereviewer.py

在Cygwin上测试通过,但用纯win32版本的gtk+/pygtk时会崩溃,不知道为什么

2004年11月7日星期日

对Debian做了全面升级

昨天将debian做了一次全面升级,主要是将gnome升级到2.6。

感觉linux下的程序可用性好了很多:
  • mplayer可以播放mpeg4了,看X 档案没有问题了
  • wine支持xim了(后来发现早前安装的crossover也可以,看来很早就有了,原来没有注意到
  • openq也可以很容易得下载到编译后的版本,直接装在gaim-1.0.2上
  • firefox用起来很爽,不象原来mozilla那么慢,又比opera强,现在在windows和linux都用firefox了
  • d4x很稳定了,不象原来那样经常崩溃
不爽的地方:
  • gnome还是不太稳定,尤其是panel和nautilus,常常半天没有反应,不知道在做什么。然后过了好长时间又一起弹出来,有时还崩溃; nautilus还不如rox好用
  • gnome的音量控制老是说打不开设备,奇怪,beep-media-player用oss输出是没有任何问题的
另外自己编译了beep-media-player-0.9.7rc, gwhere, rox-2.1.4, leafpad-0.7.5
debian中gnome-commander还是for gnome-1.x的1.0.1版本,加了device后就崩溃,目前正在编译for gnome2的1.1.6
krusader也还是1.4版本,是否要编译最新的1.5版本看看再说,因为要搞一整套编译环境

BTW: Debian升级还是得会解决包冲突才行,有时因为一两个包的影响导致很多软件无法升级

搞定了GNOME下中文件名乱码的问题

Q1: gtk-2.4打开文件对话框对中文显示乱码,都是xxxxxx之类;beep-media-player的id3信息对话框显示的文件名也是乱码

A:设置G_FILENAME_ENCODING=GBK可以解决这个问题 (奇怪的是,我在Cygwin下没有设置这个也很正常,甚至CHARSET, LC_CTYPE都没有设置)


Q2: 上述问题是解决了。但通过gdm登录时,仍然出现乱码,在~/.bashrc和~/.bash_profile设置都不管用,/etc/bash.bashrc和/etc/profile也不好使
A: 查看了一下/etc/X11/Xsession.d/55gnome-session_gnomerc, 发现这个设置应该写在~/.gnomerc中

2004年11月6日星期六

Fw: Scripting your Delphi Application

"In this paper I'll show you how to use the Microsoft ActiveScripting technologies to achieve everything we've just mentioned. While there is more to these technologies than can be covered by a single paper, by the end of this paper you'll know more than enough to start planning how you can use this technology in your application."

Full story: http://www.delphidevelopers.com/learnbooks/Scripting_your_Delphi_Application.htm
PDF created by pdfFactory: Scripting Your Delphi Applications.pdf
AXS_FAQ: Microsoft Active Scripting Frequently Asked Questions

2004年11月5日星期五

Create a CHM file for PyGTK2 Tutorial

Document source: PyGTK2 Tutorial[1]
[1] http://www.pygtk.org/dist/pygtk2tutorial.tgz

The main problem is to parse the contents from index.html write then into a HHC file for MS HtmlHelp Workshop.

You can use this simple script to do this (see below)
pygtk-index2hhc.py pygtk2tut.hhc index.html


P.S:
As to the PyGTK2 Reference[2], you can download the devhelp index file[3], and then use my devhelp2chm.sh[4]to get the .HHP, .HHC and .HHK.
[2] http://www.pygtk.org/dist/pygtk2reference.tbz2
[3] http://www.moeraki.com/pygtkreference/pygtk2reference.devhelp.gz
[4] http://www.linuxeden.com/forum/blog/resserver.php?blogId=110848&resource=devhelp2chm.sh







#!env python from sgmllib import SGMLParser import htmlentitydefs from chmmaker import HHCWriter import os class ContentParser(SGMLParser): def __init__(self, outputfile): self.hhcwriter = HHCWriter(outputfile) self.hhcwriter.print_header() SGMLParser.__init__(self) def __del__(self): self.hhcwriter.print_footer() def reset(self): SGMLParser.reset(self) # some temp variables self.level=0 self.title = self.url = "" self.in_href = False def start_dd(self, attrs):
self.hhcwriter.hhcfile.write("&lt;UL&gt;")

def end_dd(self):
self.hhcwriter.hhcfile.write("
&lt;/UL&gt;")

def start_a(self, attrs): for attr in attrs: if attr[0].lower()=='href': self.in_href = True self.title = "" self.url = attr[1] break def end_a(self): if self.in_href and self.title and self.url: self.on_href(self.title.replace('"', ""), self.url) self.in_href = False self.title = self.url = "" def handle_data(self, text): self.title += text def handle_charref(self, ref): if self.in_href: self.title += "&#%(ref)s;" % locals() def handle_entityref(self, ref): if self.in_href: self.title += "&%(ref)s" % locals() if htmlentitydefs.entitydefs.has_key(ref): self.title += ";" def on_href(self, title, url): target=url if url[-3:]=='fig': target= "" if title and target: self.hhcwriter.add_topic(title, target) if __name__=='__main__': import sys if len(sys.argv)&lt;3: print "Usage: %s hhcfilename index.html" % sys.argv[0] sys.exit() trans=ContentParser(sys.argv[1]) fh=open(sys.argv[2], "r"[img]/images/wink.gif[/img] try: trans.feed(fh.read()) except: pass trans.close() fh.close()
# vim:expandtab softtabstop=4


Powered by ScribeFire.

2004年11月3日星期三

rox-2.1.2文件名UTF-8补丁

nautilus太笨重了; 新版本的xffm似乎比以前更难移至了; gnome-commander的gnome-1版本在没有FAM的情况下总需要手工刷新,gnome2也老是出问题。于是我开始沉下心来用rox。

但它似乎对于在中文文件名(应该是非ANSI字符)上有不少问题,比如对路径包含中文的话,加到书签里之后又无法跳过去,拷贝、移动、删除的时候老是报告路径找不到。

琢磨了一阵,基本上可以用了: rox对于文件名没有进行编码转换就直接交给了gtk2显示,但gtk2要求非ansi字符在显示时必须采用UTF-8编码。这个补丁可以修正这个问题,在Cygwin上和Linux都试过了,但在Cygwin上还不太稳定。

diff -Nurp rox-2.1.2.orig/ROX-Filer/src/action.c rox-2.1.2/ROX-Filer/src/action.c --- rox-2.1.2.orig/ROX-Filer/src/action.c 2004-01-22 04:03:16.000000000 +0800 +++ rox-2.1.2/ROX-Filer/src/action.c 2004-10-11 19:23:10.000000000 +0800 @@ -887,12 +887,14 @@ static void do_usage(const char *src_pat } /* dest_path is the dir containing src_path */ -static void do_delete(const char *src_path, const char *unused) +static void do_delete(const char *src_path_req, const char *unused) { struct stat info; gboolean write_prot; char *safe_path; + gchar *src_path = filename_from_utf8(src_path_req); + check_flags(); if (mc_lstat(src_path, &info)) @@ -994,10 +996,12 @@ static void do_eject(const char *path) /* path is the item to check. If is is a directory then we may recurse * (unless prune is used). */ -static void do_find(const char *path, const char *unused) +static void do_find(const char *path_req, const char *unused) { FindInfo info; + gchar *path = filename_from_utf8(path_req); + check_flags(); if (!quiet) @@ -1081,11 +1085,13 @@ static struct mode_change *nice_mode_com return retval; } -static void do_chmod(const char *path, const char *unused) +static void do_chmod(const char *path_req, const char *unused) { struct stat info; mode_t new_mode; + gchar *path = filename_from_utf8(path_req); + check_flags(); if (mc_lstat(path, &info)) @@ -1159,10 +1165,12 @@ static void do_chmod(const char *path, c } } -static void do_settype(const char *path, const char *unused) +static void do_settype(const char *path_req, const char *unused) { struct stat info; + gchar *path = filename_from_utf8(path_req); + check_flags(); if (mc_lstat(path, &info)) @@ -1257,8 +1265,9 @@ static const char *make_dest_path(const else leaf++; } + gchar *leaf_copy = filename_from_utf8(leaf); - return make_path(dir, leaf); + return make_path(dir, leaf_copy); } /* If action_leaf is not NULL it specifies the new leaf name */ @@ -1510,8 +1519,11 @@ static void do_move2(const char *path, c /* Copy path to dest. * Check that path not copied into itself. */ -static void do_copy(const char *path, const char *dest) +static void do_copy(const char *path_req, const char *dest_req) { + gchar *path = filename_from_utf8(path_req); + gchar *dest = filename_from_utf8(dest_req); + if (is_sub_dir(make_dest_path(path, dest), path)) printf_send(_("!ERROR: Can't copy object into itselfn")); else @@ -1524,8 +1536,11 @@ static void do_copy(const char *path, co /* Move path to dest. * Check that path not moved into itself. */ -static void do_move(const char *path, const char *dest) +static void do_move(const char *path_req, const char *dest_req) { + gchar *path = filename_from_utf8(path_req); + gchar *dest = filename_from_utf8(dest_req); + if (is_sub_dir(make_dest_path(path, dest), path)) printf_send( _("!ERROR: Can't move/rename object into itselfn")); @@ -1536,10 +1551,13 @@ static void do_move(const char *path, co } } -static void do_link(const char *path, const char *dest) +static void do_link(const char *path_req, const char *dest_req) { const char *dest_path; + gchar *path = filename_from_utf8(path_req); + gchar *dest = filename_from_utf8(dest_req); + check_flags(); dest_path = make_dest_path(path, dest); @@ -1566,6 +1584,7 @@ static void do_mount(const guchar *path, const char *argv[3] = {NULL, NULL, NULL}; char *err; + /* path = filename_from_utf8(path); */ check_flags(); argv[0] = mount ? "mount" : "umount"; diff -Nurp rox-2.1.2.orig/ROX-Filer/src/bookmarks.c rox-2.1.2/ROX-Filer/src/bookmarks.c --- rox-2.1.2.orig/ROX-Filer/src/bookmarks.c 2004-03-25 21:03:44.000000000 +0800 +++ rox-2.1.2/ROX-Filer/src/bookmarks.c 2004-10-11 16:58:26.000000000 +0800 @@ -380,8 +380,10 @@ static xmlNode *bookmark_find(const gcha same = strcmp(mark, path) == 0; xmlFree(path); - if (same) + if (same) { + printf("This path already in bookmark listn.", path); return node; + } } return NULL; @@ -410,10 +412,12 @@ static void bookmarks_add(GtkMenuItem *m bookmarks_add_dir(filer_window-&gt;sym_path); } -static void bookmarks_add_dir(const guchar *dir) +static void bookmarks_add_dir(const guchar *dir_req) { xmlNode *bookmark; + gchar *dir = filename_to_utf8(dir_req); + if (bookmark_find(dir)) return; @@ -439,8 +443,10 @@ static void bookmarks_activate(GtkMenuSh mark = gtk_label_get_text(label); } - if (strcmp(mark, filer_window-&gt;sym_path) != 0) - filer_change_to(filer_window, mark, NULL); + gchar *path = filename_from_utf8(mark); + + if (strcmp(path, filer_window-&gt;sym_path) != 0) + filer_change_to(filer_window, path, NULL); if (g_hash_table_lookup(fstab_mounts, filer_window-&gt;real_path) && !mount_is_mounted(filer_window-&gt;real_path, NULL, NULL)) { diff -Nurp rox-2.1.2.orig/ROX-Filer/src/display.c rox-2.1.2/ROX-Filer/src/display.c --- rox-2.1.2.orig/ROX-Filer/src/display.c 2004-04-27 18:34:30.000000000 +0800 +++ rox-2.1.2/ROX-Filer/src/display.c 2004-10-11 18:00:40.000000000 +0800 @@ -759,15 +759,24 @@ void display_update_view(FilerWindow *fi view-&gt;layout = NULL; } + gchar *u8 = filename_to_utf8(item-&gt;leafname); if (view-&gt;layout) { /* Do nothing */ } +#ifndef __CYGWIN__ else if (g_utf8_validate(item-&gt;leafname, -1, NULL)) { view-&gt;layout = gtk_widget_create_pango_layout( filer_window-&gt;window, item-&gt;leafname); } +#else /* on Cygwin(Windows), filenames should be in local charset, rather than UTF-8, */ + else if (g_utf8_validate(u8, -1, NULL)) + { + view-&gt;layout = gtk_widget_create_pango_layout( + filer_window-&gt;window, u8); + } +#endif else { PangoAttribute *attr; diff -Nurp rox-2.1.2.orig/ROX-Filer/src/dropbox.c rox-2.1.2/ROX-Filer/src/dropbox.c --- rox-2.1.2.orig/ROX-Filer/src/dropbox.c 2004-01-22 04:03:16.000000000 +0800 +++ rox-2.1.2/ROX-Filer/src/dropbox.c 2004-10-11 18:00:50.000000000 +0800 @@ -177,6 +177,7 @@ void drop_box_set_path(DropBox *drop_box gtk_widget_set_sensitive(drop_box-&gt;buttons, FALSE); } + ensure_utf8(&copy); gtk_label_set_text(GTK_LABEL(drop_box-&gt;label), copy); g_free(copy); } diff -Nurp rox-2.1.2.orig/ROX-Filer/src/filer.c rox-2.1.2/ROX-Filer/src/filer.c --- rox-2.1.2.orig/ROX-Filer/src/filer.c 2004-04-13 17:04:04.000000000 +0800 +++ rox-2.1.2/ROX-Filer/src/filer.c 2004-10-11 16:58:38.000000000 +0800 @@ -2102,10 +2102,12 @@ void filer_add_tip_details(FilerWindow * g_object_unref(info); } +#ifndef __CYGWIN__ /* TODO: use G_BROKEN_FILENAME/G_FILENAME_ENCODINGS ?? */ if (!g_utf8_validate(item-&gt;leafname, -1, NULL)) g_string_append(tip, _("This filename is not valid UTF-8. " "You should rename it.n")); +#endif } /* Return the selection as a text/uri-list. diff -Nurp rox-2.1.2.orig/ROX-Filer/src/menu.c rox-2.1.2/ROX-Filer/src/menu.c --- rox-2.1.2.orig/ROX-Filer/src/menu.c 2004-05-01 00:36:42.000000000 +0800 +++ rox-2.1.2/ROX-Filer/src/menu.c 2004-10-11 16:59:02.000000000 +0800 @@ -1024,7 +1024,7 @@ static void find(FilerWindow *filer_wind * both the current and new paths. * NOTE: This function unrefs 'image'! */ -static void savebox_show(const gchar *action, const gchar *path, +static void savebox_show(const gchar *action, const gchar *path_req, MaskedPixmap *image, SaveCb callback, GdkDragAction dnd_action) { @@ -1032,6 +1032,7 @@ static void savebox_show(const gchar *ac GtkWidget *check_relative = NULL; g_return_if_fail(image != NULL); + gchar *path = filename_to_utf8(path_req); savebox = gtk_savebox_new(action); gtk_savebox_set_action(GTK_SAVEBOX(savebox), dnd_action); @@ -1293,8 +1294,10 @@ void menu_show_options(gpointer data, gu } static gboolean new_directory_cb(GObject *savebox, - const gchar *initial, const gchar *path) + const gchar *initial, const gchar *path_req) { + gchar *path = filename_from_utf8(path_req); + if (mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO)) { report_error("mkdir: %s", g_strerror(errno)); @@ -1325,9 +1328,11 @@ static void new_directory(gpointer data, } static gboolean new_file_cb(GObject *savebox, - const gchar *initial, const gchar *path) + const gchar *initial, const gchar *path_req) { int fd; + + gchar *path = filename_from_utf8(path_req); fd = open(path, O_CREAT | O_EXCL, 0666); diff -Nurp rox-2.1.2.orig/ROX-Filer/src/pinboard.c rox-2.1.2/ROX-Filer/src/pinboard.c --- rox-2.1.2.orig/ROX-Filer/src/pinboard.c 2004-03-07 02:50:48.000000000 +0800 +++ rox-2.1.2/ROX-Filer/src/pinboard.c 2004-10-11 19:23:38.000000000 +0800 @@ -753,6 +753,7 @@ static void drag_backdrop_dropped(GtkWid radios = g_object_get_data(G_OBJECT(dialog), "rox-radios"); g_return_if_fail(radios != NULL); + /*gchar *path = filename_from_utf8(path_req); */ if (mc_stat(path, &info)) { delayed_error( @@ -2088,12 +2089,13 @@ static void create_pinboard_window(Pinbo } /* Load image 'path' and scale according to 'style' */ -static GdkPixmap *load_backdrop(const gchar *path, BackdropStyle style) +static GdkPixmap *load_backdrop(const gchar *path_req, BackdropStyle style) { GdkPixmap *pixmap; GdkPixbuf *pixbuf; GError *error = NULL; + gchar *path = filename_from_utf8(path_req); pixbuf = gdk_pixbuf_new_from_file(path, &error); if (error) { diff -Nurp rox-2.1.2.orig/ROX-Filer/src/support.c rox-2.1.2/ROX-Filer/src/support.c --- rox-2.1.2.orig/ROX-Filer/src/support.c 2004-04-27 18:34:30.000000000 +0800 +++ rox-2.1.2/ROX-Filer/src/support.c 2004-10-11 17:20:42.000000000 +0800 @@ -1083,6 +1083,34 @@ void ensure_utf8(gchar **sp) } } +/* +void filename_from_utf8(gchar **pathp) +{ + gchar *foo = g_filename_from_utf8(*pathp, -1, NULL, NULL, NULL); + if (foo) { + *pathp = g_strdup(foo); + g_free(foo); + } +} */ + +gchar* filename_from_utf8(const gchar* path_u) +{ + gchar *foo = g_filename_from_utf8(path_u, -1, NULL, NULL, NULL); + if (foo) { + return foo; + } else + return g_strdup(path_u); +} + +gchar* filename_to_utf8(const gchar* path) +{

Powered by ScribeFire.

2004年10月4日星期一

在win32下编译QQ-0.3 (with gaim-1.0.0)

准备工具: mingw, msys
源代码: gaim-1.0.0, openq-0.3-p3
头/库文件: gtk2, aspell, gtkspell, nspr, nss, perl58, tcl
如果要制作安装包还得需要NSIS
另外需要几个补丁

[@more@]
编译方法:
1.从http://sourceforge.net/projects/tcl下载并安装msys_mingw,这个包包含了一个简单的 POSIX环境和Mingw GCC (gaim的网页上说要下载安装Cygwin,这并没有必要; 而且上述包已经自带了mingw).;

2.安装msys_mingw, 并运行msys.bat,这将打开一个rxvt会话窗口。

3.从http://sourceforge.net/projects/gaim下载gaim-1.0.0的源代码,解压到msys的某个目录(假定为~/wingaim_building/)
cd ~/wingaim_building
tar jxf /path/to/gaim-1.0.0.tar.bz2

4.按照http://gaim.sourceforge.net/win32/build.php上面的说明,下载gtk2, aspell, gtkspell, nspr, nss, perl58, tcl的头文件和库文件,解压到wingaim_building/win32-dev/;

5.因为OpenQ使用了regex库,需要到http://sourceforge.net/projects/gnuwin32下载regex-0.12-bin.zip和regex-0.12-lib.zip,前者留着最后运行时使用,后者也解压到wingaim_building/win32-dev/;

6.在gaim-1.0.0源代码目录中补上OpenQ-0.3-p3的源代码 (这部分代码是我从OpenQ-0.3-p3 的完整源代码中提取出来的,对应gaim-0.79)
cd ~/wingaim_buiding/gaim-1.0.0
tar zxvf /path/to/openq-0.3-p3-src.tar.gz

7.对gaim-1.0.0的代码打补丁[补丁]。主要包含两类补丁,一类是对gaim- 1.0.0源代码针对openq的少量修改
cd ~/wingaim_buiding/gaim-1.0.0
patch-p1 -b <>
patch -p1 -b <>
patch -p1 -b <>

8.另一类是补丁是因为: OpenQ-0.3是在gaim-0.79上发布的,而gaim-1.0发布时修改了一些插件接口,所以要做相应更改
cd ~/wingaim_buiding/gaim-1.0.0
patch -p1 -b <>

9.开始编译
如 果你有ActivePerl-5.8,修改gaim- 1.0.0/plugins/perl/common/Makefile.mingw 中PERL和EXTUTILS两项使之指向perl安装的位置;如果你没有ActivePerl-5.8, 需要将gaim-1.0.0/plugins/Makefile.mingw中与PERL_PLUGIN_LOADER相关的行删除

cd ~/wingaim_buiding/gaim-1.0.0
make -f Makefile.mingw

10.安装
制作安装包
cd ~/wingaim_buiding/gaim-1.0.0
make -f Makefile.mingw install
然 后需要加上OpenQ的数据文件,即人头图标、笑脸图标和IP数据,这些包含在OpenQ-0.3的源代码包中。如果你下载了我在前面提供的 data.zip,可以直接解压到win32-install-dir中; 另外OpenQ需要regex.dll拷贝到win32-install-dir目录
如果需要perl插件,将perl58.dll也拷贝过去

-------------------------------------------------------------
目前还存在的问题: 一点击 "获取信息", gaim就崩溃(cygwin版本就没有这个问题)

相关信息整理在:
http://bamanzi.inlsd.org/gnuwin32/openq/README.html

另外也试了一下cygwin版本移植,比较简单。问题是在一个版本的gtk2上编译后在另外一个版本上运行就会出错,根本启动不了。不知道怎么回事,所以patch也没敢往主页上放。

2004年9月28日星期二

Cygwin中文How-to

大致写了一下,有待补充。

本来一年前就打算写的,但后来觉得老黄写更合适,但这家伙似乎只对代码有兴趣,总不写文档。
[@more@]

终端

locale支持

Cygwin的locale支持一直都不太好,采用zh_CN.gb2312好像问题很多,我一直采用的是zh_CN.gbk
~/.bashrc
LC_CTYPE=zh_CN.gbk
CHARSET=GBK #(glib2需要使用找个环境变量确定文件名的编码)
export LC_CTYPE CHARSET

一些小问题

允许bash输入、输出中文字符
~/.inputrc
set convert-meta off
set input-meta on
set output-meta on

ls显示中文文件名(而不是一堆问号)
alias ls="/bin/ls --show-control-chars"

less浏览中文文件
less --raw-control-chars
另外LESSCHARSET环境变量也很有用

X下的中文支持

locale支持

Cygwin的locale支持一直都有问题,好在X程序还可以使用XLOCALE。
建议还是使用zh_CN.gbk, 不要使用zh_CN.GB2312

在移植程序时需要注意不要让程序连接libcygwin.a里面的setlocale,而是采用libX11.a里面的_Xsetlocale。方法是:检查被移植程序的全部源代码,发现
#include
就修改为
#define X_LOCALE
#include
同时注意程序的连接库要添加-lX11.
如果对于结果没有把握,可以找个Dependency Walker查看程序是否连接到了cygwin1.dll里面的setlocale,如果是,就说明有遗漏。

中文字体

PCF点阵字体
GTK1.x 和其他一些老的X程序都是用X字体,

注意必须要有编码与locale一致的字体,比如用zh_CN.gbk就必须要由GBK编码的字体,用zh_CN.GB2312就必须要有GB2312编码的字体

如果使用zh_CN.GB2312,这里有一个RedOffice面带的点阵字体包

可以采用ttf2bdf从TTF抽取得到bdf格式,然后再用bdf2pcf得到pcf格式的字体文件。
(这里有一个Windows版本的TTF2BDF,可以将Windows TTF字体转换出BDF字体, 注意得到bdf后要手工编辑一下文件头,将编码声明修改正确)

得到字体之后,放到某个目录下,执行mkfontdir生成fonts.dir,然后用xset +fp /path/to/your/fonts将字体路径加入即可(注意与fontconfig的配置不同,这里路径是不递归的,如果有的字体放在子目录里面,子目录也需要添加进去才行)。
TTF字体
很多新的应用程序(比如GTK2)都使用fontconfig/libxft2来显示字体,它对TTF字体的支持比较好(X以前通过freetype, xft模块也支持TTF字体,但对中日韩字体的支持不是太好,而且也在Cygwin下似乎也没有这些模块)

完全可以使用Linux下的arphic字体包. 如果没有安装Linux,可以到http://packages.debian.org下载相应的包,然后用7zip解压提取出ttf文件。

得到字体文件之后,放到某个目录之下,编辑/etc/fonts/local.conf,将字体路径加入:
/path/to/my/ttf/fonts如果只是自己使用,可以将字体文件放到~/.fonts下,不需要修改任何配置,最多三十秒fontconfig就能够发现这些字体了。

中文输入法

老黄(hzhr)移植了miniChinput到Cygwin,我也移植了fcitx-1.8.5和3.0,均可以从我的网站上找到 http://www.oliwen.com/bamanzi/cygwin/chinese/

一般设置了LC_CTYPE和XMODIFIERS就可以在程序中激活输入输入法了(除非这个程序没有XIM支持):

LC_CTYPE=zh_CN.gbk
XMODIFIERS="@im=Chinput"
export LC_CTYPE XMODIFIERS

对于fcitx而言,XMODIFIERS设置为什么都可以(但必须要设置),所以设置为"@im=Chinput"的话chinput和fcitx都可以正常使用

2004年9月26日星期日

fontconfig/libxft对中文字体的支持似乎改进了很多

今天升级了一下cygwin里面的fontconfig和libxft(fontconfig-2.2.0, freetype-2.1.5 and libXft2-2.1.0),发现中文字体的显示漂亮了不少,原来发虚的问题也没有了。

注: 字体采用了windows里面的simsun字体,配置文件(/etc/fonts/local.conf)如下:
[@more@]


SimSun


false





10


false





bold
black


true

2004年9月20日星期一

制作CHM文件时的未公开的选项

在工程文件(.HHP)中添加窗口定义,然后做相应更改:

添加MSDN菜单:
window定义中将style参数(第一个0x....数值)加上0x10000(比如0x23520->0X33520)

添加字体按钮:
window定义中将buttons参数(第二个0x....数值)加上0x100000(比如0x24385e->0x34385e)

工具条按钮不显示文字:
window定义中将style参数(第一个0x....数值)加上0x40(比如0x23520->0X23560)
[@more@]

工具条按钮说明(带括号者为隐藏选项,可能部分是过时的选项, 至少现在的HtmlHelp Workshop没有提供)

Hide/Show 0x0002
Back 0x0004
Forward 0x0008
Stop 0x0010
Refresh 0x0020
Home 0x0040
(Next) 0x0080 下一步, 不知何用
(Prev) 0x0100 上一步, 不知何用
(Notepad) 0x0200 便笺, 似乎没有作用
(Contents) 0x0400 目录,似乎没有作用
Locate 0x0800
Options 0x1000
Print 0x2000
(Index) 0x4000 索引,似乎没有作用
(Search) 0x8000 搜索,似乎没有作用
(History) 0x010000 历史,似乎没有作用
(Bookmark) 0x020000 书签,似乎没有作用
Jump1 0x040000
Jump2 0x080000
(Fonts) 0x100000 字体
(Next) 0x200000 上一步,不知何用
(Prev) 0x400000 下一步,不知何用

似乎唯一有用的也就是“字体”按钮了

2004年7月16日星期五

gaim-0.64-cygwin-win32: trayicon

今天给gaim2-0.64 for Cygwin with Win32 GUI添加了trayicon支持,
代码都是从win32版本中的相应文件中挪过来的。
明天有时间的话,再看看flash window是否也可以成功移植。

...也不知道有没有意义 :-(

2004年5月30日星期日

Cygwin GNOME 2.4有点样子了

这一个月都埋头在Cygwin GNOME 2.4.2里面,五一这几天假期几乎有四天在家折腾这个东西。

不过总算有点眉目,网站也有了一点内容。

――想起去年搞1.4的时候累的病了一场,现在比较注意了,不管怎样,身体最重要