inital gtk2 patch
authorThorsten Maerz <torte@netztorte.de>
Sun, 5 Oct 2003 10:10:30 +0000 (10:10 +0000)
committerThorsten Maerz <torte@netztorte.de>
Sun, 5 Oct 2003 10:10:30 +0000 (10:10 +0000)
116 files changed:
ChangeLog-gtk2 [new file with mode: 0644]
ChangeLog-gtk2.jp [new file with mode: 0644]
Makefile.am
TODO-gtk2 [new file with mode: 0644]
TODO-gtk2.jp [new file with mode: 0644]
autogen.sh
configure.ac
po/Makefile.in.in
src/Makefile.am
src/account.c
src/action.c
src/addr_compl.c
src/addressadd.c
src/addressbook.c
src/addrgather.c
src/alertpanel.c
src/codeconv.c
src/codeconv.h
src/common/defs.h
src/common/intl.h
src/common/socket.c
src/common/sylpheed.c
src/common/template.c
src/common/utils.c
src/common/utils.h
src/common/xml.c
src/compose.c
src/compose.h
src/editaddress.c
src/editbook.c
src/editgroup.c
src/editjpilot.c
src/editldap.c
src/editldap_basedn.c
src/editvcard.c
src/exphtmldlg.c
src/expldifdlg.c
src/export.c
src/folder.h
src/foldersel.c
src/folderview.c
src/grouplistdialog.c
src/gtk/Makefile.am
src/gtk/about.c
src/gtk/colorlabel.c
src/gtk/colorlabel.h
src/gtk/description_window.c
src/gtk/filesel.c
src/gtk/gtksctree.c
src/gtk/gtksctree.h
src/gtk/gtkshruler.c
src/gtk/gtkshruler.h
src/gtk/gtkutils.c
src/gtk/gtkutils.h
src/gtk/manage_window.h
src/gtk/menu.c
src/gtk/menu.h
src/gtk/pluginwindow.c
src/gtk/sylpheed-marshal.list [new file with mode: 0644]
src/headerview.c
src/imap.c
src/import.c
src/importldif.c
src/importmutt.c
src/importpine.c
src/inc.c
src/inputdialog.c
src/jpilot.c
src/logwindow.c
src/main.c
src/mainwindow.c
src/matcher.h
src/matcher_parser.h
src/matcher_parser_parse.y
src/mbox.h
src/message_search.c
src/messageview.c
src/mh.c
src/mimeview.c
src/mutt.c
src/passphrase.c
src/pine.c
src/plugins/image_viewer/Makefile.am
src/plugins/image_viewer/viewer.c
src/prefs_account.c
src/prefs_actions.c
src/prefs_common.c
src/prefs_common.h
src/prefs_customheader.c
src/prefs_display_header.c
src/prefs_filtering.c
src/prefs_filtering_action.c
src/prefs_folder_item.c
src/prefs_gtk.c
src/prefs_matcher.c
src/prefs_scoring.c
src/prefs_summary_column.c
src/prefs_template.c
src/prefs_toolbar.c
src/procheader.c
src/procmime.c
src/procmsg.h
src/progressdialog.c
src/select-keys.c
src/sigstatus.c
src/sourcewindow.c
src/stock_pixmap.c
src/summary_search.c
src/summaryview.c
src/textview.c
src/textview.h
src/toolbar.c
src/undo.c
src/undo.h
src/unmime.c
src/vcard.c

diff --git a/ChangeLog-gtk2 b/ChangeLog-gtk2
new file mode 100644 (file)
index 0000000..d01a864
--- /dev/null
@@ -0,0 +1,130 @@
+2003-09-14 Takuro Ashie <ashie@homa.ne.jp>
+
+        * Enabled to compile on sylpheed-claws.
+       (tray-icon plugin still cannot compile yet.)
+
+2003-09-06 Takuro Ashie <ashie@homa.ne.jp>
+
+        * Updated to 0.9.5.
+
+2003-08-02 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Updated to 0.9.4.
+       * Ported monitoring SSL mechanism to GSource of GLib2
+       (I don't confirm it)
+       * Added _gtk2 suffix to key name of font preference to avoid
+       ovverwriting preference of Gtk+-1.2 version.
+
+2003-06-09 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Updated to 0.9.2.
+
+2003-05-30 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Updated to 0.9.1.
+        * Translate po files into UTF-8 when execute autogen.sh.
+
+2003-05-28 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Updated to 0.9.0.
+
+2003-04-29 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Plugged GError related memory leaks.
+
+2003-04-28 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Changed default size of fonts.
+       * Enabled to set titile font size of warning dialog.
+
+2003-04-23 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Embed a sylpheed icon into executable binary on Windows.
+
+2003-04-21 Takuro Ashie <ashie@homa.ne.jp>
+
+       * I forgot to traslate character set of element string in src/xml.c.
+
+2003-04-18 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Fixed detecting bind_textdomain_codeset in configure.in.
+       * The bug in which "Example" of "Date fromat" preference isn't displayed
+       correctly has been fixed.
+
+2003-04-04 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Added bind_textdomain_codeset into AC_CHECK_FUNCS.
+         Replaced AM_GLIB_GNU_GETTEXT to AM_GNU_GETTEXT.
+         glib-gettextize
+         Removed intl directory.
+         Translated po files into UTF-8.
+         (Thanks! Ryuji Abe)
+
+2003-03-28 Takuro Ashie <ashie@homa.ne.jp>
+
+       * The bug which doesn't unscape string in xml.c has been fixed.
+
+2003-03-27 Takuro Ashie <ashie@homa.ne.jp>
+
+       * The bug which is failed to translate encoding of file name thorough
+       file dialog has been fixed.
+
+2003-03-25 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Modified to translate file names which is used in inporting/expoting
+       mbox feature and "Save as" feature into locale encoding.
+       * Translate file names into locale encoding when "Attache file" and
+       "Insert file".
+       * Force set G_BROKEN_FILENAMES environment variable.
+       * Other minor fixes.
+
+2003-03-17 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Modified to treat MH folder's name as locale encoding.
+
+2003-03-16 Takuro Ashie <ashie@homa.ne.jp>
+
+       * The bug which clash on switching candidates of auto completion of
+       addresses, cannot use auto completion in Japanesse is fixed
+       (Thanks! Tokunaga-san)¡¥
+
+2003-03-14 Takuro Ashie <ashie@homa.ne.jp>
+
+       * The bug which cannot switch key accelerator preference has been fixed
+       (Thanks! smbd-san)¡¥
+
+2003-03-14 Takuro Ashie <ashie@homa.ne.jp>
+
+       * version 0.8.11-gtk2-20030314
+
+2003-03-14 Takuro Ashie <ashie@homa.ne.jp>
+
+       * The bug in which character set conversion of filtering messages has
+       been fixed.(Thanks! COCOA-san).
+
+2003-03-13 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Revived "Leave space on head" preference in "Message" category.
+       * A bug which clash when put the cursor to end of buffer and execute
+       "Wrap current paragraph" was fixed.(Thanks! Tokunaga-san)
+
+2003-03-12 Takuro Ashie <ashie@homa.ne.jp>
+
+       * version 0.8.11-gtk2-20030312
+
+2003-03-12 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Fixed position of  switching account popup (Thanks! Ikezoe-san)¡¥
+       * Modified to use Pango's API directly for font preference.
+       * Integrated GtkTextView of textview to one widget.
+       * Set fonts of header title in textview by "header_title" tag.
+       * Removed some deprecated codes.
+
+2003-03-11 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Updated to 0.8.11.
+       * Merged cygwin patch(Thanks! Sakai-san).
+
+2003-03-09 Takuro Ashie <ashie@homa.ne.jp>
+
+       * version 0.8.10-gtk2-20030309
diff --git a/ChangeLog-gtk2.jp b/ChangeLog-gtk2.jp
new file mode 100644 (file)
index 0000000..5e33ff6
--- /dev/null
@@ -0,0 +1,126 @@
+2003-09-14 Takuro Ashie <ashie@homa.ne.jp>
+
+        * sylpheed-claws¤Ç¥³¥ó¥Ñ¥¤¥ë¤Ç¤­¤ë¤è¤¦¤Ë¤·¤¿
+       (¥È¥ì¥¤¥¢¥¤¥³¥ó¥×¥é¥°¥¤¥ó¤Ï¤Þ¤À¥³¥ó¥Ñ¥¤¥ë¤Ç¤­¤Ê¤¤)
+
+2003-09-06 Takuro Ashie <ashie@homa.ne.jp>
+
+        * 0.9.5¤ËÄɽ¾
+
+2003-08-02 Takuro Ashie <ashie@homa.ne.jp>
+
+       * 0.9.4¤ËÄɽ¾
+       * SSL´Æ»ëµ¡¹½¤òGLib2¤ÎGSource¤ËÂбþ¤µ¤»¤¿(Æ°ºî̤³Îǧ)
+       * ¥Õ¥©¥ó¥ÈÀßÄê¤Î¥­¡¼Ì¾¤Ë_gtk2¥µ¥Õ¥£¥Ã¥¯¥¹¤ò¤Ä¤±¡¤Gtk+-1.2¥Ð¡¼¥¸¥ç¥ó¤È
+       ¶¦Â¸¤Ç¤­¤ë¤è¤¦¤Ë¤·¤¿
+
+2003-06-09 Takuro Ashie <ashie@homa.ne.jp>
+
+       * 0.9.2¤ËÄɽ¾
+
+2003-05-30 Takuro Ashie <ashie@homa.ne.jp>
+
+       * 0.9.1¤ËÄɽ¾
+        * po¥Õ¥¡¥¤¥ë¤Ïautogen.sh¤ÇÊÑ´¹¤¹¤ë¤è¤¦¤Ë¤·¤¿
+
+2003-05-28 Takuro Ashie <ashie@homa.ne.jp>
+
+       * 0.9.0¤ËÄɽ¾
+
+2003-04-29 Takuro Ashie <ashie@homa.ne.jp>
+
+       * GError¤Î¥á¥â¥ê¥ê¡¼¥¯¤ò½¤Àµ
+
+2003-04-28 Takuro Ashie <ashie@homa.ne.jp>
+
+       * ¥Õ¥©¥ó¥È¤Î¥Ç¥Õ¥©¥ë¥È¥µ¥¤¥º¤òÊѹ¹
+       * ·Ù¹ð¥À¥¤¥¢¥í¥°¤Î¥¿¥¤¥È¥ë¥Õ¥©¥ó¥È¤òÀßÄê¤Ç¤­¤ë¤è¤¦¤Ë¤·¤¿
+
+2003-04-23 Takuro Ashie <ashie@homa.ne.jp>
+
+       * Windows¤Ç¤Î¥³¥ó¥Ñ¥¤¥ë»þ¤Ë¡¤¼Â¹Ô¥Õ¥¡¥¤¥ë¤Ë¥¢¥¤¥³¥ó¤òËä¤á¹þ¤à¤è¤¦¤Ë¤·¤¿
+
+2003-04-21 Takuro Ashie <ashie@homa.ne.jp>
+
+       * src/xml.cÆâ¤Ç¥¨¥ì¥á¥ó¥È¤Îʸ»ú¥³¡¼¥ÉÊÑ´¹¤¬È´¤±¤Æ¤¤¤¿ÌäÂê¤ò½¤Àµ
+
+2003-04-18 Takuro Ashie <ashie@homa.ne.jp>
+
+       * bind_textdomain_codeset¤Î¸¡½Ð¤ò½¤Àµ
+       * ÆüÉդνñ¼°ÀßÄê¤Îɽ¼¨Î㤬Àµ¤·¤¯É½¼¨¤µ¤ì¤Æ¤¤¤Ê¤«¤Ã¤¿¤Î¤ò½¤Àµ
+
+2003-04-04 Takuro Ashie <ashie@homa.ne.jp>
+
+       * AC_CHECK_FUNCS¤Ëbind_textdomain_codeset¤òÄɲÃ
+         AM_GNU_GETTEXT¤òAM_GLIB_GNU_GETTEXT¤ËÃÖ¤­´¹¤¨
+         glib-gettextize
+         intl¥Ç¥£¥ì¥¯¥È¥ê¤òºï½ü
+         po¥Õ¥¡¥¤¥ë¤òUTF-8¤ËÊÑ´¹
+         (Thanks! °ÂÉôεÆ󤵤ó)
+
+2003-03-28 Takuro Ashie <ashie@homa.ne.jp>
+
+       * xml.cÆâ¤ÇunescapeÁ°¤Ëʸ»ú¥³¡¼¥ÉÊÑ´¹¤ò¹Ô¤Ã¤Æ¤¤¤¿ÌäÂê¤ò½¤Àµ
+
+2003-03-27 Takuro Ashie <ashie@homa.ne.jp>
+
+       * ¥Õ¥¡¥¤¥ëÁªÂò¥À¥¤¥¢¥í¥°·Ðͳ¤Î½èÍý¤ÎºÝ¤Ëʸ»ú¥³¡¼¥ÉÊÑ´¹¤Ë¼ºÇÔ¤·¤Æ¤¤¤¿ÌäÂê
+       ¤ò½¤Àµ
+
+2003-03-25 Takuro Ashie <ashie@homa.ne.jp>
+
+       * ¡Ömbox¥Õ¥¡¥¤¥ë¤Î¥¤¥ó¥Ý¡¼¥È/¥¨¥¯¥¹¥Ý¡¼¥È¡×µÚ¤Ó¡Ö̾Á°¤òÉÕ¤±¤ÆÊݸ¡×»þ¤Î
+       ¥Õ¥¡¥¤¥ë̾¤òlocale¤Îʸ»ú¥³¡¼¥É¤ËÊÑ´¹¤¹¤ë¤è¤¦¤Ë¤·¤¿¡¥
+       * ¡Ö¥Õ¥¡¥¤¥ëźÉաס֥ե¡¥¤¥ëÁÞÆþ¡×»þ¤Î¥Õ¥¡¥¤¥ë̾¤òlocale¤Îʸ»ú¥³¡¼¥É¤ËÊÑ
+       ´¹¤¹¤ë¤è¤¦¤Ë¤·¤¿¡¥
+       * ¶¯À©Åª¤Ë´Ä¶­ÊÑ¿ôG_BROKEN_FILENAMES¤ò¥»¥Ã¥È¤¹¤ë¤è¤¦¤Ë¤·¤¿¡¥
+       * ¤½¤Î¾ºÙ¤«¤¤½¤Àµ
+
+2003-03-17 Takuro Ashie <ashie@homa.ne.jp>
+
+       * MH¥Õ¥©¥ë¥À¤Î¥Ç¥£¥ì¥¯¥È¥ê̾¤òlocale¤Îʸ»ú¥³¡¼¥É¤Ç°·¤¦¤è¤¦¤Ë½¤Àµ¡¥
+
+2003-03-16 Takuro Ashie <ashie@homa.ne.jp>
+
+       * ¥¢¥É¥ì¥¹Êä´°»þ¤Ë¸õÊä¤òÀÚÂؤ¨¤ë¤ÈÍî¤Á¤ëÌäÂꡤµÚ¤ÓÆüËܸì¤ÇÊä´°¤Ç¤­¤Ê¤¤Ìä
+       Âê¤ò½¤Àµ(Thanks! ÆÁ±Ê¤µ¤ó)¡¥
+
+2003-03-14 Takuro Ashie <ashie@homa.ne.jp>
+
+       * ¥­¡¼¥¢¥¯¥»¥é¥ì¡¼¥¿¤ÎÀßÄê¤òÀÚÂؤ¨¤é¤ì¤Ê¤¤ÌäÂê¤ò½¤Àµ(Thanks! smbd¤µ¤ó)¡¥
+
+2003-03-14 Takuro Ashie <ashie@homa.ne.jp>
+
+       * version 0.8.11-gtk2-20030314
+
+2003-03-14 Takuro Ashie <ashie@homa.ne.jp>
+
+       * ¿¶¤êʬ¤±ÀßÄê¤Îʸ»ú¥³¡¼¥ÉÊÑ´¹¤¬²õ¤ì¤Æ¤¤¤¿¥Ð¥°¤ò½¤Àµ(Thanks! COCOA¤µ¤ó)¡¥
+
+2003-03-13 Takuro Ashie <ashie@homa.ne.jp>
+
+       * ¹Ô´Ö¤ª¤è¤Ó¹ÔƬ¤Î¶õÇò¤ÎÀßÄê¤òÉü¸µ¡¥
+       * ¥«¡¼¥½¥ë¤òʸËö¤ËÃÖ¤¤¤¿¾õÂ֤ǡָ½ºß¤ÎÃÊÍî¤òÀ°·Á¤¹¤ë¡×¤ò¼Â¹Ô¤¹¤ë¤ÈÍî¤Á¤ë
+       ÌäÂê¤ò½¤Àµ(Thanks! ÆÁ±Ê¤µ¤ó)¡¥
+
+2003-03-12 Takuro Ashie <ashie@homa.ne.jp>
+
+       * version 0.8.11-gtk2-20030312
+
+2003-03-12 Takuro Ashie <ashie@homa.ne.jp>
+
+       * ¥¢¥«¥¦¥ó¥ÈÀÚÂؤ¨¥Ü¥¿¥ó¤Î¥á¥Ë¥å¡¼½Ð¸½°ÌÃÖ¤ò½¤Àµ(Thanks! ÃÓź¤µ¤ó)¡¥
+       * ¥Õ¥©¥ó¥ÈÀßÄêÍѤΥ³¡¼¥É¤òPango¤ÎAPI¤òľÀÜ»ÈÍѤ¹¤ë¤è¤¦¤ËÊѹ¹¡¥
+       * textview¤ÎGtkTextView¥¦¥£¥¸¥§¥Ã¥È¤ò°ì¤Ä¤ËÅý¹ç¡¥
+       * textview¤Î¥Ø¥Ã¥À¥¿¥¤¥È¥ë¤Î¥Õ¥©¥ó¥È¤ò¡Öheader_title¡×¥¿¥°¤ÇÀßÄꤹ¤ë¤è¤¦
+        ¤Ë¤·¤¿¡¥
+       * Deprecated¤Ê¥³¡¼¥É¤òÀ°Íý¡¥
+
+2003-03-11 Takuro Ashie <ashie@homa.ne.jp>
+
+       * ¥Ù¡¼¥¹¤ò0.8.11¤Ë¹¹¿·¡¥
+       * cygwin¥Ñ¥Ã¥Á¤ò¥Þ¡¼¥¸(Thanks! ¼ò°æ¤µ¤ó)¡¥
+
+2003-03-09 Takuro Ashie <ashie@homa.ne.jp>
+
+       * version 0.8.10-gtk2-20030309
index 945e0e1..97c77bd 100644 (file)
@@ -1,8 +1,10 @@
-SUBDIRS = ac po src man manual faq tools config intl
+SUBDIRS = ac po src man manual faq tools config
 
 EXTRA_DIST = \
        ChangeLog.claws \
        ChangeLog.jp \
+       ChangeLog-gtk2 \
+       ChangeLog-gtk2.jp \
        README.claws \
        README.jp \
        sylpheed-128x128.png \
@@ -15,6 +17,8 @@ EXTRA_DIST = \
        TODO \
        TODO.claws \
        TODO.jp \
+       TODO-gtk2 \
+       TODO-gtk2.jp \
        autogen.sh 
 
 if SYLPHEED_GNOME
diff --git a/TODO-gtk2 b/TODO-gtk2
new file mode 100644 (file)
index 0000000..7bfea4a
--- /dev/null
+++ b/TODO-gtk2
@@ -0,0 +1,23 @@
+Bugfixes
+    * SSL support seems broken.
+    * Chracter set conversion
+        * Modify codeconv.c for UTF-8
+        * Should we prepare functions  for locale <-> UTF-8?
+          (Use conv_localetodisp()?)
+        * Character set of file name.
+          (Should we use g_filename_from_locale() and g_filename_to_locale()?)
+        * Character set conversion for "Action" feature.
+        * Character set conversion for jpilot
+        * vCard is ok?(<- I don't understand about it)
+    * URI of uri_list_extract_filenames()
+        * Host name.
+        * Should we add a argument for length of string?
+    * Revive ruler of compose(adjust start point)
+    * Case sensitive searching feature in message.
+    * Remove all deprecated codes (About 90% completed except CList/CTree)
+    * Verify all #warning FIXME_GTK2
+    * Remove all warnings of Gtk+
+    * Fix other unknown bugs.
+
+Features
+    * I want a dialog for character set conversion when invoke external editor.
diff --git a/TODO-gtk2.jp b/TODO-gtk2.jp
new file mode 100644 (file)
index 0000000..8da3d0c
--- /dev/null
@@ -0,0 +1,22 @@
+¥Ð¥°¥Õ¥£¥Ã¥¯¥¹
+    * SSL¥µ¥Ý¡¼¥È
+    * Ê¸»ú¥³¡¼¥ÉÊÑ´¹¤Î¥³¡¼¥É¸«Ä¾¤·
+        * codeconv.c¤òUTF-8¤ò¥á¥¤¥ó¤Ë½¤Àµ?
+        * locale <-> UTF-8 ¤ÏŬÅö¤Ê´Ø¿ô¤òÍÑ°Õ¤¹¤Ù¤­?(conv_localetodisp()¤ò»ÈÍÑ?)
+        * ¥Õ¥¡¥¤¥ë̾¤Îʸ»ú¥³¡¼¥É¤Î°·¤¤
+          (g_filename_from_locale()µÚ¤Óg_filename_to_locale()¤ò»ÈÍѤ¹¤Ù¤­?)
+        * ¡Ö¥¢¥¯¥·¥ç¥ó¡×Åù¤Ç¥³¥Þ¥ó¥É¤ËÅϤ¹Ê¸»úÎó¤Îʸ»ú¥³¡¼¥ÉÊÑ´¹
+        * jpilot¤Îʸ»ú¥³¡¼¥ÉÊÑ´¹
+        * vCard¤ÏÂç¾æÉ×?(<-Á´Á³Ê¬¤«¤Ã¤Æ¤Ê¤¤)
+    * uri_list_extract_filenames()¤Ç¤ÎURI¤Î°·¤¤
+        * ¥Û¥¹¥È̾¤Î°·¤¤(»ö¼Â¾å¡¤Æ°ºî¤Ë¤Ï»Ù¾ã̵¤¤?)
+        * °ú¿ô¤Ëʸ»úÎóŤò²Ã¤¨¤ë¤Ù¤­?
+    * Compose¤Î¥ë¡¼¥é¤òÉü¸µ(»ÏÅÀ¤ÎÄ´À°)
+    * ¥á¥Ã¥»¡¼¥¸Æ⸡º÷¤Ç¤ÎÂçʸ»ú/¾®Ê¸»ú¤Î¶èÊÌ
+    * Deprecated¤Ê¥³¡¼¥É¤ò°ìÁÝ(CList/CTree°Ê³°¤Ï9³äÊý½ªÎ»)
+    * Á´¤Æ¤Î #warning FIXME_GTK2 ¤ò¸¡¾Ú/Áݽü
+    * Gtk+¤¬ÅǤ¯Á´¤Æ¤ÎWarning¤òËõ»¦
+    * ¤½¤Î¾Á´¤Æ¤Î̤ÃΤΥХ°¤Î½¤Àµ
+
+µ¡Ç½³ÈÄ¥
+    * ³°Éô¥¨¥Ç¥£¥¿Åù¤ËÅϤ¹ºÝ¤Îʸ»ú¥³¡¼¥É»ØÄêÍѤΥÀ¥¤¥¢¥í¥°¤¬¤¢¤ë¤ÈÎɤ¤¤«¤â
index 517d398..4f75a6d 100644 (file)
@@ -1,5 +1,9 @@
 #!/bin/sh
 
+cd po
+/bin/sh poconv.sh
+cd ..
+
 aclocal -I ac \
   && libtoolize --force --copy \
   && autoheader \
index f3f4621..78ae27f 100644 (file)
@@ -79,18 +79,58 @@ AC_PROG_YACC
 AM_PROG_LIBTOOL
 
 SYLPHEED_ACLOCAL_INCLUDE(ac)
+  
+dnl ******************************
+dnl Checks for host
+dnl ******************************
+AC_CANONICAL_HOST
+
+dnl Copied from the official gtk+-2 configure.in
+AC_MSG_CHECKING([for some Win32 platform])
+case "$host" in
+  *-*-mingw*|*-*-cygwin*)
+    platform_win32=yes
+    LDFLAGS="$LDFLAGS -mwindows"
+    ;;
+  *)
+    platform_win32=no
+    ;;
+esac
+AC_MSG_RESULT([$platform_win32])
+AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = x"yes")
+
+if test x"$platform_win32" = x"yes"; then
+    WINDRES=windres
+    AC_SUBST(WINDRES)
+fi
+
+AC_MSG_CHECKING([for native Win32])
+case "$host" in
+  *-*-mingw*)
+    os_win32=yes
+    ;;
+  *)
+    os_win32=no
+    ;;
+esac
+AC_MSG_RESULT([$os_win32])
+AM_CONDITIONAL(OS_WIN32, test x"$os_win32" = x"yes")
 
 case "$target" in
 *-darwin*)
        CFLAGS="$CFLAGS -traditional-cpp -fno-common"
        ;;
 esac
-
+  
+dnl Checks for iconv
 AM_ICONV
 
 dnl for gettext
 ALL_LINGUAS="bg cs de el en_GB es fr hr hu it ja ko nl pl pt_BR ru sk sr sv zh_TW.Big5"
-AM_GNU_GETTEXT([use-libtool])
+GETTEXT_PACKAGE=sylpheed
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.])
+AM_GLIB_GNU_GETTEXT
 dnl AC_CHECK_FUNC(gettext, AC_CHECK_LIB(intl, gettext))
 localedir='${prefix}/${DATADIRNAME}/locale'
 AC_SUBST(localedir)
@@ -187,9 +227,15 @@ dnl ** common code **
 dnl *****************
 
 dnl check for glib
