sync with sylpheed 0.6.1cvs2
authorPaul Mangan <paul@claws-mail.org>
Thu, 6 Sep 2001 10:24:20 +0000 (10:24 +0000)
committerPaul Mangan <paul@claws-mail.org>
Thu, 6 Sep 2001 10:24:20 +0000 (10:24 +0000)
25 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
NEWS
acconfig.h
configure.in
po/POTFILES.in
src/.cvsignore
src/Makefile.am
src/addrbook.c
src/addrbook.h
src/addrcache.c
src/addrcache.h
src/addressadd.c
src/addressbook.c
src/addressbook.h
src/addrindex.c
src/addritem.c
src/addritem.h
src/editaddress.c
src/editbook.c
src/editgroup.c
src/editvcard.c
src/mainwindow.c
src/summaryview.c

index 56a0992..1269f8b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,57 @@
+2001-09-06
+
+       * src/Makefile.am: added extra xpm's.
+
+2001-09-05
+
+       * src/addressbook.c: fixed a compilation problem when enabling
+         LDAP.
+         addressbook_open(): fixed a missing 'else'.
+
+2001-09-04
+
+       * src/pixmaps/dir-close.xpm
+         src/pixmaps/dir-open.xpm
+         src/pixmaps/trash.xpm: replaced with the new blue icons.
+       * merged Match Grun's new addressbook code.
+       * src/pixmaps/address.xpm
+         src/pixmaps/book.xpm
+         src/pixmaps/category.xpm
+         src/pixmaps/interface.xpm
+         src/pixmaps/jpilot.xpm
+         src/pixmaps/ldap.xpm
+         src/pixmaps/vcard.xpm: new icons.
+       * src/addrbook.[ch]
+         src/addrcache.[ch]
+         src/addressadd.[ch]
+         src/addressitem.[ch]
+         src/addrindex.[ch]
+         src/addritem.[ch]
+         src/editaddress.[ch]
+         src/editbook.[ch]
+         src/editgroup.[ch]
+         src/editjpilot.[ch]
+         src/editldap.[ch]
+         src/editldap_basedn.[ch]
+         src/editvcard.[ch]
+         src/jpilot.[ch]
+         src/mgutils.[ch]
+         src/syldap.[ch]
+         src/vcard.[ch]: new. Many fixes to remove the huge amount of
+         warnings.
+         addrbook_build_avail_email_vis(): fixed a memory leak.
+
+2001-09-04
+
+       * NEWS: brought in the all of the changes previously put on the web.
+
+2001-09-03
+
+       * src/mainwindow.c
+         src/summaryview.c: modified the layout of menus.
+       * src/mainwindow.c: ac_menu_popup_closed(): fixed a bug that didn't
+         return a focus to the main window after selecting the account menu.
+
 2001-09-03
 
        * version 0.6.1
index 93910fe..e115d27 100644 (file)
@@ -1,3 +1,13 @@
+2001-09-06 [paul]
+
+       * po/de.po, po/es.po, po/nl.po, po/pt_BR.po
+               updated translations
+
+       * configure.in
+               change to version 0.6.1claws1
+
+       * sync with sylpheed 0.6.1cvs2
+
 2001-09-03 [paul]
 
        * po/POTFILES.in
index 2682826..f794384 100644 (file)
@@ -1,3 +1,56 @@
+2001-09-06
+
+       * src/Makefile.am: »Ä¤ê¤Î xpm ¤òÄɲá£
+
+2001-09-05
+
+       * src/addressbook.c: LDAP ¤òÍ­¸ú¤Ë¤·¤¿¤È¤­¤Ë¥³¥ó¥Ñ¥¤¥ë¤Ç¤­¤Ê¤¤ÌäÂê
+         ¤ò½¤Àµ¡£
+         addressbook_open(): 'else' ¤¬¤Ê¤¤¤Î¤ò½¤Àµ¡£
+
+2001-09-04
+
+       * src/pixmaps/dir-close.xpm
+         src/pixmaps/dir-open.xpm
+         src/pixmaps/trash.xpm: ¿·¤·¤¤¥Ö¥ë¡¼¤Î¥¢¥¤¥³¥ó¤ÇÃÖ¤­´¹¤¨¤¿¡£
+       * Match Grun ¤µ¤ó¤Î¿·¥¢¥É¥ì¥¹Ä¢¤Î¥³¡¼¥É¤ò¥Þ¡¼¥¸¡£
+       * src/pixmaps/address.xpm
+         src/pixmaps/book.xpm
+         src/pixmaps/category.xpm
+         src/pixmaps/interface.xpm
+         src/pixmaps/jpilot.xpm
+         src/pixmaps/ldap.xpm
+         src/pixmaps/vcard.xpm: ¿·µ¬¥¢¥¤¥³¥ó¡£
+       * src/addrbook.[ch]
+         src/addrcache.[ch]
+         src/addressadd.[ch]
+         src/addressitem.[ch]
+         src/addrindex.[ch]
+         src/addritem.[ch]
+         src/editaddress.[ch]
+         src/editbook.[ch]
+         src/editgroup.[ch]
+         src/editjpilot.[ch]
+         src/editldap.[ch]
+         src/editldap_basedn.[ch]
+         src/editvcard.[ch]
+         src/jpilot.[ch]
+         src/mgutils.[ch]
+         src/syldap.[ch]
+         src/vcard.[ch]: ¿·µ¬¡£ÂçÎ̤Πwarning ¤ò¼è¤ê½ü¤¯¤¿¤á¤Ë½¤Àµ¡£
+         addrbook_build_avail_email_vis(): ¥á¥â¥ê¥ê¡¼¥¯¤ò½¤Àµ¡£
+
+2001-09-04
+
+       * NEWS: °ÊÁ°¤Ë web ¤ËÃÖ¤«¤ì¤¿Á´¤Æ¤Î¹¹¿·ÍúÎò¤ò¼è¤ê¹þ¤ó¤À¡£
+
+2001-09-03
+
+       * src/mainwindow.c
+         src/summaryview.c: ¥á¥Ë¥å¡¼¤ÎÇÛÃÖ¤ò½¤Àµ¡£
+       * src/mainwindow.c: ac_menu_popup_closed(): ¥¢¥«¥¦¥ó¥È¥á¥Ë¥å¡¼¤ò
+         ÁªÂò¸å¥Õ¥©¡¼¥«¥¹¤ò¥á¥¤¥ó¥¦¥£¥ó¥É¥¦¤ËÊÖ¤µ¤Ê¤«¤Ã¤¿¥Ð¥°¤ò½¤Àµ¡£
+
 2001-09-03
 
        * version 0.6.1