-AM_PATH_GLIB(1.2.6,,
+AM_PATH_GLIB_2_0(2.0.0,,
        AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
-       gthread)
+       gmodule gobject gthread)
+
+dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
+syl_save_LIBS=$LIBS
+LIBS="$LIBS $GTK_LIBS"
+AC_CHECK_FUNCS(bind_textdomain_codeset)
+LIBS=$syl_save_LIBS
 
 dnl check for IPv6 option
 AC_ARG_ENABLE(ipv6,
@@ -240,7 +286,7 @@ dnl ** GTK user interface **
 dnl ************************
 
 dnl Checks for GTK
-AM_PATH_GTK(1.2.6,,
+AM_PATH_GTK_2_0(2.0.0,,
        AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
 
 dnl check if gdk / gtk was compiled with USE_XIM
@@ -433,20 +479,14 @@ if test x"$ac_cv_enable_image_viewer_plugin" = xyes; then
                [ac_cv_enable_imlib=$enableval], [ac_cv_enable_imlib=yes])
 
        if test "$ac_cv_enable_gdk_pixbuf" = yes; then
-               AM_PATH_GDK_PIXBUF(0.8.0,
-                       [AC_DEFINE(HAVE_GDK_PIXBUF, 1, Define if you use gdk-pixbuf to support image viewer)
-                        ac_cv_enable_imlib=no], [ac_cv_enable_gdk_pixbuf=no])
-       fi
-       if test "$ac_cv_enable_imlib" = yes; then
-               AM_PATH_GDK_IMLIB(1.9,
-                       AC_DEFINE(HAVE_GDK_IMLIB, 1, Define if you use gdk_imlib to support image viewer),
-                       [ac_cv_enable_imlib=no])
+               PKG_CHECK_MODULES(GDK_PIXBUF, \
+                       [ gdk-pixbuf-2.0 ],
+                       [ AC_DEFINE(HAVE_GDK_PIXBUF, 1, Define if you use gdk-pixbuf to support image viewer) ],
+                       [ ac_cv_enable_gdk_pixbuf=no ])
        fi
 
        if test "$ac_cv_enable_gdk_pixbuf" = yes; then
                PLUGINS="image-viewer(gdk-pixbuf) $PLUGINS"
-       elif test "$ac_cv_enable_imlib" = yes; then
-               PLUGINS="image-viewer(gdk_imlib) $PLUGINS"
        else
                ac_cv_enable_image_viewer_plugin=no
        fi
@@ -496,7 +536,6 @@ dnl ****************************
 AC_OUTPUT([
 Makefile
 sylpheed.spec
-intl/Makefile
 ac/Makefile
 po/Makefile.in
 src/common/version.h
index 27b721a..435cd18 100644 (file)
@@ -1,13 +1,18 @@
-# Makefile for PO directory in any package using GNU gettext.
-# Copyright (C) 1995-1997, 2000-2003 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+# Makefile for program source directory in GNU NLS utilities package.
+# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
 #
-# This file can be copied and used freely without restrictions.  It can
-# be used in projects which are not available under the GNU General Public
-# License but which still want to provide support for the GNU gettext
-# functionality.
-# Please note that the actual code of GNU gettext is covered by the GNU
-# General Public License and is *not* in the public domain.
+# This file file be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+#
+# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
+#   instead of PACKAGE and to look for po2tbl in ./ not in intl/
+#
+# - Modified by jacob berkman <jacob@ximian.com> to install
+#   Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
 
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
 PACKAGE = @PACKAGE@
 VERSION = @VERSION@
 
@@ -21,333 +26,218 @@ VPATH = @srcdir@
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 datadir = @datadir@
-localedir = $(datadir)/locale
-gettextsrcdir = $(datadir)/gettext/po
+libdir = @libdir@
+localedir = $(libdir)/locale
+gnulocaledir = $(datadir)/locale
+gettextsrcdir = $(datadir)/glib-2.0/gettext/po
+subdir = po
 
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
+MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
 
+CC = @CC@
+GENCAT = @GENCAT@
 GMSGFMT = @GMSGFMT@
 MSGFMT = @MSGFMT@
 XGETTEXT = @XGETTEXT@
 MSGMERGE = msgmerge
-MSGMERGE_UPDATE = @MSGMERGE@ --update
-MSGINIT = msginit
-MSGCONV = msgconv
-MSGFILTER = msgfilter
 
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+
+INCLUDES = -I.. -I$(top_srcdir)/intl
+
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+SOURCES = 
 POFILES = @POFILES@
 GMOFILES = @GMOFILES@
-UPDATEPOFILES = @UPDATEPOFILES@
-DUMMYPOFILES = @DUMMYPOFILES@
-DISTFILES.common = Makefile.in.in remove-potcdate.sin \
-$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
-DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(DOMAIN).pot stamp-po \
-$(POFILES) $(GMOFILES) \
-$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
+DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
+$(POFILES) $(GMOFILES) $(SOURCES)
 
 POTFILES = \
 
 CATALOGS = @CATALOGS@
-
-# Makevars gets inserted here. (Don't remove this line!)
+CATOBJEXT = @CATOBJEXT@
+INSTOBJEXT = @INSTOBJEXT@
 
 .SUFFIXES:
-.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-update
+.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
+
+.c.o:
+       $(COMPILE) $<
+
+.po.pox:
+       $(MAKE) $(GETTEXT_PACKAGE).pot
+       $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
 
 .po.mo:
-       @echo "$(MSGFMT) -c -o $@ $<"; \
-       $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
+       $(MSGFMT) -o $@ $<
 
 .po.gmo:
-       @lang=`echo $* | sed -e 's,.*/,,'`; \
-       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
-       echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
-       cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+       file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
+         && rm -f $$file && $(GMSGFMT) -o $$file $<
 
-.sin.sed:
-       sed -e '/^#/d' $< > t-$@
-       mv t-$@ $@
+.po.cat:
+       sed -f ../intl/po2msg.sed < $< > $*.msg \
+         && rm -f $@ && $(GENCAT) $@ $*.msg
 
 
 all: all-@USE_NLS@
 
-all-yes: stamp-po
+all-yes: $(CATALOGS)
 all-no:
 
-# stamp-po is a timestamp denoting the last time at which the CATALOGS have
-# been loosely updated. Its purpose is that when a developer or translator
-# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
-# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
-# invocations of "make" will do nothing. This timestamp would not be necessary
-# if updating the $(CATALOGS) would always touch them; however, the rule for
-# $(POFILES) has been designed to not touch files that don't need to be
-# changed.
-stamp-po: $(srcdir)/$(DOMAIN).pot
-       test -z "$(CATALOGS)" || $(MAKE) $(CATALOGS)
-       @echo "touch stamp-po"
-       @echo timestamp > stamp-poT
-       @mv stamp-poT stamp-po
-
-# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
-# otherwise packages like GCC can not be built if only parts of the source
-# have been downloaded.
-
-# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
-# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
-$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
-       $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
-         --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
+$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
+       $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
+         --add-comments --keyword=_ --keyword=N_ \
          --files-from=$(srcdir)/POTFILES.in \
-         --copyright-holder='$(COPYRIGHT_HOLDER)' \
-         --msgid-bugs-address='$(MSGID_BUGS_ADDRESS)'
-       test ! -f $(DOMAIN).po || { \
-         if test -f $(srcdir)/$(DOMAIN).pot; then \
-           sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
-           sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
-           if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
-             rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
-           else \
-             rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
-             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
-           fi; \
-         else \
-           mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
-         fi; \
-       }
-
-# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
-# every "make" invocation, only create it when it is missing.
-# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
-$(srcdir)/$(DOMAIN).pot:
-       $(MAKE) $(DOMAIN).pot-update
-
-# This target rebuilds a PO file if $(DOMAIN).pot has changed.
-# Note that a PO file is not touched if it doesn't need to be changed.
-$(POFILES): $(srcdir)/$(DOMAIN).pot
-       @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
-       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
-       echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
-       cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot
-
+       && test ! -f $(GETTEXT_PACKAGE).po \
+          || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
+               && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
 
 install: install-exec install-data
 install-exec:
 install-data: install-data-@USE_NLS@
-       if test "$(PACKAGE)" = "gettext-tools"; then \
-         $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
-         for file in $(DISTFILES.common) Makevars.template; do \
-           $(INSTALL_DATA) $(srcdir)/$$file \
-                           $(DESTDIR)$(gettextsrcdir)/$$file; \
-         done; \
-         for file in Makevars; do \
-           rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
-         done; \
-       else \
-         : ; \
-       fi
 install-data-no: all
 install-data-yes: all
-       $(mkinstalldirs) $(DESTDIR)$(datadir)
+       if test -r "$(MKINSTALLDIRS)"; then \
+         $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
+       else \
+         $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
+       fi
        @catalogs='$(CATALOGS)'; \
        for cat in $$catalogs; do \
          cat=`basename $$cat`; \
-         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
-         dir=$(localedir)/$$lang/LC_MESSAGES; \
-         $(mkinstalldirs) $(DESTDIR)$$dir; \
-         if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
-         $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
-         echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
-         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
-           if test -n "$$lc"; then \
-             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
-               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
-               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
-               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
-               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
-                for file in *; do \
-                  if test -f $$file; then \
-                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
-                  fi; \
-                done); \
-               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
-             else \
-               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
-                 :; \
-               else \
-                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
-                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
-               fi; \
-             fi; \
-             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
-             ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
-             ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
-             cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
-             echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
+         case "$$cat" in \
+           *.gmo) destdir=$(gnulocaledir);; \
+           *)     destdir=$(localedir);; \
+         esac; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
+         if test -r "$(MKINSTALLDIRS)"; then \
+           $(MKINSTALLDIRS) $$dir; \
+         else \
+           $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
+         fi; \
+         if test -r $$cat; then \
+           $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+           echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
+         else \
+           $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+           echo "installing $(srcdir)/$$cat as" \
+                "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
+         fi; \
+         if test -r $$cat.m; then \
+           $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+           echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
+         else \
+           if test -r $(srcdir)/$$cat.m ; then \
+             $(INSTALL_DATA) $(srcdir)/$$cat.m \
+               $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+             echo "installing $(srcdir)/$$cat as" \
+                  "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
+           else \
+             true; \
            fi; \
-         done; \
+         fi; \
        done
-
-install-strip: install
-
-installdirs: installdirs-exec installdirs-data
-installdirs-exec:
-installdirs-data: installdirs-data-@USE_NLS@
-       if test "$(PACKAGE)" = "gettext-tools"; then \
-         $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
+       if test "$(PACKAGE)" = "glib"; then \
+         if test -r "$(MKINSTALLDIRS)"; then \
+           $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
+         else \
+           $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
+         fi; \
+         $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
+                         $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
        else \
          : ; \
        fi
-installdirs-data-no:
-installdirs-data-yes:
-       $(mkinstalldirs) $(DESTDIR)$(datadir)
-       @catalogs='$(CATALOGS)'; \
-       for cat in $$catalogs; do \
-         cat=`basename $$cat`; \
-         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
-         dir=$(localedir)/$$lang/LC_MESSAGES; \
-         $(mkinstalldirs) $(DESTDIR)$$dir; \
-         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
-           if test -n "$$lc"; then \
-             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
-               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
-               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
-               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
-               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
-                for file in *; do \
-                  if test -f $$file; then \
-                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
-                  fi; \
-                done); \
-               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
-             else \
-               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
-                 :; \
-               else \
-                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
-                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
-               fi; \
-             fi; \
-           fi; \
-         done; \
-       done
 
 # Define this as empty until I found a useful application.
 installcheck:
 
-uninstall: uninstall-exec uninstall-data
-uninstall-exec:
-uninstall-data: uninstall-data-@USE_NLS@
-       if test "$(PACKAGE)" = "gettext-tools"; then \
-         for file in $(DISTFILES.common) Makevars.template; do \
-           rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
-         done; \
-       else \
-         : ; \
-       fi
-uninstall-data-no:
-uninstall-data-yes:
+uninstall:
        catalogs='$(CATALOGS)'; \
        for cat in $$catalogs; do \
          cat=`basename $$cat`; \
-         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
-         for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
-           rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
-         done; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+         rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+         rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+         rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
        done
+       rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
 
 check: all
 
-info dvi ps pdf html tags TAGS ctags CTAGS ID:
+dvi info tags TAGS ID:
 
 mostlyclean:
-       rm -f remove-potcdate.sed
-       rm -f stamp-poT
-       rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
+       rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
        rm -fr *.o
 
 clean: mostlyclean
 
 distclean: clean
-       rm -f Makefile Makefile.in POTFILES *.mo
+       rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
 
 maintainer-clean: distclean
        @echo "This command is intended for maintainers to use;"
        @echo "it deletes files that may require special tools to rebuild."
-       rm -f stamp-po $(GMOFILES)
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-dist distdir:
-       $(MAKE) update-po
-       @$(MAKE) dist2
-# This is a separate target because 'update-po' must be executed before.
-dist2: $(DISTFILES)
+       rm -f $(GMOFILES)
+
+distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: update-po $(DISTFILES)
        dists="$(DISTFILES)"; \
-       if test "$(PACKAGE)" = "gettext-tools"; then \
-         dists="$$dists Makevars.template"; \
-       fi; \
-       if test -f $(srcdir)/ChangeLog; then \
-         dists="$$dists ChangeLog"; \
-       fi; \
-       for i in 0 1 2 3 4 5 6 7 8 9; do \
-         if test -f $(srcdir)/ChangeLog.$$i; then \
-           dists="$$dists ChangeLog.$$i"; \
-         fi; \
-       done; \
-       if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
        for file in $$dists; do \
-         if test -f $$file; then \
-           cp -p $$file $(distdir); \
-         else \
-           cp -p $(srcdir)/$$file $(distdir); \
-         fi; \
+         ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+           || cp -p $(srcdir)/$$file $(distdir); \
        done
 
 update-po: Makefile
-       $(MAKE) $(DOMAIN).pot-update
-       test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
-       $(MAKE) update-gmo
-
-# General rule for updating PO files.
-
-.nop.po-update:
-       @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
-       if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
-       tmpdir=`pwd`; \
-       echo "$$lang:"; \
-       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
-       echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
+       $(MAKE) $(GETTEXT_PACKAGE).pot
        cd $(srcdir); \
-       if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
-         if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
-           rm -f $$tmpdir/$$lang.new.po; \
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         mv $$lang.po $$lang.old.po; \
+         echo "$$lang:"; \
+         if $(MSGMERGE) $$lang.old.po $(GETTEXT_PACKAGE).pot -o $$lang.po; then \
+           rm -f $$lang.old.po; \
          else \
-           if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
-             :; \
-           else \
-             echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
-             exit 1; \
-           fi; \
+           echo "msgmerge for $$cat failed!"; \
+           rm -f $$lang.po; \
+           mv $$lang.old.po $$lang.po; \
          fi; \
-       else \
-         echo "msgmerge for $$lang.po failed!" 1>&2; \
-         rm -f $$tmpdir/$$lang.new.po; \
-       fi
-
-$(DUMMYPOFILES):
-
-update-gmo: Makefile $(GMOFILES)
-       @:
+       done
 
-Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@
-       cd $(top_builddir) \
+# POTFILES is created from POTFILES.in by stripping comments, empty lines
+# and Intltool tags (enclosed in square brackets), and appending a full
+# relative path to them
+POTFILES: POTFILES.in
+       ( if test 'x$(srcdir)' != 'x.'; then \
+           posrcprefix='$(top_srcdir)/'; \
+         else \
+           posrcprefix="../"; \
+         fi; \
+         rm -f $@-t $@ \
+           && (sed -e '/^#/d'                                          \
+                   -e "s/^\[.*\] +//"                                  \
+                   -e '/^[     ]*$$/d'                                 \
+                   -e "s@.*@   $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
+               | sed -e '$$s/\\$$//') > $@-t \
+           && chmod a-w $@-t \
+           && mv $@-t $@ )
+
+Makefile: Makefile.in.in ../config.status POTFILES
+       cd .. \
          && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
               $(SHELL) ./config.status
 
-force:
-
 # Tell versions [3.59,3.63) of GNU make not to export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
index 5e66724..320f1a8 100644 (file)
@@ -1,5 +1,19 @@
 SUBDIRS = common gtk plugins
 
+
+if PLATFORM_WIN32
+
+SYLPHEED_RES = sylpheed.res
+
+sylpheed.rc:
+       echo "SYLPHEED ICON sylpheed.ico" > sylpheed.rc
+
+sylpheed.res: sylpheed.rc
+       $(WINDRES) $< -O coff -o $@
+
+endif
+
+
 bin_PROGRAMS = sylpheed
 
 sylpheed_SOURCES = \
@@ -246,6 +260,7 @@ BUILT_SOURCES = \
        quote_fmt_parse.h
 
 EXTRA_DIST = \
+       sylpheed.ico \
        pixmaps/address_book.xpm \
        pixmaps/address_search.xpm \
        pixmaps/address.xpm \
@@ -346,7 +361,8 @@ sylpheed_LDADD = \
        $(GPGME_LIBS) \
        $(LDAP_LIBS) \
        $(OPENSSL_LIBS) \
-       $(LIBICONV)
+       $(LIBICONV) \
+       $(SYLPHEED_RES)
 
 AM_CPPFLAGS = \
        -DG_LOG_DOMAIN=\"Sylpheed\" \
index ecc47fb..9930980 100644 (file)
@@ -99,7 +99,7 @@ static void account_selected          (GtkCList       *clist,
 static void account_row_moved          (GtkCList       *clist,
                                         gint            source_row,
                                         gint            dest_row);
-static void account_key_pressed                (GtkWidget      *widget,
+static gboolean account_key_pressed    (GtkWidget      *widget,
                                         GdkEventKey    *event,
                                         gpointer        data);
 
@@ -549,15 +549,15 @@ static void account_edit_create(void)
 
        debug_print("Creating account edit window...\n");
 
-       window = gtk_window_new (GTK_WINDOW_DIALOG);
-       gtk_widget_set_usize (window, 500, 320);
+       window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+       gtk_widget_set_size_request (window, 500, 320);
        gtk_container_set_border_width (GTK_CONTAINER (window), 8);
        gtk_window_set_title (GTK_WINDOW (window), _("Edit accounts"));
        gtk_window_set_modal (GTK_WINDOW (window), TRUE);
-       gtk_signal_connect (GTK_OBJECT (window), "delete_event",
-                           GTK_SIGNAL_FUNC (account_delete_event), NULL);
-       gtk_signal_connect (GTK_OBJECT (window), "key_press_event",
-                           GTK_SIGNAL_FUNC (account_key_pressed), NULL);
+       g_signal_connect (G_OBJECT (window), "delete_event",
+                         G_CALLBACK (account_delete_event), NULL);
+       g_signal_connect (G_OBJECT (window), "key_press_event",
+                         G_CALLBACK (account_key_pressed), NULL);
        MANAGE_WINDOW_SIGNALS_CONNECT (window);
        gtk_widget_realize(window);
 
@@ -612,10 +612,10 @@ static void account_edit_create(void)
                GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(clist)->column[i].button,
                                       GTK_CAN_FOCUS);
 
-       gtk_signal_connect (GTK_OBJECT (clist), "select_row",
-                           GTK_SIGNAL_FUNC (account_selected), NULL);
-       gtk_signal_connect_after (GTK_OBJECT (clist), "row_move",
-                                 GTK_SIGNAL_FUNC (account_row_moved), NULL);
+       g_signal_connect (G_OBJECT (clist), "select_row",
+                         G_CALLBACK (account_selected), NULL);
+       g_signal_connect_after (G_OBJECT (clist), "row_move",
+                               G_CALLBACK (account_row_moved), NULL);
 
        vbox2 = gtk_vbox_new (FALSE, 0);
        gtk_widget_show (vbox2);
@@ -624,32 +624,32 @@ static void account_edit_create(void)
        add_btn = gtk_button_new_with_label (_("Add"));
        gtk_widget_show (add_btn);
        gtk_box_pack_start (GTK_BOX (vbox2), add_btn, FALSE, FALSE, 4);
-       gtk_signal_connect (GTK_OBJECT(add_btn), "clicked",
-                           GTK_SIGNAL_FUNC (account_add), NULL);
+       g_signal_connect (G_OBJECT(add_btn), "clicked",
+                         G_CALLBACK (account_add), NULL);
 
        edit_btn = gtk_button_new_with_label (_("Edit"));
        gtk_widget_show (edit_btn);
        gtk_box_pack_start (GTK_BOX (vbox2), edit_btn, FALSE, FALSE, 4);
-       gtk_signal_connect (GTK_OBJECT(edit_btn), "clicked",
-                           GTK_SIGNAL_FUNC (account_edit_prefs), NULL);
+       g_signal_connect (G_OBJECT(edit_btn), "clicked",
+                         G_CALLBACK (account_edit_prefs), NULL);
 
        del_btn = gtk_button_new_with_label (_(" Delete "));
        gtk_widget_show (del_btn);
        gtk_box_pack_start (GTK_BOX (vbox2), del_btn, FALSE, FALSE, 4);
-       gtk_signal_connect (GTK_OBJECT(del_btn), "clicked",
-                           GTK_SIGNAL_FUNC (account_delete), NULL);
+       g_signal_connect (G_OBJECT(del_btn), "clicked",
+                         G_CALLBACK (account_delete), NULL);
 
        down_btn = gtk_button_new_with_label (_("Down"));
        gtk_widget_show (down_btn);
        gtk_box_pack_end (GTK_BOX (vbox2), down_btn, FALSE, FALSE, 4);
-       gtk_signal_connect (GTK_OBJECT(down_btn), "clicked",
-                           GTK_SIGNAL_FUNC (account_down), NULL);
+       g_signal_connect (G_OBJECT(down_btn), "clicked",
+                         G_CALLBACK (account_down), NULL);
 
        up_btn = gtk_button_new_with_label (_("Up"));
        gtk_widget_show (up_btn);
        gtk_box_pack_end (GTK_BOX (vbox2), up_btn, FALSE, FALSE, 4);
-       gtk_signal_connect (GTK_OBJECT(up_btn), "clicked",
-                           GTK_SIGNAL_FUNC (account_up), NULL);
+       g_signal_connect (G_OBJECT(up_btn), "clicked",
+                         G_CALLBACK (account_up), NULL);
 
        hbox = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox);
@@ -662,8 +662,8 @@ static void account_edit_create(void)
        default_btn = gtk_button_new_with_label (_(" Set as default account "));
        gtk_widget_show (default_btn);
        gtk_box_pack_start (GTK_BOX (vbox2), default_btn, TRUE, FALSE, 0);
-       gtk_signal_connect (GTK_OBJECT(default_btn), "clicked",
-                           GTK_SIGNAL_FUNC (account_set_default), NULL);
+       g_signal_connect (G_OBJECT(default_btn), "clicked",
+                         G_CALLBACK (account_set_default), NULL);
 
        gtkut_button_set_create(&hbbox, &close_btn, _("Close"),
                                NULL, NULL, NULL, NULL);
@@ -671,9 +671,9 @@ static void account_edit_create(void)
        gtk_box_pack_end (GTK_BOX (hbox), hbbox, FALSE, FALSE, 0);
        gtk_widget_grab_default (close_btn);
 
-       gtk_signal_connect (GTK_OBJECT (close_btn), "clicked",
-                           GTK_SIGNAL_FUNC (account_edit_close),
-                           NULL);
+       g_signal_connect (G_OBJECT (close_btn), "clicked",
+                         G_CALLBACK (account_edit_close),
+                         NULL);
 
        stock_pixmap_gdk(clist, STOCK_PIXMAP_MARK, &markxpm, &markxpmmask);
        stock_pixmap_gdk(clist, STOCK_PIXMAP_CHECKBOX_ON,
@@ -853,11 +853,12 @@ static void account_row_moved(GtkCList *clist, gint source_row, gint dest_row)
                gtk_clist_moveto(clist, dest_row, -1, 0.5, 0.0);
 }
 
-static void account_key_pressed(GtkWidget *widget, GdkEventKey *event,
-                               gpointer data)
+static gboolean account_key_pressed(GtkWidget *widget, GdkEventKey *event,
+                                   gpointer data)
 {
        if (event && event->keyval == GDK_Escape)
                account_edit_close();
+       return FALSE;
 }
 
 /* set one CList row or add new row */
index fc5bc80..913a06f 100644 (file)
@@ -26,7 +26,9 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
-#include <gdk/gdkx.h>
+#ifdef GDK_WINDOWING_X11
+#      include <gdk/gdkx.h>
+#endif /* GDK_WINDOWING_X11 */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -47,7 +49,6 @@
 #include "action.h"
 #include "compose.h"
 #include "procmsg.h"
-#include "gtkstext.h"
 #include "textview.h"
 
 typedef struct _Children               Children;
@@ -74,7 +75,8 @@ struct _Children
        gboolean         output;
 
        GtkWidget       *msg_text;
-       GdkFont         *msgfont;
+
+       gboolean         is_selection;
 };
 
 struct _ChildInfo
@@ -115,7 +117,6 @@ static void message_actions_execute (MessageView    *msgview,
 static gboolean execute_actions                (gchar          *action, 
                                         GSList         *msg_list, 
                                         GtkWidget      *text,
-                                        GdkFont        *msgfont,
                                         gint            body_pos,
                                         MimeInfo       *partinfo);
 
@@ -475,7 +476,7 @@ static void compose_actions_execute_cb(Compose *compose, guint action_nb,
                return;
        }
 
-       execute_actions(action, NULL, compose->text, NULL, 0, NULL);
+       execute_actions(action, NULL, compose->text, 0, NULL);
 }
 
 static void mainwin_actions_execute_cb(MainWindow *mainwin, guint action_nb,
@@ -507,7 +508,6 @@ static void message_actions_execute(MessageView *msgview, guint action_nb,
        gchar *buf;
        gchar *action;
        GtkWidget *text = NULL;
-       GdkFont *msgfont = NULL;
        guint body_pos = 0;
        ActionType action_type;
        
@@ -516,7 +516,7 @@ static void message_actions_execute(MessageView *msgview, guint action_nb,
        buf = (gchar *)g_slist_nth_data(prefs_common.actions_list, action_nb);
 
        g_return_if_fail(buf);
-       g_return_if_fail(action = strstr(buf, ": "));
+       g_return_if_fail((action = strstr(buf, ": ")));
 
        /* Point to the beginning of the command-line */
        action += 2;
@@ -524,7 +524,6 @@ static void message_actions_execute(MessageView *msgview, guint action_nb,
        textview = messageview_get_current_textview(msgview);
        if (textview) {
                text     = textview->text;
-               msgfont  = textview->msgfont;
                body_pos = textview->body_pos;
        }
        partinfo = messageview_get_selected_mime_part(msgview);
@@ -534,11 +533,11 @@ static void message_actions_execute(MessageView *msgview, guint action_nb,
        if (action_type & (ACTION_PIPE_OUT | ACTION_INSERT))
                msgview->filtered = TRUE;
 
-       execute_actions(action, msg_list, text, msgfont, body_pos, partinfo);
+       execute_actions(action, msg_list, text, body_pos, partinfo);
 }
 
 static gboolean execute_actions(gchar *action, GSList *msg_list,
-                               GtkWidget *text, GdkFont *msgfont,
+                               GtkWidget *text,
                                gint body_pos, MimeInfo *partinfo)
 {
        GSList *children_list = NULL;
@@ -549,11 +548,12 @@ static gboolean execute_actions(gchar *action, GSList *msg_list,
        ActionType action_type;
        MsgInfo *msginfo;
        gchar *cmd;
-       guint start = 0, end = 0;
        gchar *sel_str = NULL;
        gchar *msg_str = NULL;
        gchar *user_str = NULL;
        gchar *user_hidden_str = NULL;
+       GtkTextIter start_iter, end_iter;
+       gboolean is_selection = FALSE;
 
        g_return_val_if_fail(action && *action, FALSE);
 
@@ -580,32 +580,21 @@ static gboolean execute_actions(gchar *action, GSList *msg_list,
        }
 
        if (text) {
-               if (GTK_EDITABLE(text)->has_selection) {
-                       start = GTK_EDITABLE(text)->selection_start_pos;
-                       end   = GTK_EDITABLE(text)->selection_end_pos;
-                       if (start > end) {
-                               guint tmp;
-                               tmp = start;
-                               start = end;
-                               end = tmp;
-                       }
-
-                       if (start == end) {
-                               start = body_pos;
-                               end = gtk_stext_get_length(GTK_STEXT(text));
-                               msg_str = gtk_editable_get_chars
-                                       (GTK_EDITABLE(text), start, end);
-                       } else {
-                               sel_str = gtk_editable_get_chars
-                                       (GTK_EDITABLE(text), start, end);
-                               msg_str = g_strdup(sel_str);
-                       }
-               } else {
-                       start = body_pos;
-                       end = gtk_stext_get_length(GTK_STEXT(text));
-                       msg_str = gtk_editable_get_chars(GTK_EDITABLE(text),
-                                                        start, end);
+               GtkTextBuffer *textbuf;
+
+               textbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+               is_selection = gtk_text_buffer_get_selection_bounds(textbuf,
+                                                                   &start_iter,
+                                                                   &end_iter);
+               if (!is_selection) {
+                       gtk_text_buffer_get_start_iter(textbuf, &start_iter);
+                       gtk_text_buffer_get_end_iter(textbuf, &end_iter);
                }
+               msg_str = gtk_text_buffer_get_text(textbuf,
+                                                  &start_iter, &end_iter,
+                                                  FALSE);
+               if (is_selection)
+                       sel_str = g_strdup (msg_str);
        }
 
        if (action_type & ACTION_USER_STR) {
@@ -626,11 +615,10 @@ static gboolean execute_actions(gchar *action, GSList *msg_list,
                }
        }
 
-       if (action_type & ACTION_PIPE_OUT) {
-               gtk_stext_freeze(GTK_STEXT(text));
-               gtk_stext_set_point(GTK_STEXT(text), start);
-               gtk_stext_forward_delete(GTK_STEXT(text), end - start);
-               gtk_stext_thaw(GTK_STEXT(text));
+       if (text && (action_type & ACTION_PIPE_OUT)) {
+               GtkTextBuffer *textbuf;
+               textbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+               gtk_text_buffer_delete(textbuf, &start_iter, &end_iter);
        }
 
        children = g_new0(Children, 1);
@@ -638,7 +626,7 @@ static gboolean execute_actions(gchar *action, GSList *msg_list,
        children->action      = g_strdup(action);
        children->action_type = action_type;
        children->msg_text    = text;
-       children->msgfont     = msgfont;
+       children->is_selection = is_selection;
 
        if ((action_type & (ACTION_USER_IN | ACTION_USER_HIDDEN_IN)) &&
            ((action_type & ACTION_SINGLE) == 0 || msg_list_len == 1))
@@ -749,7 +737,9 @@ static ChildInfo *fork_child(gchar *cmd, const gchar *msg_str,
                if (setpgid(0, 0))
                        perror("setpgid");
 
+#ifdef GDK_WINDOWING_X11
                close(ConnectionNumber(gdk_display));
+#endif /* GDK_WINDOWING_X11 */
 
                gch_pid = fork();
 
@@ -1015,22 +1005,24 @@ static void update_io_dialog(Children *children)
                if (children->input_hbox)
                        gtk_widget_set_sensitive(children->input_hbox, FALSE);
                gtk_widget_grab_focus(children->close_btn);
-               gtk_signal_connect(GTK_OBJECT(children->dialog),
-                                  "key_press_event",
-                                  GTK_SIGNAL_FUNC(io_dialog_key_pressed_cb),
-                                  children);
+               g_signal_connect(G_OBJECT(children->dialog),
+                                "key_press_event",
+                                G_CALLBACK(io_dialog_key_pressed_cb),
+                                children);
        }
 
        if (children->output) {
                GtkWidget *text = children->text;
                gchar *caption;
                ChildInfo *child_info;
+               GtkTextBuffer *textbuf;
+               GtkTextIter iter, start_iter, end_iter;
 
                gtk_widget_show(children->scrolledwin);
-               gtk_text_freeze(GTK_TEXT(text));
-               gtk_text_set_point(GTK_TEXT(text), 0);
-               gtk_text_forward_delete(GTK_TEXT(text), 
-                                       gtk_text_get_length(GTK_TEXT(text)));
+               textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW(text));
+               gtk_text_buffer_get_start_iter (textbuf, &start_iter);
+               gtk_text_buffer_get_end_iter (textbuf, &end_iter);
+               iter = start_iter;
                for (cur = children->list; cur; cur = cur->next) {
                        child_info = (ChildInfo *)cur->data;
                        if (child_info->pid)
@@ -1042,14 +1034,13 @@ static void update_io_dialog(Children *children)
                                        (_("--- Ended: %s\n"),
                                         child_info->cmd);
 
-                       gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
-                                       caption, -1);
-                       gtk_text_insert(GTK_TEXT(text), NULL, NULL, NULL,
-                                       child_info->output->str, -1);
+                       gtk_text_buffer_insert(textbuf, &iter,
+                                              caption, -1);
+                       gtk_text_buffer_insert(textbuf, &iter,
+                                              child_info->output->str, -1);
                        g_free(caption);
                        child_info->new_out = FALSE;
                }
-               gtk_text_thaw(GTK_TEXT(text));
        }
 }
 
@@ -1077,11 +1068,11 @@ static void create_io_dialog(Children *children)
        gtk_window_set_title(GTK_WINDOW(dialog), _("Action's input/output"));
        gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
        manage_window_set_transient(GTK_WINDOW(dialog));
-       gtk_signal_connect(GTK_OBJECT(dialog), "delete_event",
-                       GTK_SIGNAL_FUNC(delete_io_dialog_cb), children);
-       gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
-                       GTK_SIGNAL_FUNC(hide_io_dialog_cb),
-                       children);
+       g_signal_connect(G_OBJECT(dialog), "delete_event",
+                        G_CALLBACK(delete_io_dialog_cb), children);
+       g_signal_connect(G_OBJECT(dialog), "destroy",
+                        G_CALLBACK(hide_io_dialog_cb),
+                        children);
 
        vbox = gtk_vbox_new(FALSE, 8);
        gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), vbox);
@@ -1096,14 +1087,11 @@ static void create_io_dialog(Children *children)
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
                                       GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
        gtk_box_pack_start(GTK_BOX(vbox), scrolledwin, TRUE, TRUE, 0);
-       gtk_widget_set_usize(scrolledwin, 480, 200);
+       gtk_widget_set_size_request(scrolledwin, 480, 200);
        gtk_widget_hide(scrolledwin);
 
-       text = gtk_text_new(gtk_scrolled_window_get_hadjustment
-                           (GTK_SCROLLED_WINDOW(scrolledwin)),
-                           gtk_scrolled_window_get_vadjustment
-                           (GTK_SCROLLED_WINDOW(scrolledwin)));
-       gtk_text_set_editable(GTK_TEXT(text), FALSE);
+       text = gtk_text_view_new();
+       gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
        gtk_container_add(GTK_CONTAINER(scrolledwin), text);
        gtk_widget_show(text);
 
@@ -1112,17 +1100,17 @@ static void create_io_dialog(Children *children)
                gtk_widget_show(input_hbox);
 
                entry = gtk_entry_new();
-               gtk_widget_set_usize(entry, 320, -1);
-               gtk_signal_connect(GTK_OBJECT(entry), "activate",
-                                  GTK_SIGNAL_FUNC(send_input), children);
+               gtk_widget_set_size_request(entry, 320, -1);
+               g_signal_connect(G_OBJECT(entry), "activate",
+                                G_CALLBACK(send_input), children);
                gtk_box_pack_start(GTK_BOX(input_hbox), entry, TRUE, TRUE, 0);
                if (children->action_type & ACTION_USER_HIDDEN_IN)
                        gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
                gtk_widget_show(entry);
 
                send_button = gtk_button_new_with_label(_(" Send "));
-               gtk_signal_connect(GTK_OBJECT(send_button), "clicked",
-                                  GTK_SIGNAL_FUNC(send_input), children);
+               g_signal_connect(G_OBJECT(send_button), "clicked",
+                                G_CALLBACK(send_input), children);
                gtk_box_pack_start(GTK_BOX(input_hbox), send_button, FALSE,
                                   FALSE, 0);
                gtk_widget_show(send_button);
@@ -1152,10 +1140,10 @@ static void create_io_dialog(Children *children)
 
        gtkut_button_set_create(&hbox, &abort_button, _("Abort"),
                                &close_button, _("Close"), NULL, NULL);
-       gtk_signal_connect(GTK_OBJECT(abort_button), "clicked",
-                       GTK_SIGNAL_FUNC(kill_children_cb), children);
-       gtk_signal_connect(GTK_OBJECT(close_button), "clicked",
-                       GTK_SIGNAL_FUNC(hide_io_dialog_cb), children);
+       g_signal_connect(G_OBJECT(abort_button), "clicked",
+                        G_CALLBACK(kill_children_cb), children);
+       g_signal_connect(G_OBJECT(close_button), "clicked",
+                        G_CALLBACK(hide_io_dialog_cb), children);
        gtk_widget_show(hbox);
 
        if (children->nb)
@@ -1240,29 +1228,26 @@ static void catch_output(gpointer data, gint source, GdkInputCondition cond)
        if (child_info->children->action_type &
            (ACTION_PIPE_OUT | ACTION_INSERT)
            && source == child_info->chld_out) {
-               gboolean is_selection = FALSE;
-               GtkWidget *text = child_info->children->msg_text;
+               GtkTextView *text = GTK_TEXT_VIEW(child_info->children->msg_text);
+               GtkTextBuffer *textbuf = gtk_text_view_get_buffer(text);
+               GtkTextIter iter1, iter2;
+               GtkTextMark *mark;
+               mark = gtk_text_buffer_get_insert(textbuf);
+               gtk_text_buffer_get_iter_at_mark(textbuf, &iter1, mark);
+               gtk_text_buffer_get_iter_at_mark(textbuf, &iter2, mark);
 
-               if (GTK_EDITABLE(text)->has_selection)
-                       is_selection = TRUE;
-               gtk_stext_freeze(GTK_STEXT(text));
                while (TRUE) {
                        c = read(source, buf, sizeof(buf) - 1);
                        if (c == 0)
                                break;
-                       gtk_stext_insert(GTK_STEXT(text),
-                                        child_info->children->msgfont,
-                                        NULL, NULL, buf, c);
+                       gtk_text_buffer_insert(textbuf, &iter2, buf, c);
                }
-               if (is_selection) {
-                       /* Using the select_region draws things. Should not.
-                        * so we just change selection position and 
-                        * defere drawing when thawing. Hack?
-                        */
-                       GTK_EDITABLE(text)->selection_end_pos =
-                                       gtk_stext_get_point(GTK_STEXT(text));
+               if (child_info->children->is_selection) {
+                       gtk_text_buffer_place_cursor(textbuf, &iter1);
+                       gtk_text_buffer_move_mark_by_name
+                               (textbuf, "selection_bound", &iter2);
                }
-               gtk_stext_thaw(GTK_STEXT(text));
        } else {
                c = read(source, buf, sizeof(buf) - 1);
                for (i = 0; i < c; i++)
index de93684..cf094ff 100644 (file)
@@ -167,7 +167,7 @@ static void add_address1(const char *str, address_entry *ae)
 {
        completion_entry *ce1;
        ce1 = g_new0(completion_entry, 1),
-       ce1->string = g_strdup(str);
+       ce1->string = g_utf8_strdown(str, -1);
        /* GCompletion list is case sensitive */
        g_strdown(ce1->string);
        ce1->ref = ae;
@@ -277,69 +277,52 @@ gint start_address_completion(void)
  */
 static gchar *get_address_from_edit(GtkEntry *entry, gint *start_pos)
 {
-       const gchar *edit_text;
+       const gchar *edit_text, *p;
        gint cur_pos;
-       wchar_t *wtext;
-       wchar_t *wp;
-       wchar_t rfc_mail_sep;
-       wchar_t quote;
-       wchar_t lt;
-       wchar_t gt;
        gboolean in_quote = FALSE;
        gboolean in_bracket = FALSE;
        gchar *str;
 
-       if (mbtowc(&rfc_mail_sep, ",", 1) < 0) return NULL;
-       if (mbtowc(&quote, "\"", 1) < 0) return NULL;
-       if (mbtowc(&lt, "<", 1) < 0) return NULL;
-       if (mbtowc(&gt, ">", 1) < 0) return NULL;
-
        edit_text = gtk_entry_get_text(entry);
        if (edit_text == NULL) return NULL;
 
-       wtext = strdup_mbstowcs(edit_text);
-       g_return_val_if_fail(wtext != NULL, NULL);
-
        cur_pos = gtk_editable_get_position(GTK_EDITABLE(entry));
 
        /* scan for a separator. doesn't matter if walk points at null byte. */
-       for (wp = wtext + cur_pos; wp > wtext; wp--) {
-               if (*wp == quote)
-                       in_quote ^= TRUE;
-               else if (!in_quote) {
-                       if (!in_bracket && *wp == rfc_mail_sep)
+       for (p = g_utf8_offset_to_pointer(edit_text, cur_pos);
+            p > edit_text;
+            p = g_utf8_prev_char(p)) {
+               if (*p == '"') {
+                       in_quote = TRUE;
+               } else if (!in_quote) {
+                       if (!in_bracket && *p == ',') {
                                break;
-                       else if (*wp == gt)
+                       } else if (*p == '<')
                                in_bracket = TRUE;
-                       else if (*wp == lt)
+                       else if (*p == '>')
                                in_bracket = FALSE;
                }
        }
 
        /* have something valid */
-       if (wcslen(wp) == 0) {
-               g_free(wtext);
+       if (g_utf8_strlen(p, -1) == 0)
                return NULL;
-       }
 
 #define IS_VALID_CHAR(x) \
-       (iswalnum(x) || (x) == quote || (x) == lt || ((x) > 0x7f))
+       (isalnum(x) || (x) == '"' || (x) == '<' || (((unsigned char)(x)) > 0x7f))
 
        /* now scan back until we hit a valid character */
-       for (; *wp && !IS_VALID_CHAR(*wp); wp++)
+       for (; *p && !IS_VALID_CHAR(*p); p = g_utf8_next_char(p))
                ;
 
 #undef IS_VALID_CHAR
 
-       if (wcslen(wp) == 0) {
-               g_free(wtext);
+       if (g_utf8_strlen(p, -1) == 0)
                return NULL;
-       }
 
-       if (start_pos) *start_pos = wp - wtext;
+       if (start_pos) *start_pos = g_utf8_pointer_to_offset(edit_text, p);
 
-       str = strdup_wcstombs(wp);
-       g_free(wtext);
+       str = g_strdup(p);
 
        return str;
 } 
@@ -377,13 +360,12 @@ guint complete_address(const gchar *str)
 
        g_return_val_if_fail(str != NULL, 0);
 
-       Xstrdup_a(d, str, return 0);
+       /* g_completion is case sensitive */
+       d = g_utf8_strdown(str, -1);
 
        clear_completion_cache();
        g_completion_prefix = g_strdup(str);
 
-       /* g_completion is case sensitive */
-       g_strdown(d);
        result = g_completion_complete(g_completion, d, NULL);
 
        count = g_list_length(result);
@@ -409,6 +391,9 @@ guint complete_address(const gchar *str)
        }
 
        g_completion_count = count;
+
+       g_free(d);
+
        return count;
 }
 
@@ -713,14 +698,14 @@ static void addrcompl_resize_window( CompletionWindow *cw ) {
        gdk_window_get_geometry( cw->window->window, &x, &y, &width, &height, &depth );
 
        gtk_widget_size_request( cw->clist, &r );
-       gtk_widget_set_usize( cw->window, width, r.height );
+       gtk_widget_set_size_request( cw->window, width, r.height );
        gtk_widget_show_all( cw->window );
        gtk_widget_size_request( cw->clist, &r );
 
        /* Adjust window height to available screen space */
        if( ( y + r.height ) > gdk_screen_height() ) {
                gtk_window_set_policy( GTK_WINDOW( cw->window ), TRUE, FALSE, FALSE );
-               gtk_widget_set_usize( cw->window, width, gdk_screen_height() - y );
+               gtk_widget_set_size_request( cw->window, width, gdk_screen_height() - y );
        }
 }
 
@@ -919,7 +904,7 @@ static void completion_window_apply_selection(GtkCList *clist, GtkEntry *entry)
        /* Move focus to next widget */
        parent = GTK_WIDGET(entry)->parent;
        if( parent ) {
-               gtk_container_focus( GTK_CONTAINER(parent), GTK_DIR_TAB_FORWARD );
+               gtk_widget_child_focus( parent, GTK_DIR_TAB_FORWARD );
        }
 }
 
@@ -933,9 +918,9 @@ void address_completion_start(GtkWidget *mainwindow)
        start_address_completion();
 
        /* register focus change hook */
-       gtk_signal_connect(GTK_OBJECT(mainwindow), "set_focus",
-                          GTK_SIGNAL_FUNC(address_completion_mainwindow_set_focus),
-                          mainwindow);
+       g_signal_connect(G_OBJECT(mainwindow), "set_focus",
+                        G_CALLBACK(address_completion_mainwindow_set_focus),
+                        mainwindow);
 }
 
 /**
@@ -954,16 +939,15 @@ void address_completion_register_entry(GtkEntry *entry)
        g_return_if_fail(GTK_IS_ENTRY(entry));
 
        /* add hooked property */
-       gtk_object_set_data(GTK_OBJECT(entry), ENTRY_DATA_TAB_HOOK, entry);
+       g_object_set_data(G_OBJECT(entry), ENTRY_DATA_TAB_HOOK, entry);
 
        /* add keypress event */
-       gtk_signal_connect_full(GTK_OBJECT(entry), "key_press_event",
-                               GTK_SIGNAL_FUNC(address_completion_entry_key_pressed),
-                               NULL,
+       g_signal_connect_closure
+               (GTK_OBJECT(entry), "key_press_event",
+                g_cclosure_new(G_CALLBACK(address_completion_entry_key_pressed),
                                COMPLETION_UNIQUE_DATA,
-                               NULL,
-                               0,
-                               0); /* magic */
+                               NULL),
+                FALSE); /* magic */
 }
 
 /**
@@ -977,17 +961,17 @@ void address_completion_unregister_entry(GtkEntry *entry)
        g_return_if_fail(entry != NULL);
        g_return_if_fail(GTK_IS_ENTRY(entry));
 
-       entry_obj = gtk_object_get_data(GTK_OBJECT(entry), ENTRY_DATA_TAB_HOOK);
+       entry_obj = g_object_get_data(G_OBJECT(entry), ENTRY_DATA_TAB_HOOK);
        g_return_if_fail(entry_obj);
        g_return_if_fail(entry_obj == GTK_OBJECT(entry));
 
        /* has the hooked property? */
-       gtk_object_set_data(GTK_OBJECT(entry), ENTRY_DATA_TAB_HOOK, NULL);
+       g_object_set_data(G_OBJECT(entry), ENTRY_DATA_TAB_HOOK, NULL);
 
        /* remove the hook */
-       gtk_signal_disconnect_by_func(GTK_OBJECT(entry), 
-               GTK_SIGNAL_FUNC(address_completion_entry_key_pressed),
-               COMPLETION_UNIQUE_DATA);
+       g_signal_handlers_disconnect_by_func(G_OBJECT(entry), 
+                       G_CALLBACK(address_completion_entry_key_pressed),
+                       COMPLETION_UNIQUE_DATA);
 }
 
 /**
@@ -1008,8 +992,11 @@ static void address_completion_mainwindow_set_focus(GtkWindow *window,
                                                    GtkWidget *widget,
                                                    gpointer   data)
 {
-       if (widget)
+       
+       if (widget && GTK_IS_ENTRY(widget) &&
+           g_object_get_data(G_OBJECT(widget), ENTRY_DATA_TAB_HOOK)) {
                clear_completion_cache();
+       }
 }
 
 /**
@@ -1032,14 +1019,14 @@ static gboolean address_completion_entry_key_pressed(GtkEntry    *entry,
                         * reported by the system. */
                        ev->keyval = GDK_AudibleBell_Enable;
                        ev->state &= ~GDK_SHIFT_MASK;
-                       gtk_signal_emit_stop_by_name(GTK_OBJECT(entry),
-                                                    "key_press_event");
 
                        /* Create window */                     
                        address_completion_create_completion_window(entry);
 
                        /* Start remote queries */
                        addrcompl_start_search();
+
+                       return TRUE;
                }
                else {
                        /* old behaviour */
@@ -1058,7 +1045,7 @@ static gboolean address_completion_entry_key_pressed(GtkEntry    *entry,
        } else
                clear_completion_cache();
 
-       return TRUE;
+       return FALSE;
 }
 /**
  * Initialize search term for address completion.
@@ -1137,26 +1124,26 @@ static void address_completion_create_completion_window( GtkEntry *entry_ )
        gdk_window_get_geometry(entry->window, &x, &y, &width, &height, &depth);
        gdk_window_get_deskrelative_origin (entry->window, &x, &y);
        y += height;
-       gtk_widget_set_uposition(window, x, y);
+       gtk_window_move(GTK_WINDOW(window), x, y);
 
        /* Resize window to fit initial (empty) address list */
        gtk_widget_size_request( clist, &r );
-       gtk_widget_set_usize( window, width, r.height );
+       gtk_widget_set_size_request( window, width, r.height );
        gtk_widget_show_all( window );
        gtk_widget_size_request( clist, &r );
 
        /* Setup handlers */
-       gtk_signal_connect(GTK_OBJECT(clist), "select_row",
-                          GTK_SIGNAL_FUNC(completion_window_select_row),
-                          _compWindow_ );
-       gtk_signal_connect(GTK_OBJECT(window),
-                          "button-press-event",
-                          GTK_SIGNAL_FUNC(completion_window_button_press),
-                          _compWindow_ );
-       gtk_signal_connect(GTK_OBJECT(window),
-                          "key-press-event",
-                          GTK_SIGNAL_FUNC(completion_window_key_press),
-                          _compWindow_ );
+       g_signal_connect(G_OBJECT(clist), "select_row",
+                        G_CALLBACK(completion_window_select_row),
+                        _compWindow_ );
+       g_signal_connect(G_OBJECT(window),
+                        "button-press-event",
+                        G_CALLBACK(completion_window_button_press),
+                        _compWindow_ );
+       g_signal_connect(G_OBJECT(window),
+                        "key-press-event",
+                        G_CALLBACK(completion_window_key_press),
+                        _compWindow_ );
        gdk_pointer_grab(window->window, TRUE,
                         GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK |
                         GDK_BUTTON_RELEASE_MASK,
@@ -1307,7 +1294,7 @@ static gboolean completion_window_key_press(GtkWidget *widget,
 
                /* Move focus to next widget */
                if( parent ) {
-                       gtk_container_focus( GTK_CONTAINER(parent), GTK_DIR_TAB_FORWARD );
+                       gtk_widget_child_focus( parent, GTK_DIR_TAB_FORWARD );
                }
                return FALSE;
        }
@@ -1323,7 +1310,7 @@ static gboolean completion_window_key_press(GtkWidget *widget,
 
                /* Move focus to previous widget */
                if( parent ) {
-                       gtk_container_focus( GTK_CONTAINER(parent), GTK_DIR_TAB_BACKWARD );
+                       gtk_widget_child_focus( parent, GTK_DIR_TAB_BACKWARD );
                }
                return FALSE;
        }
index 928f533..e39012b 100644 (file)
@@ -104,11 +104,12 @@ static gint addressadd_delete_event( GtkWidget *widget, GdkEventAny *event, gboo
        return TRUE;
 }
 
-static void addressadd_key_pressed( GtkWidget *widget, GdkEventKey *event, gboolean *cancelled ) {
+static gboolean addressadd_key_pressed( GtkWidget *widget, GdkEventKey *event, gboolean *cancelled ) {
        if (event && event->keyval == GDK_Escape) {
                addressadd_cancelled = TRUE;
                gtk_main_quit();
        }
+       return FALSE;
 }
 
 static void addressadd_ok( GtkWidget *widget, gboolean *cancelled ) {
@@ -127,8 +128,8 @@ static void addressadd_folder_select( GtkCTree *ctree, gint row, gint column,
        addressadd_dlg.fiSelected = gtk_clist_get_row_data( GTK_CLIST(ctree), row );
 }
 
-static void addressadd_tree_button( GtkCTree *ctree, GdkEventButton *event, gpointer data ) {
-       if( ! event ) return;
+static gboolean addressadd_tree_button( GtkCTree *ctree, GdkEventButton *event, gpointer data ) {
+       if( ! event ) return FALSE;
        if( event->button == 1 ) {
                /* Handle double click */
                if( event->type == GDK_2BUTTON_PRESS ) {
@@ -136,6 +137,8 @@ static void addressadd_tree_button( GtkCTree *ctree, GdkEventButton *event, gpoi
                        gtk_main_quit();
                }
        }
+
+       return FALSE;
 }
 
 static void addressadd_create( void ) {
@@ -156,16 +159,16 @@ static void addressadd_create( void ) {
        GtkWidget *statusbar;
        gint top;
 
-       window = gtk_window_new(GTK_WINDOW_DIALOG);
-       gtk_widget_set_usize( window, 300, 400 );
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       gtk_widget_set_size_request( window, 300, 400 );
        gtk_container_set_border_width( GTK_CONTAINER(window), 0 );
        gtk_window_set_title( GTK_WINDOW(window), _("Add to address book") );
        gtk_window_set_position( GTK_WINDOW(window), GTK_WIN_POS_MOUSE );
        gtk_window_set_modal( GTK_WINDOW(window), TRUE );
-       gtk_signal_connect( GTK_OBJECT(window), "delete_event",
-                           GTK_SIGNAL_FUNC(addressadd_delete_event), NULL );
-       gtk_signal_connect( GTK_OBJECT(window), "key_press_event",
-                           GTK_SIGNAL_FUNC(addressadd_key_pressed), NULL );
+       g_signal_connect( G_OBJECT(window), "delete_event",
+                         G_CALLBACK(addressadd_delete_event), NULL );
+       g_signal_connect( G_OBJECT(window), "key_press_event",
+                         G_CALLBACK(addressadd_key_pressed), NULL );
 
        vbox = gtk_vbox_new(FALSE, 8);
        gtk_container_add(GTK_CONTAINER(window), vbox);
@@ -243,14 +246,14 @@ static void addressadd_create( void ) {
        gtk_container_set_border_width( GTK_CONTAINER(hbbox), 0 );
        gtk_widget_grab_default(ok_btn);
 
-       gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
-                          GTK_SIGNAL_FUNC(addressadd_ok), NULL);
-       gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked",
-                          GTK_SIGNAL_FUNC(addressadd_cancel), NULL);
-       gtk_signal_connect(GTK_OBJECT(tree_folder), "select_row",
-                          GTK_SIGNAL_FUNC(addressadd_folder_select), NULL);
-       gtk_signal_connect(GTK_OBJECT(tree_folder), "button_press_event",
-                          GTK_SIGNAL_FUNC(addressadd_tree_button), NULL);
+       g_signal_connect(G_OBJECT(ok_btn), "clicked",
+                        G_CALLBACK(addressadd_ok), NULL);
+       g_signal_connect(G_OBJECT(cancel_btn), "clicked",
+                        G_CALLBACK(addressadd_cancel), NULL);
+       g_signal_connect(G_OBJECT(tree_folder), "select_row",
+                        G_CALLBACK(addressadd_folder_select), NULL);
+       g_signal_connect(G_OBJECT(tree_folder), "button_press_event",
+                        G_CALLBACK(addressadd_tree_button), NULL);
 
        gtk_widget_show_all(vbox);
 
index 6daf690..5511c0c 100644 (file)
@@ -199,16 +199,16 @@ static void addressbook_entry_gotfocus            (GtkWidget      *widget);
 static void addressbook_entry_changed          (GtkWidget      *widget);
 #endif
 
-static void addressbook_list_button_pressed    (GtkWidget      *widget,
+static gboolean addressbook_list_button_pressed        (GtkWidget      *widget,
                                                 GdkEventButton *event,
                                                 gpointer        data);
-static void addressbook_list_button_released   (GtkWidget      *widget,
+static gboolean addressbook_list_button_released(GtkWidget     *widget,
                                                 GdkEventButton *event,
                                                 gpointer        data);
-static void addressbook_tree_button_pressed    (GtkWidget      *ctree,
+static gboolean addressbook_tree_button_pressed        (GtkWidget      *ctree,
                                                 GdkEventButton *event,
                                                 gpointer        data);
-static void addressbook_tree_button_released   (GtkWidget      *ctree,
+static gboolean addressbook_tree_button_released(GtkWidget     *ctree,
                                                 GdkEventButton *event,
                                                 gpointer        data);
 static void addressbook_popup_close            (GtkMenuShell   *menu_shell,
@@ -295,7 +295,7 @@ static void addressbook_move_nodes_up               (GtkCTree       *ctree,
                                                GtkCTreeNode    *node);
 static GtkCTreeNode *addressbook_find_group_node (GtkCTreeNode *parent,
                                                   ItemGroup    *group);
-static void key_pressed                                (GtkWidget      *widget,
+static gboolean key_pressed                    (GtkWidget      *widget,
                                                 GdkEventKey    *event,
                                                 gpointer        data);
 static gint addressbook_treenode_compare_func  (GtkCList       *clist,
@@ -621,15 +621,15 @@ static void addressbook_create(void)
 
        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_window_set_title(GTK_WINDOW(window), _("Address book"));
-       gtk_widget_set_usize(window, ADDRESSBOOK_WIDTH, ADDRESSBOOK_HEIGHT);
+       gtk_widget_set_size_request(window, ADDRESSBOOK_WIDTH, ADDRESSBOOK_HEIGHT);
        gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, TRUE);
        gtk_window_set_wmclass(GTK_WINDOW(window), "addressbook", "Sylpheed");
        gtk_widget_realize(window);
 
-       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
-                          GTK_SIGNAL_FUNC(addressbook_close), NULL);
-       gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
-                          GTK_SIGNAL_FUNC(key_pressed), NULL);
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(addressbook_close), NULL);
+       g_signal_connect(G_OBJECT(window), "key_press_event",
+                        G_CALLBACK(key_pressed), NULL);
        MANAGE_WINDOW_SIGNALS_CONNECT(window);
 
        vbox = gtk_vbox_new(FALSE, 0);
@@ -650,7 +650,7 @@ static void addressbook_create(void)
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ctree_swin),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_ALWAYS);
-       gtk_widget_set_usize(ctree_swin, COL_FOLDER_WIDTH + 40, -1);
+       gtk_widget_set_size_request(ctree_swin, COL_FOLDER_WIDTH + 40, -1);
 
        /* Address index */
        ctree = gtk_ctree_new(1, 0);
@@ -664,14 +664,14 @@ static void addressbook_create(void)
        gtk_clist_set_compare_func(GTK_CLIST(ctree),
                                   addressbook_treenode_compare_func);
 
-       gtk_signal_connect(GTK_OBJECT(ctree), "tree_select_row",
-                          GTK_SIGNAL_FUNC(addressbook_tree_selected), NULL);
-       gtk_signal_connect(GTK_OBJECT(ctree), "button_press_event",
-                          GTK_SIGNAL_FUNC(addressbook_tree_button_pressed),
-                          NULL);
-       gtk_signal_connect(GTK_OBJECT(ctree), "button_release_event",
-                          GTK_SIGNAL_FUNC(addressbook_tree_button_released),
-                          NULL);
+       g_signal_connect(G_OBJECT(ctree), "tree_select_row",
+                        G_CALLBACK(addressbook_tree_selected), NULL);
+       g_signal_connect(G_OBJECT(ctree), "button_press_event",
+                        G_CALLBACK(addressbook_tree_button_pressed),
+                        NULL);
+       g_signal_connect(G_OBJECT(ctree), "button_release_event",
+                        G_CALLBACK(addressbook_tree_button_released),
+                        NULL);
 
        clist_vbox = gtk_vbox_new(FALSE, 4);
 
@@ -699,22 +699,22 @@ static void addressbook_create(void)
                GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(clist)->column[i].button,
                                       GTK_CAN_FOCUS);
 
-       gtk_signal_connect(GTK_OBJECT(clist), "tree_select_row",
-                          GTK_SIGNAL_FUNC(addressbook_list_row_selected), NULL);
-       gtk_signal_connect(GTK_OBJECT(clist), "tree_unselect_row",
-                          GTK_SIGNAL_FUNC(addressbook_list_row_unselected), NULL);
-       gtk_signal_connect(GTK_OBJECT(clist), "button_press_event",
-                          GTK_SIGNAL_FUNC(addressbook_list_button_pressed),
-                          NULL);
-       gtk_signal_connect(GTK_OBJECT(clist), "button_release_event",
-                          GTK_SIGNAL_FUNC(addressbook_list_button_released),
-                          NULL);
-       gtk_signal_connect(GTK_OBJECT(clist), "select_row",
-                          GTK_SIGNAL_FUNC(addressbook_list_selected), NULL);
-       gtk_signal_connect(GTK_OBJECT(clist), "tree_expand",
-                          GTK_SIGNAL_FUNC(addressbook_person_expand_node), NULL );
-       gtk_signal_connect(GTK_OBJECT(clist), "tree_collapse",
-                          GTK_SIGNAL_FUNC(addressbook_person_collapse_node), NULL );
+       g_signal_connect(G_OBJECT(clist), "tree_select_row",
+                        G_CALLBACK(addressbook_list_row_selected), NULL);
+       g_signal_connect(G_OBJECT(clist), "tree_unselect_row",
+                        G_CALLBACK(addressbook_list_row_unselected), NULL);
+       g_signal_connect(G_OBJECT(clist), "button_press_event",
+                        G_CALLBACK(addressbook_list_button_pressed),
+                        NULL);
+       g_signal_connect(G_OBJECT(clist), "button_release_event",
+                        G_CALLBACK(addressbook_list_button_released),
+                        NULL);
+       g_signal_connect(G_OBJECT(clist), "select_row",
+                        G_CALLBACK(addressbook_list_selected), NULL);
+       g_signal_connect(G_OBJECT(clist), "tree_expand",
+                        G_CALLBACK(addressbook_person_expand_node), NULL );
+       g_signal_connect(G_OBJECT(clist), "tree_collapse",
+                        G_CALLBACK(addressbook_person_collapse_node), NULL );
 
        hbox = gtk_hbox_new(FALSE, 4);
        gtk_box_pack_start(GTK_BOX(clist_vbox), hbox, FALSE, FALSE, 0);
@@ -726,12 +726,12 @@ static void addressbook_create(void)
        gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0);
 
        address_completion_register_entry(GTK_ENTRY(entry));
-       gtk_signal_connect(GTK_OBJECT(entry), "focus_in_event",
-                          GTK_SIGNAL_FUNC(addressbook_entry_gotfocus), NULL);
+       g_signal_connect(G_OBJECT(entry), "focus_in_event",
+                        G_CALLBACK(addressbook_entry_gotfocus), NULL);
 
 #if 0
-       gtk_signal_connect(GTK_OBJECT(entry), "changed",
-                          GTK_SIGNAL_FUNC(addressbook_entry_changed), NULL);
+       g_signal_connect(G_OBJECT(entry), "changed",
+                        G_CALLBACK(addressbook_entry_changed), NULL);
 #endif
 
        paned = gtk_hpaned_new();
@@ -748,7 +748,7 @@ static void addressbook_create(void)
        /* Button panel */
        hbbox = gtk_hbutton_box_new();
        gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_END);
-       gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbbox), 2);
+       gtk_box_set_spacing(GTK_BOX(hbbox), 2);
        gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
 
        del_btn = gtk_button_new_with_label(_("Delete"));
@@ -761,12 +761,12 @@ static void addressbook_create(void)
        GTK_WIDGET_SET_FLAGS(lup_btn, GTK_CAN_DEFAULT);
        gtk_box_pack_start(GTK_BOX(hbbox), lup_btn, TRUE, TRUE, 0);
 
-       gtk_signal_connect(GTK_OBJECT(del_btn), "clicked",
-                          GTK_SIGNAL_FUNC(addressbook_del_clicked), NULL);
-       gtk_signal_connect(GTK_OBJECT(reg_btn), "clicked",
-                          GTK_SIGNAL_FUNC(addressbook_reg_clicked), NULL);
-       gtk_signal_connect(GTK_OBJECT(lup_btn), "clicked",
-                          GTK_SIGNAL_FUNC(addressbook_lup_clicked), NULL);
+       g_signal_connect(G_OBJECT(del_btn), "clicked",
+                        G_CALLBACK(addressbook_del_clicked), NULL);
+       g_signal_connect(G_OBJECT(reg_btn), "clicked",
+                        G_CALLBACK(addressbook_reg_clicked), NULL);
+       g_signal_connect(G_OBJECT(lup_btn), "clicked",
+                        G_CALLBACK(addressbook_lup_clicked), NULL);
 
        to_btn = gtk_button_new_with_label
                (prefs_common.trans_hdr ? _("To:") : "To:");
@@ -781,15 +781,15 @@ static void addressbook_create(void)
        GTK_WIDGET_SET_FLAGS(bcc_btn, GTK_CAN_DEFAULT);
        gtk_box_pack_start(GTK_BOX(hbbox), bcc_btn, TRUE, TRUE, 0);
 
-       gtk_signal_connect(GTK_OBJECT(to_btn), "clicked",
-                          GTK_SIGNAL_FUNC(addressbook_to_clicked),
-                          GINT_TO_POINTER(COMPOSE_TO));
-       gtk_signal_connect(GTK_OBJECT(cc_btn), "clicked",
-                          GTK_SIGNAL_FUNC(addressbook_to_clicked),
-                          GINT_TO_POINTER(COMPOSE_CC));
-       gtk_signal_connect(GTK_OBJECT(bcc_btn), "clicked",
-                          GTK_SIGNAL_FUNC(addressbook_to_clicked),
-                          GINT_TO_POINTER(COMPOSE_BCC));
+       g_signal_connect(G_OBJECT(to_btn), "clicked",
+                        G_CALLBACK(addressbook_to_clicked),
+                        GINT_TO_POINTER(COMPOSE_TO));
+       g_signal_connect(G_OBJECT(cc_btn), "clicked",
+                        G_CALLBACK(addressbook_to_clicked),
+                        GINT_TO_POINTER(COMPOSE_CC));
+       g_signal_connect(G_OBJECT(bcc_btn), "clicked",
+                        G_CALLBACK(addressbook_to_clicked),
+                        GINT_TO_POINTER(COMPOSE_BCC));
 
        /* Build icons for interface */
        stock_pixmap_gdk( window, STOCK_PIXMAP_INTERFACE,
@@ -830,8 +830,8 @@ static void addressbook_create(void)
                                       n_entries,
                                       "<AddressBookTree>", &tree_factory,
                                       NULL);
-       gtk_signal_connect(GTK_OBJECT(tree_popup), "selection_done",
-                          GTK_SIGNAL_FUNC(addressbook_popup_close), NULL);
+       g_signal_connect(G_OBJECT(tree_popup), "selection_done",
+                        G_CALLBACK(addressbook_popup_close), NULL);
        n_entries = sizeof(addressbook_list_popup_entries) /
                sizeof(addressbook_list_popup_entries[0]);
        list_popup = menu_create_items(addressbook_list_popup_entries,
@@ -1142,7 +1142,8 @@ static void addressbook_to_clicked(GtkButton *button, gpointer data)
        Compose *compose;
        AddrSelectItem *item;
        AddrItemObject *aio;
-       gchar *addr;
+       const gchar *addr;
+       gchar *tmpaddr;
 
        compose = addrbook.target_compose;
        if( ! compose ) return;
@@ -1163,10 +1164,10 @@ static void addressbook_to_clicked(GtkButton *button, gpointer data)
                aio = item->addressItem;
                if( aio->type == ADDR_ITEM_PERSON ||
                    aio->type == ADDR_ITEM_EMAIL ) {
-                       addr = addressbook_format_address( aio );
+                       tmpaddr = addressbook_format_address( aio );
                        compose_entry_append(
-                               compose, addr, (ComposeEntryType) data );
-                       g_free( addr );
+                               compose, tmpaddr, (ComposeEntryType) data );
+                       g_free( tmpaddr );
                }
                else if( aio->type == ADDR_ITEM_GROUP ) {
                        ItemGroup *group = ( ItemGroup * ) aio;
@@ -1174,11 +1175,11 @@ static void addressbook_to_clicked(GtkButton *button, gpointer data)
                        while( nodeMail ) {
                                ItemEMail *email = nodeMail->data;
 
-                               addr = addressbook_format_address(
+                               tmpaddr = addressbook_format_address(
                                                ( AddrItemObject * ) email );
                                compose_entry_append(
-                                       compose, addr, (ComposeEntryType) data );
-                               g_free( addr );
+                                       compose, tmpaddr, (ComposeEntryType) data );
+                               g_free( tmpaddr );
                                nodeMail = g_list_next( nodeMail );
                        }
                }
@@ -1798,11 +1799,11 @@ static void addressbook_entry_gotfocus( GtkWidget *widget ) {
        gtk_editable_select_region( GTK_EDITABLE(addrbook.entry), 0, -1 );
 }
 
-static void addressbook_list_button_pressed(GtkWidget *widget,
-                                           GdkEventButton *event,
-                                           gpointer data)
+static gboolean addressbook_list_button_pressed(GtkWidget *widget,
+                                               GdkEventButton *event,
+                                               gpointer data)
 {
-       if( ! event ) return;
+       if( ! event ) return FALSE;
 
        addressbook_list_menu_setup();
 
@@ -1810,17 +1811,18 @@ static void addressbook_list_button_pressed(GtkWidget *widget,
                gtk_menu_popup( GTK_MENU(addrbook.list_popup), NULL, NULL, NULL, NULL,
                       event->button, event->time );
        }
+       return FALSE;
 }
 
-static void addressbook_list_button_released(GtkWidget *widget,
-                                            GdkEventButton *event,
-                                            gpointer data)
+static gboolean addressbook_list_button_released(GtkWidget *widget,
+                                                GdkEventButton *event,
+                                                gpointer data)
 {
 }
 
-static void addressbook_tree_button_pressed(GtkWidget *ctree,
-                                           GdkEventButton *event,
-                                           gpointer data)
+static gboolean addressbook_tree_button_pressed(GtkWidget *ctree,
+                                               GdkEventButton *event,
+                                               gpointer data)
 {
        GtkCList *clist = GTK_CLIST(ctree);
        gint row, column;
@@ -1837,7 +1839,7 @@ static void addressbook_tree_button_pressed(GtkWidget *ctree,
        gboolean canTreePaste = FALSE;
        gboolean canLookup = FALSE;
 
-       if( ! event ) return;
+       if( ! event ) return FALSE;
        addressbook_menubar_set_sensitive( FALSE );
 
        if( gtk_clist_get_selection_info( clist, event->x, event->y, &row, &column ) ) {
@@ -1849,7 +1851,7 @@ static void addressbook_tree_button_pressed(GtkWidget *ctree,
        menu_set_insensitive_all(GTK_MENU_SHELL(addrbook.tree_popup));
        gtk_widget_set_sensitive( addrbook.lup_btn, FALSE );
 
-       if( obj == NULL ) return;
+       if( obj == NULL ) return FALSE;
 
        if( ! addrclip_is_empty( _clipBoard_ ) ) {
                canTreePaste = TRUE;
@@ -1930,14 +1932,16 @@ static void addressbook_tree_button_pressed(GtkWidget *ctree,
                               event->button, event->time);
        }
 
+       return FALSE;
 }
 
-static void addressbook_tree_button_released(GtkWidget *ctree,
-                                            GdkEventButton *event,
-                                            gpointer data)
+static gboolean addressbook_tree_button_released(GtkWidget *ctree,
+                                                GdkEventButton *event,
+                                                gpointer data)
 {
        gtk_ctree_select(GTK_CTREE(addrbook.ctree), addrbook.opened);
        gtkut_ctree_set_focus_row(GTK_CTREE(addrbook.ctree), addrbook.opened);
+       return FALSE;
 }
 
 static void addressbook_popup_close(GtkMenuShell *menu_shell, gpointer data)
@@ -3231,10 +3235,11 @@ void addressbook_export_to_file( void ) {
        }
 }
 
-static void key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
+static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
 {
        if (event && event->keyval == GDK_Escape)
                addressbook_close();
+       return FALSE;
 }
 
 /*
index f8cabb1..fa2396b 100644 (file)
@@ -470,7 +470,7 @@ static void addrgather_dlg_create( void ) {
        GtkWidget *hbbox;
        GtkWidget *hsbox;
 
-       window = gtk_window_new( GTK_WINDOW_DIALOG );
+       window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
        gtk_widget_set_usize( window, 380, -1 );
        gtk_container_set_border_width(GTK_CONTAINER(window), 0);
        gtk_window_set_position( GTK_WINDOW(window), GTK_WIN_POS_CENTER );
index 811b401..1387c5f 100644 (file)
 #include "inc.h"
 #include "log.h"
 #include "logwindow.h"
+#include "prefs_common.h"
 
-#define TITLE_FONT     "-*-helvetica-medium-r-normal--17-*-*-*-*-*-*-*," \
-                       "-*-*-medium-r-normal--16-*-*-*-*-*-*-*,*"
-#define MESSAGE_FONT   "-*-helvetica-medium-r-normal--14-*-*-*-*-*-*-*," \
-                       "-*-*-medium-r-normal--14-*-*-*-*-*-*-*,*"
 #define ALERT_PANEL_WIDTH      380
 #define TITLE_HEIGHT           72
 #define MESSAGE_HEIGHT         62
 
+#define DEFAULT_TITLE_FONT     "Helvetica 16"
+
 static gboolean alertpanel_is_open = FALSE;
 static AlertValue value;
 
@@ -63,7 +62,7 @@ static void alertpanel_button_clicked (GtkWidget              *widget,
 static gint alertpanel_deleted         (GtkWidget              *widget,
                                         GdkEventAny            *event,
                                         gpointer                data);
-static void alertpanel_close           (GtkWidget              *widget,
+static gboolean alertpanel_close       (GtkWidget              *widget,
                                         GdkEventAny            *event,
                                         gpointer                data);
 
@@ -221,8 +220,7 @@ static void alertpanel_create(const gchar *title,
                              gboolean     can_disable,
                              GtkWidget *custom_widget)
 {
-       static GdkFont *titlefont;
-       GtkStyle *style;
+       static PangoFontDescription *font_desc;
        GtkWidget *label;
        GtkWidget *hbox;
        GtkWidget *vbox;
@@ -243,13 +241,13 @@ static void alertpanel_create(const gchar *title,
        gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, FALSE);
        gtk_container_set_border_width
                (GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), 5);
-       gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
-       gtk_signal_connect(GTK_OBJECT(dialog), "delete_event",
-                          GTK_SIGNAL_FUNC(alertpanel_deleted),
-                          (gpointer)G_ALERTOTHER);
-       gtk_signal_connect(GTK_OBJECT(dialog), "key_press_event",
-                          GTK_SIGNAL_FUNC(alertpanel_close),
-                          (gpointer)G_ALERTOTHER);
+       gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
+       g_signal_connect(G_OBJECT(dialog), "delete_event",
+                        G_CALLBACK(alertpanel_deleted),
+                        (gpointer)G_ALERTOTHER);
+       g_signal_connect(G_OBJECT(dialog), "key_press_event",
+                        G_CALLBACK(alertpanel_close),
+                        (gpointer)G_ALERTOTHER);
        gtk_widget_realize(dialog);
 
        /* for title label */
@@ -263,12 +261,15 @@ static void alertpanel_create(const gchar *title,
        label = gtk_label_new(title);
        gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 16);
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
-       style = gtk_style_copy(gtk_widget_get_style(label));
-       if (!titlefont)
-               titlefont = gtkut_font_load(TITLE_FONT);
-       if (titlefont)
-               style->font = titlefont;
-       gtk_widget_set_style(label, style);
+       if (!font_desc) {
+               gchar *fontstr = prefs_common.titlefont
+                                       ? prefs_common.titlefont
+                                       : DEFAULT_TITLE_FONT;
+               font_desc = pango_font_description_from_string (fontstr);
+       }
+       if (font_desc) {
+               gtk_widget_modify_font (label, font_desc);
+       }
 
        /* for message and button(s) */
        vbox = gtk_vbox_new(FALSE, 0);
@@ -277,7 +278,7 @@ static void alertpanel_create(const gchar *title,
 
        spc_vbox = gtk_vbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox), spc_vbox, FALSE, FALSE, 0);
-       gtk_widget_set_usize(spc_vbox, -1, 16);
+       gtk_widget_set_size_request(spc_vbox, -1, 16);
 
        msg_vbox = gtk_vbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox), msg_vbox, FALSE, FALSE, 0);
@@ -310,13 +311,13 @@ static void alertpanel_create(const gchar *title,
                                             TRUE);
                gtk_box_pack_start(GTK_BOX(hbox), disable_chkbtn,
                                   FALSE, FALSE, 0);
-               gtk_signal_connect(GTK_OBJECT(disable_chkbtn), "toggled",
-                                  GTK_SIGNAL_FUNC(alertpanel_button_toggled),
-                                  GUINT_TO_POINTER(G_ALERTDISABLE));
+               g_signal_connect(G_OBJECT(disable_chkbtn), "toggled",
+                                G_CALLBACK(alertpanel_button_toggled),
+                                GUINT_TO_POINTER(G_ALERTDISABLE));
        } else {
                spc_vbox = gtk_vbox_new(FALSE, 0);
                gtk_box_pack_start(GTK_BOX(vbox), spc_vbox, FALSE, FALSE, 0);
-               gtk_widget_set_usize(spc_vbox, -1, 20);
+               gtk_widget_set_size_request(spc_vbox, -1, 20);
        }
 
        /* for button(s) */
@@ -344,17 +345,17 @@ static void alertpanel_create(const gchar *title,
                gtk_widget_grab_focus(button3);
        }
 
-       gtk_signal_connect(GTK_OBJECT(button1), "clicked",
-                          GTK_SIGNAL_FUNC(alertpanel_button_clicked),
-                          GUINT_TO_POINTER(G_ALERTDEFAULT));
+       g_signal_connect(G_OBJECT(button1), "clicked",
+                        G_CALLBACK(alertpanel_button_clicked),
+                        GUINT_TO_POINTER(G_ALERTDEFAULT));
        if (button2_label)
-               gtk_signal_connect(GTK_OBJECT(button2), "clicked",
-                                  GTK_SIGNAL_FUNC(alertpanel_button_clicked),
-                                  GUINT_TO_POINTER(G_ALERTALTERNATE));
+               g_signal_connect(G_OBJECT(button2), "clicked",
+                                G_CALLBACK(alertpanel_button_clicked),
+                                GUINT_TO_POINTER(G_ALERTALTERNATE));
        if (button3_label)
-               gtk_signal_connect(GTK_OBJECT(button3), "clicked",
-                                  GTK_SIGNAL_FUNC(alertpanel_button_clicked),
-                                  GUINT_TO_POINTER(G_ALERTOTHER));
+               g_signal_connect(G_OBJECT(button3), "clicked",
+                                G_CALLBACK(alertpanel_button_clicked),
+                                GUINT_TO_POINTER(G_ALERTOTHER));
 
        gtk_widget_show_all(dialog);
 }