diff --git a/NEWS b/NEWS
index e69de29..a384bd4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -0,0 +1,337 @@
+Changes of Sylpheed
+
+* 0.6.1
+
+    * A crash bug caused by the typo of ja.po was fixed.
+    * Some bugs of configure were fixed.
+    * The bug that ignored Bcc: when using external command for sending was
+      fixed.
+    * A bug of auto-checking was fixed.
+    * Readability of the selected color-labelled line has been improved.
+    * Croatian message catalog has been added.
+
+* 0.6.0
+
+    * Some operations are enabled while receiving.
+    * A progress bar has been added to the status bar.
+    * SSL has been supported (POP3, SMTP, IMAP4).
+    * Color label is implemented.
+    * Sending with local sendmail command is enabled.
+    * Queued messages are now re-editable.
+    * Old messages will be removed after re-editing.
+    * Account information is now used when sending from queue.
+    * New account dialog will be displayed on the first run.
+    * Suppressed the output to status bar on IMAP4 and NNTP.
+    * The memory usage of the integrated XML parser has been reduced.
+    * The configure script has been improved.
+    * The bug that tried to fetch a nonexistent message on POP3 has been
+      fixed.
+    * The crash bugs of the summary view and the attachment property dialog
+      of the composition window has been fixed.
+
+* 0.5.3
+
+    * The performance of the summary view has been improved a bit.
+    * The option to expand / collapse message threads has been added.
+    * Unread messages are now displayed with bold font.
+    * The option to update all local folders after getting messages has
+      been added.
+    * "Add sender to address book" has been implemented.
+    * The position of displayed message is now kept after updating the
+      summary view.
+    * A security problem of POP3 has been fixed.
+    * Bold and small fonts are now configurable with ~/.sylpheed/sylpheedrc.
+    * Some other bugs have been fixed.
+
+* 0.5.2
+
+    * The English manual has been added.
+    * Polish message catalog has been added.
+    * Accounts are automatically selected on reply.
+    * Unnecessary return codes in user-defined header are removed.
+    * UI of date format setting has been improved.
+    * The bug that couldn't handle escaped characters on IMAP4 has been fixed.
+    * The bug that suspended the process after opening attached files has
+      been fixed.
+    * Workaround for raw-JIS code in header fields has been done again.
+    * The bug that couldn't handle some responses on NNTP has been fixed.
+    * Some other minor fixes have been done.
+
+* 0.5.1
+
+    * Expand/collapse state of folders is now preserved.
+    * Newsgroups can be selected from the list dialog.
+    * Workaround for raw-JIS code in header fields.
+    * The current read size in some dialogs are displayed with human-readable
+      format.
+    * Cc can be used in the reply format.
+    * Base64 data with unusual line length became decodable.
+
+* 0.5.0
+
+    * A fix for the bug that prevented the removal of selected IMAP4 folder.
+
+* 0.5.0pre4
+
+    * Gettext has been updated to 0.10.38.
+    * Some more outgoing character sets became specifiable without libjconv.
+    * --enable-threads option has been removed temporarily.
+    * IMAP4 mailbox status is now updated while scanning tree.
+    * IMAP4 and NNTP port number is now specifiable.
+    * The Japanese manual has been updated.
+    * Some UI and other fixes have been done.
+
+* 0.5.0pre3
+
+    * Autoscan of IMAP4 directory has been implemented.
+    * IMAP4 server directory prefix became specifiable.
+    * Some other bugfixes have been done.
+
+* 0.5.0pre2
+
+    * Bugfixes for IMAP4. Logs are now also output to file.
+
+* 0.5.0pre1
+
+    * Many bugfixes for IMAP4, and some modifications for user interface.
+
+* 0.4.99
+
+    * Attached files can be opened with arbitrary programs.
+    * The progress dialog is shown when sending a message.
+    * User-defined headers can be added.
+    * On the folder tree, unread mark is added to closed folders which have
+      some unread subfolders.
+    * Command line options such as --help and --version can now be executed
+      without X.
+    * NNTP authentication has been supported.
+    * Summary view shows a dialog to process the unexecuted marks when
+      changing the current folder.
+    * `Reply to sender' has been added.
+    * In IMAP4rev1, move, copy, delete and namespace have been implemented.
+      INBOX and trash folder are automatically added when creating a new
+      IMAP4 account.
+    * Many other bugfixes have been done.
+
+* 0.4.66
+
+    * The bug that didn't calculate MD5 correctly on big endian machines
+      (like PowerPC) has been fixed.
+    * The incorporation dialog has been improved.
+    * Auto mail checking has been implemented.
+    * Headers displayed on the message view are now customizable.
+    * Some other bugfixes have been done.
+
+* 0.4.65
+
+    * The items of preferences dialog have been reorganized.
+    * The header pane can be toggled on and off now.
+    * Page scroll step is now selectable between one page and half page.
+    * Messages can be exported as mbox format.
+    * GnuPG support code has been updated.
+    * The format of date in summary view became freely definable.
+    * The MD5 routine by RSA has been replaced by an FSF implementation.
+    * The progress dialog of POP3 has been considerably improved.
+    * IMAP4 folder creation/deletion is enabled.
+    * A bug in IMAP4 that caused infinite loop and buffer overrun has been
+      fixed.
+    * A socket is now handled with abstraction layer.
+    * Some other bugs have been fixed.
+
+* 0.4.64
+
+    * The built-in XML parser has been modified so that it escapes certain
+      characters, and supports multiple-lined tag.
+    * The bug that caused infinite loop when illegal XML file was given was
+      fixed.
+    * The problem when not moving to inbox after getting new mail was fixed.
+    * The bug that made Sylpheed crash when clicking Cancel button while
+      getting new mail was fixed.
+
+* 0.4.63
+
+    * Some menu items are sorted out.
+    * `Attract by subject' is speeded up.
+    * Smooth scrolling of message text is enabled.
+    * Generic mark and Deleted mark became permanent.
+    * Replied and Forwarded mark are enabled.
+    * The design of New and Unread mark is changed.
+    * Generic mark and Unread mark can be toggled with clicking summary view.
+    * Long References header is truncated now.
+    * Updated the GnuPG support code.
+    * Messages can be moved across file systems.
+    * Message date is converted into local time when displaying.
+    * The colors of quoted part and URI of messages can be specified, and
+      they are specifiable according to quotation level.
+    * It is enabled to keep the current folder after receiving new messages.
+    * The speed of cache reading is improved.
+    * Message copy is implemented.
+    * Many other bugfixes have been done.
+
+* 0.4.62
+
+    * Prohibition of multiple execution and operation by command line
+      options are enabled.
+    * Workaround was done for duplicated From_ line in mbox file.
+    * HTML - > text converter is implemented.
+    * SMTP AUTH is supported.
+    * FIFO is allowed for signature file.
+    * Security probrems related to tmpfile() and chmod() are fixed.
+    * A bug was fixed that couldn't open attached files which include space.
+    * Address completion is enhanced.
+    * Move and remove are enabled in IMAP4.
+    * Message source can be displayed.
+    * Some other bugfixes.
+
+* 0.4.61
+
+    * Bugs in address completion, sending, and folder view have been fixed.
+
+* 0.4.60
+
+    * The horizontal scroll bar is added on the summary view.
+    * Drag and drop from the summary view to the folder view is enabled.
+    * Preliminary support of GnuPG is added (needs GPGME).
+    * `Update folder tree' is performed correctly now.
+    * Receiving dialog is improved.
+    * `Select all matched' is enabled in the summary search.
+    * Some new toolbar icons are added.
+    * Attached files can be opened with metamail command.
+    * Address completion with tab key is enabled in the address entry on
+      the composition window.
+    * Some many other bugfixes.
+
+* 0.4.52
+
+    * News posting feature is implemented.
+    * Number of unread messages is now displayed at the side of folder name.
+    * Accounts are now selectable on the composition window.
+    * Some other bugfixes.
+
+* 0.4.51
+
+    * A bug was fixed that didn't incorporate spool file correctly.
+    * From_ line is now recognized as separator of messages even if the
+      previous line isn't empty.
+    * A bug was fixed that printed warning when sending message from queue.
+
+* 0.4.50
+
+    * The architecture were overhauled, and folders are now managed by
+      object-oriented approach.
+    * The location of mailbox became specifiable, and multiple mailboxes
+      are now manageable simultaneously.
+    * Summary scrolls only on the edge when messages are selected.
+    * News servers are now added using account creation.
+    * In IMAP4, the reading of existing folders is enabled.
+    * Interfaces are modified a bit.
+
+* 0.4.9
+
+    * Fixed some bugs and updated message catalogs.
+
+* 0.4.8
+
+    * Fixed a bug that locked the process if the status bar was hidden.
+    * Fixed a bug that put a garbage to charset if the outgoing character
+      set was specified and non-ascii characters were used in subject.
+    * Added Portuguese message catalog.
+
+* 0.4.7
+
+    * Changed the ruler to the more graphical one.
+    * Made the state of status bar get preserved.
+    * Made it configurable for each accounts whether to receive messages
+      when getting from all accounts.
+    * Updated README.
+
+* 0.4.6
+
+    * Added a ruler to the composition window.
+    * Added the list of the compiled-in features and clickable URI to the
+      official web site to the about dialog.
+    * Added `Show all header' to the right-click menu at the summary.
+    * Fixed a bug on quotation.
+    * Fixed memory leak bugs.
+    * Some other fixes.
+
+* 0.4.5
+
+    * Implemented line-wrapping functions.
+    * Added supports for some codesets.
+    * Added Chinese message catalog.
+    * Extended quotation format.
+    * Made the settings of the menu shortcuts preservable.
+    * Fixed a probrem that caused to show garbage characters if the codeset
+      wasn't set.
+    * Some other bug fixes.
+
+* 0.4.4
+
+    * Enhanced the support for 8bit code (ex. ISO-8859-1). Other bug fixes.
+
+* 0.4.3
+
+    * Implemented the draft message function.
+    * Made the summary get the proper display on the queue folder.
+    * Changed the color of unread mark from green to blue.
+    * Some other bug fixes.
+
+* 0.4.2
+
+    * Added preliminary IMAP4 codes.
+    * Enhanced the MIME message parsing routines.
+    * Changed the display method of HeaderView.
+    * Modified the codeset conversion routines.
+    * Added Spanish message catalog.
+    * Removed `Reply with quote', and added `Reply to all'.
+    * Implemented `Forward as an attachment'.
+    * Some other bug fixes.
+
+* 0.4.1
+
+    * Fixed the probrem of codeconv.c that prevented compiling.
+    * Modified sylpheed.spec.
+
+* 0.4.0
+
+    * Modified the layout of the preferences dialog widgets.
+    * Fixed the probrem of Japanese processing on FreeBSD.
+    * Workaround for the malformed References: header generated by OE5 :(
+
+* 0.3.99
+
+    * Applied Kondara patch and enabled to support many locales, including
+      UTF-8 (Unicode), when using libjconv.
+    * Integrated the manual written by BONAIM.
+    * Added the option that specifies whether to display short headers on
+      message view or not.
+    * Disabled IPv6 support by default.
+    * Added copyright notice to the source files.
+    * Some bug fixes.
+
+* 0.3.29
+
+    * Supported external editor.
+    * Supported Content-Transfer-Encoding: x-uuencode.
+    * Replaced system() with execvp().
+    * Modified the reversed order of `Yes' and `No' at some alert dialogs.
+    * Enabled to open a message with new window.
+    * Made it display the simplified headers if the part of multipart
+      message is text/plain.
+    * Enabled to use font selection dialog on the setting of message font.
+    * Modified so that it processes address correctly if the part of it is
+      quoted.
+    * Added `None (local)' to the menu of protocol on the account setting.
+    * Some other fixes.
+
+* 0.3.28
+
+    * Supported ISO-8859-1.
+    * Fixed the size of the dialogs.
+    * Made it saves the size of widgets and the width of columns.
+    * Added the French message catalog.
+    * Changed the variable name of filtering (check the auto-filtering
+      option again if you've turned it on before).
+    * Fixed some bugs.
+
index 25a3dfe..bc9cabb 100644 (file)
 /* Define if you want IPv6 support.  */
 #undef INET6
 
+/* Define if you use GPGME to support OpenPGP */
+#undef USE_GPGME
+
+/* Define if you use OpenSSL to support SSL */
+#undef USE_SSL
+
 /* Define if you want JPilot support in addressbook.  */
 #undef USE_JPILOT
 
 /* Define if you want LDAP support in addressbook.  */
 #undef USE_LDAP
 
-/* Define if we use GPGME to support OpenPGP */
-#undef USE_GPGME
-
-/* Define if you use OpenSSL to support SSL */
-#undef USE_SSL
-
 /* Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.  */
 #undef wint_t
 
@@ -34,9 +34,6 @@
 #undef HAVE_U32_TYPEDEF
 
 
-#undef PACKAGE
-#undef VERSION
-
 #undef CLAWS
 
 /* Has ispell path */
index 2561cbd..1fd2f12 100644 (file)
@@ -8,13 +8,13 @@ MINOR_VERSION=6
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws
+EXTRA_VERSION=claws1
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
+dnl AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
+dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
 AC_SUBST(PACKAGE)
 AC_SUBST(VERSION)
 
@@ -141,27 +141,19 @@ if test "$ac_cv_enable_compface" = yes; then
 fi
 
 dnl for JPilot support in addressbook
-dnl no check for libraries: these are dynamically loaded
+dnl no check for libraries; these are dynamically loaded
 AC_ARG_ENABLE(jpilot,
        [  --enable-jpilot         Enable JPilot support [default=no]],
        [ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
-
-AC_MSG_CHECKING([whether to use jpilot])
+AC_MSG_CHECKING([whether to use JPilot])
 if test "$ac_cv_enable_jpilot" = yes; then
        AC_MSG_RESULT(yes)
-       if test "$ac_cv_enable_jpilot" = yes; then
-               AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h, , [ac_cv_enable_jpilot=no])
-               if test "$ac_cv_enable_jpilot" = yes; then              
-                       LIBS="$LIBS -lpisock"
-                       AC_DEFINE(USE_JPILOT)
-               fi
-       fi
-       AC_MSG_CHECKING(whether jpilot is available)
-       if test "$ac_cv_enable_jpilot" = yes; then
-               AC_MSG_RESULT(yes)
-       else
-               AC_MSG_RESULT(no)
-       fi
+       AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h,
+                        [ LIBS="$LIBS -lpisock"
+                          AC_DEFINE(USE_JPILOT) ],
+                        [ ac_cv_enable_jpilot=no ])
+       AC_MSG_CHECKING([whether jpilot is available])
+       AC_MSG_RESULT($ac_cv_enable_jpilot)
 else
        AC_MSG_RESULT(no)
 fi
@@ -169,25 +161,17 @@ fi
 dnl for LDAP support in addressbook
 dnl no check for libraries; dynamically loaded
 AC_ARG_ENABLE(ldap,
-       [  --enable-ldap         Enable LDAP support [default=no]],
+       [  --enable-ldap           Enable LDAP support [default=no]],
        [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no])
-
-AC_MSG_CHECKING([whether to use ldap])
+AC_MSG_CHECKING([whether to use LDAP])
 if test "$ac_cv_enable_ldap" = yes; then
        AC_MSG_RESULT(yes)
-       if test "$ac_cv_enable_ldap" = yes; then
-               AC_CHECK_HEADERS(ldap.h lber.h pthread.h, , [ac_cv_enable_ldap=no])
-               if test "$ac_cv_enable_ldap" = yes; then
-                       LIBS="$LIBS -lldap -llber -lpthread -lresolv"
-                       AC_DEFINE(USE_LDAP)
-               fi      
-       fi
-       AC_MSG_CHECKING(whether ldap is available)
-       if test "$ac_cv_enable_ldap" = yes; then
-               AC_MSG_RESULT(yes)
-       else
-               AC_MSG_RESULT(no)
-       fi
+       AC_CHECK_HEADERS(ldap.h lber.h pthread.h,
+                        [ LIBS="$LIBS -lldap -llber -lpthread -lresolv"
+                          AC_DEFINE(USE_LDAP) ],
+                        [ ac_cv_enable_ldap=no ])
+       AC_MSG_CHECKING([whether ldap is available])
+       AC_MSG_RESULT($ac_cv_enable_ldap)
 else
        AC_MSG_RESULT(no)
 fi
@@ -341,9 +325,9 @@ echo ""
 echo "gdk-pixbuf : $ac_cv_enable_gdk_pixbuf"
 echo "gdk_imlib  : $ac_cv_enable_imlib"
 echo "GPGME      : $ac_cv_enable_gpgme"
+echo "OpenSSL    : $ac_cv_enable_ssl"
 echo "JPilot     : $ac_cv_enable_jpilot"
 echo "LDAP       : $ac_cv_enable_ldap"
-echo "OpenSSL    : $ac_cv_enable_ssl"
 echo "compface   : $ac_cv_enable_compface"
 echo "libjconv   : $ac_cv_enable_jconv"
 echo "IPv6       : $ac_cv_enable_ipv6"
index 5f5bd1f..9d285f7 100644 (file)
@@ -1,8 +1,12 @@
 src/about.c
 src/account.c
+src/addrbook.c
+src/addrcache.c
+src/address.c
 src/addressadd.c
 src/addressbook.c
-src/addr_compl.c
+src/addrindex.c
+src/addritem.c
 src/alertpanel.c
 src/automaton.c
 src/base64.c
@@ -31,6 +35,7 @@ src/imap.c
 src/import.c
 src/inc.c
 src/inputdialog.c
+src/jpilot.c
 src/logwindow.c
 src/main.c
 src/mainwindow.c
@@ -40,6 +45,7 @@ src/mbox.c
 src/mbox_folder.c
 src/menu.c
 src/messageview.c
+src/mgutils.c
 src/mh.c
 src/mimeview.c
 src/news.c
@@ -72,12 +78,14 @@ src/sigstatus.c
 src/smtp.c
 src/socket.c
 src/sourcewindow.c
+src/ssl.c
 src/statusbar.c
 src/summary_search.c
 src/summaryview.c
+src/syldap.c
 src/textview.c
 src/unmime.c
 src/utils.c
 src/uuencode.c
+src/vcard.c
 src/xml.c
-src/ssl.c
index 69a7305..5ef28fb 100644 (file)
@@ -12,3 +12,4 @@ quote_fmt_parse.h
 matcher_parser_lex.c
 matcher_parser_parse.c
 matcher_parser_parse.h
+version.h
index c844be8..38977a0 100644 (file)
@@ -34,6 +34,23 @@ sylpheed_SOURCES = \
        customheader.c customheader.h \
        addressbook.c addressbook.h \
        addr_compl.c addr_compl.h \
+       addressitem.h \
+       addritem.c addritem.h \
+       addrcache.c addrcache.h \
+       addrbook.c addrbook.h \
+       addrindex.c addrindex.h \
+       mgutils.c mgutils.h \
+       vcard.c vcard.h \
+       jpilot.c jpilot.h \
+       syldap.c syldap.h \
+       editbook.c editbook.h \
+       editgroup.c editgroup.h \
+       editaddress.c editaddress.h \
+       editvcard.c editvcard.h \
+       editjpilot.c editjpilot.h \
+       editldap.c editldap.h \
+       editldap_basedn.c editldap_basedn.h \
+       addressadd.c addressadd.h \
        filesel.c filesel.h \
        foldersel.c foldersel.h \
        statusbar.c statusbar.h \
@@ -93,23 +110,6 @@ sylpheed_SOURCES = \
        mbox_folder.c mbox_folder.h \
        quote_fmt_lex.l quote_fmt_lex.h \
        quote_fmt_parse.y quote_fmt.h \
-       addressitem.h \
-       addritem.c addritem.h \
-       addrcache.c addrcache.h \
-       addrbook.c addrbook.h \
-       addrindex.c addrindex.h \
-       mgutils.c mgutils.h \
-       vcard.c vcard.h \
-       jpilot.c jpilot.h \
-       syldap.c syldap.h \
-       editbook.c editbook.h \
-       editgroup.c editgroup.h \
-       editaddress.c editaddress.h \
-       editvcard.c editvcard.h \
-       editjpilot.c editjpilot.h \
-       editldap.c editldap.h \
-       editldap_basedn.c editldap_basedn.h \
-       addressadd.c addressadd.h \
        gtkspell.c gtkspell.h gtkxtext.h \
        template.c template.h \
        prefs_templates.c prefs_templates.h \
@@ -161,14 +161,13 @@ EXTRA_DIST = \
        pixmaps/stock_paste.xpm \
        pixmaps/tb_address_book.xpm \
        pixmaps/sylpheed-logo.xpm \
-       pixmaps/interface.xpm \
-       pixmaps/book.xpm \
        pixmaps/address.xpm \
-       pixmaps/vcard.xpm \
-       pixmaps/jpilot.xpm \
+       pixmaps/book.xpm \
        pixmaps/category.xpm \
+       pixmaps/interface.xpm \
+       pixmaps/jpilot.xpm \
        pixmaps/ldap.xpm \
-       pixmaps/ignorethread.xpm
+       pixmaps/vcard.xpm
 
 INCLUDES = \
        -DG_LOG_DOMAIN=\"Sylpheed\" \
index 8e9098e..91d7f6e 100644 (file)
@@ -21,8 +21,9 @@
  * General functions for accessing external address book files.
  */
 
-#include <stdio.h>
 #include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <dirent.h>
 #include <sys/stat.h>
 #include <math.h>
@@ -36,6 +37,7 @@
 
 #ifndef DEV_STANDALONE
 #include "prefs.h"
+#include "codeconv.h"
 #endif
 
 #define ADDRBOOK_MAX_SEARCH_COUNT 1000
@@ -49,7 +51,7 @@
 */
 AddressBookFile *addrbook_create_book() {
        AddressBookFile *book;
-       gint t;
+
        book = g_new0( AddressBookFile, 1 );
        book->name = NULL;
        book->path = NULL;
@@ -88,40 +90,41 @@ void addrbook_set_accessed( AddressBookFile *book, const gboolean value ) {
        book->accessFlag = value;
 }
 gboolean addrbook_get_modified( AddressBookFile *book ) {
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, FALSE );
        return book->modifyFlag;
 }
 gboolean addrbook_get_accessed( AddressBookFile *book ) {
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, FALSE );
        return book->accessFlag;
 }
 gboolean addrbook_get_read_flag( AddressBookFile *book ) {
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, FALSE );
        return book->readFlag;
 }
 gint addrbook_get_status( AddressBookFile *book ) {
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, -1 );
        return book->retVal;
 }
 ItemFolder *addrbook_get_root_folder( AddressBookFile *book ) {
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, NULL );
        return addrcache_get_root_folder( book->addressCache );
 }
 GList *addrbook_get_list_folder( AddressBookFile *book ) {
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, NULL );
        return addrcache_get_list_folder( book->addressCache );
 }
 GList *addrbook_get_list_person( AddressBookFile *book ) {
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, NULL );
        return addrcache_get_list_person( book->addressCache );
 }
 gchar *addrbook_get_name( AddressBookFile *book ) {
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, NULL );
        return book->name;
 }
 
 static gint addrcache_free_item_vis( gpointer key, gpointer value, gpointer data ) {
        AddrItemObject *obj = ( AddrItemObject * ) value;
+
        if( ADDRITEM_TYPE(obj) == ITEMTYPE_PERSON ) {
                addritem_free_item_person( ( ItemPerson * ) obj );
        }
@@ -203,6 +206,7 @@ void addrbook_free_book( AddressBookFile *book ) {
 */
 void addrbook_print_item_list( GList *list, FILE *stream ) {
        GList *node = list;
+
        while( node ) {
                AddrItemObject *obj = node->data;
                if( ADDRITEM_TYPE(obj) == ITEMTYPE_PERSON ) {
@@ -224,6 +228,7 @@ void addrbook_print_item_list( GList *list, FILE *stream ) {
 */
 void addrbook_print_book( AddressBookFile *book, FILE *stream ) {
        g_return_if_fail( book != NULL );
+
        fprintf( stream, "AddressBook:\n" );
        fprintf( stream, "\tname  : '%s'\n", book->name );
        fprintf( stream, "\tpath  : '%s'\n", book->path );
@@ -236,9 +241,10 @@ void addrbook_print_book( AddressBookFile *book, FILE *stream ) {
 * Dump entire address book traversing folders.
 */
 void addrbook_dump_book( AddressBookFile *book, FILE *stream ) {
-       GList *node;
        ItemFolder *folder;
+
        g_return_if_fail( book != NULL );
+
        addrbook_print_book( book, stream );
        folder = book->addressCache->rootFolder;
        addritem_print_item_folder( folder, stream );
@@ -251,7 +257,9 @@ void addrbook_dump_book( AddressBookFile *book, FILE *stream ) {
 */
 ItemGroup *addrbook_remove_group( AddressBookFile *book, ItemGroup *group ) {
        ItemGroup *item;
-       g_return_if_fail( book != NULL );
+
+       g_return_val_if_fail( book != NULL, NULL );
+
        item = addrcache_remove_group( book->addressCache, group );
        if( item ) book->dirtyFlag = TRUE;
        return item;
@@ -264,7 +272,9 @@ ItemGroup *addrbook_remove_group( AddressBookFile *book, ItemGroup *group ) {
 */
 ItemPerson *addrbook_remove_person( AddressBookFile *book, ItemPerson *person ) {
        ItemPerson *item;
-       g_return_if_fail( book != NULL );
+
+       g_return_val_if_fail( book != NULL, NULL );
+
        item = addrcache_remove_person( book->addressCache, person );
        if( item ) book->dirtyFlag = TRUE;
        return item;
@@ -278,7 +288,9 @@ ItemPerson *addrbook_remove_person( AddressBookFile *book, ItemPerson *person )
 */
 ItemEMail *addrbook_person_remove_email( AddressBookFile *book, ItemPerson *person, ItemEMail *email ) {
        ItemEMail *item;
-       g_return_if_fail( book != NULL );
+
+       g_return_val_if_fail( book != NULL, NULL );
+
        item = addrcache_person_remove_email( book->addressCache, person, email );
        if( item ); book->dirtyFlag = TRUE;
        return item;
@@ -552,7 +564,6 @@ static void addrbook_parse_member( AddressBookFile *book, XMLFile *file, ItemGro
 static void addrbook_parse_member_list( AddressBookFile *book, XMLFile *file, ItemGroup *group ){
        GList *attr;
        guint prev_level;
-       gchar *element;
 
        for (;;) {
                prev_level = file->level;
@@ -636,7 +647,6 @@ static void addrbook_parse_folder_item( AddressBookFile *book, XMLFile *file, It
 static void addrbook_parse_folder_list( AddressBookFile *book, XMLFile *file, ItemFolder *folder ){
        GList *attr;
        guint prev_level;
-       gchar *element;
 
        for (;;) {
                prev_level = file->level;
@@ -868,7 +878,8 @@ static void addrbook_resolve_folder_items( AddressBookFile *book ) {
 gint addrbook_read_data( AddressBookFile *book ) {
        XMLFile *file = NULL;
        gchar *fileSpec = NULL;
-       g_return_if_fail( book != NULL );
+
+       g_return_val_if_fail( book != NULL, -1 );
 
        fileSpec = g_strconcat( book->path, G_DIR_SEPARATOR_S, book->fileName, NULL );
        book->retVal = MGU_OPEN_FILE;
@@ -926,6 +937,7 @@ static void addrbook_write_item_person_vis( gpointer key, gpointer value, gpoint
        AddrItemObject *obj = ( AddrItemObject * ) value;
        FILE *fp = ( FILE * ) data;
        GList *node;
+
        if( ! obj ) return;
        if( ADDRITEM_TYPE(obj) == ITEMTYPE_PERSON ) {
                ItemPerson *person = ( ItemPerson * ) value;
@@ -980,6 +992,7 @@ static void addrbook_write_item_person_vis( gpointer key, gpointer value, gpoint
 static void addrbook_write_folder_group( ItemFolder *parent, FILE *fp ) {
        GList *nodeGrp = parent->listGroup;
        GList *node;
+
        while( nodeGrp ) {
                ItemGroup *group = nodeGrp->data;
                if( group ) {
@@ -1022,6 +1035,7 @@ static void addrbook_write_item_group_vis( gpointer key, gpointer value, gpointe
        AddrItemObject *obj = ( AddrItemObject * ) value;
        FILE *fp = ( FILE * ) data;
        GList *node;
+
        if( ! obj ) return;
        if( ADDRITEM_TYPE(obj) == ITEMTYPE_GROUP ) {
                ItemGroup *group = ( ItemGroup * ) value;
@@ -1057,6 +1071,7 @@ static void addrbook_write_item_group_vis( gpointer key, gpointer value, gpointe
 static void addrbook_write_folder_folder( ItemFolder *parent, FILE *fp ) {
        GList *nodeFold = parent->listFolder;
        GList *node;
+
        while( nodeFold ) {
                ItemFolder *folder = nodeFold->data;
                addrbook_write_folder_folder( folder, fp );
@@ -1115,6 +1130,7 @@ static void addrbook_write_item_folder_vis( gpointer key, gpointer value, gpoint
        AddrItemObject *obj = ( AddrItemObject * ) value;
        FILE *fp = ( FILE * ) data;
        GList *node;
+
        if( ! obj ) return;
        if( ADDRITEM_TYPE(obj) == ITEMTYPE_FOLDER ) {
                ItemFolder *folder = ( ItemFolder * ) value;
@@ -1176,8 +1192,8 @@ gint addrbook_write_to( AddressBookFile *book, gchar *newFile ) {
        PrefFile *pfile;
 #endif
 
-       g_return_if_fail( book != NULL );
-       g_return_if_fail( newFile != NULL );
+       g_return_val_if_fail( book != NULL, -1 );
+       g_return_val_if_fail( newFile != NULL, -1 );
 
        fileSpec = g_strconcat( book->path, G_DIR_SEPARATOR_S, newFile, NULL );
 
@@ -1230,7 +1246,7 @@ gint addrbook_write_to( AddressBookFile *book, gchar *newFile ) {
 * return: Status code.
 */
 gint addrbook_save_data( AddressBookFile *book ) {
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, -1 );
 
        book->retVal = MGU_NO_FILE;
        if( book->fileName == NULL || *book->fileName == '\0' ) return book->retVal;
@@ -1259,7 +1275,9 @@ ItemEMail *addrbook_move_email_before( AddressBookFile *book, ItemPerson *person
                        ItemEMail *itemMove, ItemEMail *itemTarget )
 {
        ItemEMail *email = NULL;
-       g_return_if_fail( book != NULL );
+
+       g_return_val_if_fail( book != NULL, NULL );
+
        email = addritem_move_email_before( person, itemMove, itemTarget );
        if( email ) {
                book->dirtyFlag = TRUE;
@@ -1278,7 +1296,9 @@ ItemEMail *addrbook_move_email_after( AddressBookFile *book, ItemPerson *person,
                        ItemEMail *itemMove, ItemEMail *itemTarget )
 {
        ItemEMail *email = NULL;
-       g_return_if_fail( book != NULL );
+
+       g_return_val_if_fail( book != NULL, NULL );
+
        email = addritem_move_email_after( person, itemMove, itemTarget );
        if( email ) {
                book->dirtyFlag = TRUE;
@@ -1422,7 +1442,7 @@ ItemPerson *addrbook_add_address_list( AddressBookFile *book, ItemFolder *folder
        ItemFolder *f = folder;
        GList *node;
 
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, NULL );
 
        if( ! f ) f = book->addressCache->rootFolder;
        person = addritem_create_item_person();
@@ -1447,6 +1467,7 @@ ItemPerson *addrbook_add_address_list( AddressBookFile *book, ItemFolder *folder
 */
 static void addrbook_load_hash_table_email_vis( gpointer key, gpointer value, gpointer data ) {
        AddrItemObject *obj = ( AddrItemObject * ) value;
+
        if( ADDRITEM_TYPE(obj) == ITEMTYPE_EMAIL ) {
                GHashTable *table = ( GHashTable * ) data;
                gchar *newKey = g_strdup( key );
@@ -1471,13 +1492,15 @@ static void addrbook_load_hash_table_email( AddressBookFile *book, GHashTable *t
 */
 static void addrbook_build_avail_email_vis( gpointer key, gpointer value, gpointer data ) {
        AddrItemObject *obj = ( AddrItemObject * ) value;
+
        if( ADDRITEM_TYPE(obj) == ITEMTYPE_PERSON ) {
                AddressBookFile *book = data;
                ItemPerson *person = ( ItemPerson * ) obj;
                GList *node = person->listEMail;
                while( node ) {
                        ItemEMail *email = node->data;
-                       gchar *newKey = g_strdup( ADDRITEM_ID(email) );
+                       //gchar *newKey = g_strdup( ADDRITEM_ID(email) );
+
                        if( ! g_hash_table_lookup( book->tempHash, ADDRITEM_ID(email) ) ) {
                                book->tempList = g_list_append( book->tempList, email );
                        }
@@ -1497,7 +1520,7 @@ GList *addrbook_get_available_email_list( AddressBookFile *book, ItemGroup *grou
        GList *list = NULL;
        GHashTable *table;
 
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, NULL );
 
        // Load hash table with group email entries
        table = g_hash_table_new( g_str_hash, g_str_equal );
@@ -1561,7 +1584,8 @@ void addrbook_update_group_list( AddressBookFile *book, ItemGroup *group, GList
 ItemGroup *addrbook_add_group_list( AddressBookFile *book, ItemFolder *folder, GList *listEMail ) {
        ItemGroup *group = NULL;
        ItemFolder *f = folder;
-       g_return_if_fail( book != NULL );
+
+       g_return_val_if_fail( book != NULL, NULL );
 
        if( ! f ) f = book->addressCache->rootFolder;
        group = addritem_create_item_group();
@@ -1581,7 +1605,8 @@ ItemGroup *addrbook_add_group_list( AddressBookFile *book, ItemFolder *folder, G
 ItemFolder *addrbook_add_new_folder( AddressBookFile *book, ItemFolder *parent ) {
        ItemFolder *folder = NULL;
        ItemFolder *p = parent;
-       g_return_if_fail( book != NULL );
+
+       g_return_val_if_fail( book != NULL, NULL );
 
        if( ! p ) p = book->addressCache->rootFolder;
        folder = addritem_create_item_folder();
@@ -1644,6 +1669,7 @@ void addrbook_update_attrib_list( AddressBookFile *book, ItemPerson *person, GLi
 */
 void addrbook_add_attrib_list( AddressBookFile *book, ItemPerson *person, GList *listAttrib ) {
        GList *node;
+
        g_return_if_fail( book != NULL );
        g_return_if_fail( person != NULL );
 
@@ -1666,6 +1692,7 @@ void addrbook_add_attrib_list( AddressBookFile *book, ItemPerson *person, GList
 */
 AddressBookFile *addrbook_item_get_bookfile( AddrItemObject *aio ) {
        AddressBookFile *book = NULL;
+
        if( aio ) {
                ItemFolder *parent = NULL;
                ItemFolder *root = NULL;
@@ -1695,7 +1722,9 @@ AddressBookFile *addrbook_item_get_bookfile( AddrItemObject *aio ) {
 */
 ItemFolder *addrbook_remove_folder( AddressBookFile *book, ItemFolder *folder ) {
        ItemFolder *f;
-       g_return_if_fail( book != NULL );
+
+       g_return_val_if_fail( book != NULL, NULL );
+
        f = addrcache_remove_folder( book->addressCache, folder );
        if( f ) book->dirtyFlag = TRUE;
        return f;
@@ -1708,7 +1737,9 @@ ItemFolder *addrbook_remove_folder( AddressBookFile *book, ItemFolder *folder )
 */
 ItemFolder *addrbook_remove_folder_delete( AddressBookFile *book, ItemFolder *folder ) {
        ItemFolder *f;
-       g_return_if_fail( book != NULL );
+
+       g_return_val_if_fail( book != NULL, NULL );
+
        f = addrcache_remove_folder_delete( book->addressCache, folder );
        if( f ) book->dirtyFlag = TRUE;
        return f;
@@ -1733,7 +1764,7 @@ GList *addrbook_get_bookfile_list( AddressBookFile *book ) {
        long int val, maxval;
        GList *fileList = NULL;
 
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, NULL );
 
        if( book->path == NULL || *book->path == '\0' ) {
                book->retVal = MGU_NO_PATH;
@@ -1764,7 +1795,7 @@ GList *addrbook_get_bookfile_list( AddressBookFile *book ) {
        maxval = -1;
 
        while( ( entry = readdir( dp ) ) != NULL ) {
-               gchar **endptr = NULL;
+               gchar *endptr = NULL;
                gint i;
                gboolean flg;
 
@@ -1894,7 +1925,6 @@ static void addrbook_chkparse_attr_list( AddressBookFile *book, XMLFile *file ){
 */
 static void addrbook_chkparse_person( AddressBookFile *book, XMLFile *file ) {
        GList *attr;
-       gchar *name, *value;
 
        attr = xml_get_current_tag_attr(file);
        // addrbook_show_attribs( attr );
@@ -1942,7 +1972,6 @@ static void addrbook_chkparse_member_list( AddressBookFile *book, XMLFile *file
 */
 static void addrbook_chkparse_group( AddressBookFile *book, XMLFile *file ) {
        GList *attr;
-       gchar *name, *value;
 
        attr = xml_get_current_tag_attr(file);
        // addrbook_show_attribs( attr );
@@ -1984,7 +2013,6 @@ static void addrbook_chkparse_folder_list( AddressBookFile *book, XMLFile *file
 */
 static void addrbook_chkparse_folder( AddressBookFile *book, XMLFile *file ) {
        GList *attr;
-       gchar *name, *value;
 
        attr = xml_get_current_tag_attr(file);
        // addrbook_show_attribs( attr );
@@ -2001,7 +2029,6 @@ static void addrbook_chkparse_folder( AddressBookFile *book, XMLFile *file ) {
 */
 static gboolean addrbook_chkread_tree( AddressBookFile *book, XMLFile *file ) {
        GList *attr;
-       gchar *name, *value;
        gboolean retVal;
 
        if( xml_get_dtd( file ) ) {
@@ -2056,7 +2083,7 @@ gint addrbook_test_read_file( AddressBookFile *book, gchar *fileName ) {
        XMLFile *file = NULL;
        gchar *fileSpec = NULL;
 
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, -1 );
 
        fileSpec = g_strconcat( book->path, G_DIR_SEPARATOR_S, fileName, NULL );
        book->retVal = MGU_OPEN_FILE;
@@ -2084,7 +2111,7 @@ gint addrbook_test_read_file( AddressBookFile *book, gchar *fileName ) {
 * Return: List of items, or NULL if none.
 */
 GList *addrbook_get_all_persons( AddressBookFile *book ) {
-       g_return_if_fail( book != NULL );
+       g_return_val_if_fail( book != NULL, NULL );
        return addrcache_get_all_persons( book->addressCache );
 }
 
@@ -2102,7 +2129,9 @@ ItemPerson *addrbook_add_contact( AddressBookFile *book, ItemFolder *folder, con
                const gchar *address, const gchar *remarks )
 {
        ItemPerson *person = NULL;
-       g_return_if_fail( book != NULL );
+
+       g_return_val_if_fail( book != NULL, NULL );
+
        person = addrcache_add_contact( book->addressCache, folder, name, address, remarks );
        if( person ) book->dirtyFlag = TRUE;
        return person;
@@ -2111,4 +2140,3 @@ ItemPerson *addrbook_add_contact( AddressBookFile *book, ItemFolder *folder, con
 /*
 * End of Source.
 */
-
index 3f6002e..4882f57 100644 (file)
@@ -94,6 +94,9 @@ ItemGroup *addrbook_add_group_list    ( AddressBookFile *book, ItemFolder *folder,
                                          GList *listEMail );
 ItemFolder *addrbook_add_new_folder    ( AddressBookFile *book, ItemFolder *parent );
 
+void addrbook_update_attrib_list       ( AddressBookFile *book, ItemPerson *person, GList *listAttrib );
+void addrbook_add_attrib_list          ( AddressBookFile *book, ItemPerson *person, GList *listAttrib );
+
 ItemFolder *addrbook_remove_folder     ( AddressBookFile *book, ItemFolder *folder );
 ItemFolder *addrbook_remove_folder_delete( AddressBookFile *book, ItemFolder *folder );
 
index c9bc33b..e221a11 100644 (file)
@@ -64,15 +64,15 @@ AddressCache *addrcache_create() {
 * Properties.
 */
 ItemFolder *addrcache_get_root_folder( AddressCache *cache ) {
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
        return cache->rootFolder;
 }
 GList *addrcache_get_list_folder( AddressCache *cache ) {
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
        return cache->rootFolder->listFolder;
 }
 GList *addrcache_get_list_person( AddressCache *cache ) {
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
        return cache->rootFolder->listPerson;
 }
 
@@ -260,10 +260,10 @@ static void addrcache_print_item_vis( gpointer key, gpointer value, gpointer dat
 void addrcache_print( AddressCache *cache, FILE *stream ) {
        g_return_if_fail( cache != NULL );
        fprintf( stream, "AddressCache:\n" );
-       fprintf( stream, "next id  : %d\n", cache->nextID );
-       fprintf( stream, "mod time : %d\n", cache->modifyTime );
-       fprintf( stream, "modified : %s\n", cache->modified ? "yes" : "no" );
-       fprintf( stream, "data read: %s\n", cache->dataRead ? "yes" : "no" );
+       fprintf( stream, "next id  : %d\n",  cache->nextID );
+       fprintf( stream, "mod time : %ld\n", cache->modifyTime );
+       fprintf( stream, "modified : %s\n",  cache->modified ? "yes" : "no" );
+       fprintf( stream, "data read: %s\n",  cache->dataRead ? "yes" : "no" );
 }
 
 /*
@@ -347,8 +347,9 @@ gboolean addrcache_hash_add_person( AddressCache *cache, ItemPerson *person ) {
 * return: TRUE if item added.
 */
 gboolean addrcache_hash_add_group( AddressCache *cache, ItemGroup *group ) {
-       g_return_if_fail( cache != NULL );
-       g_return_if_fail( group != NULL );
+       g_return_val_if_fail( cache != NULL, FALSE );
+       g_return_val_if_fail( group != NULL, FALSE );
+
        if( g_hash_table_lookup( cache->itemHash, ADDRITEM_ID(group) ) ) {
                return FALSE;
        }
@@ -361,8 +362,9 @@ gboolean addrcache_hash_add_group( AddressCache *cache, ItemGroup *group ) {
 * return: TRUE if item added.
 */
 gboolean addrcache_hash_add_folder( AddressCache *cache, ItemFolder *folder ) {
-       g_return_if_fail( cache != NULL );
-       g_return_if_fail( folder != NULL );
+       g_return_val_if_fail( cache != NULL, FALSE );
+       g_return_val_if_fail( folder != NULL, FALSE );
+
        if( g_hash_table_lookup( cache->itemHash, ADDRITEM_ID(folder) ) ) {
                return FALSE;
        }
@@ -375,9 +377,11 @@ gboolean addrcache_hash_add_folder( AddressCache *cache, ItemFolder *folder ) {
 */
 gboolean addrcache_folder_add_person( AddressCache *cache, ItemFolder *folder, ItemPerson *item ) {
        gboolean retVal = FALSE;
-       g_return_if_fail( cache != NULL );
-       g_return_if_fail( folder != NULL );
-       g_return_if_fail( item != NULL );
+
+       g_return_val_if_fail( cache != NULL, FALSE );
+       g_return_val_if_fail( folder != NULL, FALSE );
+       g_return_val_if_fail( item != NULL, FALSE );
+
        retVal = addrcache_hash_add_person( cache, item );
        if( retVal ) {
                addritem_folder_add_person( folder, item );
@@ -390,9 +394,11 @@ gboolean addrcache_folder_add_person( AddressCache *cache, ItemFolder *folder, I
 */
 gboolean addrcache_folder_add_folder( AddressCache *cache, ItemFolder *folder, ItemFolder *item ) {
        gboolean retVal = FALSE;
-       g_return_if_fail( cache != NULL );
-       g_return_if_fail( folder != NULL );
-       g_return_if_fail( item != NULL );
+
+       g_return_val_if_fail( cache != NULL, FALSE );
+       g_return_val_if_fail( folder != NULL, FALSE );
+       g_return_val_if_fail( item != NULL, FALSE );
+
        retVal = addrcache_hash_add_folder( cache, item );
        if( retVal ) {
                addritem_folder_add_folder( folder, item );
@@ -405,9 +411,11 @@ gboolean addrcache_folder_add_folder( AddressCache *cache, ItemFolder *folder, I
 */
 gboolean addrcache_folder_add_group( AddressCache *cache, ItemFolder *folder, ItemGroup *item ) {
        gboolean retVal = FALSE;
-       g_return_if_fail( cache != NULL );
-       g_return_if_fail( folder != NULL );
-       g_return_if_fail( item != NULL );
+
+       g_return_val_if_fail( cache != NULL, FALSE );
+       g_return_val_if_fail( folder != NULL, FALSE );
+       g_return_val_if_fail( item != NULL, FALSE );
+
        retVal = addrcache_hash_add_group( cache, item );
        if( retVal ) {
                addritem_folder_add_group( folder, item );
@@ -421,8 +429,10 @@ gboolean addrcache_folder_add_group( AddressCache *cache, ItemFolder *folder, It
 */
 gboolean addrcache_add_person( AddressCache *cache, ItemPerson *person ) {
        gboolean retVal = FALSE;
-       g_return_if_fail( cache != NULL );
-       g_return_if_fail( person != NULL );
+
+       g_return_val_if_fail( cache != NULL, FALSE );
+       g_return_val_if_fail( person != NULL, FALSE );
+
        retVal = addrcache_hash_add_person( cache, person );
        if( retVal ) {
                addritem_folder_add_person( cache->rootFolder, person );
@@ -435,9 +445,10 @@ gboolean addrcache_add_person( AddressCache *cache, ItemPerson *person ) {
 * return: TRUE if item added.
 */
 gboolean addrcache_person_add_email( AddressCache *cache, ItemPerson *person, ItemEMail *email ) {
-       g_return_if_fail( cache != NULL );
-       g_return_if_fail( person != NULL );
-       g_return_if_fail( email != NULL );
+       g_return_val_if_fail( cache != NULL, FALSE );
+       g_return_val_if_fail( person != NULL, FALSE );
+       g_return_val_if_fail( email != NULL, FALSE );
+
        addritem_person_add_email( person, email );
        return TRUE;
 }
@@ -448,8 +459,10 @@ gboolean addrcache_person_add_email( AddressCache *cache, ItemPerson *person, It
 */
 gboolean addrcache_add_group( AddressCache *cache, ItemGroup *group ) {
        gboolean retVal = FALSE;
-       g_return_if_fail( cache != NULL );
-       g_return_if_fail( group != NULL );
+
+       g_return_val_if_fail( cache != NULL, FALSE );
+       g_return_val_if_fail( group != NULL, FALSE );
+
        retVal = addrcache_hash_add_group( cache, group );
        if( retVal ) {
                addritem_folder_add_group( cache->rootFolder, group );
@@ -462,9 +475,10 @@ gboolean addrcache_add_group( AddressCache *cache, ItemGroup *group ) {
 * return: TRUE if item added.
 */
 gboolean addrcache_group_add_email( AddressCache *cache, ItemGroup *group, ItemEMail *email ) {
-       g_return_if_fail( cache != NULL );
-       g_return_if_fail( group != NULL );
-       g_return_if_fail( email != NULL );
+       g_return_val_if_fail( cache != NULL, FALSE );
+       g_return_val_if_fail( group != NULL, FALSE );
+       g_return_val_if_fail( email != NULL, FALSE );
+
        addritem_group_add_email( group, email );
        return TRUE;
 }
@@ -475,8 +489,10 @@ gboolean addrcache_group_add_email( AddressCache *cache, ItemGroup *group, ItemE
 */
 gboolean addrcache_add_folder( AddressCache *cache, ItemFolder *folder ) {
        gboolean retVal = FALSE;
-       g_return_if_fail( cache != NULL );
-       g_return_if_fail( folder != NULL );
+
+       g_return_val_if_fail( cache != NULL, FALSE );
+       g_return_val_if_fail( folder != NULL, FALSE );
+
        retVal = addrcache_hash_add_folder( cache, folder );
        if( retVal ) {
                addritem_folder_add_folder( cache->rootFolder, folder );
@@ -493,7 +509,8 @@ AddrItemObject *addrcache_get_object( AddressCache *cache, const gchar *uid ) {
        AddrItemObject *obj = NULL;
        gchar *uidH;
 
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
+
        if( uid == NULL || *uid == '\0' ) return NULL;
        obj = ( AddrItemObject * ) g_hash_table_lookup( cache->itemHash, uid );
        if( obj ) {
@@ -514,6 +531,7 @@ AddrItemObject *addrcache_get_object( AddressCache *cache, const gchar *uid ) {
 ItemPerson *addrcache_get_person( AddressCache *cache, const gchar *uid ) {
        ItemPerson *person = NULL;
        AddrItemObject *obj = addrcache_get_object( cache, uid );
+
        if( obj ) {
                if( ADDRITEM_TYPE(obj) == ITEMTYPE_PERSON ) {
                        person = ( ItemPerson * ) obj;
@@ -530,6 +548,7 @@ ItemPerson *addrcache_get_person( AddressCache *cache, const gchar *uid ) {
 ItemGroup *addrcache_get_group( AddressCache *cache, const gchar *uid ) {
        ItemGroup *group = NULL;
        AddrItemObject *obj = addrcache_get_object( cache, uid );
+
        if( obj ) {
                if( ADDRITEM_TYPE(obj) == ITEMTYPE_GROUP ) {
                        group = ( ItemGroup * ) obj;
@@ -546,6 +565,7 @@ ItemGroup *addrcache_get_group( AddressCache *cache, const gchar *uid ) {
 */
 ItemEMail *addrcache_get_email( AddressCache *cache, const gchar *uid, const gchar *eid ) {
        AddrItemObject *objP;
+
        if( eid == NULL || *eid == '\0' ) return NULL;
 
        objP = addrcache_get_object( cache, uid );
@@ -578,6 +598,7 @@ ItemEMail *addrcache_get_email( AddressCache *cache, const gchar *uid, const gch
 UserAttribute *addrcache_person_remove_attrib_id( AddressCache *cache, const gchar *uid, const gchar *aid ) {
        UserAttribute *attrib = NULL;
        ItemPerson *person;
+
        if( aid == NULL || *aid == '\0' ) return NULL;
 
        person = addrcache_get_person( cache, uid );
@@ -595,7 +616,9 @@ UserAttribute *addrcache_person_remove_attrib_id( AddressCache *cache, const gch
 */
 UserAttribute *addrcache_person_remove_attribute( AddressCache *cache, ItemPerson *person, UserAttribute *attrib ) {
        UserAttribute *found = NULL;
-       g_return_if_fail( cache != NULL );
+
+       g_return_val_if_fail( cache != NULL, NULL );
+
        if( person && attrib ) {
                found = addritem_person_remove_attribute( person, attrib );
        }
@@ -610,7 +633,8 @@ UserAttribute *addrcache_person_remove_attribute( AddressCache *cache, ItemPerso
 ItemGroup *addrcache_remove_group_id( AddressCache *cache, const gchar *uid ) {
        AddrItemObject *obj = NULL;
 
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
+
        if( uid == NULL || *uid == '\0' ) return NULL;
        obj = ( AddrItemObject * ) g_hash_table_lookup( cache->itemHash, uid );
        if( obj ) {
@@ -635,13 +659,13 @@ ItemGroup *addrcache_remove_group_id( AddressCache *cache, const gchar *uid ) {
 ItemGroup *addrcache_remove_group( AddressCache *cache, ItemGroup *group ) {
        AddrItemObject *obj = NULL;
 
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
+
        if( group ) {
                gchar *uid = ADDRITEM_ID(group);
                if( uid == NULL || *uid == '\0' ) return NULL;
                obj = ( AddrItemObject * ) g_hash_table_lookup( cache->itemHash, uid );
                if( obj ) {
-                       ItemGroup *item = ( ItemGroup * ) obj;
                        ItemFolder *parent = ( ItemFolder * ) ADDRITEM_PARENT(group);
                        if( ! parent ) parent = cache->rootFolder;
 
@@ -659,6 +683,7 @@ ItemGroup *addrcache_remove_group( AddressCache *cache, ItemGroup *group ) {
 */
 static void addrcache_foldergrp_rem_person( ItemFolder *folder, ItemPerson *person ) {
        GList *nodeGrp = folder->listGroup;
+
        while( nodeGrp ) {
                ItemGroup *group = nodeGrp->data;
                if( group ) {
@@ -683,7 +708,8 @@ static void addrcache_foldergrp_rem_person( ItemFolder *folder, ItemPerson *pers
 ItemPerson *addrcache_remove_person_id( AddressCache *cache, const gchar *uid ) {
        AddrItemObject *obj = NULL;
 
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
+
        if( uid == NULL || *uid == '\0' ) return NULL;
        obj = ( AddrItemObject * ) g_hash_table_lookup( cache->itemHash, uid );
        if( obj ) {
@@ -712,7 +738,8 @@ ItemPerson *addrcache_remove_person_id( AddressCache *cache, const gchar *uid )
 ItemPerson *addrcache_remove_person( AddressCache *cache, ItemPerson *person ) {
        AddrItemObject *obj = NULL;
 
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
+
        if( person ) {
                gchar *uid = ADDRITEM_ID(person);
                if( uid == NULL || *uid == '\0' ) return NULL;
@@ -739,7 +766,8 @@ ItemPerson *addrcache_remove_person( AddressCache *cache, ItemPerson *person ) {
 static void addrcache_allgrp_rem_email_vis( gpointer key, gpointer value, gpointer data ) {
        AddrItemObject *obj = ( AddrItemObject * ) value;
        ItemEMail *email = ( ItemEMail * ) data;
-       if( ! email ) return;
+
+       if( !email ) return;
        if( ADDRITEM_TYPE(obj) == ITEMTYPE_GROUP ) {
                ItemGroup *group = ( ItemGroup * ) value;
                if( group ) {
@@ -758,6 +786,7 @@ static void addrcache_allgrp_rem_email_vis( gpointer key, gpointer value, gpoint
 ItemEMail *addrcache_person_remove_email_id( AddressCache *cache, const gchar *uid, const gchar *eid ) {
        ItemEMail *email = NULL;
        ItemPerson *person;
+
        if( eid == NULL || *eid == '\0' ) return NULL;
 
        person = addrcache_get_person( cache, uid );
@@ -786,7 +815,9 @@ ItemEMail *addrcache_person_remove_email_id( AddressCache *cache, const gchar *u
 */
 ItemEMail *addrcache_person_remove_email( AddressCache *cache, ItemPerson *person, ItemEMail *email ) {
        ItemEMail *found = NULL;
-       g_return_if_fail( cache != NULL );
+
+       g_return_val_if_fail( cache != NULL, NULL );
+
        if( person && email ) {
                found = addritem_person_remove_email( person, email );
                if( found ) {
@@ -814,7 +845,8 @@ GList *addrcache_folder_get_address_list( AddressCache *cache, ItemFolder *folde
        GList *list = NULL;
        GList *node = NULL;
        ItemFolder *f = folder;
-       g_return_if_fail( cache != NULL );
+
+       g_return_val_if_fail( cache != NULL, NULL );
 
        if( ! f ) f = cache->rootFolder;
        node = f->listPerson;
@@ -837,10 +869,9 @@ GList *addrcache_folder_get_address_list( AddressCache *cache, ItemFolder *folde
 * Return: List of items, or NULL if none.
 */
 GList *addrcache_folder_get_person_list( AddressCache *cache, ItemFolder *folder ) {
-       GList *list = NULL;
-       GList *node = NULL;
        ItemFolder *f = folder;
-       g_return_if_fail( cache != NULL );
+
+       g_return_val_if_fail( cache != NULL, NULL );
 
        if( ! f ) f = cache->rootFolder;
        return addritem_folder_get_person_list( f );
@@ -853,10 +884,10 @@ GList *addrcache_folder_get_person_list( AddressCache *cache, ItemFolder *folder
 * Return: List of items, or NULL if none.
 */
 GList *addrcache_folder_get_group_list( AddressCache *cache, ItemFolder *folder ) {
-       GList *node = NULL;
-       GList *list = NULL;
        ItemFolder *f = folder;
-       g_return_if_fail( cache != NULL );
+
+       g_return_val_if_fail( cache != NULL, NULL );
+
        if( ! f ) f = cache->rootFolder;
        return addritem_folder_get_group_list( f );
 }
@@ -871,7 +902,9 @@ GList *addrcache_folder_get_folder_list( AddressCache *cache, ItemFolder *folder
        GList *node = NULL;
        GList *list = NULL;
        ItemFolder *f = folder;
-       g_return_if_fail( cache != NULL );
+
+       g_return_val_if_fail( cache != NULL, NULL );
+
        if( ! f ) f = cache->rootFolder;
        node = f->listFolder;
        while( node ) {
@@ -888,8 +921,7 @@ GList *addrcache_folder_get_folder_list( AddressCache *cache, ItemFolder *folder
 * Return: List of items, or NULL if none.
 */
 GList *addrcache_get_address_list( AddressCache *cache ) {
-       GList *list = NULL;
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
        return addrcache_folder_get_address_list( cache, cache->rootFolder );
 }
 
@@ -900,7 +932,7 @@ GList *addrcache_get_address_list( AddressCache *cache ) {
 * Return: List of items, or NULL if none.
 */
 GList *addrcache_get_person_list( AddressCache *cache ) {
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
        return addritem_folder_get_person_list( cache->rootFolder );
 }
 
@@ -911,7 +943,7 @@ GList *addrcache_get_person_list( AddressCache *cache ) {
 * Return: List of items, or NULL if none.
 */
 GList *addrcache_get_group_list( AddressCache *cache ) {
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
        return cache->rootFolder->listGroup;
 }
 
@@ -922,7 +954,7 @@ GList *addrcache_get_group_list( AddressCache *cache ) {
 * Return: List of items, or NULL if none.
 */
 GList *addrcache_get_folder_list( AddressCache *cache ) {
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
        return cache->rootFolder->listFolder;
 }
 
@@ -931,6 +963,7 @@ GList *addrcache_get_folder_list( AddressCache *cache ) {
 */
 static void addrcache_get_grp_person_vis( gpointer key, gpointer value, gpointer data ) {
        AddrItemObject *obj = ( AddrItemObject * ) value;
+
        if( ADDRITEM_TYPE(obj) == ITEMTYPE_GROUP ) {
                AddressCache *cache = data;
                ItemGroup *group = ( ItemGroup * ) obj;
@@ -954,7 +987,9 @@ static void addrcache_get_grp_person_vis( gpointer key, gpointer value, gpointer
 */
 GList *addrcache_get_group_for_person( AddressCache *cache, ItemPerson *person ) {
        GList *list = NULL;
-       g_return_if_fail( cache != NULL );
+
+       g_return_val_if_fail( cache != NULL, NULL );
+
        cache->tempList = NULL;
        cache->tempList = g_list_append( cache->tempList, person );
        g_hash_table_foreach( cache->itemHash, addrcache_get_grp_person_vis, cache );
@@ -972,6 +1007,7 @@ GList *addrcache_get_group_for_person( AddressCache *cache, ItemPerson *person )
 ItemFolder *addrcache_find_root_folder( ItemFolder *folder ) {
        ItemFolder *item = folder;
        gint count = 0;
+
        while( item ) {
                if( item->isRoot ) break;
                if( ++count > ADDRCACHE_MAX_SEARCH_COUNT ) {
@@ -988,6 +1024,7 @@ ItemFolder *addrcache_find_root_folder( ItemFolder *folder ) {
 */
 static void addrcache_get_all_persons_vis( gpointer key, gpointer value, gpointer data ) {
        AddrItemObject *obj = ( AddrItemObject * ) value;
+
        if( ADDRITEM_TYPE(obj) == ITEMTYPE_PERSON ) {
                AddressCache *cache = data;
                cache->tempList = g_list_append( cache->tempList, obj );
@@ -1002,7 +1039,8 @@ static void addrcache_get_all_persons_vis( gpointer key, gpointer value, gpointe
 */
 GList *addrcache_get_all_persons( AddressCache *cache ) {
        GList *list = NULL;
-       g_return_if_fail( cache != NULL );
+
+       g_return_val_if_fail( cache != NULL, NULL );
 
        cache->tempList = NULL;
        g_hash_table_foreach( cache->itemHash, addrcache_get_all_persons_vis, cache );
@@ -1019,7 +1057,8 @@ GList *addrcache_get_all_persons( AddressCache *cache ) {
 ItemFolder *addrcache_remove_folder( AddressCache *cache, ItemFolder *folder ) {
        AddrItemObject *obj = NULL;
 
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
+
        if( folder ) {
                gchar *uid = ADDRITEM_ID(folder);
                if( uid == NULL || *uid == '\0' ) return NULL;
@@ -1071,15 +1110,14 @@ ItemFolder *addrcache_remove_folder( AddressCache *cache, ItemFolder *folder ) {
 ItemFolder *addrcache_remove_folder_delete( AddressCache *cache, ItemFolder *folder ) {
        AddrItemObject *obj = NULL;
 
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
+
        if( folder ) {
                gchar *uid = ADDRITEM_ID(folder);
                if( uid == NULL || *uid == '\0' ) return NULL;
                obj = ( AddrItemObject * ) g_hash_table_lookup( cache->itemHash, uid );
                if( obj ) {
                        ItemFolder *parent = ( ItemFolder * ) ADDRITEM_PARENT(folder);
-                       GList *node;
-                       AddrItemObject *aio;
                        if( ! parent ) parent = cache->rootFolder;
 
                        // Remove groups
@@ -1138,7 +1176,7 @@ ItemPerson *addrcache_add_contact( AddressCache *cache, ItemFolder *folder, cons
        ItemEMail *email = NULL;
        ItemFolder *f = folder;
 
-       g_return_if_fail( cache != NULL );
+       g_return_val_if_fail( cache != NULL, NULL );
 
        if( ! f ) f = cache->rootFolder;
 
@@ -1161,4 +1199,3 @@ ItemPerson *addrcache_add_contact( AddressCache *cache, ItemFolder *folder, cons
 /*
 * End of Source.
 */
-
index 2dce5f1..7c73334 100644 (file)
@@ -29,7 +29,7 @@
 #include <glib.h>
 #include "addritem.h"
 
-// Address book file.
+/* Address book file. */
 typedef struct _AddressCache AddressCache;
 struct _AddressCache {
        gint       nextID;
@@ -41,14 +41,15 @@ struct _AddressCache {
        ItemFolder *rootFolder;
 };
 
-// Function prototypes
+/* Function prototypes */
 AddressCache *addrcache_create();
 ItemFolder *addrcache_get_root_folder  ( AddressCache *cache );
 GList *addrcache_get_list_folder       ( AddressCache *cache );
 GList *addrcache_get_list_person       ( AddressCache *cache );
 
 void addrcache_refresh                 ( AddressCache *cache );
-void addrcache_empty                   ( AddressCache *cache );
+/* void addrcache_empty                        ( AddressCache *cache ); */
+void addrcache_clear                   ( AddressCache *cache );
 void addrcache_free                    ( AddressCache *cache );
 gboolean addrcache_check_file          ( AddressCache *cache, gchar *path );
 gboolean addrcache_mark_file           ( AddressCache *cache, gchar *path );
index dfeaf0d..dbb3928 100644 (file)
@@ -44,6 +44,7 @@
 #include "addritem.h"
 #include "addrbook.h"
 #include "addrindex.h"
+#include "manage_window.h"
 
 #include "pixmaps/book.xpm"
 #include "pixmaps/dir-open.xpm"
@@ -150,13 +151,10 @@ static void addressadd_create( void ) {
        GtkWidget *tree_folder;
        GtkWidget *vlbox;
        GtkWidget *tree_win;
-       GtkWidget *hlbox;
        GtkWidget *hbbox;
        GtkWidget *hsep;
        GtkWidget *ok_btn;
        GtkWidget *cancel_btn;
-       GtkWidget *check_btn;
-       GtkWidget *file_btn;
        GtkWidget *hsbox;
        GtkWidget *statusbar;
        gint top;
index 4626378..2548176 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -67,6 +67,7 @@
 #include "addrcache.h"
 #include "addrbook.h"
 #include "addrindex.h"
+#include "addressadd.h"
 #include "vcard.h"
 #include "editvcard.h"
 #include "editgroup.h"
@@ -135,13 +136,13 @@ static GdkBitmap *categoryxpmmask;
 static GdkPixmap *ldapxpm;
 static GdkBitmap *ldapxpmmask;
 
-// Message buffer
+/* Message buffer  */
 static gchar addressbook_msgbuf[ ADDRESSBOOK_MSGBUF_SIZE ];
 
-// Address list selection
+/* Address list selection  */
 static GList *_addressListSelection_ = NULL;
 
-// Address index file and interfaces
+/* Address index file and interfaces */
 static AddressIndex *_addressIndex_ = NULL;
 static GList *_addressInterfaceList_ = NULL;
 static GList *_addressIFaceSelection_ = NULL;
@@ -243,7 +244,7 @@ static void addressbook_file_save_cb                (gpointer        data,
                                                 guint           action,
                                                 GtkWidget      *widget);
 
-// Data source edit stuff
+/* Data source edit stuff  */
 static void addressbook_new_book_cb            ( gpointer      data,
                                                  guint         action,
                                                  GtkWidget     *widget );
@@ -283,10 +284,10 @@ static GtkCTreeNode *addressbook_node_add_folder
 static GtkCTreeNode *addressbook_node_add_group (GtkCTreeNode  *node,
                                                AddressDataSource *ds,
                                                ItemGroup       *itemGroup );
-static GtkCTreeNode *addressbook_node_add_category
+/* static GtkCTreeNode *addressbook_node_add_category
                                                (GtkCTreeNode   *node,
                                                 AddressDataSource *ds,
-                                                ItemFolder     *itemFolder );
+                                                ItemFolder     *itemFolder );  */
 static void addressbook_tree_remove_children   (GtkCTree       *ctree,
                                                GtkCTreeNode    *parent );
 static void addressbook_move_nodes_up          (GtkCTree       *ctree,
@@ -302,8 +303,8 @@ static void key_pressed                             (GtkWidget      *widget,
 static gint addressbook_list_compare_func      (GtkCList       *clist,
                                                 gconstpointer   ptr1,
                                                 gconstpointer   ptr2);
-//static gint addressbook_obj_name_compare     (gconstpointer   a,
-//                                              gconstpointer   b);
+/* static gint addressbook_obj_name_compare    (gconstpointer   a,
+                                                gconstpointer   b);  */
 
 static void addressbook_book_show_message      ( AddressBookFile *book );
 static void addressbook_vcard_show_message     ( VCardFile *vcf );
@@ -314,7 +315,7 @@ static void addressbook_jpilot_show_message ( JPilotFile *jpf );
 static void addressbook_ldap_show_message      ( SyldapServer *server );
 #endif
 
-// LUT's and IF stuff
+/* LUT's and IF stuff  */
 static void addressbook_free_adapter           ( GtkCTreeNode  *node );
 static void addressbook_free_child_adapters    ( GtkCTreeNode  *node );
 AddressTypeControlItem *addrbookctl_lookup     ( gint          ot );
@@ -349,7 +350,7 @@ static GtkItemFactoryEntry addressbook_entries[] =
        {N_("/_File/_Edit"),            NULL,           addressbook_treenode_edit_cb,   0, NULL},
        {N_("/_File/_Delete"),          NULL,           addressbook_treenode_delete_cb, 0, NULL},
        {N_("/_File/---"),              NULL,           NULL, 0, "<Separator>"},
-       {N_("/_File/_Save"),            "<alt>V",       addressbook_file_save_cb,       0, NULL},
+       {N_("/_File/_Save"),            "<alt>S",       addressbook_file_save_cb,       0, NULL},
        {N_("/_File/_Close"),           "<alt>W",       close_cb, 0, NULL},
        {N_("/_Address"),               NULL,           NULL, 0, "<Branch>"},
        {N_("/_Address/New _Address"),  "<alt>N",       addressbook_new_address_cb,     0, NULL},
@@ -362,7 +363,7 @@ static GtkItemFactoryEntry addressbook_entries[] =
        {N_("/_Help/_About"),           NULL,           about_show, 0, NULL}
 };
 
-// New options to be added.
+/* New options to be added. */
 /*
        {N_("/_Edit"),                  NULL,           NULL, 0, "<Branch>"},
        {N_("/_Edit/C_ut"),             "<ctl>X",       NULL,                           0, NULL},
@@ -405,8 +406,7 @@ void addressbook_open(Compose *target)
                addressbook_load_tree();
                gtk_ctree_select(GTK_CTREE(addrbook.ctree),
                                 GTK_CTREE_NODE(GTK_CLIST(addrbook.ctree)->row_list));
-       }
-       
+       } else
                gtk_widget_hide(addrbook.window);
 
        gtk_widget_show_all(addrbook.window);
@@ -465,7 +465,7 @@ static void addressbook_create( void ) {
        GtkWidget *label;
        GtkWidget *entry;
        GtkWidget *statusbar;
-       GtkWidget *hmbox;
+       /* GtkWidget *hmbox;  */
        GtkWidget *hbbox;
        GtkWidget *hsbox;
        GtkWidget *del_btn;
@@ -527,7 +527,7 @@ static void addressbook_create( void ) {
                                       GTK_POLICY_ALWAYS);
        gtk_widget_set_usize(ctree_swin, COL_FOLDER_WIDTH + 40, -1);
 
-       // Address index
+       /* Address index  */
        ctree = gtk_ctree_new(1, 0);
        gtk_container_add(GTK_CONTAINER(ctree_swin), ctree);
        gtk_clist_set_selection_mode(GTK_CLIST(ctree), GTK_SELECTION_BROWSE);
@@ -556,7 +556,7 @@ static void addressbook_create( void ) {
                                       GTK_POLICY_ALWAYS);
        gtk_box_pack_start(GTK_BOX(clist_vbox), clist_swin, TRUE, TRUE, 0);
 
-       // Address list
+       /* Address list  */
        clist = gtk_ctree_new_with_titles(N_COLS, 0, titles);
        gtk_container_add(GTK_CONTAINER(clist_swin), clist);
        gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_EXTENDED);
@@ -614,13 +614,13 @@ static void addressbook_create( void ) {
        gtk_paned_add1(GTK_PANED(paned), ctree_swin);
        gtk_paned_add2(GTK_PANED(paned), clist_vbox);
 
-       // Status bar
+       /* Status bar */
        hsbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_end(GTK_BOX(vbox), hsbox, FALSE, FALSE, BORDER_WIDTH);
        statusbar = gtk_statusbar_new();
        gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH);
 
-       // Button panel
+       /* 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);
@@ -666,15 +666,15 @@ static void addressbook_create( void ) {
                           GTK_SIGNAL_FUNC(addressbook_to_clicked),
                           GINT_TO_POINTER(COMPOSE_BCC));
 
-       // Build icons for interface
+       /* Build icons for interface  */
        PIXMAP_CREATE( window, interfacexpm, interfacexpmmask, interface_xpm );
 
-       // Build control tables
+       /* Build control tables */
        addrbookctl_build_map( window );
        addrbookctl_build_iflist();
        addrbookctl_build_ifselect();
 
-       // Add each interface into the tree as a root level folder
+       /* Add each interface into the tree as a root level folder  */
        nodeIf = _addressInterfaceList_;
        while( nodeIf ) {
                adapter = nodeIf->data;
@@ -694,7 +694,7 @@ static void addressbook_create( void ) {
                }
        }
 
-       // Popup menu
+       /* Popup menu */
        n_entries = sizeof(addressbook_tree_popup_entries) /
                sizeof(addressbook_tree_popup_entries[0]);
        tree_popup = menu_create_items(addressbook_tree_popup_entries,
@@ -807,7 +807,7 @@ static void addressbook_del_clicked(GtkButton *button, gpointer data)
        AddressObject *pobj, *obj;
        AdapterDSource *ads = NULL;
        GtkCTreeNode *nodeList;
-       gboolean remFlag, procFlag;
+       gboolean procFlag;
        AlertValue aval;
        AddressBookFile *abf = NULL;
        AddressDataSource *ds = NULL;
@@ -836,15 +836,15 @@ static void addressbook_del_clicked(GtkButton *button, gpointer data)
        abf = ds->rawDataSource;
        if( abf == NULL ) return;
 
-       // Confirm deletion
+       /* Confirm deletion */
        aval = alertpanel( _("Delete address(es)"),
                        _("Really delete the address(es)?"),
                        _("Yes"), _("No"), NULL );
        if( aval != G_ALERTDEFAULT ) return;
 
-       // Process deletions
+       /* Process deletions */
        if( pobj->type == ADDR_DATASOURCE || pobj->type == ADDR_ITEM_FOLDER ) {
-               // Items inside folders
+               /* Items inside folders */
                GList *node;
                node = _addressListSelection_;
                while( node ) {
@@ -860,7 +860,7 @@ static void addressbook_del_clicked(GtkButton *button, gpointer data)
                                        addritem_free_item_group( item );
                                        item = NULL;
                                }
-                               // Remove group from parent node
+                               /* Remove group from parent node  */
                                gtk_ctree_remove_node( ctree, nd );
                        }
                        else if( aio->type == ADDR_ITEM_PERSON ) {
@@ -886,7 +886,7 @@ static void addressbook_del_clicked(GtkButton *button, gpointer data)
                return;
        }
        else if( pobj->type == ADDR_ITEM_GROUP ) {
-               // Items inside groups
+               /* Items inside groups */
                GList *node;
                node = _addressListSelection_;
                while( node ) {
@@ -1029,7 +1029,7 @@ static void addressbook_menuitem_set_sensitive( AddressObject *obj, GtkCTreeNode
                iface = adapter->interface;
                if( iface ) {
                        if( iface->haveLibrary ) {
-                               // Enable appropriate File / New command
+                               /* Enable appropriate File / New command */
                                atci = adapter->atci;
                                menu_set_sensitive( addrbook.menu_factory, atci->menuCommand, TRUE );
                        }
@@ -1068,13 +1068,13 @@ static void addressbook_menuitem_set_sensitive( AddressObject *obj, GtkCTreeNode
 
        if( addrbook.listSelected == NULL ) canEdit = FALSE;
 
-       // Enable add
+       /* Enable add  */
        menu_set_sensitive( addrbook.menu_factory, "/Address/New Address", editAddress );
        menu_set_sensitive( addrbook.menu_factory, "/Address/New Group",   canAdd );
        menu_set_sensitive( addrbook.menu_factory, "/Address/New Folder",  canAdd );
        gtk_widget_set_sensitive( addrbook.reg_btn, editAddress );
 
-       // Enable edit
+       /* Enable edit */
        menu_set_sensitive( addrbook.menu_factory, "/Address/Edit",   canEdit );
        menu_set_sensitive( addrbook.menu_factory, "/Address/Delete", canEdit );
        gtk_widget_set_sensitive( addrbook.del_btn, canEdit );
@@ -1103,13 +1103,13 @@ static void addressbook_tree_selected(GtkCTree *ctree, GtkCTreeNode *node,
        addrbook.opened = node;
 
        if( obj->type == ADDR_DATASOURCE ) {
-               // Read from file
+               /*  Read from file */
                static gboolean tVal = TRUE;
 
                ads = ADAPTER_DSOURCE(obj);
                if( ads == NULL ) return;
                ds = ads->dataSource;
-               if( ds == NULL ) return;                
+               if( ds == NULL ) return;
 
                if( addrindex_ds_get_modify_flag( ds ) ) {
                        addrindex_ds_read_data( ds );
@@ -1121,12 +1121,12 @@ static void addressbook_tree_selected(GtkCTree *ctree, GtkCTreeNode *node,
                addressbook_ds_show_message( ds );
 
                if( ! addrindex_ds_get_access_flag( ds ) ) {
-                       // Remove existing folders and groups
+                       /* Remove existing folders and groups */
                        gtk_clist_freeze( GTK_CLIST(ctree) );
                        addressbook_tree_remove_children( ctree, node );
                        gtk_clist_thaw( GTK_CLIST(ctree) );
 
-                       // Load folders into the tree
+                       /* Load folders into the tree */
                        rootFolder = addrindex_ds_get_root_folder( ds );
                        if( ds->type == ADDR_IF_JPILOT ) {
                                addressbook_node_add_folder( node, ds, rootFolder, ADDR_CATEGORY );
@@ -1139,10 +1139,10 @@ static void addressbook_tree_selected(GtkCTree *ctree, GtkCTreeNode *node,
                }
        }
 
-       // Update address list
+       /* Update address list  */
        addressbook_set_clist( obj );
 
-       // Setup main menu selections
+       /* Setup main menu selections */
        addressbook_menubar_set_sensitive( FALSE );
        addressbook_menuitem_set_sensitive( obj, node );
 
@@ -1154,7 +1154,7 @@ static void addressbook_list_selected(GtkCList *clist, gint row, gint column,
                                      GdkEvent *event, gpointer data)
 {
        if (event && event->type == GDK_2BUTTON_PRESS) {
-               // Handle double click
+               /* Handle double click */
                if (prefs_common.add_address_by_click &&
                    addrbook.target_compose)
                        addressbook_to_clicked(NULL, NULL);
@@ -1163,6 +1163,7 @@ static void addressbook_list_selected(GtkCList *clist, gint row, gint column,
        }
 }
 
+#if 0
 static void addressbook_list_select_show() {
        GList *node = _addressListSelection_;
        gchar *addr = NULL;
@@ -1199,6 +1200,7 @@ static void addressbook_list_select_show() {
        }
        printf( "show selection...<<<\n" );
 }
+#endif
 
 static void addressbook_list_select_clear() {
        if( _addressListSelection_ ) {
@@ -1208,7 +1210,6 @@ static void addressbook_list_select_clear() {
 }
 
 static void addressbook_list_select_add( AddressObject *obj ) {
-       GList *node;
        if( obj ) {
                if(     obj->type == ADDR_ITEM_PERSON ||
                        obj->type == ADDR_ITEM_EMAIL ||
@@ -1218,7 +1219,7 @@ static void addressbook_list_select_add( AddressObject *obj ) {
                        }
                }
        }
-       // addressbook_list_select_show();
+       /* addressbook_list_select_show(); */
 }
 
 static void addressbook_list_select_remove( AddressObject *obj ) {
@@ -1226,7 +1227,7 @@ static void addressbook_list_select_remove( AddressObject *obj ) {
        if( _addressListSelection_ ) {
                _addressListSelection_ = g_list_remove( _addressListSelection_, obj );
        }
-       // addressbook_list_select_show();
+       /* addressbook_list_select_show(); */
 }
 
 static void addressbook_list_row_selected( GtkCTree *clist, GtkCTreeNode *node, gint column, gpointer data ) {
@@ -1243,7 +1244,7 @@ static void addressbook_list_row_selected( GtkCTree *clist, GtkCTreeNode *node,
        addrbook.listSelected = node;
        obj = gtk_ctree_node_get_row_data( clist, node );
        if( obj != NULL ) {
-               // printf( "list select: %d : '%s'\n", obj->type, obj->name );
+               /* printf( "list select: %d : '%s'\n", obj->type, obj->name ); */
                addressbook_list_select_add( obj );
        }
 
@@ -1294,13 +1295,12 @@ static void addressbook_list_row_selected( GtkCTree *clist, GtkCTreeNode *node,
 
 }
 
-static void addressbook_list_row_unselected( GtkCTree *clist, GtkCTreeNode *node, gint column, gpointer data ) {
-       GtkEntry *entry = GTK_ENTRY(addrbook.entry);
+static void addressbook_list_row_unselected( GtkCTree *ctree, GtkCTreeNode *node, gint column, gpointer data ) {
        AddressObject *obj;
 
-       obj = gtk_ctree_node_get_row_data( clist, node );
+       obj = gtk_ctree_node_get_row_data( ctree, node );
        if( obj != NULL ) {
-               // printf( "list unselect: %d : '%s'\n", obj->type, obj->name );
+               /* g_print( "list unselect: %d : '%s'\n", obj->type, obj->name ); */
                addressbook_list_select_remove( obj );
        }
 }
@@ -1333,11 +1333,11 @@ static void addressbook_tree_button_pressed(GtkWidget *ctree,
        GtkCList *clist = GTK_CLIST(ctree);
        gint row, column;
        AddressObject *obj = NULL;
-       GtkCTreeNode *node;
+       /* GtkCTreeNode *node; */
        AdapterDSource *ads = NULL;
        AddressInterface *iface = NULL;
        AddressDataSource *ds = NULL;
-       AddressTypeControlItem *atci = NULL;
+       /* AddressTypeControlItem *atci = NULL; */
        gboolean canEdit = FALSE;
 
        if( ! event ) return;
@@ -1385,7 +1385,7 @@ static void addressbook_tree_button_pressed(GtkWidget *ctree,
                }
        }
 
-       // Enable edit
+       /* Enable edit */
        menu_set_sensitive( addrbook.tree_factory, "/Edit",   canEdit );
        menu_set_sensitive( addrbook.tree_factory, "/Delete", canEdit );
        menu_set_sensitive( addrbook.menu_factory, "/File/Edit",   canEdit );
@@ -1525,12 +1525,12 @@ static gchar *addressbook_edit_datasource( AddressObject *obj, GtkCTreeNode *nod
        iface = ds->interface;
        if( ! iface->haveLibrary ) return NULL;
 
-       // Read data from data source
+       /* Read data from data source */
        if( ! addrindex_ds_get_read_flag( ds ) ) {
                addrindex_ds_read_data( ds );
        }
 
-       // Handle edit
+       /* Handle edit */
        ads = ADAPTER_DSOURCE(obj);
        if( ads->subType == ADDR_BOOK ) {
                 if( addressbook_edit_book( _addressIndex_, ads ) == NULL ) return NULL;
@@ -1603,7 +1603,7 @@ static void addressbook_treenode_edit_cb(gpointer data, guint action,
                }
        }
        if( name && parentNode ) {
-               // Update node in tree view
+               /* Update node in tree view */
                addressbook_change_node_name( node, name );
                gtk_ctree_sort_node(ctree, parentNode);
                gtk_ctree_expand( ctree, node );
@@ -1642,16 +1642,16 @@ static void addressbook_treenode_delete_cb(gpointer data, guint action,
                if( ds == NULL ) return;
        }
        else {
-               // Must be folder or something else
+               /* Must be folder or something else  */
                ds = addressbook_find_datasource( node );
                if( ds == NULL ) return;
 
-               // Only allow deletion from non-readOnly data sources
+               /* Only allow deletion from non-readOnly data sources */
                iface = ds->interface;
                if( iface->readOnly ) return;
        }
 
-       // Confirm deletion
+       /* Confirm deletion */
        if( obj->type == ADDR_ITEM_FOLDER ) {
                message = g_strdup_printf( _(
                                "Do you want to delete the folder AND all addresses in `%s' ? \n" \
@@ -1668,9 +1668,9 @@ static void addressbook_treenode_delete_cb(gpointer data, guint action,
                if (aval != G_ALERTDEFAULT) return;
        }
 