@@ -380,12 +381,13 @@ static gint alertpanel_deleted(GtkWidget *widget, GdkEventAny *event,
        return TRUE;
 }
 
-static void alertpanel_close(GtkWidget *widget, GdkEventAny *event,
+static gboolean alertpanel_close(GtkWidget *widget, GdkEventAny *event,
                             gpointer data)
 {
        if (event->type == GDK_KEY_PRESS)
                if (((GdkEventKey *)event)->keyval != GDK_Escape)
-                       return;
+                       return FALSE;
 
        value = (value & ~G_ALERT_VALUE_MASK) | (AlertValue)data;
+       return FALSE;
 }
index 0357f2a..53e6e82 100644 (file)
@@ -298,6 +298,32 @@ void conv_anytoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
        }
 }
 
+void conv_anytoutf8(gchar *outbuf, gint outlen, const gchar *inbuf)
+{
+       gchar *tmpstr = NULL;
+
+       switch (conv_guess_ja_encoding(inbuf)) {
+       case C_ISO_2022_JP:
+               tmpstr = conv_codeset_strdup(inbuf, CS_ISO_2022_JP, CS_UTF_8);
+               strncpy2(outbuf, tmpstr, outlen);
+               g_free(tmpstr);
+               break;
+       case C_SHIFT_JIS:
+               tmpstr = conv_codeset_strdup(inbuf, CS_SHIFT_JIS, CS_UTF_8);
+               strncpy2(outbuf, tmpstr, outlen);
+               g_free(tmpstr);
+               break;
+       case C_EUC_JP:
+               tmpstr = conv_codeset_strdup(inbuf, CS_EUC_JP, CS_UTF_8);
+               strncpy2(outbuf, tmpstr, outlen);
+               g_free(tmpstr);
+               break;
+       default:
+               strncpy2(outbuf, inbuf, outlen);
+               break;
+       }
+}
+
 void conv_anytojis(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
        switch (conv_guess_ja_encoding(inbuf)) {
@@ -616,11 +642,19 @@ void conv_euctodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
        conv_unreadable_eucjp(outbuf);
 }
 
+#warning FIXME_GTK2
+#if 0
 void conv_anytodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
        conv_anytoeuc(outbuf, outlen, inbuf);
        conv_unreadable_eucjp(outbuf);
 }
+#else
+void conv_anytodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
+{
+       conv_anytoutf8(outbuf, outlen, inbuf);
+}
+#endif
 
 void conv_ustodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
@@ -650,7 +684,8 @@ CodeConverter *conv_code_converter_new(const gchar *charset)
        CodeConverter *conv;
 
        conv = g_new0(CodeConverter, 1);
-       conv->code_conv_func = conv_get_code_conv_func(charset, NULL);
+#warning FIXME_GTK2
+       conv->code_conv_func = conv_get_code_conv_func(charset, CS_UTF_8);
        conv->charset_str = g_strdup(charset);
        conv->charset = conv_get_charset_from_str(charset);
 
@@ -672,7 +707,8 @@ gint conv_convert(CodeConverter *conv, gchar *outbuf, gint outlen,
        else {
                gchar *str;
 
-               str = conv_iconv_strdup(inbuf, conv->charset_str, NULL);
+#warning FIXME_GTK2
+               str = conv_iconv_strdup(inbuf, conv->charset_str, CS_UTF_8);
                if (!str)
                        return -1;
                else {
@@ -1339,7 +1375,7 @@ gboolean conv_is_multibyte_encoding(CharSet encoding)
 
 const gchar *conv_get_current_locale(void)
 {
-       gchar *cur_locale;
+       const gchar *cur_locale;
 
        cur_locale = g_getenv("LC_ALL");
        if (!cur_locale) cur_locale = g_getenv("LC_CTYPE");
@@ -1357,10 +1393,15 @@ void conv_unmime_header_overwrite(gchar *str)
        gchar *buf;
        gint buflen;
        CharSet cur_charset;
+       const gchar *locale;
 
        cur_charset = conv_get_current_charset();
 
-       if (cur_charset == C_EUC_JP) {
+#warning FIXME_GTK2
+/* Should we always ensure to convert? */
+       locale = conv_get_current_locale();
+
+       if (locale && !strncasecmp(locale, "ja", 2)) {
                buflen = strlen(str) * 2 + 1;
                Xalloca(buf, buflen, return);
                conv_anytodisp(buf, buflen, str);
@@ -1377,10 +1418,15 @@ void conv_unmime_header(gchar *outbuf, gint outlen, const gchar *str,
                        const gchar *charset)
 {
        CharSet cur_charset;
+       const gchar *locale;
 
        cur_charset = conv_get_current_charset();
 
-       if (cur_charset == C_EUC_JP) {
+#warning FIXME_GTK2
+/* Should we always ensure to convert? */
+       locale = conv_get_current_locale();
+
+       if (locale && !strncasecmp(locale, "ja", 2)) {
                gchar *buf;
                gint buflen;
 
index 19c2424..9bd19d2 100644 (file)
@@ -165,6 +165,7 @@ void conv_jistoeuc  (gchar *outbuf, gint outlen, const gchar *inbuf);
 void conv_euctojis     (gchar *outbuf, gint outlen, const gchar *inbuf);
 void conv_sjistoeuc    (gchar *outbuf, gint outlen, const gchar *inbuf);
 void conv_anytoeuc     (gchar *outbuf, gint outlen, const gchar *inbuf);
+void conv_anytoutf8    (gchar *outbuf, gint outlen, const gchar *inbuf);
 void conv_anytojis     (gchar *outbuf, gint outlen, const gchar *inbuf);
 
 void conv_unreadable_eucjp     (gchar *str);
index 5e24b3b..2b55f6f 100644 (file)
@@ -74,7 +74,8 @@
 #define FOLDER_LIST            "folderlist.xml"
 #define CACHE_FILE             ".sylpheed_cache"
 #define MARK_FILE              ".sylpheed_mark"
-#define CACHE_VERSION          20
+/* #warning FIXME_GTK2 */
+#define CACHE_VERSION          2020
 #define MARK_VERSION           2
 
 #define DEFAULT_SIGNATURE      ".signature"
index 3cb08bf..5ce3ad8 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef __INTL_H__
 #define __INTL_H__
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif /* HAVE_CONFIG_H */
+
 #ifdef ENABLE_NLS
 #  include <libintl.h>
 #  define _(String) gettext(String)
@@ -9,6 +13,9 @@
 #  else
 #    define N_(String) (String)
 #  endif /* gettext_noop */
+#  ifndef HAVE_BIND_TEXTDOMAIN_CODESET
+#    define bind_textdomain_codeset(Domain, Codeset) (Codeset)
+#  endif /* HAVE_BIND_TEXTDOMAIN_CODESET */
 #else
 #  define _(String) (String)
 #  define N_(String) (String)
@@ -17,6 +24,7 @@
 #  define dgettext(Domain,String) (String)
 #  define dcgettext(Domain,String,Type) (String)
 #  define bindtextdomain(Domain,Directory) (Domain) 
+#  define bind_textdomain_codeset(Domain, Codeset) (Codeset)
 #endif /* ENABLE_NLS */
 
 #endif /* __INTL_H__ */
index 8b5f073..3fa5b5d 100644 (file)
@@ -61,6 +61,7 @@ typedef gint (*SockAddrFunc)  (GList          *addr_list,
 typedef struct _SockConnectData        SockConnectData;
 typedef struct _SockLookupData SockLookupData;
 typedef struct _SockAddrData   SockAddrData;
+typedef struct _SockSource     SockSource;
 
 struct _SockConnectData {
        gint id;
@@ -92,19 +93,20 @@ struct _SockAddrData {
        struct sockaddr *addr;
 };
 
+struct _SockSource {
+       GSource parent;
+       SockInfo *sock;
+};
+
 static guint io_timeout = 60;
 
 static GList *sock_connect_data_list = NULL;
 
-static gboolean sock_prepare           (gpointer        source_data,
-                                        GTimeVal       *current_time,
-                                        gint           *timeout,
-                                        gpointer        data);
-static gboolean sock_check             (gpointer        source_data,
-                                        GTimeVal       *current_time,
-                                        gpointer        user_data);
-static gboolean sock_dispatch          (gpointer        source_data,
-                                        GTimeVal       *current_time,
+static gboolean sock_prepare           (GSource        *source,
+                                        gint           *timeout);
+static gboolean sock_check             (GSource        *source);
+static gboolean sock_dispatch          (GSource        *source,
+                                        GSourceFunc     callback,
                                         gpointer        user_data);
 
 GSourceFuncs sock_watch_funcs = {
@@ -269,17 +271,15 @@ gboolean sock_is_nonblocking_mode(SockInfo *sock)
 }
 
 
-static gboolean sock_prepare(gpointer source_data, GTimeVal *current_time,
-                            gint *timeout, gpointer data)
+static gboolean sock_prepare(GSource *source, gint *timeout)
 {
        *timeout = 1;
        return FALSE;
 }
 
-static gboolean sock_check(gpointer source_data, GTimeVal *current_time,
-                          gpointer user_data)
+static gboolean sock_check(GSource *source)
 {
-       SockInfo *sock = (SockInfo *)source_data;
+       SockInfo *sock = ((SockSource *)source)->sock;
        struct timeval timeout = {0, 0};
        fd_set fds;
        GIOCondition condition = sock->condition;
@@ -311,10 +311,10 @@ static gboolean sock_check(gpointer source_data, GTimeVal *current_time,
        return FD_ISSET(sock->sock, &fds) != 0;
 }
 
-static gboolean sock_dispatch(gpointer source_data, GTimeVal *current_time,
+static gboolean sock_dispatch(GSource *source, GSourceFunc callback,
                              gpointer user_data)
 {
-       SockInfo *sock = (SockInfo *)source_data;
+       SockInfo *sock = ((SockSource *)source)->sock;
 
        return sock->callback(sock, sock->condition, user_data);
 }
@@ -336,8 +336,14 @@ guint sock_add_watch(SockInfo *sock, GIOCondition condition, SockFunc func,
 
 #if USE_OPENSSL
        if (sock->ssl)
-               return g_source_add(G_PRIORITY_DEFAULT, FALSE,
-                                   &sock_watch_funcs, sock, data, NULL);
+       {
+               GSource *source = g_source_new(&sock_watch_funcs,
+                                              sizeof(SockSource));
+               ((SockSource *) source)->sock = sock;
+               g_source_set_priority(source, G_PRIORITY_DEFAULT);
+               g_source_set_can_recurse(source, FALSE);
+               g_source_attach(source, NULL);
+       }
 #endif
 
        return g_io_add_watch(sock->sock_ch, condition, sock_watch_cb, sock);
index e00231e..99b82aa 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include "defs.h"
+#include <stdlib.h>
 #include <glib.h>
 
 #if HAVE_LOCALE_H
@@ -93,7 +94,9 @@ gboolean sylpheed_init(int *argc, char ***argv)
 
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
+       bind_textdomain_codeset (PACKAGE, "UTF-8");
        textdomain(PACKAGE);
+       putenv("G_BROKEN_FILENAMES=1");
 
        /* backup if old rc file exists */
        if (is_file_exist(RC_DIR)) {
index 15f12fe..fdafcf8 100644 (file)
@@ -29,6 +29,7 @@
 #include "intl.h"
 #include "utils.h"
 #include "template.h"
+#include "../codeconv.h"
 
 static GSList *template_list;
 
@@ -38,6 +39,9 @@ static Template *template_load(gchar *filename)
        FILE *fp;
        gchar buf[BUFFSIZE];
        gint bytes_read;
+#warning FIXME_GTK2
+       const gchar *src_codeset = conv_get_current_charset_str();
+       const gchar *dest_codeset = CS_UTF_8;
 
        if ((fp = fopen(filename, "rb")) == NULL) {
                FILE_OP_ERROR(filename, "fopen");
@@ -53,18 +57,36 @@ static Template *template_load(gchar *filename)
        tmpl->value = NULL;
 
        while (fgets(buf, sizeof(buf), fp) != NULL) {
+               gchar *tmp = NULL;
+
                if (buf[0] == '\n')
                        break;
-               else if (!g_strncasecmp(buf, "Name:", 5))
-                       tmpl->name = g_strdup(g_strstrip(buf + 5));
-               else if (!g_strncasecmp(buf, "Subject:", 8))
-                       tmpl->subject = g_strdup(g_strstrip(buf + 8));
-               else if (!g_strncasecmp(buf, "To:", 3))
-                       tmpl->to = g_strdup(g_strstrip(buf + 3));
-               else if (!g_strncasecmp(buf, "Cc:", 3))
-                       tmpl->cc = g_strdup(g_strstrip(buf + 3));
-               else if (!g_strncasecmp(buf, "Bcc:", 4))
-                       tmpl->bcc = g_strdup(g_strstrip(buf + 4));                                              
+               else if (!g_strncasecmp(buf, "Name:", 5)) {
+                       tmp = conv_codeset_strdup(buf + 5,
+                                                 src_codeset,
+                                                 dest_codeset);
+                       tmpl->name = tmp ? g_strstrip(tmp) : g_strdup(buf + 5);
+               } else if (!g_strncasecmp(buf, "Subject:", 8)) {
+                       tmp = conv_codeset_strdup(buf + 8,
+                                                 src_codeset,
+                                                 dest_codeset);
+                       tmpl->subject = tmp ? g_strstrip(tmp) : g_strdup(buf + 8);
+               } else if (!g_strncasecmp(buf, "To:", 3)) {
+                       tmp = conv_codeset_strdup(buf + 3,
+                                                 src_codeset,
+                                                 dest_codeset);
+                       tmpl->to = tmp ? g_strstrip(tmp) : g_strdup(buf + 3);
+               } else if (!g_strncasecmp(buf, "Cc:", 3)) {
+                       tmp = conv_codeset_strdup(buf + 3,
+                                                 src_codeset,
+                                                 dest_codeset);
+                       tmpl->cc = tmp ? g_strstrip(tmp) : g_strdup(buf + 3);
+               } else if (!g_strncasecmp(buf, "Bcc:", 4)) {
+                       tmp = conv_codeset_strdup(buf + 4,
+                                                 src_codeset,
+                                                 dest_codeset);
+                       tmpl->bcc = tmp ? g_strstrip(tmp) : g_strdup(buf + 4);
+               }
        }
 
        if (!tmpl->name) {
@@ -81,7 +103,10 @@ static Template *template_load(gchar *filename)
                }
        }
        fclose(fp);
-       tmpl->value = g_strndup(buf, bytes_read);
+       buf[bytes_read] = '\0';
+       tmpl->value = conv_codeset_strdup(buf, src_codeset, dest_codeset);
+       if (!tmpl->value)
+               tmpl->value = g_strdup(buf);
 
        return tmpl;
 }
@@ -111,7 +136,7 @@ void template_clear_config(GSList *tmpl_list)
 
 GSList *template_read_config(void)
 {
-       gchar *path;
+       const gchar *path;
        gchar *filename;
        DIR *dp;
        struct dirent *de;
@@ -157,7 +182,7 @@ GSList *template_read_config(void)
 
 void template_write_config(GSList *tmpl_list)
 {
-       gchar *path;
+       const gchar *path;
        GSList *cur;
        Template *tmpl;
        FILE *fp;
@@ -180,6 +205,10 @@ void template_write_config(GSList *tmpl_list)
 
        for (cur = tmpl_list, tmpl_num = 1; cur != NULL;
             cur = cur->next, tmpl_num++) {
+#warning FIXME_GTK2
+               const gchar *src_codeset = CS_UTF_8;
+               const gchar *dest_codeset = conv_get_current_charset_str();
+               gchar *tmp = NULL;
                gchar *filename;
 
                tmpl = cur->data;
@@ -190,21 +219,58 @@ void template_write_config(GSList *tmpl_list)
                if ((fp = fopen(filename, "wb")) == NULL) {
                        FILE_OP_ERROR(filename, "fopen");
                        g_free(filename);
-                       g_free(path);
                        return;
                }
 
-               fprintf(fp, "Name: %s\n", tmpl->name);
-               if (tmpl->subject && *tmpl->subject != '\0')
-                       fprintf(fp, "Subject: %s\n", tmpl->subject);
-               if (tmpl->to && *tmpl->to != '\0')
-                       fprintf(fp, "To: %s\n", tmpl->to);
-               if (tmpl->cc && *tmpl->cc != '\0')
-                       fprintf(fp, "Cc: %s\n", tmpl->cc);
-               if (tmpl->bcc && *tmpl->bcc != '\0')
-                       fprintf(fp, "Bcc: %s\n", tmpl->bcc);                                            
+               tmp = conv_codeset_strdup(tmpl->name, src_codeset, dest_codeset);
+               if (!tmp)
+                       tmp = g_strdup(tmpl->name);
+               fprintf(fp, "Name: %s\n", tmp ? tmp : "");
+               g_free(tmp);
+
+               if (tmpl->subject && *tmpl->subject != '\0') {
+                       tmp = conv_codeset_strdup(tmpl->subject,
+                                                 src_codeset, dest_codeset);
+                       if (!tmp)
+                               tmp = g_strdup(tmpl->subject);
+                       fprintf(fp, "Subject: %s\n", tmp);
+                       g_free(tmp);
+               }
+
+               if (tmpl->to && *tmpl->to != '\0') {
+                       tmp = conv_codeset_strdup(tmpl->to,
+                                                 src_codeset, dest_codeset);
+                       if (!tmp)
+                               tmp = g_strdup(tmpl->to);
+                       fprintf(fp, "To: %s\n", tmp);
+                       g_free(tmp);
+               }
+
+               if (tmpl->cc && *tmpl->cc != '\0') {
+                       tmp = conv_codeset_strdup(tmpl->cc,
+                                                 src_codeset, dest_codeset);
+                       if (!tmp)
+                               tmp = g_strdup(tmpl->cc);
+                       fprintf(fp, "Cc: %s\n", tmp);
+                       g_free(tmp);
+               }
+
+               if (tmpl->bcc && *tmpl->bcc != '\0') {
+                       tmp = conv_codeset_strdup(tmpl->bcc,
+                                                 src_codeset, dest_codeset);
+                       if (!tmp)
+                               tmp = g_strdup(tmpl->bcc);
+                       fprintf(fp, "Bcc: %s\n", tmp);
+                       g_free(tmp);
+               }
+
                fputs("\n", fp);
-               fwrite(tmpl->value, sizeof(gchar) * strlen(tmpl->value), 1, fp);
+               tmp = conv_codeset_strdup(tmpl->value,
+                                         src_codeset, dest_codeset);
+               if (!tmp)
+                       tmp = g_strdup(tmpl->value);
+               fwrite(tmp, sizeof(gchar) * strlen(tmp), 1, fp);
+               g_free(tmp);
                fclose(fp);
        }
 }
index d5e861f..adb1ed8 100644 (file)
@@ -46,6 +46,7 @@
 #include "intl.h"
 #include "utils.h"
 #include "socket.h"
+#include "../codeconv.h"
 
 #define BUFFSIZE       8192
 
@@ -1393,7 +1394,7 @@ GList *uri_list_extract_filenames(const gchar *uri_list)
 {
        GList *result = NULL;
        const gchar *p, *q;
-       gchar *file;
+       gchar *escaped_utf8uri;
 
        p = uri_list;
 
@@ -1401,17 +1402,36 @@ GList *uri_list_extract_filenames(const gchar *uri_list)
                if (*p != '#') {
                        while (isspace(*p)) p++;
                        if (!strncmp(p, "file:", 5)) {
-                               p += 5;
                                q = p;
+                               q += 5;
                                while (*q && *q != '\n' && *q != '\r') q++;
 
                                if (q > p) {
+                                       gchar *file, *locale_file = NULL;
                                        q--;
                                        while (q > p && isspace(*q)) q--;
-                                       file = g_malloc(q - p + 2);
-                                       strncpy(file, p, q - p + 1);
-                                       file[q - p + 1] = '\0';
-                                       result = g_list_append(result,file);
+                                       Xalloca(escaped_utf8uri, q - p + 2,
+                                               return result);
+                                       Xalloca(file, q - p + 2,
+                                               return result);
+                                       *file = '\0';
+                                       strncpy(escaped_utf8uri, p, q - p + 1);
+                                       escaped_utf8uri[q - p + 1] = '\0';
+                                       decode_uri(file, escaped_utf8uri);
+#warning FIXME_GTK2 /* should we use g_filename_from_utf8()? */
+                    /*
+                    * g_filename_from_uri() rejects escaped/locale encoded uri
+                    * string which come from Nautilus.
+                    */
+                                       if (g_utf8_validate(file, -1, NULL))
+                                               locale_file
+                                                       = conv_codeset_strdup(
+                                                               file + 5,
+                                                               CS_UTF_8,
+                                                               conv_get_current_charset_str());
+                                       if (!locale_file)
+                                               locale_file = g_strdup(file + 5);
+                                       result = g_list_append(result, locale_file);
                                }
                        }
                }
@@ -1500,7 +1520,7 @@ gint scan_mailto_url(const gchar *mailto, gchar **to, gchar **cc, gchar **bcc,
  * but as long as we are not able to do our own extensions to glibc, we do
  * it here.
  */
-gchar *get_home_dir(void)
+const gchar *get_home_dir(void)
 {
 #if HAVE_DOSISH_SYSTEM
     static gchar *home_dir;
@@ -1525,7 +1545,7 @@ gchar *get_home_dir(void)
 #endif
 }
 
-gchar *get_rc_dir(void)
+const gchar *get_rc_dir(void)
 {
        static gchar *rc_dir = NULL;
 
@@ -1536,7 +1556,7 @@ gchar *get_rc_dir(void)
        return rc_dir;
 }
 
-gchar *get_news_cache_dir(void)
+const gchar *get_news_cache_dir(void)
 {
        static gchar *news_cache_dir = NULL;
 
@@ -1547,7 +1567,7 @@ gchar *get_news_cache_dir(void)
        return news_cache_dir;
 }
 
-gchar *get_imap_cache_dir(void)
+const gchar *get_imap_cache_dir(void)
 {
        static gchar *imap_cache_dir = NULL;
 
@@ -1558,7 +1578,7 @@ gchar *get_imap_cache_dir(void)
        return imap_cache_dir;
 }
 
-gchar *get_mbox_cache_dir(void)
+const gchar *get_mbox_cache_dir(void)
 {
        static gchar *mbox_cache_dir = NULL;
 
@@ -1569,7 +1589,7 @@ gchar *get_mbox_cache_dir(void)
        return mbox_cache_dir;
 }
 
-gchar *get_mime_tmp_dir(void)
+const gchar *get_mime_tmp_dir(void)
 {
        static gchar *mime_tmp_dir = NULL;
 
@@ -1580,7 +1600,7 @@ gchar *get_mime_tmp_dir(void)
        return mime_tmp_dir;
 }
 
-gchar *get_template_dir(void)
+const gchar *get_template_dir(void)
 {
        static gchar *template_dir = NULL;
 
@@ -1591,7 +1611,7 @@ gchar *get_template_dir(void)
        return template_dir;
 }
 
-gchar *get_header_cache_dir(void)
+const gchar *get_header_cache_dir(void)
 {
        static gchar *header_dir = NULL;
 
@@ -1602,7 +1622,7 @@ gchar *get_header_cache_dir(void)
        return header_dir;
 }
 
-gchar *get_tmp_dir(void)
+const gchar *get_tmp_dir(void)
 {
        static gchar *tmp_dir = NULL;
 
@@ -1624,7 +1644,7 @@ gchar *get_tmp_file(void)
        return tmp_file;
 }
 
-gchar *get_domain_name(void)
+const gchar *get_domain_name(void)
 {
        static gchar *domain_name = NULL;
 
index 629fd21..0c1e7ef 100644 (file)
@@ -313,17 +313,17 @@ gint scan_mailto_url                      (const gchar    *mailto,
                                         gchar         **body);
 
 /* return static strings */
-gchar *get_home_dir            (void);
-gchar *get_rc_dir              (void);
-gchar *get_news_cache_dir      (void);
-gchar *get_imap_cache_dir      (void);
-gchar *get_mbox_cache_dir      (void);
-gchar *get_mime_tmp_dir                (void);
-gchar *get_template_dir                (void);
-gchar *get_header_cache_dir     (void);
-gchar *get_tmp_dir             (void);
-gchar *get_tmp_file            (void);
-gchar *get_domain_name         (void);
+const gchar *get_home_dir              (void);
+const gchar *get_rc_dir                        (void);
+const gchar *get_news_cache_dir                (void);
+const gchar *get_imap_cache_dir                (void);
+const gchar *get_mbox_cache_dir                (void);
+const gchar *get_mime_tmp_dir          (void);
+const gchar *get_template_dir          (void);
+const gchar *get_header_cache_dir      (void);
+const gchar *get_tmp_dir               (void);
+gchar *get_tmp_file                    (void);
+const gchar *get_domain_name           (void);
 
 /* file / directory handling */
 off_t get_file_size            (const gchar    *file);
index 5783044..306f10e 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "xml.h"
 #include "utils.h"
+#include "../codeconv.h"
 
 #define SPARSE_MEMORY
 /* if this is defined all attr.names and tag.names are stored
@@ -231,8 +232,8 @@ gint xml_parse_next_tag(XMLFile *file)
        /* parse attributes ( name=value ) */
        while (*bufp) {
                XMLAttr *attr;
-               gchar *attr_name;
-               gchar *attr_value;
+               gchar *attr_name, *attr_value;
+               gchar *utf8attr_name, *utf8attr_value;
                gchar *p;
                gchar quote;
 
@@ -264,9 +265,31 @@ gint xml_parse_next_tag(XMLFile *file)
                xml_unescape_str(attr_value);
 
                attr = g_new(XMLAttr, 1);
-               attr->name  = XML_STRING_ADD(attr_name);
-               attr->value = g_strdup(attr_value);
+#warning FIXME_GTK2
+               utf8attr_name  = conv_codeset_strdup
+                                       (attr_name,
+                                        conv_get_current_charset_str(),
+                                        CS_UTF_8);
+               utf8attr_value = conv_codeset_strdup
+                                       (attr_value,
+                                        conv_get_current_charset_str(),
+                                        CS_UTF_8);
+               if (!utf8attr_name) {
+                       g_warning("xml_parse_next_tag(): "
+                                 "faild to convert character set of attr_name\n");
+                       utf8attr_name = g_strdup(attr_name);
+               }
+               if (!utf8attr_value) {
+                       g_warning("xml_parse_next_tag(): "
+                                 "faild to convert character set of attr_value\n");
+                       utf8attr_value = g_strdup(attr_value);
+               }
+
+               attr->name  = XML_STRING_ADD(utf8attr_name);
+               attr->value = utf8attr_value;
                tag->attr   = g_list_append(tag->attr, attr);
+
+               g_free(utf8attr_name);
        }
 
        return 0;
@@ -315,6 +338,7 @@ gchar *xml_get_element(XMLFile *file)
 {
        gchar *str;
        gchar *end;
+       gchar *utf8str;
 
        while ((end = strchr(file->bufp, '<')) == NULL)
                if (xml_read_line(file) < 0) return NULL;
@@ -335,7 +359,18 @@ gchar *xml_get_element(XMLFile *file)
                return NULL;
        }
 
-       return str;
+       utf8str = conv_codeset_strdup
+                       (str,
+                        conv_get_current_charset_str(),
+                        CS_UTF_8);
+       if (!utf8str) {
+               g_warning("xml_get_element(): "
+                         "faild to convert character set.\n");
+               utf8str = str;
+       } else
+               g_free(str);
+
+       return utf8str;
 }
 
 gint xml_read_line(XMLFile *file)
@@ -451,15 +486,25 @@ gint xml_unescape_str(gchar *str)
        return 0;
 }
 
+#warning FIXME_GTK2
 gint xml_file_put_escape_str(FILE *fp, const gchar *str)
 {
+       const gchar *src_codeset = CS_UTF_8;
+       const gchar *dest_codeset = conv_get_current_charset_str();
+       gchar *tmpstr = NULL;
        const gchar *p;
 
        g_return_val_if_fail(fp != NULL, -1);
 
        if (!str) return 0;
 
-       for (p = str; *p != '\0'; p++) {
+       tmpstr = conv_codeset_strdup(str, src_codeset, dest_codeset);
+       if (!tmpstr) {
+               g_warning("xml_file_put_escape_str(): Faild to convert character set.");
+               tmpstr = g_strdup(str);
+       }
+
+       for (p = tmpstr; *p != '\0'; p++) {
                switch (*p) {
                case '<':
                        fputs("&lt;", fp);
@@ -481,6 +526,8 @@ gint xml_file_put_escape_str(FILE *fp, const gchar *str)
                }
        }
 
+       g_free(tmpstr);
+
        return 0;
 }
 
index df9d2f1..daf92bf 100644 (file)
@@ -47,7 +47,9 @@
 #include <gtk/gtkhbox.h>
 #include <gtk/gtklabel.h>
 #include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkthemes.h>
+#include <gtk/gtktreeview.h>
+#warning FIXME_GTK2
+/* #include <gtk/gtkthemes.h> */
 #include <gtk/gtkdnd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -72,7 +74,6 @@
 #include "main.h"
 #include "mainwindow.h"
 #include "compose.h"
-#include "gtkstext.h"
 #include "addressbook.h"
 #include "folderview.h"
 #include "procmsg.h"
@@ -123,22 +124,22 @@ typedef enum
 
 typedef enum
 {
-       COMPOSE_CALL_GTK_STEXT_MOVE_BEGINNING_OF_LINE,
-       COMPOSE_CALL_GTK_STEXT_MOVE_FORWARD_CHARACTER,
-       COMPOSE_CALL_GTK_STEXT_MOVE_BACKWARD_CHARACTER,
-       COMPOSE_CALL_GTK_STEXT_MOVE_FORWARD_WORD,
-       COMPOSE_CALL_GTK_STEXT_MOVE_BACKWARD_WORD,
-       COMPOSE_CALL_GTK_STEXT_MOVE_END_OF_LINE,
-       COMPOSE_CALL_GTK_STEXT_MOVE_NEXT_LINE,
-       COMPOSE_CALL_GTK_STEXT_MOVE_PREVIOUS_LINE,
-       COMPOSE_CALL_GTK_STEXT_DELETE_FORWARD_CHARACTER,
-       COMPOSE_CALL_GTK_STEXT_DELETE_BACKWARD_CHARACTER,
-       COMPOSE_CALL_GTK_STEXT_DELETE_FORWARD_WORD,
-       COMPOSE_CALL_GTK_STEXT_DELETE_BACKWARD_WORD,
-       COMPOSE_CALL_GTK_STEXT_DELETE_LINE,
-       COMPOSE_CALL_GTK_STEXT_DELETE_LINE_N,
-       COMPOSE_CALL_GTK_STEXT_DELETE_TO_LINE_END
-} ComposeCallGtkSTextAction;
+       COMPOSE_CALL_ADVANCED_ACTION_MOVE_BEGINNING_OF_LINE,
+       COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_CHARACTER,
+       COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_CHARACTER,
+       COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_WORD,
+       COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_WORD,
+       COMPOSE_CALL_ADVANCED_ACTION_MOVE_END_OF_LINE,
+       COMPOSE_CALL_ADVANCED_ACTION_MOVE_NEXT_LINE,
+       COMPOSE_CALL_ADVANCED_ACTION_MOVE_PREVIOUS_LINE,
+       COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_CHARACTER,
+       COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_CHARACTER,
+       COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_WORD,
+       COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_WORD,
+       COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE,
+       COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE_N,
+       COMPOSE_CALL_ADVANCED_ACTION_DELETE_TO_LINE_END
+} ComposeCallAdvancedAction;
 
 typedef enum
 {
@@ -265,7 +266,7 @@ static void attach_property_cancel          (GtkWidget      *widget,
 static gint attach_property_delete_event       (GtkWidget      *widget,
                                                 GdkEventAny    *event,
                                                 gboolean       *cancelled);
-static void attach_property_key_pressed                (GtkWidget      *widget,
+static gboolean attach_property_key_pressed    (GtkWidget      *widget,
                                                 GdkEventKey    *event,
                                                 gboolean       *cancelled);
 
@@ -283,7 +284,7 @@ static void compose_undo_state_changed              (UndoMain       *undostruct,
                                                 gint            redo_state,
                                                 gpointer        data);
 
-static gint calc_cursor_xpos   (GtkSText       *text,
+static gint calc_cursor_xpos   (GtkTextView    *text,
                                 gint            extra,
                                 gint            char_width);
 
@@ -303,10 +304,10 @@ static void attach_selected               (GtkCList       *clist,
                                         gint            column,
                                         GdkEvent       *event,
                                         gpointer        data);
-static void attach_button_pressed      (GtkWidget      *widget,
+static gboolean attach_button_pressed  (GtkWidget      *widget,
                                         GdkEventButton *event,
                                         gpointer        data);
-static void attach_key_pressed         (GtkWidget      *widget,
+static gboolean attach_key_pressed     (GtkWidget      *widget,
                                         GdkEventKey    *event,
                                         gpointer        data);
 
@@ -359,22 +360,14 @@ static void compose_paste_cb              (Compose        *compose);
 static void compose_paste_as_quote_cb  (Compose        *compose);
 static void compose_allsel_cb          (Compose        *compose);
 
-static void compose_gtk_stext_action_cb        (Compose                   *compose,
-                                        ComposeCallGtkSTextAction  action);
+static void compose_advanced_action_cb (Compose                   *compose,
+                                        ComposeCallAdvancedAction  action);
 
 static void compose_grab_focus_cb      (GtkWidget      *widget,
                                         Compose        *compose);
 
-static void compose_changed_cb         (GtkEditable    *editable,
+static void compose_changed_cb         (GtkTextBuffer  *textbuf,
                                         Compose        *compose);
-static void compose_button_press_cb    (GtkWidget      *widget,
-                                        GdkEventButton *event,
-                                        Compose        *compose);
-#if 0
-static void compose_key_press_cb       (GtkWidget      *widget,
-                                        GdkEventKey    *event,
-                                        Compose        *compose);
-#endif
 
 #if 0
 static void compose_toggle_to_cb       (gpointer        data,
@@ -457,10 +450,10 @@ static void subject_activated             (GtkWidget      *widget,
 
 static void text_activated             (GtkWidget      *widget,
                                         Compose        *compose);
-static void text_inserted              (GtkWidget      *widget,
+static void text_inserted              (GtkTextBuffer  *buffer,
+                                        GtkTextIter    *iter,
                                         const gchar    *text,
-                                        gint            length,
-                                        gint           *position,
+                                        gint            len,
                                         Compose        *compose);
 static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
                                  gboolean to_all, gboolean to_ml,
@@ -516,78 +509,78 @@ static GtkItemFactoryEntry compose_entries[] =
        {N_("/_Edit/A_dvanced"),        NULL, NULL, 0, "<Branch>"},
        {N_("/_Edit/A_dvanced/Move a character backward"),
                                        "<control>B",
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_MOVE_BACKWARD_CHARACTER,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_CHARACTER,
                                        NULL},
        {N_("/_Edit/A_dvanced/Move a character forward"),
                                        "<control>F",
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_MOVE_FORWARD_CHARACTER,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_CHARACTER,
                                        NULL},
        {N_("/_Edit/A_dvanced/Move a word backward"),
                                        NULL, /* "<alt>B" */
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_MOVE_BACKWARD_WORD,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_WORD,
                                        NULL},
        {N_("/_Edit/A_dvanced/Move a word forward"),
                                        NULL, /* "<alt>F" */
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_MOVE_FORWARD_WORD,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_WORD,
                                        NULL},
        {N_("/_Edit/A_dvanced/Move to beginning of line"),
                                        NULL, /* "<control>A" */
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_MOVE_BEGINNING_OF_LINE,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_MOVE_BEGINNING_OF_LINE,
                                        NULL},
        {N_("/_Edit/A_dvanced/Move to end of line"),
                                        "<control>E",
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_MOVE_END_OF_LINE,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_MOVE_END_OF_LINE,
                                        NULL},
        {N_("/_Edit/A_dvanced/Move to previous line"),
                                        "<control>P",
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_MOVE_PREVIOUS_LINE,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_MOVE_PREVIOUS_LINE,
                                        NULL},
        {N_("/_Edit/A_dvanced/Move to next line"),
                                        "<control>N",
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_MOVE_NEXT_LINE,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_MOVE_NEXT_LINE,
                                        NULL},
        {N_("/_Edit/A_dvanced/Delete a character backward"),
                                        "<control>H",
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_DELETE_BACKWARD_CHARACTER,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_CHARACTER,
                                        NULL},
        {N_("/_Edit/A_dvanced/Delete a character forward"),
                                        "<control>D",
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_DELETE_FORWARD_CHARACTER,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_CHARACTER,
                                        NULL},
        {N_("/_Edit/A_dvanced/Delete a word backward"),
                                        NULL, /* "<control>W" */
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_DELETE_BACKWARD_WORD,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_WORD,
                                        NULL},
        {N_("/_Edit/A_dvanced/Delete a word forward"),
                                        NULL, /* "<alt>D", */
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_DELETE_FORWARD_WORD,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_WORD,
                                        NULL},
        {N_("/_Edit/A_dvanced/Delete line"),
                                        "<control>U",
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_DELETE_LINE,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE,
                                        NULL},
        {N_("/_Edit/A_dvanced/Delete entire line"),
                                        NULL,
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_DELETE_LINE_N,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE_N,
                                        NULL},
        {N_("/_Edit/A_dvanced/Delete to end of line"),
                                        "<control>K",
-                                       compose_gtk_stext_action_cb,
-                                       COMPOSE_CALL_GTK_STEXT_DELETE_TO_LINE_END,
+                                       compose_advanced_action_cb,
+                                       COMPOSE_CALL_ADVANCED_ACTION_DELETE_TO_LINE_END,
                                        NULL},
        {N_("/_Edit/---"),              NULL, NULL, 0, "<Separator>"},
        {N_("/_Edit/_Wrap current paragraph"),
@@ -690,7 +683,9 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
                             GPtrArray *attach_files)
 {
        Compose *compose;
-       GtkSText *text;
+       GtkTextView *textview;
+       GtkTextBuffer *textbuf;
+       GtkTextIter iter;
        GtkItemFactory *ifactory;
        gboolean grab_focus_on_last = TRUE;
 
@@ -706,8 +701,8 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
        compose->replyinfo = NULL;
        compose->fwdinfo   = NULL;
 
-       text = GTK_STEXT(compose->text);
-       gtk_stext_freeze(text);
+       textview = GTK_TEXT_VIEW(compose->text);
+       textbuf = gtk_text_view_get_buffer(textview);
 
 #ifdef USE_ASPELL
        if (item && item->prefs && item->prefs->enable_default_dictionary &&
@@ -718,10 +713,8 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
 
        if (account->auto_sig)
                compose_insert_sig(compose, FALSE);
-       gtk_editable_set_position(GTK_EDITABLE(text), 0);
-       gtk_stext_set_point(text, 0);
-
-       gtk_stext_thaw(text);
+       gtk_text_buffer_get_start_iter(textbuf, &iter);
+       gtk_text_buffer_place_cursor(textbuf, &iter);
 
        if (account->protocol != A_NNTP) {
                if (mailto && *mailto != '\0') {
@@ -772,6 +765,8 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
        if (grab_focus_on_last)
                gtk_widget_grab_focus(compose->header_last->entry);
 
+       undo_unblock(compose->undostruct);
+
        if (prefs_common.auto_exteditor)
                compose_exec_ext_editor(compose);
 
@@ -915,7 +910,8 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
        Compose *compose;
        PrefsAccount *account = NULL;
        PrefsAccount *reply_account;
-       GtkSText *text;
+       GtkTextBuffer *buffer;
+       GtkTextIter iter;
 
        g_return_if_fail(msginfo != NULL);
        g_return_if_fail(msginfo->folder != NULL);
@@ -963,9 +959,6 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
                                to_sender, followup_and_reply_to);
        compose_show_first_last_header(compose, TRUE);
 
-       text = GTK_STEXT(compose->text);
-       gtk_stext_freeze(text);
-
 #ifdef USE_ASPELL
        if (msginfo->folder && msginfo->folder->prefs && 
            msginfo->folder->prefs && 
@@ -994,12 +987,14 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
        if (quote && prefs_common.linewrap_quote)
                compose_wrap_line_all(compose);
 
-       gtk_editable_set_position(GTK_EDITABLE(text), 0);
-       gtk_stext_set_point(text, 0);
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(compose->text));
+       gtk_text_buffer_get_start_iter(buffer, &iter);
+       gtk_text_buffer_place_cursor(buffer, &iter);
 
-       gtk_stext_thaw(text);
        gtk_widget_grab_focus(compose->text);
 
+       undo_unblock(compose->undostruct);
+
        if (prefs_common.auto_exteditor)
                compose_exec_ext_editor(compose);
 }
@@ -1015,7 +1010,9 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
                         gboolean as_attach, const gchar *body)
 {
        Compose *compose;
-       GtkSText *text;
+       GtkTextView *textview;
+       GtkTextBuffer *textbuf;
+       GtkTextIter iter;
 
        g_return_val_if_fail(msginfo != NULL, NULL);
        g_return_val_if_fail(msginfo->folder != NULL, NULL);
@@ -1068,8 +1065,8 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
                g_free(buf2);
        }
 
-       text = GTK_STEXT(compose->text);
-       gtk_stext_freeze(text);
+       textview = GTK_TEXT_VIEW(compose->text);
+       textbuf = gtk_text_view_get_buffer(textview);
 
        if (as_attach) {
                gchar *msgfile;
@@ -1110,10 +1107,9 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
        if (prefs_common.linewrap_quote)
                compose_wrap_line_all(compose);
 
-       gtk_editable_set_position(GTK_EDITABLE(compose->text), 0);
-       gtk_stext_set_point(GTK_STEXT(compose->text), 0);
+       gtk_text_buffer_get_start_iter(textbuf, &iter);
+       gtk_text_buffer_place_cursor(textbuf, &iter);
 
-       gtk_stext_thaw(text);
 #if 0 /* NEW COMPOSE GUI */
        if (account->protocol != A_NNTP)
                gtk_widget_grab_focus(compose->to_entry);
@@ -1143,7 +1139,9 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
 Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_list)
 {
        Compose *compose;
-       GtkSText *text;
+       GtkTextView *textview;
+       GtkTextBuffer *textbuf;
+       GtkTextIter iter;
        GSList *msginfo;
        gchar *msgfile;
 
@@ -1170,8 +1168,8 @@ Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_list)
 
        compose = compose_create(account, COMPOSE_FORWARD);
 
-       text = GTK_STEXT(compose->text);
-       gtk_stext_freeze(text);
+       textview = GTK_TEXT_VIEW(compose->text);
+       textbuf = gtk_text_view_get_buffer(textview);
 
        for (msginfo = msginfo_list; msginfo != NULL; msginfo = msginfo->next) {
                msgfile = procmsg_get_message_file_path((MsgInfo *)msginfo->data);
@@ -1189,10 +1187,9 @@ Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_list)
        if (prefs_common.linewrap_quote)
                compose_wrap_line_all(compose);
 
-       gtk_editable_set_position(GTK_EDITABLE(compose->text), 0);
-       gtk_stext_set_point(GTK_STEXT(compose->text), 0);
+       gtk_text_buffer_get_start_iter(textbuf, &iter);
+       gtk_text_buffer_place_cursor(textbuf, &iter);
 
-       gtk_stext_thaw(text);
        gtk_widget_grab_focus(compose->header_last->entry);
        
 #if 0 /* NEW COMPOSE GUI */
@@ -1209,7 +1206,10 @@ void compose_reedit(MsgInfo *msginfo)
 {
        Compose *compose;
        PrefsAccount *account = NULL;
-       GtkSText *text;
+       GtkTextView *textview;
+       GtkTextBuffer *textbuf;
+       GtkTextMark *mark;
+       GtkTextIter iter;
        FILE *fp;
        gchar buf[BUFFSIZE];
 
@@ -1273,21 +1273,22 @@ void compose_reedit(MsgInfo *msginfo)
        if (compose_parse_header(compose, msginfo) < 0) return;
        compose_reedit_set_entry(compose, msginfo);
 
-       text = GTK_STEXT(compose->text);
-       gtk_stext_freeze(text);
+       textview = GTK_TEXT_VIEW(compose->text);
+       textbuf = gtk_text_view_get_buffer(textview);
+       mark = gtk_text_buffer_get_insert(textbuf);
+       gtk_text_buffer_get_iter_at_mark(textbuf, &iter, mark);
 
        if ((fp = procmime_get_first_text_content(msginfo)) == NULL)
                g_warning("Can't get text part\n");
        else {
                while (fgets(buf, sizeof(buf), fp) != NULL) {
                        strcrchomp(buf);
-                       gtk_stext_insert(text, NULL, NULL, NULL, buf, -1);
+                       gtk_text_buffer_insert(textbuf, &iter, buf, -1);
                }
                fclose(fp);
        }
        compose_attach_parts(compose, msginfo);
 
-       gtk_stext_thaw(text);
        gtk_widget_grab_focus(compose->text);
 
         if (prefs_common.auto_exteditor)
@@ -1330,10 +1331,8 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo)
                                   msginfo->subject);
        gtk_editable_set_editable(GTK_EDITABLE(compose->subject_entry), FALSE);
 
-       gtk_stext_freeze(GTK_STEXT(compose->text));
        compose_quote_fmt(compose, msginfo, "%M", NULL, NULL);
-       gtk_editable_set_editable(GTK_EDITABLE(compose->text), FALSE);
-       gtk_stext_thaw(GTK_STEXT(compose->text));
+       gtk_text_view_set_editable(GTK_TEXT_VIEW(compose->text), TRUE);
 
        ifactory = gtk_item_factory_from_widget(compose->popupmenu);
        menu_set_sensitive(ifactory, "/Add...", FALSE);
@@ -1502,10 +1501,16 @@ static void compose_entries_set(Compose *compose, const gchar *mailto)
        if (subject)
                gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), subject);
        if (body) {
-               gtk_stext_insert(GTK_STEXT(compose->text),
-                               NULL, NULL, NULL, body, -1);
-               gtk_stext_insert(GTK_STEXT(compose->text),
-                               NULL, NULL, NULL, "\n", 1);
+               GtkTextView *text = GTK_TEXT_VIEW(compose->text);
+               GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
+               GtkTextMark *mark;
+               GtkTextIter iter;
+
+               mark = gtk_text_buffer_get_insert(buffer);
+               gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
+
+               gtk_text_buffer_insert(buffer, &iter, body, -1);
+               gtk_text_buffer_insert(buffer, &iter, "\n", 1);
        }
 
        g_free(to);
@@ -1694,7 +1699,6 @@ static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo,
                                const gchar *fmt, const gchar *qmark,
                                const gchar *body)
 {
-       GtkSText *text = GTK_STEXT(compose->text);
        static MsgInfo dummyinfo;
        gchar *quote_str = NULL;
        gchar *buf;
@@ -1734,20 +1738,24 @@ static gchar *compose_quote_fmt(Compose *compose, MsgInfo *msginfo,
        } else
                buf = "";
 
-       gtk_stext_freeze(text);
-
        for (p = buf; *p != '\0'; ) {
+               GtkTextView *text = GTK_TEXT_VIEW(compose->text);
+               GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
+               GtkTextMark *mark;
+               GtkTextIter iter;
+
+               mark = gtk_text_buffer_get_insert(buffer);
+               gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
+
                lastp = strchr(p, '\n');
                len = lastp ? lastp - p + 1 : -1;
-               gtk_stext_insert(text, NULL, NULL, NULL, p, len);
+               gtk_text_buffer_insert(buffer, &iter, p, len);
                if (lastp)
                        p = lastp + 1;
                else
                        break;
        }
 
-       gtk_stext_thaw(text);
-
        return buf;
 }
 
@@ -1917,33 +1925,38 @@ static void compose_reedit_set_entry(Compose *compose, MsgInfo *msginfo)
 
 static void compose_insert_sig(Compose *compose, gboolean replace)
 {
-       GtkSText *text = GTK_STEXT(compose->text);
+       GtkTextView *text = GTK_TEXT_VIEW(compose->text);
+       GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
+       GtkTextMark *mark;
+       GtkTextIter iter;
        gint cur_pos;
-       gint len;
 
        g_return_if_fail(compose->account != NULL);
 
-       cur_pos = gtk_editable_get_position(GTK_EDITABLE(text));
-
-       gtk_stext_freeze(text);
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
+       cur_pos = gtk_text_iter_get_offset (&iter);
 
-       len = gtk_stext_get_length(text);
-       gtk_stext_set_point(text, len);
+       gtk_text_buffer_get_end_iter(buffer, &iter);
 
        if (replace && compose->sig_str) {
-               gint pos;
+               gboolean found;
+               GtkTextIter first_iter, start_iter, end_iter;
+
+               gtk_text_buffer_get_start_iter(buffer, &first_iter);
 
                if (compose->sig_str[0] == '\0')
-                       pos = -1;
+                       found = FALSE;
                else
-                       pos = gtkut_stext_find(text, 0, compose->sig_str, TRUE);
-
-               if (pos != -1) {
-                       len = get_mbs_len(compose->sig_str);
-                       if (len >= 0) {
-                               gtk_stext_set_point(text, pos);
-                               gtk_stext_forward_delete(text, len);
-                       }
+                       found = gtk_text_iter_forward_search(&first_iter,
+                                                            compose->sig_str,
+                                                            GTK_TEXT_SEARCH_TEXT_ONLY,
+                                                            &start_iter, &end_iter,
+                                                            NULL);
+
+               if (found) {
+                       gtk_text_buffer_delete(buffer, &start_iter, &end_iter);
+                       iter = start_iter;
                }
        }
 
@@ -1952,15 +1965,13 @@ static void compose_insert_sig(Compose *compose, gboolean replace)
        if (!compose->sig_str || (replace && !compose->account->auto_sig))
                compose->sig_str = g_strdup("");
 
-       gtk_stext_insert(text, NULL, NULL, NULL, compose->sig_str, -1);
+       gtk_text_buffer_insert(buffer, &iter, compose->sig_str, -1);
 
-       gtk_stext_thaw(text);
+       if (cur_pos > gtk_text_buffer_get_char_count (buffer))
+               cur_pos = gtk_text_buffer_get_char_count (buffer);
 
-       if (cur_pos > gtk_stext_get_length(text))
-               cur_pos = gtk_stext_get_length(text);
-
-       gtk_editable_set_position(GTK_EDITABLE(text), cur_pos);
-       gtk_stext_set_point(text, cur_pos);
+       gtk_text_buffer_get_iter_at_offset (buffer, &iter, cur_pos);
+       gtk_text_buffer_place_cursor (buffer, &iter);
 }
 
 static gchar *compose_get_signature_str(Compose *compose)
@@ -2006,7 +2017,10 @@ static gchar *compose_get_signature_str(Compose *compose)
 
 static void compose_insert_file(Compose *compose, const gchar *file)
 {
-       GtkSText *text = GTK_STEXT(compose->text);
+       GtkTextView *text;
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter iter;
        gchar buf[BUFFSIZE];
        gint len;
        FILE *fp;
@@ -2018,21 +2032,32 @@ static void compose_insert_file(Compose *compose, const gchar *file)
                return;
        }
 
-       gtk_stext_freeze(text);
+       text = GTK_TEXT_VIEW(compose->text);
+       buffer = gtk_text_view_get_buffer(text);
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
 
        while (fgets(buf, sizeof(buf), fp) != NULL) {
+#warning FIXME_GTK2
+#if 1 /* FIXME_GTK2 */
+               const gchar *cur_encoding = conv_get_current_charset_str();
+               gchar *str = conv_codeset_strdup(buf, cur_encoding, CS_UTF_8);
+
+               if (!str) continue;
+
                /* strip <CR> if DOS/Windows file,
                   replace <CR> with <LF> if Macintosh file. */
-               strcrchomp(buf);
-               len = strlen(buf);
-               if (len > 0 && buf[len - 1] != '\n') {
+               strcrchomp(str);
+               len = strlen(str);
+               if (len > 0 && str[len - 1] != '\n') {
                        while (--len >= 0)
-                               if (buf[len] == '\r') buf[len] = '\n';
+                               if (str[len] == '\r') str[len] = '\n';
                }
-               gtk_stext_insert(text, NULL, NULL, NULL, buf, -1);
-       }
+               gtk_text_buffer_insert(buffer, &iter, str, -1);
 
-       gtk_stext_thaw(text);
+               g_free (str);
+#endif /* FIXME_GTK2 */
+       }
 
        fclose(fp);
 }
@@ -2085,7 +2110,7 @@ static void compose_attach_append(Compose *compose, const gchar *file,
                if (!strcasecmp(content_type, "message/rfc822")) {
                        MsgInfo *msginfo;
                        MsgFlags flags = {0, 0};
-                       gchar *name;
+                       const gchar *name;
 
                        if (procmime_get_encoding_for_file(file) == ENC_7BIT)
                                ainfo->encoding = ENC_7BIT;
@@ -2193,108 +2218,132 @@ static void compose_attach_parts(Compose *compose, MsgInfo *msginfo)
 }
 
 #undef IS_FIRST_PART_TEXT
+  
+#define CHAR_BUF_SIZE 8
 
-#define GET_CHAR(pos, buf, len)                                                     \
+#define GET_CHAR(iter_p, buf, len)                                          \
 {                                                                           \
-       if (text->use_wchar)                                                 \
-               len = wctomb(buf, (wchar_t)GTK_STEXT_INDEX(text, (pos)));    \
-       else {                                                               \
-               buf[0] = GTK_STEXT_INDEX(text, (pos));                       \
+       GtkTextIter end_iter;                                                \
+       gchar *tmp;                                                          \
+       end_iter = *iter_p;                                                  \
+       gtk_text_iter_forward_char(&end_iter);                               \
+       tmp = gtk_text_buffer_get_text(textbuf, iter_p, &end_iter, FALSE);   \
+       if (tmp) {                                                           \
+               glong items_read, items_witten;                              \
+               GError *error = NULL;                                        \
+               gunichar *wide_char;                                         \
+               strncpy2(buf, tmp, CHAR_BUF_SIZE);                           \
+               wide_char = g_utf8_to_ucs4(tmp, -1,                          \
+                                          &items_read, &items_witten,       \
+                                          &error);                          \
+               if (error != NULL) {                                         \
+                       g_warning("%s\n", error->message);                   \
+                       g_error_free(error);                                 \
+               }                                                            \
+               len = wide_char && g_unichar_iswide(*wide_char) ? 2 : 1;     \
+               g_free(wide_char);                                           \
+       } else {                                                             \
+               buf[0] = '\0';                                               \
                len = 1;                                                     \
        }                                                                    \
+       g_free(tmp);                                                         \
 }
 
-#define DISP_WIDTH(len) \
-       ((len > 2 && conv_get_current_charset() == C_UTF_8) ? 2 : \
-        (len == 2 && conv_get_current_charset() == C_UTF_8) ? 1 : len)
-
 #define INDENT_CHARS   ">|#"
 #define SPACE_CHARS    " \t"
 
+#warning FIXME_GTK2
 static void compose_wrap_line(Compose *compose)
 {
-       GtkSText *text = GTK_STEXT(compose->text);
+       GtkTextView *text = GTK_TEXT_VIEW(compose->text);
+       GtkTextBuffer *textbuf = gtk_text_view_get_buffer(text);
+       GtkTextMark *mark;
+       GtkTextIter insert_iter, iter;
        gint ch_len, last_ch_len;
-       gchar cbuf[MB_LEN_MAX], last_ch;
+       gchar cbuf[CHAR_BUF_SIZE], last_ch;
        guint text_len;
-       guint line_end;
-       guint quoted;
        gint p_start, p_end;
        gint line_pos, cur_pos;
        gint line_len, cur_len;
+       gboolean line_end, quoted;
 
-       gtk_stext_freeze(text);
-
-       text_len = gtk_stext_get_length(text);
-
-       /* check to see if the point is on the paragraph mark (empty line). */
-       cur_pos = gtk_stext_get_point(text);
-       GET_CHAR(cur_pos, cbuf, ch_len);
+       text_len = gtk_text_buffer_get_char_count(textbuf);
+       mark = gtk_text_buffer_get_insert(textbuf);
+       gtk_text_buffer_get_iter_at_mark(textbuf, &insert_iter, mark);
+       cur_pos = gtk_text_iter_get_offset(&insert_iter);
+       GET_CHAR(&insert_iter, cbuf, ch_len);
        if ((ch_len == 1 && *cbuf == '\n') || cur_pos == text_len) {
+               GtkTextIter prev_iter;
                if (cur_pos == 0)
-                       goto compose_end; /* on the paragraph mark */
-               GET_CHAR(cur_pos - 1, cbuf, ch_len);
+                       return; /* on the paragraph mark */
+               prev_iter = insert_iter;
+               gtk_text_iter_backward_char(&prev_iter);
+               GET_CHAR(&prev_iter, cbuf, ch_len);
                if (ch_len == 1 && *cbuf == '\n')
-                       goto compose_end; /* on the paragraph mark */
+                       return; /* on the paragraph mark */
        }
 
        /* find paragraph start. */
-       line_end = quoted = 0;
-       for (p_start = cur_pos; p_start >= 0; --p_start) {
-               GET_CHAR(p_start, cbuf, ch_len);
+       line_end = quoted = FALSE;
+       for (iter = insert_iter; gtk_text_iter_backward_char(&iter);) {
+               GET_CHAR(&iter, cbuf, ch_len);
                if (ch_len == 1 && *cbuf == '\n') {
                        if (quoted)
-                               goto compose_end; /* quoted part */
+                               return; /* quoted part */
                        if (line_end) {
-                               p_start += 2;
+                               gtk_text_iter_forward_chars(&iter, 2);
                                break;
                        }
-                       line_end = 1;
+                       line_end = TRUE;
                } else {
                        if (ch_len == 1 
                            && strchr(prefs_common.quote_chars, *cbuf))
-                               quoted = 1;
+                               quoted = TRUE;
                        else if (ch_len != 1 || !isspace(*cbuf))
-                               quoted = 0;
+                               quoted = FALSE;
 
-                       line_end = 0;
+                       line_end = FALSE;
                }
        }
-       if (p_start < 0)
-               p_start = 0;
+       p_start = gtk_text_iter_get_offset(&iter);
 
        /* find paragraph end. */
-       line_end = 0;
-       for (p_end = cur_pos; p_end < text_len; p_end++) {
-               GET_CHAR(p_end, cbuf, ch_len);
+       line_end = FALSE;
+       for (iter = insert_iter; gtk_text_iter_forward_char(&iter);) {
+               GET_CHAR(&iter, cbuf, ch_len);
                if (ch_len == 1 && *cbuf == '\n') {
                        if (line_end) {
                                p_end -= 1;
+                               gtk_text_iter_backward_char(&iter);
                                break;
                        }
-                       line_end = 1;
+                       line_end = TRUE;
                } else {
                        if (line_end && ch_len == 1 &&
                            strchr(prefs_common.quote_chars, *cbuf))
-                               goto compose_end; /* quoted part */
+                               return; /* quoted part */
 
-                       line_end = 0;
+                       line_end = FALSE;
                }
        }
+       p_end = gtk_text_iter_get_offset(&iter);
+
        if (p_end >= text_len)
                p_end = text_len;
 
        if (p_start >= p_end)
-               goto compose_end;
+               return;
 
        line_len = cur_len = 0;
        last_ch_len = 0;
        last_ch = '\0';
        line_pos = p_start;
        for (cur_pos = p_start; cur_pos < p_end; cur_pos++) {
-               guint space = 0;
+               gboolean space = FALSE;
+
+               gtk_text_buffer_get_iter_at_offset(textbuf, &iter, cur_pos);
 
-               GET_CHAR(cur_pos, cbuf, ch_len);
+               GET_CHAR(&iter, cbuf, ch_len);
 
                if (ch_len < 0) {
                        cbuf[0] = '\0';
@@ -2302,27 +2351,31 @@ static void compose_wrap_line(Compose *compose)
                }
 
                if (ch_len == 1 && isspace(*cbuf))
-                       space = 1;
+                       space = TRUE;
 
                if (ch_len == 1 && *cbuf == '\n') {
-                       guint replace = 0;
+                       gboolean replace = FALSE;
+                       GtkTextIter next_iter = iter;
+
+                       gtk_text_iter_forward_char(&next_iter);
+
                        if (last_ch_len == 1 && !isspace(last_ch)) {
                                if (cur_pos + 1 < p_end) {
-                                       GET_CHAR(cur_pos + 1, cbuf, ch_len);
+                                       GET_CHAR(&next_iter, cbuf, ch_len);
                                        if (ch_len == 1 && !isspace(*cbuf))
-                                               replace = 1;
+                                               replace = TRUE;
                                }
                        }
-                       gtk_stext_set_point(text, cur_pos + 1);
-                       gtk_stext_backward_delete(text, 1);
+                       gtk_text_buffer_delete(textbuf, &iter, &next_iter);
                        if (replace) {
-                               gtk_stext_set_point(text, cur_pos);
-                               gtk_stext_insert(text, NULL, NULL, NULL, " ", 1);
-                               space = 1;
+                               gtk_text_buffer_insert(textbuf, &iter, " ", 1);
+                               space = TRUE;
                        }
                        else {
                                p_end--;
                                cur_pos--;
+                               gtk_text_buffer_get_iter_at_offset
+                                       (textbuf, &iter, cur_pos);
                                continue;
                        }
                }
@@ -2335,14 +2388,19 @@ static void compose_wrap_line(Compose *compose)
                        line_len = cur_len + ch_len;
                }
 
-               if (cur_len + DISP_WIDTH(ch_len) > prefs_common.linewrap_len &&
+               gtk_text_buffer_get_iter_at_offset(textbuf, &iter, line_pos);
+
+               if (cur_len + ch_len > prefs_common.linewrap_len &&
                    line_len > 0) {
                        gint tlen = ch_len;
+                       GtkTextIter prev_iter = iter;
+
+                       gtk_text_iter_backward_char(&prev_iter);
 
-                       GET_CHAR(line_pos - 1, cbuf, ch_len);
+                       GET_CHAR(&prev_iter, cbuf, ch_len);
                        if (ch_len == 1 && isspace(*cbuf)) {
-                               gtk_stext_set_point(text, line_pos);
-                               gtk_stext_backward_delete(text, 1);
+                               gtk_text_buffer_delete(textbuf, &prev_iter, &iter);
+                               iter = prev_iter;
                                p_end--;
                                cur_pos--;
                                line_pos--;
@@ -2351,38 +2409,37 @@ static void compose_wrap_line(Compose *compose)
                        }
                        ch_len = tlen;
 
-                       gtk_stext_set_point(text, line_pos);
-                       gtk_stext_insert(text, NULL, NULL, NULL, "\n", 1);
+                       gtk_text_buffer_insert(textbuf, &iter, "\n", 1);
                        p_end++;
                        cur_pos++;
                        line_pos++;
-                       cur_len = cur_len - line_len + DISP_WIDTH(ch_len);
+                       cur_len = cur_len - line_len + ch_len;
                        line_len = 0;
                        continue;
                }
 
                if (ch_len > 1) {
                        line_pos = cur_pos + 1;
-                       line_len = cur_len + DISP_WIDTH(ch_len);
+                       line_len = cur_len + ch_len;
                }
-               cur_len += DISP_WIDTH(ch_len);
+               cur_len += ch_len;
        }
-
-compose_end:
-       gtk_stext_thaw(text);
 }
 
 #undef WRAP_DEBUG
 #ifdef WRAP_DEBUG
 /* Darko: used when I debug wrapping */
-void dump_text(GtkSText *text, int pos, int tlen, int breakoncr)
+void dump_text(GtkTextBuffer textbuf, int pos, int tlen, int breakoncr)
 {
        gint i, clen;
-       gchar cbuf[MB_LEN_MAX];
+       gchar cbuf[CHAR_BUF_SIZE];
 
        printf("%d [", pos);
-       for (i = pos; i < tlen; i++) {
-               GET_CHAR(i, cbuf, clen);
+       gtk_text_buffer_get_iter_at_offset(textbuf, &iter, pos);
+       gtk_text_buffer_get_iter_at_offset(textbuf, &end_iter, pos + tlen);
+       for (; gtk_text_iter_forward_char(&iter) &&
+                    gtk_text_iter_compare(&iter, &end_iter) < 0;)
+               GET_CHAR(&iter, cbuf, clen);
                if (clen < 0) break;
                if (breakoncr && clen == 1 && cbuf[0] == '\n')
                        break;
@@ -2404,12 +2461,12 @@ typedef enum {
    uppercase characters immediately followed by >,
    and the repeating sequences of the above */
 /* return indent length */
-static guint get_indent_length(GtkSText *text, guint start_pos, guint text_len)
+static guint get_indent_length(GtkTextBuffer *textbuf, guint start_pos, guint text_len)
 {
        guint i_len = 0;
        guint i, ch_len, alnum_cnt = 0;
        IndentState state = WAIT_FOR_INDENT_CHAR;
-       gchar cbuf[MB_LEN_MAX];
+       gchar cbuf[CHAR_BUF_SIZE];
        gboolean is_space;
        gboolean is_indent;
 
@@ -2418,7 +2475,10 @@ static guint get_indent_length(GtkSText *text, guint start_pos, guint text_len)
        }
 
        for (i = start_pos; i < text_len; i++) {
-               GET_CHAR(i, cbuf, ch_len);
+               GtkTextIter iter;
+
+               gtk_text_buffer_get_iter_at_offset(textbuf, &iter, i);
+               GET_CHAR(&iter, cbuf, ch_len);
                if (ch_len > 1)
                        break;
 
@@ -2475,36 +2535,49 @@ out:
 }
 
 /* insert quotation string when line was wrapped */
-static guint ins_quote(GtkSText *text, guint indent_len,
+static guint ins_quote(GtkTextBuffer *textbuf, GtkTextIter *iter,
+                      guint indent_len,
                       guint prev_line_pos, guint text_len,
                       gchar *quote_fmt)
 {
-       guint i, ins_len = 0;
-       gchar ch;
+       guint ins_len = 0;
 
        if (indent_len) {
-               for (i = 0; i < indent_len; i++) {
-                       ch = GTK_STEXT_INDEX(text, prev_line_pos + i);
-                       gtk_stext_insert(text, NULL, NULL, NULL, &ch, 1);
-               }
-               ins_len = indent_len;
+               GtkTextIter iter1, iter2;
+               gchar *text;
+
+               gtk_text_buffer_get_iter_at_offset(textbuf, &iter1,
+                                                  prev_line_pos);
+               gtk_text_buffer_get_iter_at_offset(textbuf, &iter2,
+                                                  prev_line_pos + indent_len);
+               text = gtk_text_buffer_get_text(textbuf, &iter1, &iter2, FALSE);
+               if (!text) return 0;
+
+               gtk_text_buffer_insert(textbuf, iter, text, -1);
+               ins_len = g_utf8_strlen(text, -1);
+
+               g_free(text);
        }
 
        return ins_len;
 }
 
 /* check if we should join the next line */
-static gboolean join_next_line(GtkSText *text, guint start_pos, guint tlen,
-                              guint prev_ilen, gboolean autowrap)
+static gboolean join_next_line_is_needed(GtkTextBuffer *textbuf,
+                                        guint start_pos, guint tlen,
+                                        guint prev_ilen, gboolean autowrap)
 {
        guint indent_len, ch_len;
        gboolean do_join = FALSE;
-       gchar cbuf[MB_LEN_MAX];
+       gchar cbuf[CHAR_BUF_SIZE];
 
-       indent_len = get_indent_length(text, start_pos, tlen);
+       indent_len = get_indent_length(textbuf, start_pos, tlen);
 
        if ((autowrap || indent_len > 0) && indent_len == prev_ilen) {
-               GET_CHAR(start_pos + indent_len, cbuf, ch_len);
+               GtkTextIter iter;
+               gtk_text_buffer_get_iter_at_offset(textbuf, &iter,
+                                                  start_pos + indent_len);
+               GET_CHAR(&iter, cbuf, ch_len);
                if (ch_len > 0 && (cbuf[0] != '\n'))
                        do_join = TRUE;
        }
@@ -2517,12 +2590,12 @@ static void compose_wrap_line_all(Compose *compose)
        compose_wrap_line_all_full(compose, FALSE);
 }
 
-#define STEXT_FREEZE() \
-       if (!frozen) { gtk_stext_freeze(text); frozen = TRUE; }
-
 static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
 {
-       GtkSText *text = GTK_STEXT(compose->text);
+#if 0
+       GtkTextView *text = GTK_TEXT_VIEW(compose->text);
+       GtkTextBuffer *textbuf = gtk_text_view_get_buffer(text);
+       GtkTextIter iter, end_iter;
        guint tlen;
        guint line_pos = 0, cur_pos = 0, p_pos = 0;
        gint line_len = 0, cur_len = 0;
@@ -2532,104 +2605,96 @@ static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
        gboolean linewrap_quote = TRUE;
        gboolean set_editable_pos = FALSE;
        gint editable_pos = 0;
-       gboolean frozen = FALSE;
        guint linewrap_len = prefs_common.linewrap_len;
        gchar *qfmt = prefs_common.quotemark;
-       gchar cbuf[MB_LEN_MAX];
+       gchar cbuf[CHAR_BUF_SIZE];
 
-       tlen = gtk_stext_get_length(text);
+       tlen = gtk_text_buffer_get_char_count(textbuf);
 
        for (; cur_pos < tlen; cur_pos++) {
                /* mark position of new line - needed for quotation wrap */
                if (is_new_line) {
                        if (linewrap_quote)
-                               i_len = get_indent_length(text, cur_pos, tlen);
+                               i_len = get_indent_length(textbuf, cur_pos, tlen);
 
                        is_new_line = FALSE;
                        p_pos = cur_pos;
-#ifdef WRAP_DEBUG
-                       g_print("new line i_len=%d p_pos=", i_len);
-                       dump_text(text, p_pos, tlen, 1);
-#endif
                }
 
-               GET_CHAR(cur_pos, cbuf, ch_len);
+               gtk_text_buffer_get_iter_at_offset(textbuf, &iter, cur_pos);
+               GET_CHAR(&iter, cbuf, ch_len);
 
                /* fix line length for tabs */
                if (ch_len == 1 && *cbuf == '\t') {
-                       guint tab_width = text->default_tab_width;
+#warning FIXME_GTK2
+                       /* guint tab_width = text->default_tab_width; */
+                       guint tab_width = 8;
                        guint tab_offset = line_len % tab_width;
 
-#ifdef WRAP_DEBUG
-                       g_print("found tab at pos=%d line_len=%d ", cur_pos,
-                               line_len);
-#endif
                        if (tab_offset) {
                                line_len += tab_width - tab_offset - 1;
                                cur_len = line_len;
                        }
-#ifdef WRAP_DEBUG
-                       printf("new_len=%d\n", line_len);
-#endif
                }
 
                /* we have encountered line break */
                if (ch_len == 1 && *cbuf == '\n') {
                        gint clen;
-                       gchar cb[MB_LEN_MAX];
+                       gchar cb[CHAR_BUF_SIZE];
 
                        /* should we join the next line */
                        if ((autowrap || i_len != cur_len) && do_delete &&
-                           join_next_line
-                               (text, cur_pos + 1, tlen, i_len, autowrap))
+                           join_next_line_is_needed
+                               (textbuf, cur_pos + 1, tlen, i_len, autowrap))
                                do_delete = TRUE;
                        else
                                do_delete = FALSE;
 
-#ifdef WRAP_DEBUG
-                       g_print("found CR at %d do_del is %d next line is ",
-                              cur_pos, do_delete);
-                       dump_text(text, cur_pos + 1, tlen, 1);
-#endif
-
                        /* skip delete if it is continuous URL */
                        if (do_delete && (line_pos - p_pos <= i_len) &&
-                           gtk_stext_is_uri_string(text, line_pos, tlen))
+                           gtkut_text_buffer_is_uri_string(textbuf, line_pos,
+                                                           tlen))
                                do_delete = FALSE;
 
-#ifdef WRAP_DEBUG
-                       g_print("l_len=%d wrap_len=%d do_del=%d\n",
-                               line_len, linewrap_len, do_delete);
-#endif
                        /* should we delete to perform smart wrapping */
                        if (line_len < linewrap_len && do_delete) {
-                               STEXT_FREEZE();
                                /* get rid of newline */
-                               gtk_stext_set_point(text, cur_pos);
-                               gtk_stext_forward_delete(text, 1);
+                               gtk_text_buffer_get_iter_at_offset(textbuf,
+                                                                  &iter,
+                                                                  cur_pos);
+                               end_iter = iter;
+                               gtk_text_iter_forward_char(&end_iter);
+                               gtk_text_buffer_delete(textbuf, &iter, &end_iter);
                                tlen--;
 
                                /* if text starts with quote fmt or with
                                   indent string, delete them */
                                if (i_len) {
                                        guint ilen;
-                                       ilen =  gtk_stext_str_compare_n
-                                               (text, cur_pos, p_pos, i_len,
+                                       ilen =  gtkut_text_buffer_str_compare_n
+                                               (textbuf, cur_pos, p_pos, i_len,
                                                 tlen);
                                        if (ilen) {
-                                               gtk_stext_forward_delete
-                                                       (text, ilen);
+                                               end_iter = iter;
+                                               gtk_text_iter_forward_chars
+                                                       (&end_iter, ilen);
+                                               gtk_text_buffer_delete(textbuf,
+                                                                      &iter,
+                                                                      &end_iter);
                                                tlen -= ilen;
                                        }
                                }
 
-                               GET_CHAR(cur_pos, cb, clen);
+                               gtk_text_buffer_get_iter_at_offset(textbuf,
+                                                                  &iter,
+                                                                  cur_pos);
+                               GET_CHAR(&iter, cb, clen);
 
                                /* insert space if it's alphanumeric */
                                if ((cur_pos != line_pos) &&
                                    ((clen > 1) || isalnum(cb[0]))) {
-                                       gtk_stext_insert(text, NULL, NULL,
-                                                       NULL, " ", 1);
+                                       gtk_text_buffer_insert(textbuf, &iter,
+                                                              " ", 1);
                                        tlen++;
                                }
 
@@ -2772,21 +2837,21 @@ static void compose_wrap_line_all_full(Compose *compose, gboolean autowrap)
 
                if (ch_len > 1) {
                        line_pos = cur_pos + 1;
-                       line_len = cur_len + DISP_WIDTH(ch_len);
+                       line_len = cur_len + ch_len;
                }
                /* advance to next character in buffer */
-               cur_len += DISP_WIDTH(ch_len);
+               cur_len += ch_len;
        }
 
-       if (frozen)
-               gtk_stext_thaw(text);
-
-       if (set_editable_pos && editable_pos <= tlen)
-               gtk_editable_set_position(GTK_EDITABLE(text), editable_pos);
+       if (set_editable_pos && editable_pos <= tlen) {
+               gtk_text_buffer_get_iter_at_offset(textbuf, &iter, editable_pos);
+               gtk_text_buffer_place_cursor(textbuf, &iter);
+       }
+#endif
 }
 
-#undef STEXT_FREEZE
 #undef GET_CHAR
+#undef CHAR_BUF_SIZE
 
 static void compose_set_title(Compose *compose)
 {
@@ -2966,7 +3031,7 @@ gboolean compose_check_for_valid_recipient(Compose *compose) {
 
 static gboolean compose_check_entries(Compose *compose, gboolean check_subject)
 {
-       gchar *str;
+       const gchar *str;
 
        if (compose_check_for_valid_recipient(compose) == FALSE) {
                alertpanel_error(_("Recipient is not specified."));
@@ -3147,7 +3212,7 @@ static gint compose_redirect_write_headers_from_headerlist(Compose *compose,
        gboolean first_address;
        GSList *list;
        ComposeHeaderEntry *headerentry;
-       gchar *headerentryname;
+       const gchar *headerentryname;
        gchar *cc_hdr;
        gchar *to_hdr;
 
@@ -3163,8 +3228,8 @@ static gint compose_redirect_write_headers_from_headerlist(Compose *compose,
 
                if (g_strcasecmp(headerentryname, cc_hdr) == 0 
                   || g_strcasecmp(headerentryname, to_hdr) == 0) {
-                       str = gtk_entry_get_text(GTK_ENTRY(headerentry->entry));
-                       Xstrdup_a(str, str, return -1);
+                       const gchar *entstr = gtk_entry_get_text(GTK_ENTRY(headerentry->entry));
+                       Xstrdup_a(str, entstr, return -1);
                        g_strstrip(str);
                        if (str[0] != '\0') {
                                compose_convert_header
@@ -3191,6 +3256,7 @@ static gint compose_redirect_write_headers(Compose *compose, FILE *fp)
 {
        gchar buf[BUFFSIZE];
        gchar *str;
+       const gchar *entstr;
        /* struct utsname utsbuf; */
 
        g_return_val_if_fail(fp != NULL, -1);
@@ -3212,9 +3278,9 @@ static gint compose_redirect_write_headers(Compose *compose, FILE *fp)
                fprintf(fp, "Resent-From: %s\n", compose->account->address);
 
        /* Subject */
-       str = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry));
-       if (*str != '\0') {
-               Xstrdup_a(str, str, return -1);
+       entstr = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry));
+       if (*entstr != '\0') {
+               Xstrdup_a(str, entstr, return -1);
                g_strstrip(str);
                if (*str != '\0') {
                        compose_convert_header(buf, sizeof(buf), str,
@@ -3397,6 +3463,8 @@ static gint compose_clearsign_text(Compose *compose, gchar **text)
 static gint compose_write_to_file(Compose *compose, const gchar *file,
                                  gboolean is_draft)
 {
+       GtkTextBuffer *buffer;
+       GtkTextIter start, end;
        FILE *fp;
        size_t len;
        gchar *chars;
@@ -3417,7 +3485,10 @@ static gint compose_write_to_file(Compose *compose, const gchar *file,
        }
 
        /* get all composed text */
-       chars = gtk_editable_get_chars(GTK_EDITABLE(compose->text), 0, -1);
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(compose->text));
+       gtk_text_buffer_get_start_iter(buffer, &start);
+       gtk_text_buffer_get_end_iter(buffer, &end);
+       chars = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
        len = strlen(chars);
        if (is_ascii_str(chars)) {
                buf = chars;
@@ -3447,11 +3518,16 @@ static gint compose_write_to_file(Compose *compose, const gchar *file,
                        encoding = ENC_BASE64;
 #endif
 
+#warning FIXME_GTK2
+#if 0 /* FIXME_GTK2 */
                src_codeset = conv_get_current_charset_str();
                /* if current encoding is US-ASCII, set it the same as
                   outgoing one to prevent code conversion failure */
                if (!strcasecmp(src_codeset, CS_US_ASCII))
                        src_codeset = out_codeset;
+#else /* FIXME_GTK2 */
+               src_codeset = CS_UTF_8;
+#endif /* FIXME_GTK2 */
 
                debug_print("src encoding = %s, out encoding = %s, transfer encoding = %s\n",
                            src_codeset, out_codeset, procmime_get_encoding_str(encoding));
@@ -3614,9 +3690,12 @@ static gint compose_write_to_file(Compose *compose, const gchar *file,
 
 static gint compose_write_body_to_file(Compose *compose, const gchar *file)
 {
+       GtkTextBuffer *buffer;
+       GtkTextIter start, end;
        FILE *fp;
        size_t len;
-       gchar *chars;
+       gchar *chars, *tmp;
+       const gchar *src_codeset, *dest_codeset;
 
        if ((fp = fopen(file, "wb")) == NULL) {
                FILE_OP_ERROR(file, "fopen");
@@ -3629,7 +3708,19 @@ static gint compose_write_body_to_file(Compose *compose, const gchar *file)
                g_warning("can't change file mode\n");
        }
 
-       chars = gtk_editable_get_chars(GTK_EDITABLE(compose->text), 0, -1);
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(compose->text));
+       gtk_text_buffer_get_start_iter(buffer, &start);
+       gtk_text_buffer_get_end_iter(buffer, &end);
+       tmp = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
+
+#warning FIXME_GTK2
+#if 1 /* FIXME_GTK2 */
+       src_codeset = CS_UTF_8;
+       dest_codeset = conv_get_current_charset_str();
+       chars = conv_codeset_strdup(tmp, src_codeset, dest_codeset);
+       g_free(tmp);
+       if (!chars) return -1;
+#endif /* FIXME_GTK2 */
 
        /* write body */
        len = strlen(chars);
@@ -3995,21 +4086,22 @@ static void compose_write_attach(Compose *compose, FILE *fp)
                Xstrdup_a(out, str, return -1);         \
        }                                               \
 }
-
-#define PUT_RECIPIENT_HEADER(header, str)                                   \
-{                                                                           \
-       if (*str != '\0') {                                                  \
-               Xstrdup_a(str, str, return -1);                              \
-               g_strstrip(str);                                             \
-               if (*str != '\0') {                                          \
-                       compose->to_list = address_list_append               \
-                               (compose->to_list, str);                     \
-                       compose_convert_header                               \
-                               (buf, sizeof(buf), str, strlen(header) + 2,  \
-                                TRUE);                                      \
-                       fprintf(fp, "%s: %s\n", header, buf);                \
-               }                                                            \
-       }                                                                    \
+  
+#define PUT_RECIPIENT_HEADER(header, str)                                    \
+{                                                                            \
+       if (*str != '\0') {                                                   \
+               gchar *dest;                                                  \
+               Xstrdup_a(dest, str, return -1);                              \
+               g_strstrip(dest);                                             \
+               if (*dest != '\0') {                                          \
+                       compose->to_list = address_list_append                \
+                               (compose->to_list, dest);                     \
+                       compose_convert_header                                \
+                               (buf, sizeof(buf), dest, strlen(header) + 2,  \
+                                TRUE);                                       \
+                       fprintf(fp, "%s: %s\n", header, buf);                 \
+               }                                                             \
+       }                                                                     \
 }
 
 #define IS_IN_CUSTOM_HEADER(header) \
@@ -4025,7 +4117,7 @@ static gint compose_write_headers_from_headerlist(Compose *compose,
        gboolean first_address;
        GSList *list;
        ComposeHeaderEntry *headerentry;
-       gchar * headerentryname;
+       const gchar * headerentryname;
 
        if (IS_IN_CUSTOM_HEADER(header)) {
                return 0;
@@ -4042,8 +4134,8 @@ static gint compose_write_headers_from_headerlist(Compose *compose,
                headerentryname = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(headerentry->combo)->entry));
 
                if (!g_strcasecmp(trans_hdr, headerentryname)) {
-                       str = gtk_entry_get_text(GTK_ENTRY(headerentry->entry));
-                       Xstrdup_a(str, str, return -1);
+                       const gchar *entstr = gtk_entry_get_text(GTK_ENTRY(headerentry->entry));
+                       Xstrdup_a(str, entstr, return -1);
                        g_strstrip(str);
                        if (str[0] != '\0') {
                                compose_convert_header
@@ -4073,6 +4165,7 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
                                  gboolean is_draft)
 {
        gchar buf[BUFFSIZE];
+       const gchar *entry_str;
        gchar *str;
        gchar *name;
        GSList *list;
@@ -4122,8 +4215,8 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
        compose_write_headers_from_headerlist(compose, fp, "To");
 #if 0 /* NEW COMPOSE GUI */
        if (compose->use_to) {
-               str = gtk_entry_get_text(GTK_ENTRY(compose->to_entry));
-               PUT_RECIPIENT_HEADER("To", str);
+               entry_str = gtk_entry_get_text(GTK_ENTRY(compose->to_entry));
+               PUT_RECIPIENT_HEADER("To", entry_str);
        }
 #endif
 
@@ -4131,9 +4224,9 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
        compose_write_headers_from_headerlist(compose, fp, "Newsgroups");
 #if 0 /* NEW COMPOSE GUI */
        if (compose->use_newsgroups) {
-               str = gtk_entry_get_text(GTK_ENTRY(compose->newsgroups_entry));
-               if (*str != '\0') {
-                       Xstrdup_a(str, str, return -1);
+               entry_str = gtk_entry_get_text(GTK_ENTRY(compose->newsgroups_entry));
+               if (*entry_str != '\0') {
+                       Xstrdup_a(str, entry_str, return -1);
                        g_strstrip(str);
                        remove_space(str);
                        if (*str != '\0') {
@@ -4166,9 +4259,9 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
 #endif
 
        /* Subject */
-       str = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry));
-       if (*str != '\0' && !IS_IN_CUSTOM_HEADER("Subject")) {
-               Xstrdup_a(str, str, return -1);
+       entry_str = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry));
+       if (*entry_str != '\0' && !IS_IN_CUSTOM_HEADER("Subject")) {
+               Xstrdup_a(str, entry_str, return -1);
                g_strstrip(str);
                if (*str != '\0') {
                        compose_convert_header(buf, sizeof(buf), str,
@@ -4198,9 +4291,9 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
        compose_write_headers_from_headerlist(compose, fp, "Followup-To");
 #if 0 /* NEW COMPOSE GUI */
        if (compose->use_followupto && !IS_IN_CUSTOM_HEADER("Followup-To")) {
-               str = gtk_entry_get_text(GTK_ENTRY(compose->followup_entry));
-               if (*str != '\0') {
-                       Xstrdup_a(str, str, return -1);
+               entry_str = gtk_entry_get_text(GTK_ENTRY(compose->followup_entry));
+               if (*entry_str != '\0') {
+                       Xstrdup_a(str, entry_str, return -1);
                        g_strstrip(str);
                        remove_space(str);
                        if (*str != '\0') {
@@ -4216,9 +4309,9 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
        compose_write_headers_from_headerlist(compose, fp, "Reply-To");
 #if 0 /* NEW COMPOSE GUI */
        if (compose->use_replyto && !IS_IN_CUSTOM_HEADER("Reply-To")) {
-               str = gtk_entry_get_text(GTK_ENTRY(compose->reply_entry));
-               if (*str != '\0') {
-                       Xstrdup_a(str, str, return -1);
+               entry_str = gtk_entry_get_text(GTK_ENTRY(compose->reply_entry));
+               if (*entry_str != '\0') {
+                       Xstrdup_a(str, entry_str, return -1);
                        g_strstrip(str);
                        if (*str != '\0') {
                                compose_convert_header(buf, sizeof(buf), str,
@@ -4363,7 +4456,8 @@ static gint compose_write_headers(Compose *compose, FILE *fp,
                }
                g_free(tmp);
                
-               headervalue = gtk_entry_get_text(GTK_ENTRY(headerentry->entry));
+               entry_str = gtk_entry_get_text(GTK_ENTRY(headerentry->entry));
+               Xstrdup_a(headervalue, entry_str, return -1);
                subst_char(headervalue, '\r', ' ');
                subst_char(headervalue, '\n', ' ');
                string = std_headers;
@@ -4441,7 +4535,8 @@ static void compose_create_header_entry(Compose *compose)
        GtkWidget *combo;
        GtkWidget *entry;
        GList *combo_list = NULL;
-       gchar **string, *header = NULL;
+       gchar **string;
+       const gchar *header = NULL;
        ComposeHeaderEntry *headerentry;
        gboolean standard_header = FALSE;
 
@@ -4460,7 +4555,7 @@ static void compose_create_header_entry(Compose *compose)
        gtk_widget_show(combo);
        gtk_table_attach(GTK_TABLE(compose->header_table), combo, 0, 1, compose->header_nextrow, compose->header_nextrow+1, GTK_SHRINK, GTK_FILL, 0, 0);
        if (compose->header_last) {     
-               gchar *last_header_entry = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry));
+               const gchar *last_header_entry = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(compose->header_last->combo)->entry));
                string = headers;
                while (*string != NULL) {
                        if (!strcmp(*string, last_header_entry))
@@ -4596,35 +4691,35 @@ static GtkWidget *compose_create_header(Compose *compose)
 
        gtk_table_set_col_spacings(GTK_TABLE(table), 4);
 
-       gtk_signal_connect(GTK_OBJECT(to_entry), "activate",
-                          GTK_SIGNAL_FUNC(to_activated), compose);
-       gtk_signal_connect(GTK_OBJECT(newsgroups_entry), "activate",
-                          GTK_SIGNAL_FUNC(newsgroups_activated), compose);
-       gtk_signal_connect(GTK_OBJECT(subject_entry), "activate",
-                          GTK_SIGNAL_FUNC(subject_activated), compose);
-       gtk_signal_connect(GTK_OBJECT(cc_entry), "activate",
-                          GTK_SIGNAL_FUNC(cc_activated), compose);
-       gtk_signal_connect(GTK_OBJECT(bcc_entry), "activate",
-                          GTK_SIGNAL_FUNC(bcc_activated), compose);
-       gtk_signal_connect(GTK_OBJECT(reply_entry), "activate",
-                          GTK_SIGNAL_FUNC(replyto_activated), compose);
-       gtk_signal_connect(GTK_OBJECT(followup_entry), "activate",
-                          GTK_SIGNAL_FUNC(followupto_activated), compose);
-
-       gtk_signal_connect(GTK_OBJECT(subject_entry), "grab_focus",
-                          GTK_SIGNAL_FUNC(compose_grab_focus_cb), compose);
-       gtk_signal_connect(GTK_OBJECT(to_entry), "grab_focus",
-                          GTK_SIGNAL_FUNC(compose_grab_focus_cb), compose);
-       gtk_signal_connect(GTK_OBJECT(newsgroups_entry), "grab_focus",
-                          GTK_SIGNAL_FUNC(compose_grab_focus_cb), compose);
-       gtk_signal_connect(GTK_OBJECT(cc_entry), "grab_focus",
-                          GTK_SIGNAL_FUNC(compose_grab_focus_cb), compose);
-       gtk_signal_connect(GTK_OBJECT(bcc_entry), "grab_focus",
-                          GTK_SIGNAL_FUNC(compose_grab_focus_cb), compose);
-       gtk_signal_connect(GTK_OBJECT(reply_entry), "grab_focus",
-                          GTK_SIGNAL_FUNC(compose_grab_focus_cb), compose);
-       gtk_signal_connect(GTK_OBJECT(followup_entry), "grab_focus",
-                          GTK_SIGNAL_FUNC(compose_grab_focus_cb), compose);
+       g_signal_connect(G_OBJECT(to_entry), "activate",
+                        G_CALLBACK(to_activated), compose);
+       g_signal_connect(G_OBJECT(newsgroups_entry), "activate",
+                        G_CALLBACK(newsgroups_activated), compose);
+       g_signal_connect(G_OBJECT(subject_entry), "activate",
+                        G_CALLBACK(subject_activated), compose);
+       g_signal_connect(G_OBJECT(cc_entry), "activate",
+                        G_CALLBACK(cc_activated), compose);
+       g_signal_connect(G_OBJECT(bcc_entry), "activate",
+                        G_CALLBACK(bcc_activated), compose);
+       g_signal_connect(G_OBJECT(reply_entry), "activate",
+                        G_CALLBACK(replyto_activated), compose);
+       g_signal_connect(G_OBJECT(followup_entry), "activate",
+                        G_CALLBACK(followupto_activated), compose);
+
+       g_signal_connect(G_OBJECT(subject_entry), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
+       g_signal_connect(G_OBJECT(to_entry), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
+       g_signal_connect(G_OBJECT(newsgroups_entry), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
+       g_signal_connect(G_OBJECT(cc_entry), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
+       g_signal_connect(G_OBJECT(bcc_entry), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
+       g_signal_connect(G_OBJECT(reply_entry), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
+       g_signal_connect(G_OBJECT(followup_entry), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
 #endif
 
        compose->table            = NULL;
@@ -4666,7 +4761,7 @@ GtkWidget *compose_create_attach(Compose *compose)
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(attach_scrwin),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_ALWAYS);
-       gtk_widget_set_usize(attach_scrwin, -1, 80);
+       gtk_widget_set_size_request(attach_scrwin, -1, 80);
 
        attach_clist = gtk_clist_new_with_titles(N_ATTACH_COLS, titles);
        gtk_clist_set_column_justification(GTK_CLIST(attach_clist), COL_SIZE,
@@ -4681,20 +4776,20 @@ GtkWidget *compose_create_attach(Compose *compose)
                         GTK_CAN_FOCUS);
        gtk_container_add(GTK_CONTAINER(attach_scrwin), attach_clist);
 
-       gtk_signal_connect(GTK_OBJECT(attach_clist), "select_row",
-                          GTK_SIGNAL_FUNC(attach_selected), compose);
-       gtk_signal_connect(GTK_OBJECT(attach_clist), "button_press_event",
-                          GTK_SIGNAL_FUNC(attach_button_pressed), compose);
-       gtk_signal_connect(GTK_OBJECT(attach_clist), "key_press_event",
-                          GTK_SIGNAL_FUNC(attach_key_pressed), compose);
+       g_signal_connect(G_OBJECT(attach_clist), "select_row",
+                        G_CALLBACK(attach_selected), compose);
+       g_signal_connect(G_OBJECT(attach_clist), "button_press_event",
+                        G_CALLBACK(attach_button_pressed), compose);
+       g_signal_connect(G_OBJECT(attach_clist), "key_press_event",
+                        G_CALLBACK(attach_key_pressed), compose);
 
        /* drag and drop */
        gtk_drag_dest_set(attach_clist,
                          GTK_DEST_DEFAULT_ALL, compose_mime_types, 1,
                          GDK_ACTION_COPY | GDK_ACTION_MOVE);
-       gtk_signal_connect(GTK_OBJECT(attach_clist), "drag_data_received",
-                          GTK_SIGNAL_FUNC(compose_attach_drag_received_cb),
-                          compose);
+       g_signal_connect(G_OBJECT(attach_clist), "drag_data_received",
+                        G_CALLBACK(compose_attach_drag_received_cb),
+                        compose);
 
        compose->attach_scrwin = attach_scrwin;
        compose->attach_clist  = attach_clist;
@@ -4801,6 +4896,8 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        GtkWidget *ruler;
        GtkWidget *scrolledwin;
        GtkWidget *text;
+       GtkTextBuffer *buffer;
+       GtkClipboard *clipboard;
 
        UndoMain *undostruct;
 
@@ -4835,7 +4932,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
 
        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
-       gtk_widget_set_usize(window, -1, prefs_common.compose_height);
+       gtk_widget_set_size_request(window, -1, prefs_common.compose_height);
        gtk_window_set_wmclass(GTK_WINDOW(window), "compose window", "Sylpheed");
 
        if (!geometry.max_width) {
@@ -4845,10 +4942,10 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL,
                                      &geometry, GDK_HINT_MAX_SIZE);
 
-       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
-                          GTK_SIGNAL_FUNC(compose_delete_cb), compose);
-       gtk_signal_connect(GTK_OBJECT(window), "destroy",
-                          GTK_SIGNAL_FUNC(compose_destroy_cb), compose);
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(compose_delete_cb), compose);
+       g_signal_connect(G_OBJECT(window), "destroy",
+                        G_CALLBACK(compose_destroy_cb), compose);
        MANAGE_WINDOW_SIGNALS_CONNECT(window);
        gtk_widget_realize(window);
 
@@ -4874,7 +4971,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        
        /* Notebook */
        notebook = gtk_notebook_new();
-       gtk_widget_set_usize(notebook, -1, 130);
+       gtk_widget_set_size_request(notebook, -1, 130);
        gtk_widget_show(notebook);
 
        /* header labels and entries */
@@ -4923,65 +5020,71 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        gtk_ruler_set_range(GTK_RULER(ruler), 0.0, 100.0, 1.0, 100.0);
        gtk_box_pack_start(GTK_BOX(ruler_hbox), ruler, TRUE, TRUE,
                           BORDER_WIDTH + 1);
-       gtk_widget_set_usize(ruler_hbox, 1, -1);
+       gtk_widget_set_size_request(ruler_hbox, 1, -1);
 
        /* text widget */
        scrolledwin = gtk_scrolled_window_new(NULL, NULL);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
                                       GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
        gtk_box_pack_start(GTK_BOX(edit_vbox), scrolledwin, TRUE, TRUE, 0);
-       gtk_widget_set_usize(scrolledwin, prefs_common.compose_width, -1);
+       gtk_widget_set_size_request(scrolledwin, prefs_common.compose_width, -1);
 
-       text = gtk_stext_new(gtk_scrolled_window_get_hadjustment
-                           (GTK_SCROLLED_WINDOW(scrolledwin)),
-                           gtk_scrolled_window_get_vadjustment
-                           (GTK_SCROLLED_WINDOW(scrolledwin)));
-       GTK_STEXT(text)->default_tab_width = 8;
-       gtk_stext_set_editable(GTK_STEXT(text), TRUE);
+       text = gtk_text_view_new();
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       gtk_text_view_set_editable(GTK_TEXT_VIEW(text), TRUE);
+       clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
+       gtk_text_buffer_add_selection_clipboard(buffer, clipboard);
+#warning FIXME_GTK2
+       /* GTK_STEXT(text)->default_tab_width = 8; */
 
+#warning FIXME_GTK2
+#if 0
        if (prefs_common.block_cursor) {
                GTK_STEXT(text)->cursor_type = GTK_STEXT_CURSOR_BLOCK;
        }
+#endif
        
+#warning FIXME_GTK2
+#if 0
        if (prefs_common.smart_wrapping) {      
                gtk_stext_set_word_wrap(GTK_STEXT(text), TRUE);
                gtk_stext_set_wrap_rmargin(GTK_STEXT(text), prefs_common.linewrap_len);
        }               
+#else
+       if (prefs_common.smart_wrapping) {      
+               gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
+       }               
+#endif
 
        gtk_container_add(GTK_CONTAINER(scrolledwin), text);
 
-       gtk_signal_connect(GTK_OBJECT(text), "changed",
-                          GTK_SIGNAL_FUNC(compose_changed_cb), compose);
-       gtk_signal_connect(GTK_OBJECT(text), "grab_focus",
-                          GTK_SIGNAL_FUNC(compose_grab_focus_cb), compose);
-       gtk_signal_connect(GTK_OBJECT(text), "activate",
-                          GTK_SIGNAL_FUNC(text_activated), compose);
-       gtk_signal_connect(GTK_OBJECT(text), "insert_text",
-                          GTK_SIGNAL_FUNC(text_inserted), compose);
-       gtk_signal_connect_after(GTK_OBJECT(text), "button_press_event",
-                                GTK_SIGNAL_FUNC(compose_button_press_cb),
-                                edit_vbox);
-#if 0
-       gtk_signal_connect_after(GTK_OBJECT(text), "key_press_event",
-                                GTK_SIGNAL_FUNC(compose_key_press_cb),
-                                compose);
-#endif
-       gtk_signal_connect_after(GTK_OBJECT(text), "size_allocate",
-                                GTK_SIGNAL_FUNC(compose_edit_size_alloc),
-                                ruler);
+#warning FIXME_GTK2
+#if 0 /* FIXME_GTK2 */
+       g_signal_connect(G_OBJECT(text), "activate",
+                        G_CALLBACK(text_activated), compose);
+#endif /* FIXME_GTK2 */
+
+       g_signal_connect_after(G_OBJECT(text), "size_allocate",
+                              G_CALLBACK(compose_edit_size_alloc),
+                              ruler);
+       g_signal_connect(G_OBJECT(buffer), "changed",
+                        G_CALLBACK(compose_changed_cb), compose);
+       g_signal_connect(G_OBJECT(text), "grab_focus",
+                        G_CALLBACK(compose_grab_focus_cb), compose);
+       g_signal_connect(G_OBJECT(buffer), "insert-text",
+                        G_CALLBACK(text_inserted), compose);
 
        /* drag and drop */
        gtk_drag_dest_set(text, GTK_DEST_DEFAULT_ALL, compose_mime_types, 1,
                          GDK_ACTION_COPY | GDK_ACTION_MOVE);
-       gtk_signal_connect(GTK_OBJECT(text), "drag_data_received",
-                          GTK_SIGNAL_FUNC(compose_insert_drag_received_cb),
-                          compose);
+       g_signal_connect(G_OBJECT(text), "drag_data_received",
+                        G_CALLBACK(compose_insert_drag_received_cb),
+                        compose);
        gtk_widget_show_all(vbox);
 
        /* pane between attach clist and text */
        paned = gtk_vpaned_new();
        gtk_paned_set_gutter_size(GTK_PANED(paned), 12);
-       gtk_paned_set_handle_size(GTK_PANED(paned), 12);
        gtk_container_add(GTK_CONTAINER(vbox2), paned);
        gtk_paned_add1(GTK_PANED(paned), notebook);
        gtk_paned_add2(GTK_PANED(paned), edit_vbox);
@@ -4990,6 +5093,8 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        style = gtk_widget_get_style(text);
 
        /* workaround for the slow down of GtkSText when using Pixmap theme */
+#warning FIXME_GTK2
+#if 0 /* FIXME_GTK2 */
        if (style->engine) {
                GtkThemeEngine *engine;
 
@@ -4998,14 +5103,19 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
                new_style = gtk_style_copy(style);
                style->engine = engine;
        } else
+#endif /* FIXME_GTK2 */
                new_style = gtk_style_copy(style);
 
        if (prefs_common.textfont) {
-               GdkFont *font;
-
-               if ((font = gtkut_font_load(prefs_common.textfont)) != NULL) {
-                       gdk_font_unref(new_style->font);
-                       new_style->font = font;
+               PangoFontDescription *font_desc;
+
+               font_desc = pango_font_description_from_string
+                                       (prefs_common.textfont);
+               if (font_desc) {
+                       if (new_style->font_desc)
+                               pango_font_description_free
+                                       (new_style->font_desc);
+                       new_style->font_desc = font_desc;
                }
        }
 
@@ -5248,9 +5358,9 @@ static GtkWidget *compose_account_option_menu_create(Compose *compose)
                                               ac->account_name, ac->address);
                MENUITEM_ADD(menu, menuitem, name, ac->account_id);
                g_free(name);
-               gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
-                                  GTK_SIGNAL_FUNC(account_activated),
-                                  compose);
+               g_signal_connect(G_OBJECT(menuitem), "activate",
+                                G_CALLBACK(account_activated),
+                                compose);
        }
 
        gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
@@ -5348,11 +5458,11 @@ static void compose_set_template_menu(Compose *compose)
                Template *tmpl = (Template *)cur->data;
 
                item = gtk_menu_item_new_with_label(tmpl->name);
-               gtk_menu_append(GTK_MENU(menu), item);
-               gtk_signal_connect(GTK_OBJECT(item), "activate",
-                                  GTK_SIGNAL_FUNC(compose_template_activate_cb),
-                                  compose);
-               gtk_object_set_data(GTK_OBJECT(item), "template", tmpl);
+               gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+               g_signal_connect(G_OBJECT(item), "activate",
+                                G_CALLBACK(compose_template_activate_cb),
+                                compose);
+               g_object_set_data(G_OBJECT(item), "template", tmpl);
                gtk_widget_show(item);
        }
 
@@ -5385,12 +5495,17 @@ void compose_reflect_prefs_pixmap_theme(void)
 static void compose_template_apply(Compose *compose, Template *tmpl,
                                   gboolean replace)
 {
+       GtkTextView *text;
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter iter;
        gchar *qmark;
        gchar *parsed_str;
 
        if (!tmpl || !tmpl->value) return;
 
-       gtk_stext_freeze(GTK_STEXT(compose->text));
+       text = GTK_TEXT_VIEW(compose->text);
+       buffer = gtk_text_view_get_buffer(text);
 
        if (tmpl->subject && *tmpl->subject != '\0')
                gtk_entry_set_text(GTK_ENTRY(compose->subject_entry),
@@ -5404,7 +5519,10 @@ static void compose_template_apply(Compose *compose, Template *tmpl,
                compose_entry_append(compose, tmpl->bcc, COMPOSE_BCC);
 
        if (replace)
-               gtkut_stext_clear(GTK_STEXT(compose->text));
+               gtk_text_buffer_set_text(buffer, "\0", 1);
+
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
 
        if ((compose->replyinfo == NULL) && (compose->fwdinfo == NULL)) {
                parsed_str = compose_quote_fmt(compose, NULL, tmpl->value,
@@ -5429,14 +5547,12 @@ static void compose_template_apply(Compose *compose, Template *tmpl,
                compose_insert_sig(compose, FALSE);
 
        if (replace && parsed_str) {
-               gtk_editable_set_position(GTK_EDITABLE(compose->text), 0);
-               gtk_stext_set_point(GTK_STEXT(compose->text), 0);
+               gtk_text_buffer_get_start_iter(buffer, &iter);
+               gtk_text_buffer_place_cursor(buffer, &iter);
        }
 
        if (parsed_str)
                compose_changed_cb(NULL, compose);
-
-       gtk_stext_thaw(GTK_STEXT(compose->text));
 }
 
 static void compose_destroy(Compose *compose)
@@ -5576,6 +5692,7 @@ static void compose_attach_property(Compose *compose)
                           ainfo->name ? ainfo->name : "");
 
        for (;;) {
+               const gchar *entry_text;
                gchar *text;
                gchar *cnttype = NULL;
                gchar *file = NULL;
@@ -5591,11 +5708,11 @@ static void compose_attach_property(Compose *compose)
                        break;
                }
 
-               text = gtk_entry_get_text(GTK_ENTRY(attach_prop.mimetype_entry));
-               if (*text != '\0') {
+               entry_text = gtk_entry_get_text(GTK_ENTRY(attach_prop.mimetype_entry));
+               if (*entry_text != '\0') {
                        gchar *p;
 
-                       text = g_strstrip(g_strdup(text));
+                       text = g_strstrip(g_strdup(entry_text));
                        if ((p = strchr(text, '/')) && !strchr(p + 1, '/')) {
                                cnttype = g_strdup(text);
                                g_free(text);
@@ -5609,13 +5726,13 @@ static void compose_attach_property(Compose *compose)
                menu = gtk_option_menu_get_menu(optmenu);
                menuitem = gtk_menu_get_active(GTK_MENU(menu));
                ainfo->encoding = GPOINTER_TO_INT
-                       (gtk_object_get_user_data(GTK_OBJECT(menuitem)));
+                       (g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
 
-               text = gtk_entry_get_text(GTK_ENTRY(attach_prop.path_entry));
-               if (*text != '\0') {
-                       if (is_file_exist(text) &&
-                           (size = get_file_size(text)) > 0)
-                               file = g_strdup(text);
+               entry_text = gtk_entry_get_text(GTK_ENTRY(attach_prop.path_entry));
+               if (*entry_text != '\0') {
+                       if (is_file_exist(entry_text) &&
+                           (size = get_file_size(entry_text)) > 0)
+                               file = g_strdup(entry_text);
                        else {
                                alertpanel_error
                                        (_("File doesn't exist or is empty."));
@@ -5624,10 +5741,10 @@ static void compose_attach_property(Compose *compose)
                        }
                }
 
-               text = gtk_entry_get_text(GTK_ENTRY(attach_prop.filename_entry));
-               if (*text != '\0') {
+               entry_text = gtk_entry_get_text(GTK_ENTRY(attach_prop.filename_entry));
+               if (*entry_text != '\0') {
                        g_free(ainfo->name);
-                       ainfo->name = g_strdup(text);
+                       ainfo->name = g_strdup(entry_text);
                }
 
                if (cnttype) {
@@ -5684,18 +5801,18 @@ static void compose_attach_property_create(gboolean *cancelled)
 
        debug_print("Creating attach_property window...\n");
 
-       window = gtk_window_new(GTK_WINDOW_DIALOG);
-       gtk_widget_set_usize(window, 480, -1);
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       gtk_widget_set_size_request(window, 480, -1);
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
        gtk_window_set_title(GTK_WINDOW(window), _("Properties"));
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
        gtk_window_set_modal(GTK_WINDOW(window), TRUE);
-       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
-                          GTK_SIGNAL_FUNC(attach_property_delete_event),
-                          cancelled);
-       gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
-                          GTK_SIGNAL_FUNC(attach_property_key_pressed),
-                          cancelled);
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(attach_property_delete_event),
+                        cancelled);
+       g_signal_connect(G_OBJECT(window), "key_press_event",
+                        G_CALLBACK(attach_property_key_pressed),
+                        cancelled);
 
        vbox = gtk_vbox_new(FALSE, 8);
        gtk_container_add(GTK_CONTAINER(window), vbox);
@@ -5771,12 +5888,12 @@ static void compose_attach_property_create(gboolean *cancelled)
        gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
        gtk_widget_grab_default(ok_btn);
 
-       gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
-                          GTK_SIGNAL_FUNC(attach_property_ok),
-                          cancelled);
-       gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked",
-                          GTK_SIGNAL_FUNC(attach_property_cancel),
-                          cancelled);
+       g_signal_connect(G_OBJECT(ok_btn), "clicked",
+                        G_CALLBACK(attach_property_ok),
+                        cancelled);
+       g_signal_connect(G_OBJECT(cancel_btn), "clicked",
+                        G_CALLBACK(attach_property_cancel),
+                        cancelled);
 
        gtk_widget_show_all(vbox);
 
@@ -5812,13 +5929,15 @@ static gint attach_property_delete_event(GtkWidget *widget, GdkEventAny *event,
        return TRUE;
 }
 
-static void attach_property_key_pressed(GtkWidget *widget, GdkEventKey *event,
-                                       gboolean *cancelled)
+static gboolean attach_property_key_pressed(GtkWidget *widget,
+                                           GdkEventKey *event,
+                                           gboolean *cancelled)
 {
        if (event && event->keyval == GDK_Escape) {
                *cancelled = TRUE;
                gtk_main_quit();
        }
+       return FALSE;
 }
 
 static void compose_exec_ext_editor(Compose *compose)
@@ -6000,14 +6119,12 @@ static void compose_input_cb(gpointer data, gint source,
        waitpid(compose->exteditor_pid, NULL, 0);
 
        if (buf[0] == '0') {            /* success */
-               GtkSText *text = GTK_STEXT(compose->text);
+               GtkTextView *text = GTK_TEXT_VIEW(compose->text);
+               GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
 
-               gtk_stext_freeze(text);
-               gtk_stext_set_point(text, 0);
-               gtk_stext_forward_delete(text, gtk_stext_get_length(text));
+               gtk_text_buffer_set_text(buffer, "\0", 1);
                compose_insert_file(compose, compose->exteditor_file);
                compose_changed_cb(NULL, compose);
-               gtk_stext_thaw(text);
 
                if (unlink(compose->exteditor_file) < 0)
                        FILE_OP_ERROR(compose->exteditor_file, "unlink");
@@ -6127,14 +6244,10 @@ static void compose_undo_state_changed(UndoMain *undostruct, gint undo_state,
        }
 }
 
-static gint calc_cursor_xpos(GtkSText *text, gint extra, gint char_width)
+static gint calc_cursor_xpos(GtkTextView *text, gint extra, gint char_width)
 {
-       gint cursor_pos;
-
-       cursor_pos = (text->cursor_pos_x - extra) / char_width;
-       cursor_pos = MAX(cursor_pos, 0);
-
-       return cursor_pos;
+#warning FIXME_GTK2
+       return 0;
 }
 
 /* callback functions */
@@ -6148,18 +6261,18 @@ static gboolean compose_edit_size_alloc(GtkEditable *widget,
                                        GtkSHRuler *shruler)
 {
        if (prefs_common.show_ruler) {
-               gint char_width;
+               gint char_width = 0, char_height = 0;
                gint line_width_in_chars;
 
-               char_width = gtkut_get_font_width
-                       (GTK_WIDGET(widget)->style->font);
+               gtkut_get_font_size(GTK_WIDGET(widget),
+                                   &char_width, &char_height);
                line_width_in_chars =
                        (allocation->width - allocation->x) / char_width;
 
                /* got the maximum */
                gtk_ruler_set_range(GTK_RULER(shruler),
                                    0.0, line_width_in_chars,
-                                   calc_cursor_xpos(GTK_STEXT(widget),
+                                   calc_cursor_xpos(GTK_TEXT_VIEW(widget),
                                                     allocation->x,
                                                     char_width),
                                    /*line_width_in_chars*/ char_width);
@@ -6191,14 +6304,14 @@ static void attach_selected(GtkCList *clist, gint row, gint column,
                compose_attach_property(compose);
 }
 
-static void attach_button_pressed(GtkWidget *widget, GdkEventButton *event,
-                                 gpointer data)
+static gboolean attach_button_pressed(GtkWidget *widget, GdkEventButton *event,
+                                     gpointer data)
 {
        Compose *compose = (Compose *)data;
        GtkCList *clist = GTK_CLIST(compose->attach_clist);
        gint row, column;
 
-       if (!event) return;
+       if (!event) return FALSE;
 
        if (event->button == 3) {
                if ((clist->selection && !clist->selection->next) ||
@@ -6214,20 +6327,23 @@ static void attach_button_pressed(GtkWidget *widget, GdkEventButton *event,
                gtk_menu_popup(GTK_MENU(compose->popupmenu), NULL, NULL,
                               NULL, NULL, event->button, event->time);
        }
+
+       return FALSE;
 }
 
-static void attach_key_pressed(GtkWidget *widget, GdkEventKey *event,
-                              gpointer data)
+static gboolean attach_key_pressed(GtkWidget *widget, GdkEventKey *event,
+                                  gpointer data)
 {
        Compose *compose = (Compose *)data;
 
-       if (!event) return;
+       if (!event) return FALSE;
 
        switch (event->keyval) {
        case GDK_Delete:
                compose_attach_remove_selected(compose);
                break;
        }
+       return FALSE;
 }
 
 static void compose_allow_user_actions (Compose *compose, gboolean allow)
@@ -6467,7 +6583,7 @@ static void compose_template_activate_cb(GtkWidget *widget, gpointer data)
        gchar *msg;
        AlertValue val;
 
-       tmpl = gtk_object_get_data(GTK_OBJECT(widget), "template");
+       tmpl = g_object_get_data(G_OBJECT(widget), "template");
        g_return_if_fail(tmpl != NULL);
 
        msg = g_strdup_printf(_("Do you want to apply the template `%s' ?"),
@@ -6558,44 +6674,299 @@ static void compose_allsel_cb(Compose *compose)
                        (GTK_EDITABLE(compose->focused_editable), 0, -1);
 }
 
-static void compose_gtk_stext_action_cb(Compose *compose,
-                                       ComposeCallGtkSTextAction action)
+static void textview_move_beginning_of_line (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+       gtk_text_iter_set_line_offset(&ins, 0);
+       gtk_text_buffer_place_cursor(buffer, &ins);
+}
+
+static void textview_move_forward_character (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+       if (gtk_text_iter_forward_cursor_position(&ins))
+               gtk_text_buffer_place_cursor(buffer, &ins);
+}
+
+static void textview_move_backward_character (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+       if (gtk_text_iter_backward_cursor_position(&ins))
+               gtk_text_buffer_place_cursor(buffer, &ins);
+}
+
+static void textview_move_forward_word (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins;
+       gint count;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+       count = gtk_text_iter_inside_word (&ins) ? 2 : 1;
+       if (gtk_text_iter_forward_word_ends(&ins, count)) {
+               gtk_text_iter_backward_word_start(&ins);
+               gtk_text_buffer_place_cursor(buffer, &ins);
+       }
+}
+
+static void textview_move_backward_word (GtkTextView *text)
 {
-       GtkSText *text = GTK_STEXT(compose->text);
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins;
+       gint count;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+       count = gtk_text_iter_inside_word (&ins) ? 2 : 1;
+       if (gtk_text_iter_backward_word_starts(&ins, 1))
+               gtk_text_buffer_place_cursor(buffer, &ins);
+}
+
+static void textview_move_end_of_line (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+       if (gtk_text_iter_forward_to_line_end(&ins))
+               gtk_text_buffer_place_cursor(buffer, &ins);
+}
+
+static void textview_move_next_line (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins;
+       gint offset;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+#warning FIXME_GTK2 /* should regist current line offset */
+       offset = gtk_text_iter_get_line_offset(&ins);
+       if (gtk_text_iter_forward_line(&ins)) {
+               gtk_text_iter_set_line_offset(&ins, offset);
+               gtk_text_buffer_place_cursor(buffer, &ins);
+       }
+}
+
+static void textview_move_previous_line (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins;
+       gint offset;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+#warning FIXME_GTK2 /* should regist current line offset */
+       offset = gtk_text_iter_get_line_offset(&ins);
+       if (gtk_text_iter_backward_line(&ins)) {
+               gtk_text_iter_set_line_offset(&ins, offset);
+               gtk_text_buffer_place_cursor(buffer, &ins);
+       }
+}
+
+static void textview_delete_forward_character (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins, end_iter;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+       end_iter = ins;
+       if (gtk_text_iter_forward_char(&end_iter)) {
+               gtk_text_buffer_delete(buffer, &ins, &end_iter);
+       }
+}
+
+static void textview_delete_backward_character (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins, end_iter;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+       end_iter = ins;
+       if (gtk_text_iter_backward_char(&end_iter)) {
+               gtk_text_buffer_delete(buffer, &end_iter, &ins);
+       }
+}
+
+static void textview_delete_forward_word (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins, end_iter;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+       end_iter = ins;
+       if (gtk_text_iter_forward_word_end(&end_iter)) {
+               gtk_text_buffer_delete(buffer, &ins, &end_iter);
+       }
+}
+
+static void textview_delete_backward_word (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins, end_iter;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+       end_iter = ins;
+       if (gtk_text_iter_backward_word_start(&end_iter)) {
+               gtk_text_buffer_delete(buffer, &end_iter, &ins);
+       }
+}
+
+static void textview_delete_line (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins, start_iter, end_iter;
+       gboolean found;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+
+       start_iter = ins;
+       gtk_text_iter_set_line_offset(&start_iter, 0);
+
+       end_iter = ins;
+       if (gtk_text_iter_ends_line(&end_iter))
+               found = gtk_text_iter_forward_char(&end_iter);
+       else
+               found = gtk_text_iter_forward_to_line_end(&end_iter);
+
+       if (found)
+               gtk_text_buffer_delete(buffer, &start_iter, &end_iter);
+}
+
+static void textview_delete_to_line_end (GtkTextView *text)
+{
+       GtkTextBuffer *buffer;
+       GtkTextMark *mark;
+       GtkTextIter ins, end_iter;
+       gboolean found;
+
+       g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+
+       buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+       mark = gtk_text_buffer_get_insert(buffer);
+       gtk_text_buffer_get_iter_at_mark(buffer, &ins, mark);
+       end_iter = ins;
+       if (gtk_text_iter_ends_line(&end_iter))
+               found = gtk_text_iter_forward_char(&end_iter);
+       else
+               found = gtk_text_iter_forward_to_line_end(&end_iter);
+       if (found)
+               gtk_text_buffer_delete(buffer, &ins, &end_iter);
+}
+
+static void compose_advanced_action_cb(Compose *compose,
+                                       ComposeCallAdvancedAction action)
+{
+       GtkTextView *text = GTK_TEXT_VIEW(compose->text);
        static struct {
-               void (*do_action) (GtkSText *text);
+               void (*do_action) (GtkTextView *text);
        } action_table[] = {
-               {gtk_stext_move_beginning_of_line},
-               {gtk_stext_move_forward_character},
-               {gtk_stext_move_backward_character},
-               {gtk_stext_move_forward_word},
-               {gtk_stext_move_backward_word},
-               {gtk_stext_move_end_of_line},
-               {gtk_stext_move_next_line},
-               {gtk_stext_move_previous_line},
-               {gtk_stext_delete_forward_character},
-               {gtk_stext_delete_backward_character},
-               {gtk_stext_delete_forward_word},
-               {gtk_stext_delete_backward_word},
-               {gtk_stext_delete_line},
-               {gtk_stext_delete_line}, /* gtk_stext_delete_line_n */
-               {gtk_stext_delete_to_line_end}
+               {textview_move_beginning_of_line},
+               {textview_move_forward_character},
+               {textview_move_backward_character},
+               {textview_move_forward_word},
+               {textview_move_backward_word},
+               {textview_move_end_of_line},
+               {textview_move_next_line},
+               {textview_move_previous_line},
+               {textview_delete_forward_character},
+               {textview_delete_backward_character},
+               {textview_delete_forward_word},
+               {textview_delete_backward_word},
+               {textview_delete_line},
+               {NULL}, /* gtk_stext_delete_line_n */
+               {textview_delete_to_line_end}
        };
 
        if (!GTK_WIDGET_HAS_FOCUS(text)) return;
 
-       if (action >= COMPOSE_CALL_GTK_STEXT_MOVE_BEGINNING_OF_LINE &&
-           action <= COMPOSE_CALL_GTK_STEXT_DELETE_TO_LINE_END)
-               action_table[action].do_action(text);
+       if (action >= COMPOSE_CALL_ADVANCED_ACTION_MOVE_BEGINNING_OF_LINE &&
+           action <= COMPOSE_CALL_ADVANCED_ACTION_DELETE_TO_LINE_END) {
+               if (action_table[action].do_action)
+                       action_table[action].do_action(text);
+               else
+                       g_warning("Not implemented yet.");
+       }
 }
 
 static void compose_grab_focus_cb(GtkWidget *widget, Compose *compose)
 {
-       if (GTK_IS_EDITABLE(widget))
+       if (GTK_IS_EDITABLE(widget) || GTK_IS_TEXT_VIEW(widget))
                compose->focused_editable = widget;
 }
 
-static void compose_changed_cb(GtkEditable *editable, Compose *compose)
+static void compose_changed_cb(GtkTextBuffer *textbuf, Compose *compose)
 {
        if (compose->modified == FALSE) {
                compose->modified = TRUE;
@@ -6603,22 +6974,6 @@ static void compose_changed_cb(GtkEditable *editable, Compose *compose)
        }
 }
 
-static void compose_button_press_cb(GtkWidget *widget, GdkEventButton *event,
-                                   Compose *compose)
-{
-       gtk_stext_set_point(GTK_STEXT(widget),
-                          gtk_editable_get_position(GTK_EDITABLE(widget)));
-}
-
-#if 0
-static void compose_key_press_cb(GtkWidget *widget, GdkEventKey *event,
-                                Compose *compose)
-{
-       gtk_stext_set_point(GTK_STEXT(widget),
-                          gtk_editable_get_position(GTK_EDITABLE(widget)));
-}
-#endif
-
 #if 0 /* NEW COMPOSE GUI */
 static void compose_toggle_to_cb(gpointer data, guint action,
                                 GtkWidget *widget)
@@ -7007,47 +7362,47 @@ static void text_activated(GtkWidget *widget, Compose *compose)
        compose_send_control_enter(compose);
 }
 
-static void text_inserted(GtkWidget *widget, const gchar *text,
-                         gint length, gint *position, Compose *compose)
+static void text_inserted(GtkTextBuffer *buffer, GtkTextIter *iter,
+                         const gchar *text, gint len, Compose *compose)
 {
-       GtkEditable *editable = GTK_EDITABLE(widget);
-       gint paste_as_quotation = GPOINTER_TO_INT(gtk_object_get_data
-                               (GTK_OBJECT(widget), "paste_as_quotation"));
+       g_return_if_fail(text);
+
+       gint paste_as_quotation = GPOINTER_TO_INT(g_object_get_data
+                               (G_OBJECT(compose->text), "paste_as_quotation"));
 
-       gtk_signal_handler_block_by_func(GTK_OBJECT(widget),
-                                        GTK_SIGNAL_FUNC(text_inserted),
-                                        compose);
+       g_signal_handlers_block_by_func(G_OBJECT(buffer),
+                                       G_CALLBACK(text_inserted),
+                                       compose);
        if (paste_as_quotation) {
                gchar *new_text;
                gchar *qmark;
-               gint pos;
 
-               new_text = g_strndup(text, length);
+               if (len < 0)
+                       len = strlen(text);
+
+               new_text = g_strndup(text, len);
                if (prefs_common.quotemark && *prefs_common.quotemark)
                        qmark = prefs_common.quotemark;
                else
                        qmark = "> ";
-               gtk_stext_set_point(GTK_STEXT(widget), *position);
+               gtk_text_buffer_place_cursor(buffer, iter);
                compose_quote_fmt(compose, NULL, "%Q", qmark, new_text);
-               pos = gtk_stext_get_point(GTK_STEXT(widget));
-               gtk_editable_set_position(editable, pos);
-               *position = pos;
                g_free(new_text);
-               gtk_object_set_data(GTK_OBJECT(widget), "paste_as_quotation",
-                                   GINT_TO_POINTER(paste_as_quotation - 1));
+               g_object_set_data(G_OBJECT(compose->text), "paste_as_quotation",
+                                 GINT_TO_POINTER(paste_as_quotation - 1));
        } else
-               gtk_editable_insert_text(editable, text, length, position);
+               gtk_text_buffer_insert(buffer, iter, text, len);
 
        if (prefs_common.autowrap)
                compose_wrap_line_all_full(compose, TRUE);
 
-       gtk_signal_handler_unblock_by_func(GTK_OBJECT(widget),
-                                          GTK_SIGNAL_FUNC(text_inserted),
-                                          compose);
-       gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert_text");
+       g_signal_handlers_unblock_by_func(G_OBJECT(buffer),
+                                         G_CALLBACK(text_inserted),
+                                         compose);
+       g_signal_stop_emission_by_name(G_OBJECT(buffer), "insert-text");
 
        if (prefs_common.autosave && 
-           gtk_stext_get_length(GTK_STEXT(widget)) % prefs_common.autosave_length == 0)
+           gtk_text_buffer_get_char_count(buffer) % prefs_common.autosave_length == 0)
                gtk_timeout_add(500, (GtkFunction) compose_defer_auto_save_draft, compose);
 }
 
@@ -7062,7 +7417,7 @@ static gboolean compose_send_control_enter(Compose *compose)
        GdkEvent *ev;
        GdkEventKey *kev;
        GtkItemFactory *ifactory;
-       GtkAccelEntry *accel;
+       GtkAccelKey *accel;
        GtkWidget *send_menu;
        GSList *list;
        GdkModifierType ignored_mods =
@@ -7078,13 +7433,13 @@ static gboolean compose_send_control_enter(Compose *compose)
 
        ifactory = gtk_item_factory_from_widget(compose->menubar);
        send_menu = gtk_item_factory_get_widget(ifactory, "/Message/Send");
-       list = gtk_accel_group_entries_from_object(GTK_OBJECT(send_menu));
+       list = gtk_accel_groups_from_object(G_OBJECT(send_menu));
        if (!list)
                return FALSE;
 
-       accel = (GtkAccelEntry *)list->data;
-       if (accel && accel->accelerator_key == kev->keyval &&
-           (accel->accelerator_mods & ~ignored_mods) ==
+       accel = (GtkAccelKey *)list->data;
+       if (accel && accel->accel_key == kev->keyval &&
+           (accel->accel_mods & ~ignored_mods) ==
            (kev->state & ~ignored_mods)) {
                compose_send_cb(compose, 0, NULL);
                return TRUE;
index 7a1db31..a85dfa9 100644 (file)
@@ -218,6 +218,8 @@ struct _AttachInfo
        off_t size;
 };
 
+/*#warning FIXME_GTK2 */
+/* attache_files will be locale encode */
 Compose *compose_new                   (PrefsAccount   *account,
                                         const gchar    *mailto,
                                         GPtrArray      *attach_files);
index 10e1be6..64bb69a 100644 (file)
@@ -126,11 +126,12 @@ static gint edit_person_delete_event(GtkWidget *widget, GdkEventAny *event, gboo
        return TRUE;
 }
 
-static void edit_person_key_pressed(GtkWidget *widget, GdkEventKey *event, gboolean *cancelled) {
+static gboolean edit_person_key_pressed(GtkWidget *widget, GdkEventKey *event, gboolean *cancelled) {
        if (event && event->keyval == GDK_Escape) {
                *cancelled = TRUE;
                gtk_main_quit();
        }
+       return FALSE;
 }
 
 static gchar *_title_new_ = NULL;
@@ -474,18 +475,18 @@ static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
        GtkWidget *hsbox;
        GtkWidget *statusbar;
 
-       window = gtk_window_new(GTK_WINDOW_DIALOG);
-       gtk_widget_set_usize(window, EDITPERSON_WIDTH, EDITPERSON_HEIGHT );
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       gtk_widget_set_size_request(window, EDITPERSON_WIDTH, EDITPERSON_HEIGHT );
        /* gtk_container_set_border_width(GTK_CONTAINER(window), 0); */
        gtk_window_set_title(GTK_WINDOW(window), _("Edit Person Data"));
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
        gtk_window_set_modal(GTK_WINDOW(window), TRUE); 
-       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
-                          GTK_SIGNAL_FUNC(edit_person_delete_event),
-                          cancelled);
-       gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
-                          GTK_SIGNAL_FUNC(edit_person_key_pressed),
-                          cancelled);
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(edit_person_delete_event),
+                        cancelled);
+       g_signal_connect(G_OBJECT(window), "key_press_event",
+                        G_CALLBACK(edit_person_key_pressed),
+                        cancelled);
 
        vbox = gtk_vbox_new(FALSE, 4);
        /* gtk_container_set_border_width(GTK_CONTAINER(vbox), BORDER_WIDTH); */
@@ -515,12 +516,12 @@ static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
        gtk_box_pack_end(GTK_BOX(vnbox), hbbox, FALSE, FALSE, 0);
        gtk_widget_grab_default(ok_btn);
 
-       gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
-                          GTK_SIGNAL_FUNC(edit_person_ok), cancelled);
-       gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked",
-                          GTK_SIGNAL_FUNC(edit_person_cancel), cancelled);
-       gtk_signal_connect(GTK_OBJECT(notebook), "switch_page",
-                          GTK_SIGNAL_FUNC(edit_person_switch_page), NULL );
+       g_signal_connect(G_OBJECT(ok_btn), "clicked",
+                        G_CALLBACK(edit_person_ok), cancelled);
+       g_signal_connect(G_OBJECT(cancel_btn), "clicked",
+                        G_CALLBACK(edit_person_cancel), cancelled);
+       g_signal_connect(G_OBJECT(notebook), "switch_page",
+                        G_CALLBACK(edit_person_switch_page), NULL );
 
        gtk_widget_show_all(vbox);
 
@@ -702,7 +703,7 @@ static void addressbook_edit_person_page_email( gint pageNum, gchar *pageLbl ) {
 
        vbuttonbox = gtk_vbutton_box_new();
        gtk_button_box_set_layout( GTK_BUTTON_BOX(vbuttonbox), GTK_BUTTONBOX_START );
-       gtk_button_box_set_spacing( GTK_BUTTON_BOX(vbuttonbox), 8 );
+       gtk_box_set_spacing( GTK_BOX(vbuttonbox), 8 );
        gtk_container_set_border_width( GTK_CONTAINER(vbuttonbox), 4 );
        gtk_container_add( GTK_CONTAINER(vboxb), vbuttonbox );
 
@@ -728,20 +729,20 @@ static void addressbook_edit_person_page_email( gint pageNum, gchar *pageLbl ) {
        gtk_widget_show_all(vbox);
 
        /* Event handlers */
-       gtk_signal_connect( GTK_OBJECT(clist), "select_row",
-                       GTK_SIGNAL_FUNC( edit_person_email_list_selected), NULL );
-       gtk_signal_connect( GTK_OBJECT(buttonUp), "clicked",
-                       GTK_SIGNAL_FUNC( edit_person_email_move_up ), NULL );
-       gtk_signal_connect( GTK_OBJECT(buttonDown), "clicked",
-                       GTK_SIGNAL_FUNC( edit_person_email_move_down ), NULL );
-       gtk_signal_connect( GTK_OBJECT(buttonDel), "clicked",
-                       GTK_SIGNAL_FUNC( edit_person_email_delete ), NULL );
-       gtk_signal_connect( GTK_OBJECT(buttonMod), "clicked",
-                       GTK_SIGNAL_FUNC( edit_person_email_modify ), NULL );
-       gtk_signal_connect( GTK_OBJECT(buttonAdd), "clicked",
-                       GTK_SIGNAL_FUNC( edit_person_email_add ), NULL );
-       gtk_signal_connect( GTK_OBJECT(buttonClr), "clicked",
-                       GTK_SIGNAL_FUNC( edit_person_email_clear ), NULL );
+       g_signal_connect( G_OBJECT(clist), "select_row",
+                         G_CALLBACK( edit_person_email_list_selected), NULL );
+       g_signal_connect( G_OBJECT(buttonUp), "clicked",
+                         G_CALLBACK( edit_person_email_move_up ), NULL );
+       g_signal_connect( G_OBJECT(buttonDown), "clicked",
+                         G_CALLBACK( edit_person_email_move_down ), NULL );
+       g_signal_connect( G_OBJECT(buttonDel), "clicked",
+                         G_CALLBACK( edit_person_email_delete ), NULL );
+       g_signal_connect( G_OBJECT(buttonMod), "clicked",
+                         G_CALLBACK( edit_person_email_modify ), NULL );
+       g_signal_connect( G_OBJECT(buttonAdd), "clicked",
+                         G_CALLBACK( edit_person_email_add ), NULL );
+       g_signal_connect( G_OBJECT(buttonClr), "clicked",
+                         G_CALLBACK( edit_person_email_clear ), NULL );
 
        personeditdlg.clist_email   = clist;
        personeditdlg.entry_email   = entry_email;
@@ -842,7 +843,7 @@ static void addressbook_edit_person_page_attrib( gint pageNum, gchar *pageLbl )
 
        vbuttonbox = gtk_vbutton_box_new();
        gtk_button_box_set_layout( GTK_BUTTON_BOX(vbuttonbox), GTK_BUTTONBOX_START );
-       gtk_button_box_set_spacing( GTK_BUTTON_BOX(vbuttonbox), 8 );
+       gtk_box_set_spacing( GTK_BOX(vbuttonbox), 8 );
        gtk_container_set_border_width( GTK_CONTAINER(vbuttonbox), 4 );
        gtk_container_add( GTK_CONTAINER(vboxb), vbuttonbox );
 
@@ -862,16 +863,16 @@ static void addressbook_edit_person_page_attrib( gint pageNum, gchar *pageLbl )
        gtk_widget_show_all(vbox);
 
        /* Event handlers */
-       gtk_signal_connect( GTK_OBJECT(clist), "select_row",
-                       GTK_SIGNAL_FUNC( edit_person_attrib_list_selected), NULL );
-       gtk_signal_connect( GTK_OBJECT(buttonDel), "clicked",
-                       GTK_SIGNAL_FUNC( edit_person_attrib_delete ), NULL );
-       gtk_signal_connect( GTK_OBJECT(buttonMod), "clicked",
-                       GTK_SIGNAL_FUNC( edit_person_attrib_modify ), NULL );
-       gtk_signal_connect( GTK_OBJECT(buttonAdd), "clicked",
-                       GTK_SIGNAL_FUNC( edit_person_attrib_add ), NULL );
-       gtk_signal_connect( GTK_OBJECT(buttonClr), "clicked",
-                       GTK_SIGNAL_FUNC( edit_person_attrib_clear ), NULL );
+       g_signal_connect( G_OBJECT(clist), "select_row",
+                         G_CALLBACK( edit_person_attrib_list_selected), NULL );
+       g_signal_connect( G_OBJECT(buttonDel), "clicked",
+                         G_CALLBACK( edit_person_attrib_delete ), NULL );
+       g_signal_connect( G_OBJECT(buttonMod), "clicked",
+                         G_CALLBACK( edit_person_attrib_modify ), NULL );
+       g_signal_connect( G_OBJECT(buttonAdd), "clicked",
+                         G_CALLBACK( edit_person_attrib_add ), NULL );
+       g_signal_connect( G_OBJECT(buttonClr), "clicked",
+                         G_CALLBACK( edit_person_attrib_clear ), NULL );
 
        personeditdlg.clist_attrib  = clist;
        personeditdlg.entry_atname  = entry_name;
@@ -968,10 +969,10 @@ ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent, I
 
        /* Select appropriate start page */
        if( pgMail ) {
-               gtk_notebook_set_page( GTK_NOTEBOOK(personeditdlg.notebook), PAGE_EMAIL );
+               gtk_notebook_set_current_page( GTK_NOTEBOOK(personeditdlg.notebook), PAGE_EMAIL );
        }
        else {
-               gtk_notebook_set_page( GTK_NOTEBOOK(personeditdlg.notebook), PAGE_BASIC );
+               gtk_notebook_set_current_page( GTK_NOTEBOOK(personeditdlg.notebook), PAGE_BASIC );
        }
 
        gtk_clist_select_row( GTK_CLIST(personeditdlg.clist_email), 0, 0 );
index 5184005..9b5d9c8 100644 (file)
@@ -95,11 +95,12 @@ static gint edit_book_delete_event( GtkWidget *widget, GdkEventAny *event, gbool
        return TRUE;
 }
 
-static void edit_book_key_pressed( GtkWidget *widget, GdkEventKey *event, gboolean *cancelled ) {
+static gboolean edit_book_key_pressed( GtkWidget *widget, GdkEventKey *event, gboolean *cancelled ) {
        if (event && event->keyval == GDK_Escape) {
                *cancelled = TRUE;
                gtk_main_quit();
        }
+       return FALSE;
 }
 
 static void edit_book_file_check( void ) {
@@ -146,18 +147,18 @@ static void addressbook_edit_book_create( gboolean *cancelled ) {
        GtkWidget *hsbox;
        gint top;
 
-       window = gtk_window_new(GTK_WINDOW_DIALOG);
-       gtk_widget_set_usize(window, 450, -1);
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       gtk_widget_set_size_request(window, 450, -1);
        gtk_container_set_border_width( GTK_CONTAINER(window), 0 );
        gtk_window_set_title(GTK_WINDOW(window), _("Edit Addressbook"));
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
        gtk_window_set_modal(GTK_WINDOW(window), TRUE); 
-       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
-                          GTK_SIGNAL_FUNC(edit_book_delete_event),
-                          cancelled);
-       gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
-                          GTK_SIGNAL_FUNC(edit_book_key_pressed),
-                          cancelled);
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(edit_book_delete_event),
+                        cancelled);
+       g_signal_connect(G_OBJECT(window), "key_press_event",
+                        G_CALLBACK(edit_book_key_pressed),
+                        cancelled);
 
        vbox = gtk_vbox_new(FALSE, 8);
        gtk_container_add(GTK_CONTAINER(window), vbox);
@@ -210,16 +211,16 @@ static void addressbook_edit_book_create( gboolean *cancelled ) {
        hsep = gtk_hseparator_new();
        gtk_box_pack_end(GTK_BOX(vbox), hsep, FALSE, FALSE, 0);
 
-       gtk_signal_connect(GTK_OBJECT(name_entry), "focus_in_event",
-                          GTK_SIGNAL_FUNC(edit_book_name_focus), NULL );
-       gtk_signal_connect(GTK_OBJECT(ok_btn), "clicked",
-                          GTK_SIGNAL_FUNC(edit_book_ok), cancelled);
-       gtk_signal_connect(GTK_OBJECT(cancel_btn), "clicked",
-                          GTK_SIGNAL_FUNC(edit_book_cancel), cancelled);
-/*     gtk_signal_connect(GTK_OBJECT(file_btn), "clicked", */
-/*                        GTK_SIGNAL_FUNC(edit_book_file_select), NULL); */
-       gtk_signal_connect(GTK_OBJECT(check_btn), "clicked",
-                          GTK_SIGNAL_FUNC(edit_book_file_check), NULL);
+       g_signal_connect(G_OBJECT(name_entry), "focus_in_event",
+                        G_CALLBACK(edit_book_name_focus), NULL );
+       g_signal_connect(G_OBJECT(ok_btn), "clicked",
+                        G_CALLBACK(edit_book_ok), cancelled);
+       g_signal_connect(G_OBJECT(cancel_btn), "clicked",
+                        G_CALLBACK(edit_book_cancel), cancelled);
+/*     g_signal_connect(G_OBJECT(file_btn), "clicked", */
+/*                      G_CALLBACK(edit_book_file_select), NULL); */
+       g_signal_connect(G_OBJECT(check_btn), "clicked",
+                        G_CALLBACK(edit_book_file_check), NULL);
 
        gtk_widget_show_all(vbox);
 
index a86bbf9..e5a7406 100644 (file)
@@ -116,11 +116,12 @@ static gint edit_group_delete_event(GtkWidget *widget, GdkEventAny *event, gbool
        return TRUE;
 }
 
-static void edit_group_key_pressed(GtkWidget *widget, GdkEventKey *event, gboolean *cancelled) {
+static gboolean edit_group_key_pressed(GtkWidget *widget, GdkEventKey *event, gboolean *cancelled) {
        if (event && event->keyval == GDK_Escape) {
                *cancelled = TRUE;
                gtk_main_quit();
        }
+       return FALSE;
 }
 
 static gchar *edit_group_format_item_clist( ItemPerson *person, ItemEMail *email ) {
@@ -197,22 +198,24 @@ static void edit_group_to_avail( GtkWidget *widget, gpointer data ) {
        }
 }
 
-static void edit_group_list_group_button( GtkCList *clist, GdkEventButton *event, gpointer data ) {
-       if( ! event ) return;
+static gboolean edit_group_list_group_button( GtkCList *clist, GdkEventButton *event, gpointer data ) {
+       if( ! event ) return<