-       // Proceed with deletion
+       /* Proceed with deletion */
        if( obj->type == ADDR_DATASOURCE ) {
-               // Remove data source.
+               /* Remove data source */
                if( addrindex_index_remove_datasource( _addressIndex_, ds ) ) {
                        addressbook_free_child_adapters( node );
                        remFlag = TRUE;
@@ -1685,7 +1685,7 @@ static void addressbook_treenode_delete_cb(gpointer data, guint action,
                AdapterFolder *adapter = ADAPTER_FOLDER(obj);
                ItemFolder *item = adapter->itemFolder;
                if( aval == G_ALERTDEFAULT ) {
-                       // Remove folder only
+                       /* Remove folder only */
                        item = addrbook_remove_folder( abf, item );
                        if( item ) {
                                addritem_free_item_folder( item );
@@ -1694,7 +1694,7 @@ static void addressbook_treenode_delete_cb(gpointer data, guint action,
                        }
                }
                else if( aval == G_ALERTALTERNATE ) {
-                       // Remove folder and addresses
+                       /* Remove folder and addresses */
                        item = addrbook_remove_folder_delete( abf, item );
                        if( item ) {
                                addritem_free_item_folder( item );
@@ -1715,7 +1715,7 @@ static void addressbook_treenode_delete_cb(gpointer data, guint action,
        }
 
        if( remFlag ) {
-               // Free up adapter and remove node.
+               /* Free up adapter and remove node. */
                addressbook_free_adapter( node );
                gtk_ctree_remove_node(ctree, node );
        }
@@ -1736,7 +1736,7 @@ static void addressbook_new_address_cb( gpointer data, guint action, GtkWidget *
 
        if( pobj->type == ADDR_DATASOURCE ) {
                if( ADAPTER_DSOURCE(pobj)->subType == ADDR_BOOK ) {
-                       // New address
+                       /* New address */
                        ItemPerson *person = addressbook_edit_person( abf, NULL, NULL, FALSE );
                        if( person ) {
                                if( addrbook.treeSelected == addrbook.opened ) {
@@ -1746,7 +1746,7 @@ static void addressbook_new_address_cb( gpointer data, guint action, GtkWidget *
                }
        }
        else if( pobj->type == ADDR_ITEM_FOLDER ) {
-               // New address
+               /* New address  */
                ItemFolder *folder = ADAPTER_FOLDER(pobj)->itemFolder;
                ItemPerson *person = addressbook_edit_person( abf, folder, NULL, FALSE );
                if( person ) {
@@ -1756,11 +1756,11 @@ static void addressbook_new_address_cb( gpointer data, guint action, GtkWidget *
                }
        }
        else if( pobj->type == ADDR_ITEM_GROUP ) {
-               // New address in group
+               /* New address in group */
                ItemGroup *group = ADAPTER_GROUP(pobj)->itemGroup;
                if( addressbook_edit_group( abf, NULL, group ) == NULL ) return;
                if (addrbook.treeSelected == addrbook.opened) {
-                       // Change node name in tree.
+                       /* Change node name in tree. */
                        addressbook_change_node_name( addrbook.treeSelected, ADDRITEM_NAME(group) );
                        gtk_ctree_select( GTK_CTREE(addrbook.ctree), addrbook.opened );
                }
@@ -1793,8 +1793,9 @@ static GtkCTreeNode *addressbook_find_group_node( GtkCTreeNode *parent, ItemGrou
 static AddressBookFile *addressbook_get_book_file() {
        AddressBookFile *abf = NULL;
        AddressDataSource *ds = NULL;
+
        ds = addressbook_find_datasource( addrbook.treeSelected );
-       if( ds == NULL ) return;
+       if( ds == NULL ) return NULL;
        if( ds->type == ADDR_IF_BOOK ) abf = ds->rawDataSource;
        return abf;
 }
@@ -1803,10 +1804,10 @@ static void addressbook_tree_remove_children( GtkCTree *ctree, GtkCTreeNode *par
        GtkCTreeNode *node;
        GtkCTreeRow *row;
 
-       // Remove existing folders and groups
+       /* Remove existing folders and groups */
        row = GTK_CTREE_ROW( parent );
        if( row ) {
-               while( node = row->children ) {
+               while( (node = row->children) ) {
                        gtk_ctree_remove_node( ctree, node );
                }
        }
@@ -1818,7 +1819,7 @@ static void addressbook_move_nodes_up( GtkCTree *ctree, GtkCTreeNode *node ) {
        currRow = GTK_CTREE_ROW( node );
        if( currRow ) {
                parent = currRow->parent;
-               while( child = currRow->children ) {
+               while( (child = currRow->children) ) {
                        gtk_ctree_move( ctree, child, parent, node );
                }
                gtk_ctree_sort_node( ctree, parent );
@@ -1852,7 +1853,7 @@ static void addressbook_edit_address_cb( gpointer data, guint action, GtkWidget
                ItemPerson *person;
                if( email == NULL ) return;
                if( pobj && pobj->type == ADDR_ITEM_GROUP ) {
-                       // Edit parent group
+                       /* Edit parent group  */
                        AdapterGroup *adapter = ADAPTER_GROUP(pobj);
                        ItemGroup *itemGrp = adapter->itemGroup;
                        if( addressbook_edit_group( abf, NULL, itemGrp ) == NULL ) return;
@@ -1861,7 +1862,7 @@ static void addressbook_edit_address_cb( gpointer data, guint action, GtkWidget
                        parentNode = GTK_CTREE_ROW(node)->parent;
                }
                else {
-                       // Edit person - email page
+                       /* Edit person - email page */
                        person = ( ItemPerson * ) ADDRITEM_PARENT(email);
                        if( addressbook_edit_person( abf, NULL, person, TRUE ) == NULL ) return;
                        gtk_ctree_select( ctree, addrbook.opened );
@@ -1869,7 +1870,7 @@ static void addressbook_edit_address_cb( gpointer data, guint action, GtkWidget
                }
        }
        else if( obj->type == ADDR_ITEM_PERSON ) {
-               // Edit person - basic page
+               /* Edit person - basic page */
                ItemPerson *person = ( ItemPerson * ) obj;
                if( addressbook_edit_person( abf, NULL, person, FALSE ) == NULL ) return;
                gtk_ctree_select( ctree, addrbook.opened);
@@ -1886,7 +1887,7 @@ static void addressbook_edit_address_cb( gpointer data, guint action, GtkWidget
                return;
        }
 
-       // Update tree node with node name
+       /* Update tree node with node name */
        if( node == NULL ) return;
        addressbook_change_node_name( node, name );
        gtk_ctree_sort_node( ctree, parentNode );
@@ -1978,14 +1979,14 @@ static void addressbook_folder_load_person( GtkCTree *clist, ItemFolder *itemFol
        if( atci == NULL ) return;
        if( atciMail == NULL ) return;
 
-       // Load email addresses
+       /* Load email addresses  */
        items = addritem_folder_get_person_list( itemFolder );
        for( ; items != NULL; items = g_list_next( items ) ) {
                GtkCTreeNode *nodePerson = NULL;
                GtkCTreeNode *nodeEMail = NULL;
                gchar *text[N_COLS];
                gboolean flgFirst = TRUE, haveAddr = FALSE;
-               gint row;
+               /* gint row; */
                ItemPerson *person;
                GList *node;
 
@@ -2004,7 +2005,7 @@ static void addressbook_folder_load_person( GtkCTree *clist, ItemFolder *itemFol
                        eMailAddr = ADDRITEM_NAME(email);
                        if( *eMailAddr == '\0' ) eMailAddr = NULL;
                        if( flgFirst ) {
-                               // First email belongs with person
+                               /* First email belongs with person  */
                                gchar *str = addressbook_format_item_clist( person, email );
                                if( str ) {
                                        text[COL_NAME] = str;
@@ -2023,7 +2024,7 @@ static void addressbook_folder_load_person( GtkCTree *clist, ItemFolder *itemFol
                                gtk_ctree_node_set_row_data(clist, nodePerson, person );
                        }
                        else {
-                               // Subsequent email is a child node of person
+                               /* Subsequent email is a child node of person */
                                text[COL_NAME] = ADDRITEM_NAME(email);
                                nodeEMail = gtk_ctree_insert_node(
                                                clist, nodePerson, NULL,
@@ -2037,7 +2038,7 @@ static void addressbook_folder_load_person( GtkCTree *clist, ItemFolder *itemFol
                        haveAddr = TRUE;
                }
                if( ! haveAddr ) {
-                       // Have name without EMail
+                       /* Have name without EMail */
                        text[COL_NAME] = ADDRITEM_NAME(person);
                        text[COL_ADDRESS] = NULL;
                        text[COL_REMARKS] = NULL;
@@ -2051,7 +2052,7 @@ static void addressbook_folder_load_person( GtkCTree *clist, ItemFolder *itemFol
                }
                gtk_ctree_sort_node(GTK_CTREE(clist), NULL);
        }
-       // Free up the list
+       /* Free up the list */
        mgu_clear_list( items );
        g_list_free( items );
 }
@@ -2060,7 +2061,7 @@ static void addressbook_folder_load_group( GtkCTree *clist, ItemFolder *itemFold
        GList *items;
        AddressTypeControlItem *atci =  addrbookctl_lookup( ADDR_ITEM_GROUP );
 
-       // Load any groups
+       /* Load any groups */
        if( ! atci ) return;
        items = addritem_folder_get_group_list( itemFolder );
        for( ; items != NULL; items = g_list_next( items ) ) {
@@ -2079,7 +2080,7 @@ static void addressbook_folder_load_group( GtkCTree *clist, ItemFolder *itemFold
                gtk_ctree_node_set_row_data(clist, nodeGroup, group );
                gtk_ctree_sort_node(clist, NULL);
        }
-       // Free up the list
+       /* Free up the list */
        mgu_clear_list( items );
        g_list_free( items );
 }
@@ -2091,7 +2092,7 @@ static void addressbook_node_load_datasource( GtkCTree *clist, AddressObject *ob
        AdapterInterface *adapter;
        AddressInterface *iface;
        AddressTypeControlItem *atci = NULL;
-       AddressDataSource *ds;
+       /* AddressDataSource *ds; */
        GtkCTreeNode *newNode, *node;
        GtkCTreeRow *row;
        GtkCell *cell = NULL;
@@ -2103,7 +2104,7 @@ static void addressbook_node_load_datasource( GtkCTree *clist, AddressObject *ob
        atci = adapter->atci;
        if( atci == NULL ) return;
 
-       // Create nodes in list copying values for data sources in tree
+       /* Create nodes in list copying values for data sources in tree  */
        row = GTK_CTREE_ROW( adapter->treeNode );
        if( row ) {
                node = row->children;
@@ -2131,16 +2132,16 @@ static AddressDataSource *addressbook_find_datasource( GtkCTreeNode *node ) {
        AddressDataSource *ds = NULL;
        AddressObject *ao;
 
-       g_return_if_fail(addrbook.ctree != NULL);
+       g_return_val_if_fail(addrbook.ctree != NULL, NULL);
 
        while( node ) {
                if( GTK_CTREE_ROW(node)->level < 2 ) return NULL;
                ao = gtk_ctree_node_get_row_data( GTK_CTREE(addrbook.ctree), node );
                if( ao ) {
-//                     printf( "ao->type = %d\n", ao->type );
+/*                     printf( "ao->type = %d\n", ao->type );   */
                        if( ao->type == ADDR_DATASOURCE ) {
                                AdapterDSource *ads = ADAPTER_DSOURCE(ao);
-//                             printf( "found it\n" );
+/*                             printf( "found it\n" );           */
                                ds = ads->dataSource;
                                break;
                        }
@@ -2166,8 +2167,8 @@ static void addressbook_set_clist( AddressObject *obj ) {
        }
 
        if( obj->type == ADDR_INTERFACE ) {
-               // printf( "set_clist: loading datasource...\n" );
-               // addressbook_node_load_datasource( clist, obj );
+               /* printf( "set_clist: loading datasource...\n" );
+                addressbook_node_load_datasource( clist, obj ); */
                return;
        }
 
@@ -2178,7 +2179,7 @@ static void addressbook_set_clist( AddressObject *obj ) {
                ads = ADAPTER_DSOURCE(obj);
                ds = ADAPTER_DSOURCE(obj)->dataSource;
                if( ds ) {
-                       // Load root folder
+                       /* Load root folder */
                        ItemFolder *rootFolder = NULL;
                        rootFolder = addrindex_ds_get_root_folder( ds );
                        addressbook_folder_load_person( ctreelist, addrindex_ds_get_root_folder( ds ) );
@@ -2187,12 +2188,12 @@ static void addressbook_set_clist( AddressObject *obj ) {
        }
        else {
                if( obj->type == ADDR_ITEM_GROUP ) {
-                       // Load groups
+                       /* Load groups */
                        ItemGroup *itemGroup = ADAPTER_GROUP(obj)->itemGroup;
                        addressbook_load_group( ctreelist, itemGroup );
                }
                else if( obj->type == ADDR_ITEM_FOLDER ) {
-                       // Load folders
+                       /* Load folders  */
                        ItemFolder *itemFolder = ADAPTER_FOLDER(obj)->itemFolder;
                        addressbook_folder_load_person( ctreelist, itemFolder );
                        addressbook_folder_load_group( ctreelist, itemFolder );
@@ -2293,7 +2294,7 @@ static void addressbook_load_tree( void ) {
                atci = adapter->atci;
                if( iface ) {
                        if( iface->useInterface ) {
-                               // Load data sources below interface node
+                               /* Load data sources below interface node  */
                                nodeDS = iface->listSource;
                                while( nodeDS ) {
                                        ds = nodeDS->data;
@@ -2318,16 +2319,16 @@ static gboolean addressbook_convert( AddressIndex *addrIndex ) {
        gboolean errFlag = TRUE;
        gchar *msg = NULL;
 
-       // Read old address book, performing conversion
+       /* Read old address book, performing conversion */
        debug_print( "Reading and converting old address book...\n" );
        addrindex_set_file_name( addrIndex, ADDRESSBOOK_OLD_FILE );
        addrindex_read_data( addrIndex );
        if( addrIndex->retVal == MGU_NO_FILE ) {
-               // We do not have a file - new user
+               /* We do not have a file - new user */
                debug_print( "New user... create new books...\n" );
                addrindex_create_new_books( addrIndex );
                if( addrIndex->retVal == MGU_SUCCESS ) {
-                       // Save index file
+                       /* Save index file */
                        addrindex_set_file_name( addrIndex, ADDRESSBOOK_INDEX_FILE );
                        addrindex_save_data( addrIndex );
                        if( addrIndex->retVal == MGU_SUCCESS ) {
@@ -2335,69 +2336,63 @@ static gboolean addressbook_convert( AddressIndex *addrIndex ) {
                                errFlag = FALSE;
                        }
                        else {
-                               msg = g_strdup( _( "New user, could not save index file." ) );
+                               msg = _( "New user, could not save index file." );
                        }
                }
                else {
-                       msg = g_strdup( _( "New user, could not save address book files." ) );
+                       msg = _( "New user, could not save address book files." );
                }
        }
        else {
-               // We have an old file
+               /* We have an old file */
                if( addrIndex->wasConverted ) {
-                       // Converted successfully - save address index
+                       /* Converted successfully - save address index  */
                        addrindex_set_file_name( addrIndex, ADDRESSBOOK_INDEX_FILE );
                        addrindex_save_data( addrIndex );
                        if( addrIndex->retVal == MGU_SUCCESS ) {
-                               msg = g_strdup( _( "Old address book converted successfully." ) );
+                               msg = _( "Old address book converted successfully." );
                                retVal = TRUE;
                                errFlag = FALSE;
                        }
                        else {
-                               msg = g_strdup( _(
-                                       "Old address book converted, " \
-                                       "could not save new address index file" ) );
+                               msg = _("Old address book converted,\n"
+                                       "could not save new address index file" );
                        }
                }
                else {
-                       // File conversion failed - just create new books
+                       /* File conversion failed - just create new books */
                        debug_print( "File conversion failed... just create new books...\n" );
                        addrindex_create_new_books( addrIndex );
                        if( addrIndex->retVal == MGU_SUCCESS ) {
-                               // Save index
+                               /* Save index */
                                addrindex_set_file_name( addrIndex, ADDRESSBOOK_INDEX_FILE );
                                addrindex_save_data( addrIndex );
                                if( addrIndex->retVal == MGU_SUCCESS ) {
-                                       msg = g_strdup( _(
-                                               "Could not convert address book, " \
-                                               "but created empty new address book files." ) );
+                                       msg = _("Could not convert address book,\n"
+                                               "but created empty new address book files." );
                                        retVal = TRUE;
                                        errFlag = FALSE;
                                }
                                else {
-                                       msg = g_strdup( _(
-                                               "Could not convert address book, " \
-                                               "could not create new address book files." ) );
+                                       msg = _("Could not convert address book,\n"
+                                               "could not create new address book files." );
                                }
                        }
                        else {
-                               msg = g_strdup( _(
-                                       "Could not convert address book " \
-                                       "and could not create new address book files." ) );
+                               msg = _("Could not convert address book\n"
+                                       "and could not create new address book files." );
                        }
                }
        }
        if( errFlag ) {
                debug_print( "Error\n%s\n", msg );
-               alertpanel( _( "Sylpheed Addressbook Conversion Error" ), msg, _( "Close" ), NULL, NULL );
+               alertpanel( _( "Addressbook conversion error" ), msg, _( "Close" ), NULL, NULL );
        }
-       else {
-               if( msg ) {
-                       debug_print( "Warning\n%s\n", msg );
-                       alertpanel( _( "Sylpheed Addressbook Conversion" ), msg, _( "Close" ), NULL, NULL );
-               }
+       else if( msg ) {
+               debug_print( "Warning\n%s\n", msg );
+               alertpanel( _( "Addressbook conversion" ), msg, _( "Close" ), NULL, NULL );
        }
-       if( msg ) g_free( msg );
+
        return retVal;
 }
 
@@ -2412,13 +2407,13 @@ void addressbook_read_file( void ) {
 
        addrIndex = addrindex_create_index();
 
-       // Use new address book index.
+       /* Use new address book index. */
        addrindex_set_file_path( addrIndex, get_rc_dir() );
        addrindex_set_file_name( addrIndex, ADDRESSBOOK_INDEX_FILE );
        addrindex_read_data( addrIndex );
        if( addrIndex->retVal == MGU_NO_FILE ) {
-               // Conversion required
-               printf( "Converting...\n" );
+               /* Conversion required */
+               debug_print( "Converting...\n" );
                if( addressbook_convert( addrIndex ) ) {
                        _addressIndex_ = addrIndex;
                }
@@ -2427,17 +2422,17 @@ void addressbook_read_file( void ) {
                _addressIndex_ = addrIndex;
        }
        else {
-               // Error reading address book
-               gchar *msg = NULL;
+               /* Error reading address book */
                debug_print( "Could not read address index.\n" );
                addrindex_print_index( addrIndex, stdout );
-               msg = g_strdup( _( "Could not read address index" ) );
-               alertpanel( _( "Sylpheed Addressbook Error" ), msg, _( "Close" ), NULL, NULL );
-               g_free( msg );
+               alertpanel( _( "Addressbook Error" ),
+                           _( "Could not read address index" ),
+                           _( "Close" ), NULL, NULL );
        }
        debug_print( "done.\n" );
 }
 
+#if 0
 void addressbook_read_file_old( void ) {
        AddressIndex *addrIndex = NULL;
        gboolean errFlag = TRUE;
@@ -2450,24 +2445,24 @@ void addressbook_read_file_old( void ) {
 
        addrIndex = addrindex_create_index();
 
-       // Use use new address book.
-       // addrindex_set_file_path( addrIndex, "/home/match/tmp/empty-dir" );
+       /* Use use new address book. */
+       /* addrindex_set_file_path( addrIndex, "/home/match/tmp/empty-dir" );  */
        addrindex_set_file_path( addrIndex, get_rc_dir() );
        addrindex_set_file_name( addrIndex, ADDRESSBOOK_INDEX_FILE );
 
        debug_print( "Reading address index...\n" );
        addrindex_read_data( addrIndex );
        if( addrIndex->retVal == MGU_NO_FILE ) {
-               // Read old address book, performing conversion
+               /* Read old address book, performing conversion */
                debug_print( "Reading and converting old address book...\n" );
                addrindex_set_file_name( addrIndex, ADDRESSBOOK_OLD_FILE );
                addrindex_read_data( addrIndex );
                if( addrIndex->retVal == MGU_NO_FILE ) {
-                       // We do not have a file - new user
+                       /* We do not have a file - new user */
                        debug_print( "New user... create new books...\n" );
                        addrindex_create_new_books( addrIndex );
                        if( addrIndex->retVal == MGU_SUCCESS ) {
-                               // Save index file
+                               /* Save index file */
                                addrindex_set_file_name( addrIndex, ADDRESSBOOK_INDEX_FILE );
                                addrindex_save_data( addrIndex );
                                if( addrIndex->retVal == MGU_SUCCESS ) {
@@ -2482,9 +2477,9 @@ void addressbook_read_file_old( void ) {
                        }
                }
                else {
-                       // We have an old file
+                       /* We have an old file */
                        if( addrIndex->wasConverted ) {
-                               // Converted successfully - save address index
+                               /* Converted successfully - save address index  */
                                addrindex_set_file_name( addrIndex, ADDRESSBOOK_INDEX_FILE );
                                addrindex_save_data( addrIndex );
                                if( addrIndex->retVal == MGU_SUCCESS ) {
@@ -2498,11 +2493,11 @@ void addressbook_read_file_old( void ) {
                                }
                        }
                        else {
-                               // File conversion failed - just create new books
+                               /* File conversion failed - just create new books */
                                debug_print( "File conversion failed... just create new books...\n" );
                                addrindex_create_new_books( addrIndex );
                                if( addrIndex->retVal == MGU_SUCCESS ) {
-                                       // Save index
+                                       /* Save index */
                                        addrindex_set_file_name( addrIndex, ADDRESSBOOK_INDEX_FILE );
                                        addrindex_save_data( addrIndex );
                                        if( addrIndex->retVal == MGU_SUCCESS ) {
@@ -2548,6 +2543,7 @@ void addressbook_read_file_old( void ) {
        if( msg ) g_free( msg );
        debug_print( "done.\n" );
 }
+#endif
 
 /*
 * Add object into the address index tree widget.
@@ -2570,7 +2566,7 @@ static GtkCTreeNode *addressbook_add_object(GtkCTreeNode *node,
        pobj = gtk_ctree_node_get_row_data(ctree, node);
        g_return_val_if_fail(pobj != NULL, NULL);
 
-       // Determine object type to be displayed
+       /* Determine object type to be displayed  */
        if( obj->type == ADDR_DATASOURCE ) {
                otype = ADAPTER_DSOURCE(obj)->subType;
        }
@@ -2578,12 +2574,12 @@ static GtkCTreeNode *addressbook_add_object(GtkCTreeNode *node,
                otype = obj->type;
        }
 
-       // Handle any special conditions.
+       /* Handle any special conditions. */
        added = node;
        atci = addrbookctl_lookup( otype );
        if( atci ) {
                if( atci->showInTree ) {
-                       // Add object to tree
+                       /* Add object to tree */
                        gchar **name;
                        name = &obj->name;
                        added = gtk_ctree_insert_node( ctree, node, NULL, name, FOLDER_SPACING,
@@ -2612,8 +2608,8 @@ static GtkCTreeNode *addressbook_node_add_group( GtkCTreeNode *node, AddressData
        AddressTypeControlItem *atci = NULL;
        gchar **name;
 
-       if( ds == NULL ) return;
-       if( node == NULL || itemGroup == NULL ) return;
+       if( ds == NULL ) return NULL;
+       if( node == NULL || itemGroup == NULL ) return NULL;
 
        name = &itemGroup->obj.name;
 
@@ -2654,7 +2650,7 @@ static GtkCTreeNode *addressbook_node_add_folder(
        if( ds == NULL ) return NULL;
        if( node == NULL || itemFolder == NULL ) return NULL;
 
-       // Determine object type
+       /* Determine object type */
        atci = addrbookctl_lookup( otype );
        if( atci == NULL ) return NULL;
 
@@ -2697,7 +2693,7 @@ static void addressbook_delete_object(AddressObject *obj) {
        AddressDataSource *ds = NULL;
        if (!obj) return;
 
-       // Remove data source.
+       /* Remove data source. */
        printf( "Delete obj type : %d\n", obj->type );
 
        ads = ADAPTER_DSOURCE(obj);
@@ -2705,17 +2701,17 @@ static void addressbook_delete_object(AddressObject *obj) {
        ds = ads->dataSource;
        if( ds == NULL ) return;
 
-       // Remove data source
+       /* Remove data source */
        if( addrindex_index_remove_datasource( _addressIndex_, ds ) ) {
                addrindex_free_datasource( _addressIndex_, ds );
        }
-       // Free up Adapter object
+       /* Free up Adapter object */
        g_free( ADAPTER_DSOURCE(obj) );
 }
 
 void addressbook_export_to_file( void ) {
        if( _addressIndex_ ) {
-               // Save all new address book data
+               /* Save all new address book data */
                debug_print( "Saving address books...\n" );
                addrindex_save_all_books( _addressIndex_ );
 
@@ -2725,7 +2721,7 @@ void addressbook_export_to_file( void ) {
                        addrindex_print_index( _addressIndex_, stdout );
                }
 
-               // Notify address completion of new data
+               /* Notify address completion of new data  */
                invalidate_address_completion();
        }
 }
@@ -2940,7 +2936,7 @@ static void ldapsearch_callback( SyldapServer *sls ) {
                        if( ! iface->haveLibrary ) return;
                        server = ds->rawDataSource;
                        if( server == sls ) {
-                               // Read from cache
+                               /* Read from cache */
                                gtk_widget_show_all(addrbook.window);
                                addressbook_set_clist( obj );
                                addressbook_ldap_show_message( sls );
@@ -2958,9 +2954,11 @@ static void ldapsearch_callback( SyldapServer *sls ) {
 static void addressbook_lup_clicked( GtkButton *button, gpointer data ) {
        GtkCTree *ctree = GTK_CTREE(addrbook.ctree);
        AddressObject *obj;
+#ifdef USE_LDAP
        AdapterDSource *ads = NULL;
        AddressDataSource *ds = NULL;
        AddressInterface *iface = NULL;
+#endif
        gchar *sLookup;
 
        sLookup = gtk_editable_get_chars( GTK_EDITABLE(addrbook.entry), 0, -1 );
@@ -3008,7 +3006,7 @@ static void addressbook_lup_clicked( GtkButton *button, gpointer data ) {
 void addrbookctl_build_map( GtkWidget *window ) {
        AddressTypeControlItem *atci;
 
-       // Build icons
+       /* Build icons */
        PIXMAP_CREATE(window, folderxpm, folderxpmmask, DIRECTORY_CLOSE_XPM);
        PIXMAP_CREATE(window, folderopenxpm, folderopenxpmmask, DIRECTORY_OPEN_XPM);
        PIXMAP_CREATE(window, groupxpm, groupxpmmask, group_xpm);
@@ -3022,7 +3020,7 @@ void addrbookctl_build_map( GtkWidget *window ) {
        _addressBookTypeHash_ = g_hash_table_new( g_int_hash, g_int_equal );
        _addressBookTypeList_ = NULL;
 
-       // Interface
+       /* Interface */
        atci = g_new0( AddressTypeControlItem, 1 );
        atci->objectType = ADDR_INTERFACE;
        atci->interfaceType = ADDR_IF_NONE;
@@ -3038,7 +3036,7 @@ void addrbookctl_build_map( GtkWidget *window ) {
        g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
        _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
 
-       // Address book
+       /* Address book  */
        atci = g_new0( AddressTypeControlItem, 1 );
        atci->objectType = ADDR_BOOK;
        atci->interfaceType = ADDR_IF_BOOK;
@@ -3054,7 +3052,7 @@ void addrbookctl_build_map( GtkWidget *window ) {
        g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
        _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
 
-       // Item person
+       /* Item person */
        atci = g_new0( AddressTypeControlItem, 1 );
        atci->objectType = ADDR_ITEM_PERSON;
        atci->interfaceType = ADDR_IF_NONE;
@@ -3070,7 +3068,7 @@ void addrbookctl_build_map( GtkWidget *window ) {
        g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
        _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
 
-       // Item email
+       /* Item email */
        atci = g_new0( AddressTypeControlItem, 1 );
        atci->objectType = ADDR_ITEM_EMAIL;
        atci->interfaceType = ADDR_IF_NONE;
@@ -3086,7 +3084,7 @@ void addrbookctl_build_map( GtkWidget *window ) {
        g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
        _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
 
-       // Item group
+       /* Item group */
        atci = g_new0( AddressTypeControlItem, 1 );
        atci->objectType = ADDR_ITEM_GROUP;
        atci->interfaceType = ADDR_IF_BOOK;
@@ -3102,7 +3100,7 @@ void addrbookctl_build_map( GtkWidget *window ) {
        g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
        _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
 
-       // Item folder
+       /* Item folder */
        atci = g_new0( AddressTypeControlItem, 1 );
        atci->objectType = ADDR_ITEM_FOLDER;
        atci->interfaceType = ADDR_IF_BOOK;
@@ -3118,7 +3116,7 @@ void addrbookctl_build_map( GtkWidget *window ) {
        g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
        _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
 
-       // V-Card
+       /* V-Card */
        atci = g_new0( AddressTypeControlItem, 1 );
        atci->objectType = ADDR_VCARD;
        atci->interfaceType = ADDR_IF_VCARD;
@@ -3134,7 +3132,7 @@ void addrbookctl_build_map( GtkWidget *window ) {
        g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
        _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
 
-       // J-Pilot
+       /* J-Pilot */
        atci = g_new0( AddressTypeControlItem, 1 );
        atci->objectType = ADDR_JPILOT;
        atci->interfaceType = ADDR_IF_JPILOT;
@@ -3150,7 +3148,7 @@ void addrbookctl_build_map( GtkWidget *window ) {
        g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
        _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
 
-       // Category
+       /* Category */
        atci = g_new0( AddressTypeControlItem, 1 );
        atci->objectType = ADDR_CATEGORY;
        atci->interfaceType = ADDR_IF_JPILOT;
@@ -3166,7 +3164,7 @@ void addrbookctl_build_map( GtkWidget *window ) {
        g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci );
        _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci );
 
-       // LDAP Server
+       /* LDAP Server */
        atci = g_new0( AddressTypeControlItem, 1 );
        atci->objectType = ADDR_LDAP;
        atci->interfaceType = ADDR_IF_LDAP;
@@ -3309,15 +3307,15 @@ void addrbookctl_build_ifselect() {
        gchar *endptr = NULL;
        gboolean enabled;
        AdapterInterface *adapter;
-       GList *node;
+       /* GList *node; */
 
        selectStr = g_strdup( ADDRESSBOOK_IFACE_SELECTION );
 
-       // Parse string
+       /* Parse string */
        splitStr = g_strsplit( selectStr, ",", -1 );
        for( i = 0; i < ADDRESSBOOK_MAX_IFACE; i++ ) {
                if( splitStr[i] ) {
-                       // printf( "%d : %s\n", i, splitStr[i] );
+                       /* printf( "%d : %s\n", i, splitStr[i] ); */
                        ifType = strtol( splitStr[i], &endptr, 10 );
                        enabled = TRUE;
                        if( *endptr ) {
@@ -3325,7 +3323,7 @@ void addrbookctl_build_ifselect() {
                                        enabled = FALSE;
                                }
                        }
-                       // printf( "\t%d : %s\n", ifType, enabled ? "yes" : "no" );
+                       /* printf( "\t%d : %s\n", ifType, enabled ? "yes" : "no" ); */
                        adapter = addrbookctl_find_interface( ifType );
                        if( adapter ) {
                                newList = g_list_append( newList, adapter );
@@ -3335,11 +3333,11 @@ void addrbookctl_build_ifselect() {
                        break;
                }
        }
-       // printf( "i=%d\n", i );
+       /* printf( "i=%d\n", i ); */
        g_strfreev( splitStr );
        g_free( selectStr );
 
-       // Replace existing list
+       /* Replace existing list */
        mgu_clear_list( _addressIFaceSelection_ );
        g_list_free( _addressIFaceSelection_ );
        _addressIFaceSelection_ = newList;
@@ -3377,7 +3375,7 @@ gboolean addressbook_add_contact( const gchar *name, const gchar *address, const
 * Return: TRUE if data loaded, FALSE if address index not loaded.
 */
 gboolean addressbook_load_completion( gint (*callBackFunc) ( const gchar *, const gchar * ) ) {
-       AddressInterface *interface;
+       /* AddressInterface *interface; */
        AddressDataSource *ds;
        GList *nodeIf, *nodeDS;
        GList *listP, *nodeP;
@@ -3395,28 +3393,28 @@ gboolean addressbook_load_completion( gint (*callBackFunc) ( const gchar *, cons
                while( nodeDS ) {
                        ds = nodeDS->data;
 
-                       // Read address book
+                       /* Read address book */
                        if( ! addrindex_ds_get_read_flag( ds ) ) {
                                addrindex_ds_read_data( ds );
                        }
 
-                       // Get all persons
+                       /* Get all persons */
                        listP = addrindex_ds_get_all_persons( ds );
                        nodeP = listP;
                        while( nodeP ) {
                                ItemPerson *person = nodeP->data;
                                nodeM = person->listEMail;
 
-                               // Figure out name to use
+                               /* Figure out name to use */
                                sName = person->nickName;
                                if( sName == NULL || *sName == '\0' ) {
                                        sName = ADDRITEM_NAME(person);
                                }
 
-                               // Process each E-Mail address
+                               /* Process each E-Mail address */
                                while( nodeM ) {
                                        ItemEMail *email = nodeM->data;
-                                       // Have mail
+                                       /* Have mail */
                                        sFriendly = sName;
                                        sAddress = email->address;
                                        if( sAddress || *sAddress != '\0' ) {
@@ -3431,7 +3429,7 @@ gboolean addressbook_load_completion( gint (*callBackFunc) ( const gchar *, cons
                                }
                                nodeP = g_list_next( nodeP );
                        }
-                       // Free up the list
+                       /* Free up the list */
                        g_list_free( listP );
 
                        nodeDS = g_list_next( nodeDS );
index 7a0d5ad..371bf93 100644 (file)
@@ -28,6 +28,7 @@
 void addressbook_open                  (Compose        *target);
 void addressbook_set_target_compose    (Compose        *target);
 Compose *addressbook_get_target_compose        (void);
+void addressbook_read_file             (void);
 void addressbook_export_to_file                (void);
 gint addressbook_obj_name_compare      (gconstpointer   a,
                                         gconstpointer   b);
index a8d1f9b..58a620a 100644 (file)
@@ -32,6 +32,7 @@
 
 #ifndef DEV_STANDALONE
 #include "prefs.h"
+#include "codeconv.h"
 #endif
 
 #include "vcard.h"
@@ -134,7 +135,6 @@ static AddressInterface *addrindex_create_interface( gint type, gchar *name, gch
 */
 static void addrindex_build_if_list( AddressIndex *addrIndex ) {
        AddressInterface *iface;
-       gint seq = 0;
 
        iface = addrindex_create_interface( ADDR_IF_BOOK, "Address Book", TAG_IF_ADDRESS_BOOK, TAG_DS_ADDRESS_BOOK );
        iface->readOnly      = FALSE;
@@ -353,7 +353,7 @@ static void addrindex_free_all_datasources( AddressInterface *iface ) {
        }
 }
 
-static addrindex_free_interface( AddressInterface *iface ) {
+static void addrindex_free_interface( AddressInterface *iface ) {
        addrindex_free_all_datasources( iface );
 
        g_free( ADDRITEM_ID(iface) );
@@ -384,6 +384,7 @@ static addrindex_free_interface( AddressInterface *iface ) {
 */
 AddressIndex *addrindex_create_index() {
        AddressIndex *addrIndex = g_new0( AddressIndex, 1 );
+
        ADDRITEM_TYPE(addrIndex) = ITEMTYPE_INDEX;
        ADDRITEM_ID(addrIndex) = NULL;
        ADDRITEM_NAME(addrIndex) = g_strdup( "Address Index" );
@@ -422,7 +423,7 @@ void addrindex_set_dirty( AddressIndex *addrIndex, const gboolean value ) {
 * Return list of interfaces.
 */
 GList *addrindex_get_interface_list( AddressIndex *addrIndex ) {
-       g_return_if_fail( addrIndex != NULL );
+       g_return_val_if_fail( addrIndex != NULL, NULL );
        return addrIndex->interfaceList;
 }
 
@@ -431,6 +432,7 @@ GList *addrindex_get_interface_list( AddressIndex *addrIndex ) {
 */
 void addrindex_free_index( AddressIndex *addrIndex ) {
        GList *node;
+
        g_return_if_fail( addrIndex != NULL );
 
        g_free( ADDRITEM_ID(addrIndex) );
@@ -481,7 +483,9 @@ void addrindex_print_index( AddressIndex *addrIndex, FILE *stream ) {
 AddressInterface *addrindex_get_interface( AddressIndex *addrIndex, AddressIfType ifType ) {
        AddressInterface *retVal = NULL;
        GList *node;
-       g_return_if_fail( addrIndex != NULL );
+
+       g_return_val_if_fail( addrIndex != NULL, NULL );
+
        node = addrIndex->interfaceList;
        while( node ) {
                AddressInterface *iface = node->data;
@@ -520,8 +524,9 @@ AddressDataSource *addrindex_create_datasource() {
 AddressDataSource *addrindex_index_add_datasource( AddressIndex *addrIndex, AddressIfType ifType, gpointer dataSource ) {
        AddressInterface *iface;
        AddressDataSource *ds = NULL;
-       g_return_if_fail( addrIndex != NULL );
-       g_return_if_fail( dataSource != NULL );
+
+       g_return_val_if_fail( addrIndex != NULL, NULL );
+       g_return_val_if_fail( dataSource != NULL, NULL );
 
        iface = addrindex_get_interface( addrIndex, ifType );
        if( iface ) {
@@ -546,8 +551,9 @@ AddressDataSource *addrindex_index_add_datasource( AddressIndex *addrIndex, Addr
 AddressDataSource *addrindex_index_remove_datasource( AddressIndex *addrIndex, AddressDataSource *dataSource ) {
        AddressDataSource *retVal = FALSE;
        AddressInterface *iface;
-       g_return_if_fail( addrIndex != NULL );
-       g_return_if_fail( dataSource != NULL );
+
+       g_return_val_if_fail( addrIndex != NULL, NULL );
+       g_return_val_if_fail( dataSource != NULL, NULL );
 
        iface = addrindex_get_interface( addrIndex, dataSource->type );
        if( iface ) {
@@ -562,6 +568,7 @@ AddressDataSource *addrindex_index_remove_datasource( AddressIndex *addrIndex, A
 static AddressInterface *addrindex_tag_get_interface( AddressIndex *addrIndex, gchar *tag, AddressIfType ifType ) {
        AddressInterface *retVal = NULL;
        GList *node = addrIndex->interfaceList;
+
        while( node ) {
                AddressInterface *iface = node->data;
                node = g_list_next( node );
@@ -584,6 +591,7 @@ static AddressInterface *addrindex_tag_get_interface( AddressIndex *addrIndex, g
 static AddressInterface *addrindex_tag_get_datasource( AddressIndex *addrIndex, AddressIfType ifType, gchar *tag ) {
        AddressInterface *retVal = NULL;
        GList *node = addrIndex->interfaceList;
+
        while( node ) {
                AddressInterface *iface = node->data;
                node = g_list_next( node );
@@ -915,8 +923,8 @@ static void addrindex_write_ldap( FILE *fp, AddressDataSource *ds, gint lvl ) {
 */
 static void addrindex_read_index( AddressIndex *addrIndex, XMLFile *file ) {
        guint prev_level;
-       gchar *element;
-       GList *attr;
+       //gchar *element;
+       //GList *attr;
        XMLTag *xtag;
        AddressInterface *iface = NULL, *dsIFace = NULL;
        AddressDataSource *ds;
@@ -995,7 +1003,8 @@ static void addrindex_read_index( AddressIndex *addrIndex, XMLFile *file ) {
 static gint addrindex_read_file( AddressIndex *addrIndex ) {
        XMLFile *file = NULL;
        gchar *fileSpec = NULL;
-       g_return_if_fail( addrIndex != NULL );
+
+       g_return_val_if_fail( addrIndex != NULL, -1 );
 
        fileSpec = g_strconcat( addrIndex->filePath, G_DIR_SEPARATOR_S, addrIndex->fileName, NULL );
        addrIndex->retVal = MGU_NO_FILE;
@@ -1071,7 +1080,7 @@ gint addrindex_write_to( AddressIndex *addrIndex, const gchar *newFile ) {
        PrefFile *pfile;
 #endif
 
-       g_return_if_fail( addrIndex != NULL );
+       g_return_val_if_fail( addrIndex != NULL, -1 );
 
        fileSpec = g_strconcat( addrIndex->filePath, G_DIR_SEPARATOR_S, newFile, NULL );
        addrIndex->retVal = MGU_OPEN_FILE;
@@ -1113,7 +1122,7 @@ gint addrindex_write_to( AddressIndex *addrIndex, const gchar *newFile ) {
 * return: Status code, from addrIndex->retVal.
 */
 gint addrindex_save_data( AddressIndex *addrIndex ) {
-       g_return_if_fail( addrIndex != NULL );
+       g_return_val_if_fail( addrIndex != NULL, -1 );
 
        addrIndex->retVal = MGU_NO_FILE;
        if( addrIndex->fileName == NULL || *addrIndex->fileName == '\0' ) return addrIndex->retVal;
@@ -1133,6 +1142,7 @@ gint addrindex_save_data( AddressIndex *addrIndex ) {
 gint addrindex_save_all_books( AddressIndex *addrIndex ) {
        gint retVal = MGU_SUCCESS;
        GList *nodeIf, *nodeDS;
+
        nodeIf = addrIndex->interfaceList;
        while( nodeIf ) {
                AddressInterface *iface = nodeIf->data;
@@ -1311,6 +1321,7 @@ static void addrindex_consume_tree( XMLFile *file ) {
 */
 static void addrindex_print_node( AddressCvtNode *node, FILE *stream  ) {
        GList *list;
+
        fprintf( stream, "Node:\ttype :%d:\n", node->type );
        fprintf( stream, "\tname :%s:\n", node->name );
        fprintf( stream, "\taddr :%s:\n", node->address );
@@ -1332,6 +1343,7 @@ static void addrindex_print_node( AddressCvtNode *node, FILE *stream  ) {
 */
 static void addrindex_free_node( AddressCvtNode *node ) {
        GList *list = node->list;
+
        while( list ) {
                AddressCvtNode *lNode = list->data;
                list = g_list_next( list );
@@ -1353,7 +1365,7 @@ static void addrindex_process_node(
                ItemGroup *parentGrp, ItemFolder *folderGrp )
 {
        GList *list;
-       ItemFolder *itemFolder;
+       ItemFolder *itemFolder = NULL;
        ItemGroup *itemGParent = parentGrp;
        ItemFolder *itemGFolder = folderGrp;
        AddressCache *cache = abf->addressCache;
@@ -1608,7 +1620,7 @@ static gboolean addrindex_create_new_book( AddressIndex *addrIndex, gchar *displ
 *      "Gathered addresses" - a new address book.
 */
 gint addrindex_read_data( AddressIndex *addrIndex ) {
-       g_return_if_fail( addrIndex != NULL );
+       g_return_val_if_fail( addrIndex != NULL, -1 );
 
        addrIndex->conversionError = FALSE;
        addrindex_read_file( addrIndex );
@@ -1639,7 +1651,7 @@ gint addrindex_read_data( AddressIndex *addrIndex ) {
 gint addrindex_create_new_books( AddressIndex *addrIndex ) {
        gboolean flg;
 
-       g_return_if_fail( addrIndex != NULL );
+       g_return_val_if_fail( addrIndex != NULL, -1 );
 
        flg = addrindex_create_new_book( addrIndex, DISP_NEW_COMMON );
        if( flg ) {
@@ -1842,5 +1854,3 @@ GList *addrindex_ds_get_all_persons( AddressDataSource *ds ) {
 /*
 * End of Source.
 */
-
-
index 5517745..f078afa 100644 (file)
@@ -309,8 +309,10 @@ void addritem_print_item_person( ItemPerson *person, FILE *stream ) {
 */
 gboolean addritem_person_add_email( ItemPerson *person, ItemEMail *email ) {
        GList *node;
-       g_return_if_fail( person != NULL );
-       g_return_if_fail( email != NULL );
+
+       g_return_val_if_fail( person != NULL, FALSE );
+       g_return_val_if_fail( email != NULL, FALSE );
+
        node = person->listEMail;
        while( node ) {
                if( node->data == email ) return FALSE;
@@ -330,7 +332,8 @@ gboolean addritem_person_add_email( ItemPerson *person, ItemEMail *email ) {
 ItemEMail *addritem_person_get_email( ItemPerson *person, const gchar *eid ) {
        ItemEMail *email = NULL;
        GList *node;
-       g_return_if_fail( person != NULL );
+
+       g_return_val_if_fail( person != NULL, NULL );
        if( eid == NULL || *eid == '\0' ) return NULL;
 
        // Look for email
@@ -357,7 +360,8 @@ ItemEMail *addritem_person_get_email( ItemPerson *person, const gchar *eid ) {
 ItemEMail *addritem_person_remove_email_id( ItemPerson *person, const gchar *eid ) {
        ItemEMail *email = NULL;
        GList *node;
-       g_return_if_fail( person != NULL );
+
+       g_return_val_if_fail( person != NULL, NULL );
        if( eid == NULL || *eid == '\0' ) return NULL;
 
        // Look for email
@@ -393,7 +397,8 @@ ItemEMail *addritem_person_remove_email_id( ItemPerson *person, const gchar *eid
 ItemEMail *addritem_person_remove_email( ItemPerson *person, ItemEMail *email ) {
        gboolean found = FALSE;
        GList *node;
-       g_return_if_fail( person != NULL );
+
+       g_return_val_if_fail( person != NULL, NULL );
        if( email == NULL ) return NULL;
 
        // Look for email
@@ -436,7 +441,8 @@ void addritem_person_add_attribute( ItemPerson *person, UserAttribute *attrib )
 UserAttribute *addritem_person_get_attribute( ItemPerson *person, const gchar *aid ) {
        UserAttribute *attrib = NULL;
        GList *node;
-       g_return_if_fail( person != NULL );
+
+       g_return_val_if_fail( person != NULL, NULL );
        if( aid == NULL || *aid == '\0' ) return NULL;
 
        // Look for attribute
@@ -463,7 +469,8 @@ UserAttribute *addritem_person_get_attribute( ItemPerson *person, const gchar *a
 UserAttribute *addritem_person_remove_attrib_id( ItemPerson *person, const gchar *aid ) {
        UserAttribute *attrib = NULL;
        GList *node;
-       g_return_if_fail( person != NULL );
+
+       g_return_val_if_fail( person != NULL, NULL );
        if( aid == NULL || *aid == '\0' ) return NULL;
 
        // Look for attribute
@@ -495,7 +502,8 @@ UserAttribute *addritem_person_remove_attrib_id( ItemPerson *person, const gchar
 UserAttribute *addritem_person_remove_attribute( ItemPerson *person, UserAttribute *attrib ) {
        gboolean found = FALSE;
        GList *node;
-       g_return_if_fail( person != NULL );
+
+       g_return_val_if_fail( person != NULL, NULL );
        if( attrib == NULL ) return NULL;
 
        // Look for attribute
@@ -522,6 +530,7 @@ UserAttribute *addritem_person_remove_attribute( ItemPerson *person, UserAttribu
 */
 ItemGroup *addritem_create_item_group( void ) {
        ItemGroup *group;
+
        group = g_new0( ItemGroup, 1 );
        ADDRITEM_TYPE(group) = ITEMTYPE_GROUP;
        ADDRITEM_ID(group) = NULL;
@@ -576,8 +585,10 @@ void addritem_free_item_group( ItemGroup *group ) {
 */
 gboolean addritem_group_add_email( ItemGroup *group, ItemEMail *email ) {
        GList *node;
-       g_return_if_fail( group != NULL );
-       g_return_if_fail( email != NULL );
+
+       g_return_val_if_fail( group != NULL, FALSE );
+       g_return_val_if_fail( email != NULL, FALSE );
+
        node = group->listEMail;
        while( node ) {
                if( node->data == email ) return FALSE;
@@ -738,6 +749,7 @@ void addritem_free_item_folder( ItemFolder *folder ) {
 */
 void addritem_free_item_folder_recurse( ItemFolder *parent ) {
        GList *node = parent->listFolder;
+
        while( node ) {
                ItemFolder *folder = node->data;
                addritem_free_item_folder_recurse( folder );
@@ -756,6 +768,7 @@ void addritem_free_item_folder_recurse( ItemFolder *parent ) {
 */
 void addritem_folder_free_person( ItemFolder *folder ) {
        GList *node;
+
        g_return_if_fail( folder != NULL );
        
        // Free up folder of persons.
@@ -773,9 +786,9 @@ void addritem_folder_free_person( ItemFolder *folder ) {
 * return: TRUE if person added.
 */
 gboolean addritem_folder_add_person( ItemFolder *folder, ItemPerson *item ) {
-       gboolean retVal = FALSE;
-       g_return_if_fail( folder != NULL );
-       g_return_if_fail( item != NULL );
+       g_return_val_if_fail( folder != NULL, FALSE );
+       g_return_val_if_fail( item != NULL, FALSE );
+
        folder->listPerson = g_list_append( folder->listPerson, item );
        ADDRITEM_PARENT(item) = ADDRITEM_OBJECT(folder);
        return TRUE;
@@ -786,9 +799,9 @@ gboolean addritem_folder_add_person( ItemFolder *folder, ItemPerson *item ) {
 * return: TRUE if folder added.
 */
 gboolean addritem_folder_add_folder( ItemFolder *folder, ItemFolder *item ) {
-       gboolean retVal = FALSE;
-       g_return_if_fail( folder != NULL );
-       g_return_if_fail( item != NULL );
+       g_return_val_if_fail( folder != NULL, FALSE );
+       g_return_val_if_fail( item != NULL, FALSE );
+
        folder->listFolder = g_list_append( folder->listFolder, item );
        ADDRITEM_PARENT(item) = ADDRITEM_OBJECT(folder);
        return TRUE;
@@ -799,9 +812,9 @@ gboolean addritem_folder_add_folder( ItemFolder *folder, ItemFolder *item ) {
 * return: TRUE if folder added.
 */
 gboolean addritem_folder_add_group( ItemFolder *folder, ItemGroup *item ) {
-       gboolean retVal = FALSE;
-       g_return_if_fail( folder != NULL );
-       g_return_if_fail( item != NULL );
+       g_return_val_if_fail( folder != NULL, FALSE );
+       g_return_val_if_fail( item != NULL, FALSE );
+
        folder->listGroup = g_list_append( folder->listGroup, item );
        ADDRITEM_PARENT(item) = ADDRITEM_OBJECT(folder);
        return TRUE;
@@ -812,9 +825,11 @@ gboolean addritem_folder_add_group( ItemFolder *folder, ItemGroup *item ) {
 */
 void addritem_print_item_folder( ItemFolder *folder, FILE *stream ) {
        GList *node;
-       ItemPerson *person;
+       //ItemPerson *person;
        ItemFolder *parent;
+
        g_return_if_fail( folder != NULL );
+
        fprintf( stream, "Folder:\n" );
        fprintf( stream, "\tt/u: %d : '%s'\n", ADDRITEM_TYPE(folder), ADDRITEM_ID(folder) );
        fprintf( stream, "\tsub: %d\n", ADDRITEM_SUBTYPE(folder) );
@@ -886,12 +901,13 @@ void addritem_print_item_folder( ItemFolder *folder, FILE *stream ) {
 GList *addritem_folder_get_person_list( ItemFolder *folder ) {
        GList *list = NULL;
        GList *node = NULL;
-       g_return_if_fail( folder != NULL );
+
+       g_return_val_if_fail( folder != NULL, NULL );
 
        node = folder->listPerson;
        while( node ) {
                ItemPerson *person = node->data;
-               list = g_list_append( list, node->data );
+               list = g_list_append( list, person );
                node = g_list_next( node );
        }
        return list;
@@ -906,12 +922,13 @@ GList *addritem_folder_get_person_list( ItemFolder *folder ) {
 GList *addritem_folder_get_group_list( ItemFolder *folder ) {
        GList *list = NULL;
        GList *node = NULL;
-       g_return_if_fail( folder != NULL );
+
+       g_return_val_if_fail( folder != NULL, NULL );
 
        node = folder->listGroup;
        while( node ) {
                ItemGroup *group = node->data;
-               list = g_list_append( list, node->data );
+               list = g_list_append( list, group );
                node = g_list_next( node );
        }
        return list;
@@ -926,10 +943,13 @@ GList *addritem_folder_get_group_list( ItemFolder *folder ) {
 
 ItemEMail *addritem_move_email_before( ItemPerson *person, ItemEMail *itemMove, ItemEMail *itemTarget ) {
        gint posT, posM;
-       g_return_if_fail( person != NULL );
+
+       g_return_val_if_fail( person != NULL, NULL );
+
        if( itemTarget == NULL ) return NULL;
        if( itemMove == NULL ) return NULL;
        if( itemMove == itemTarget ) return itemMove;
+
        posT = g_list_index( person->listEMail, itemTarget );
        if( posT < 0 ) return NULL;
        posM = g_list_index( person->listEMail, itemMove );
@@ -947,10 +967,13 @@ ItemEMail *addritem_move_email_before( ItemPerson *person, ItemEMail *itemMove,
 */
 ItemEMail *addritem_move_email_after( ItemPerson *person, ItemEMail *itemMove, ItemEMail *itemTarget ) {
        gint posT, posM;
-       g_return_if_fail( person != NULL );
+
+       g_return_val_if_fail( person != NULL, NULL );
+
        if( itemTarget == NULL ) return NULL;
        if( itemMove == NULL ) return NULL;
        if( itemMove == itemTarget ) return itemMove;
+
        posT = g_list_index( person->listEMail, itemTarget );
        if( posT < 0 ) return NULL;
        posM = g_list_index( person->listEMail, itemMove );
@@ -963,4 +986,3 @@ ItemEMail *addritem_move_email_after( ItemPerson *person, ItemEMail *itemMove, I
 /*
 * End of Source.
 */
-
index 66dca48..7250367 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index eea5c8c..bca341f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -38,6 +38,8 @@
 #include "addressitem.h"
 #include "addritem.h"
 #include "addrbook.h"
+#include "manage_window.h"
+#include "gtkutils.h"
 
 #include "prefs_common.h"
 
@@ -757,7 +759,6 @@ void addressbook_edit_person_page_email( gint pageNum, gchar *pageLbl ) {
        gint top;
 
        gchar *titles[ EMAIL_N_COLS ] = { _("E-Mail Address"), _("Alias"), _("Remarks") };
-       gchar *text;
        gint i;
 
        vbox = gtk_vbox_new( FALSE, 8 );
@@ -903,7 +904,6 @@ void addressbook_edit_person_page_attrib( gint pageNum, gchar *pageLbl ) {
        gint top;
 
        gchar *titles[ ATTRIB_N_COLS ] = { _("Name"), _("Value") };
-       gchar *text;
        gint i;
 
        vbox = gtk_vbox_new( FALSE, 8 );
@@ -1025,7 +1025,7 @@ static GList *edit_person_build_email_list() {
        GList *listEMail = NULL;
        ItemEMail *email;
        gint row = 0;
-       while( email = gtk_clist_get_row_data( clist, row ) ) {
+       while( (email = gtk_clist_get_row_data( clist, row )) ) {
                listEMail = g_list_append( listEMail, email );
                row++;
        }
@@ -1040,7 +1040,7 @@ static GList *edit_person_build_attrib_list() {
        GList *listAttrib = NULL;
        UserAttribute *attrib;
        gint row = 0;
-       while( attrib = gtk_clist_get_row_data( clist, row ) ) {
+       while( (attrib = gtk_clist_get_row_data( clist, row )) ) {
                listAttrib = g_list_append( listAttrib, attrib );
                row++;
        }
index 8e219f2..201d401 100644 (file)
@@ -44,6 +44,8 @@
 #include "addressitem.h"
 #include "addrindex.h"
 #include "addrbook.h"
+#include "manage_window.h"
+#include "gtkutils.h"
 
 #define ADDRESSBOOK_GUESS_BOOK  "MyAddressBook"
 
@@ -54,13 +56,13 @@ static struct _AddrBookEdit_Dlg {
        GtkWidget *ok_btn;
        GtkWidget *cancel_btn;
        GtkWidget *check_btn;
-       // GtkWidget *file_btn;
+       /* GtkWidget *file_btn; */
        GtkWidget *statusbar;
        gint status_cid;
        AddressBookFile *bookFile;
 } addrbookedit_dlg;
 
-static struct _AddressFileSelection vcard_file_selector;
+/* static struct _AddressFileSelection vcard_file_selector;  */
 
 /*
 * Edit functions.
@@ -256,7 +258,6 @@ AdapterDSource *addressbook_edit_book( AddressIndex *addrIndex, AdapterDSource *
        gboolean fin;
        gboolean newBook = FALSE;
        gchar *newFile = NULL;
-       gint rc;
 
        if (!addrbookedit_dlg.window)
                addressbook_edit_book_create(&cancelled);
@@ -344,4 +345,3 @@ AdapterDSource *addressbook_edit_book( AddressIndex *addrIndex, AdapterDSource *
 /*
 * End of Source.
 */
-
index e6cf99f..bdedadc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include "addrbook.h"
 #include "addritem.h"
 
+#include "mgutils.h"
+
 #include "prefs_common.h"
 
 #include "alertpanel.h"
 #include "inputdialog.h"
+#include "manage_window.h"
+#include "gtkutils.h"
 
 #define ADDRESSBOOK_GUESS_FOLDER_NAME  "NewFolder"
 #define ADDRESSBOOK_GUESS_GROUP_NAME   "NewGroup"
@@ -238,14 +242,11 @@ static void addressbook_edit_group_create( gboolean *cancelled ) {
        GtkWidget *clist_group;
        GtkWidget *clist_avail;
 
-       GtkWidget *vboxb;
-       GtkWidget *vbuttonbox;
        GtkWidget *buttonGroup;
        GtkWidget *buttonAvail;
        gint top;
 
        gchar *titles[ GROUP_N_COLS ] = { _( "Name" ), _("E-Mail Address"), _("Remarks") };
-       gchar *text;
        gint i;
 
        window = gtk_window_new(GTK_WINDOW_DIALOG);
@@ -405,7 +406,7 @@ static GList *edit_group_build_email_list() {
        GList *listEMail = NULL;
        ItemEMail *email;
        gint row = 0;
-       while( email = gtk_clist_get_row_data( clist, row ) ) {
+       while( (email = gtk_clist_get_row_data( clist, row )) ) {
                listEMail = g_list_append( listEMail, email );
                row++;
        }
index aa2a1b6..562dc74 100644 (file)
@@ -42,6 +42,8 @@
 #include "addressitem.h"
 #include "vcard.h"
 #include "mgutils.h"
+#include "gtkutils.h"
+#include "manage_window.h"
 
 #define ADDRESSBOOK_GUESS_VCARD  "MyGnomeCard"
 
index 658d283..a07904a 100644 (file)
@@ -427,6 +427,9 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_View/Separate f_older tree"),    NULL, NULL, SEPARATE_ACTION + SEPARATE_FOLDER, "<ToggleItem>"},
        {N_("/_View/Separate m_essage view"),   NULL, NULL, SEPARATE_ACTION + SEPARATE_MESSAGE, "<ToggleItem>"},
        {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
+       {N_("/_View/View _source"),             "<control>U", view_source_cb, 0, NULL},
+       {N_("/_View/Show all _header"),         "<control>H", header_window_show_cb, 0, NULL},
+       {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_View/_Code set"),                NULL, NULL, 0, "<Branch>"},
        {N_("/_View/_Code set/_Auto detect"),
         NULL, set_charset_cb, C_AUTO, "<RadioItem>"},
@@ -519,9 +522,12 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Message/Forward as a_ttachment"),
                                                "<shift><control>F", reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
+       {N_("/_Message/Re-_edit"),              NULL, reedit_cb, 0, NULL},
+       {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/M_ove..."),              "<alt>O", move_to_cb, 0, NULL},
        {N_("/_Message/_Copy..."),              NULL, copy_to_cb, 0, NULL},
        {N_("/_Message/_Delete"),               "<alt>D", delete_cb,  0, NULL},
+       {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/_Mark"),                 NULL, NULL, 0, "<Branch>"},
        {N_("/_Message/_Mark/_Mark"),           NULL, mark_cb,   0, NULL},
        {N_("/_Message/_Mark/_Unmark"),         NULL, unmark_cb, 0, NULL},
@@ -531,9 +537,6 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                NULL, mark_as_read_cb, 0, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/Open in new _window"),   "<shift><control>N", open_msg_cb, 0, NULL},
-       {N_("/_Message/View _source"),          "<control>U", view_source_cb, 0, NULL},
-       {N_("/_Message/Show all _header"),      "<control>H", header_window_show_cb, 0, NULL},
-       {N_("/_Message/Re-_edit"),              NULL, reedit_cb, 0, NULL},
 
        {N_("/_Summary"),                       NULL, NULL, 0, "<Branch>"},
        {N_("/_Summary/_Delete duplicated messages"),
@@ -1219,7 +1222,8 @@ static SensitiveCond main_window_get_current_state(MainWindow *mainwin)
                state |= M_EXEC;
        if (selection == SUMMARY_SELECTED_SINGLE &&
            (mainwin->summaryview->folder_item &&
-            mainwin->summaryview->folder_item->stype == F_DRAFT))
+            (mainwin->summaryview->folder_item->stype == F_DRAFT ||
+             mainwin->summaryview->folder_item->stype == F_QUEUE)))
                state |= M_ALLOW_REEDIT;
        if (cur_account)
                state |= M_HAVE_ACCOUNT;
@@ -1284,34 +1288,32 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/File/Close", M_UNLOCKED},
                {"/File/Exit" , M_UNLOCKED},
 
-               {"/Message/Get new mail"         , M_UNLOCKED},
-               {"/Message/Get from all accounts", M_UNLOCKED},
-               {"/Message/Reply"                , M_SINGLE_TARGET_EXIST},
-               {"/Message/Reply to sender"      , M_SINGLE_TARGET_EXIST},
-                {"/Message/Follow-up and reply to", M_SINGLE_TARGET_EXIST},
-               {"/Message/Reply to all"         , M_SINGLE_TARGET_EXIST},
-               {"/Message/Forward"              , M_SINGLE_TARGET_EXIST},
-               {"/Message/Forward as attachment", M_SINGLE_TARGET_EXIST},
-               {"/Message/Open in new window"   , M_SINGLE_TARGET_EXIST},
-               {"/Message/Show all header"      , M_SINGLE_TARGET_EXIST},
-               {"/Message/View source"          , M_SINGLE_TARGET_EXIST},
+               {"/View/Show all header"      , M_SINGLE_TARGET_EXIST},
+               {"/View/View source"          , M_SINGLE_TARGET_EXIST},
+
+               {"/Message/Get new mail"          , M_HAVE_ACCOUNT|M_UNLOCKED},
+               {"/Message/Get from all accounts" , M_HAVE_ACCOUNT|M_UNLOCKED},
+               {"/Message/Compose new message"   , M_HAVE_ACCOUNT},
+               {"/Message/Reply"                 , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
+               {"/Message/Reply to sender"       , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
+               {"/Message/Follow-up and reply to", M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
+               {"/Message/Reply to all"          , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
+               {"/Message/Forward"               , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
+               {"/Message/Forward as attachment" , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
+               {"/Message/Open in new window"    , M_SINGLE_TARGET_EXIST},
                {"/Message/Move...", M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
                {"/Message/Copy...", M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
                {"/Message/Delete" , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
                {"/Message/Mark"   , M_TARGET_EXIST},
-               {"/Message/Re-edit", M_ALLOW_REEDIT},
+               {"/Message/Re-edit", M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
 
                {"/Summary/Delete duplicated messages", M_MSG_EXIST|M_EXEC|M_UNLOCKED},
-               {"/Summary/Filter messages"     , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
-               {"/Summary/Execute"             , M_MSG_EXIST|M_UNLOCKED},
-               {"/Summary/Prev message"        , M_MSG_EXIST},
-               {"/Summary/Next message"        , M_MSG_EXIST},
-               {"/Summary/Prev marked message" , M_MSG_EXIST},
-               {"/Summary/Next marked message" , M_MSG_EXIST},
-               {"/Summary/Prev labeled message", M_MSG_EXIST},
-               {"/Summary/Next labeled message", M_MSG_EXIST},
-               {"/Summary/Next unread message" , M_MSG_EXIST},
-               {"/Summary/Sort"                , M_MSG_EXIST},
+               {"/Summary/Filter messages"    , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
+               {"/Summary/Execute"            , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
+               {"/Summary/Prev message"       , M_MSG_EXIST},
+               {"/Summary/Next message"       , M_MSG_EXIST},
+               {"/Summary/Next unread message", M_MSG_EXIST},
+               {"/Summary/Sort"               , M_MSG_EXIST},
 
                {"/Configuration", M_UNLOCKED},
 
@@ -2053,12 +2055,16 @@ static void ac_menu_popup_closed(GtkMenuShell *menu_shell, gpointer data)
        button = gtk_object_get_data(GTK_OBJECT(menu_shell), "menu_button");
        gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
        gtk_object_remove_data(GTK_OBJECT(mainwin->ac_menu), "menu_button");
+       manage_window_focus_in(mainwin->window, NULL, NULL);
 }
 
 static gint main_window_close_cb(GtkWidget *widget, GdkEventAny *event,
                                 gpointer data)
 {
-       app_exit_cb(data, 0, widget);
+       MainWindow *mainwin = (MainWindow *)data;
+
+       if (mainwin->lock_count == 0)
+               app_exit_cb(data, 0, widget);
 
        return TRUE;
 }
index ba5c6f3..8a06d34 100644 (file)
@@ -352,10 +352,21 @@ GtkTargetEntry summary_drag_types[1] =
 
 static GtkItemFactoryEntry summary_popup_entries[] =
 {
+       {N_("/_Reply"),                 NULL, summary_reply_cb, COMPOSE_REPLY, NULL},
+       {N_("/Repl_y to sender"),       NULL, summary_reply_cb, COMPOSE_REPLY_TO_SENDER, NULL},
+       {N_("/Follow-up and reply to"), NULL, summary_reply_cb, COMPOSE_FOLLOWUP_AND_REPLY_TO, NULL},
+       {N_("/Reply to a_ll"),          NULL, summary_reply_cb, COMPOSE_REPLY_TO_ALL, NULL},
+       {N_("/_Forward"),               NULL, summary_reply_cb, COMPOSE_FORWARD, NULL},
+       {N_("/Forward as a_ttachment"),
+                                       NULL, summary_reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL},
+       {N_("/---"),                    NULL, NULL,             0, "<Separator>"},
+       {N_("/Re-_edit"),               NULL, summary_reedit,   0, NULL},
+       {N_("/---"),                    NULL, NULL,             0, "<Separator>"},
        {N_("/M_ove..."),               NULL, summary_move_to,  0, NULL},
        {N_("/_Copy..."),               NULL, summary_copy_to,  0, NULL},
        {N_("/_Delete"),                NULL, summary_delete,   0, NULL},
        {N_("/E_xecute"),               NULL, summary_execute,  0, NULL},
+       {N_("/---"),                    NULL, NULL,             0, "<Separator>"},
        {N_("/_Mark"),                  NULL, NULL,             0, "<Branch>"},
        {N_("/_Mark/_Mark"),            NULL, summary_mark,     0, NULL},
        {N_("/_Mark/_Unmark"),          NULL, summary_unmark,   0, NULL},
@@ -369,14 +380,6 @@ static GtkItemFactoryEntry summary_popup_entries[] =
        {N_("/_Mark/Unignore thread"),  NULL, summary_unignore_thread, 0, NULL},
        {N_("/Color la_bel"),           NULL, NULL,             0, NULL},
 
-       {N_("/---"),                    NULL, NULL,             0, "<Separator>"},
-       {N_("/_Reply"),                 NULL, summary_reply_cb, COMPOSE_REPLY, NULL},
-       {N_("/Repl_y to sender"),       NULL, summary_reply_cb, COMPOSE_REPLY_TO_SENDER, NULL},
-       {N_("/Follow-up and reply to"), NULL, summary_reply_cb, COMPOSE_FOLLOWUP_AND_REPLY_TO, NULL},
-       {N_("/Reply to a_ll"),          NULL, summary_reply_cb, COMPOSE_REPLY_TO_ALL, NULL},
-       {N_("/_Forward"),               NULL, summary_reply_cb, COMPOSE_FORWARD, NULL},
-       {N_("/Forward as a_ttachment"),
-                                       NULL, summary_reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL},
        {N_("/---"),                    NULL, NULL,             0, "<Separator>"},
        {N_("/Add sender to address _book"),
                                        NULL, summary_add_address_cb,           0, NULL},
@@ -384,7 +387,6 @@ static GtkItemFactoryEntry summary_popup_entries[] =
        {N_("/Open in new _window"),    NULL, summary_open_msg, 0, NULL},
        {N_("/View so_urce"),           NULL, summary_view_source, 0, NULL},
        {N_("/Show all _header"),       NULL, summary_show_all_header_cb, 0, NULL},
-       {N_("/Re-_edit"),               NULL, summary_reedit,   0, NULL},
        {N_("/---"),                    NULL, NULL,             0, "<Separator>"},
        {N_("/_Save as..."),            NULL, summary_save_as,  0, NULL},
        {N_("/_Print..."),              NULL, summary_print,    0, NULL},
@@ -1076,6 +1078,7 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
        menu_set_sensitive(ifactory, "/Reply to all",             sens);
        menu_set_sensitive(ifactory, "/Forward",                  TRUE);
        menu_set_sensitive(ifactory, "/Forward as attachment",    TRUE);
+
        menu_set_sensitive(ifactory, "/Add sender to address book", sens);
        
        menu_set_sensitive(ifactory, "/Open in new window", sens);
@@ -1099,6 +1102,33 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
        menu_set_sensitive(ifactory, "/Follow-up and reply to", sens);
 }
 
+#if 0
+static void summary_set_add_sender_menu(SummaryView *summaryview)
+{
+       GtkWidget *menu;
+       GtkWidget *submenu;
+       MsgInfo *msginfo;
+       gchar *from;
+
+       menu = gtk_item_factory_get_item(summaryview->popupfactory,
+                                        "/Add sender to address book");
+       msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
+                                             summaryview->selected);
+       if (!msginfo || !msginfo->from) {
+               gtk_widget_set_sensitive(menu, FALSE);
+               submenu = gtk_menu_new();
+               gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu), submenu);
+               return;
+       }
+
+       gtk_widget_set_sensitive(menu, TRUE);
+       Xstrdup_a(from, msginfo->from, return);
+       eliminate_address_comment(from);
+       extract_address(from);
+       addressbook_add_submenu(menu, msginfo->fromname, from, NULL);
+}
+#endif
+
 void summary_select_next_unread(SummaryView *summaryview)
 {
        GtkCTreeNode *node;
@@ -3631,8 +3661,8 @@ static void summary_button_pressed(GtkWidget *ctree, GdkEventButton *event,
        if (!event) return;
 
        if (event->button == 3) {
-               // Right button clicked
-               // summary_set_add_sender_menu(summaryview);
+               /* Right button clicked */
+               /* summary_set_add_sender_menu(summaryview); */
                gtk_menu_popup(GTK_MENU(summaryview->popupmenu), NULL, NULL,
                               NULL, NULL, event->button, event->time);
        } else if (event->button == 2) {
@@ -4029,6 +4059,22 @@ static void summary_show_all_header_cb(SummaryView *summaryview,
        header_window_show_cb(summaryview->mainwin, action, widget);
 }
 
+static void summary_add_address_cb(SummaryView *summaryview,
+                                  guint action, GtkWidget *widget)
+{
+       MsgInfo *msginfo;
+       gchar *from;
+
+       msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
+                                             summaryview->selected);
+       if (!msginfo) return;
+
+       Xstrdup_a(from, msginfo->from, return);
+       eliminate_address_comment(from);
+       extract_address(from);
+       addressbook_add_contact(msginfo->fromname, from, NULL);
+}
+
 static void summary_num_clicked(GtkWidget *button, SummaryView *summaryview)
 {
        summary_sort(summaryview, SORT_BY_NUMBER);
@@ -4292,21 +4338,6 @@ static void summary_unignore_thread(SummaryView *summaryview)
 
        summary_status_show(summaryview);
 }
-
-static void summary_add_address_cb( SummaryView *summaryview, guint action, GtkWidget *widget ) {
-       MsgInfo *msginfo;
-       gchar *from;
-
-       msginfo = gtk_ctree_node_get_row_data(GTK_CTREE(summaryview->ctree),
-                                             summaryview->selected);
-       if (!msginfo) return;
-
-       Xstrdup_a(from, msginfo->from, return);
-       eliminate_address_comment(from);
-       extract_address(from);
-       addressbook_add_contact( msginfo->fromname, from, NULL );
-}
-
 /*
  * End of Source.
  */