aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cvsignore20
-rw-r--r--ABOUT-NLS226
-rw-r--r--AUTHORS10
-rw-r--r--COPYING340
-rw-r--r--ChangeLog1962
-rw-r--r--INSTALL182
-rw-r--r--MAINTAINERS1
-rw-r--r--Makefile.am14
-rw-r--r--NEWS8
-rw-r--r--README3
-rw-r--r--acconfig.h14
-rwxr-xr-xautogen.sh10
-rw-r--r--camel/.cvsignore7
-rw-r--r--camel/CODING.STYLE19
-rw-r--r--camel/Makefile.am120
-rw-r--r--camel/README57
-rw-r--r--camel/README.COPYRIGHT47
-rw-r--r--camel/README.HACKING14
-rw-r--r--camel/camel-arg-collector.c186
-rw-r--r--camel/camel-data-wrapper.c252
-rw-r--r--camel/camel-data-wrapper.h92
-rw-r--r--camel/camel-exception-list.def16
-rw-r--r--camel/camel-exception.c252
-rw-r--r--camel/camel-exception.h88
-rw-r--r--camel/camel-folder-pt-proxy.c821
-rw-r--r--camel/camel-folder-pt-proxy.h90
-rw-r--r--camel/camel-folder-summary.c147
-rw-r--r--camel/camel-folder-summary.h102
-rw-r--r--camel/camel-folder-utils.c102
-rw-r--r--camel/camel-folder-utils.h44
-rw-r--r--camel/camel-folder.c1781
-rw-r--r--camel/camel-folder.h299
-rw-r--r--camel/camel-log.c45
-rw-r--r--camel/camel-log.h78
-rw-r--r--camel/camel-marshal-utils.c374
-rw-r--r--camel/camel-marshal-utils.h102
-rw-r--r--camel/camel-medium.c257
-rw-r--r--camel/camel-medium.h94
-rw-r--r--camel/camel-mime-body-part.c128
-rw-r--r--camel/camel-mime-body-part.h85
-rw-r--r--camel/camel-mime-message.c705
-rw-r--r--camel/camel-mime-message.h143
-rw-r--r--camel/camel-mime-part-utils.c171
-rw-r--r--camel/camel-mime-part-utils.h54
-rw-r--r--camel/camel-mime-part.c865
-rw-r--r--camel/camel-mime-part.h153
-rw-r--r--camel/camel-multipart.c505
-rw-r--r--camel/camel-multipart.h108
-rw-r--r--camel/camel-op-queue.c187
-rw-r--r--camel/camel-op-queue.h64
-rw-r--r--camel/camel-provider.c186
-rw-r--r--camel/camel-provider.h67
-rw-r--r--camel/camel-recipient.c281
-rw-r--r--camel/camel-recipient.h87
-rw-r--r--camel/camel-service.c297
-rw-r--r--camel/camel-service.h85
-rw-r--r--camel/camel-session.c217
-rw-r--r--camel/camel-session.h87
-rw-r--r--camel/camel-simple-data-wrapper-stream.c276
-rw-r--r--camel/camel-simple-data-wrapper-stream.h74
-rw-r--r--camel/camel-simple-data-wrapper.c230
-rw-r--r--camel/camel-simple-data-wrapper.h82
-rw-r--r--camel/camel-store.c263
-rw-r--r--camel/camel-store.h88
-rw-r--r--camel/camel-stream-buffered-fs.c265
-rw-r--r--camel/camel-stream-buffered-fs.h91
-rw-r--r--camel/camel-stream-data-wrapper.c209
-rw-r--r--camel/camel-stream-data-wrapper.h75
-rw-r--r--camel/camel-stream-fs.c355
-rw-r--r--camel/camel-stream-fs.h85
-rw-r--r--camel/camel-stream-mem.c286
-rw-r--r--camel/camel-stream-mem.h89
-rw-r--r--camel/camel-stream.c227
-rw-r--r--camel/camel-stream.h96
-rw-r--r--camel/camel-thread-proxy.c569
-rw-r--r--camel/camel-thread-proxy.h90
-rw-r--r--camel/camel.c39
-rw-r--r--camel/camel.h71
-rw-r--r--camel/data-wrapper-repository.c127
-rw-r--r--camel/data-wrapper-repository.h55
-rw-r--r--camel/gmime-base64.c97
-rw-r--r--camel/gmime-base64.h16
-rw-r--r--camel/gmime-content-field.c370
-rw-r--r--camel/gmime-content-field.h67
-rw-r--r--camel/gmime-rfc2047.c491
-rw-r--r--camel/gmime-rfc2047.h52
-rw-r--r--camel/gmime-utils.c268
-rw-r--r--camel/gmime-utils.h70
-rw-r--r--camel/gstring-util.c343
-rw-r--r--camel/gstring-util.h77
-rw-r--r--camel/hash-table-utils.c82
-rw-r--r--camel/hash-table-utils.h46
-rw-r--r--camel/md5-utils.c388
-rw-r--r--camel/md5-utils.h54
-rw-r--r--camel/providers/.cvsignore2
-rw-r--r--camel/providers/MH/.cvsignore6
-rw-r--r--camel/providers/MH/Makefile.am33
-rw-r--r--camel/providers/MH/camel-mh-folder.c1022
-rw-r--r--camel/providers/MH/camel-mh-folder.h72
-rw-r--r--camel/providers/MH/camel-mh-provider.c46
-rw-r--r--camel/providers/MH/camel-mh-store.c153
-rw-r--r--camel/providers/MH/camel-mh-store.h72
-rw-r--r--camel/providers/MH/mh-summary.c290
-rw-r--r--camel/providers/MH/mh-summary.h33
-rw-r--r--camel/providers/MH/mh-uid.c220
-rw-r--r--camel/providers/MH/mh-uid.h40
-rw-r--r--camel/providers/MH/mh-utils.c50
-rw-r--r--camel/providers/MH/mh-utils.h30
-rw-r--r--camel/providers/Makefile.am5
-rw-r--r--camel/providers/maildir/.cvsignore6
-rw-r--r--camel/providers/maildir/Makefile.am23
-rw-r--r--camel/providers/maildir/camel-maildir-folder.c803
-rw-r--r--camel/providers/maildir/camel-maildir-folder.h66
-rw-r--r--camel/providers/maildir/camel-maildir-provider.c46
-rw-r--r--camel/providers/maildir/camel-maildir-store.c124
-rw-r--r--camel/providers/maildir/camel-maildir-store.h69
-rw-r--r--camel/providers/mbox/.cvsignore7
-rw-r--r--camel/providers/mbox/Makefile.am26
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c811
-rw-r--r--camel/providers/mbox/camel-mbox-folder.h72
-rw-r--r--camel/providers/mbox/camel-mbox-parser.c96
-rw-r--r--camel/providers/mbox/camel-mbox-parser.h25
-rw-r--r--camel/providers/mbox/camel-mbox-store.c153
-rw-r--r--camel/providers/mbox/camel-mbox-store.h72
-rw-r--r--camel/string-utils.c313
-rw-r--r--camel/string-utils.h78
-rw-r--r--camel/url-util.c418
-rw-r--r--camel/url-util.h60
-rw-r--r--composer/.cvsignore6
-rw-r--r--composer/ChangeLog20
-rw-r--r--composer/Makefile.am47
-rw-r--r--composer/e-msg-composer-address-dialog.c660
-rw-r--r--composer/e-msg-composer-address-dialog.glade575
-rw-r--r--composer/e-msg-composer-address-dialog.h75
-rw-r--r--composer/e-msg-composer-address-entry.c175
-rw-r--r--composer/e-msg-composer-address-entry.h63
-rw-r--r--composer/e-msg-composer-attachment-bar.c665
-rw-r--r--composer/e-msg-composer-attachment-bar.h74
-rw-r--r--composer/e-msg-composer-attachment.c480
-rw-r--r--composer/e-msg-composer-attachment.glade290
-rw-r--r--composer/e-msg-composer-attachment.h72
-rw-r--r--composer/e-msg-composer-hdrs.c355
-rw-r--r--composer/e-msg-composer-hdrs.h80
-rw-r--r--composer/e-msg-composer.c564
-rw-r--r--composer/e-msg-composer.glade587
-rw-r--r--composer/e-msg-composer.h87
-rw-r--r--composer/main.c52
-rw-r--r--configure.in135
-rw-r--r--devel-docs/.cvsignore3
-rw-r--r--devel-docs/Makefile.am3
-rw-r--r--devel-docs/camel/.cvsignore12
-rw-r--r--devel-docs/camel/Makefile.am101
-rw-r--r--devel-docs/camel/README_AND_TODO.txt43
-rw-r--r--devel-docs/camel/camel-docs.sgml28
-rw-r--r--devel-docs/camel/camel-sections.txt154
-rw-r--r--devel-docs/camel/camel.types9
-rw-r--r--devel-docs/camel/tmpl/.cvsignore2
-rw-r--r--devel-docs/camel/tmpl/camel-data-wrapper.sgml26
-rw-r--r--devel-docs/camel/tmpl/camel-folder.sgml96
-rw-r--r--devel-docs/camel/tmpl/camel-mime-message.sgml171
-rw-r--r--devel-docs/camel/tmpl/camel-mime-part.sgml151
-rw-r--r--devel-docs/camel/tmpl/camel-recipient.sgml88
-rw-r--r--devel-docs/camel/tmpl/camel-service.sgml72
-rw-r--r--devel-docs/camel/tmpl/camel-store.sgml45
-rw-r--r--devel-docs/camel/tmpl/camel-stream.sgml101
-rw-r--r--devel-docs/misc/ref_and_id_proposition.txt237
-rw-r--r--devel-docs/query/virtual-folder-in-depth.sgml407
-rw-r--r--devel-docs/query/virtual-folder-in-depth.txt309
-rw-r--r--doc/Camel-Classes24
-rw-r--r--doc/Design135
-rw-r--r--e-util/Makefile.am11
-rw-r--r--e-util/e-cursors.c128
-rw-r--r--e-util/e-cursors.h33
-rw-r--r--e-util/e-gui-utils.c58
-rw-r--r--e-util/e-gui-utils.h12
-rw-r--r--e-util/e-util.h24
-rw-r--r--e-util/e-util.h-2900224
-rw-r--r--ebook/e-book.c195
-rw-r--r--ebook/e-book.h60
-rw-r--r--ebook/e-card-fields.h53
-rw-r--r--ebook/e-card.h61
-rw-r--r--ebook/e-commerce.h15
-rw-r--r--help/Camel-Classes24
-rw-r--r--help/Design135
-rw-r--r--po/.cvsignore11
-rw-r--r--po/ChangeLog7
-rw-r--r--po/POTFILES.in0
-rw-r--r--shell/.cvsignore9
-rw-r--r--shell/Makefile.am28
-rw-r--r--shell/Shell.idl19
-rw-r--r--shell/e-folder-mail.c50
-rw-r--r--shell/e-folder-mail.h28
-rw-r--r--shell/e-folder.c204
-rw-r--r--shell/e-folder.h74
-rw-r--r--shell/e-init.c34
-rw-r--r--shell/e-init.h8
-rw-r--r--shell/e-shell.c103
-rw-r--r--shell/e-shell.h29
-rw-r--r--shell/main.c59
-rw-r--r--stamp.h.in1
-rw-r--r--tests/.cvsignore13
-rw-r--r--tests/Makefile.am27
-rw-r--r--tests/test1.c119
-rw-r--r--tests/test2.c46
-rw-r--r--tests/test3.c29
-rw-r--r--tests/test4.c68
-rw-r--r--tests/test5.c60
-rw-r--r--tests/test6.c50
-rw-r--r--tests/test7.c24
-rw-r--r--tests/test8.c78
-rw-r--r--tests/ui-tests/.cvsignore6
-rw-r--r--tests/ui-tests/Makefile.am16
-rw-r--r--tests/ui-tests/store_listing.c424
-rw-r--r--tests/ui-tests/store_listing.glade489
-rw-r--r--widgets/.cvsignore7
-rw-r--r--widgets/LICENSE1
-rw-r--r--widgets/Makefile.am3
-rw-r--r--widgets/e-cursors.c128
-rw-r--r--widgets/e-cursors.h33
-rw-r--r--widgets/e-table/.cvsignore7
-rw-r--r--widgets/e-table/ChangeLog579
-rw-r--r--widgets/e-table/LICENSE1
-rw-r--r--widgets/e-table/Makefile.am60
-rw-r--r--widgets/e-table/ROADMAP.e-table113
-rw-r--r--widgets/e-table/TODO24
-rw-r--r--widgets/e-table/add-col.xpm22
-rw-r--r--widgets/e-table/check-empty.xpm21
-rw-r--r--widgets/e-table/check-filled.xpm21
-rw-r--r--widgets/e-table/e-cell-checkbox.c44
-rw-r--r--widgets/e-table/e-cell-checkbox.h24
-rw-r--r--widgets/e-table/e-cell-string.c9
-rw-r--r--widgets/e-table/e-cell-text.c508
-rw-r--r--widgets/e-table/e-cell-text.h28
-rw-r--r--widgets/e-table/e-cell-toggle.c298
-rw-r--r--widgets/e-table/e-cell-toggle.h35
-rw-r--r--widgets/e-table/e-cell.c176
-rw-r--r--widgets/e-table/e-cell.h73
-rw-r--r--widgets/e-table/e-table-col-dnd.h10
-rw-r--r--widgets/e-table/e-table-col.c64
-rw-r--r--widgets/e-table/e-table-col.h44
-rw-r--r--widgets/e-table/e-table-column-item.c199
-rw-r--r--widgets/e-table/e-table-column-item.h20
-rw-r--r--widgets/e-table/e-table-column-model.h5
-rw-r--r--widgets/e-table/e-table-column.c293
-rw-r--r--widgets/e-table/e-table-group.c269
-rw-r--r--widgets/e-table/e-table-group.h63
-rw-r--r--widgets/e-table/e-table-header-item.c793
-rw-r--r--widgets/e-table/e-table-header-item.h56
-rw-r--r--widgets/e-table/e-table-header.c342
-rw-r--r--widgets/e-table/e-table-header.h65
-rw-r--r--widgets/e-table/e-table-item.c1316
-rw-r--r--widgets/e-table/e-table-item.h106
-rw-r--r--widgets/e-table/e-table-model.c176
-rw-r--r--widgets/e-table/e-table-model.h58
-rw-r--r--widgets/e-table/e-table-render.c20
-rw-r--r--widgets/e-table/e-table-render.h21
-rw-r--r--widgets/e-table/e-table-simple.c111
-rw-r--r--widgets/e-table/e-table-simple.h37
-rw-r--r--widgets/e-table/e-table-sorted.c89
-rw-r--r--widgets/e-table/e-table-sorted.h29
-rw-r--r--widgets/e-table/e-table-subset.c178
-rw-r--r--widgets/e-table/e-table-subset.h32
-rw-r--r--widgets/e-table/e-table-tree.h19
-rw-r--r--widgets/e-table/e-table.c558
-rw-r--r--widgets/e-table/e-table.h48
-rw-r--r--widgets/e-table/image1.pngbin1858 -> 0 bytes
-rw-r--r--widgets/e-table/image2.pngbin1987 -> 0 bytes
-rw-r--r--widgets/e-table/image3.pngbin2051 -> 0 bytes
-rw-r--r--widgets/e-table/remove-col.xpm22
-rw-r--r--widgets/e-table/sample.table11
-rw-r--r--widgets/e-table/table-test.c43
-rw-r--r--widgets/e-table/table-test.h4
-rw-r--r--widgets/e-table/test-check.c153
-rw-r--r--widgets/e-table/test-cols.c196
-rw-r--r--widgets/e-table/test-table.c304
-rw-r--r--widgets/e-table/test.c17
-rw-r--r--widgets/meeting-time-sel/.cvsignore7
-rw-r--r--widgets/meeting-time-sel/LICENSE1
-rw-r--r--widgets/meeting-time-sel/Makefile.am30
-rw-r--r--widgets/meeting-time-sel/e-meeting-time-sel-item.c924
-rw-r--r--widgets/meeting-time-sel/e-meeting-time-sel-item.h78
-rw-r--r--widgets/meeting-time-sel/e-meeting-time-sel-list-item.c303
-rw-r--r--widgets/meeting-time-sel/e-meeting-time-sel-list-item.h74
-rw-r--r--widgets/meeting-time-sel/e-meeting-time-sel-mail.xpm135
-rw-r--r--widgets/meeting-time-sel/e-meeting-time-sel-no-mail.xpm123
-rw-r--r--widgets/meeting-time-sel/e-meeting-time-sel.c3065
-rw-r--r--widgets/meeting-time-sel/e-meeting-time-sel.h496
-rw-r--r--widgets/meeting-time-sel/test-meeting-time-sel.c236
-rw-r--r--widgets/misc/e-colors.c73
-rw-r--r--widgets/misc/e-colors.h14
-rw-r--r--widgets/misc/e-cursors.c38
-rw-r--r--widgets/misc/e-cursors.h38
-rw-r--r--widgets/misc/e-gui-utils.c58
-rw-r--r--widgets/misc/e-gui-utils.h12
-rw-r--r--widgets/misc/pixmaps/cursor_cross.xpm38
-rw-r--r--widgets/misc/pixmaps/cursor_hand_closed.xpm38
-rw-r--r--widgets/misc/pixmaps/cursor_hand_open.xpm38
-rw-r--r--widgets/misc/pixmaps/cursor_zoom_in.xpm37
-rw-r--r--widgets/misc/pixmaps/cursor_zoom_out.xpm37
-rw-r--r--widgets/shortcut-bar/.cvsignore7
-rw-r--r--widgets/shortcut-bar/LICENSE1
-rw-r--r--widgets/shortcut-bar/Makefile.am30
-rw-r--r--widgets/shortcut-bar/e-clipped-label.c361
-rw-r--r--widgets/shortcut-bar/e-clipped-label.h90
-rw-r--r--widgets/shortcut-bar/e-group-bar.c1498
-rw-r--r--widgets/shortcut-bar/e-group-bar.h171
-rw-r--r--widgets/shortcut-bar/e-icon-bar-bg-item.c361
-rw-r--r--widgets/shortcut-bar/e-icon-bar-bg-item.h72
-rw-r--r--widgets/shortcut-bar/e-icon-bar-text-item.c1696
-rw-r--r--widgets/shortcut-bar/e-icon-bar-text-item.h158
-rw-r--r--widgets/shortcut-bar/e-icon-bar.c1450
-rw-r--r--widgets/shortcut-bar/e-icon-bar.h221
-rw-r--r--widgets/shortcut-bar/e-shortcut-bar.c563
-rw-r--r--widgets/shortcut-bar/e-shortcut-bar.h114
-rw-r--r--widgets/shortcut-bar/e-vscrolled-bar.c652
-rw-r--r--widgets/shortcut-bar/e-vscrolled-bar.h97
-rw-r--r--widgets/shortcut-bar/test-shortcut-bar.c445
-rw-r--r--widgets/table/.cvsignore7
-rw-r--r--widgets/table/add-col.xpm22
-rw-r--r--widgets/table/check-empty.xpm21
-rw-r--r--widgets/table/check-filled.xpm21
-rw-r--r--widgets/table/e-cell-checkbox.c44
-rw-r--r--widgets/table/e-cell-checkbox.h24
-rw-r--r--widgets/table/e-cell-string.c9
-rw-r--r--widgets/table/e-cell-text.c508
-rw-r--r--widgets/table/e-cell-text.h28
-rw-r--r--widgets/table/e-cell-toggle.c298
-rw-r--r--widgets/table/e-cell-toggle.h35
-rw-r--r--widgets/table/e-cell.c176
-rw-r--r--widgets/table/e-cell.h73
-rw-r--r--widgets/table/e-table-col-dnd.h10
-rw-r--r--widgets/table/e-table-col.c64
-rw-r--r--widgets/table/e-table-col.h44
-rw-r--r--widgets/table/e-table-column-item.c199
-rw-r--r--widgets/table/e-table-column-item.h20
-rw-r--r--widgets/table/e-table-column-model.h5
-rw-r--r--widgets/table/e-table-column.c293
-rw-r--r--widgets/table/e-table-group.c269
-rw-r--r--widgets/table/e-table-group.h63
-rw-r--r--widgets/table/e-table-header-item.c793
-rw-r--r--widgets/table/e-table-header-item.h56
-rw-r--r--widgets/table/e-table-header.c342
-rw-r--r--widgets/table/e-table-header.h65
-rw-r--r--widgets/table/e-table-item.c1316
-rw-r--r--widgets/table/e-table-item.h106
-rw-r--r--widgets/table/e-table-model.c176
-rw-r--r--widgets/table/e-table-model.h58
-rw-r--r--widgets/table/e-table-render.c20
-rw-r--r--widgets/table/e-table-render.h21
-rw-r--r--widgets/table/e-table-simple.c111
-rw-r--r--widgets/table/e-table-simple.h37
-rw-r--r--widgets/table/e-table-sorted.c89
-rw-r--r--widgets/table/e-table-sorted.h29
-rw-r--r--widgets/table/e-table-subset.c178
-rw-r--r--widgets/table/e-table-subset.h32
-rw-r--r--widgets/table/e-table-tree.h19
-rw-r--r--widgets/table/e-table.c558
-rw-r--r--widgets/table/e-table.h48
-rw-r--r--widgets/table/image1.pngbin1858 -> 0 bytes
-rw-r--r--widgets/table/image2.pngbin1987 -> 0 bytes
-rw-r--r--widgets/table/image3.pngbin2051 -> 0 bytes
-rw-r--r--widgets/table/remove-col.xpm22
-rw-r--r--widgets/table/sample.table11
-rw-r--r--widgets/table/table-test.c43
-rw-r--r--widgets/table/table-test.h4
-rw-r--r--widgets/table/test-check.c153
-rw-r--r--widgets/table/test-cols.c196
-rw-r--r--widgets/table/test-table.c304
-rw-r--r--widgets/table/test.c17
369 files changed, 0 insertions, 63384 deletions
diff --git a/.cvsignore b/.cvsignore
deleted file mode 100644
index 4c57be0ac0..0000000000
--- a/.cvsignore
+++ /dev/null
@@ -1,20 +0,0 @@
-Makefile.in
-aclocal.m4
-configure
-config.guess
-config.sub
-ltconfig
-ltmain.sh
-config.h.in
-config.log
-config.h
-config.cache
-libtool
-config.status
-stamp-h
-Makefile
-stamp.h
-stamp-h.in
-xlibtool
-xltmain.sh
-intl
diff --git a/ABOUT-NLS b/ABOUT-NLS
deleted file mode 100644
index 28d38c76fd..0000000000
--- a/ABOUT-NLS
+++ /dev/null
@@ -1,226 +0,0 @@
-Notes on the Free Translation Project
-*************************************
-
- Free software is going international! The Free Translation Project
-is a way to get maintainers of free software, translators, and users all
-together, so that will gradually become able to speak many languages.
-A few packages already provide translations for their messages.
-
- If you found this `ABOUT-NLS' file inside a distribution, you may
-assume that the distributed package does use GNU `gettext' internally,
-itself available at your nearest GNU archive site. But you do *not*
-need to install GNU `gettext' prior to configuring, installing or using
-this package with messages translated.
-
- Installers will find here some useful hints. These notes also
-explain how users should proceed for getting the programs to use the
-available translations. They tell how people wanting to contribute and
-work at translations should contact the appropriate team.
-
- When reporting bugs in the `intl/' directory or bugs which may be
-related to internationalization, you should tell about the version of
-`gettext' which is used. The information can be found in the
-`intl/VERSION' file, in internationalized packages.
-
-One advise in advance
-=====================
-
- If you want to exploit the full power of internationalization, you
-should configure it using
-
- ./configure --with-included-gettext
-
-to force usage of internationalizing routines provided within this
-package, despite the existence of internationalizing capabilities in the
-operating system where this package is being installed. So far, only
-the `gettext' implementation in the GNU C library version 2 provides as
-many features (such as locale alias or message inheritance) as the
-implementation here. It is also not possible to offer this additional
-functionality on top of a `catgets' implementation. Future versions of
-GNU `gettext' will very likely convey even more functionality. So it
-might be a good idea to change to GNU `gettext' as soon as possible.
-
- So you need not provide this option if you are using GNU libc 2 or
-you have installed a recent copy of the GNU gettext package with the
-included `libintl'.
-
-INSTALL Matters
-===============
-
- Some packages are "localizable" when properly installed; the
-programs they contain can be made to speak your own native language.
-Most such packages use GNU `gettext'. Other packages have their own
-ways to internationalization, predating GNU `gettext'.
-
- By default, this package will be installed to allow translation of
-messages. It will automatically detect whether the system provides
-usable `catgets' (if using this is selected by the installer) or
-`gettext' functions. If neither is available, the GNU `gettext' own
-library will be used. This library is wholly contained within this
-package, usually in the `intl/' subdirectory, so prior installation of
-the GNU `gettext' package is *not* required. Installers may use
-special options at configuration time for changing the default
-behaviour. The commands:
-
- ./configure --with-included-gettext
- ./configure --with-catgets
- ./configure --disable-nls
-
-will respectively bypass any pre-existing `catgets' or `gettext' to use
-the internationalizing routines provided within this package, enable
-the use of the `catgets' functions (if found on the locale system), or
-else, *totally* disable translation of messages.
-
- When you already have GNU `gettext' installed on your system and run
-configure without an option for your new package, `configure' will
-probably detect the previously built and installed `libintl.a' file and
-will decide to use this. This might be not what is desirable. You
-should use the more recent version of the GNU `gettext' library. I.e.
-if the file `intl/VERSION' shows that the library which comes with this
-package is more recent, you should use
-
- ./configure --with-included-gettext
-
-to prevent auto-detection.
-
- By default the configuration process will not test for the `catgets'
-function and therefore they will not be used. The reasons are already
-given above: the emulation on top of `catgets' cannot provide all the
-extensions provided by the GNU `gettext' library. If you nevertheless
-want to use the `catgets' functions use
-
- ./configure --with-catgets
-
-to enable the test for `catgets' (this causes no harm if `catgets' is
-not available on your system). If you really select this option we
-would like to hear about the reasons because we cannot think of any
-good one ourself.
-
- Internationalized packages have usually many `po/LL.po' files, where
-LL gives an ISO 639 two-letter code identifying the language. Unless
-translations have been forbidden at `configure' time by using the
-`--disable-nls' switch, all available translations are installed
-together with the package. However, the environment variable `LINGUAS'
-may be set, prior to configuration, to limit the installed set.
-`LINGUAS' should then contain a space separated list of two-letter
-codes, stating which languages are allowed.
-
-Using This Package
-==================
-
- As a user, if your language has been installed for this package, you
-only have to set the `LANG' environment variable to the appropriate
-ISO 639 `LL' two-letter code prior to using the programs in the
-package. For example, let's suppose that you speak German. At the
-shell prompt, merely execute `setenv LANG de' (in `csh'),
-`export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This
-can be done from your `.login' or `.profile' file, once and for all.
-
- An operating system might already offer message localization for
-many of its programs, while other programs have been installed locally
-with the full capabilities of GNU `gettext'. Just using `gettext'
-extended syntax for `LANG' would break proper localization of already
-available operating system programs. In this case, users should set
-both `LANGUAGE' and `LANG' variables in their environment, as programs
-using GNU `gettext' give preference to `LANGUAGE'. For example, some
-Swedish users would rather read translations in German than English for
-when Swedish is not available. This is easily accomplished by setting
-`LANGUAGE' to `sv:de' while leaving `LANG' to `sv'.
-
-Translating Teams
-=================
-
- For the Free Translation Project to be a success, we need interested
-people who like their own language and write it well, and who are also
-able to synergize with other translators speaking the same language.
-Each translation team has its own mailing list, courtesy of Linux
-International. You may reach your translation team at the address
-`LL@li.org', replacing LL by the two-letter ISO 639 code for your
-language. Language codes are *not* the same as the country codes given
-in ISO 3166. The following translation teams exist, as of December
-1997:
-
- Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en',
- Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian
- `hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja',
- Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish
- `pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es',
- Swedish `sv', and Turkish `tr'.
-
-For example, you may reach the Chinese translation team by writing to
-`zh@li.org'.
-
- If you'd like to volunteer to *work* at translating messages, you
-should become a member of the translating team for your own language.
-The subscribing address is *not* the same as the list itself, it has
-`-request' appended. For example, speakers of Swedish can send a
-message to `sv-request@li.org', having this message body:
-
- subscribe
-
- Keep in mind that team members are expected to participate
-*actively* in translations, or at solving translational difficulties,
-rather than merely lurking around. If your team does not exist yet and
-you want to start one, or if you are unsure about what to do or how to
-get started, please write to `translation@iro.umontreal.ca' to reach the
-coordinator for all translator teams.
-
- The English team is special. It works at improving and uniformizing
-the terminology in use. Proven linguistic skill are praised more than
-programming skill, here.
-
-Available Packages
-==================
-
- Languages are not equally supported in all packages. The following
-matrix shows the current state of internationalization, as of December
-1997. The matrix shows, in regard of each package, for which languages
-PO files have been submitted to translation coordination.
-
- Ready PO files cs da de en es fi fr it ja ko nl no pl pt ru sl sv
- .----------------------------------------------------.
- bash | [] [] [] | 3
- bison | [] [] [] | 3
- clisp | [] [] [] [] | 4
- cpio | [] [] [] [] [] [] | 6
- diffutils | [] [] [] [] [] | 5
- enscript | [] [] [] [] [] [] | 6
- fileutils | [] [] [] [] [] [] [] [] [] [] | 10
- findutils | [] [] [] [] [] [] [] [] [] | 9
- flex | [] [] [] [] | 4
- gcal | [] [] [] [] [] | 5
- gettext | [] [] [] [] [] [] [] [] [] [] [] | 12
- grep | [] [] [] [] [] [] [] [] [] [] | 10
- hello | [] [] [] [] [] [] [] [] [] [] [] | 11
- id-utils | [] [] [] | 3
- indent | [] [] [] [] [] | 5
- libc | [] [] [] [] [] [] [] | 7
- m4 | [] [] [] [] [] [] | 6
- make | [] [] [] [] [] [] | 6
- music | [] [] | 2
- ptx | [] [] [] [] [] [] [] [] | 8
- recode | [] [] [] [] [] [] [] [] [] | 9
- sh-utils | [] [] [] [] [] [] [] [] | 8
- sharutils | [] [] [] [] [] [] | 6
- tar | [] [] [] [] [] [] [] [] [] [] [] | 11
- texinfo | [] [] [] | 3
- textutils | [] [] [] [] [] [] [] [] [] | 9
- wdiff | [] [] [] [] [] [] [] [] | 8
- `----------------------------------------------------'
- 17 languages cs da de en es fi fr it ja ko nl no pl pt ru sl sv
- 27 packages 6 4 25 1 18 1 26 2 1 12 20 9 19 7 4 7 17 179
-
- Some counters in the preceding matrix are higher than the number of
-visible blocks let us expect. This is because a few extra PO files are
-used for implementing regional variants of languages, or language
-dialects.
-
- For a PO file in the matrix above to be effective, the package to
-which it applies should also have been internationalized and
-distributed as such by its maintainer. There might be an observable
-lag between the mere existence a PO file and its wide availability in a
-distribution.
-
- If December 1997 seems to be old, you may fetch a more recent copy
-of this `ABOUT-NLS' file on most GNU archive sites.
-
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index 6a6b4a1bc9..0000000000
--- a/AUTHORS
+++ /dev/null
@@ -1,10 +0,0 @@
-Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org>
- Main author of Camel.
-
-Miguel de Icaza <miguel@gnu.org>
- Base64 encoding in Camel.
-
-Robert Brady <rwb197@ecs.soton.ac.uk>
- Unicode and RFC2047 support for Camel.
-
-
diff --git a/COPYING b/COPYING
deleted file mode 100644
index d60c31a97a..0000000000
--- a/COPYING
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- 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
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index b7c67a0e8e..0000000000
--- a/ChangeLog
+++ /dev/null
@@ -1,1962 +0,0 @@
-2000-01-06 Miguel de Icaza <miguel@gnu.org>
-
- * configure.in: Add Bonobo detection, Bonobo flags for compilation
- for the components and the shell.
-
-2000-01-06 Elliot Lee <sopwith@redhat.com>
- * composer/Makefile.am, widgets/e-table/Makefile.am: Work with
- builddir != srcdir
-
-2000-01-05 Miguel de Icaza <miguel@gnu.org>
-
- * shell/Makefile.am: New file.
-
- * configure.in (EXTRA_GNOME_CFLAGS_THREADS,
- EXTRA_GNOME_LIBS_THREADS): New variables that hold the thread
- version of the compile/link lines.
-
-1999-11-20 Miguel de Icaza <miguel@gnu.org>
-
- * configure.in (PACKAGE): Raise warning level.
-
-2000-01-04 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/mbox/camel-mbox-folder.c (_list_subfolders):
- in the io_error label does not return before the
- list has been freed.
-
-2000-01-03 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/mbox/camel-mbox-folder.c (_list_subfolders):
- detects netscape ".sdb" folders as well as simple
- non-suffixed folders (as the ones used in pine).
-
-
- * camel/string-utils.c (string_prefix):
- finished implementation.
- (string_prefix): added a boolean flag to indicate if the
- suffix has been found. When the suffix does not match,
- return NULL.
-
-1999-12-26 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-exception.c (camel_exception_setv):
- new function. Allow printf-like description
- string constructions.
-
- * camel/camel-exception.h: cosmetic changes.
-
- * camel/providers/mbox/camel-mbox-store.h:
- * camel/providers/mbox/camel-mbox-store.c:
- * camel/providers/mbox/camel-mbox-folder.h:
- * camel/providers/mbox/camel-mbox-folder.c:
- More work on the mbox provider.
-
-
-1999-12-22 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/mbox/camel-mbox-store.h:
- * camel/providers/mbox/camel-mbox-store.c:
- * camel/providers/mbox/camel-mbox-folder.h:
- * camel/providers/mbox/camel-mbox-folder.c:
- part of the mbox provider.
-
-1999-12-20 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c (_set_name):
- check that the folder is closed or raise an exception.
- (_set_name): unset the name fields as soon as possible,
- even if an exception is raised.
-
- * configure.in:
- build mbox provider Makefile
-
- * camel/Makefile.am (SUBDIRS):
- re-enable providers compilation
-
-1999-12-19 Damon Chaplin <damon@karuna.freeserve.co.uk>
-
- * configure.in (AC_OUTPUT): added widgets/meeting-time-sel/Makefile
-
-1999-12-19 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder-utils.c: include camel-log.h
- to avoid unresolved symbols.
-
-1999-12-18 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c (camel_folder_get_summary):
- documented.
-
- * camel/camel-folder-pt-proxy.c (_append_message):
- updated to take the change on append into account.
-
- * camel/camel-folder.h:
- updated class def concerning append.
- * camel/camel-folder.c
- (camel_folder_append_message): documented.
- (camel_folder_append_message): don't return the
- message number. Use specific methods instead.
- (_append_message): idem.
-
- (_delete): use exception mechanism.
- (camel_folder_delete): idem.
- (_delete_messages): idem.
- (camel_folder_delete_messages): idem.
- (_get_parent_folder): idem.
- (camel_folder_get_parent_folder): idem.
- (_get_parent_store): idem.
- (_get_mode): idem.
- (camel_folder_get_parent_store): idem.
- (camel_folder_get_mode): idem.
- (_list_subfolders): idem.
- (camel_folder_list_subfolders): idem.
- (_expunge): idem.
- (camel_folder_expunge): idem.
- (_has_message_number_capability): idem.
- (camel_folder_has_message_number_capability): idem.
- (_get_message_by_number): idem.
- (camel_folder_get_message_by_number): idem.
- (camel_folder_get_message_count): idem.
- (_list_permanent_flags): idem.
- (camel_folder_list_permanent_flags): idem.
- (_copy_message_to): idem.
- (camel_folder_copy_message_to): idem.
- (camel_folder_has_summary_capability): idem.
- (camel_folder_get_summary): idem.
- (camel_folder_has_uid_capability): idem.
- (camel_folder_get_message_uid): idem.
- (_get_message_uid_by_number): idem.
- (camel_folder_get_message_uid_by_number): idem.
- (camel_folder_get_message_by_uid): idem.
- (camel_folder_get_uid_list): idem.
-
-1999-12-17 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c (_set_name):
- use exception mechanism.
- (camel_folder_set_name): idem.
- (camel_folder_set_full_name): idem.
- (_get_name): idem.
- (camel_folder_get_name): idem.
- (_get_full_name): idem.
- (camel_folder_get_full_name): idem.
- (_can_hold_folders): idem.
- (_can_hold_messages): idem.
- (_exists): idem.
- (camel_folder_exists): idem.
- (_is_open): idem.
- (_get_subfolder): idem.
- (camel_folder_get_subfolder): idem.
-
- * camel/camel-exception.c (camel_exception_clear):
- New function. Clear an exception.
- (camel_exception_get_id):
- New function.
- (camel_exception_get_description):
- New function.
-
- * camel/camel-folder.c (_set_name):
- Use the exception system. When the folder
- has no parent, don't set its full name
- field.
-
-
-1999-12-16 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c (camel_folder_expunge):
- (_expunge):
- * camel/camel-folder-pt-proxy.c (_expunge):
- changed the return value. Now returns the list
- of expunged messages
-
- * camel/camel-folder.c (_init_with_store):
- cleaned up. Use the exception system now.
- (_open): ditto.
- (camel_folder_open): ditto.
- (camel_folder_open_async): ditto.
- (_close): ditto.
- (camel_folder_close): ditto.
- (camel_folder_close_async): ditto.
-
- * camel/camel-exception.c (camel_exception_set):
- When no exception is given, do nothing, just
- return.
- (camel_exception_set): documented.
- (camel_exception_new): idem.
- (camel_exception_free): idem.
- (camel_exception_xfer): idem.
-
-
- * camel/camel-folder.c:
- * camel/camel-folder.h: more clean-ups.
- Removed message list related code.
- This was braindead design.
-
-
- * camel/camel-folder-utils.c (camel_aml_expunge_messages):
- implemented. The routines in this file will be
- called by providers to handle the list of
- message already standing in memory.
-
-1999-12-15 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder-utils.c:
- * camel/camel-folder-utils.h:
- New files, misc utilities for the
- folder providers. Includes active message
- list utilities.
-
-
- * camel/camel-folder.c (_has_message_number_capability):
- (camel_folder_has_message_number_capability):
- Added this to know if a folder provides
- number-based message access.
-
- * camel/camel-folder.c (_get_message_count):
- added warning when called directly.
- (_append_message): ditto
- (_open_async): ditto
- (_close_async): ditto
- (_delete_messages): ditto
- (_expunge): ditto
- (_get_message_by_number): ditto
- (_get_message_uid): ditto
- (_get_message_uid_by_number): ditto
- (_get_message_by_uid): ditto
- (_get_uid_list): ditto
-
-
- * camel/camel-folder-pt-proxy.c (_open_async):
- (_open):
- (_close_async):
- (_close):
- (camel_folder_pt_proxy_class_init):
- update
- (_get_message_by_number):
- Update to reflect changes in CamelFolder
-
- * camel/camel-folder.h:
- * camel/camel-folder.c (_get_subfolder):
- (camel_folder_get_subfolder):
- The CamelFolder::get_folder is renamed to
- get_subfolder as it is more intuitive.
-
- * camel/camel-folder.c (_get_message_by_number):
- (camel_folder_get_message_by_number):
- * camel/camel-folder.h
- (camel_folder_get_message_by_number):
- The get_message method is now named
- get_message_by_number for consistency
- with the _by_uid methods.
-
- * camel/camel-folder.[ch]:
- clean-ups.
-
-1999-12-13 Nat Friedman <nat@helixcode.com>
-
- * ebook/e-book.h: New file.
- * ebook/e-book.c: New file.
- * ebook/e-card.h: New file.
- * ebook/e-card-fields.h: New file.
- * ebook/e-commerce.h: New file. :-)
-
-1999-12-08 Ettore Perazzoli <ettore@gnu.org>
-
- * tests/test1.c (main): Removed the strdup()s, which are not
- deeded anymore.
-
- * camel/camel-mime-message.c (_set_subject): `subject' made const.
- (camel_mime_message_set_subject): Likewise.
- (_set_from): `from' made const.
- (camel_mime_message_set_from): Likewise.
- (_set_reply_to): Made `reply_to' const.
- (camel_mime_message_set_reply_to): Likewise.
- (_set_set_received_date): Made `received_date' const.
- (camel_mime_message_set_reply_to): Likewise.
- (_set_field): `value' made const. Also, strdup the string before
- assigning.
-
- * camel/camel-mime-message.h: Virtual methods changed to use const
- strings when setting header values.
-
-1999-11-17 Ettore Perazzoli <ettore@gnu.org>
-
- * composer/Makefile.am (EXTRA_DIST): Added `$(glade_DATA)'.
-
- * camel/Makefile.am (EXTRA_DIST): Added
- `$(libcamel_extra_sources)'.
- (libcamelinclude_HEADERS): Added `gmime-base64.h'.
-
-1999-11-17 Ettore Perazzoli <ettore@gnu.org>
-
- * camel/camel-mime-message.c (_write_to_stream): Removed extra ':'
- in the `Mime-Version' header.
-
- * tests/ui-tests/msg-composer-test.c: Removed.
-
- * Makefile.am (SUBDIRS): Added `composer'.
-
- * configure.in: Create `composer/Makefile'.
-
- * camel/camel-simple-data-wrapper-stream.c
- (camel_simple_data_wrapper_stream_construct): Updated accordingly.
- (camel_simple_data_wrapper_stream_new): Updated accordingly.
- * camel/camel-stream-data-wrapper.c
- (camel_stream_data_wrapper_construct): Updated accordingly.
-
- * camel/camel-data-wrapper.h: Replaced `IS_CAMEL...()' type check
- macro name with `CAMEL_IS...()'.
- * camel/camel-folder-pt-proxy.h: Likewise.
- * camel/camel-folder-summary.h: Likewise.
- * camel/camel-folder.h: Likewise.
- * camel/camel-medium.h: Likewise.
- * camel/camel-mime-body-part.h: Likewise.
- * camel/camel-mime-message.h: Likewise.
- * camel/camel-mime-part.h: Likewise.
- * camel/camel-multipart.h: Likewise.
- * camel/camel-service.h: Likewise.
- * camel/camel-session.h: Likewise.
- * camel/camel-simple-data-wrapper-stream.h: Likewise.
- * camel/camel-simple-data-wrapper.h: Likewise.
- * camel/camel-store.h: Likewise.
- * camel/camel-stream-buffered-fs.h: Likewise.
- * camel/camel-stream-data-wrapper.h: Likewise.
- * camel/camel-stream-fs.h: Likewise.
- * camel/camel-stream-mem.h: Likewise.
- * camel/camel-stream.h: Likewise.
-
- * tests/test1.c (main): Updated to match the `RECIPIENT_TYPE'
- changes.
-
- * camel/camel-mime-message.h: Changed `RECIPIENT_TYPE_TO',
- `RECIPIENT_TYPE_CC' and `RECIPIENT_TYPE_BCC' into
- `CAMEL_RECIPIENT_TYPE_TO', `CAMEL_RECIPIENT_TYPE_CC' and
- `CAMEL_RECIPIENT_TYPE_BCC', respectively.
-
-1999-11-17 Ettore Perazzoli <ettore@gnu.org>
-
- * camel/camel-mime-message.c (_write_to_stream): Write
- "Mime-Version: 1.0" to the stream.
-
- * tests/test1.c: If executed with a file name parameter, attach a
- file with with that name to the email without loading it into
- core, thus demonstrating usage of my latest changes.
-
- * camel/camel-mime-part.c (_set_encoding): Updated to use
- `CamelMimePartEncodingType'.
- (camel_mime_part_set_encoding): Likewise.
- (_get_encoding): Likewise.
- (camel_mime_part_get_encoding): Likewise.
- (_write_content_to_stream): Honour the `encoding' member.
- (_construct_from_stream): Made static.
- (camel_mime_part_encoding_to_string): New function.
- (_write_to_stream): Write the encoding string using it.
- (camel_mime_part_init): Set encoding to
- `CAMEL_MIME_PART_ENCODING_DEFAULT'.
- (_finalize): Don't free `encoding' anymore.
- (camel_mime_part_encoding_from_string): New function.
- (_parse_header_pair): Use it.
-
- * camel/camel-mime-part.h: New enum `CamelMimePartEncodingType'.
- Member `encoding' of `struct _CamelMimePart' changed from `gchar
- *' to `CamelMimePartEncodingType'. All the encoding-related
- methods changed to use this type instead of `gchar *'.
-
- * camel/gmime-base64.c (gmime_encode_base64): Got it to work.
-
- * camel/Makefile.am (libcamel_la_SOURCES): Compile
- `gmime-base64.c'.
-
- * camel/gmime-base64.h: New, previously missing, header.
-
- * camel/camel-stream-data-wrapper.c: New file implementing the
- `CamelStreamDataWrapper' class.
- * camel/camel-stream-data-wrapper.h: Corresponding header.
-
- * camel/camel-simple-data-wrapper.c: Implemented the `get_stream'
- virtual method.
- (_get_stream): New function implementing the method.
- (camel_simple_data_wrapper_class_init): Install it in the class
- struct.
- (camel_simple_data_wrapper_init): New function initializing the
- `stream' member to NULL,
- (camel_simple_data_wrapper_class_init): Set it as the
- GtkObjectInitFunc.
-
- * camel/camel-simple-data-wrapper.h: New member `stream' in
- `struct _CamelSimpleDataWrapper'.
-
- * camel/camel-simple-data-wrapper-stream.c: New file implementing
- the `CamelSimpleDataWrapperStream' class.
- * camel/camel-simple-data-wrapper-stream.h: Corresponding header.
-
- * camel/camel-data-wrapper.c (camel_data_wrapper_get_stream): New
- function.
- (_get_stream): New private function, just returning NULL.
- (camel_data_wrapper_class_init): Install it as the default
- `get_stream' virtual method.
-
- * camel/camel-data-wrapper.h: New virtual method `get_stream' in
- `CamelDataWrapperClass'.
- (camel_data_wrapper_get_stream): New function prototype.
-
-1999-11-05 Ettore Perazzoli <ettore@gnu.org>
-
- * tests/ui-tests/msg-composer-test.c: New file for testing the
- `EMsgComposer' widget.
- * tests/ui-tests/Makefile.am (noinst_PROGRAMS): Compile it. Do
- not compile `store_listing' for now because it's currently broken.
- (INCLUDES): Added the `widgets' source directory to the include
- path list.
- (LDADD): Removed the MH dependency; link with
- `libevolutionwidgets.la' from the `widgets' directory.
-
- * configure.in: Create `widgets/Makefile'.
-
- * camel/gmime-rfc2047.c (rfc2047_clean): Removed C++-like comment.
- * camel/camel-folder.c (camel_folder_get_message_uid_by_number):
- Likewise.
- * camel/gmime-content-field.c (gmime_content_field_get_parameter):
- Likewise.
- * camel/camel.c (camel_init): Likewise.
- * camel/camel-provider.c (camel_provider_register): Likewise.
- * camel/camel-multipart.c (_construct_from_stream): Likewise.
- * camel/camel-mime-part.c (_write_content_to_stream): Likewise.
- * camel/camel-medium.c (camel_medium_class_init): Likewise.
-
- * camel/camel-data-wrapper.h (camel_data_wrapper_get_type): Make
- prototype non-static.
-
- * camel/Makefile.am (libcamelinclude_HEADERS): Move
- `camel-exception-list.def' from `EXTRA_DIST' to
- `libcamelinclude_HEADERS'.
-
- * camel/camel.h: Do not #include <config.h>.
- * camel/data-wrapper-repository.h: Likewise.
-
-1999-11-05 Ettore Perazzoli <ettore@gnu.org>
-
- * tests/Makefile.am (INCLUDES): Add `-I$(top_srcdir)'.
-
-1999-10-13 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c (camel_folder_close): the
- folder->close method is now asynchronous.
-
- * camel/camel-folder-pt-proxy.c (_folder_open_cb):
- (_open):
- (_folder_open_cb):
- (_open):
- open/close method implemented in the thread proxy
- folder. More to come.
-
- * camel/camel-exception.c (camel_exception_xfer):
- new utility func.
-
- * camel/camel-marshal-utils.c: some new marshallers
-
- * camel/camel-folder-pt-proxy.c: Some explanations
- on the thread proxy system.
-
-1999-10-11 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-marshal-utils.c:
- camel/camel-marshal-utils.h:
- Handles operation marshalling.
-
- * camel/camel-thread-proxy.c:
- camel/camel-thread-proxy.h:
- new files. Generic proxy system.
-
- * camel/camel-folder-pt-proxy.c
- moved all proxy related code in dedicated files.
-
- (camel_folder_pt_proxy_init):
- removed proxy initialisation code
- (_finalize):
- removed proxy finalization code
-
-
- * camel/camel-exception.c
- (camel_exception_new):
- (camel_exception_set):
- (camel_exception_free):
- New funcs.
-
-1999-09-21 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder-pt-proxy.c (_async_close):
- implemented.
-
- * configure.in:
- Check pthreads.
-
- * camel/Makefile.am:
- camel-folder-pt-proxy.c is only compiled
- when pthreads are available.
-
- * camel/camel-folder-pt-proxy.c:
- Signal proxying implemenatation.
- (_signal_marshaller_server_side):
- (_signal_marshaller_client_side):
- (_init_signals_proxy):
- Code not is tested and has to be best
- explained as it uses threads conditions and
- gtk signal system.
- (_thread_notification_catch): notify pending signals
- as well as thread availability.
-
-1999-09-20 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder-pt-proxy.c (_op_exec_or_plan_for_exec):
- completed
-
- Binch of new funcs:
- (_maybe_run_next_op):
- Called by the watch notification when
- a threaded op is completed
- (_thread_notification_catch):
- notification watch call back
- (_init_notify_system):
- set up the notification channel
- (notify_availability):
- called by threads before completion.
-
-1999-09-18 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder-pt-proxy.c (_op_exec_or_plan_for_exec):
- new func. Try to exec an operation in a thread
- or queue it if a thread is already busy.
-
- * camel/camel-op-queue.c (camel_op_queue_set_service_availability):
- (camel_op_queue_get_service_availability):
- new funcs.
-
- * camel/camel-op-queue.c (camel_op_new):
- (camel_op_free):
- new funcs. Uses glib mem chunks.
-
-
-1999-09-17 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder-pt-proxy.c (_init_with_store):
- added notify io_channel.
-
- * camel/camel-op-queue.h:
- * camel/camel-op-queue.c:
- New object. Operation queue. Meant to be used in
- non-blocking proxy objects.
- (camel_op_queue_run_next_op): new func.
- run the next operation.
-
-1999-09-14 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/Makefile.am (libcamel_la_SOURCES):
- added camel-folder-pt-proxy.[ch] to the build
- process.
-
- * camel/camel-folder-pt-proxy.c (_init_with_store):
- started implementation of the pthread-based
- folder proxy.
-
-
-1999-09-08 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/MH/mh-summary.c
- (mh_load_summary):
- (mh_save_summary):
- (mh_create_summary):
- implemented summary (files) for MH folders.
-
- * camel/providers/MH/camel-mh-folder.c
- (_get_message_by_uid): implemented.
- (camel_mh_folder_class_init):
- (_get_message_uid): implemented
-
- * camel/camel-folder.c (camel_folder_has_uid_capability):
- (camel_folder_get_message_uid):
- (camel_folder_get_message_uid_by_number):
- (camel_folder_get_message_by_uid):
- (camel_folder_get_uid_list):
- Documented UID methods.
- (camel_folder_get_message_uid_by_number):
- const'ified uid.
- (camel_folder_get_message_by_uid): idem
- removed stupid camel_folder_get_message_uid_by_number
- method.
-
- * tests/ui-tests/store_listing.c (close_all):
- close all open folders and stores. (necessary
- for UID list saving ).
-
- * camel/providers/MH/mh-uid.c (mh_generate_uid_list):
- fix: store UID list in CamelMHFolder object.
-
- * camel/providers/MH/camel-mh-folder.c (_open):
- read or create UID list.
- (_close): save UID list.
-
-1999-09-07 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/md5-utils.c (md5_get_digest_from_file):
- correct parameter decl (const)
-
- * camel/md5-utils.h: typo.
-
- * camel/providers/MH/mh-uid.c
- More work on UID stuff for MH.
- (mh_save_uid_list):
- (mh_load_uid_list):
- (mh_generate_uid_list):
- new funcs. Manage on-disk uid list.
-
- * camel/providers/MH/mh-utils.c (mh_is_a_message_file):
- Util routines live here now.
-
- * camel/md5-utils.c
- Documented all funcs.
-
- (md5_get_digest_from_stream):
- correct typo.
- (md5_get_digest_from_file):
- same typo corrected.
-
-
- * camel/md5-utils.h :
- raw routines are declared public now.
- Md5 use has to be versatile.
-
- * camel/providers/MH/mh-uid.c (mh_uid_get_for_file):
- new func. Returns an UID for an MH message.
-
-1999-09-06 bertrand <Bertrand.Guiheneuf@aful.org>
-
-
- * camel/md5-utils.h:
- * camel/md5-utils.c:
- changed names to follow camel style.
- (md5_get_digest_from_stream):
- new methods.
- (md5_get_digest_from_file):
- new function : get file md5 signature.
- To be used in providers code.
-
- * camel/md5-utils.c: imported md5 coding
- routine from rpm. Compiles.
-
-
-1999-09-05 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c (camel_folder_has_uid_capability):
- (camel_folder_get_message_uid):
- (camel_folder_get_message_uid_by_number):
- (camel_folder_get_message_by_uid):
- (camel_folder_get_uid_list):
- Basic UID framework.
-
- * devel-docs/misc/ref_and_id_proposition.txt:
- New revision. Some fixes.
-
- * camel/camel-folder.h (struct _CamelFolder): added
- uid_capability field.
-
-
- * camel/camel-folder.c (camel_folder_close): publicized
- the close method.
-
- * tests/ui-tests/store_listing.c (show_folder_messages):
- use folder summary instead of opening all messages.
- (show_folder_messages): re-enabled old CPU/Mem consumming
- method. Useful for pop3 for instance.
-
- * camel/providers/MH/camel-mh-folder.c (_create_summary):
- basic and highly non-efficient summary implementation.
- Should be seen as a proof of concept only.
- subfolder summary still has to be implemented.
-
- * camel/providers/maildir/camel-maildir-folder.c (_init_with_store):
- hasn't summary for the moment.
- * camel/providers/maildir/camel-maildir-folder.c
- cosmetic changes.
-
-
-1999-09-04 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/MH/camel-mh-folder.c (_create_summary):
- started summary implementation.
- (_open): correct use of open.
-
- * camel/camel-folder.c (camel_folder_get_summary):
- get folder associated summary object.
-
- * camel/Makefile.am:
- added summary files build
-
- * camel/camel-folder-summary.[ch]:
- basic summary framework
-
-1999-09-03 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * devel-docs/camel/Makefile.am:
- sgml doc has camel-recipient now.
-
- * camel/camel-recipient.c (camel_recipient_foreach_recipient_type):
- added in-line documentation.
-
-1999-09-02 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/maildir: Added (experimental) maildir
- provider written by Jukka Zitting <hukka@greywolves.org>
-
- * camel/providers/Makefile.am (SUBDIRS): build maildir
- provider.
-
- * camel/camel-provider.c (camel_provider_get_for_protocol):
- bug fix. patch from Jukka Zitting <hukka@greywolves.org>
-
- * camel/camel-mime-message.c (_write_one_recipient_to_stream):
- changed decl to fit CRLFunc.
- (_write_recipients_to_stream):
- calls camel_recipient_foreach_recipient_type now.
-
- * camel/camel-recipient.c (camel_recipient_foreach_recipient_type):
- new convinience function. Iterate over all recipient types.
-
- * camel/gmime-utils.c (gmime_write_header_table_to_stream):
- s/write_header_table_to_stream/gmime_write_header_table_to_stream/
- (gmime_write_header_with_glist_to_stream):
- s/write_header_with_glist_to_stream/gmime_write_header_with_glist_to_stream/
-
-1999-09-01 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-message.c (_finalize):
- (_add_recipient):
- (_remove_recipient):
- (_get_recipients): now use CamelRecipientTable
-
- * camel/gmime-content-field.c:
- (gmime_content_field_unref): test if object
- to free is non void.
-
- * camel/camel-folder.c (_finalize):
- (_set_name):
- * camel/camel-mime-part.c (_finalize):
- (_set_description):
- (_set_disposition):
- * camel/camel-service.c (_finalize):
- * camel/camel-stream-fs.c (_finalize):
- * camel/gmime-content-field.c:
- (gmime_content_field_construct_from_string):
-
- * camel/url-util.c (g_url_free):
-
- When using g_free (obj) don't test if obj != NULL
- g_free () already do that. Thanks to elerium for
- the feedback.
-
-1999-08-30 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-recipient.c (camel_recipient_get):
- (camel_recipient_remove):
- (camel_recipient_add):
- new func. More work on new independant recipient code.
-
-1999-08-29 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * MAINTAINERS: updated my e-mail address.
-
-1999-08-28 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.c (camel_mime_part_set_text):
- text parameter declared const
-
- * camel/camel-mime-part-utils.c (camel_mime_part_store_stream_in_buffer):
- actually test correctly nb_bytes_read_chunk is >0
-
- * camel/gstring-util.c:
- * camel/gmime-content-field.c:
- * camel/providers/MH/camel-mh-folder.c:
- * camel/camel-stream-fs.c:
- include string.h
-
- * camel/camel-stream-mem.c (_write): return
- the numver of written bytes.
-
- * camel/camel-stream-buffered-fs.c (_eos):
- return sthg
-
- * camel/camel-stream.c (default_camel_seek):
- return something.
-
-1999-08-26 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.c (_get_content_object):
- contruct the content from the buffer before calling
- CamelMedium implementation.
- (_construct_from_stream): Do not construct the content
- by default, just store the content bytes in
- a temporary buffer. Content will be constructed only
- at caller request (when calling CamelMedium::get_content_object)
- Providers with better access to the messages (mbox/MH ...)
- will have to provider lighter implementation, that is
- shall not read content at all unless the caller asks
- for it (again with get_content).
-
- * camel/camel-mime-part-utils.c: new file, groups
- mime-part related utils. Meant to be used by providers
- subclassing MimeMessage.
- (camel_mime_part_construct_headers_from_stream):
- (camel_mime_part_construct_content_from_stream):
- no more useless temporary hash table.
-
- * camel/camel-mime-part.c (_construct_from_stream): calls
- mime-part-utils functions now.
-
- * camel/gmime-utils.c (_store_header_pair_from_string):
- do not use hash table to store header, use an array instead.
-
-1999-08-25 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.c: now descend from CamelMedium.
-
- * tests/test1.c (main): all headers must be strdup'ed
- (main): unref created objects
-
- * camel/camel-medium.c (_set_content_object):
- (_get_content_object): these methods are
- in CamelMedium now.
-
-1999-08-24 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-medium.c (camel_medium_class_init):
- new class. Will handle all sort of information media
- (Mime mail messages, Lotus Notes mail messages,
- postit notes, faxes, who knows .... :)
- CamelMimePart will inherit from it.
-
- * camel/camel-mime-part.c (_set_disposition):
- (_set_description):
- description and disposition parameters are now const.
-
-
- * camel/gmime-content-field.c (gmime_content_field_free): added
- assertion code.
-
- * camel/providers/MH/camel-mh-folder.c (_get_message):
- uses buffered stream.
-
- * camel/camel-stream-buffered-fs.c:
- new stream to accelerate file ops.
-
-1999-08-20 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-stream-fs.c (camel_stream_fs_new_with_name):
- name parameter is const. This fixes a bug in destroy ()
-
-1999-08-18 Robert Brady <rwb197@ecs.soton.ac.uk>
-
- * camel/gmime-rfc2047.c: more work on encoder.
-
-1999-08-17 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-stream.c (camel_stream_read):
- return the number of bytes read.
- How can this have ever worked ?
- (camel_stream_flush): don't return anything.
-
- * camel/gmime-utils.c (get_header_table_from_stream):
- mem leak fixed.
-
-1999-08-16 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * tests/ui-tests/store_listing.c:
- Now has a popup menu on mailbox tree to allow
- easier tests. Implemented the copy stuff.
- Works well for the MH provider :)))
-
- * camel/providers/MH/camel-mh-folder.c (_copy_message_to):
- Test MH provider fast copy implemented.
-
-
-1999-08-15 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c (camel_folder_expunge):
- moved the active list readjustment code here.
- Much saner, providers won't have to worry about
- that.
- (_copy_message_to): new method.
-
- * camel/providers/MH/camel-mh-folder.c (_expunge):
- no more active list readjustment stuff.
-
- * camel/camel-folder.h: the expunge virtual no more
- returns a list of expunged messages. Now providers
- only have to set the expunge flag on the expunged
- messages.
-
- * camel/camel-folder.c (camel_folder_get_message):
- moved the caching code here. Finally, I don't want
- providers to crash the libs with a bad message cache
- implementation.
- (_close): do not call the CamelFolder virtual expunge
- method directly, use camel_folder_expunge() instead.
- (camel_folder_expunge): added the want_list param.
- The client can decide if it wants the expunged message
- list or not. If yes, it'll have to unref the messages
- itself.
-
-1999-08-14 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * tests/ui-tests/store_listing.c (delete_selected_messages):
- (expunge_selected_folders):
- Implemented deletion/expunge mechanism.
-
- * camel/camel-folder.c (_get_message):
- Added some debug info.
-
- * camel/providers/MH/camel-mh-folder.c (_expunge):
- implemented and tested.
-
- * camel/camel-mime-message.c (_set_flag):
- changed the old braindead implementation.
- boolean are inserted in the flag hash
- table casted as gpointers.
-
-
- * camel/camel-mime-message.c: indentation fix
-
-
-1999-08-13 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c (_get_message): default implementation
- to be called first by providers methods. It looks in the
- folder message list (in memory) to see if the message has
- not already been retrieved, and in this case, returns
- the same CamelMimeMessage object
-
- * camel/providers/MH/camel-mh-folder.c (_get_message): set
- message->message_number correctly.
-
- * camel/camel-folder.h (struct _CamelFolder):
- New field (message_list) which will hold a
- reference on each message obtained by the folder,
- which is necessary in order for the caching procedure
- to work (Getting the same message from a folder twice
- will return the same CamelMimeMessage object).
-
- * camel/camel-folder.c (camel_folder_get_message):
- When the store retreives a message put it in its
- message list.
- (_finalize): free message list.
-
- * ChangeLog: fix typo (parmanent)
-
- * camel/camel-folder.c (_get_permanent_flag_list):
- (camel_folder_get_permanent_flag_list):
- new method, returns the list of permanent
- flags supported by the folder.
-
- * camel/camel-mime-message.c (_get_flag_list):
- (camel_mime_message_get_flag_list): new method,
- return the list of flag name used by this message.
-
- * camel/hash-table-utils.c (g_strcase_equal):
- (g_strcase_hash): those two func go here now.
-
- * camel/hash_table_utils.c (hash_table_generic_free):
- free a (gpointer, gpointer) hash table pair.
-
- * camel/camel-mime-message.c (camel_mime_message_init): use
- case insensitive hash table functions.
- (_set_flag):
- (camel_mime_message_set_flag):
- (_get_flag):
- (camel_mime_message_get_flag):
- Use const for flag name, they are now
- duplicated.
-
-1999-08-12 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * tests/ui-tests/store_listing.c (show_folder_messages):
- remove stupid debug code.
- (add_mail_store): use camel_session_get_store instead
- of creating MH store directly.
- (main): load MH provider.
-
- * camel/camel-provider.c (camel_provider_register_as_module):
- register new provider.
- (camel_provider_get_for_protocol):
- Now, implementation is correct.
-
- * camel/camel-store.c (_finalize):
- * camel/camel-store.h (struct _CamelStore):
- further disabled url_name field use.
- URL will be generated dynamically.
-
- * camel/camel-session.c (camel_session_get_store_for_protocol):
- compilation and runtime fixes.
-
- * camel/providers/MH/camel-mh-store.c (_init):
- synced with CamelStore.
-
- * camel/camel-store.c (_init):
- in CamelStore::init, url_name is now const.
- disabled url_name copy.
-
- * camel/camel-session.c (camel_session_get_store):
- new function: returns a store for an URL.
- (camel_session_get_store_for_protocol):
- new functionc: returns a store for a given
- store protocol (as IMAP/POP/MH ...)
- * camel/string-utils.c (g_strcase_equal):
- (g_strcase_hash): case insensitive hash table
- funcs.
-
- * camel/camel-session.c (camel_session_init): hash table
- keys are case insensitive.
-
- * camel/camel-provider.c (camel_provider_get_for_protocol):
- new function, returns the last registered
- provider for a protocol.
-
- * camel/providers/MH/camel-mh-provider.c:
- new file. MH provider registration stuff.
-
- * camel/camel-provider.c (camel_provider_register_as_module):
- load a provider from a shared object (plugin).
- (camel_provider_register): register a provider
- "by hand". Used for statically defined providers.
-
- * tests/test7.c: new test.
- tests providers loading framework.
-
-1999-08-11
-
- * camel/camel-service.c (_finalize):
- * camel/camel-stream-fs.c (_finalize):
- (_destroy): close file descriptor.
- * camel/camel-stream-mem.c (_finalize):
- * camel/camel-store.c (_finalize):
- * camel/camel-folder.c (_finalize):
- * camel/camel-multipart.c (_finalize):
- * camel/camel-simple-data-wrapper.c (_finalize):
- * camel/camel-mime-part.c (_finalize):
- implemented destructors.
-
-
- * camel/gmime-content-field.c (gmime_content_field_ref):
- (gmime_content_field_unref):
- New reference mechanism for GMimeContentField objects.
-
- * camel/camel-data-wrapper.c (_finalize):
- Started implementing destructors.
-
- * camel/camel-mime-part.c (_construct_from_stream):
- * camel/gmime-content-field.c (gmime_content_field_write_to_stream):
- * camel/camel-multipart.c (_construct_from_stream):
- removed forgotten anarchic traces.
-
-1999-08-10 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * tests/ui-tests/store_listing.c:
- * tests/ui-tests/store_listing.glade:
- Quick and (very) dirty hack to test Camel more
- easily.
-
- * camel/camel-folder.c (camel_folder_append_message):
- new method.
-
-1999-08-09 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * devel-docs/misc/ref_and_id_proposition.txt:
- new file. Document message UID and vfolder
- implementation.
-
-1999-08-08 Robert Brady <rwb197@ecs.soton.ac.uk>
-
- * camel/gmime-rfc2047.c: more advanced RFC2047 encoder started.
-
-1999-08-08 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/MH/camel-mh-folder.c (_get_message):
- fix. In MH, message number is not related to
- message position in folder.
-
- * camel/providers/MH/camel-mh-folder.c (_is_a_message_file):
- util func.
- (_get_message_count): implemented.
-
-1999-08-06 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * devel-docs/camel/:
- updated some autogen doc stuff.
- Still don't understand warnings :(
-
- * camel/camel-data-wrapper.c:
- * camel/providers/MH/camel-mh-store.c:
- * camel/url-util.c:
- * camel/gmime-content-field.c:
- * camel/camel-store.c:
- various inline doc corrections.
-
- * camel/camel-folder.c (get_message_count):
- new method. Returns the number of message
- in the folder.
-
-
-
-1999-08-06 Robert Brady <rwb197@ecs.soton.ac.uk>
-
- * tests/test6.c: encoder test.
-
- * camel/gmime-rfc2047.c: Fixed decoder bug : sequence
- ?= is not always the terminator for an encoded-string.
-
-
-1999-08-06 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/MH/camel-mh-folder.c (_list_subfolders):
- stat was not testing the good file. Fixed.
-
- * tests/test4.c (main): added real test for MH folder
- provider. All tested things seem to work OK :)
-
-1998-08-06 Robert Brady <rwb197@ecs.soton.ac.uk>
-
- * tests/test5.c: test for RFC2047 decoder.
-
- * camel/gmime-rfc2047.c: Improved RFC2047 decoder.
-
-1999-08-06 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/MH/camel-mh-folder.c (_exists): add debug information
- (_list_subfolders): test if first char in folder name is not '.'
- before adding it to the folder list.
-
- * camel/camel-store.c (_init):
- disable session check temporarily
- (_get_separator):
- (_get_folder): new static func.
- Fixed several oddities in class definition.
-
- * camel/providers/MH/camel-mh-store.c (camel_mh_store_get_type):
- parent type is CAMEL_STORE_TYPE not CAMEL_FOLDER_TYPE
-
- * camel/camel-store.c:
- prent class is CamelServiceClass not GtkObjectClass
-
- * camel/url-util.c :
- cosmetic changes + use of const when possible.
- (find_host):
- fix a bug: when there is no host and no port don't skip the '/'
- all static find_* func are now named _func_*
- (g_url_free): destructor func.
- cache field has been disabled. Constructing the url string
- won't be too slow and will occur rarely enough that we
- do not need to add complexity to this code.
-
- * camel/providers/MH/camel-mh-store.c:
- parent class is CamelStorClass not GtkObjectClass
-
-1999-08-05 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * tests/test4.c:
- test mh provider.
-
- * camel/providers/MH/camel-mh-folder.c (_get_message):
- implemented
-
- * camel/camel-folder.c (_get_message):
- new method.
- (camel_folder_get_message):
- corresponding public call
-
- * camel/README.HACKING:
- Some notes.
-
- * camel/CODING.STYLE:
- short note about coding style.
-
- * camel/README.COPYRIGHT:
- Note about copyright policy.
-
- * camel/providers/MH/camel-mh-folder.c (_list_subfolders):
- minor typo fixes.
-
-
-1999-08-04 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/gmime-rfc2047.c:
- * camel/gmime-rfc2047.h:
- indentation and cosmetic changes.
-
- * camel/providers/MH/camel-mh-folder.c (_list_subfolders):
- implemented.
- * camel/providers/MH/camel-mh-folder.c (_delete):
- finshed implementation
- (_delete_messages): implemented.
-
-
-1999-08-04 Robert Brady <rwb197@ecs.soton.ac.uk>
-
- * camel/gmime-rfc2047.[ch]: added an implemention of RFC2047
- (support for character sets other than US-ASCII in MIME
- headers). Not actually called from anywhere yet.
-
-
-1999-08-03 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/MH/camel-mh-folder.c (_create):
- implemented.
- (_delete): started implementation.
-
- * camel/camel-folder.c (_get_folder): default implementation
- calls camel_store_get_folder ().
-
- * camel/providers/MH/camel-mh-folder.c (_init_with_store):
- implemented.
-
- * camel/camel-folder.h (struct _CamelFolder):
- remove useless exist_on_store field.
-
- * camel/camel-folder.c (_exists):
- do not use exist_on_store field.
-
- * camel/camel-folder.c (camel_folder_set_name):
- (camel_folder_get_name):
- new public functions
- (_set_name): set full_path.
-
- (_set_full_name):
- (camel_folder_set_full_name):
- commented out this functions def.
- It would make things very difficult to handle, and would not
- be very useful.
-
- * camel/providers/MH/camel-mh-store.h:
- * camel/providers/MH/camel-mh-store.c (camel_mh_store_set_toplevel_dir):
- (camel_mh_store_get_toplevel_dir):
- * camel/providers/MH/camel-mh-folder.c (_set_name):
- * camel/providers/MH/camel-mh-folder.h:
- use (gchar *) instead of (GString *) everywhere.
- use const when necessary.
-
- * camel/camel-folder.h (struct _CamelFolder):
- removed unused message_list field.
-
- * camel/camel-mime-part.c (_set_content_object):
- There is a probleme here. We can not allow mime part
- content-type field and content_object mime-type to be
- different. I thus chosed to set mime part object
- content field to be freed (if necessary) and set
- to be a pointer to content_object mime type
- field.
- (_construct_from_stream): set content_object mime type
- to be the same as mime_part's one. This is necessary
- because we use _set_content_type.
-
- This two things are a bit hackish ansd may need
- to be redesigned.
-
- * camel/gmime-utils.c (gmime_write_header_pair_to_stream):
- use g_strdup_printf and remove a bug.
-
- * camel/camel-simple-data-wrapper.c (_construct_from_stream):
- more debugging output + nb_bytes_read is now a signed int
- to avoid bug when eos is encountered.
-
- * camel/camel-mime-part.c (_construct_from_stream):
- sync to data_wrapper_repository function name changes.
- Use default "text/plain" type when conten-type field
- is not found. (following RFC 2046 spec).
-
- * camel/data-wrapper-repository.c (data_wrapper_repository_set_data_wrapper_type):
- (data_wrapper_repository_get_data_wrapper_type):
- change function name prefix (s/data_wrapper/data_wrapper_repository/)
-
- * camel/camel-multipart.c (_read_part):
- add `\n` at eol but not before boundary.
-
- * camel/gmime-utils.c (get_header_table_from_stream):
- correct implementation of end of stream detection.
-
-1999-08-01 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-multipart.c (_read_part):
- use a stream to store the part instead of GString.
-
- * camel/camel-mime-part.c (camel_mime_part_set_text):
- set data wrapper content type to "text/plain".
-
- * camel/camel-stream-mem.c:
- * camel/camel-stream-mem.h:
- new memory buffer based stream.
-
- * camel/camel-stream-fs.c (_seek):
- implementation for file system based stream.
-
- * camel/camel-stream.c (camel_stream_seek):
- new method.
-
- * camel/camel-stream-fs.c (camel_stream_fs_class_init):
- pass CamelStreamFsClass instead of CamelStreamClass.
-
-1999-08-01 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/gmime-utils.c (gmime_write_header_pair_to_stream):
- corrected a bug with memory not allocated for '\0' in strtmp
-
- * camel/gmime-utils.c (gmime_read_line_from_stream):
- do not return NULL when line is empty.
-
- * camel/camel-multipart.c (_read_part): return true when end
- of multipart is found, not the opposite
-
-1999-07-31 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/gmime-utils.c (gmime_read_line_from_stream):
- Don't return crlf at end of line.
-
-1999-07-30 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/gmime-utils.c (gmime_read_line_from_stream):
- new function: reads a line from a stream.
- should be in streams utils maybe.
-
-1999-07-29 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.c (_construct_from_stream):
- Uses data wrapper repository to find what data wrapper
- to use to construct the content from a stream. When
- no object is registered for the mime type found in
- content type field a CamelSimpleDataWrapper is
- used.
-
- * camel/camel-mime-part.c (_get_content_type):
- (camel_mime_part_get_content_type): returns
- a pointer on the content_type field instead
- of the gchar * mime "type/subtype".
-
-1999-07-28 bertrand <Bertrand.Guiheneuf@aful.org>
-
-
- * camel/data-wrapper-repository.c
- * camel/data-wrapper-repository.h
- New files. Handles mime type <-> camel object
- (for example "multipart" <-> CamelMultipart
- * tests/tesst3.c: test data repository thing.
-
-1999-07-26 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-multipart.c (_write_to_stream):
- implemented output of multipart.
-
- * tests/test1.c (main): testing content objects operations.
-
-1999-07-25 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.c (camel_mime_part_set_text):
- new util function to set a mime part content to be
- a text string.
-
- * camel/camel-simple-data-wrapper.c (camel_simple_data_wrapper_set_buffer_from_text):
- new util func.
- (camel_simple_data_wrapper_new): new func.
-
- * camel/camel-multipart.c (_write_to_stream):
- implemented output of multiparts.
-
-1999-07-24 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/gmime-content-field.c (gmime_content_field_get_parameter):
- New function. Returns the value associated to a
- mime parameter.
-
-
-1999-07-22 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-multipart.h:
- * camel/camel-multipart.c:
- New class. Models multipart mime objects.
-
- * camel/camel-mime-body-part.h:
- * camel/camel-mime-body-part.c:
- New class. Body part is a mime part contained in
- a multipart object.
-
-
-1999-07-21 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-log.h:
- implemented hard log level stuff.
- * came/*.c use "CAMEL_LOG_*" instead of "CAMEL_LOG (*"
- in order to allow hard level switch.
-
- * tests/test1.c:
- * tests/test2.c:
- updated to use gchar instead of GString. Tests passed.
-
-
-1999-07-19 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-stream.c:
- * camel/camel-stream.h:
- "const"-antified
-
-
- * camel/camel-simple-data-wrapper.c: (_construct_from_stream)
- do not use any limit when constructing the object from a stream
-
- * camel/camel-stream-fs.c:
- * camel/camel-stream-fs.h:
- * camel/camel-mime-message.c:
- * camel/camel-mime-message.h:
- * camel/camel-session.c:
- * camel/camel-session.h:
- * camel/camel-service.c:
- * camel/camel-service.h:
- * camel/camel-store.c:
- * camel/camel-store.h:
- * camel/camel-folder.c:
- * camel/camel-folder.h:
- * camel/gmime-utils.c:
- * camel/gmime-utils.h:
- GString -> gchar
- constantified what had to be.
-
- * camel/string-utils.c:
- * camel/string-utils.h:
- New files. Meant to replace gstring-util for gchar *
-
-1999-07-16 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/gmime-content-field.c (gmime_content_field_construct_from_string):
- GString -> gchar
- use const to indicate copied parameter.
-
-1999-07-15 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-simple-data-wrapper.c:
- * camel/camel-simple-data-wrapper.h:
- Gstring -> gchar
-
-1999-07-15 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/url-util.c:
- * camel/url-util.h:
- Do not use GStrings any more.
- Added assertion code.
- Cosmetic reformating
-
- * AUTHORS:
- * ChangeLog:
- Changed my email address.
-
-
-1999-07-13 Miguel de Icaza <miguel@gnu.org>
-
- * camel/gmime-base64.c (gmime_encode_base64): Implemented base64
- encoder based on CamelStreams. Should the encoder/decoder be a
- Stream itself?
-
- * camel/gmime-utils.c: include config.h here.
- * camel/url-util.c: ditto.
- * camel/gstring-util.c: ditto.
- * camel/gmime-content-field.c: ditto.
- * camel/camel-stream.c: ditto.
- * camel/camel-stream-fs.c: ditto.
- * camel/camel-store.c: ditto.
- * camel/camel-simple-data-wrapper.c: ditto.
- * camel/camel-session.c: ditto.
- * camel/camel-service.c: ditto.
- * camel/camel-mime-part.c: ditto.
- * camel/camel-mime-message.c: ditto.
- * camel/camel-log.c: ditto.
- * camel/camel-data-wrapper.c: ditto
- * camel/camel-folder.c: ditto.
-
- * camel/camel-stream.c (camel_stream_write): Moved api
- documentation to the places that they document.
- (camel_stream_class_init): Virtual classes do not need to have a
- default implementation. So null them all.
- (camel_stream_write): Return value from write.
- (camel_stream_available): implement.
- (camel_stream_write_strings): documented.
-
- * devel-docs/query/virtual-folder-in-depth.sgml: Small
- reformatting
-
-1999-06-28 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * tests/test2.c (main): now use
- CamelDataWrapper::contruct_form_stream to test
- message parsing
-
- * camel/camel-data-wrapper.c:
- * camel/camel-data-wrapper.h:
- construct_from_stream no longer has maximimum size arg.
-
- * camel/camel-mime-part.c (_construct_from_stream): new.
- Construct the mime_part from a stream.
-
- * camel/camel-mime-part.c:
- new field (content_type) and associated methods.
- (camel_mime_part_init): initialize content_type field.
- (_parse_header_pair): now set content_type MimePart field
- instead of using DataWrapper Mime typing facility.
-
-1999-06-28 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-data-wrapper.h:
- s/content_type/mime_type/
-
-1999-06-24 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-simple-data-wrapper.[ch]:
- new class. Simple implementation of a data wrapper:
- simply keeps the stream result in a byte array.
-
- * camel/camel-mime-part.c (_parse_header_pair): added a warning.
- Have to think about the correct way to store content type stuff.
-
-1999-06-24 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-message.c (_write_one_recipient_to_stream):
- includes gmime-utils header.
- patch from Ulrich Drepper <drepper at cygnus.com>
- set separator string in write_header_with_glist_to_stream()
-
- * camel/camel-log.c (camel_log):
- patch from Ulrich Drepper <drepper at cygnus.com>
- Do not use stderr in initialization of logfile descriptor.
-
- * camel/camel-stream-fs.c (camel_stream_fs_new_with_name):
- patch from Ulrich Drepper <drepper at cygnus.com>
- initialize mode field in open().
-
-1999-06-22 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-data-wrapper.c (_get_content_type):
- moved all the content-type stuff here.
- (camel_data_wrapper_init): initialize the instance
- content-type field.
-
- * camel/camel-mime-part.c (_parse_header_pair):
- parse Content-Type stuff in header.
- (_write_to_stream): write the content type stuff to
- the stream.
-
- * camel/gmime-content-field.c (gmime_content_field_get_mime_type):
- new function, returns "type/subtype" mime type string.
- (gmime_content_field_construct_from_string):
- new function, construbt a content_field object
- form a string. be used to set the mime_type from a
- string.
-
- * camel/camel-mime-part.c (_set_content_type):
- (camel_mime_part_set_content_type):
- (_get_content_type):
- (_get_content_type):
- new methods.
-
-1999-06-21 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/gmime-utils.c (get_header_table_from_stream):
- replace CR/LF+'\t' with ' '
-
- * camel/camel-mime-message.c (_set_recipient_list_from_string):
- trim \t when splitting
-
- * camel/gmime-utils.c (get_header_table_from_file):
- corrected bug in scanning tabulations ('t' -> '\t')
-
- * tests/test2.c (main): read mail.test instead
- of mail1.test
-
- * camel/camel-mime-part.c (_add_header):
- added comments
-
-1999-06-03 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * devel-docs/query/virtual-folder-in-depth.sgml:
- sgmlized Giao's doc about virtual folders.
-
-1999-05-31 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * tests/test2.c (main):
- use new stream code instead of raw file * stuff.
-
- * camel/gmime-utils.c (get_header_table_from_stream):
- new func. Will replace get_header_table_from_file and will
- be used to parse headers from files as well as from
- memory buffers.
-
- * camel/camel-stream-fs.c:
- CamelStream Subclass. File system based
- stream.
-
-
-1999-05-30 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-stream.h: new class. Represents an
- abstract stream object.
-
- * camel/camel-mime-message.c (_set_recipient_list_from_string):
- remove leading and trailing spaces in recipient addresses.
-
- * camel/gmime-utils.c (_store_header_pair_from_gstring):
- remove leading and trailing spaces from header values.
-
- * camel/gstring-util.c (g_string_trim): new
- func: remove leading or trailng chars from
- a specified char set.
- (g_string_split): allow trimming of substrings.
-
- * tests/test1.c (main): remove gtk_main call
-
-1999-05-28 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.c
- (_parse_header_pair):
- (_init_header_name_table):
- More header parsing code.
-
-
-1999-05-27 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * tests/test2.c (main): rewrite message obtained via
- parsing into a file. Actually, it works pretty well :))
-
- * camel/camel-mime-message.c (_set_recipient_list_from_string):
- create recipient list form a comma separated string.
- (_parse_header_pair): added recipient lists parsing.
-
- * camel/camel-mime-part.c (_parse_header_pair):
- new (protected) method. Parse a head pair and
- decides what to do with it.
-
- (_add_header): Call in _parse_header_pair
-
- * camel/camel-mime-message.c (_parse_header_pair):
- overload header parsing MimePart mthod.
-
- * camel/gstring-util.c (g_string_split):
- new func: split a gstring into a GList of
- substring.
-
-1999-05-26 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/gmime-utils.c (get_header_lines_from_file):
- new func. Parses message header zone and returns
- a Glist of all header lines.
-
- * tests/test2.c: tests message parsing
-
- * camel/gmime-utils.c (write_header_table_to_file):
- new func to write a table of headers.
-
-1999-05-20 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-message.c (_write_to_file):
- recipient list printing
-
- * tests/test1.c (main): more tests.
-
-1999-05-19 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.c (_write_to_file): test if content
- exists before calling its write_to method.
-
- * camel/camel-mime-message.c (_write_to_file): bugs fix.
-
- * camel/camel-mime-message.c (camel_mime_message_new_with_session):
- new func. Creates a message with the session field set
- up correctly.
-
-1999-05-18 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * tests/test1.c (main): tests
-
- * camel/camel-mime-message.c (_write_to_file):
- started write_to framework for mime_messages
-
- * camel/camel-mime-message.c (*_message_number):
- message number funcs.
-
-1999-05-15 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-message.c (*_flag):
- flags handling methods
-
-1999-05-14 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-message.c (camel_mime_message_class_init):
- added recipient handling class funcs.
-
-1999-05-13 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-message.c (camel_mime_message_init):
- create recipients hash table
- (_remove_recipient):
- (_add_recipient):
- (_get_recipients): new funcs.
- Internal Recipients data structure is
- a bit complicated though.
-
- * camel/camel-mime-part.c (camel_mime_part_init):
- create headers hash table
-
- * camel/camel-mime-message.h:
- a bunch of get/set header field
- method done. Does nothing yet though.
-
- * camel/camel-mime-message.[ch] :
- new file.
-
-1999-05-12 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.h (struct ):
- disposition is now a full GMimeContentField
- object.
-
- * camel/gmime-content-field.c: new file
- handle "type/subtype ;parameter=value ; parameter=value ..."
- BNF grammar elements
- (gmime_content_field_write_to_file): new func
-
- * camel/gmime-utils.c (gmime_write_header_pair_to_file):
- namespace change
-
-1999-05-11 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.c (_write_to_file):
- overload wrapper class method.
- (_write_to_file): start to write some text in
- file.
-
- * camel/camel-store.c: typo fix.
-
- * camel/camel-store.c:
- * camel/camel-service.c:
- * camel/camel-folder.c:
- * camel/camel-data-wrapper.c:
- * camel/camel-mime-part.c:
- static functions naming follows gnome
- coding style guide.
-
- * camel/camel-mime-part.h: implemented public interfaces
-
-
-1999-05-10 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.c (__camel_mime_part_get_header_lines):
- (__camel_mime_part_set_header_lines):
- (__camel_mime_part_get_content_languages):
- (__camel_mime_part_set_content_languages):
- (__camel_mime_part_get_encoding):
- (__camel_mime_part_set_encoding):
- (__camel_mime_part_get_content_MD5):
- (__camel_mime_part_set_content_MD5):
- (__camel_mime_part_get_content_id):
- (__camel_mime_part_set_content_id):
- A bunch of new set/get func.
-
- * camel/gstring-util.c (g_string_list_free):
- convenience function for string list
- complete deallocation.
-
-1999-05-09 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.c (__camel_mime_part_add_header):
- new method
-
- * camel/camel-mime-part.h (struct CamelMimePart):
- added core fields.
-
-1999-05-08 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-mime-part.[ch]:
- new class. models a mime mail part.
-
- * camel/camel-data-wrapper.c
- (camel_data_wrapper_write_to_buffer): method to
- stream data content in a buffer.
- (camel_data_wrapper_write_to_file):
- (camel_data_wrapper_construct_from_buffer):
- (camel_data_wrapper_construct_from_file):
- new methods.
-
-1999-05-07 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-data-wrapper.[ch]:new class.
- This should not be a class but rather an
- interface. The day Gtk support interfaces,
- it dataWrapper should become an interface.
-
-1999-05-04 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-service.c (camel_service_get_url):
- new method.
-
- * devel-docs/camel/camel-sections.txt: added
- function doc references
-
- * camel/camel-folder.c (__camel_folder_close):
- fixed indentation.
- (camel_folder_expunge): new method.
- (__camel_folder_close): used expunge flag
-
-1999-05-03 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c (camel_folder_get_mode):
- typo fix
-
- * camel/camel-folder.c (__camel_folder_list_subfolders):
- new func.
-
- * some doc stuffs
-
-
-1999-05-01 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c
- (__camel_folder_get_mode):
- (camel_folder_get_mode):
- (camel_folder_get_parent_store):
- (__camel_folder_get_parent_store):
- (camel_folder_get_parent_folder):
- (__camel_folder_get_parent_folder):
- new methods
-
- * camel/camel-service.c: put __ prefix before
- private virtual funcs.
-
- * camel/camel-folder.c (camel_folder_delete):
- (camel_folder_delete_messages):
- new methods.
-
- * camel/url-util.c (g_url_new): some
- more comments
-
-1999-04-27 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c (camel_folder_create):
- new public function.
-
-1999-04-25 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-session.c (camel_session_get_store_from_provider):
- initialize folder object.
-
- * camel/camel-store.c (init): new method.
- called by session object at instantiation time.
-
- * camel/camel-store.h (struct _CamelStore):
- new fields : session and url_name
-
-1999-04-25 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-session.c (camel_session_set_provider):
- new method to set the default provider for a protocol.
- (camel_session_get_store_from_provider):
- new method to instantiate a folder from a provider.
-
- * camel/camel-provider.h: s/GString/gchar/g
- + typo fix.
-
- * camel/camel-provider.[ch]:
- basic provider structure. Have to write the
- code for dynamic loading.
-
-1999-04-24 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/url-util.[ch]: s/new_g_url/g_url_new
-
- * camel/url-util.c (new_g_url): URL
- rewritten completely. Error handling not
- implemented in public functions.
- But URL scan works pretty well :)))
-
-1999-04-24 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/url-util.[ch]: I needed the url
- functions to use GString, and I wanted a more
- general scheme so I finally started rewriting
- the whole thing from scratch.
- No more code from gzilla :(
-
-1999-04-23 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/url-util.[ch]:
- Utility functions to parse URLs.
- Stolen shamelessly from gzilla (www.gzilla.com)
- written by Raph Levien <raph@acm.org>
-
- * camel/Makefile.am: added url-util.[ch]
- compilation.
-
- * Makefile.am (SUBDIRS): removed devel-docs
- until I come up with a correct Makefile.am
-
- * camel/camel-store.h:
- * camel/camel-folder.h:
- correct declarations of structs
-
-
-1999-04-22 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/MH/camel-mh-store.c:
- more test implementation.
-
- * camel/camel-store.c (camel_store_get_type): typo fix
-
-
-1999-04-21 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/providers/MH/camel-mh-folder.c (camel_mh_folder_get_type):
- start test provider.
-
-1999-04-20 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-store.h: now CamelStore inherits from
- CamelService.
-
- * camel/camel-service.c (camel_service_class_init):
- basic abstract service class.
-
-1999-04-19 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/README: added some (few) explanations.
-
-1999-04-18 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-store.[ch]: started implementation
- * camel/camel-folder.c (camel_folder_get_type): typo
- uncommented the store related code.
- (camel_folder_create): enable som store relted code.
- Not finished. Have to define public methods first.
-
- * camel/camel-log.h: some explanation about the
- log system
-
-1999-04-18 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c:
- (camel_folder_create): implemented (partially)
- have to write CamelStore before finishing it.
-
- * camel/camel-folder.h (CamelFolder): added full_name field
- (CamelFolderClass): added set/get_full_name methods
-
-1999-04-18 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * camel/camel-folder.c: some work
- * camel/camel-log.c: log system for camel
- * camel/gstring-util.c: some utilities for GString objects
-
-
-1999-04-18 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * autogen.sh (PKG_NAME): groomf -> gnome-mailer
-
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index b42a17ac46..0000000000
--- a/INSTALL
+++ /dev/null
@@ -1,182 +0,0 @@
-Basic Installation
-==================
-
- These are generic installation instructions.
-
- The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
-
- If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release. If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
-
- The file `configure.in' is used to create `configure' by a program
-called `autoconf'. You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
-
-The simplest way to compile this package is:
-
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
-
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
-
- 2. Type `make' to compile the package.
-
- 3. Optionally, type `make check' to run any self-tests that come with
- the package.
-
- 4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
- for the package's developers. If you use it, you may have to get
- all sorts of other programs in order to regenerate files that came
- with the distribution.
-
-Compilers and Options
-=====================
-
- Some systems require unusual options for compilation or linking that
-the `configure' script does not know about. You can give `configure'
-initial values for variables by setting them in the environment. Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
- CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
-
-Or on systems that have the `env' program, you can do it like this:
- env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
-
-Compiling For Multiple Architectures
-====================================
-
- You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
- If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory. After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
-
-Installation Names
-==================
-
- By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc. You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
-
- You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files. If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
- In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
- If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
- Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
- For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
- There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on. Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
- CPU-COMPANY-SYSTEM
-
-See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
-
- If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
-
-Sharing Defaults
-================
-
- If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Operation Controls
-==================
-
- `configure' recognizes the following options to control how it
-operates.
-
-`--cache-file=FILE'
- Use and save the results of the tests in FILE instead of
- `./config.cache'. Set FILE to `/dev/null' to disable caching, for
- debugging `configure'.
-
-`--help'
- Print a summary of the options to `configure', and exit.
-
-`--quiet'
-`--silent'
-`-q'
- Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
- messages will still be shown).
-
-`--srcdir=DIR'
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-`--version'
- Print the version of Autoconf used to generate the `configure'
- script, and exit.
-
-`configure' also accepts some other, not widely useful, options.
diff --git a/MAINTAINERS b/MAINTAINERS
deleted file mode 100644
index 7a42d1eee8..0000000000
--- a/MAINTAINERS
+++ /dev/null
@@ -1 +0,0 @@
-Email: miguel@kernel.org
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 6a9c335cc5..0000000000
--- a/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-SUBDIRS = \
- po \
- macros \
- camel \
- e-util \
- widgets \
- composer \
- tests
-
-dist-hook:
- for subdir in intl ; do \
- mkdir $(distdir)/$$subdir ; \
- cp -pr $(srcdir)/$$subdir $(distdir) ; \
- done
diff --git a/NEWS b/NEWS
deleted file mode 100644
index 5b9f6e1c60..0000000000
--- a/NEWS
+++ /dev/null
@@ -1,8 +0,0 @@
-01/Jun/1999
------------
-
-New development document from Giao Nguyen :
-TITLE: An in-depth look at the virtual folder mechanism
-(see devel-docs/query)
-
-
diff --git a/README b/README
deleted file mode 100644
index 9b4f6c7ca8..0000000000
--- a/README
+++ /dev/null
@@ -1,3 +0,0 @@
-This is the future gnome mailer.
-
-See camel/README for details about the mail library. \ No newline at end of file
diff --git a/acconfig.h b/acconfig.h
deleted file mode 100644
index 4ac725695e..0000000000
--- a/acconfig.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#undef ENABLE_NLS
-#undef HAVE_CATGETS
-#undef HAVE_GETTEXT
-#undef HAVE_LC_MESSAGES
-#undef HAVE_STPCPY
-#undef HAVE_LIBSM
-#undef PACKAGE
-#undef VERSION
-#undef HAVE_BONOBO
-#undef CAMEL_HARD_LOG_LEVEL
-
-/* Define this if you want to build against the development gtk */
-#undef HAVE_DEVGTK
-
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index eec4b5f56d..0000000000
--- a/autogen.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-# Run this to generate all the initial makefiles, etc.
-
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-
-PKG_NAME="evolution"
-
-
-. $srcdir/macros/autogen.sh
diff --git a/camel/.cvsignore b/camel/.cvsignore
deleted file mode 100644
index fd6b811c68..0000000000
--- a/camel/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
diff --git a/camel/CODING.STYLE b/camel/CODING.STYLE
deleted file mode 100644
index a236f0060f..0000000000
--- a/camel/CODING.STYLE
+++ /dev/null
@@ -1,19 +0,0 @@
-Note to hackers
----------------
-
-When hacking on camel (and on the gnome mailer in general),
-be sure to follow the same coding style as the intial authors.
-Please read the file HACKING in gnumeric and follow the
-general guidelines explained in it.
-
-Please take a look at camel source files and try to exactly
-imitate the coding style. We are perfectly aware that this
-is not the best and unique style, but it is absolutely
-mandatory that Camel is homogeneous. If you find the current
-coding style to have some weaknesses, please contact the
-authors to discuss this matter.
-
-Thanks.
-
- Bertrand.
-
diff --git a/camel/Makefile.am b/camel/Makefile.am
deleted file mode 100644
index b61bb5bef7..0000000000
--- a/camel/Makefile.am
+++ /dev/null
@@ -1,120 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS = providers
-
-libcamelincludedir = $(includedir)/camel
-
-
-lib_LTLIBRARIES = libcamel.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR)
-
-
-if HAVE_PTHREAD
-
-pthread_SRC = \
- camel-folder-pt-proxy.c \
- camel-thread-proxy.c
-
-pthread_HDR = \
- camel-folder-pt-proxy.h \
- camel-thread-proxy.h
-
-else
-
-libcamel_pthread_SRC =
-libcamel_pthread_HDR=
-
-endif
-
-
-libcamel_la_SOURCES = \
- camel.c \
- camel-log.c \
- camel-data-wrapper.c \
- camel-exception.c \
- camel-simple-data-wrapper.c \
- camel-simple-data-wrapper-stream.c \
- camel-stream-data-wrapper.c \
- camel-folder.c \
- camel-folder-summary.c \
- camel-folder-utils.c \
- camel-medium.c \
- camel-marshal-utils.c \
- camel-mime-body-part.c \
- camel-mime-message.c \
- camel-mime-part.c \
- camel-mime-part-utils.c \
- camel-multipart.c \
- camel-op-queue.c \
- camel-provider.c \
- camel-recipient.c \
- camel-service.c \
- camel-session.c \
- camel-store.c \
- camel-stream.c \
- camel-stream-buffered-fs.c \
- camel-stream-fs.c \
- camel-stream-mem.c \
- data-wrapper-repository.c \
- gmime-base64.c \
- gmime-content-field.c \
- gmime-rfc2047.c \
- gmime-utils.c \
- gstring-util.c \
- hash-table-utils.c \
- md5-utils.c \
- string-utils.c \
- url-util.c \
- $(pthread_SRC)
-
-libcamelinclude_HEADERS = \
- camel.h \
- camel-log.h \
- camel-data-wrapper.h \
- camel-exception.h \
- camel-simple-data-wrapper.h \
- camel-simple-data-wrapper-stream.h \
- camel-stream-data-wrapper.h \
- camel-folder.h \
- camel-folder-summary.h \
- camel-folder-utils.h \
- camel-mime-body-part.h \
- camel-marshal-utils.h \
- camel-medium.h \
- camel-mime-message.h \
- camel-mime-part.h \
- camel-mime-part-utils.h \
- camel-multipart.h \
- camel-op-queue.h \
- camel-provider.h \
- camel-recipient.h \
- camel-service.h \
- camel-session.h \
- camel-store.h \
- camel-stream.h \
- camel-stream-buffered-fs.h \
- camel-stream-fs.h \
- camel-stream-mem.h \
- data-wrapper-repository.h \
- gmime-base64.h \
- gmime-content-field.h \
- gmime-utils.h \
- gstring-util.h \
- hash-table-utils.h \
- md5-utils.h \
- string-utils.h \
- url-util.h \
- camel-exception-list.def \
- $(pthread_HDR)
-
-libcamel_extra_sources = \
- camel-arg-collector.c
-
-libcamel_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-EXTRA_DIST = \
- $(libcamel_extra_sources) \
- README
diff --git a/camel/README b/camel/README
deleted file mode 100644
index 44f93fa6d8..0000000000
--- a/camel/README
+++ /dev/null
@@ -1,57 +0,0 @@
-
- CAMEL
-
-
- A generic Messaging Library
-
-
- ----
-
-
-Introduction:
--------------
-
-Camel will be a generic messaging library. It will evntually support
-the standard messaging system for receiving and sending messages.
-It aims at being the backend for the future gnome-mailer system.
-
-The name "camel" stands for ... nothing. Open area of developpement there.
-You know, that "bazaar" thing. Maybe could we organize a big contest on
-gnome-list to find the best signification :)
-
-Camel draws heacily from JavaMail and the IMAP4rev1 RFC.
-people wanting to hack on a provider are recommended to read the JavaMail
-API specification but CMC and MAPI are of interest too.
-
-Please, before starting anything, wait for me to finish the abstract classes.
-Some parts are not definitive yet.
-
-
-Organization:
--------------
-
-The library is roughly a set of abstract classes, some kind of generic
-"interfaces" (idl interfaces, not java interfaces ).
-
-Particular implementations are called providers.
-
-Here are the basic objects:
-
-* CamelService : an abstract class representing an access to a server.
-Handles the connection and authentication to any server.
-
-* CamelStore (CamelService): A hierarchy of folders on a server.
-
-* CamelFolder : An object containing messages. A folder is always associated
-to a store.
-
-* CamelMessage : An object contained in folders. Is defined by a set of
-attribute and a content. (Attributes are generally: The date it was received,
-the sender address, .....)
-
-* CamelTransport (CamelService): A way to send messages.
-
-....
-...
-
-
diff --git a/camel/README.COPYRIGHT b/camel/README.COPYRIGHT
deleted file mode 100644
index 307013bedc..0000000000
--- a/camel/README.COPYRIGHT
+++ /dev/null
@@ -1,47 +0,0 @@
-Important note for Camel hackers:
----------------------------------
-
-Camel has been a lot of work, and has been conceived to be general
-enough to be used outside the gnome-mailer. It is possible in the
-future that it is used in softwares with licenses incompatible with the
-LGPL. For this reason, the copyright has to be owned by a unique
-person. Be sure, however, that Camel will always be available under
-the LGPL. Significant authors will always be consulted before any
-special use of Camel. Moreover, in special situations, they may be
-given the authorization to use Camel with a license different than the
-LGPL.
-
-Thus, when adding code in Camel, always add the following lines at the
-begining of the file:
-
-/*
- *
- * Copyright 199x, 200x HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-You may also want to add your name to the author name list after this
-header.
-
-Please contact me (Bertrand.Guiheneuf@aful.org) if you want to discuss
-this copyright issue.
-
-Happy hacking,
-
-Bertrand.
-
-
diff --git a/camel/README.HACKING b/camel/README.HACKING
deleted file mode 100644
index a4742ee7b8..0000000000
--- a/camel/README.HACKING
+++ /dev/null
@@ -1,14 +0,0 @@
-You want to hack on Camel ?
-
-Thanks. Camel aims at being the best messaging
-library for Linux and your help is welcome.
-Please be sure to read the following files before
-commiting any change or sending any patch:
-
-CODING.STYLE
-README.COPYRIGHT
-
-
-Thanks.
-
- Bertrand <Bertrand.Guiheneuf@aful.org> \ No newline at end of file
diff --git a/camel/camel-arg-collector.c b/camel/camel-arg-collector.c
deleted file mode 100644
index 44b9e2d99b..0000000000
--- a/camel/camel-arg-collector.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-/*
- * included in camel because it is not exported
- * by gtk
- *
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- */
-
-/* collect a single argument value from a va_list.
- * this is implemented as a huge macro <shrug>, because we can't
- * pass va_list variables by reference on some systems.
- * the corresponding prototype would be:
- * static inline gchar*
- * gtk_arg_collect_value (GtkArg *arg,
- * va_list var_args);
- */
-#define CAMEL_ARG_COLLECT_VALUE(arg, var_args, _error) \
-G_STMT_START { \
- gchar *error_msg; \
- GtkType fundamental_type; \
- \
- fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type); \
- if (fundamental_type > GTK_TYPE_FUNDAMENTAL_LAST) \
- { \
- fundamental_type = gtk_type_get_varargs_type (fundamental_type); \
- if (!fundamental_type) \
- fundamental_type = GTK_FUNDAMENTAL_TYPE (arg->type); \
- } \
- \
- error_msg = NULL; \
- switch (fundamental_type) \
- { \
- case GTK_TYPE_INVALID: \
- error_msg = g_strdup ("invalid untyped argument"); \
- break; \
- \
- case GTK_TYPE_NONE: \
- /* we just ignore this type, since it arithmetically just requires \
- * us to not move the var_args pointer any further. callers need to \
- * check for the validity of GTK_TYPE_NONE themselves. \
- * \
- * error_msg = g_strdup ("invalid argument type `void'"); \
- */ \
- break; \
- \
- /* everything smaller than an int is guarranteed to be \
- * passed as an int \
- */ \
- case GTK_TYPE_CHAR: \
- GTK_VALUE_CHAR (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_UCHAR: \
- GTK_VALUE_UCHAR (*arg) = va_arg (var_args, guint); \
- break; \
- case GTK_TYPE_BOOL: \
- GTK_VALUE_BOOL (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_INT: \
- GTK_VALUE_INT (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_UINT: \
- GTK_VALUE_UINT (*arg) = va_arg (var_args, guint); \
- break; \
- case GTK_TYPE_ENUM: \
- GTK_VALUE_ENUM (*arg) = va_arg (var_args, gint); \
- break; \
- case GTK_TYPE_FLAGS: \
- GTK_VALUE_FLAGS (*arg) = va_arg (var_args, guint); \
- break; \
- \
- /* we collect longs as glongs since they differ in size with \
- * integers on some platforms \
- */ \
- case GTK_TYPE_LONG: \
- GTK_VALUE_LONG (*arg) = va_arg (var_args, glong); \
- break; \
- case GTK_TYPE_ULONG: \
- GTK_VALUE_ULONG (*arg) = va_arg (var_args, gulong); \
- break; \
- \
- /* floats are always passed as doubles \
- */ \
- case GTK_TYPE_FLOAT: \
- /* GTK_VALUE_FLOAT (*arg) = va_arg (var_args, gfloat); */ \
- GTK_VALUE_FLOAT (*arg) = va_arg (var_args, gdouble); \
- break; \
- case GTK_TYPE_DOUBLE: \
- GTK_VALUE_DOUBLE (*arg) = va_arg (var_args, gdouble); \
- break; \
- \
- /* collect pointer values \
- */ \
- case GTK_TYPE_STRING: \
- GTK_VALUE_STRING (*arg) = va_arg (var_args, gchar*); \
- break; \
- case GTK_TYPE_POINTER: \
- GTK_VALUE_POINTER (*arg) = va_arg (var_args, gpointer); \
- break; \
- case GTK_TYPE_BOXED: \
- GTK_VALUE_BOXED (*arg) = va_arg (var_args, gpointer); \
- break; \
- \
- /* structured types \
- */ \
- case GTK_TYPE_SIGNAL: \
- GTK_VALUE_SIGNAL (*arg).f = va_arg (var_args, GtkSignalFunc); \
- GTK_VALUE_SIGNAL (*arg).d = va_arg (var_args, gpointer); \
- break; \
- case GTK_TYPE_ARGS: \
- GTK_VALUE_ARGS (*arg).n_args = va_arg (var_args, gint); \
- GTK_VALUE_ARGS (*arg).args = va_arg (var_args, GtkArg*); \
- break; \
- case GTK_TYPE_FOREIGN: \
- GTK_VALUE_FOREIGN (*arg).data = va_arg (var_args, gpointer); \
- GTK_VALUE_FOREIGN (*arg).notify = va_arg (var_args, GtkDestroyNotify); \
- break; \
- case GTK_TYPE_CALLBACK: \
- GTK_VALUE_CALLBACK (*arg).marshal = va_arg (var_args, GtkCallbackMarshal); \
- GTK_VALUE_CALLBACK (*arg).data = va_arg (var_args, gpointer); \
- GTK_VALUE_CALLBACK (*arg).notify = va_arg (var_args, GtkDestroyNotify); \
- break; \
- case GTK_TYPE_C_CALLBACK: \
- GTK_VALUE_C_CALLBACK (*arg).func = va_arg (var_args, GtkFunction); \
- GTK_VALUE_C_CALLBACK (*arg).func_data = va_arg (var_args, gpointer); \
- break; \
- \
- /* we do some extra sanity checking when collecting objects, \
- * i.e. if the object pointer is not NULL, we check whether we \
- * actually got an object pointer within the desired class branch. \
- */ \
- case GTK_TYPE_OBJECT: \
- GTK_VALUE_OBJECT (*arg) = va_arg (var_args, GtkObject*); \
- if (GTK_VALUE_OBJECT (*arg) != NULL) \
- { \
- register GtkObject *object = GTK_VALUE_OBJECT (*arg); \
- \
- if (object->klass == NULL) \
- error_msg = g_strconcat ("invalid unclassed object pointer for argument type `", \
- gtk_type_name (arg->type), \
- "'", \
- NULL); \
- else if (!gtk_type_is_a (GTK_OBJECT_TYPE (object), arg->type)) \
- error_msg = g_strconcat ("invalid object `", \
- gtk_type_name (GTK_OBJECT_TYPE (object)), \
- "' for argument type `", \
- gtk_type_name (arg->type), \
- "'", \
- NULL); \
- } \
- break; \
- \
- default: \
- error_msg = g_strconcat ("unsupported argument type `", \
- gtk_type_name (arg->type), \
- "'", \
- NULL); \
- break; \
- } \
- \
- _error = error_msg; /* return error_msg; */ \
-} G_STMT_END
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
deleted file mode 100644
index 061225b03a..0000000000
--- a/camel/camel-data-wrapper.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelDataWrapper.c : Abstract class for a data_wrapper */
-
-/** THIS IS MOSTLY AN ABSTRACT CLASS THAT SHOULD HAVE BEEN AN
- INTERFACE. **/
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-data-wrapper.h"
-#include "camel-log.h"
-
-static GtkObjectClass *parent_class=NULL;
-
-/* Returns the class for a CamelDataWrapper */
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
-
-static void _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void _set_mime_type (CamelDataWrapper *data_wrapper, gchar *mime_type);
-static gchar *_get_mime_type (CamelDataWrapper *data_wrapper);
-static GMimeContentField *_get_mime_type_field (CamelDataWrapper *data_wrapper);
-static void _set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type);
-static CamelStream *_get_stream (CamelDataWrapper *data_wrapper);
-static void _finalize (GtkObject *object);
-
-static void
-camel_data_wrapper_class_init (CamelDataWrapperClass *camel_data_wrapper_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_data_wrapper_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- camel_data_wrapper_class->write_to_stream = _write_to_stream;
- camel_data_wrapper_class->construct_from_stream = _construct_from_stream;
- camel_data_wrapper_class->set_mime_type = _set_mime_type;
- camel_data_wrapper_class->get_mime_type = _get_mime_type;
- camel_data_wrapper_class->get_mime_type_field = _get_mime_type_field;
- camel_data_wrapper_class->set_mime_type_field = _set_mime_type_field;
- camel_data_wrapper_class->get_stream = _get_stream;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-
-static void
-camel_data_wrapper_init (gpointer object, gpointer klass)
-{
- CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
-
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_init:: Entering\n");
- camel_data_wrapper->mime_type = gmime_content_field_new (NULL, NULL);
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_init:: Leaving\n");
-}
-
-
-
-GtkType
-camel_data_wrapper_get_type (void)
-{
- static GtkType camel_data_wrapper_type = 0;
-
- if (!camel_data_wrapper_type) {
- GtkTypeInfo camel_data_wrapper_info =
- {
- "CamelDataWrapper",
- sizeof (CamelDataWrapper),
- sizeof (CamelDataWrapperClass),
- (GtkClassInitFunc) camel_data_wrapper_class_init,
- (GtkObjectInitFunc) camel_data_wrapper_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_data_wrapper_type = gtk_type_unique (gtk_object_get_type (), &camel_data_wrapper_info);
- }
-
- return camel_data_wrapper_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelDataWrapper *camel_data_wrapper = CAMEL_DATA_WRAPPER (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelDataWrapper::finalize\n");
- CAMEL_LOG_FULL_DEBUG ("CamelDataWrapper::finalize, finalizing object %p\n", object);
- if (camel_data_wrapper->mime_type)
- gmime_content_field_unref (camel_data_wrapper->mime_type);
-
- parent_class->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelDataWrapper::finalize\n");
-}
-
-
-/**
- * _write_to_stream: write data content in a byte stream
- * @data_wrapper: the data wrapper object
- * @stream byte stream where data will be written
- *
- * This method must be overriden by subclasses
- * Data must be written in the bytes stream
- * in a architecture independant fashion.
- * If data is a standard data (for example an jpg image)
- * it must be serialized in the strea exactly as it
- * would be saved on disk. A simple dump of the stream in
- * a file should be sufficient for the data to be
- * re-read by a foreign application.
- *
- **/
-static void
-_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- /* nothing */
-}
-
-
-/**
- * camel_data_wrapper_write_to_stream: write data in a stream
- * @data_wrapper: the data wrapper object
- * @stream: byte stream where data will be written
- *
- * Write data content in a stream. Data is stored in a machine
- * independant format.
- *
- **/
-void
-camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_write_to_stream:: Entering\n");
- CDW_CLASS(data_wrapper)->write_to_stream (data_wrapper, stream);
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_write_to_stream:: Leaving\n");
-}
-
-
-
-
-
-
-static void
-_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- /* nothing */
-}
-
-void
-camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_construct_from_stream:: Entering\n");
- CDW_CLASS(data_wrapper)->construct_from_stream (data_wrapper, stream);
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_construct_from_stream:: Leaving\n");
-}
-
-
-
-static void
-_set_mime_type (CamelDataWrapper *data_wrapper, gchar *mime_type)
-{
- CAMEL_LOG_FULL_DEBUG ( "CamelDataWrapper::set_mime_type Entering\n");
- g_assert (mime_type);
- gmime_content_field_construct_from_string (data_wrapper->mime_type, mime_type);
- CAMEL_LOG_FULL_DEBUG ( "CamelDataWrapper::set_mime_type Leaving\n");
-}
-
-void
-camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper, gchar *mime_type)
-{
- CDW_CLASS(data_wrapper)->set_mime_type (data_wrapper, mime_type);
-}
-
-static gchar *
-_get_mime_type (CamelDataWrapper *data_wrapper)
-{
- gchar *mime_type;
-
- mime_type = gmime_content_field_get_mime_type (data_wrapper->mime_type);
- return mime_type;
-}
-
-gchar *
-camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper)
-{
- CAMEL_LOG_FULL_DEBUG ( "camel_data_wrapper_get_mime_type:: Entering before returning\n");
- return CDW_CLASS(data_wrapper)->get_mime_type (data_wrapper);
-}
-
-
-static GMimeContentField *
-_get_mime_type_field (CamelDataWrapper *data_wrapper)
-{
- return data_wrapper->mime_type;
-}
-
-GMimeContentField *
-camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper)
-{
- return CDW_CLASS(data_wrapper)->get_mime_type_field (data_wrapper);
-}
-
-
-static void
-_set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type)
-{
- if (data_wrapper->mime_type) gmime_content_field_free (data_wrapper->mime_type);
- data_wrapper->mime_type = mime_type;
-}
-
-void
-camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type)
-{
- CDW_CLASS(data_wrapper)->set_mime_type_field (data_wrapper, mime_type);
-}
-
-static CamelStream *
-_get_stream (CamelDataWrapper *data_wrapper)
-{
- /* This needs to be implemented in subclasses. */
- return NULL;
-}
-
-CamelStream *
-camel_data_wrapper_get_stream (CamelDataWrapper *data_wrapper)
-{
- CDW_CLASS(data_wrapper)->get_stream (data_wrapper);
-}
diff --git a/camel/camel-data-wrapper.h b/camel/camel-data-wrapper.h
deleted file mode 100644
index 90d0cb4ad4..0000000000
--- a/camel/camel-data-wrapper.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelDataWrapper.h : Abstract class for a data wrapper */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_DATA_WRAPPER_H
-#define CAMEL_DATA_WRAPPER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include "gmime-content-field.h"
-#include "camel-stream.h"
-
-
-
-#define CAMEL_DATA_WRAPPER_TYPE (camel_data_wrapper_get_type ())
-#define CAMEL_DATA_WRAPPER(obj) (GTK_CHECK_CAST((obj), CAMEL_DATA_WRAPPER_TYPE, CamelDataWrapper))
-#define CAMEL_DATA_WRAPPER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_DATA_WRAPPER_TYPE, CamelDataWrapperClass))
-#define CAMEL_IS_DATA_WRAPPER(o) (GTK_CHECK_TYPE((o), CAMEL_DATA_WRAPPER_TYPE))
-
-
-typedef struct
-{
- GtkObject parent_object;
-
- GMimeContentField *mime_type;
-} CamelDataWrapper;
-
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /* Virtual methods */
- void (*write_to_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream);
- void (*construct_from_stream) (CamelDataWrapper *data_wrapper, CamelStream *stream);
- void (*set_mime_type) (CamelDataWrapper *data_wrapper, gchar * mime_type);
- gchar * (*get_mime_type) (CamelDataWrapper *data_wrapper);
- GMimeContentField * (*get_mime_type_field) (CamelDataWrapper *data_wrapper);
- void (*set_mime_type_field) (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type_field);
- CamelStream * (*get_stream) (CamelDataWrapper *data_wrapper);
-} CamelDataWrapperClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_data_wrapper_get_type (void);
-
-
-/* public methods */
-
-void camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-void camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-void camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper, gchar *mime_type);
-gchar *camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper);
-GMimeContentField *camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper);
-void camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type);
-CamelStream *camel_data_wrapper_get_stream (CamelDataWrapper *data_wrapper);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_DATA_WRAPPER_H */
diff --git a/camel/camel-exception-list.def b/camel/camel-exception-list.def
deleted file mode 100644
index b13655e35a..0000000000
--- a/camel/camel-exception-list.def
+++ /dev/null
@@ -1,16 +0,0 @@
-CAMEL_EXCEPTION_NONE = 0,
-
-/* Generic exceptions */
-CAMEL_EXCEPTION_INVALID_PARAM,
-CAMEL_EXCEPTION_SYSTEM,
-
-/* CamelFolderException */
-CAMEL_EXCEPTION_FOLDER_NULL,
-CAMEL_EXCEPTION_FOLDER_INVALID,
-CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
-CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
-CAMEL_EXCEPTION_FOLDER_NON_UID,
-CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
-CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
-
-
diff --git a/camel/camel-exception.c b/camel/camel-exception.c
deleted file mode 100644
index 0a4b92b8ef..0000000000
--- a/camel/camel-exception.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-execpetion.c : exception utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-exception.h"
-
-
-
-/**
- * camel_exception_new: allocate a new exception object.
- *
- * Create and returns a new exception object.
- *
- *
- * Return value: The newly allocated exception object.
- **/
-CamelException *
-camel_exception_new ()
-{
- CamelException *ex;
-
- ex = g_new (CamelException, 1);
- return ex;
-}
-
-
-/**
- * camel_exception_clear: Clear an exception
- * @exception: the exception object
- *
- * Clear an exception, that is, set the
- * exception ID to CAMEL_EXCEPTION_NONE and
- * free the description text.
- * If the exception is NULL, this funtion just
- * returns.
- **/
-void
-camel_exception_clear (CamelException *exception)
-{
- if (!exception) return;
-
- /* free the description text */
- if (exception->desc)
- g_free (exception->desc);
- exception->desc = NULL;
-
- /* set the Exception Id to NULL */
- exception->id = CAMEL_EXCEPTION_NONE;
-}
-
-
-
-
-/**
- * camel_exception_free: Free an exception
- * @exception: The exception object to free
- *
- * Free an exception object. If the exception
- * is NULL, nothing is done, the routine simply
- * returns.
- **/
-void
-camel_exception_free (CamelException *exception)
-{
- if (!exception) return;
-
- /* free the description text */
- if (exception->desc)
- g_free (exception->desc);
- /* free the exeption itself */
- g_free (exception);
-}
-
-/**
- * camel_exception_set: set an exception
- * @ex: exception object
- * @id: exception id
- * @desc: textual description of the exception
- *
- * Set the value of an exception. The exception id is
- * a unique number representing the exception. The
- * textual description is a small text explaining
- * what happened and provoked the exception.
- *
- * When @ex is NULL, nothing is done, this routine
- * simply returns.
- *
- **/
-void
-camel_exception_set (CamelException *ex,
- ExceptionId id,
- const char *desc)
-{
- /* if no exception is given, do nothing */
- if (!ex) return;
-
- ex->id = id;
-
- /* remove the previous exception description */
- if (ex->desc)
- g_free (ex->desc);
- ex->desc = g_strdup (desc);
-}
-
-
-/**
- * camel_exception_setv: set an exception
- * @ex: exception object
- * @id: exception id
- * @format: format of the description string. The format string is used as in printf().
- *
- * Set the value of an exception. The exception id is
- * a unique number representing the exception. The
- * textual description is a small text explaining
- * what happened and provoked the exception.
- * In this version, the string is created from the format
- * string and the variable argument list.
- *
- * When @ex is NULL, nothing is done, this routine
- * simply returns.
- *
- **/
-void
-camel_exception_setv (CamelException *ex,
- ExceptionId id,
- const char *format,
- ...)
-{
- va_list args;
- gchar *tmp_desc_string;
-
-
- /* if no exception is given, do nothing */
- if (!ex) return;
-
-
- /* create the temporary exception string */
- va_start(args, format);
- tmp_desc_string = g_strdup_vprintf (format, args);
- va_end (args);
-
-
- /* now set the exception. We don't call
- camel_exception_set because we want to
- avoid a useless strdup () */
- ex->id = id;
-
- /* remove the previous exception description */
- if (ex->desc)
- g_free (ex->desc);
- ex->desc = g_strdup (tmp_desc_string);
-
-}
-
-
-
-
-
-
-
-/**
- * camel_exception_xfer: transfer an exception
- * @ex_dst: Destination exception object
- * @ex_src: Source exception object
- *
- * Transfer the content of an exception from
- * an exception object to another.
- * The destination exception receives the id and
- * the description text of the source exception.
- **/
-void
-camel_exception_xfer (CamelException *ex_dst,
- CamelException *ex_src)
-{
- if (ex_dst->desc)
- g_free (ex_dst->desc);
-
- ex_dst->id = ex_src->id;
- ex_dst->desc = ex_src->desc;
-
- ex_src->desc = NULL;
- ex_src->id = CAMEL_EXCEPTION_NONE;
-}
-
-
-
-
-
-
-
-/**
- * camel_exception_get_id: get the exception id
- * @ex: The exception object
- *
- * Return the id of an exception.
- * If @ex is NULL, return CAMEL_EXCEPTION_NONE;
- *
- * Return value: Exception ID.
- **/
-ExceptionId
-camel_exception_get_id (CamelException *ex)
-{
- if (ex)
- return ex->id;
- else
- return CAMEL_EXCEPTION_NONE;
-}
-
-
-
-
-/**
- * camel_exception_get_description: get the description of an exception.
- * @ex: The exception object
- *
- * Return the exception description text.
- * If @ex is NULL, return NULL;
- *
- *
- * Return value: Exception description text.
- **/
-const gchar *
-camel_exception_get_description (CamelException *ex)
-{
- if (ex)
- return ex->desc;
- else
- return NULL;
-}
diff --git a/camel/camel-exception.h b/camel/camel-exception.h
deleted file mode 100644
index 1284608e91..0000000000
--- a/camel/camel-exception.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-execpetion.h : exception utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#ifndef CAMEL_EXCEPTION_H
-#define CAMEL_EXCEPTION_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-
-
-typedef enum {
-#include "camel-exception-list.def"
-
-} ExceptionId;
-
-
-typedef struct {
- /* do not access the fields directly */
- ExceptionId id;
- char *desc;
-
-} CamelException;
-
-
-
-/* creation and destruction functions */
-CamelException *camel_exception_new ();
-void camel_exception_free (CamelException *exception);
-
-
-/* exception content manipulation */
-void camel_exception_clear (CamelException *exception);
-void camel_exception_set (CamelException *ex,
- ExceptionId id,
- const char *desc);
-void camel_exception_setv (CamelException *ex,
- ExceptionId id,
- const char *format,
- ...);
-
-
-/* exception content transfer */
-void camel_exception_xfer (CamelException *ex_dst,
- CamelException *ex_src);
-
-
-/* exception content retrieval */
-ExceptionId camel_exception_get_id (CamelException *ex);
-const gchar *camel_exception_get_description (CamelException *ex);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_EXCEPTION_H */
-
diff --git a/camel/camel-folder-pt-proxy.c b/camel/camel-folder-pt-proxy.c
deleted file mode 100644
index e21c2bcd9a..0000000000
--- a/camel/camel-folder-pt-proxy.c
+++ /dev/null
@@ -1,821 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.c : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#include <config.h>
-#include "camel-folder-pt-proxy.h"
-#include "camel-log.h"
-#include "camel-marshal-utils.h"
-#include "camel-exception.h"
-#include <pthread.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for CamelFolderPtProxy and CamelFolder objects */
-#define CFPP_CLASS(so) CAMEL_FOLDER_PT_PROXY_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-
-enum CamelFolderFunc {
- CAMEL_FOLDER_OPEN,
- CAMEL_FOLDER_CLOSE,
- CAMEL_FOLDER__LAST_FUNC
-};
-
-static CamelFuncDef _camel_func_def [CAMEL_FOLDER__LAST_FUNC];
-
-
-static void _init_with_store (CamelFolder *folder,
- CamelStore *parent_store,
- CamelException *ex);
-static void _open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-static void _close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-static void _open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex);
-static void _close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex);
-static void _set_name (CamelFolder *folder,
- const gchar *name,
- CamelException *ex);
-
-static const gchar *_get_name (CamelFolder *folder, CamelException *ex);
-static const gchar *_get_full_name (CamelFolder *folder, CamelException *ex);
-static gboolean _can_hold_folders (CamelFolder *folder, CamelException *ex);
-static gboolean _can_hold_messages(CamelFolder *folder, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _is_open (CamelFolder *folder, CamelException *ex);
-static CamelFolder *_get_subfolder (CamelFolder *folder, const gchar *folder_name, CamelException *ex);
-static gboolean _create (CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static CamelFolder *_get_parent_folder (CamelFolder *folder, CamelException *ex);
-static CamelStore *_get_parent_store (CamelFolder *folder, CamelException *ex);
-static CamelFolderOpenMode _get_mode (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-static GList *_expunge (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex);
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static void _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static const GList *_list_permanent_flags (CamelFolder *folder, CamelException *ex);
-static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex);
-
-static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-static GList *_get_uid_list (CamelFolder *folder, CamelException *ex);
-
-static void _finalize (GtkObject *object);
-
-
-static void
-camel_folder_pt_proxy_class_init (CamelFolderPtProxyClass *camel_folder_pt_proxy_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_pt_proxy_class);
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_folder_pt_proxy_class);
- CamelFolderPtProxyClass *proxy_class = camel_folder_pt_proxy_class;
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->open = _open;
- camel_folder_class->close = _close;
- camel_folder_class->open_async = _open_async;
- camel_folder_class->close_async = _close_async;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->get_name = _get_name;
- camel_folder_class->can_hold_folders = _can_hold_folders;
- camel_folder_class->can_hold_messages = _can_hold_messages;
- camel_folder_class->exists = _exists;
- camel_folder_class->is_open = _is_open;
- camel_folder_class->get_subfolder = _get_subfolder;
- camel_folder_class->create = _create;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->get_parent_folder = _get_parent_folder;
- camel_folder_class->get_parent_store = _get_parent_store;
- camel_folder_class->get_mode = _get_mode;
- camel_folder_class->list_subfolders = _list_subfolders;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->get_message_by_number = _get_message_by_number;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->append_message = _append_message;
- camel_folder_class->list_permanent_flags = _list_permanent_flags;
- camel_folder_class->copy_message_to;
- camel_folder_class->get_message_uid = _get_message_uid;
- camel_folder_class->get_message_by_uid = _get_message_by_uid;
- camel_folder_class->get_uid_list = _get_uid_list;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-
- /* function definition for proxying */
- proxy_class->open_func_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_INT_POINTER_POINTER,
- 4,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
- proxy_class->open_cb_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER,
- 3,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
-
- proxy_class->close_func_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER,
- 4,
- GTK_TYPE_POINTER,
- GTK_TYPE_BOOL,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
- proxy_class->close_cb_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER,
- 3,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
-
- proxy_class->set_name_func_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER,
- 4,
- GTK_TYPE_POINTER,
- GTK_TYPE_BOOL,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
- proxy_class->set_name_cb_def =
- camel_func_def_new (camel_marshal_NONE__POINTER_POINTER_POINTER,
- 3,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
-
-}
-
-
-
-
-static void
-camel_folder_pt_proxy_init (CamelFolderPtProxy *folder_pt_proxy)
-{
- folder_pt_proxy->thread_ex = camel_exception_new ();
- folder_pt_proxy->pud = g_new (_ProxyCbUserData, 1);
-}
-
-
-
-
-GtkType
-camel_folder_pt_proxy_get_type (void)
-{
- static GtkType camel_folder_pt_proxy_type = 0;
-
- if (!camel_folder_pt_proxy_type) {
- GtkTypeInfo camel_folder_pt_proxy_info =
- {
- "CamelFolderPtProxy",
- sizeof (CamelFolderPtProxy),
- sizeof (CamelFolderPtProxyClass),
- (GtkClassInitFunc) camel_folder_pt_proxy_class_init,
- (GtkObjectInitFunc) camel_folder_pt_proxy_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_folder_pt_proxy_type = gtk_type_unique (gtk_object_get_type (), &camel_folder_pt_proxy_info);
- }
-
- return camel_folder_pt_proxy_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelFolder *camel_folder = CAMEL_FOLDER (object);
- CamelFolderPtProxy *camel_folder_pt_proxy = CAMEL_FOLDER_PT_PROXY (camel_folder);
- GList *message_node;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelFolderPtProxy::finalize\n");
-
- camel_exception_free (camel_folder_pt_proxy->thread_ex);
- g_free (camel_folder_pt_proxy->pud);
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolderPtProxy::finalize\n");
-}
-
-
-
-
-
-
-/*********/
-
-/**** Operations implementation ****/
-
-
-
-static gpointer
-_proxy_cb_user_data (_ProxyCbUserData *pud,
- CamelFolderAsyncCallback real_callback,
- CamelFolderPtProxy *proxy_folder,
- CamelException *ex,
- gpointer real_user_data)
-{
- pud->real_callback = real_callback;
- pud->proxy_folder = proxy_folder;
- pud->ex = ex;
- pud->real_user_data = real_user_data;
- return (gpointer)pud;
-}
-
-
-/* ******** */
-
-/* thread->init_with_store implementation */
-static void
-_init_with_store (CamelFolder *folder,
- CamelStore *parent_store,
- CamelException *ex)
-{
-
- parent_class->init_with_store (folder, parent_store, ex);
- if (ex->id != CAMEL_EXCEPTION_NONE)
- return;
-#warning use proxy store here
- CF_CLASS (folder)->init_with_store (CAMEL_FOLDER_PT_PROXY (folder)->real_folder,
- parent_store,
- ex);
-}
-
-
-
-/* a little bit of explanation for the folder_class->open
- * method implementation :
- *
- * the proxy object "open" method is called by the client
- * program in the main thread. This method creates a
- * CamelOp object containing all the necessary informations
- * to call the corresponding "open" method on the real
- * folder object in the child thread. This CamelOp object
- * is thus pushed in a queue in the main thread (see the
- * CamelThreadProxy structure for more details).
- * The operations in this queue are executed one by one
- * in a child thread.
- * Once the "open" method of the real object is finished,
- * it calls a callback. This callback is not the one supplied
- * by the client object. Instead, the _folder_open_cb()
- * function is called (in the child thread) which pushes
- * the real callback function in another operation queue.
- * The real callback is then called in the main thread.
- */
-
-/* folder->open implementation */
-
-/*
- * proxy callback. Called in the child thread by the
- * real folder "open" method when it is completed
- */
-static void
-_folder_open_cb (CamelFolder *folder,
- gpointer user_data,
- CamelException *ex)
-{
- CamelOp *cb;
- _ProxyCbUserData *pud;
- CamelFuncDef *cb_def;
-
- /* transfer the exception information from "ex" to the
- * client supplied exception (kept in pud->ex) */
- camel_exception_xfer (pud->ex, ex);
-
- /* create an operation which will call the real client
- * supplied callback in the main thread */
- cb_def = CAMEL_FOLDER_PT_PROXY_CLASS(pud->proxy_folder)->open_cb_def;
- cb = camel_marshal_create_op (cb_def,
- pud->real_callback,
- pud->proxy_folder,
- pud->real_user_data,
- pud->ex);
- camel_thread_proxy_push_cb (pud->proxy_folder->proxy_object, cb);
-
-}
-
-static void
-_open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
- CamelOp *op;
- CamelFuncDef *func_def;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
-
- /* create an operation corresponding to the "open"
- * method of the real object. The operation definition
- * is common to all instances of the CamelFolderPtProxy
- * class so it is contained in the CamelFolderPtProxyClass
- * structure. */
- func_def = CAMEL_FOLDER_PT_PROXY_CLASS(proxy_folder)->open_func_def;
- if (callback)
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->open_async,
- proxy_folder->real_folder,
- mode,
- _folder_open_cb,
- _proxy_cb_user_data (proxy_folder->pud, callback, proxy_folder, ex, user_data),
- proxy_folder->thread_ex);
- else
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->open_async,
- proxy_folder->real_folder,
- mode,
- NULL,
- NULL,
- NULL);
- /* push the operation in the operation queue. This operation
- * will be executed in a child thread but only one operation
- * will be executed at a time, so that folder implementations
- * don't have to be MultiThread safe. */
- camel_thread_proxy_push_op (proxy_folder->proxy_object, op);
-}
-
-
-
-static void _open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- open (proxy_folder->real_folder, mode, ex);
-}
-
-
-
-/* folder->close implementation */
-
-static void
-_folder_close_cb (CamelFolder *folder,
- gpointer user_data,
- CamelException *ex)
-{
- CamelOp *cb;
- _ProxyCbUserData *pud;
- CamelFuncDef *cb_def;
-
- camel_exception_xfer (pud->ex, ex);
- cb_def = CAMEL_FOLDER_PT_PROXY_CLASS(pud->proxy_folder)->close_cb_def;
- cb = camel_marshal_create_op (cb_def,
- pud->real_callback,
- pud->proxy_folder,
- pud->real_user_data,
- pud->ex);
- camel_thread_proxy_push_cb (pud->proxy_folder->proxy_object, cb);
-
-}
-
-static void
-_close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
- CamelOp *op;
- CamelFuncDef *func_def;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
-
- func_def = CAMEL_FOLDER_PT_PROXY_CLASS(proxy_folder)->close_func_def;
- if (callback)
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->close_async,
- proxy_folder->real_folder,
- expunge,
- _folder_close_cb,
- _proxy_cb_user_data (proxy_folder->pud, callback, proxy_folder, ex, user_data),
- proxy_folder->thread_ex);
- else
- op = camel_marshal_create_op (func_def,
- CAMEL_FOLDER_CLASS (proxy_folder->real_folder)->close_async,
- proxy_folder->real_folder,
- expunge,
- NULL,
- NULL,
- NULL);
- camel_thread_proxy_push_op (proxy_folder->proxy_object, op);
-
-}
-
-
-static void _close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- close (proxy_folder->real_folder, expunge, ex);
-}
-
-
-
-
-
-/* folder->set_name implementation */
-
-static void
-_set_name (CamelFolder *folder,
- const gchar *name,
- CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- set_name (proxy_folder->real_folder, name, ex);
-
-}
-
-
-/* folder->get_name implementation */
-/* this one is not executed in a thread */
-static const gchar *
-_get_name (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_name (proxy_folder->real_folder, ex);
-}
-
-
-
-/* folder->get_full_name implementation */
-/* this one is not executed in a thread */
-
-static const gchar *
-_get_full_name (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_full_name (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static gboolean
-_can_hold_folders (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- can_hold_folders (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static gboolean
-_can_hold_messages (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- can_hold_messages (proxy_folder->real_folder, ex);
-}
-
-
-
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- exists (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static gboolean
-_is_open (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- is_open (proxy_folder->real_folder, ex);
-}
-
-
-
-
-
-static CamelFolder *
-_get_subfolder (CamelFolder *folder, const gchar *folder_name, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_subfolder (proxy_folder->real_folder, folder_name, ex);
-}
-
-
-
-
-
-
-static gboolean
-_create(CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- create (proxy_folder->real_folder, ex);
-}
-
-
-
-
-
-
-
-
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- delete (proxy_folder->real_folder, recurse, ex);
-}
-
-
-
-
-
-
-
-static gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- delete_messages (proxy_folder->real_folder, ex);
-}
-
-
-
-
-
-
-static CamelFolder *
-_get_parent_folder (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-#warning return proxy parent folder if any
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_parent_folder (proxy_folder->real_folder, ex);
-}
-
-
-
-
-
-static CamelStore *
-_get_parent_store (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_parent_store (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static CamelFolderOpenMode
-_get_mode (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_mode (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- list_subfolders (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static GList *
-_expunge (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- expunge (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static CamelMimeMessage *
-_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_by_number (proxy_folder->real_folder, number, ex);
-}
-
-
-
-
-
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_count (proxy_folder->real_folder, ex);
-}
-
-
-
-
-static void
-_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- append_message (proxy_folder->real_folder, message, ex);
-}
-
-
-
-static const GList *
-_list_permanent_flags (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- list_permanent_flags (proxy_folder->real_folder, ex);
-}
-
-
-
-static void
-_copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- CF_CLASS (proxy_folder->real_folder)->
- copy_message_to (proxy_folder->real_folder, message, dest_folder, ex);
-}
-
-
-
-
-
-
-/* UIDs stuff */
-
-
-static const gchar *
-_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_uid (proxy_folder->real_folder, message, ex);
-}
-
-
-/* the next two func are left there temporarily */
-#if 0
-static const gchar *
-_get_message_uid_by_number (CamelFolder *folder, gint message_number, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_uid_by_number (proxy_folder->real_folder, message_number, ex);
-}
-
-#endif
-
-static CamelMimeMessage *
-_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_message_by_uid (proxy_folder->real_folder, uid, ex);
-}
-
-
-static GList *
-_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- CamelFolderPtProxy *proxy_folder;
-
- proxy_folder = CAMEL_FOLDER_PT_PROXY (folder);
- return CF_CLASS (proxy_folder->real_folder)->
- get_uid_list (proxy_folder->real_folder, ex);
-}
-
-
-/* **** */
-
-
-
-
-
diff --git a/camel/camel-folder-pt-proxy.h b/camel/camel-folder-pt-proxy.h
deleted file mode 100644
index 35c0965f45..0000000000
--- a/camel/camel-folder-pt-proxy.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.h : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-
-
-#ifndef CAMEL_FOLDER_PT_PROXY_H
-#define CAMEL_FOLDER_PT_PROXY_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-folder.h"
-#include "camel-op-queue.h"
-#include "camel-thread-proxy.h"
-
-
-#define CAMEL_FOLDER_PT_PROXY_TYPE (camel_folder_pt_proxy_get_type ())
-#define CAMEL_FOLDER_PT_PROXY(obj) (GTK_CHECK_CAST((obj), CAMEL_FOLDER_PT_PROXY_TYPE, CamelFolderPtProxy))
-#define CAMEL_FOLDER_PT_PROXY_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_FOLDER_PT_PROXY_TYPE, CamelFolderPtProxyClass))
-#define CAMEL_IS_FOLDER_PT_PROXY(o) (GTK_CHECK_TYPE((o), CAMEL_FOLDER_PT_PROXY_TYPE))
-
-typedef struct _CamelFolderPtProxy CamelFolderPtProxy;
-
-typedef struct {
- CamelFolderAsyncCallback real_callback;
- CamelFolderPtProxy *proxy_folder;
- CamelException *ex;
- gpointer real_user_data;
-} _ProxyCbUserData;
-
-struct _CamelFolderPtProxy {
- CamelFolder parent;
-
- /* private fields */
- CamelFolder *real_folder;
- CamelThreadProxy *proxy_object;
- CamelException *thread_ex;
- _ProxyCbUserData *pud;
-
-};
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* functions and callbacks definition (for marshalling) */
- CamelFuncDef *open_func_def;
- CamelFuncDef *open_cb_def;
- CamelFuncDef *close_func_def;
- CamelFuncDef *close_cb_def;
- CamelFuncDef *set_name_func_def;
- CamelFuncDef *set_name_cb_def;
-
-} CamelFolderPtProxyClass;
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_FOLDER_PT_PROXY_H */
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
deleted file mode 100644
index 2c6b45b718..0000000000
--- a/camel/camel-folder-summary.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelFolderSummary.c : Abstract class for a folder_summary */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-folder-summary.h"
-#include "camel-log.h"
-
-static GtkObjectClass *parent_class=NULL;
-
-/* Returns the class for a CamelFolderSummary */
-#define CFS_CLASS(so) CAMEL_FOLDER_SUMMARY_CLASS (GTK_OBJECT(so)->klass)
-
-
-static const GList *_get_subfolder_info_list (CamelFolderSummary *summary);
-static const GList *_get_message_info_list (CamelFolderSummary *summary);
-
-static void _finalize (GtkObject *object);
-
-static void
-camel_folder_summary_class_init (CamelFolderSummaryClass *camel_folder_summary_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_summary_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- camel_folder_summary_class->get_subfolder_info_list = _get_subfolder_info_list;
- camel_folder_summary_class->get_message_info_list = _get_message_info_list;
-
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-
-static void
-camel_folder_summary_init (gpointer object, gpointer klass)
-{
- CamelFolderSummary *summary = CAMEL_FOLDER_SUMMARY (object);
-
- CAMEL_LOG_FULL_DEBUG ( "camel_folder_summary_init:: Entering\n");
- summary->subfolder_info_list = NULL;
- summary->message_info_list = NULL;
- CAMEL_LOG_FULL_DEBUG ( "camel_folder_summary_init:: Leaving\n");
-}
-
-
-
-GtkType
-camel_folder_summary_get_type (void)
-{
- static GtkType camel_folder_summary_type = 0;
-
- if (!camel_folder_summary_type) {
- GtkTypeInfo camel_folder_summary_info =
- {
- "CamelFolderSummary",
- sizeof (CamelFolderSummary),
- sizeof (CamelFolderSummaryClass),
- (GtkClassInitFunc) camel_folder_summary_class_init,
- (GtkObjectInitFunc) camel_folder_summary_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_folder_summary_type = gtk_type_unique (gtk_object_get_type (), &camel_folder_summary_info);
- }
-
- return camel_folder_summary_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelFolderSummary *camel_folder_summary = CAMEL_FOLDER_SUMMARY (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelFolderSummary::finalize\n");
- CAMEL_LOG_FULL_DEBUG ("CamelFolderSummary::finalize, finalizing object %p\n", object);
-
- parent_class->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolderSummary::finalize\n");
-}
-
-
-CamelFolderSummary *
-camel_folder_summary_new ()
-{
- return gtk_type_new (CAMEL_FOLDER_SUMMARY_TYPE);
-}
-
-static const GList *
-_get_subfolder_info_list (CamelFolderSummary *summary)
-{
- return summary->subfolder_info_list;
-}
-
-
-const GList *
-camel_folder_summary_get_subfolder_info_list (CamelFolderSummary *summary)
-{
- return CFS_CLASS (summary)->get_subfolder_info_list (summary);
-}
-
-
-
-
-static const GList *
-_get_message_info_list (CamelFolderSummary *summary)
-{
- return summary->message_info_list;
-}
-
-const GList *
-camel_folder_summary_get_message_info_list (CamelFolderSummary *summary)
-{
- return CFS_CLASS (summary)->get_message_info_list (summary);
-}
-
-
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
deleted file mode 100644
index acb3ba5f01..0000000000
--- a/camel/camel-folder-summary.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelFolderSummary.h : Abstract class for a folder summary */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_FOLDER_SUMMARY_H
-#define CAMEL_FOLDER_SUMMARY_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-
-
-#define CAMEL_FOLDER_SUMMARY_TYPE (camel_folder_summary_get_type ())
-#define CAMEL_FOLDER_SUMMARY(obj) (GTK_CHECK_CAST((obj), CAMEL_FOLDER_SUMMARY_TYPE, CamelFolderSummary))
-#define CAMEL_FOLDER_SUMMARY_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_FOLDER_SUMMARY_TYPE, CamelFolderSummaryClass))
-#define CAMEL_IS_FOLDER_SUMMARY(o) (GTK_CHECK_TYPE((o), CAMEL_FOLDER_SUMMARY_TYPE))
-
-typedef struct {
- gchar *name;
- gint nb_message;
- gint nb_unread_message;
- gint nb_deleted_message;
-
- GHashTable *extended_fields;
-} CamelFolderInfo;
-
-typedef struct {
- gchar *subject;
- gchar *uid;
- gchar *date;
- gchar *sender;
-
- GHashTable *extended_fields;
-} CamelMessageInfo;
-
-
-typedef struct
-{
- GtkObject parent_object;
-
- GList *subfolder_info_list; /* informations on subfolders */
- GList *message_info_list; /* informations on messages */
-
-} CamelFolderSummary;
-
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /* Virtual methods */
- const GList * (*get_subfolder_info_list) (CamelFolderSummary *summary);
- const GList * (*get_message_info_list) (CamelFolderSummary *summary);
-
-} CamelFolderSummaryClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_folder_summary_get_type (void);
-
-
-/* public methods */
-CamelFolderSummary *camel_folder_summary_new ();
-const GList *camel_folder_summary_get_subfolder_info_list (CamelFolderSummary *summary);
-const GList *camel_folder_summary_get_message_info_list (CamelFolderSummary *summary);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_FOLDER_SUMMARY_H */
diff --git a/camel/camel-folder-utils.c b/camel/camel-folder-utils.c
deleted file mode 100644
index 601966ab02..0000000000
--- a/camel/camel-folder-utils.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-utils : Utility for camel folders */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-folder-utils.h"
-#include "camel-log.h"
-#include "camel-mime-message.h"
-
-
-
-/* Active Message List utilities */
-
-/* */
-gint
-camel_mime_message_number_cmp (gconstpointer a, gconstpointer b)
-{
- CamelMimeMessage *m_a = CAMEL_MIME_MESSAGE (a);
- CamelMimeMessage *m_b = CAMEL_MIME_MESSAGE (b);
-
- return (m_a->message_number - (m_b->message_number));
-}
-
-
-/**
- * camel_aml_expunge_messages: Expunge the message marked as deleted in an Active Message List
- * @aml: active message list
- * @folder: folder object
- *
- * Expunge the message flagged as "DELETED" in an active message list.
- * The messages are not freed nor really expunged on the disk, they
- * are just removed from the active message list and marked as
- * "EXPUNGED". The list of the message which have been expunged is
- * return in a GList which must be freed by the caller.
- * To be really expunged the providers must provide or call
- * folder specific methods.
- *
- * Return value: the list of expunged messages.
- **/
-GList *
-camel_aml_expunge_messages (GList *aml,
- CamelFolder *folder)
-{
- CamelMimeMessage *message;
- GList *message_node;
- GList *next_message_node;
- guint nb_expunged = 0;
- GList *expunged_messages;
-
-
- message_node = aml;
- /* look in folder message list which messages
- * need to be expunged */
- while ( message_node) {
- message = CAMEL_MIME_MESSAGE (message_node->data);
-
- /* we may free message_node so get the next node now */
- next_message_node = message_node->next;
-
- if (message) {
- if (camel_mime_message_get_flag (message, "DELETED")) {
-
- /* remove the message from active message list */
- g_list_remove_link (aml, message_node);
- g_list_free_1 (message_node);
- camel_mime_message_set_flag (message, "EXPUNGED", TRUE);
- expunged_messages = g_list_prepend (expunged_messages, message);
-
- }
- }
- else {
- CAMEL_LOG_WARNING ("CamelFolder::expunge warning message_node contains no message\n");
- }
- message_node = next_message_node;
- CAMEL_LOG_FULL_DEBUG ("CamelFolder::expunge, examined message node %p\n", message_node);
- }
-
- return expunged_messages;
-}
diff --git a/camel/camel-folder-utils.h b/camel/camel-folder-utils.h
deleted file mode 100644
index 1d6823e771..0000000000
--- a/camel/camel-folder-utils.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-utils : Utility for camel folders */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef CAMEL_MIME_PART_UTILS_H
-#define CAMEL_MIME_PART_UTILS_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-folder.h"
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_PART_UTILS_H */
-
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
deleted file mode 100644
index 4efae9544f..0000000000
--- a/camel/camel-folder.c
+++ /dev/null
@@ -1,1781 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelFolder.c : Abstract class for an email folder */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-folder.h"
-#include "camel-log.h"
-#include "string-utils.h"
-
-static GtkObjectClass *parent_class=NULL;
-
-/* Returns the class for a CamelFolder */
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-
-
-
-static void _init_with_store (CamelFolder *folder,
- CamelStore *parent_store,
- CamelException *ex);
-static void _finalize (GtkObject *object);
-
-
-static void _open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex);
-static void _close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex);
-
-/* Async operations are not used for the moment */
-static void _open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-static void _close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-
-
-static void _set_name (CamelFolder *folder,
- const gchar *name,
- CamelException *ex);
-static const gchar *_get_name (CamelFolder *folder,
- CamelException *ex);
-static const gchar *_get_full_name (CamelFolder *folder, CamelException *ex);
-/* static void _set_full_name (CamelFolder *folder, const gchar *name); */
-
-
-static gboolean _can_hold_folders (CamelFolder *folder, CamelException *ex);
-static gboolean _can_hold_messages (CamelFolder *folder, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _is_open (CamelFolder *folder, CamelException *ex);
-static const GList *_list_permanent_flags (CamelFolder *folder, CamelException *ex);
-static CamelFolderOpenMode _get_mode (CamelFolder *folder, CamelException *ex);
-
-
-static gboolean _create (CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-
-
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-static CamelFolder *_get_subfolder (CamelFolder *folder,
- const gchar *folder_name, CamelException *ex);
-static CamelFolder *_get_parent_folder (CamelFolder *folder, CamelException *ex);
-static CamelStore * _get_parent_store (CamelFolder *folder, CamelException *ex);
-
-
-static gboolean _has_message_number_capability (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message_by_number (CamelFolder *folder,
- gint number,
- CamelException *ex);
-static gint _get_message_count (CamelFolder *folder,
- CamelException *ex);
-
-
-static gboolean _delete_messages (CamelFolder *folder,
- CamelException *ex);
-static GList * _expunge (CamelFolder *folder,
- CamelException *ex);
-static void _append_message (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-static void _copy_message_to (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelFolder *dest_folder,
- CamelException *ex);
-
-
-static GList *_get_uid_list (CamelFolder *folder, CamelException *ex);
-static const gchar *_get_message_uid (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-
-
-
-
-static void
-camel_folder_class_init (CamelFolderClass *camel_folder_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->open = _open;
- camel_folder_class->open_async = _open_async;
- camel_folder_class->close = _close;
- camel_folder_class->close_async = _close_async;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->get_name = _get_name;
- camel_folder_class->get_full_name = _get_full_name;
- camel_folder_class->can_hold_folders = _can_hold_folders;
- camel_folder_class->can_hold_messages = _can_hold_messages;
- camel_folder_class->exists = _exists;
- camel_folder_class->is_open = _is_open;
- camel_folder_class->get_subfolder = _get_subfolder;
- camel_folder_class->create = _create;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->get_parent_folder = _get_parent_folder;
- camel_folder_class->get_parent_store = _get_parent_store;
- camel_folder_class->get_mode = _get_mode;
- camel_folder_class->list_subfolders = _list_subfolders;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->has_message_number_capability = _has_message_number_capability;
- camel_folder_class->get_message_by_number = _get_message_by_number;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->append_message = _append_message;
- camel_folder_class->list_permanent_flags = _list_permanent_flags;
- camel_folder_class->copy_message_to;
- camel_folder_class->get_message_uid = _get_message_uid;
- camel_folder_class->get_message_by_uid = _get_message_by_uid;
- camel_folder_class->get_uid_list = _get_uid_list;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-
-
-
-GtkType
-camel_folder_get_type (void)
-{
- static GtkType camel_folder_type = 0;
-
- if (!camel_folder_type) {
- GtkTypeInfo camel_folder_info =
- {
- "CamelFolder",
- sizeof (CamelFolder),
- sizeof (CamelFolderClass),
- (GtkClassInitFunc) camel_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_folder_type = gtk_type_unique (gtk_object_get_type (), &camel_folder_info);
- }
-
- return camel_folder_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelFolder *camel_folder = CAMEL_FOLDER (object);
- GList *message_node;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelFolder::finalize\n");
-
- g_free (camel_folder->name);
- g_free (camel_folder->full_name);
- g_free (camel_folder->permanent_flags);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::finalize\n");
-}
-
-
-/**
- * _init_with_store: init the folder by setting its parent store.
- * @folder: folder object to initialize
- * @parent_store: parent store object of the folder
- *
- *
- **/
-static void
-_init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex)
-{
-
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- if (!parent_store) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_INVALID_PARAM,
- "parent_store parameter is NULL");
- return;
- }
-
- if (folder->parent_store) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "folder already has a parent store");
- return;
- }
-
- folder->parent_store = parent_store;
- gtk_object_ref (GTK_OBJECT (parent_store));
-
- folder->open_mode = FOLDER_OPEN_UNKNOWN;
- folder->open_state = FOLDER_CLOSE;
- folder->name = NULL;
- folder->full_name = NULL;
-}
-
-
-
-
-
-static void
-_open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- folder->open_state = FOLDER_OPEN;
- folder->open_mode = mode;
-}
-
-
-
-
-/**
- * camel_folder_open: Open a folder
- * @folder: The folder object
- * @mode: open mode (R/W/RW ?)
- * @ex: exception object
- *
- * Open a folder in a given mode.
- *
- **/
-void
-camel_folder_open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- CF_CLASS(folder)->open (folder, mode, ex);
-}
-
-
-
-
-
-
-static void
-_open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- CAMEL_LOG_WARNING ("Calling CamelFolder::open_async directly. "
- "Should be overloaded\n");
-}
-
-
-
-/**
- * camel_folder_open: Open a folder
- * @folder: The folder object
- * @mode: open mode (R/W/RW ?)
- * @callback: function to call when the operation is over
- * @user_data: data to pass to the callback
- * @ex: exception object
- *
- * Open a folder in a given mode. When the operation is over
- * the callback is called and the client program can determine
- * if the operation suceeded by examining the exception.
- *
- **/
-void
-camel_folder_open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- CF_CLASS(folder)->open_async (folder, mode, callback, user_data, ex);
-}
-
-
-
-
-
-
-static void
-_close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- folder->open_state = FOLDER_CLOSE;
-}
-
-/**
- * camel_folder_close: Close a folder.
- * @folder: The folder object
- * @expunge: if TRUE, the flagged message are deleted.
- * @ex: exception object
- *
- * Put a folder in its closed state, and possibly
- * expunge the flagged messages.
- *
- **/
-void
-camel_folder_close (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- CF_CLASS(folder)->close (folder, expunge, ex);
-}
-
-
-
-
-
-
-static void
-_close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- CAMEL_LOG_WARNING ("Calling CamelFolder::close_async directly. "
- "Should be overloaded\n");
-}
-
-/**
- * camel_folder_close_async: Close a folder.
- * @folder: The folder object
- * @expunge: if TRUE, the flagged message are deleted.
- * @callback: function to call when the operation is over
- * @user_data: data to pass to the callback
- * @ex: exception object
- *
- * Put a folder in its closed state, and possibly
- * expunge the flagged messages. The callback is called
- * when the operation is over and the client program can determine
- * if the operation suceeded by examining the exception.
- *
- **/
-void
-camel_folder_close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- CF_CLASS(folder)->close_async (folder, expunge, callback, user_data, ex);
-}
-
-
-
-
-
-static void
-_set_name (CamelFolder *folder,
- const gchar *name,
- CamelException *ex)
-{
- gchar separator;
- gchar *full_name;
- const gchar *parent_full_name;
-
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- /* if the folder already has a name, free it */
- g_free (folder->name);
- g_free (folder->full_name);
-
- /* set those fields to NULL now, so that if an
- exception occurs, they will be set anyway */
- folder->name = NULL;
- folder->full_name = NULL;
-
- if (!name) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_INVALID_PARAM,
- "name parameter is NULL");
- return;
- }
-
-
- if (!folder->parent_store) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "folder has no parent store");
- return;
- }
-
- /* the set_name method is valid only only on
- close folders */
-
- if (camel_folder_get_mode (folder, ex) != FOLDER_CLOSE) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "CamelFolder::set_name is valid only on closed folders");
- return;
- }
-
- separator = camel_store_get_separator (folder->parent_store);
- camel_exception_clear (ex);
- if (folder->parent_folder) {
- parent_full_name = camel_folder_get_full_name (folder->parent_folder, ex);
- if (camel_exception_get_id (ex)) return;
-
- full_name = g_strdup_printf ("%s%d%s", parent_full_name, separator, name);
- }
-
- folder->name = g_strdup (name);
- folder->full_name = full_name;
-
-}
-
-
-/**
- * camel_folder_set_name:set the (short) name of the folder
- * @folder: folder
- * @name: new name of the folder
- * @ex: exception object
- **/
-void
-camel_folder_set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- }
-
- CF_CLASS(folder)->set_name (folder, name, ex);
-}
-
-
-
-
-
-/* not used for the moment, I don't know if it it is
- a good idea or not to use it */
-#if 0
-static void
-_set_full_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
- g_free(folder->full_name);
- folder->full_name = g_strdup (name);
-}
-
-
-/**
- * camel_folder_set_full_name:set the (full) name of the folder
- * @folder: folder
- * @name: new name of the folder
- *
- * set the name of the folder.
- *
- **/
-void
-camel_folder_set_full_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- CF_CLASS(folder)->set_full_name (folder, name, ex);
-}
-#endif
-
-
-
-
-static const gchar *
-_get_name (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
- return folder->name;
-}
-
-
-/**
- * camel_folder_get_name: get the (short) name of the folder
- * @folder:
- *
- * get the name of the folder. The fully qualified name
- * can be obtained with the get_full_ame method (not implemented)
- *
- * Return value: name of the folder
- **/
-const gchar *
-camel_folder_get_name (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS(folder)->get_name (folder, ex);
-}
-
-
-
-static const gchar *
-_get_full_name (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return folder->full_name;
-}
-
-/**
- * camel_folder_get_full_name:get the (full) name of the folder
- * @folder: folder to get the name
- *
- * get the name of the folder.
- *
- * Return value: full name of the folder
- **/
-const gchar *
-camel_folder_get_full_name (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS(folder)->get_full_name (folder, ex);
-}
-
-
-/**
- * _can_hold_folders: tests if the folder can contain other folders
- * @folder: The folder object
- *
- * Tests if a folder can contain other folder
- * (as for example MH folders)
- *
- * Return value:
- **/
-static gboolean
-_can_hold_folders (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return folder->can_hold_folders;
-}
-
-
-
-
-/**
- * _can_hold_messages: tests if the folder can contain messages
- * @folder: The folder object
- *
- * Tests if a folder object can contain messages.
- * In the case it can not, it most surely can only
- * contain folders (rare).
- *
- * Return value: true if it can contain messages false otherwise
- **/
-static gboolean
-_can_hold_messages (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return folder->can_hold_messages;
-}
-
-
-
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return FALSE;
-}
-
-
-/**
- * _exists: tests if the folder object exists in its parent store.
- * @folder: folder object
- *
- * Test if a folder exists on a store. A folder can be
- * created without physically on a store. In that case,
- * use CamelFolder::create to create it
- *
- * Return value: true if the folder exists on the store false otherwise
- **/
-gboolean
-camel_folder_exists (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return (CF_CLASS(folder)->exists (folder, ex));
-}
-
-
-
-/**
- * _is_open: test if the folder is open
- * @folder: The folder object
- *
- * Tests if a folder is open. If not open it can be opened
- * CamelFolder::open
- *
- * Return value: true if the folder exists, false otherwise
- **/
-static gboolean
-_is_open (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return (folder->open_state == FOLDER_OPEN);
-}
-
-
-
-
-
-static CamelFolder *
-_get_subfolder (CamelFolder *folder,
- const gchar *folder_name,
- CamelException *ex)
-{
- CamelFolder *new_folder;
- gchar *full_name;
- const gchar *current_folder_full_name;
- gchar separator;
-
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
-
- if (!folder_name) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_INVALID_PARAM,
- "folder_name parameter is NULL");
- return;
- }
-
- if (!folder->parent_store) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "folder has no parent store");
- return;
- }
-
- current_folder_full_name = camel_folder_get_full_name (folder, ex);
- if (camel_exception_get_id (ex)) return NULL;
-
-
- separator = camel_store_get_separator (folder->parent_store);
- full_name = g_strdup_printf ("%s%d%s", current_folder_full_name, separator, folder_name);
-
- new_folder = camel_store_get_folder (folder->parent_store, full_name);
- return new_folder;
-}
-
-
-
-/**
- * camel_folder_get_subfolder: return the (sub)folder object that is specified
- * @folder: the folder
- * @folder_name: subfolder path
- *
- * This method returns a folder objects. This folder
- * is necessarily a subfolder of the current folder.
- * It is an error to ask a folder begining with the
- * folder separator character.
- *
- * Return value: Required folder. NULL if the subfolder object could not be obtained
- **/
-CamelFolder *
-camel_folder_get_subfolder (CamelFolder *folder, gchar *folder_name, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return (CF_CLASS(folder)->get_subfolder(folder,folder_name, ex));
-}
-
-
-
-
-/**
- * _create: creates a folder on its store
- * @folder: a CamelFolder object.
- *
- * this routine handles the recursion mechanism.
- * Children classes have to implement the actual
- * creation mechanism. They must call this method
- * before physically creating the folder in order
- * to be sure the parent folder exists.
- * Calling this routine on an existing folder is
- * not an error, and returns %TRUE.
- *
- * Return value: %TRUE if the folder exists, %FALSE otherwise
- **/
-static gboolean
-_create (CamelFolder *folder, CamelException *ex)
-{
- gchar *prefix;
- gchar dich_result;
- CamelFolder *parent;
- gchar sep;
-
- g_assert (folder);
- g_assert (folder->parent_store);
- g_assert (folder->name);
-
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
-
- if (!folder->name) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "folder has no name");
- return FALSE;
- }
-
- if (!folder->parent_store) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "folder has no parent store");
- return FALSE;
- }
-
- /* if the folder already exists on the
- store, do nothing and return true */
- if (CF_CLASS(folder)->exists (folder, ex))
- return TRUE;
-
-
- sep = camel_store_get_separator (folder->parent_store);
- if (folder->parent_folder) {
- camel_folder_create (folder->parent_folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
- }
- else {
- if (folder->full_name) {
- dich_result = string_dichotomy (
- folder->full_name, sep, &prefix, NULL,
- STRING_DICHOTOMY_STRIP_TRAILING | STRING_DICHOTOMY_RIGHT_DIR);
- if (dich_result!='o') {
- g_warning("have to handle the case where the path is not OK\n");
- return FALSE;
- } else {
- parent = camel_store_get_folder (folder->parent_store, prefix);
- camel_folder_create (parent, ex);
- if (camel_exception_get_id (ex)) return FALSE;
- }
- }
- }
- return TRUE;
-}
-
-
-/**
- * camel_folder_create: create the folder object on the physical store
- * @folder: folder object to create
- *
- * This routine physically creates the folder object on
- * the store. Having created the object does not
- * mean the folder physically exists. If it does not
- * exists, this routine will create it.
- * if the folder full name contains more than one level
- * of hierarchy, all folders between the current folder
- * and the last folder name will be created if not existing.
- *
- * Return value:
- **/
-gboolean
-camel_folder_create (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return (CF_CLASS(folder)->create(folder, ex));
-}
-
-
-
-
-
-/**
- * _delete: delete folder
- * @folder: folder to delete
- * @recurse: true is subfolders must also be deleted
- *
- * Delete a folder and its subfolders (if recurse is TRUE).
- * The scheme is the following:
- * 1) delete all messages in the folder
- * 2) if recurse is FALSE, and if there are subfolders
- * return FALSE, else delete current folder and retuen TRUE
- * if recurse is TRUE, delete subfolders, delete
- * current folder and return TRUE
- *
- * subclasses implementing a protocol with a different
- * deletion behaviour must emulate this one or implement
- * empty folders deletion and call this routine which
- * will do all the works for them.
- * Opertions must be done in the folllowing order:
- * - call this routine
- * - delete empty folder
- *
- * Return value: true if the folder has been deleted
- **/
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- GList *subfolders=NULL;
- GList *sf;
- gboolean ok;
-
- g_assert(folder);
-
- /* method valid only on closed folders */
- if (folder->open_state != FOLDER_CLOSE) {
- camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
- "Delete operation invalid on opened folders");
- return FALSE;
- }
-
- /* delete all messages in the folder */
- CF_CLASS(folder)->delete_messages(folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- subfolders = CF_CLASS(folder)->list_subfolders(folder, ex);
- if (camel_exception_get_id (ex)) {
- if (subfolders) g_list_free (subfolders);
- return FALSE;
- }
-
- ok = TRUE;
- if (recurse) { /* delete subfolders */
- if (subfolders) {
- sf = subfolders;
- do {
- CF_CLASS(sf->data)->delete(CAMEL_FOLDER(sf->data), TRUE, ex);
- if (camel_exception_get_id (ex)) ok = FALSE;
- } while (ok && (sf = sf->next));
- }
- } else if (subfolders) {
- camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
- "folder has subfolders");
- ok = FALSE;
- }
-
- if (subfolders) g_list_free (subfolders);
-
- return ok;
-}
-
-
-
-/**
- * camel_folder_delete: delete a folder
- * @folder: folder to delete
- * @recurse: TRUE if subfolders must be deleted
- *
- * Delete a folder. All messages in the folder
- * are deleted before the folder is deleted.
- * When recurse is true, all subfolders are
- * deleted too. When recurse is FALSE and folder
- * contains subfolders, all messages are deleted,
- * but folder deletion fails.
- *
- * Return value: TRUE if deletion was successful
- **/
-gboolean camel_folder_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return CF_CLASS(folder)->delete(folder, recurse, ex);
-}
-
-
-
-
-
-/**
- * _delete_messages: delete all messages in the folder
- * @folder:
- *
- *
- *
- * Return value:
- **/
-static gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::delete_messages directly. "
- "Should be overloaded\n");
- return FALSE;
-}
-
-
-/**
- * camel_folder_delete_messages: delete all messages in the folder
- * @folder: folder
- *
- * delete all messages stored in a folder
- *
- * Return value: TRUE if the messages could be deleted
- **/
-gboolean
-camel_folder_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return CF_CLASS(folder)->delete_messages(folder, ex);
-}
-
-
-
-
-
-
-/**
- * _get_parent_folder: return parent folder
- * @folder: folder to get the parent
- *
- *
- *
- * Return value:
- **/
-static CamelFolder *
-_get_parent_folder (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return folder->parent_folder;
-}
-
-
-/**
- * camel_folder_get_parent_folder:return parent folder
- * @folder: folder to get the parent
- *
- *
- *
- * Return value:
- **/
-CamelFolder *
-camel_folder_get_parent_folder (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS(folder)->get_parent_folder(folder, ex);
-}
-
-
-/**
- * _get_parent_store: return parent store
- * @folder: folder to get the parent
- *
- *
- *
- * Return value:
- **/
-static CamelStore *
-_get_parent_store (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return folder->parent_store;
-}
-
-
-/**
- * camel_folder_get_parent_store: return parent store
- * @folder: folder to get the parent
- *
- * Return the parent store of a folder
- *
- * Return value: the parent store.
- **/
-CamelStore *
-camel_folder_get_parent_store (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS(folder)->get_parent_store(folder, ex);
-}
-
-
-
-
-static CamelFolderOpenMode
-_get_mode (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FOLDER_OPEN_UNKNOWN;
- }
-
- return folder->open_mode;
-}
-
-
-/**
- * camel_folder_get_mode: return the open mode of a folder
- * @folder:
- *
- *
- *
- * Return value: open mode of the folder
- **/
-CamelFolderOpenMode
-camel_folder_get_mode (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FOLDER_OPEN_UNKNOWN;
- }
-
- return CF_CLASS(folder)->get_mode(folder, ex);
-}
-
-
-
-
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::list_subfolders directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-
-/**
- * camel_folder_list_subfolders: list subfolders in a folder
- * @folder: the folder
- *
- * List subfolders in a folder.
- *
- * Return value: list of subfolders
- **/
-GList *
-camel_folder_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS(folder)->list_subfolders(folder, ex);
-}
-
-
-
-
-static GList *
-_expunge (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::expunge directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-
-/**
- * camel_folder_expunge: physically delete messages marked as "DELETED"
- * @folder: the folder
- *
- * Delete messages which have been marked as "DELETED"
- *
- * Return value: list of expunged messages
- **/
-GList *
-camel_folder_expunge (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- CF_CLASS (folder)->expunge (folder, ex);
-}
-
-
-static gboolean
-_has_message_number_capability (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::has_message_number_capability directly. "
- "Should be overloaded\n");
- return FALSE;
-
-}
-
-
-/**
- * camel_folder_has_message_number_capability: tests if the message can be numbered within the folder
- * @folder: folder to test
- *
- * Test if the message in this folder can be
- * obtained via the get_by_number method.
- * Usually, when the folder has the UID
- * capability, messages should be referred to
- * by their UID rather than by their number
- * as the UID is more reliable.
- *
- * Return value: TRUE if the folder supports message numbering, FALSE otherwise.
- **/
-gboolean
-camel_folder_has_message_number_capability (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return CF_CLASS(folder)->has_message_number_capability (folder, ex);
-}
-
-
-
-
-static CamelMimeMessage *
-_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_message_by_number directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-
-
-
-/**
- * camel_folder_get_message_by_number: return the message corresponding to that number in the folder
- * @folder: a CamelFolder object
- * @number: the number of the message within the folder.
- *
- * Return the message corresponding to that number within the folder.
- *
- * Return value: A pointer on the corresponding message or NULL if no corresponding message exists
- **/
-CamelMimeMessage *
-camel_folder_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS (folder)->get_message_by_number (folder, number, ex);
-}
-
-
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_message_count directly. "
- "Should be overloaded\n");
- return -1;
-}
-
-
-
-/**
- * camel_folder_get_message_count: get the number of messages in the folder
- * @folder: A CamelFolder object
- *
- * Returns the number of messages in the folder.
- *
- * Return value: the number of messages or -1 if unknown.
- **/
-gint
-camel_folder_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return -1;
- }
-
- return CF_CLASS (folder)->get_message_count (folder, ex);
-}
-
-
-static void
-_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::append_message directly. "
- "Should be overloaded\n");
- return;
-
-}
-
-
-/**
- * camel_folder_append_message: add a message to a folder
- * @folder: folder object to add the message to
- * @message: message object
- * @ex: exception object
- *
- * Add a message to a folder.
- *
- **/
-void
-camel_folder_append_message (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- CF_CLASS (folder)->append_message (folder, message, ex);
-}
-
-
-static const GList *
-_list_permanent_flags (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return folder->permanent_flags;
-}
-
-
-const GList *
-camel_folder_list_permanent_flags (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return CF_CLASS (folder)->list_permanent_flags (folder, ex);
-}
-
-
-
-
-static void
-_copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- camel_folder_append_message (dest_folder, message, ex);
-}
-
-
-void
-camel_folder_copy_message_to (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelFolder *dest_folder,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return;
- }
-
- CF_CLASS (folder)->copy_message_to (folder, message, dest_folder, ex);;
-}
-
-
-
-
-
-/* summary stuff */
-
-gboolean
-camel_folder_has_summary_capability (CamelFolder *folder,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return folder->has_summary_capability;
-}
-
-
-/**
- * camel_folder_get_summary: return the summary of a folder
- * @folder: folder object
- * @ex: exception object
- *
- * Return a CamelFolderSummary object from
- * which the main informations about a folder
- * can be retrieved.
- *
- * Return value: the folder summary object.
- **/
-CamelFolderSummary *
-camel_folder_get_summary (CamelFolder *folder,
- CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- return folder->summary;
-}
-
-
-
-
-/* UIDs stuff */
-
-/**
- * camel_folder_has_uid_capability: detect if the folder support UIDs
- * @folder: Folder object
- *
- * Detects if a folder supports UID operations, that is
- * reference messages by a Unique IDentifier instead
- * of by message number.
- *
- * Return value: TRUE if the folder supports UIDs
- **/
-gboolean
-camel_folder_has_uid_capability (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- return folder->has_uid_capability;
-}
-
-
-
-static const gchar *
-_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_message_uid directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-/**
- * camel_folder_get_message_uid: get the UID of a message in a folder
- * @folder: Folder in which the UID must refer to
- * @message: Message object
- *
- * Return the UID of a message relatively to a folder.
- * A message can have different UID, each one corresponding
- * to a different folder, if the message is referenced in
- * several folders.
- *
- * Return value: The UID of the message in the folder
- **/
-const gchar *
-camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- if (!folder->has_uid_capability) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_UID,
- "folder is not UID capable");
- return NULL;
- }
-
- return CF_CLASS (folder)->get_message_uid (folder, message, ex);
-}
-
-
-
-/* the next two func are left there temporarily */
-static const gchar *
-_get_message_uid_by_number (CamelFolder *folder, gint message_number, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_message_uid_by_number directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-/**
- * camel_folder_get_message_uid_by_number: get the UID corresponding to a message number
- * @folder: Folder object
- * @message_number: Message number
- *
- * get the UID corresponding to a message number.
- * Use of this routine should be avoiding, as on
- * folders supporting UIDs, message numbers should
- * not been used.
- *
- * Return value:
- **/
-const gchar *
-camel_folder_get_message_uid_by_number (CamelFolder *folder, gint message_number, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- /* if (!folder->has_uid_capability) return NULL; */
- /* return CF_CLASS (folder)->get_message_uid_by_number (folder, message_number, ex); */
-}
-
-
-static CamelMimeMessage *
-_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_message_by_uid directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-
-/**
- * camel_folder_get_message_by_uid: Get a message by its UID in a folder
- * @folder: the folder object
- * @uid: the UID
- *
- * Get a message from its UID in the folder. Messages
- * are cached within a folder, that is, asking twice
- * for the same UID returns the same message object.
- *
- * Return value: Message corresponding to the UID
- **/
-CamelMimeMessage *
-camel_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- if (!folder->has_uid_capability) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_UID,
- "folder is not UID capable");
- return NULL;
- }
-
- return CF_CLASS (folder)->get_message_by_uid (folder, uid, ex);
-}
-
-static GList *
-_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- if (!folder->has_uid_capability) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_UID,
- "folder is not UID capable");
- return NULL;
- }
-
- CAMEL_LOG_WARNING ("Calling CamelFolder::get_uid_list directly. "
- "Should be overloaded\n");
- return NULL;
-}
-
-/**
- * camel_folder_get_uid_list: get the list of UID in a folder
- * @folder: folder object
- *
- * get the list of UID available in a folder. This
- * routine is usefull to know what messages are
- * available when the folder does not support
- * summaries. The UIDs in the list must not be freed,
- * the folder object caches them.
- *
- * Return value: Glist of UID correspondind to the messages available in the folder.
- **/
-GList *
-camel_folder_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return NULL;
- }
-
- if (!folder->has_uid_capability) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_UID,
- "folder is not UID capable");
- return NULL;
- }
-
- return CF_CLASS (folder)->get_uid_list (folder, ex);
-}
-
-
-/* **** */
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
deleted file mode 100644
index c00a17d8b6..0000000000
--- a/camel/camel-folder.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelFolder.h : Abstract class for an email folder */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_FOLDER_H
-#define CAMEL_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-typedef struct _CamelFolder CamelFolder;
-
-#include "camel-store.h"
-#include "camel-mime-message.h"
-#include "camel-folder-summary.h"
-#include "camel-exception.h"
-
-#define CAMEL_FOLDER_TYPE (camel_folder_get_type ())
-#define CAMEL_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_FOLDER_TYPE, CamelFolder))
-#define CAMEL_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_FOLDER_TYPE, CamelFolderClass))
-#define CAMEL_IS_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_FOLDER_TYPE))
-
-typedef enum {
- FOLDER_OPEN,
- FOLDER_CLOSE
-} CamelFolderState;
-
-typedef enum {
- FOLDER_OPEN_UNKNOWN = 0, /* folder open mode is unknown */
- FOLDER_OPEN_READ = 1, /* folder is read only */
- FOLDER_OPEN_WRITE = 2, /* folder is write only */
- FOLDER_OPEN_RW = 3 /* folder is read/write */
-} CamelFolderOpenMode;
-
-typedef void (*CamelFolderAsyncCallback) ();
-
-struct _CamelFolder
-{
- GtkObject parent_object;
-
- gboolean can_hold_folders;
- gboolean can_hold_messages;
- CamelFolderOpenMode open_mode;
- CamelFolderState open_state;
- gchar *name;
- gchar *full_name;
- CamelStore *parent_store;
- CamelFolder *parent_folder;
- GList *permanent_flags;
-
- gboolean has_summary_capability;
- CamelFolderSummary *summary;
-
- gboolean has_uid_capability;
-
-};
-
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /* Virtual methods */
- void (*init_with_store) (CamelFolder *folder,
- CamelStore *parent_store,
- CamelException *ex);
-
- void (*open) (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex);
-
- void (*close) (CamelFolder *folder,
- gboolean expunge,
- CamelException *ex);
-
- void (*open_async) (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-
- void (*close_async) (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-
- void (*set_name) (CamelFolder *folder,
- const gchar *name,
- CamelException *ex);
-
- /* void (*set_full_name) (CamelFolder *folder, const gchar *name); */
-
- const gchar * (*get_name) (CamelFolder *folder,
- CamelException *ex);
-
- const gchar * (*get_full_name) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*can_hold_folders) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*can_hold_messages) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*exists) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*is_open) (CamelFolder *folder,
- CamelException *ex);
-
- CamelFolder * (*get_subfolder) (CamelFolder *folder,
- const gchar *folder_name,
- CamelException *ex);
-
- gboolean (*create) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*delete) (CamelFolder *folder,
- gboolean recurse,
- CamelException *ex);
-
- gboolean (*delete_messages) (CamelFolder *folder,
- CamelException *ex);
-
- CamelFolder * (*get_parent_folder) (CamelFolder *folder,
- CamelException *ex);
-
- CamelStore * (*get_parent_store) (CamelFolder *folder,
- CamelException *ex);
-
- CamelFolderOpenMode (*get_mode) (CamelFolder *folder,
- CamelException *ex);
-
- GList * (*list_subfolders) (CamelFolder *folder,
- CamelException *ex);
-
- GList * (*expunge) (CamelFolder *folder,
- CamelException *ex);
-
- gboolean (*has_message_number_capability) (CamelFolder *folder, CamelException *ex);
-
- CamelMimeMessage * (*get_message_by_number) (CamelFolder *folder,
- gint number,
- CamelException *ex);
-
- gint (*get_message_count) (CamelFolder *folder,
- CamelException *ex);
-
- void (*append_message) (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-
- const GList * (*list_permanent_flags) (CamelFolder *folder,
- CamelException *ex);
-
- void (*copy_message_to) (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelFolder *dest_folder,
- CamelException *ex);
-
- gboolean (*has_uid_capability) (CamelFolder *folder);
-
- const gchar * (*get_message_uid) (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelException *ex);
-
- CamelMimeMessage * (*get_message_by_uid) (CamelFolder *folder,
- const gchar *uid,
- CamelException *ex);
-
- GList * (*get_uid_list) (CamelFolder *folder,
- CamelException *ex);
-
-} CamelFolderClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_folder_get_type (void);
-
-
-/* public methods */
-
-
-
-CamelFolder *camel_folder_get_subfolder (CamelFolder *folder,
- gchar *folder_name,
- CamelException *ex);
-
-void camel_folder_open (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelException *ex);
-
-void camel_folder_open_async (CamelFolder *folder,
- CamelFolderOpenMode mode,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-
-void camel_folder_close_async (CamelFolder *folder,
- gboolean expunge,
- CamelFolderAsyncCallback callback,
- gpointer user_data,
- CamelException *ex);
-
-gboolean camel_folder_create (CamelFolder *folder, CamelException *ex);
-CamelFolder *camel_folder_get_parent_folder (CamelFolder *folder, CamelException *ex);
-CamelStore *camel_folder_get_parent_store (CamelFolder *folder, CamelException *ex);
-GList *camel_folder_list_subfolders (CamelFolder *folder, CamelException *ex);
-
-
-/* delete operations */
-gboolean camel_folder_delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-gboolean camel_folder_delete_messages (CamelFolder *folder, CamelException *ex);
-GList *camel_folder_expunge (CamelFolder *folder, CamelException *ex);
-
-
-/* folder name manipulation operations */
-void camel_folder_set_name (CamelFolder *folder,
- const gchar *name,
- CamelException *ex);
-const gchar *camel_folder_get_name (CamelFolder *folder, CamelException *ex);
-const gchar *camel_folder_get_full_name (CamelFolder *folder, CamelException *ex);
-
-
-/* various properties accessors */
-gboolean camel_folder_exists (CamelFolder *folder, CamelException *ex);
-const GList *camel_folder_list_permanent_flags (CamelFolder *folder, CamelException *ex);
-CamelFolderOpenMode camel_folder_get_mode (CamelFolder *folder, CamelException *ex);
-
-
-
-/* message manipulation */
-void camel_folder_append_message (CamelFolder *folder,
- CamelMimeMessage *message, CamelException *ex);
-void camel_folder_copy_message_to (CamelFolder *folder,
- CamelMimeMessage *message,
- CamelFolder *dest_folder,
- CamelException *ex);
-
-
-/* summary related operations */
-gboolean camel_folder_has_summary_capability (CamelFolder *folder, CamelException *ex);
-CamelFolderSummary *camel_folder_get_summary (CamelFolder *folder, CamelException *ex);
-
-
-/* number based access operations */
-gboolean camel_folder_has_message_number_capability (CamelFolder *folder, CamelException *ex);
-CamelMimeMessage *camel_folder_get_message_by_number (CamelFolder *folder,
- gint number, CamelException *ex);
-gint camel_folder_get_message_count (CamelFolder *folder, CamelException *ex);
-
-
-/* uid based access operations */
-gboolean camel_folder_has_uid_capability (CamelFolder *folder, CamelException *ex);
-const gchar * camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-CamelMimeMessage *camel_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-GList *camel_folder_get_uid_list (CamelFolder *folder, CamelException *ex);
-
-
-
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_FOLDER_H */
-
diff --git a/camel/camel-log.c b/camel/camel-log.c
deleted file mode 100644
index 970986a5ad..0000000000
--- a/camel/camel-log.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-log.h"
-
-int camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG;
-FILE *camel_log_file_descriptor = NULL;
-
-void
-camel_log(guint level, const gchar *format, ... )
-{
- va_list args;
- if (camel_log_file_descriptor == NULL)
- camel_log_file_descriptor = stdout;
-
- if (level<=camel_debug_level)
- {
- va_start(args, format);
- vfprintf(camel_log_file_descriptor, format, args);
- va_end (args);
- }
-}
diff --git a/camel/camel-log.h b/camel/camel-log.h
deleted file mode 100644
index 5337c79f4d..0000000000
--- a/camel/camel-log.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef CAMEL_LOG_H
-#define CAMEL_LOG_H
-
-
-#include <stdarg.h>
-#include <glib.h>
-#include <stdio.h>
-
-extern int camel_debug_level;
-extern FILE *camel_log_file_descriptor;
-
-#define CAMEL_LOG_LEVEL_NO_LOG 0
-#define CAMEL_LOG_LEVEL_STRANGE 5
-#define CAMEL_LOG_LEVEL_WARNING 6
-#define CAMEL_LOG_LEVEL_TRACE 8
-#define CAMEL_LOG_LEVEL_FULL_DEBUG 10
-
-/* #define CAMEL_HARD_LOG_LEVEL CAMEL_LOG_LEVEL_TRACE */
-
-/* the idea here is to be able to have a hard maximum log
-level, given at compilation time, and a soft one, given at
-runtime (with camel_debug_level) */
-
-#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_STRANGE
-#define CAMEL_LOG_STRANGE(args...) camel_log(CAMEL_LOG_LEVEL_STRANGE, ##args)
-#else /* CAMEL_LOG_LEVEL_STRANGE */
-#define CAMEL_LOG_STRANGE(args...)
-#endif /* CAMEL_LOG_LEVEL_STRANGE */
-
-#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_WARNING
-#define CAMEL_LOG_WARNING(args...) camel_log(CAMEL_LOG_LEVEL_WARNING, ##args)
-#else /* CAMEL_LOG_LEVEL_WARNING */
-#define CAMEL_LOG_WARNING(args...)
-#endif /* CAMEL_LOG_LEVEL_WARNING */
-
-#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_TRACE
-#define CAMEL_LOG_TRACE(args...) camel_log(CAMEL_LOG_LEVEL_TRACE, ##args)
-#else /* CAMEL_LOG_LEVEL_TRACE */
-#define CAMEL_LOG_TRACE(args...)
-#endif /* CAMEL_LOG_LEVEL_TRACE */
-
-#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_FULL_DEBUG
-#define CAMEL_LOG_FULL_DEBUG(args...) camel_log(CAMEL_LOG_LEVEL_FULL_DEBUG, ##args)
-#else /* CAMEL_LOG_LEVEL_FULL_DEBUG */
-#define CAMEL_LOG_FULL_DEBUG(args...)
-#endif /* CAMEL_LOG_LEVEL_FULL_DEBUG */
-
-
-
-
-extern void camel_log(guint level, const gchar *format, ... );
-
-#endif /* CAMEL_LOG_H */
diff --git a/camel/camel-marshal-utils.c b/camel/camel-marshal-utils.c
deleted file mode 100644
index ece61d79fc..0000000000
--- a/camel/camel-marshal-utils.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-marshal-utils.c : marshal utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-
-#include "config.h"
-#include "camel-log.h"
-#include "camel-marshal-utils.h"
-#include "camel-arg-collector.c"
-
-
-#define NB_OP_CHUNKS 20
-static GMemChunk *op_chunk=NULL;
-static GStaticMutex op_chunk_mutex = G_STATIC_MUTEX_INIT;
-
-CamelFuncDef *
-camel_func_def_new (CamelMarshal marshal, guint n_params, ...)
-{
- CamelFuncDef *func_def;
- va_list args;
- GtkType type;
- int i;
-
- func_def = g_new (CamelFuncDef, 1);
- func_def->marshal = marshal;
- func_def->n_params = n_params;
- func_def->params_type = g_new (GtkType, n_params);
-
- va_start (args, n_params);
- for (i=0; i<n_params; i++) {
- type = va_arg (args, GtkType);
- func_def->params_type [i] = type;
- }
- va_end (args);
-
- return func_def;
-}
-
-
-
-
-static gboolean
-_collect_params (GtkArg *params,
- CamelFuncDef *func_def,
- va_list var_args)
-{
- GtkArg *last_param;
- int i;
- gboolean failed = FALSE;
-
-
- for (i=0;
- i<func_def->n_params;
- i++, params++)
- {
- gchar *error;
-
- params->name = NULL;
- params->type = (func_def->params_type) [i];
- CAMEL_ARG_COLLECT_VALUE (params,
- var_args,
- error);
- if (error)
- {
- failed = TRUE;
- CAMEL_LOG_FULL_DEBUG ("CamelMarshall::_collect_params(): %s", error);
- g_free (error);
- }
- }
- return (failed);
-}
-
-
-
-/**
- * camel_marshal_create_op: create an operation
- * @func_def: function definition object
- * @func: function to call
- *
- * create a function ready to be executed. The
- * vari
- *
- *
- * Return value: operation ready to be executed
- **/
-CamelOp *
-camel_marshal_create_op (CamelFuncDef *func_def, CamelFunc func, ...)
-{
- GtkArg *params;
- gboolean error;
- CamelOp *op;
- va_list args;
-
- g_assert (func_def);
-
- op = camel_op_new (func_def);
- op->func = func;
-
- va_start (args, func);
- error = _collect_params (op->params, func_def, args);
- va_end (args);
-
- if (error) {
- camel_op_free (op);
- return NULL;
- } else
- return (op);
-}
-
-
-
-
-/**
- * camel_op_new: return a new CamelOp object
- *
- * The obtained object must be destroyed with
- * camel_op_free ()
- *
- * Return value: the newly allocated CamelOp object
- **/
-CamelOp *
-camel_op_new (CamelFuncDef *func_def)
-{
- CamelOp *op;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::new\n");
- g_static_mutex_lock (&op_chunk_mutex);
- if (!op_chunk)
- op_chunk = g_mem_chunk_create (CamelOp,
- NB_OP_CHUNKS,
- G_ALLOC_AND_FREE);
- g_static_mutex_unlock (&op_chunk_mutex);
-
- op = g_chunk_new (CamelOp, op_chunk);
- op->func_def = func_def;
- op->params = g_new (GtkArg, func_def->n_params);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::new\n");
- return op;
-}
-
-/**
- * camel_op_free: free a CamelOp object allocated with camel_op_new
- * @op: CamelOp object to free
- *
- * Free a CamelOp object allocated with camel_op_new ()
- * this routine won't work with CamelOp objects allocated
- * with other allocators.
- **/
-void
-camel_op_free (CamelOp *op)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::free\n");
- g_free (op->params);
- g_chunk_free (op, op_chunk);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::free\n");
-}
-
-
-/**
- * camel_op_run: run an operation
- * @op: the operation object
- *
- * run an operation
- *
- **/
-void
-camel_op_run (CamelOp *op)
-{
- GtkArg *params;
- gboolean error;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::run\n");
- g_assert (op);
- g_assert (op->func_def);
- g_assert (op->params);
-
- op->func_def->marshal (op->func, op->params);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::run\n");
-}
-
-
-
-
-/**
- * camel_op_set_user_data: set the private field
- * @op: operation
- * @user_data: private field
- *
- * associate a field to an operation object
- **/
-void
-camel_op_set_user_data (CamelOp *op, gpointer user_data)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::set_user_data\n");
- g_assert (op);
- op->user_data = user_data;
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::set_user_data\n");
-}
-
-
-/**
- * camel_op_get_user_data: return the private field
- * @op: operation object
- *
- * return the private field associated to
- * an operation object.
- *
- * Return value:
- **/
-gpointer
-camel_op_get_user_data (CamelOp *op)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::get_user_data\n");
- g_assert (op);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::get_user_data\n");
- return op->user_data;
-}
-
-
-
-/* misc marshaller */
-
-
-typedef void (*CamelMarshal_NONE__POINTER_INT) (gpointer arg1,
- gint arg2);
-void camel_marshal_NONE__POINTER_INT (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_INT rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_INT\n");
- rfunc = (CamelMarshal_NONE__POINTER_INT) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_INT(args[1]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_INT\n");
-}
-
-
-
-
-
-typedef void (*CamelMarshal_NONE__POINTER_INT_POINTER) (gpointer arg1,
- gint arg2,
- gpointer arg3);
-void camel_marshal_NONE__POINTER_INT_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_INT_POINTER rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_INT_POINTER\n");
- rfunc = (CamelMarshal_NONE__POINTER_INT_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_INT(args[1]),
- GTK_VALUE_POINTER(args[2]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_INT_POINTER\n");
-}
-
-
-typedef void (*CamelMarshal_NONE__POINTER_BOOL_POINTER) (gpointer arg1,
- gboolean arg2,
- gpointer arg3);
-void camel_marshal_NONE__POINTER_BOOL_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_BOOL_POINTER rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_BOOL_POINTER\n");
- rfunc = (CamelMarshal_NONE__POINTER_BOOL_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_BOOL(args[1]),
- GTK_VALUE_POINTER(args[2]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_BOOL_POINTER\n");
-}
-
-
-typedef void (*CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) (gpointer arg1,
- gint arg2,
- gpointer arg3,
- gpointer arg4);
-void camel_marshal_NONE__POINTER_INT_POINTER_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_INT_POINTER_POINTER rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_INT_POINTER_POINTER\n");
- rfunc = (CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_INT(args[1]),
- GTK_VALUE_POINTER(args[2]),
- GTK_VALUE_POINTER(args[3]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_INT_POINTER_POINTER\n");
-}
-
-
-
-typedef void (*CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER) (gpointer arg1,
- gboolean arg2,
- gpointer arg3,
- gpointer arg4);
-void camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER\n");
- rfunc = (CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_BOOL(args[1]),
- GTK_VALUE_POINTER(args[2]),
- GTK_VALUE_POINTER(args[3]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER\n");
-}
-
-
-
-typedef void (*CamelMarshal_NONE__POINTER_POINTER_POINTER) (gpointer arg1,
- gpointer arg2,
- gpointer arg3);
-void camel_marshal_NONE__POINTER_POINTER_POINTER (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__POINTER_POINTER_POINTER rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_POINTER_POINTER\n");
- rfunc = (CamelMarshal_NONE__POINTER_POINTER_POINTER) func;
- (* rfunc) (GTK_VALUE_POINTER(args[0]),
- GTK_VALUE_POINTER(args[1]),
- GTK_VALUE_POINTER(args[2]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_POINTER_POINTER\n");
-}
-
-
-typedef void (*CamelMarshal_NONE__INT) (gint arg1);
-void camel_marshal_NONE__INT (CamelFunc func,
- GtkArg *args)
-{
- CamelMarshal_NONE__INT rfunc;
-
- CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__INT\n");
- rfunc = (CamelMarshal_NONE__INT) func;
- (* rfunc) (GTK_VALUE_INT (args[0]));
- CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__INT\n");
-}
-
-
-
-
-
-
diff --git a/camel/camel-marshal-utils.h b/camel/camel-marshal-utils.h
deleted file mode 100644
index 8ca9901ba2..0000000000
--- a/camel/camel-marshal-utils.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maeshal-utils.h : marshal utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#ifndef CAMEL_MARSHAL_UTILS_H
-#define CAMEL_MARSHAL_UTILS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-
-typedef void (*CamelFunc) ();
-
-typedef void ( *CamelMarshal) (CamelFunc func,
- GtkArg *args);
-
-
-
-
-
-typedef struct {
-
- CamelMarshal marshal;
- guint n_params;
- GtkType *params_type;
-
-} CamelFuncDef;
-
-
-
-typedef struct {
- CamelFuncDef *func_def;
- CamelFunc func;
- GtkArg *params;
- gpointer user_data;
-} CamelOp;
-
-
-CamelFuncDef *
-camel_func_def_new (CamelMarshal marshal,
- guint n_params,
- ...);
-
-
-CamelOp *camel_op_new (CamelFuncDef *func_def);
-void camel_op_free (CamelOp *op);
-void camel_op_run (CamelOp *op);
-void camel_op_run_and_free (CamelOp *op);
-void camel_op_set_user_data (CamelOp *op, gpointer user_data);
-gpointer camel_op_get_user_data (CamelOp *op);
-
-CamelOp *camel_marshal_create_op (CamelFuncDef *func_def, CamelFunc func, ...);
-
-/* marshallers */
-void camel_marshal_NONE__POINTER_INT_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_BOOL_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_INT_POINTER_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__POINTER_POINTER_POINTER (CamelFunc func,
- GtkArg *args);
-void camel_marshal_NONE__INT (CamelFunc func,
- GtkArg *args);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MARSHAL_UTILS_H */
-
diff --git a/camel/camel-medium.c b/camel/camel-medium.c
deleted file mode 100644
index 95d00280e1..0000000000
--- a/camel/camel-medium.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelMedium.c : Abstract class for a medium */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-medium.h"
-#include <stdio.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "gmime-utils.h"
-#include "camel-simple-data-wrapper.h"
-
-
-
-
-
-static CamelDataWrapperClass *parent_class=NULL;
-
-/* Returns the class for a CamelMedium */
-#define CM_CLASS(so) CAMEL_MEDIUM_CLASS (GTK_OBJECT(so)->klass)
-
-static void _add_header (CamelMedium *medium, gchar *header_name, gchar *header_value);
-static void _remove_header (CamelMedium *medium, const gchar *header_name);
-static const gchar *_get_header (CamelMedium *medium, const gchar *header_name);
-
-static CamelDataWrapper *_get_content_object(CamelMedium *medium);
-static void _set_content_object(CamelMedium *medium, CamelDataWrapper *content);
-
-static void _finalize (GtkObject *object);
-
-static void
-camel_medium_class_init (CamelMediumClass *camel_medium_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_medium_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_data_wrapper_class);
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
-
- /* virtual method definition */
- camel_medium_class->add_header = _add_header;
- camel_medium_class->remove_header = _remove_header;
- camel_medium_class->get_header = _get_header;
-
- camel_medium_class->set_content_object = _set_content_object;
- camel_medium_class->get_content_object = _get_content_object;
-
- /* virtual method overload */
- /* camel_data_wrapper_class->write_to_stream = _write_to_stream; */
- /* camel_data_wrapper_class->construct_from_stream = _construct_from_stream; */
-
- gtk_object_class->finalize = _finalize;
-}
-
-static void
-camel_medium_init (gpointer object, gpointer klass)
-{
- CamelMedium *camel_medium = CAMEL_MEDIUM (object);
-
- camel_medium->headers = g_hash_table_new (g_str_hash, g_str_equal);
- camel_medium->content = NULL;
-}
-
-
-
-
-GtkType
-camel_medium_get_type (void)
-{
- static GtkType camel_medium_type = 0;
-
- if (!camel_medium_type) {
- GtkTypeInfo camel_medium_info =
- {
- "CamelMedium",
- sizeof (CamelMedium),
- sizeof (CamelMediumClass),
- (GtkClassInitFunc) camel_medium_class_init,
- (GtkObjectInitFunc) camel_medium_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_medium_type = gtk_type_unique (camel_data_wrapper_get_type (), &camel_medium_info);
- }
-
- return camel_medium_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelMedium *medium = CAMEL_MEDIUM (object);
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMedium::finalize\n");
-
- if (medium->headers) {
-#warning Free hash table elements
- g_hash_table_destroy (medium->headers);
- }
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMedium::finalize\n");
-}
-
-
-
-/* **** */
-
-static void
-_add_header (CamelMedium *medium, gchar *header_name, gchar *header_value)
-{
- gboolean header_exists;
- gchar *old_header_name;
- gchar *old_header_value;
-
-
- header_exists = g_hash_table_lookup_extended (medium->headers, header_name,
- (gpointer *) &old_header_name,
- (gpointer *) &old_header_value);
- if (header_exists) {
- g_free (old_header_name);
- g_free (old_header_value);
- }
-
- g_hash_table_insert (medium->headers, header_name, header_value);
-}
-
-
-void
-camel_medium_add_header (CamelMedium *medium, gchar *header_name, gchar *header_value)
-{
- CM_CLASS(medium)->add_header(medium, header_name, header_value);
-}
-
-
-/* **** */
-
-
-static void
-_remove_header (CamelMedium *medium, const gchar *header_name)
-{
-
- gboolean header_exists;
- gchar *old_header_name;
- gchar *old_header_value;
-
- header_exists = g_hash_table_lookup_extended (medium->headers, header_name,
- (gpointer *) &old_header_name,
- (gpointer *) &old_header_value);
- if (header_exists) {
- g_free (old_header_name);
- g_free (old_header_value);
- }
-
- g_hash_table_remove (medium->headers, header_name);
-
-}
-
-void
-camel_medium_remove_header (CamelMedium *medium, const gchar *header_name)
-{
- CM_CLASS(medium)->remove_header(medium, header_name);
-}
-
-
-/* **** */
-
-
-static const gchar *
-_get_header (CamelMedium *medium, const gchar *header_name)
-{
-
- gchar *old_header_name;
- gchar *old_header_value;
- gchar *header_value;
-
- header_value = (gchar *)g_hash_table_lookup (medium->headers, header_name);
- return header_value;
-}
-
-const gchar *
-camel_medium_get_header (CamelMedium *medium, const gchar *header_name)
-{
- return CM_CLASS(medium)->get_header (medium, header_name);
-}
-
-
-/* **** */
-
-
-static CamelDataWrapper *
-_get_content_object (CamelMedium *medium)
-{
- return medium->content;
-
-}
-
-
-CamelDataWrapper *
-camel_medium_get_content_object (CamelMedium *medium)
-{
- return CM_CLASS(medium)->get_content_object (medium);
-}
-
-
-/* **** */
-
-
-static void
-_set_content_object (CamelMedium *medium, CamelDataWrapper *content)
-{
- GMimeContentField *object_content_field;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMedium::set_content_object\n");
- if (medium->content) {
- CAMEL_LOG_FULL_DEBUG ("CamelMedium::set_content_object unreferencing old content object\n");
- gtk_object_unref (GTK_OBJECT (medium->content));
- }
- gtk_object_ref (GTK_OBJECT (content));
- medium->content = content;
-
-}
-
-void
-camel_medium_set_content_object (CamelMedium *medium, CamelDataWrapper *content)
-{
- CM_CLASS(medium)->set_content_object (medium, content);
-}
-
-
-/* **** */
diff --git a/camel/camel-medium.h b/camel/camel-medium.h
deleted file mode 100644
index 5a228ecbde..0000000000
--- a/camel/camel-medium.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-medium.h : class for a medium object */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MEDIUM_H
-#define CAMEL_MEDIUM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-data-wrapper.h"
-#include "camel-stream.h"
-
-
-#define CAMEL_MEDIUM_TYPE (camel_medium_get_type ())
-#define CAMEL_MEDIUM(obj) (GTK_CHECK_CAST((obj), CAMEL_MEDIUM_TYPE, CamelMedium))
-#define CAMEL_MEDIUM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MEDIUM_TYPE, CamelMediumClass))
-#define CAMEL_IS_MEDIUM(o) (GTK_CHECK_TYPE((o), CAMEL_MEDIUM_TYPE))
-
-
-typedef struct
-{
- CamelDataWrapper parent_object;
-
- GHashTable *headers;
-
- CamelDataWrapper *content; /* part real content */
-
-} CamelMedium;
-
-
-
-typedef struct {
- CamelDataWrapperClass parent_class;
-
- /* Virtual methods */
- void (*add_header) (CamelMedium *medium, gchar *header_name, gchar *header_value);
- void (*remove_header) (CamelMedium *medium, const gchar *header_name);
- const gchar * (*get_header) (CamelMedium *medium, const gchar *header_name);
-
- CamelDataWrapper * (*get_content_object) (CamelMedium *medium);
- void (*set_content_object) (CamelMedium *medium, CamelDataWrapper *content);
-
-} CamelMediumClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_medium_get_type (void);
-
-
-/* public methods */
-void camel_medium_add_header (CamelMedium *medium, gchar *header_name, gchar *header_value);
-void camel_medium_remove_header (CamelMedium *medium, const gchar *header_name);
-const gchar *camel_medium_get_header (CamelMedium *medium, const gchar *header_name);
-
-
-CamelDataWrapper *camel_medium_get_content_object (CamelMedium *medium);
-void camel_medium_set_content_object (CamelMedium *medium, CamelDataWrapper *content);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MEDIUM_H */
-
diff --git a/camel/camel-mime-body-part.c b/camel/camel-mime-body-part.c
deleted file mode 100644
index 77d245349b..0000000000
--- a/camel/camel-mime-body-part.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mime-body-part.c : Abstract class for a mime body part */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-mime-body-part.h"
-#include "camel-log.h"
-
-
-static void _set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart);
-static const CamelMultipart *_get_parent (CamelMimeBodyPart *mime_body_part);
-
-
-static CamelMimePartClass *parent_class=NULL;
-
-/* Returns the class for a CamelMimeBodyPart */
-#define CMBP_CLASS(so) CAMEL_MIME_BODY_PART_CLASS (GTK_OBJECT(so)->klass)
-
-
-
-static void
-camel_mime_body_part_class_init (CamelMimeBodyPartClass *camel_mime_body_part_class)
-{
- CamelMimePartClass *camel_mime_part_class = CAMEL_MIME_PART_CLASS (camel_mime_body_part_class);
- parent_class = gtk_type_class (camel_mime_part_get_type ());
-
- /* virtual method definition */
- camel_mime_body_part_class->set_parent = _set_parent;
- camel_mime_body_part_class->get_parent = _get_parent;
-}
-
-static void
-camel_mime_body_part_init (gpointer object, gpointer klass)
-{
- CamelMimeBodyPart *camel_mime_body_part = CAMEL_MIME_BODY_PART (object);
-}
-
-
-
-
-GtkType
-camel_mime_body_part_get_type (void)
-{
- static GtkType camel_mime_body_part_type = 0;
-
- if (!camel_mime_body_part_type) {
- GtkTypeInfo camel_mime_body_part_info =
- {
- "CamelMimeBodyPart",
- sizeof (CamelMimeBodyPart),
- sizeof (CamelMimeBodyPartClass),
- (GtkClassInitFunc) camel_mime_body_part_class_init,
- (GtkObjectInitFunc) camel_mime_body_part_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mime_body_part_type = gtk_type_unique (camel_mime_part_get_type (), &camel_mime_body_part_info);
- }
-
- return camel_mime_body_part_type;
-}
-
-CamelMimeBodyPart *
-camel_mime_body_part_new ()
-{
- CamelMimeBodyPart *mime_body_part;
- CAMEL_LOG_FULL_DEBUG ("CamelMimeBodyPart:: Entering new()\n");
-
- mime_body_part = (CamelMimeBodyPart *)gtk_type_new (CAMEL_MIME_BODY_PART_TYPE);
- CAMEL_LOG_FULL_DEBUG ("CamelMimeBodyPart:: Leaving new()\n");
- return mime_body_part;
-}
-
-
-static void
-_set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart)
-{
- if (mime_body_part->parent) gtk_object_unref (GTK_OBJECT (mime_body_part->parent));
- mime_body_part->parent = multipart;
- if (multipart) gtk_object_ref (GTK_OBJECT (multipart));
-}
-
-
-void
-camel_mime_body_part_set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart)
-{
- CMBP_CLASS (mime_body_part)->set_parent (mime_body_part, multipart);
-}
-
-
-static const CamelMultipart *
-_get_parent (CamelMimeBodyPart *mime_body_part)
-{
- return mime_body_part->parent;
-}
-
-
-const CamelMultipart *
-camel_mime_body_part_get_parent (CamelMimeBodyPart *mime_body_part)
-{
- return CMBP_CLASS (mime_body_part)->get_parent (mime_body_part);
-}
-
-
diff --git a/camel/camel-mime-body-part.h b/camel/camel-mime-body-part.h
deleted file mode 100644
index d2ae4908fb..0000000000
--- a/camel/camel-mime-body-part.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mime-body-part.h : class for a mime body part */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MIME_BODY_PART_H
-#define CAMEL_MIME_BODY_PART_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-typedef struct _CamelMimeBodyPart CamelMimeBodyPart;
-
-#include <gtk/gtk.h>
-#include "camel-mime-part.h"
-#include "camel-multipart.h"
-
-
-
-#define CAMEL_MIME_BODY_PART_TYPE (camel_mime_body_part_get_type ())
-#define CAMEL_MIME_BODY_PART(obj) (GTK_CHECK_CAST((obj), CAMEL_MIME_BODY_PART_TYPE, CamelMimeBodyPart))
-#define CAMEL_MIME_BODY_PART_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MIME_BODY_PART_TYPE, CamelMimeBodyPartClass))
-#define CAMEL_IS_MIME_BODY_PART(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_BODY_PART_TYPE))
-
-
-struct _CamelMimeBodyPart
-{
- CamelMimePart parent_object;
- CamelMultipart *parent;
-
-};
-
-
-
-typedef struct {
- CamelMimePartClass parent_class;
-
- /* Virtual methods */
- void (*set_parent) (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart);
- const CamelMultipart * (*get_parent) (CamelMimeBodyPart *mime_body_part);
-
-} CamelMimeBodyPartClass;
-
-
-/* Standard Gtk function */
-GtkType camel_mime_body_part_get_type (void);
-
-
-/* public methods */
-CamelMimeBodyPart *camel_mime_body_part_new ();
-void camel_mime_body_part_set_parent (CamelMimeBodyPart *mime_body_part, CamelMultipart *multipart);
-const CamelMultipart *camel_mime_body_part_get_parent (CamelMimeBodyPart *mime_body_part);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_BODY_PART_H */
-
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
deleted file mode 100644
index d9fd90cfc7..0000000000
--- a/camel/camel-mime-message.c
+++ /dev/null
@@ -1,705 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelMimeMessage.c : class for a mime_message */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-mime-message.h"
-#include <stdio.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "gmime-utils.h"
-#include "hash-table-utils.h"
-
-typedef enum {
- HEADER_UNKNOWN,
- HEADER_FROM,
- HEADER_REPLY_TO,
- HEADER_SUBJECT,
- HEADER_TO,
- HEADER_CC,
- HEADER_BCC
-} CamelHeaderType;
-
-static GHashTable *header_name_table;
-
-
-
-static CamelMimePartClass *parent_class=NULL;
-
-static gchar *received_date_str;
-static gchar *sent_date_str;
-static gchar *reply_to_str;
-static gchar *subject_str;
-static gchar *from_str;
-
-static void _set_received_date (CamelMimeMessage *mime_message, const gchar *received_date);
-static const gchar *_get_received_date (CamelMimeMessage *mime_message);
-static const gchar *_get_sent_date (CamelMimeMessage *mime_message);
-static void _set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to);
-static const gchar *_get_reply_to (CamelMimeMessage *mime_message);
-static void _set_subject (CamelMimeMessage *mime_message, const gchar *subject);
-static const gchar *_get_subject (CamelMimeMessage *mime_message);
-static void _set_from (CamelMimeMessage *mime_message, const gchar *from);
-static const gchar *_get_from (CamelMimeMessage *mime_message);
-static void _add_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
-static void _remove_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
-static const GList *_get_recipients (CamelMimeMessage *mime_message, const gchar *recipient_type);
-static void _set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value);
-static gboolean _get_flag (CamelMimeMessage *mime_message, const gchar *flag);
-static GList *_get_flag_list (CamelMimeMessage *mime_message);
-static void _set_message_number (CamelMimeMessage *mime_message, guint number);
-static guint _get_message_number (CamelMimeMessage *mime_message);
-static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static gboolean _parse_header_pair (CamelMimePart *mime_part, gchar *header_name, gchar *header_value);
-static void _finalize (GtkObject *object);
-
-/* Returns the class for a CamelMimeMessage */
-#define CMM_CLASS(so) CAMEL_MIME_MESSAGE_CLASS (GTK_OBJECT(so)->klass)
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void
-_init_header_name_table()
-{
- header_name_table = g_hash_table_new (g_str_hash, g_str_equal);
- g_hash_table_insert (header_name_table, "From", (gpointer)HEADER_FROM);
- g_hash_table_insert (header_name_table, "Reply-To", (gpointer)HEADER_REPLY_TO);
- g_hash_table_insert (header_name_table, "Subject", (gpointer)HEADER_SUBJECT);
- g_hash_table_insert (header_name_table, "To", (gpointer)HEADER_TO);
- g_hash_table_insert (header_name_table, "Cc", (gpointer)HEADER_CC);
- g_hash_table_insert (header_name_table, "Bcc", (gpointer)HEADER_BCC);
-
-}
-
-static void
-camel_mime_message_class_init (CamelMimeMessageClass *camel_mime_message_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_mime_message_class);
- CamelMimePartClass *camel_mime_part_class = CAMEL_MIME_PART_CLASS (camel_mime_message_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_mime_message_class);
-
- parent_class = gtk_type_class (camel_mime_part_get_type ());
- _init_header_name_table();
-
- received_date_str = "";
- sent_date_str = "";
- reply_to_str = "Reply-To";
- subject_str = "Subject";
- from_str = "From";
-
- /* virtual method definition */
- camel_mime_message_class->set_received_date = _set_received_date;
- camel_mime_message_class->get_received_date = _get_received_date;
- camel_mime_message_class->get_sent_date = _get_sent_date;
- camel_mime_message_class->set_reply_to = _set_reply_to;
- camel_mime_message_class->get_reply_to = _get_reply_to;
- camel_mime_message_class->set_subject = _set_subject;
- camel_mime_message_class->get_subject = _get_subject;
- camel_mime_message_class->set_from = _set_from;
- camel_mime_message_class->get_from = _get_from;
- camel_mime_message_class->add_recipient = _add_recipient;
- camel_mime_message_class->remove_recipient = _remove_recipient;
- camel_mime_message_class->get_recipients = _get_recipients;
- camel_mime_message_class->set_flag = _set_flag;
- camel_mime_message_class->get_flag = _get_flag;
- camel_mime_message_class->get_flag_list = _get_flag_list;
- camel_mime_message_class->set_message_number = _set_message_number;
- camel_mime_message_class->get_message_number = _get_message_number;
-
- /* virtual method overload */
- camel_data_wrapper_class->write_to_stream = _write_to_stream;
- camel_mime_part_class->parse_header_pair = _parse_header_pair;
-
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-static void
-camel_mime_message_init (gpointer object, gpointer klass)
-{
- CamelMimeMessage *camel_mime_message = CAMEL_MIME_MESSAGE (object);
-
- camel_mime_message->recipients = camel_recipient_table_new ();
- camel_mime_message->flags = g_hash_table_new (g_strcase_hash, g_strcase_equal);
-
- camel_mime_message->received_date = NULL;
- camel_mime_message->sent_date = NULL;
- camel_mime_message->subject = NULL;
- camel_mime_message->reply_to = NULL;
- camel_mime_message->from = NULL;
- camel_mime_message->folder = NULL;
- camel_mime_message->session = NULL;
-}
-
-GtkType
-camel_mime_message_get_type (void)
-{
- static GtkType camel_mime_message_type = 0;
-
- if (!camel_mime_message_type) {
- GtkTypeInfo camel_mime_message_info =
- {
- "CamelMimeMessage",
- sizeof (CamelMimeMessage),
- sizeof (CamelMimeMessageClass),
- (GtkClassInitFunc) camel_mime_message_class_init,
- (GtkObjectInitFunc) camel_mime_message_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mime_message_type = gtk_type_unique (camel_mime_part_get_type (), &camel_mime_message_info);
- }
-
- return camel_mime_message_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelMimeMessage *message = CAMEL_MIME_MESSAGE (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMimeMessage::finalize\n");
- g_free (message->received_date);
- g_free (message->sent_date);
- g_free (message->subject);
- g_free (message->reply_to);
- g_free (message->from);
-
- if (message->recipients) camel_recipient_table_unref (message->recipients);
- if (message->folder) gtk_object_unref (GTK_OBJECT (message->folder));
- if (message->session) gtk_object_unref (GTK_OBJECT (message->session));
-
- if (message->flags)
- g_hash_table_foreach (message->flags, g_hash_table_generic_free, NULL);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMimeMessage::finalize\n");
-}
-
-
-
-CamelMimeMessage *
-camel_mime_message_new_with_session (CamelSession *session)
-{
- CamelMimeMessage *mime_message;
- mime_message = gtk_type_new (CAMEL_MIME_MESSAGE_TYPE);
- mime_message->session = session;
- if (session) gtk_object_ref (GTK_OBJECT (session));
-
- return mime_message;
-}
-
-
-/* some utils func */
-
-static void
-_set_field (CamelMimeMessage *mime_message, gchar *name, const gchar *value, gchar **variable)
-{
- if (variable) {
- g_free (*variable);
- *variable = g_strdup (value);
- }
-}
-
-/* for future use */
-/* for the moment, only @variable is used */
-static gchar *
-_get_field (CamelMimeMessage *mime_message, gchar *name, gchar *variable)
-{
- return variable;
-}
-
-static gboolean
-_check_not_expunged (CamelMimeMessage *mime_message)
-{
- if (mime_message->expunged) {
- CAMEL_LOG_WARNING ("CamelMimeMessage:: An invalid operation has been tempted on an expunged message\n");
- }
- return (!mime_message->expunged);
-}
-
-/* * */
-
-
-static void
-_set_received_date (CamelMimeMessage *mime_message, const gchar *received_date)
-{
- _set_field (mime_message, received_date_str, received_date, &(mime_message->received_date));
-}
-
-void
-camel_mime_message_set_received_date (CamelMimeMessage *mime_message, const gchar *received_date)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->set_received_date (mime_message, received_date);
-}
-
-
-static const gchar *
-_get_received_date (CamelMimeMessage *mime_message)
-{
- return _get_field (mime_message, received_date_str, mime_message->received_date);
-}
-
-const gchar *
-camel_mime_message_get_received_date (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_received_date (mime_message);
-}
-
-
-static const gchar *
-_get_sent_date (CamelMimeMessage *mime_message)
-{
- return _get_field (mime_message, sent_date_str, mime_message->sent_date);
-}
-
-const gchar *
-camel_mime_message_get_sent_date (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_sent_date (mime_message);
-}
-
-
-static void
-_set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to)
-{
- _set_field (mime_message, reply_to_str, reply_to, &(mime_message->reply_to));
-}
-
-void
-camel_mime_message_set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->set_reply_to (mime_message, reply_to);
-}
-
-
-static const gchar *
-_get_reply_to (CamelMimeMessage *mime_message)
-{
- return _get_field (mime_message, reply_to_str, mime_message->reply_to);
-}
-
-const gchar *
-camel_mime_message_get_reply_to (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_reply_to (mime_message);
-}
-
-
-
-
-static void
-_set_subject (CamelMimeMessage *mime_message, const gchar *subject)
-{
- _set_field (mime_message, subject_str, subject, &(mime_message->subject));
-}
-
-void
-camel_mime_message_set_subject (CamelMimeMessage *mime_message,
- const gchar *subject)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->set_subject (mime_message, subject);
-}
-
-
-static const gchar *
-_get_subject (CamelMimeMessage *mime_message)
-{
- return _get_field (mime_message, subject_str, mime_message->subject);
-}
-
-const gchar *
-camel_mime_message_get_subject (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_subject (mime_message);
-}
-
-
-
-
-static void
-_set_from (CamelMimeMessage *mime_message, const gchar *from)
-{
- _set_field (mime_message, from_str, from, &(mime_message->from));
-}
-
-void
-camel_mime_message_set_from (CamelMimeMessage *mime_message, const gchar *from)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->set_from (mime_message, from);
-}
-
-
-static const gchar *
-_get_from (CamelMimeMessage *mime_message)
-{
- return _get_field (mime_message, from_str, mime_message->from);
-}
-
-const gchar *
-camel_mime_message_get_from (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_from (mime_message);
-}
-
-
-
-
-
-
-
-/* **** */
-
-
-
-
-
-static void
-_add_recipient (CamelMimeMessage *mime_message,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- camel_recipient_table_add (mime_message->recipients, recipient_type, recipient);
-}
-
-
-
-void
-camel_mime_message_add_recipient (CamelMimeMessage *mime_message,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->add_recipient (mime_message, recipient_type, recipient);
-}
-
-
-static void
-_remove_recipient (CamelMimeMessage *mime_message,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- camel_recipient_table_remove (mime_message->recipients, recipient_type, recipient);
-}
-
-
-void
-camel_mime_message_remove_recipient (CamelMimeMessage *mime_message,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->remove_recipient (mime_message, recipient_type, recipient);
-}
-
-
-static const GList *
-_get_recipients (CamelMimeMessage *mime_message,
- const gchar *recipient_type)
-{
- return camel_recipient_table_get (mime_message->recipients, recipient_type);
-}
-
-
-const GList *
-camel_mime_message_get_recipients (CamelMimeMessage *mime_message,
- const gchar *recipient_type)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_recipients (mime_message, recipient_type);
-}
-
-
-
-/* **** */
-
-
-
-static void
-_set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value)
-{
- gchar *old_flags;
- gboolean ptr_value;
-
- if (! g_hash_table_lookup_extended (mime_message->flags,
- flag,
- (gpointer)&(old_flags),
- (gpointer)&(ptr_value)) ) {
-
- g_hash_table_insert (mime_message->flags, g_strdup (flag), GINT_TO_POINTER (value));
- } else
- g_hash_table_insert (mime_message->flags, old_flags, GINT_TO_POINTER (value));
-
-}
-
-void
-camel_mime_message_set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value)
-{
- g_assert (mime_message);
- g_return_if_fail (_check_not_expunged (mime_message));
- CMM_CLASS (mime_message)->set_flag (mime_message, flag, value);
-}
-
-
-
-static gboolean
-_get_flag (CamelMimeMessage *mime_message, const gchar *flag)
-{
- return GPOINTER_TO_INT (g_hash_table_lookup (mime_message->flags, flag));
-}
-
-gboolean
-camel_mime_message_get_flag (CamelMimeMessage *mime_message, const gchar *flag)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), FALSE);
- return CMM_CLASS (mime_message)->get_flag (mime_message, flag);
-}
-
-
-
-static void
-_add_flag_to_list (gpointer key, gpointer value, gpointer user_data)
-{
- GList **flag_list = (GList **)user_data;
- gchar *flag_name = (gchar *)key;
-
- if ((flag_name) && (flag_name[0] != '\0'))
- *flag_list = g_list_append (*flag_list, flag_name);
-}
-
-static GList *
-_get_flag_list (CamelMimeMessage *mime_message)
-{
- GList *flag_list = NULL;
-
- if (mime_message->flags)
- g_hash_table_foreach (mime_message->flags, _add_flag_to_list, &flag_list);
- return flag_list;
-}
-
-
-GList *
-camel_mime_message_get_flag_list (CamelMimeMessage *mime_message)
-{
- g_assert (mime_message);
- g_return_val_if_fail (_check_not_expunged (mime_message), NULL);
- return CMM_CLASS (mime_message)->get_flag_list (mime_message);
-}
-
-
-
-static void
-_set_message_number (CamelMimeMessage *mime_message, guint number)
-{
- mime_message->message_number = number;
-}
-
-static guint
-_get_message_number (CamelMimeMessage *mime_message)
-{
- return mime_message->message_number;
-}
-
-
-
-guint
-camel_mime_message_get_message_number (CamelMimeMessage *mime_message)
-{
- return CMM_CLASS (mime_message)->get_message_number (mime_message);
-}
-
-
-
-
-#ifdef WHPT
-#warning : WHPT is already defined !!!!!!
-#endif
-#define WHPT gmime_write_header_pair_to_stream
-
-static void
-_write_one_recipient_to_stream (gchar *recipient_type,
- GList *recipient_list,
- gpointer user_data)
-{
-
- CamelStream *stream = (CamelStream *)user_data;
- if (recipient_type)
- gmime_write_header_with_glist_to_stream (stream, recipient_type, recipient_list, ", ");
-}
-
-static void
-_write_recipients_to_stream (CamelMimeMessage *mime_message, CamelStream *stream)
-{
- camel_recipient_foreach_recipient_type (mime_message->recipients,
- _write_one_recipient_to_stream,
- (gpointer)stream);
-}
-
-static void
-_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMimeMessage *mm = CAMEL_MIME_MESSAGE (data_wrapper);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage::write_to_stream\n");
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing \"From\"\n");
- WHPT (stream, "From", mm->from);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing \"Reply-To\"\n");
- WHPT (stream, "Reply-To", mm->reply_to);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing recipients\n");
- _write_recipients_to_stream (mm, stream);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing \"Date\"\n");
- WHPT (stream, "Date", mm->received_date);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing \"Subject\"\n");
- WHPT (stream, "Subject", mm->subject);
-
- /* FIXME correct to do it here? */
- CAMEL_LOG_FULL_DEBUG ( "CamelMimeMessage:: Writing \"Mime-Version\"\n");
- WHPT (stream, "Mime-Version", "1.0");
-
- CAMEL_DATA_WRAPPER_CLASS (parent_class)->write_to_stream (data_wrapper, stream);
-
-}
-
-/*******************************/
-/* mime message header parsing */
-
-static void
-_set_recipient_list_from_string (CamelMimeMessage *message, gchar *recipient_type, gchar *recipients_string)
-{
- GList *recipients_list;
- CAMEL_LOG_FULL_DEBUG ("CamelMimeMessage::_set_recipient_list_from_string parsing ##%s##\n", recipients_string);
- recipients_list = string_split (
- recipients_string, ',', "\t ",
- STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING);
- camel_recipient_table_add_list (message->recipients, recipient_type, recipients_list);
-
-}
-
-static gboolean
-_parse_header_pair (CamelMimePart *mime_part, gchar *header_name, gchar *header_value)
-{
- CamelHeaderType header_type;
- CamelMimeMessage *message = CAMEL_MIME_MESSAGE (mime_part);
- gboolean header_handled = FALSE;
-
-
- header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, header_name);
- switch (header_type) {
-
- case HEADER_FROM:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_FROM : %s\n",
- header_value );
-
- camel_mime_message_set_from (message, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_REPLY_TO:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_REPLY_YO : %s\n",
- header_value );
-
- camel_mime_message_set_reply_to (message, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_SUBJECT:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_SUBJECT : %s\n",
- header_value );
-
- camel_mime_message_set_subject (message, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_TO:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_TO : %s\n",
- header_value );
-
- _set_recipient_list_from_string (message, "To", header_value);
- g_free (header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_CC:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_CC : %s\n",
- header_value );
-
- _set_recipient_list_from_string (message, "Cc", header_value);
- g_free (header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_BCC:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimeMessage::parse_header_pair found HEADER_BCC : %s\n",
- header_value );
-
- _set_recipient_list_from_string (message, "Bcc", header_value);
- g_free (header_value);
- header_handled = TRUE;
- break;
-
-
- }
- if (header_handled) {
- g_free (header_name);
- return TRUE;
- } else
- return parent_class->parse_header_pair (mime_part, header_name, header_value);
-
-
-}
-
diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h
deleted file mode 100644
index 69cf840a62..0000000000
--- a/camel/camel-mime-message.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelMimeMessage.h : class for a mime message */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MIME_MESSAGE_H
-#define CAMEL_MIME_MESSAGE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-typedef struct _CamelMimeMessage CamelMimeMessage;
-
-#include <gtk/gtk.h>
-#include "camel-mime-part.h"
-#include "camel-folder.h"
-#include "camel-session.h"
-#include "camel-recipient.h"
-
-
-#define CAMEL_RECIPIENT_TYPE_TO "To"
-#define CAMEL_RECIPIENT_TYPE_CC "Cc"
-#define CAMEL_RECIPIENT_TYPE_BCC "Bcc"
-
-
-#define CAMEL_MIME_MESSAGE_TYPE (camel_mime_message_get_type ())
-#define CAMEL_MIME_MESSAGE(obj) (GTK_CHECK_CAST((obj), CAMEL_MIME_MESSAGE_TYPE, CamelMimeMessage))
-#define CAMEL_MIME_MESSAGE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MIME_MESSAGE_TYPE, CamelMimeMessageClass))
-#define CAMEL_IS_MIME_MESSAGE(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_MESSAGE_TYPE))
-
-
-
-struct _CamelMimeMessage
-{
- CamelMimePart parent_object;
-
- /* header fields */
- gchar *received_date;
- gchar *sent_date;
-
- gchar *subject;
- gchar *reply_to;
-
- gchar *from;
- CamelRecipientTable *recipients;
-
- /* other fields */
- GHashTable *flags; /* boolean values */
- gboolean expunged;
-
- guint message_number; /* set by folder object when retrieving message */
- gchar *message_uid;
-
- CamelFolder *folder;
- CamelSession *session;
-
-};
-
-
-
-typedef struct {
- CamelMimePartClass parent_class;
-
- /* Virtual methods */
- void (*set_received_date) (CamelMimeMessage *mime_message, gchar *received_date);
- const gchar * (*get_received_date) (CamelMimeMessage *mime_message);
- const gchar * (*get_sent_date) (CamelMimeMessage *mime_message);
- void (*set_reply_to) (CamelMimeMessage *mime_message, const gchar *reply_to);
- const gchar * (*get_reply_to) (CamelMimeMessage *mime_message);
- void (*set_subject) (CamelMimeMessage *mime_message, const gchar *subject);
- const gchar * (*get_subject) (CamelMimeMessage *mime_message);
- void (*set_from) (CamelMimeMessage *mime_message, const gchar *from);
- const gchar * (*get_from) (CamelMimeMessage *mime_message);
- void (*add_recipient) (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
- void (*remove_recipient) (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
- const GList * (*get_recipients) (CamelMimeMessage *mime_message, const gchar *recipient_type);
- void (*set_flag) (CamelMimeMessage *mime_message, const gchar *flag, gboolean value);
- gboolean (*get_flag) (CamelMimeMessage *mime_message, const gchar *flag);
- GList * (*get_flag_list) (CamelMimeMessage *mime_message);
- void (*set_message_number)(CamelMimeMessage *mime_message, guint number);
- guint (*get_message_number)(CamelMimeMessage *mime_message);
-} CamelMimeMessageClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_mime_message_get_type (void);
-
-
-/* public methods */
-CamelMimeMessage *camel_mime_message_new_with_session (CamelSession *session);
-
-
-void camel_mime_message_set_received_date (CamelMimeMessage *mime_message, const gchar *received_date);
-const gchar *camel_mime_message_get_received_date (CamelMimeMessage *mime_message);
-const gchar *camel_mime_message_get_sent_date (CamelMimeMessage *mime_message);
-void camel_mime_message_set_reply_to (CamelMimeMessage *mime_message, const gchar *reply_to);
-const gchar *camel_mime_message_get_reply_to (CamelMimeMessage *mime_message);
-void camel_mime_message_set_subject (CamelMimeMessage *mime_message, const gchar *subject);
-const gchar *camel_mime_message_get_subject (CamelMimeMessage *mime_message);
-void camel_mime_message_set_from (CamelMimeMessage *mime_message, const gchar *from);
-const gchar *camel_mime_message_get_from (CamelMimeMessage *mime_message);
-
-void camel_mime_message_add_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
-void camel_mime_message_remove_recipient (CamelMimeMessage *mime_message, const gchar *recipient_type, const gchar *recipient);
-const GList *camel_mime_message_get_recipients (CamelMimeMessage *mime_message, const gchar *recipient_type);
-
-void camel_mime_message_set_flag (CamelMimeMessage *mime_message, const gchar *flag, gboolean value);
-gboolean camel_mime_message_get_flag (CamelMimeMessage *mime_message, const gchar *flag);
-GList *camel_mime_message_get_flag_list (CamelMimeMessage *mime_message);
-
-guint camel_mime_message_get_message_number (CamelMimeMessage *mime_message);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_MESSAGE_H */
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
deleted file mode 100644
index 5e6d187a11..0000000000
--- a/camel/camel-mime-part-utils.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mime-part-utils : Utility for mime parsing and so on */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "gmime-utils.h"
-#include "camel-simple-data-wrapper.h"
-
-#include "camel-mime-part-utils.h"
-
-
-void
-camel_mime_part_construct_headers_from_stream (CamelMimePart *mime_part,
- CamelStream *stream)
-{
- GArray *header_array;
- Rfc822Header *cur_header;
- int i;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils:: "
- "Entering _construct_headers_from_stream\n");
- g_assert (stream);
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_headers_from_stream "
- "parsing headers\n");
- /*
- * parse all header lines
- */
- header_array = get_header_array_from_stream (stream);
- if (header_array) {
- for (i=0; i<header_array->len; i++) {
- cur_header = (Rfc822Header *)header_array->data + i;
- camel_medium_add_header ( CAMEL_MEDIUM (mime_part),
- cur_header->name,
- cur_header->value);
- }
-
- g_array_free (header_array, TRUE);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_headers_from_stream "
- "headers parsed. Leaving \n");
- }
-}
-
-
-
-
-
-void
-camel_mime_part_construct_content_from_stream (CamelMimePart *mime_part,
- CamelStream *stream)
-{
- GMimeContentField *content_type = NULL;
- gchar *mime_type = NULL;
- GtkType content_object_type;
- CamelDataWrapper *content_object = NULL;
-
- /*
- * find content mime type
- */
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream "
- "parsing content\n");
-
- content_type = camel_mime_part_get_content_type (mime_part);
- if (content_type)
- mime_type = gmime_content_field_get_mime_type (content_type);
-
- /*
- * no mime type found for the content,
- * using text/plain is the default
- */
- if (!mime_type) {
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream "
- "content type field not found "
- "using default \"text/plain\"\n");
- mime_type = g_strdup ("text/plain");
- camel_mime_part_set_content_type (mime_part, mime_type);
- }
-
- /*
- * find in the repository what particular data wrapper is
- * associated to this mime type
- */
- content_object_type =
- data_wrapper_repository_get_data_wrapper_type (mime_type);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_content_from_stream content"
- " type object type used: %s\n",
- gtk_type_name (content_object_type));
-
- g_free (mime_type);
-
- content_object = CAMEL_DATA_WRAPPER (gtk_type_new (content_object_type));
- camel_data_wrapper_set_mime_type_field (content_object,
- camel_mime_part_get_content_type (mime_part));
- camel_medium_set_content_object ( CAMEL_MEDIUM (mime_part), content_object);
- camel_data_wrapper_construct_from_stream (content_object, stream);
-
- /*
- * the object is referenced in the set_content_object method,
- * so unref it here
- */
- gtk_object_unref (GTK_OBJECT (content_object));
-
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::construct_from_stream "
- "content parsed\n");
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils:: Leaving _construct_from_stream\n");
-}
-
-
-
-void
-camel_mime_part_store_stream_in_buffer (CamelMimePart *mime_part,
- CamelStream *stream)
-{
- gint nb_bytes_read_total = 0;
- gint nb_bytes_read_chunk;
- GByteArray *buffer;
-#define STREAM_READ_CHUNK_SZ 100
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::store_stream_in_buffer entering\n");
-
- if (mime_part->temp_message_buffer == NULL)
- mime_part->temp_message_buffer = g_byte_array_new ();
-
- buffer = mime_part->temp_message_buffer;
-
- g_byte_array_set_size (buffer, nb_bytes_read_total + STREAM_READ_CHUNK_SZ);
- nb_bytes_read_chunk = camel_stream_read (stream,
- buffer->data + nb_bytes_read_total,
- STREAM_READ_CHUNK_SZ);
- nb_bytes_read_total += nb_bytes_read_chunk;
-
- while (nb_bytes_read_chunk >0) {
- g_byte_array_set_size (buffer, nb_bytes_read_total + STREAM_READ_CHUNK_SZ);
- nb_bytes_read_chunk = camel_stream_read (stream,
- buffer->data + nb_bytes_read_total,
- STREAM_READ_CHUNK_SZ);
- nb_bytes_read_total += nb_bytes_read_chunk;
- }
-
- g_byte_array_set_size (buffer, nb_bytes_read_total);
- CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::store_stream_in_buffer entering\n");
-
-}
diff --git a/camel/camel-mime-part-utils.h b/camel/camel-mime-part-utils.h
deleted file mode 100644
index 7edbf5d603..0000000000
--- a/camel/camel-mime-part-utils.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mime-part-utils : Utility for mime parsing and so on */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef CAMEL_MIME_PART_UTILS_H
-#define CAMEL_MIME_PART_UTILS_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-mime-part.h"
-
-
-void camel_mime_part_construct_headers_from_stream (CamelMimePart *mime_part,
- CamelStream *stream);
-
-void camel_mime_part_construct_content_from_stream (CamelMimePart *mime_part,
- CamelStream *stream);
-
-void camel_mime_part_store_stream_in_buffer (CamelMimePart *mime_part,
- CamelStream *stream);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_PART_UTILS_H */
-
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
deleted file mode 100644
index 874400deb8..0000000000
--- a/camel/camel-mime-part.c
+++ /dev/null
@@ -1,865 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelMimePart.c : Abstract class for a mime_part */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-mime-part.h"
-#include <stdio.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "gmime-utils.h"
-#include "camel-simple-data-wrapper.h"
-#include "hash-table-utils.h"
-#include "camel-stream-mem.h"
-
-typedef enum {
- HEADER_UNKNOWN,
- HEADER_DESCRIPTION,
- HEADER_DISPOSITION,
- HEADER_CONTENT_ID,
- HEADER_ENCODING,
- HEADER_CONTENT_MD5,
- HEADER_CONTENT_LANGUAGES,
- HEADER_CONTENT_TYPE
-} CamelHeaderType;
-
-
-static GHashTable *header_name_table;
-
-
-static CamelMediumClass *parent_class=NULL;
-
-/* Returns the class for a CamelMimePart */
-#define CMP_CLASS(so) CAMEL_MIME_PART_CLASS (GTK_OBJECT(so)->klass)
-
-/* from GtkObject */
-static void _finalize (GtkObject *object);
-
-/* from CamelDataWrapper */
-static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-
-/* from CamelMedia */
-static void _add_header (CamelMedium *medium, gchar *header_name, gchar *header_value);
-
-static void _set_content_object (CamelMedium *medium, CamelDataWrapper *content);
-static CamelDataWrapper *_get_content_object (CamelMedium *medium);
-
-/* CamelMimePart methods */
-static void _set_description (CamelMimePart *mime_part, const gchar *description);
-static const gchar *_get_description (CamelMimePart *mime_part);
-static void _set_disposition (CamelMimePart *mime_part, const gchar *disposition);
-static const gchar *_get_disposition (CamelMimePart *mime_part);
-static void _set_filename (CamelMimePart *mime_part, gchar *filename);
-static const gchar *_get_filename (CamelMimePart *mime_part);
-static void _set_content_id (CamelMimePart *mime_part, gchar *content_id);
-static const gchar *_get_content_id (CamelMimePart *mime_part);
-static void _set_content_MD5 (CamelMimePart *mime_part, gchar *content_MD5);
-static const gchar *_get_content_MD5 (CamelMimePart *mime_part);
-static void _set_encoding (CamelMimePart *mime_part, CamelMimePartEncodingType encoding);
-static CamelMimePartEncodingType _get_encoding (CamelMimePart *mime_part);
-static void _set_content_languages (CamelMimePart *mime_part, GList *content_languages);
-static const GList *_get_content_languages (CamelMimePart *mime_part);
-static void _set_header_lines (CamelMimePart *mime_part, GList *header_lines);
-static const GList *_get_header_lines (CamelMimePart *mime_part);
-static void _set_content_type (CamelMimePart *mime_part, const gchar *content_type);
-static GMimeContentField *_get_content_type (CamelMimePart *mime_part);
-
-static gboolean _parse_header_pair (CamelMimePart *mime_part, gchar *header_name, gchar *header_value);
-
-
-
-/* loads in a hash table the set of header names we */
-/* recognize and associate them with a unique enum */
-/* identifier (see CamelHeaderType above) */
-static void
-_init_header_name_table()
-{
- header_name_table = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- g_hash_table_insert (header_name_table, "Content-Description", (gpointer)HEADER_DESCRIPTION);
- g_hash_table_insert (header_name_table, "Content-Disposition", (gpointer)HEADER_DISPOSITION);
- g_hash_table_insert (header_name_table, "Content-id", (gpointer)HEADER_CONTENT_ID);
- g_hash_table_insert (header_name_table, "Content-Transfer-Encoding", (gpointer)HEADER_ENCODING);
- g_hash_table_insert (header_name_table, "Content-MD5", (gpointer)HEADER_CONTENT_MD5);
- g_hash_table_insert (header_name_table, "Content-Type", (gpointer)HEADER_CONTENT_TYPE);
-
-}
-
-static void
-camel_mime_part_class_init (CamelMimePartClass *camel_mime_part_class)
-{
- CamelMediumClass *camel_medium_class = CAMEL_MEDIUM_CLASS (camel_mime_part_class);
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_mime_part_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_data_wrapper_class);
-
- parent_class = gtk_type_class (camel_medium_get_type ());
- _init_header_name_table();
-
- /* virtual method definition */
- camel_mime_part_class->set_description = _set_description;
- camel_mime_part_class->get_description = _get_description;
- camel_mime_part_class->set_disposition = _set_disposition;
- camel_mime_part_class->get_disposition = _get_disposition;
- camel_mime_part_class->set_filename = _set_filename;
- camel_mime_part_class->get_filename = _get_filename;
- camel_mime_part_class->set_content_id = _set_content_id;
- camel_mime_part_class->get_content_id = _get_content_id;
- camel_mime_part_class->set_content_MD5 =_set_content_MD5;
- camel_mime_part_class->get_content_MD5 = _get_content_MD5;
- camel_mime_part_class->set_encoding = _set_encoding;
- camel_mime_part_class->get_encoding = _get_encoding;
- camel_mime_part_class->set_content_languages = _set_content_languages;
- camel_mime_part_class->get_content_languages = _get_content_languages;
- camel_mime_part_class->set_header_lines =_set_header_lines;
- camel_mime_part_class->get_header_lines =_get_header_lines;
- camel_mime_part_class->set_content_type = _set_content_type;
- camel_mime_part_class->get_content_type = _get_content_type;
-
- camel_mime_part_class->parse_header_pair = _parse_header_pair;
-
- /* virtual method overload */
- camel_medium_class->add_header = _add_header;
- camel_medium_class->set_content_object = _set_content_object;
- camel_medium_class->get_content_object = _get_content_object;
-
- camel_data_wrapper_class->write_to_stream = _write_to_stream;
- camel_data_wrapper_class->construct_from_stream = _construct_from_stream;
-
- gtk_object_class->finalize = _finalize;
-}
-
-static void
-camel_mime_part_init (gpointer object, gpointer klass)
-{
- CamelMimePart *camel_mime_part = CAMEL_MIME_PART (object);
-
- camel_mime_part->content_type = gmime_content_field_new (NULL, NULL);
- camel_mime_part->description = NULL;
- camel_mime_part->disposition = NULL;
- camel_mime_part->content_id = NULL;
- camel_mime_part->content_MD5 = NULL;
- camel_mime_part->content_languages = NULL;
- camel_mime_part->encoding = CAMEL_MIME_PART_ENCODING_DEFAULT;
- camel_mime_part->filename = NULL;
- camel_mime_part->header_lines = NULL;
-
- camel_mime_part->temp_message_buffer = NULL;
-
-}
-
-
-
-
-GtkType
-camel_mime_part_get_type (void)
-{
- static GtkType camel_mime_part_type = 0;
-
- if (!camel_mime_part_type) {
- GtkTypeInfo camel_mime_part_info =
- {
- "CamelMimePart",
- sizeof (CamelMimePart),
- sizeof (CamelMimePartClass),
- (GtkClassInitFunc) camel_mime_part_class_init,
- (GtkObjectInitFunc) camel_mime_part_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mime_part_type = gtk_type_unique (camel_medium_get_type (), &camel_mime_part_info);
- }
-
- return camel_mime_part_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (object);
-
-#warning do something for (mime_part->disposition) which should not be a GMimeContentField
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMimePart::finalize\n");
-
-
-
- g_free (mime_part->description);
- gmime_content_field_unref (mime_part->disposition);
- g_free (mime_part->content_id);
- g_free (mime_part->content_MD5);
- string_list_free (mime_part->content_languages);
- g_free (mime_part->filename);
- if (mime_part->header_lines) string_list_free (mime_part->header_lines);
-
- if (mime_part->content_type) gmime_content_field_unref (mime_part->content_type);
- if (mime_part->temp_message_buffer) g_byte_array_free (mime_part->temp_message_buffer, TRUE);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMimePart::finalize\n");
-}
-
-
-/* **** */
-
-static void
-_add_header (CamelMedium *medium, gchar *header_name, gchar *header_value)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (medium);
- gboolean header_exists;
- gchar *old_header_name;
- gchar *old_header_value;
-
- /* Try to parse the header pair. If it corresponds to something */
- /* known, the job is done in the parsing routine. If not, */
- /* we simply add the header in a raw fashion */
- if (! CMP_CLASS(mime_part)->parse_header_pair (mime_part, header_name, header_value) )
- parent_class->add_header (medium, header_name, header_value);
-}
-
-
-
-
-
-
-static void
-_set_description (CamelMimePart *mime_part, const gchar *description)
-{
- g_free (mime_part->description);
- mime_part->description = g_strdup (description);
-}
-
-void
-camel_mime_part_set_description (CamelMimePart *mime_part, const gchar *description)
-{
- CMP_CLASS(mime_part)->set_description (mime_part, description);
-}
-
-
-
-/* **** */
-
-
-
-static const gchar *
-_get_description (CamelMimePart *mime_part)
-{
- return mime_part->description;
-}
-
-const gchar *
-camel_mime_part_get_description (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_description (mime_part);
-}
-
-
-
-/* **** */
-
-
-static void
-_set_disposition (CamelMimePart *mime_part, const gchar *disposition)
-{
-#warning Do not use MimeContentfield here !!!
-
- if (mime_part->disposition) g_free ((mime_part->disposition)->type);
- g_free (mime_part->disposition);
-
- mime_part->disposition = g_new0 (GMimeContentField,1);
- (mime_part->disposition)->type = g_strdup (disposition);
-}
-
-
-void
-camel_mime_part_set_disposition (CamelMimePart *mime_part, const gchar *disposition)
-{
- CMP_CLASS(mime_part)->set_disposition (mime_part, disposition);
-}
-
-
-/* **** */
-
-
-
-static const gchar *
-_get_disposition (CamelMimePart *mime_part)
-{
- if (!mime_part->disposition) return NULL;
- return (mime_part->disposition)->type;
-}
-
-
-const gchar *
-camel_mime_part_get_disposition (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_disposition (mime_part);
-}
-
-
-
-static void
-_set_filename (CamelMimePart *mime_part, gchar *filename)
-{
- g_free(mime_part->filename);
- mime_part->filename = filename;
-}
-
-
-void
-camel_mime_part_set_filename (CamelMimePart *mime_part, gchar *filename)
-{
- CMP_CLASS(mime_part)->set_filename (mime_part, filename);
-}
-
-
-
-/* **** */
-
-
-static const gchar *
-_get_filename (CamelMimePart *mime_part)
-{
- return mime_part->filename;
-}
-
-
-const gchar *
-camel_mime_part_get_filename (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_filename (mime_part);
-}
-
-
-/* **** */
-
-
-/* this routine must not be public */
-static void
-_set_content_id (CamelMimePart *mime_part, gchar *content_id)
-{
- g_free(mime_part->content_id);
- mime_part->content_id = content_id;
-}
-
-
-static const gchar *
-_get_content_id (CamelMimePart *mime_part)
-{
- return mime_part->content_id;
-}
-
-
-/* **** */
-
-
-const gchar *
-camel_mime_part_get_content_id (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_content_id (mime_part);
-}
-
-
-/* this routine must not be public */
-static void
-_set_content_MD5 (CamelMimePart *mime_part, gchar *content_MD5)
-{
- g_free(mime_part->content_MD5);
- mime_part->content_MD5 = content_MD5;
-}
-
-
-/* **** */
-
-
-static const gchar *
-_get_content_MD5 (CamelMimePart *mime_part)
-{
- return mime_part->content_MD5;
-}
-
-const gchar *
-camel_mime_part_get_content_MD5 (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_content_MD5 (mime_part);
-}
-
-
-/* **** */
-
-
-
-static void
-_set_encoding (CamelMimePart *mime_part, CamelMimePartEncodingType encoding)
-{
- mime_part->encoding = encoding;
-}
-
-void
-camel_mime_part_set_encoding (CamelMimePart *mime_part,
- CamelMimePartEncodingType encoding)
-{
- CMP_CLASS(mime_part)->set_encoding (mime_part, encoding);
-}
-
-
-/* **** */
-
-
-
-static CamelMimePartEncodingType
-_get_encoding (CamelMimePart *mime_part)
-{
- return mime_part->encoding;
-}
-
-const CamelMimePartEncodingType
-camel_mime_part_get_encoding (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_encoding (mime_part);
-}
-
-
-
-/* **** */
-
-
-
-static void
-_set_content_languages (CamelMimePart *mime_part, GList *content_languages)
-{
- if (mime_part->content_languages) string_list_free (mime_part->content_languages);
- mime_part->content_languages = content_languages;
-}
-
-void
-camel_mime_part_set_content_languages (CamelMimePart *mime_part, GList *content_languages)
-{
- CMP_CLASS(mime_part)->set_content_languages (mime_part, content_languages);
-}
-
-
-/* **** */
-
-
-
-static const GList *
-_get_content_languages (CamelMimePart *mime_part)
-{
- return mime_part->content_languages;
-}
-
-
-const GList *
-camel_mime_part_get_content_languages (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_content_languages (mime_part);
-}
-
-
-/* **** */
-
-
-
-static void
-_set_header_lines (CamelMimePart *mime_part, GList *header_lines)
-{
- if (mime_part->header_lines) string_list_free (mime_part->header_lines);
- mime_part->header_lines = header_lines;
-}
-
-void
-camel_mime_part_set_header_lines (CamelMimePart *mime_part, GList *header_lines)
-{
- CMP_CLASS(mime_part)->set_header_lines (mime_part, header_lines);
-}
-
-
-/* **** */
-
-
-
-static const GList *
-_get_header_lines (CamelMimePart *mime_part)
-{
- return mime_part->header_lines;
-}
-
-
-
-const GList *
-camel_mime_part_get_header_lines (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_header_lines (mime_part);
-}
-
-
-/* **** */
-
-
-
-static void
-_set_content_type (CamelMimePart *mime_part, const gchar *content_type)
-{
- g_assert (content_type);
- gmime_content_field_construct_from_string (mime_part->content_type, content_type);
-}
-
-void
-camel_mime_part_set_content_type (CamelMimePart *mime_part, gchar *content_type)
-{
- CMP_CLASS(mime_part)->set_content_type (mime_part, content_type);
-}
-
-/* **** */
-
-
-static GMimeContentField *
-_get_content_type (CamelMimePart *mime_part)
-{
- return mime_part->content_type;
-}
-
-GMimeContentField *
-camel_mime_part_get_content_type (CamelMimePart *mime_part)
-{
- return CMP_CLASS(mime_part)->get_content_type (mime_part);
-}
-
-/*********/
-
-
-
-static void
-_set_content_object (CamelMedium *medium, CamelDataWrapper *content)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (medium);
- GMimeContentField *object_content_field;
-
- parent_class->set_content_object (medium, content);
-
- object_content_field = camel_data_wrapper_get_mime_type_field (content);
- if (mime_part->content_type && (mime_part->content_type != object_content_field))
- gmime_content_field_unref (mime_part->content_type);
- mime_part->content_type = object_content_field;
- gmime_content_field_ref (object_content_field);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMimePart::set_content_object\n");
-
-}
-
-static CamelDataWrapper *
-_get_content_object (CamelMedium *medium)
-{
- CamelMimePart *mime_part = CAMEL_MIME_PART (medium);
- CamelStream *stream;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object entering\n");
- /*
- * test if there is not pending content stored in the
- * temporary buffer
- */
- if ((!medium->content ) && (mime_part->temp_message_buffer)) {
- stream = camel_stream_mem_new_with_buffer (mime_part->temp_message_buffer,
- CAMEL_STREAM_MEM_READ);
- camel_mime_part_construct_content_from_stream (mime_part, stream);
- /*
- * Beware : this will destroy the temp buffer as well
- */
- gtk_object_unref (GTK_OBJECT (stream));
- } else {
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object part has a pointer "
- "to a content object as well as a temp buffer\n");
- }
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object leaving\n");
-
- return parent_class->get_content_object (medium);
-
-}
-
-
-/* **** */
-
-
-
-
-/**********************************************************************/
-#ifdef WHPT
-#warning : WHPT is already defined !!!!!!
-#endif
-#define WHPT gmime_write_header_pair_to_stream
-
-
-static void
-_write_content_to_stream (CamelMimePart *mime_part, CamelStream *stream)
-{
- CamelMedium *medium = CAMEL_MEDIUM (mime_part);
- CamelStream *wrapper_stream;
- guint buffer_size;
- gchar *buffer;
- gchar *encoded_buffer;
-
- CamelDataWrapper *content = medium->content;
- CAMEL_LOG_FULL_DEBUG ( "Entering CamelMimePart::_write_content_to_stream\n");
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::_write_content_to_stream, content=%p\n", content);
- if (!content) return;
-
- switch (mime_part->encoding) {
- case CAMEL_MIME_PART_ENCODING_DEFAULT:
- case CAMEL_MIME_PART_ENCODING_7BIT:
- case CAMEL_MIME_PART_ENCODING_8BIT:
- camel_data_wrapper_write_to_stream (content, stream);
- break;
- case CAMEL_MIME_PART_ENCODING_BASE64:
- wrapper_stream = camel_data_wrapper_get_stream (content);
- if (wrapper_stream == NULL) {
- /* FIXME in this case, we should probably copy stuff
- in-memory and make sure things work anyway. */
- g_warning ("Class `%s' does not implement `get_stream'",
- gtk_type_name (GTK_OBJECT (content)->klass->type));
- }
- gmime_encode_base64 (wrapper_stream, stream);
- break;
- default:
- g_warning ("Encoding type `%s' not supported.",
- camel_mime_part_encoding_to_string
- (mime_part->encoding));
- }
-
- CAMEL_LOG_FULL_DEBUG ( "Leaving CamelMimePart::_write_content_to_stream\n");
-}
-
-
-
-
-
-static void
-_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMimePart *mp = CAMEL_MIME_PART (data_wrapper);
- CamelMedium *medium = CAMEL_MEDIUM (data_wrapper);
-
- CAMEL_LOG_FULL_DEBUG ( "Entering CamelMimePart::write_to_stream\n");
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-disposition\n");
- gmime_content_field_write_to_stream(mp->disposition, stream);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-transfer-encoding\n");
- WHPT (stream, "Content-Transfer-Encoding",
- camel_mime_part_encoding_to_string (mp->encoding));
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-description\n");
- WHPT (stream, "Content-Description", mp->description);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-MD5\n");
- WHPT (stream, "Content-MD5", mp->content_MD5);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-id\n");
- WHPT (stream, "Content-id", mp->content_id);
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-languages\n");
- gmime_write_header_with_glist_to_stream (stream, "Content-Language", mp->content_languages,", ");
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing other headers\n");
- gmime_write_header_table_to_stream (stream, medium->headers);
-
- CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::write_to_stream writing content-type\n");
- gmime_content_field_write_to_stream (mp->content_type, stream);
-
- camel_stream_write_string(stream,"\n");
- _write_content_to_stream (mp, stream);
-
-}
-
-
-
-/*******************************/
-/* mime part parsing */
-
-static gboolean
-_parse_header_pair (CamelMimePart *mime_part, gchar *header_name, gchar *header_value)
-{
- CamelHeaderType header_type;
- gboolean header_handled = FALSE;
-
-
- header_type = (CamelHeaderType) g_hash_table_lookup (header_name_table, header_name);
- switch (header_type) {
-
- case HEADER_DESCRIPTION:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_DESCRIPTION: %s\n",
- header_value );
-
- camel_mime_part_set_description (mime_part, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_DISPOSITION:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_DISPOSITION: %s\n",
- header_value);
-
- camel_mime_part_set_disposition (mime_part, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_CONTENT_ID:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_CONTENT_ID: %s\n",
- header_value);
-
- CMP_CLASS(mime_part)->set_content_id (mime_part, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_ENCODING:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_ENCODING: %s\n",
- header_value);
-
- camel_mime_part_set_encoding
- (mime_part,
- camel_mime_part_encoding_from_string (header_value));
- header_handled = TRUE;
- break;
-
- case HEADER_CONTENT_MD5:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_CONTENT_MD5: %s\n",
- header_value );
-
- CMP_CLASS(mime_part)->set_content_MD5 (mime_part, header_value);
- header_handled = TRUE;
- break;
-
- case HEADER_CONTENT_TYPE:
- CAMEL_LOG_FULL_DEBUG (
- "CamelMimePart::parse_header_pair found HEADER_CONTENT_TYPE: %s\n",
- header_value );
-
- gmime_content_field_construct_from_string (mime_part->content_type, header_value);
- header_handled = TRUE;
- break;
-
-
- }
-
-
- if (header_handled) {
- g_free (header_name);
- return TRUE;
- } else return FALSE;
-
-}
-
-
-static void
-_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
-
- CamelMimePart *mime_part = CAMEL_MIME_PART (data_wrapper);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_from_stream entering\n");
- camel_mime_part_construct_headers_from_stream (mime_part, stream);
-
- camel_mime_part_store_stream_in_buffer (mime_part, stream);
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::construct_from_stream leaving\n");
-
-}
-
-
-const gchar *
-camel_mime_part_encoding_to_string (CamelMimePartEncodingType encoding)
-{
- switch (encoding) {
- case CAMEL_MIME_PART_ENCODING_DEFAULT:
- case CAMEL_MIME_PART_ENCODING_7BIT:
- return "7bit";
- case CAMEL_MIME_PART_ENCODING_8BIT:
- return "8bit";
- case CAMEL_MIME_PART_ENCODING_BASE64:
- return "base64";
- case CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE:
- return "quoted-printable";
- }
-}
-
-
-/* FIXME I am not sure this is the correct way to do this. */
-CamelMimePartEncodingType
-camel_mime_part_encoding_from_string (const gchar *string)
-{
- if (strncmp (string, "7bit") == 0)
- return CAMEL_MIME_PART_ENCODING_7BIT;
- else if (strncmp (string, "8bit") == 0)
- return CAMEL_MIME_PART_ENCODING_8BIT;
- else if (strncmp (string, "base64") == 0)
- return CAMEL_MIME_PART_ENCODING_BASE64;
- else if (strncmp (string, "quoted-printable") == 0)
- return CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE;
- else
- /* FIXME? Spit a warning? */
- return CAMEL_MIME_PART_ENCODING_DEFAULT;
-}
-
-
-/******************************/
-/** Misc utility functions **/
-
-
-/**
- * camel_mime_part_set_text: set the content to be some text
- * @camel_mime_part: Mime part
- * @text: the text
- *
- * Utility function used to set the content of a mime part object to
- * be a text string. When @text is NULL, this routine can be used as
- * a way to remove old text content.
- *
- **/
-void
-camel_mime_part_set_text (CamelMimePart *camel_mime_part, const gchar *text)
-{
- CamelSimpleDataWrapper *simple_data_wrapper;
- CamelMedium *medium = CAMEL_MEDIUM (camel_mime_part);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart:: Entering set_text\n");
- CAMEL_LOG_TRACE ("CamelMimePart::set_text, setting text as a mime part content\n");
- if (medium->content) {
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_text unreferencing old content object\n");
- gtk_object_unref (GTK_OBJECT (medium->content));
- }
- if (text) {
- simple_data_wrapper = camel_simple_data_wrapper_new ();
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_text calling CamelSimpleDataWrapper:set_text with %d chars\n", strlen (text));
- camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (simple_data_wrapper), "text/plain");
- camel_simple_data_wrapper_set_text ( simple_data_wrapper, text);
- camel_medium_set_content_object ( CAMEL_MEDIUM (camel_mime_part), CAMEL_DATA_WRAPPER (simple_data_wrapper));
- gtk_object_unref (GTK_OBJECT (simple_data_wrapper));
- } else medium->content = NULL;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMimePart:: Leaving camel_mime_part_set_text\n");
-}
-
-
diff --git a/camel/camel-mime-part.h b/camel/camel-mime-part.h
deleted file mode 100644
index 573cf69576..0000000000
--- a/camel/camel-mime-part.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mime-part.h : class for a mime part */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MIME_PART_H
-#define CAMEL_MIME_PART_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-medium.h"
-#include "camel-stream.h"
-
-
-#define CAMEL_MIME_PART_TYPE (camel_mime_part_get_type ())
-#define CAMEL_MIME_PART(obj) (GTK_CHECK_CAST((obj), CAMEL_MIME_PART_TYPE, CamelMimePart))
-#define CAMEL_MIME_PART_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MIME_PART_TYPE, CamelMimePartClass))
-#define CAMEL_IS_MIME_PART(o) (GTK_CHECK_TYPE((o), CAMEL_MIME_PART_TYPE))
-
-
-enum _CamelMimePartEncodingType {
- CAMEL_MIME_PART_ENCODING_DEFAULT,
- CAMEL_MIME_PART_ENCODING_7BIT,
- CAMEL_MIME_PART_ENCODING_8BIT,
- CAMEL_MIME_PART_ENCODING_BASE64,
- CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE,
- CAMEL_MIME_PART_NUM_ENCODINGS
-};
-typedef enum _CamelMimePartEncodingType CamelMimePartEncodingType;
-
-
-/* Do not change these values directly, you
- would regret it one day */
-typedef struct
-{
- CamelMedium parent_object;
-
- /* All fields here are -** PRIVATE **- */
- gchar *description;
- GMimeContentField *disposition;
- gchar *content_id;
- gchar *content_MD5;
- GList *content_languages;
- CamelMimePartEncodingType encoding;
- gchar *filename;
- GList *header_lines;
-
- GByteArray *temp_message_buffer;
- GMimeContentField *content_type;
-
-} CamelMimePart;
-
-
-
-typedef struct {
- CamelMediumClass parent_class;
-
- /* Virtual methods */
- void (*set_description) (CamelMimePart *mime_part, const gchar *description);
- const gchar * (*get_description) (CamelMimePart *mime_part);
- void (*set_disposition) (CamelMimePart *mime_part, const gchar *disposition);
- const gchar * (*get_disposition) (CamelMimePart *mime_part);
- void (*set_filename) (CamelMimePart *mime_part, gchar *filename);
- const gchar * (*get_filename) (CamelMimePart *mime_part);
- void (*set_content_id) (CamelMimePart *mime_part, gchar *content_id);
- const gchar * (*get_content_id) (CamelMimePart *mime_part);
- void (*set_content_MD5) (CamelMimePart *mime_part, gchar *content_MD5);
- const gchar * (*get_content_MD5) (CamelMimePart *mime_part);
- void (*set_encoding) (CamelMimePart *mime_part, CamelMimePartEncodingType type);
- const CamelMimePartEncodingType (*get_encoding) (CamelMimePart *mime_part);
- void (*set_content_languages) (CamelMimePart *mime_part, GList *content_languages);
- const GList * (*get_content_languages) (CamelMimePart *mime_part);
- void (*set_header_lines) (CamelMimePart *mime_part, GList *header_lines);
- const GList * (*get_header_lines) (CamelMimePart *mime_part);
-
- void (*set_content_type) (CamelMimePart *mime_part, const gchar *content_type);
- GMimeContentField * (*get_content_type) (CamelMimePart *mime_part);
-
- gboolean (*parse_header_pair) (CamelMimePart *mime_part, gchar *header_name, gchar *header_value);
-
-
-} CamelMimePartClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_mime_part_get_type (void);
-
-
-/* public methods */
-void camel_mime_part_set_description (CamelMimePart *mime_part,
- const gchar *description);
-const gchar *camel_mime_part_get_description (CamelMimePart *mime_part);
-void camel_mime_part_set_disposition (CamelMimePart *mime_part,
- const gchar *disposition);
-const gchar *camel_mime_part_get_disposition (CamelMimePart *mime_part);
-void camel_mime_part_set_filename (CamelMimePart *mime_part,
- gchar *filename);
-const gchar *camel_mime_part_get_filename (CamelMimePart *mime_part);
-const gchar *camel_mime_part_get_content_id (CamelMimePart *mime_part);
-const gchar *camel_mime_part_get_content_MD5 (CamelMimePart *mime_part);
-void camel_mime_part_set_encoding (CamelMimePart *mime_part,
- CamelMimePartEncodingType type);
-CamelMimePartEncodingType camel_mime_part_get_encoding (CamelMimePart *mime_part);
-void camel_mime_part_set_content_languages (CamelMimePart *mime_part,
- GList *content_languages);
-const GList *camel_mime_part_get_content_languages (CamelMimePart *mime_part);
-void camel_mime_part_set_header_lines (CamelMimePart *mime_part,
- GList *header_lines);
-const GList *camel_mime_part_get_header_lines (CamelMimePart *mime_part);
-
-GMimeContentField *camel_mime_part_get_content_type (CamelMimePart *mime_part);
-
-const gchar *camel_mime_part_encoding_to_string (CamelMimePartEncodingType encoding);
-CamelMimePartEncodingType camel_mime_part_encoding_from_string (const gchar *string);
-
-/* utility functions */
-void camel_mime_part_set_text (CamelMimePart *camel_mime_part, const gchar *text);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MIME_PART_H */
-
diff --git a/camel/camel-multipart.c b/camel/camel-multipart.c
deleted file mode 100644
index 9b6734f011..0000000000
--- a/camel/camel-multipart.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-multipart.c : Abstract class for a multipart */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel-multipart.h"
-#include "camel-log.h"
-#include "gmime-content-field.h"
-#include "gmime-utils.h"
-#include "camel-stream-mem.h"
-
-
-static void _add_part (CamelMultipart *multipart, CamelMimeBodyPart *part);
-static void _add_part_at (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index);
-static void _remove_part (CamelMultipart *multipart, CamelMimeBodyPart *part);
-static CamelMimeBodyPart *_remove_part_at (CamelMultipart *multipart, guint index);
-static CamelMimeBodyPart *_get_part (CamelMultipart *multipart, guint index);
-static guint _get_number (CamelMultipart *multipart);
-static void _set_parent (CamelMultipart *multipart, CamelMimePart *parent);
-static CamelMimePart *_get_parent (CamelMultipart *multipart);
-static void _set_boundary (CamelMultipart *multipart, gchar *boundary);
-static const gchar *_get_boundary (CamelMultipart *multipart);
-static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-
-static void _finalize (GtkObject *object);
-
-static CamelDataWrapperClass *parent_class=NULL;
-
-/* Returns the class for a CamelMultipart */
-#define CMP_CLASS(so) CAMEL_MULTIPART_CLASS (GTK_OBJECT(so)->klass)
-
-/* Returns the class for a CamelDataWrapper */
-#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void
-camel_multipart_class_init (CamelMultipartClass *camel_multipart_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_multipart_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_multipart_class);
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
-
- /* virtual method definition */
- camel_multipart_class->add_part = _add_part;
- camel_multipart_class->add_part_at = _add_part_at;
- camel_multipart_class->remove_part = _remove_part;
- camel_multipart_class->remove_part_at = _remove_part_at;
- camel_multipart_class->get_part = _get_part;
- camel_multipart_class->get_number = _get_number;
- camel_multipart_class->set_parent = _set_parent;
- camel_multipart_class->get_parent = _get_parent;
- camel_multipart_class->set_boundary = _set_boundary;
- camel_multipart_class->get_boundary = _get_boundary;
-
- /* virtual method overload */
- camel_data_wrapper_class->write_to_stream = _write_to_stream;
- camel_data_wrapper_class->construct_from_stream = _construct_from_stream;
-
- gtk_object_class->finalize = _finalize;
-}
-
-static void
-camel_multipart_init (gpointer object, gpointer klass)
-{
- CamelMultipart *multipart = CAMEL_MULTIPART (object);
- camel_data_wrapper_set_mime_type ( CAMEL_DATA_WRAPPER (multipart), "multipart");
- camel_multipart_set_boundary (multipart, "__camel_boundary__");
- multipart->preface = NULL;
- multipart->postface = NULL;
-
-}
-
-
-
-
-GtkType
-camel_multipart_get_type (void)
-{
- static GtkType camel_multipart_type = 0;
-
- if (!camel_multipart_type) {
- GtkTypeInfo camel_multipart_info =
- {
- "CamelMultipart",
- sizeof (CamelMultipart),
- sizeof (CamelMultipartClass),
- (GtkClassInitFunc) camel_multipart_class_init,
- (GtkObjectInitFunc) camel_multipart_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_multipart_type = gtk_type_unique (camel_data_wrapper_get_type (), &camel_multipart_info);
- }
-
- return camel_multipart_type;
-}
-
-static void
-_unref_part (gpointer data, gpointer user_data)
-{
- GtkObject *body_part = GTK_OBJECT (data);
-
- gtk_object_unref (body_part);
-}
-
-static void
-_finalize (GtkObject *object)
-{
- CamelMultipart *multipart = CAMEL_MULTIPART (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::finalize\n");
-
- if (multipart->parent) gtk_object_unref (GTK_OBJECT (multipart->parent));
-
- g_list_foreach (multipart->parts, _unref_part, NULL);
-
- if (multipart->boundary) g_free (multipart->boundary);
- if (multipart->preface) g_free (multipart->preface);
- if (multipart->postface) g_free (multipart->postface);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::finalize\n");
-}
-
-
-CamelMultipart *
-camel_multipart_new ()
-{
- CamelMultipart *multipart;
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Entering new()\n");
-
- multipart = (CamelMultipart *)gtk_type_new (CAMEL_MULTIPART_TYPE);
- multipart->preface = NULL;
- multipart->postface = NULL;
-
-
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving new()\n");
- return multipart;
-}
-
-
-static void
-_add_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
-{
- multipart->parts = g_list_append (multipart->parts, part);
- if (part) gtk_object_ref (GTK_OBJECT (part));
-}
-
-void
-camel_multipart_add_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
-{
- CMP_CLASS (multipart)->add_part (multipart, part);
-}
-
-
-static void
-_add_part_at (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index)
-{
- multipart->parts = g_list_insert (multipart->parts, part, index);
- if (part) gtk_object_ref (GTK_OBJECT (part));
-}
-
-void
-camel_multipart_add_part_at (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index)
-{
- CMP_CLASS (multipart)->add_part_at (multipart, part, index);
-}
-
-static void
-_remove_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
-{
- if (!multipart->parts) {
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::remove_part part list id void\n");
- return;
- }
- multipart->parts = g_list_remove (multipart->parts, part);
- if (part) gtk_object_unref (GTK_OBJECT (part));
-}
-
-void
-camel_multipart_remove_part (CamelMultipart *multipart, CamelMimeBodyPart *part)
-{
- CMP_CLASS (multipart)->remove_part (multipart, part);
-}
-
-
-static CamelMimeBodyPart *
-_remove_part_at (CamelMultipart *multipart, guint index)
-{
- GList *parts_list;
- GList *part_to_remove;
- CamelMimeBodyPart *removed_body_part;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Entering remove_part_at\n");
- CAMEL_LOG_TRACE ("CamelMultipart::remove_part_at : Removing part number %d\n", index);
-
- if (!(multipart->parts)) {
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::remove_part_at part list is void \n");
- return NULL;
- }
-
- parts_list = multipart->parts;
- part_to_remove = g_list_nth (parts_list, index);
- if (!part_to_remove) {
- CAMEL_LOG_WARNING ("CamelMultipart::remove_part_at : part to remove is NULL\n");
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::remove_part_at : index = %d, number of parts=%d\n",
- index, g_list_length (parts_list));
- return NULL;
- }
- removed_body_part = CAMEL_MIME_BODY_PART (part_to_remove->data);
-
- multipart->parts = g_list_remove_link (parts_list, part_to_remove);
- if (part_to_remove->data) gtk_object_unref (GTK_OBJECT (part_to_remove->data));
- g_list_free_1 (part_to_remove);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving remove_part_at\n");
- return removed_body_part;
-
-}
-
-CamelMimeBodyPart *
-camel_multipart_remove_part_at (CamelMultipart *multipart, guint index)
-{
- return CMP_CLASS (multipart)->remove_part_at (multipart, index);
-}
-
-
-static CamelMimeBodyPart *
-_get_part (CamelMultipart *multipart, guint index)
-{
- GList *part;
- if (!(multipart->parts)) {
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::get_part part list is void \n");
- return NULL;
- }
-
- part = g_list_nth (multipart->parts, index);
- if (part) return CAMEL_MIME_BODY_PART (part->data);
- else {
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::get_part part number %d not found\n", index);
- return NULL;
- }
-}
-
-CamelMimeBodyPart *
-camel_multipart_get_part (CamelMultipart *multipart, guint index)
-{
- return CMP_CLASS (multipart)->get_part (multipart, index);
-}
-
-
-static guint
-_get_number (CamelMultipart *multipart)
-{
- return g_list_length (multipart->parts);
-}
-
-guint
-camel_multipart_get_number (CamelMultipart *multipart)
-{
- return CMP_CLASS (multipart)->get_number (multipart);
-}
-
-
-static void
-_set_parent (CamelMultipart *multipart, CamelMimePart *parent)
-{
- multipart->parent = parent;
- if (parent) gtk_object_ref (GTK_OBJECT (parent));
-}
-
-void
-camel_multipart_set_parent (CamelMultipart *multipart, CamelMimePart *parent)
-{
- CMP_CLASS (multipart)->set_parent (multipart, parent);
-}
-
-
-static CamelMimePart *
-_get_parent (CamelMultipart *multipart)
-{
- return multipart->parent;
-}
-
-
-CamelMimePart *
-camel_multipart_get_parent (CamelMultipart *multipart)
-{
- return CMP_CLASS (multipart)->get_parent (multipart);
-}
-
-
-
-
-
-static void
-_set_boundary (CamelMultipart *multipart, gchar *boundary)
-{
- gmime_content_field_set_parameter (CAMEL_DATA_WRAPPER (multipart)->mime_type, "boundary", boundary);
-}
-
-void
-camel_multipart_set_boundary (CamelMultipart *multipart, gchar *boundary)
-{
- CMP_CLASS (multipart)->set_boundary (multipart, boundary);
-}
-
-
-static const gchar *
-_get_boundary (CamelMultipart *multipart)
-{
- const gchar *boundary;
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_get_boundary\n");
- if (!CAMEL_DATA_WRAPPER (multipart)->mime_type) {
- CAMEL_LOG_WARNING ("CamelMultipart::_get_boundary CAMEL_DATA_WRAPPER (multipart)->mime_type is NULL\n");
- return NULL;
- }
- boundary = gmime_content_field_get_parameter (CAMEL_DATA_WRAPPER (multipart)->mime_type, "boundary");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_get_boundary\n");
- return boundary;
-}
-
-
-const gchar *
-camel_multipart_get_boundary (CamelMultipart *multipart)
-{
- return CMP_CLASS (multipart)->get_boundary (multipart);
-}
-
-
-struct _print_part_user_data {
- CamelStream *stream;
- const gchar *boundary;
-};
-
-
-
-static void
-_print_part (gpointer data, gpointer user_data)
-{
- CamelMimeBodyPart *body_part = CAMEL_MIME_BODY_PART (data);
- struct _print_part_user_data *ud = (struct _print_part_user_data *)user_data;
-
- if (ud->boundary) camel_stream_write_strings (ud->stream, "\n--", ud->boundary, "\n", NULL);
- else camel_stream_write_strings (ud->stream, "\n--\n", NULL);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (body_part), ud->stream);
-
-
-}
-
-
-
-static void
-_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMultipart *multipart = CAMEL_MULTIPART (data_wrapper);
- struct _print_part_user_data ud;
- const gchar *boundary;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_write_to_stream entering\n");
- boundary = camel_multipart_get_boundary (multipart);
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_write_to_stream, boundary = %s\n", boundary);
- g_return_if_fail (boundary);
- ud.boundary = boundary;
- ud.stream = stream;
- if (multipart->preface) camel_stream_write_strings (stream, multipart->preface, NULL);
- g_list_foreach (multipart->parts, _print_part, (gpointer)&ud);
- camel_stream_write_strings (stream, "\n--", boundary, "--\n", NULL);
- if (multipart->postface) camel_stream_write_strings (stream, multipart->postface, NULL);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_write_to_stream leaving \n");
-}
-
-
-
-
-/**
- * _read_part: read one part in a multipart environement.
- * @new_part_stream: stream to add the part to
- * @stream: the stream to read the lines from.
- * @normal_boundary: end of part bundary.
- * @end_boundary: end of multipart boundary.
- *
- * This routine is a bit special: RFC 2046 says that, in a multipart
- * environment, the last crlf before a boundary belongs to the boundary.
- * Thus, if there is no blank line before the boundary, the last crlf
- * of the last line of the part is removed.
- *
- * Return value: true if the last boundary element has been found or if no more data was available from the stream, flase otherwise
- **/
-
-static gboolean
-_read_part (CamelStream *new_part_stream, CamelStream *stream, gchar *normal_boundary, gchar *end_boundary)
-{
- gchar *new_line = NULL;
- gboolean end_of_part = FALSE;
- gboolean last_part = FALSE;
- gboolean first_line = TRUE;
-
- /* Note for future enhancements */
- /* RFC 2046 precises that when parsing the content of a multipart
- * element, the program should not think it will find the last boundary,
- * and in particular, the message could have been damaged during
- * transport, the parsing should still be OK */
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Entering _read_part\n");
-
- new_line = gmime_read_line_from_stream (stream);
- while (new_line && !end_of_part && !last_part) {
- end_of_part = (strcmp (new_line, normal_boundary) == 0);
- last_part = (strcmp (new_line, end_boundary) == 0);
- if (!end_of_part && !last_part) {
- if (first_line) {
- first_line = FALSE;
- camel_stream_write_string (new_part_stream, new_line);
- } else camel_stream_write_strings (new_part_stream, "\n", new_line, NULL);
- g_free (new_line);
- new_line = gmime_read_line_from_stream (stream);
- }
- }
- if (new_line) g_free (new_line);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving _read_part\n");
- return (last_part || (new_line == NULL));
-}
-
-static void
-_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelMultipart *multipart = CAMEL_MULTIPART (data_wrapper);
- const gchar *boundary;
- gchar *real_boundary_line;
- gchar *end_boundary_line;
- CamelStream *new_part_stream;
- gboolean end_of_multipart;
- CamelMimeBodyPart *body_part;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_construct_from_stream\n");
- boundary = camel_multipart_get_boundary (multipart);
- g_return_if_fail (boundary);
-
- real_boundary_line = g_strdup_printf ("--%s", boundary);
- end_boundary_line = g_strdup_printf ("--%s--", boundary);
-
-
- /* read the prefix if any */
- new_part_stream = camel_stream_mem_new (CAMEL_STREAM_MEM_RW);
- end_of_multipart = _read_part (new_part_stream, stream, real_boundary_line, end_boundary_line);
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::construct_from_stream freeing new_part_stream:%p\n", new_part_stream);
- gtk_object_unref (GTK_OBJECT (new_part_stream));
- if (multipart->preface) g_free (multipart->preface);
-
- /* if ( (new_part->str)[0] != '\0') multipart->preface = g_strdup (new_part->str); */
-
- /* read all the real parts */
- while (!end_of_multipart) {
- CAMEL_LOG_FULL_DEBUG ("CamelMultipart::construct_from_stream, detected a new part\n");
- new_part_stream = camel_stream_mem_new (CAMEL_STREAM_MEM_RW);
- body_part = camel_mime_body_part_new ();
-
- end_of_multipart = _read_part ( new_part_stream, stream, real_boundary_line, end_boundary_line);
- camel_stream_seek (new_part_stream, 0, CAMEL_STREAM_SET);
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (body_part), new_part_stream);
- camel_multipart_add_part (multipart, body_part);
- gtk_object_destroy (GTK_OBJECT (new_part_stream));
-
- }
-
- /* g_string_assign (new_part, ""); */
- /* _read_part (new_part, stream, real_boundary_line, end_boundary_line); */
-
- if (multipart->postface) g_free (multipart->postface);
- /* if ( (new_part->str)[0] != '\0') multipart->postface = g_strdup (new_part->str); */
-
- /* g_string_free (new_part, TRUE); */
-
- g_free (real_boundary_line);
- g_free (end_boundary_line);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_construct_from_stream\n");
-}
diff --git a/camel/camel-multipart.h b/camel/camel-multipart.h
deleted file mode 100644
index 905bc82927..0000000000
--- a/camel/camel-multipart.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-multipart.h : class for a multipart */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MULTIPART_H
-#define CAMEL_MULTIPART_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-typedef struct _CamelMultipart CamelMultipart;
-
-#include <gtk/gtk.h>
-#include "camel-mime-part.h"
-#include "camel-mime-body-part.h"
-
-
-#define CAMEL_MULTIPART_TYPE (camel_multipart_get_type ())
-#define CAMEL_MULTIPART(obj) (GTK_CHECK_CAST((obj), CAMEL_MULTIPART_TYPE, CamelMultipart))
-#define CAMEL_MULTIPART_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MULTIPART_TYPE, CamelMultipartClass))
-#define CAMEL_IS_MULTIPART(o) (GTK_CHECK_TYPE((o), CAMEL_MULTIPART_TYPE))
-
-
-struct _CamelMultipart
-{
- CamelDataWrapper parent_object;
-
- CamelMimePart *parent;
- GList *parts;
- gchar *boundary;
- gchar *preface;
- gchar *postface;
-
-};
-
-
-
-typedef struct {
- CamelDataWrapperClass parent_class;
-
- /* Virtual methods */
- void (*add_part) (CamelMultipart *multipart, CamelMimeBodyPart *part);
- void (*add_part_at) (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index);
- void (*remove_part) (CamelMultipart *multipart, CamelMimeBodyPart *part);
- CamelMimeBodyPart * (*remove_part_at) (CamelMultipart *multipart, guint index);
- CamelMimeBodyPart * (*get_part) (CamelMultipart *multipart, guint index);
- guint (*get_number) (CamelMultipart *multipart);
- void (*set_parent) (CamelMultipart *multipart, CamelMimePart *parent);
- CamelMimePart * (*get_parent) (CamelMultipart *multipart);
- void (*set_boundary) (CamelMultipart *multipart, gchar *boundary);
- const gchar * (*get_boundary) (CamelMultipart *multipart);
-
-} CamelMultipartClass;
-
-
-/* Standard Gtk function */
-GtkType camel_multipart_get_type (void);
-
-
-/* public methods */
-CamelMultipart *camel_multipart_new ();
-void camel_multipart_add_part (CamelMultipart *multipart, CamelMimeBodyPart *part);
-void camel_multipart_add_part_at (CamelMultipart *multipart, CamelMimeBodyPart *part, guint index);
-void camel_multipart_remove_part (CamelMultipart *multipart, CamelMimeBodyPart *part);
-CamelMimeBodyPart *camel_multipart_remove_part_at (CamelMultipart *multipart, guint index);
-CamelMimeBodyPart *camel_multipart_get_part (CamelMultipart *multipart, guint index);
-guint camel_multipart_get_number (CamelMultipart *multipart);
-void camel_multipart_set_parent (CamelMultipart *multipart, CamelMimePart *parent);
-CamelMimePart *camel_multipart_get_parent (CamelMultipart *multipart);
-void camel_multipart_set_boundary (CamelMultipart *multipart, gchar *boundary);
-const gchar *camel_multipart_get_boundary (CamelMultipart *multipart);
-
-
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MULTIPART_H */
-
diff --git a/camel/camel-op-queue.c b/camel/camel-op-queue.c
deleted file mode 100644
index dc9996ef38..0000000000
--- a/camel/camel-op-queue.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-/* MT safe */
-
-
-#include <config.h>
-#include "camel-log.h"
-#include "camel-op-queue.h"
-
-static GStaticMutex op_queue_mutex = G_STATIC_MUTEX_INIT;
-
-
-
-/**
- * camel_op_queue_new: create a new operation queue
- *
- * Create a new operation queue.
- *
- * Return value: the newly allcated object
- **/
-CamelOpQueue *
-camel_op_queue_new ()
-{
- CamelOpQueue *op_queue;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::new\n");
-
- op_queue = g_new (CamelOpQueue, 1);
- op_queue->ops_tail = NULL;
- op_queue->ops_head = NULL;
- op_queue->service_available = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::new\n");
- return op_queue;
-}
-
-
-void
-camel_op_queue_free (CamelOpQueue *op_queue)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::free\n");
- g_list_free (op_queue->ops_head);
- g_free (op_queue);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::free\n");
-}
-
-/**
- * camel_op_queue_push_op: Add an operation to the queue
- * @queue: queue object
- * @op: operation to add
- *
- * Add an operation to an operation queue.
- * The queue is a FIFO queue.
- **/
-void
-camel_op_queue_push_op (CamelOpQueue *queue, CamelOp *op)
-{
- GList *new_op;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::push_op\n");
- g_assert (queue);
- g_static_mutex_lock (&op_queue_mutex);
- if (!queue->ops_tail) {
- CAMEL_LOG_FULL_DEBUG ("CamelOpQueue::push_op queue does not exists yet. "
- "Creating it\n");
- queue->ops_head = g_list_prepend (NULL, op);
- queue->ops_tail = queue->ops_head;
- } else
- queue->ops_head = g_list_prepend (queue->ops_head, op);
- g_static_mutex_unlock (&op_queue_mutex);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::push_op\n");
-}
-
-
-/**
- * camel_op_queue_pop_op: Pop the next operation pending in the queue
- * @queue: queue object
- *
- * Pop the next operation pending in the queue.
- *
- * Return value:
- **/
-CamelOp *
-camel_op_queue_pop_op (CamelOpQueue *queue)
-{
- GList *op_list;
- CamelOp *op;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::pop_op\n");
- g_assert (queue);
-
- g_static_mutex_lock (&op_queue_mutex);
- op_list = queue->ops_tail;
- if (!op_list) return NULL;
-
- queue->ops_tail = queue->ops_tail->prev;
- op = (CamelOp *)op_list->data;
- g_static_mutex_unlock (&op_queue_mutex);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::pop_op\n");
- return op;
-}
-
-
-/**
- * camel_op_queue_run_next_op: run the next pending operation
- * @queue: queue object
- *
- * Run the next pending operation in the queue.
- *
- * Return value: TRUE if an operation was launched FALSE if there was no operation pending in the queue.
- **/
-gboolean
-camel_op_queue_run_next_op (CamelOpQueue *queue)
-{
- CamelOp *op;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::run_next_op\n");
- op = camel_op_queue_pop_op (queue);
- if (!op) return FALSE;
-
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::run_next_op\n");
- return FALSE;
-}
-
-/**
- * camel_op_queue_set_service_availability: set the service availability for an operation queue
- * @queue: queue object
- * @available: availability flag
- *
- * set the service availability
- **/
-void
-camel_op_queue_set_service_availability (CamelOpQueue *queue, gboolean available)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::set_service_availability\n");
- g_static_mutex_lock (&op_queue_mutex);
- queue->service_available = available;
- g_static_mutex_unlock (&op_queue_mutex);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::set_service_availability\n");
-}
-
-/**
- * camel_op_queue_get_service_availability: determine if an operation queue service is available
- * @queue: queue object
- *
- * Determine if the service associated to an operation queue is available.
- *
- * Return value: service availability.
- **/
-gboolean
-camel_op_queue_get_service_availability (CamelOpQueue *queue)
-{
- gboolean available;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::get_service_availability\n");
- g_static_mutex_lock (&op_queue_mutex);
- available = queue->service_available;
- g_static_mutex_unlock (&op_queue_mutex);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::get_service_availability\n");
- return available;
-}
-
diff --git a/camel/camel-op-queue.h b/camel/camel-op-queue.h
deleted file mode 100644
index 2bceceb4c8..0000000000
--- a/camel/camel-op-queue.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_OP_QUEUE_H
-#define CAMEL_OP_QUEUE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include "camel-marshal-utils.h"
-
-
-
-typedef struct
-{
- GList *ops_head;
- GList *ops_tail;
- gboolean service_available;
-
-} CamelOpQueue;
-
-
-/* public methods */
-CamelOpQueue *camel_op_queue_new ();
-void camel_op_queue_free (CamelOpQueue *op_queue);
-void camel_op_queue_push_op (CamelOpQueue *queue, CamelOp *op);
-CamelOp *camel_op_queue_pop_op (CamelOpQueue *queue);
-gboolean camel_op_queue_run_next_op (CamelOpQueue *queue);
-gboolean camel_op_queue_get_service_availability (CamelOpQueue *queue);
-void camel_op_queue_set_service_availability (CamelOpQueue *queue, gboolean available);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_OP_QUEUE_H */
-
diff --git a/camel/camel-provider.c b/camel/camel-provider.c
deleted file mode 100644
index 7328f4ca64..0000000000
--- a/camel/camel-provider.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-provider.c : provider framework */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-/*
- A provider can be added "by hand" or by loading a module.
-
-
- Adding providers with modules.
- ------------------------------
-
- The modules are shared libraries which must contain the
- function
-
- CamelProvider *camel_provider_module_init ();
-
- returning the provider object defined in the module
-
-
-*/
-
-/* FIXME: Shouldn't we add a version number to providers ? */
-
-#include "config.h"
-#include "camel-provider.h"
-#include "camel-log.h"
-
-
-static GList *_provider_list = NULL;
-static gchar *_last_error;
-
-static gint
-_provider_name_cmp (gconstpointer a, gconstpointer b)
-{
- CamelProvider *provider_a = CAMEL_PROVIDER (a);
- CamelProvider *provider_b = CAMEL_PROVIDER (b);
-
- return strcmp ( provider_a->name, provider_b->name);
-}
-
-void
-camel_provider_register (CamelProvider *provider)
-{
- GList *old_provider_node = NULL;
-
- g_assert (provider);
-
- if (_provider_list)
- old_provider_node = g_list_find_custom (_provider_list, provider, _provider_name_cmp);
-
- if (old_provider_node != NULL) {
- /* camel_provider_unref (CAMEL_PROVIDER (old_provider_node->data)); */
- old_provider_node->data = provider;
- } else {
- /* be careful, we use prepend here, so that last registered
- providers come first */
- _provider_list = g_list_prepend (_provider_list, provider);
- }
- /* camel_provider_ref (provider); */
-}
-
-
-const CamelProvider *
-camel_provider_register_as_module (const gchar *module_path)
-{
-
- CamelProvider *new_provider = NULL;
- GModule *new_module = NULL;
- CamelProvider * (*camel_provider_module_init) ();
- gboolean has_module_init;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelProvider::register_as_module\n");
-
- g_return_val_if_fail (module_path, NULL);
-
- if (!g_module_supported ()) {
- CAMEL_LOG_WARNING ("CamelProvider::register_as_module module loading not supported on this system\n");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n");
- return NULL;
- }
-
-
- new_module = g_module_open (module_path, 0);
- if (!new_module) {
- CAMEL_LOG_WARNING ("CamelProvider::register_as_module Unable to load module %s\n", module_path);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n");
- return NULL;
- }
-
- has_module_init = g_module_symbol (new_module, "camel_provider_module_init", (gpointer *)&camel_provider_module_init);
- if (!has_module_init){
- CAMEL_LOG_WARNING ("CamelProvider::register_as_module loading of module %s failed,\n"
- "\t Symbol camel_provider_module_init not defined in it\n", module_path);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n");
- return NULL;
- }
-
- new_provider = camel_provider_module_init();
- new_provider->gmodule = new_module;
- camel_provider_register (new_provider);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n");
- return new_provider;
-
-
-}
-
-
-
-
-/*
- be careful to this function, @a is expected to be
- a provider, @b a protocol name (const gchar *)
-*/
-static gint
-_provider_protocol_find (gconstpointer a, gconstpointer b)
-{
- CamelProvider *provider_a = CAMEL_PROVIDER (a);
- const gchar *name_b = (const gchar *)b;
-
- return g_strcasecmp ( provider_a->name, name_b);
-}
-
-/**
- * camel_provider_get_for_protocol: get a registered provider for a protocol
- * @protocol: protocol name (case insensitive)
- * @type: provider type (transport, store, ...)
- *
- * Look into the list of registered provider if
- * one correspond both to the protocol name
- * and to the protocol type. When several providers
- * exist for a same protocol, the last registered
- * is returned.
- *
- * Return value: Matching provider or NULL if none exists.
- **/
-const CamelProvider *
-camel_provider_get_for_protocol (const gchar *protocol, ProviderType type)
-{
- CamelProvider *current_provider = NULL;
- GList *current_provider_node;
- gboolean protocol_is_found;
- gboolean provider_is_found;
-
- g_assert (protocol);
- g_return_val_if_fail (_provider_list, NULL);
-
- current_provider_node = _provider_list;
- provider_is_found = FALSE;
-
- while ((!provider_is_found) && current_provider_node) {
- current_provider = (CamelProvider *)current_provider_node->data;
-
- protocol_is_found = (g_strcasecmp (protocol, current_provider->protocol) == 0);
- if (protocol_is_found)
- provider_is_found = (current_provider->provider_type == type);
-
- current_provider_node = current_provider_node->next;
- }
-
- if (provider_is_found) return current_provider;
- else return NULL;
-}
diff --git a/camel/camel-provider.h b/camel/camel-provider.h
deleted file mode 100644
index 95df289c3b..0000000000
--- a/camel/camel-provider.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-provider.h : provider definition */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_PROVIDER_H
-#define CAMEL_PROVIDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <gmodule.h>
-
-#define CAMEL_PROVIDER(obj) (CamelProvider *)(obj)
-
-typedef enum {
- PROVIDER_STORE,
- PROVIDER_TRANSPORT
-} ProviderType;
-
-
-typedef struct {
- GtkType object_type; /* used to create instance of the provider */
- ProviderType provider_type; /* is a store or a transport */
- gchar *protocol; /* name of the protocol ("imap"/"smtp"/"mh" ...) */
- gchar *name; /* name of the provider ("Raymond the imap provider") */
- gchar *description; /* Useful when multiple providers are available for a same protocol */
-
- GModule *gmodule;
-} CamelProvider;
-
-void camel_provider_register (CamelProvider *provider);
-const CamelProvider *camel_provider_register_as_module (const gchar *module_path);
-const CamelProvider *camel_provider_get_for_protocol (const gchar *protocol, ProviderType type);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_PROVIDER_H */
diff --git a/camel/camel-recipient.c b/camel/camel-recipient.c
deleted file mode 100644
index 3a301f201e..0000000000
--- a/camel/camel-recipient.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-recipient.h : handle recipients (addresses) and recipiemt lists */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include "glib.h"
-#include "hash-table-utils.h"
-#include "camel-recipient.h"
-
-
-/**
- * camel_recipient_table_new: Create a new recipient table object
- *
- *
- * creates a new recipient table object. A recipient table
- * objects merely associates a recipient list (GList) to
- * recipient types (as for example "To", "Cc" for mime
- * maile messages
- *
- * Return value: the newly created recipient table object
- **/
-CamelRecipientTable *
-camel_recipient_table_new ()
-{
- CamelRecipientTable *recipient_table;
-
- recipient_table = g_new0 (CamelRecipientTable, 1);
- recipient_table->recipient_hash_table = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- recipient_table->ref_count = 1;
- return recipient_table;
-}
-
-
-/**
- * camel_recipient_table_ref: add a reference to a recipient table object
- * @recipient_table: the recipient table object
- *
- * Add a reference to a recipient table object.
- **/
-void
-camel_recipient_table_ref (CamelRecipientTable *recipient_table)
-{
- g_return_if_fail (recipient_table);
- recipient_table->ref_count += 1;
-}
-
-
-
-static void
-_free_recipient_list (gpointer key, gpointer value, gpointer user_data)
-{
- GList *recipient_list = (GList *)value;
- gchar *recipient_name = (gchar *)key;
-
- while (recipient_list) {
- g_free (recipient_list->data);
- recipient_list = recipient_list->next;
- }
-
- g_free (recipient_name);
-
-}
-
-/**
- * camel_recipient_table_free: Free a recipient table object
- * @recipient_table: the recipient table object to free
- *
- * Free a recipient table object. All recipients and recipient
- * are freed.
- **/
-void
-camel_recipient_table_free (CamelRecipientTable *recipient_table)
-{
- if (!recipient_table) return;
-
- /* free each recipient list */
- g_hash_table_foreach (recipient_table->recipient_hash_table, _free_recipient_list, NULL);
- g_hash_table_destroy (recipient_table->recipient_hash_table);
-}
-
-
-
-
-/**
- * camel_recipient_table_unref: Removes a reference to a recipient table object
- * @recipient_table: the recipient table object
- *
- * Removes a reference to the reference count of a recipient
- * table object. If the reference count falls to zero, the
- * recipient table object is freed.
- *
- **/
-void
-camel_recipient_table_unref (CamelRecipientTable *recipient_table)
-{
- if (!recipient_table) return;
-
- recipient_table->ref_count -= 1;
- if (recipient_table->ref_count <1)
- camel_recipient_table_free (recipient_table);
-
-}
-
-
-
-
-/**
- * camel_recipient_table_add: Add a recipient to a recipient table object.
- * @recipient_table: The recipient table object
- * @recipient_type: Recipient type string
- * @recipient: The recipient to add
- *
- * Add a recipient to a recipient table object.
- * The recipient is appended to the list of recipients
- * of type @recipient_type. @recipient and @recipient_type
- * are duplicated if necessary and freed when
- * camel_recipient_table_free is called.
- **/
-void
-camel_recipient_table_add (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- GList *recipients_list;
- GList *existent_list;
-
- /* see if there is already a list for this recipient type */
- existent_list = (GList *)g_hash_table_lookup (recipient_table->recipient_hash_table, recipient_type);
-
-
- /* append the new recipient to the recipient list
- if the existent_list is NULL, then a new GList is
- automagically created */
- recipients_list = g_list_append (existent_list, (gpointer)g_strdup (recipient));
-
- if (!existent_list) /* if there was no recipient of this type create the section */
- g_hash_table_insert (recipient_table->recipient_hash_table, g_strdup (recipient_type), recipients_list);
-
-
-}
-
-
-/**
- * camel_recipient_table_add_list: Add a full list of recipients to a recipient table.
- * @recipient_table: The recipient table object
- * @recipient_type: Recipient type string.
- * @recipient_list: Recipient list to add.
- *
- * Add a full list of recipients to a recipient table.
- * The new recipients are appended at the end of the
- * existing recipient list corresponding to @recipient_type.
- * Be careful, the list is used as is, and its element
- * will be freed by camel_recipient_table_unref
- **/
-void
-camel_recipient_table_add_list (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- GList *recipient_list)
-{
- GList *recipients_list;
- GList *existent_list;
-
- /* see if there is already a list for this recipient type */
- existent_list = (GList *)g_hash_table_lookup (recipient_table->recipient_hash_table, recipient_type);
-
-
- if (existent_list)
- g_list_concat (existent_list, recipient_list);
- else
- g_hash_table_insert (recipient_table->recipient_hash_table, g_strdup (recipient_type), recipients_list);
-}
-
-
-
-
-/**
- * camel_recipient_table_remove: Remove a recipient from a recipient table.
- * @recipient_table: The recipient table object
- * @recipient_type: Recipient type string.
- * @recipient: Recipient to remove from the table
- *
- * Remove a recipient from a recipient table. The recipient is
- * only removed from the recipient list corresponding to
- * @recipient_type. The removed recipient is freed.
- *
- **/
-void
-camel_recipient_table_remove (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- const gchar *recipient)
-{
- GList *recipients_list;
- GList *new_recipients_list;
- GList *old_element;
- gchar *old_recipient_type;
-
- /* if the recipient type section does not exist, do nothing */
- if (! g_hash_table_lookup_extended (recipient_table->recipient_hash_table,
- recipient_type,
- (gpointer)&(old_recipient_type),
- (gpointer)&(recipients_list))
- ) return;
-
- /* look for the recipient to remove */
- /* g_list_find_custom , use gpointer instead of gconstpointer */
- old_element = g_list_find_custom (recipients_list, (gpointer)recipient, g_strcase_equal);
- if (old_element) {
- /* if recipient exists, remove it */
- new_recipients_list = g_list_remove_link (recipients_list, old_element);
-
- /* if glist head has changed, fix up hash table */
- if (new_recipients_list != recipients_list)
- g_hash_table_insert (recipient_table->recipient_hash_table, old_recipient_type, new_recipients_list);
-
- g_free( (gchar *)(old_element->data));
- g_list_free_1 (old_element);
- }
-}
-
-
-
-/**
- * camel_recipient_table_get: Get the recipients corresponding to a recipient type.
- * @recipient_table: The recipient table object
- * @recipient_type: Recipient type string.
- *
- * Return the list of recipients corresponding to
- * @recipient_type. The returned list is not a copy
- * of the internal list used by the recipient table object
- * but the list itself. It thus must not be freed.
- * The recipients it contains can be modified.
- *
- * Return value: The list of recipients.
- **/
-const GList *
-camel_recipient_table_get (CamelRecipientTable *recipient_table,
- const gchar *recipient_type)
-{
- return (const GList *)g_hash_table_lookup (recipient_table->recipient_hash_table, recipient_type);
-}
-
-
-
-
-/**
- * camel_recipient_foreach_recipient_type: Runs a function over over all recipients type lists.
- * @recipient_table: The recipient table object.
- * @func: The function to run.
- * @user_data: User data to pass to the function.
- *
- * Runs a function over over all recipients type lists.
- **/
-void
-camel_recipient_foreach_recipient_type (CamelRecipientTable *recipient_table,
- CRLFunc func,
- gpointer user_data)
-{
- g_hash_table_foreach (recipient_table->recipient_hash_table, (GHFunc)func, user_data);
-}
diff --git a/camel/camel-recipient.h b/camel/camel-recipient.h
deleted file mode 100644
index e59171add8..0000000000
--- a/camel/camel-recipient.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-recipient.h : handle recipients (addresses) and recipiemt lists */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#ifndef CAMEL_RECIPIENT_H
-#define CAMEL_RECIPIENT_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-
-
-
-typedef struct {
- GHashTable *recipient_hash_table;
- gint ref_count;
-
-} CamelRecipientTable;
-
-
-typedef void (*CRLFunc) (gchar *recipient_type,
- GList *recipient_list,
- gpointer user_data);
-
-
-
-
-CamelRecipientTable *camel_recipient_table_new ();
-
-void camel_recipient_table_ref (CamelRecipientTable *recipient_table);
-
-void camel_recipient_table_unref (CamelRecipientTable *recipient_table);
-
-void camel_recipient_table_add (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- const gchar *recipient);
-
-void camel_recipient_table_add_list (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- GList *recipient_list);
-
-void camel_recipient_table_remove (CamelRecipientTable *recipient_table,
- const gchar *recipient_type,
- const gchar *recipient);
-
-const GList *camel_recipient_table_get (CamelRecipientTable *recipient_table,
- const gchar *recipient_type);
-
-void camel_recipient_foreach_recipient_type (CamelRecipientTable *recipient_table,
- CRLFunc func,
- gpointer user_data);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_RECIPIENT_H */
-
diff --git a/camel/camel-service.c b/camel/camel-service.c
deleted file mode 100644
index bf7af23ed2..0000000000
--- a/camel/camel-service.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelService.c : Abstract class for an email service */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-service.h"
-#include "camel-log.h"
-
-static GtkObjectClass *parent_class=NULL;
-
-/* Returns the class for a CamelService */
-#define CSERV_CLASS(so) CAMEL_SERVICE_CLASS (GTK_OBJECT(so)->klass)
-
-static void _connect(CamelService *service);
-static void _connect_to_with_login_passwd (CamelService *service, gchar *host, gchar *login, gchar *passwd);
-static void _connect_to_with_login_passwd_port (CamelService *service, gchar *host, gchar *login, gchar *passwd, guint port);
-static gboolean _is_connected (CamelService *service);
-static void _set_connected (CamelService *service, gboolean state);
-static const gchar *_get_url (CamelService *service);
-static void _finalize (GtkObject *object);
-
-static void
-camel_service_class_init (CamelServiceClass *camel_service_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_service_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- camel_service_class->connect = _connect;
- camel_service_class->connect_to_with_login_passwd = _connect_to_with_login_passwd;
- camel_service_class->connect_to_with_login_passwd_port = _connect_to_with_login_passwd_port;
- camel_service_class->is_connected = _is_connected;
- camel_service_class->set_connected = _set_connected;
- camel_service_class->get_url = _get_url;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-
-
-
-GtkType
-camel_service_get_type (void)
-{
- static GtkType camel_service_type = 0;
-
- if (!camel_service_type) {
- GtkTypeInfo camel_service_info =
- {
- "CamelService",
- sizeof (CamelService),
- sizeof (CamelServiceClass),
- (GtkClassInitFunc) camel_service_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_service_type = gtk_type_unique (gtk_object_get_type (), &camel_service_info);
- }
-
- return camel_service_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelService *camel_service = CAMEL_SERVICE (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelService::finalize\n");
-
- g_free (camel_service->url);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelService::finalize\n");
-}
-
-
-
-/**
- * _connect : connect to a service
- *
- * connect to the service using the parameters
- * stored in the session it is initialized with
- * WARNING: session not implemented for the moment
- *
- * @service: object to connect
- **/
-static void
-_connect (CamelService *service)
-{
- CSERV_CLASS(service)->set_connected(service, TRUE);
-}
-
-
-
-/**
- * camel_service_connect:connect to a service
- * @service: CamelService object
- *
- * connect to the service using the parameters
- * stored in the session it is initialized with
- * WARNING: session not implemented for the moment
- *
- **/
-void
-camel_service_connect (CamelService *service)
-{
- CSERV_CLASS(service)->connect(service);
-}
-
-
-
-/**
- * _connect_to: connect to the specified address
- *
- * Connect to the service, but do not use the session
- * default parameters to retrieve server's address
- *
- * @service: object to connect
- * @host: host to connect to
- * @login: user name used to log in
- * @passwd: password used to log in
- **/
-static void
-_connect_to_with_login_passwd (CamelService *service, gchar *host, gchar *login, gchar *passwd)
-{
- CSERV_CLASS(service)->set_connected(service, TRUE);
-}
-
-/**
- * camel_service_connect_to_with_login_passwd: connect a service
- * @service: the service to connect
- * @host: host to connect to
- * @login: login to connect with
- * @passwd: password to connect with
- *
- * Connect to a service, but do not use the session
- * default parameters to retrieve server's address
- *
- **/
-void
-camel_service_connect_to_with_login_passwd (CamelService *service, gchar *host, gchar *login, gchar *passwd)
-{
- CSERV_CLASS(service)->connect_to_with_login_passwd (service, host, login, passwd);
-}
-
-
-
-
-/**
- * _connect_to_with_login_passwd_port: connect to the specified address
- * @service: service to connect
- * @host: host to connect to
- * @login: user name used to log in
- * @passwd: password used to log in
- * @port: port to connect to
- *
- *
- **/
-static void
-_connect_to_with_login_passwd_port (CamelService *service, gchar *host, gchar *login, gchar *passwd, guint port)
-{
- CSERV_CLASS(service)->set_connected(service, TRUE);
-}
-
-
-/**
- * camel_service_connect_to_with_login_passwd_port: connect a service
- * @service: service to connect
- * @host: host to connect to
- * @login: user name used to log in
- * @passwd: password used to log in
- * @port: port to connect to
- *
- * Connect to a service, but do not use the session
- * default parameters to retrieve server's address
- *
- **/
-void
-camel_service_connect_to_with_login_passwd_port (CamelService *service, gchar *host, gchar *login, gchar *passwd, guint port)
-{
- CSERV_CLASS(service)->connect_to_with_login_passwd_port (service, host, login, passwd, port);
-}
-
-
-
-
-/**
- * _is_connected: test if the service object is connected
- * @service: object to test
- *
- *
- *
- * Return value:
- **/
-static gboolean
-_is_connected (CamelService *service)
-{
- return service->connected;
-}
-
-
-/**
- * camel_service_is_connected: test if the service object is connected
- * @service: object to test
- *
- *
- *
- * Return value:
- **/
-gboolean
-camel_service_is_connected (CamelService *service)
-{
- return CSERV_CLASS(service)->is_connected(service);
-}
-
-
-
-/**
- * _set_connected:set the connected state
- * @service: object to set the state of
- * @state: connected/disconnected
- *
- * This routine has to be called by providers to set the
- * connection state, mainly when the service is disconnected
- * wheras the close() method has not been called.
- *
- **/
-static void
-_set_connected (CamelService *service, gboolean state)
-{
- service->connected = state;
-}
-
-
-
-/**
- * _get_url: get url representing a service
- * @service: the service
- *
- * This method merely returns the "url" field. Subclasses
- * may provide more active implementations.
- *
- *
- * Return value:
- **/
-static const gchar *
-_get_url (CamelService *service)
-{
- return service->url;
-}
-
-/**
- * camel_service_get_url: get the url representing a service
- * @service: the service
- *
- * returns the URL representing a service. For security reasons
- * This routine may not always return the password.
- *
- * Return value: the url name
- **/
-const gchar *
-camel_service_get_url (CamelService *service)
-{
- return CSERV_CLASS(service)->get_url(service);
-}
-
-
diff --git a/camel/camel-service.h b/camel/camel-service.h
deleted file mode 100644
index ae960e22b8..0000000000
--- a/camel/camel-service.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-service.h : Abstract class for an email service */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_SERVICE_H
-#define CAMEL_SERVICE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-#define CAMEL_SERVICE_TYPE (camel_service_get_type ())
-#define CAMEL_SERVICE(obj) (GTK_CHECK_CAST((obj), CAMEL_SERVICE_TYPE, CamelService))
-#define CAMEL_SERVICE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SERVICE_TYPE, CamelServiceClass))
-#define CAMEL_IS_SERVICE(o) (GTK_CHECK_TYPE((o), CAMEL_SERVICE_TYPE))
-
-
-
-typedef struct {
- GtkObject parent_object;
-
- gboolean connected;
- gchar *url; /* This may be a full object ? */
-
-} CamelService;
-
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
- void (*connect) (CamelService *service);
- void (*connect_to_with_login_passwd) (CamelService *service, gchar *host, gchar *login, gchar *passwd);
- void (*connect_to_with_login_passwd_port) (CamelService *service, gchar *host, gchar *login, gchar *passwd, guint port);
- gboolean (*is_connected) (CamelService *service);
- void (*set_connected) (CamelService *service, gboolean state);
- const gchar * (*get_url) (CamelService *service);
-
-} CamelServiceClass;
-
-
-
-
-/* public methods */
-void camel_service_connect (CamelService *service);
-gboolean camel_service_is_connected (CamelService *service);
-void camel_service_connect_to_with_login_passwd (CamelService *service, gchar *host, gchar *login, gchar *passwd);
-void camel_service_connect_to_with_login_passwd_port (CamelService *service, gchar *host, gchar *login, gchar *passwd, guint port);
-const gchar *camel_service_get_url (CamelService *service);
-/* Standard Gtk function */
-GtkType camel_service_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SERVICE_H */
-
diff --git a/camel/camel-session.c b/camel/camel-session.c
deleted file mode 100644
index ff065b8c74..0000000000
--- a/camel/camel-session.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-session.c : Abstract class for an email session */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-session.h"
-#include "string-utils.h"
-#include "url-util.h"
-#include "camel-provider.h"
-#include "hash-table-utils.h"
-
-static GtkObjectClass *parent_class=NULL;
-
-/* Returns the class for a CamelSession */
-#define CSS_CLASS(so) CAMEL_SESSION_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void
-camel_session_class_init (CamelSessionClass *camel_session_class)
-{
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
-}
-
-
-
-
-
-static void
-camel_session_init (CamelSession *session)
-{
- session->store_provider_list = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- session->transport_provider_list = g_hash_table_new (g_strcase_hash, g_strcase_equal);
-}
-
-
-
-GtkType
-camel_session_get_type (void)
-{
- static GtkType camel_session_type = 0;
-
- if (!camel_session_type) {
- GtkTypeInfo camel_session_info =
- {
- "CamelSession",
- sizeof (CamelSession),
- sizeof (CamelSessionClass),
- (GtkClassInitFunc) camel_session_class_init,
- (GtkObjectInitFunc) camel_session_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_session_type = gtk_type_unique (gtk_object_get_type (), &camel_session_info);
- }
-
- return camel_session_type;
-}
-
-
-CamelSession *
-camel_session_new ()
-{
- return gtk_type_new (CAMEL_SESSION_TYPE);
-}
-
-/**
- * camel_session_set_provider: set the default provider for a protocol
- * @session: session object for wich the provider will the default
- * @provider: provider object
- *
- * Set the default implementation for a protocol. The protocol
- * is determined by provider->protocol field (See CamelProtocol).
- * It overrides the default provider for this protocol.
- *
- **/
-void
-camel_session_set_provider (CamelSession *session, CamelProvider *provider)
-{
- GHashTable *table;
-
- g_assert(session);
- g_assert(provider);
-
- if (provider->provider_type == PROVIDER_STORE)
- table = session->store_provider_list;
- else
- table = session->transport_provider_list;
-
- g_hash_table_insert (table, (gpointer)(provider->protocol), (gpointer)(provider));
-
-}
-
-
-
-
-
-/**
- * camel_session_get_store_from_provider: create a folder instance for a given provider
- * @session: session object the folder will be initialized with
- * @provider: provider folder to instantiate
- *
- *
- *
- * Return value: the newly instantiated store
- **/
-CamelStore *
-camel_session_get_store_from_provider (CamelSession *session, CamelProvider *provider)
-{
- CamelStore *store;
-
- g_assert(session);
- g_assert(provider);
-
- store = CAMEL_STORE (gtk_object_new (provider->object_type, NULL));
-#warning set the url to a useful value.
- camel_store_init(store, session, NULL);
- return store;
-}
-
-
-
-
-/**
- * camel_session_get_store_for_protocol: get the store associated to a protocol
- * @session: CamelSession object
- * @protocol: protocol name
- *
- * Return a CamelStore object associated to a given
- * store protocol. If a provider has been set for this
- * protocol in the session @session using
- * camel_session_set_provider (), then a store
- * obtained from this provider is return.
- * Otherwise, if one or more provider corresponding
- * to this protocol has been registered (See
- * camel_provider_register_as_module), the last registered
- * one is used.
- *
- * Return value: store associated to this protocol or NULL if no provider was found.
- **/
-CamelStore *
-camel_session_get_store_for_protocol (CamelSession *session, const gchar *protocol)
-{
- const CamelProvider *provider = NULL;
- CamelStore *new_store;
-
- /* look if there is a provider assiciated to this
- protocol in this session */
- provider = CAMEL_PROVIDER (g_hash_table_lookup (session->store_provider_list, protocol));
- if (!provider)
- /* no provider was found in this session, look
- if there is a registered provider for this
- protocol */
- provider = camel_provider_get_for_protocol (protocol, PROVIDER_STORE);
-
- if (!provider) return NULL;
-
- new_store = (CamelStore *)gtk_type_new (provider->object_type);
- return new_store;
-}
-
-
-
-
-/**
- * camel_session_get_store: get a store object for an URL
- * @session: session object
- * @url_string: url
- *
- * return a store corresponding to an URL.
- *
- * Return value: the store, or NULL if no provider correponds to the protocol
- **/
-CamelStore *
-camel_session_get_store (CamelSession *session, const gchar *url_string)
-{
- Gurl *url = NULL;
- CamelStore *new_store = NULL;
-
- url = g_url_new (url_string);
- g_return_val_if_fail (url, NULL);
-
- if (url->protocol) {
- new_store = camel_session_get_store_for_protocol (session, url->protocol);
- if (new_store)
- camel_store_init (new_store, session, url_string);
- }
- g_url_free (url);
-
- return new_store;
-
-}
diff --git a/camel/camel-session.h b/camel/camel-session.h
deleted file mode 100644
index bd7af5dc38..0000000000
--- a/camel/camel-session.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-session.h : Abstract class for an email session */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_SESSION_H
-#define CAMEL_SESSION_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-typedef struct _CamelSession CamelSession;
-
-#include "camel-provider.h"
-#include "camel-store.h"
-
-#define CAMEL_SESSION_TYPE (camel_session_get_type ())
-#define CAMEL_SESSION(obj) (GTK_CHECK_CAST((obj), CAMEL_SESSION_TYPE, CamelSession))
-#define CAMEL_SESSION_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SESSION_TYPE, CamelSessionClass))
-#define CAMEL_IS_SESSION(o) (GTK_CHECK_TYPE((o), CAMEL_SESSION_TYPE))
-
-
-
-
-struct _CamelSession
-{
- GtkObject parent_object;
- GHashTable *store_provider_list; /* providers are identified by their protocol */
- GHashTable *transport_provider_list;
-
-
-};
-
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /* Virtual methods */
-
-} CamelSessionClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_session_get_type (void);
-
-
-CamelSession *camel_session_new ();
-void camel_session_set_provider (CamelSession *session, CamelProvider *provider);
-CamelStore *camel_session_get_store_for_protocol (CamelSession *session, const gchar *protocol);
-CamelStore *camel_session_get_store (CamelSession *session, const gchar *url_string);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SESSION_H */
diff --git a/camel/camel-simple-data-wrapper-stream.c b/camel/camel-simple-data-wrapper-stream.c
deleted file mode 100644
index 2b5704b31e..0000000000
--- a/camel/camel-simple-data-wrapper-stream.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* camel-simple-data-wrapper-stream.c
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com)
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "camel-simple-data-wrapper-stream.h"
-
-
-static CamelStreamClass *parent_class = NULL;
-
-
-/* CamelStream methods. */
-
-static gint
-read (CamelStream *stream,
- gchar *buffer,
- gint n)
-{
- CamelSimpleDataWrapperStream *wrapper_stream;
- CamelSimpleDataWrapper *wrapper;
- GByteArray *array;
- gint len;
-
- wrapper_stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (stream);
- wrapper = wrapper_stream->wrapper;
- g_return_val_if_fail (wrapper != NULL, -1);
- array = wrapper->byte_array;
-
- len = MIN (n, array->len - wrapper_stream->current_position);
- if (len > 0) {
- memcpy (buffer, array->data, len);
- wrapper_stream->current_position += len;
- return len;
- } else {
- return 0;
- }
-}
-
-static gint
-write (CamelStream *stream,
- const gchar *buffer,
- gint n)
-{
- CamelSimpleDataWrapperStream *wrapper_stream;
- CamelSimpleDataWrapper *wrapper;
- GByteArray *array;
- gint len;
- const gchar *buffer_next;
- gint left;
-
- wrapper_stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (stream);
- wrapper = wrapper_stream->wrapper;
- g_return_val_if_fail (wrapper != NULL, -1);
- array = wrapper->byte_array;
-
- len = MIN (n, array->len - wrapper_stream->current_position);
- if (len > 0) {
- memcpy (array->data, buffer, len);
- buffer_next = buffer + len;
- left = n - len;
- } else {
- /* If we are past the end of the array, fill with zeros. */
- if (wrapper_stream->current_position > array->len) {
- gint saved_length;
-
- saved_length = array->len;
- g_byte_array_set_size
- (array, wrapper_stream->current_position);
- memset (array->data + saved_length,
- 0,
- (wrapper_stream->current_position
- - saved_length));
- }
-
- buffer_next = buffer;
- left = n;
- }
-
- if (n > 0)
- g_byte_array_append (array, buffer_next, left);
-
- wrapper_stream->current_position += n;
- return n;
-}
-
-static void
-flush (CamelStream *stream)
-{
- /* No op, as we don't do any buffering. */
-}
-
-static gint
-available (CamelStream *stream)
-{
- CamelSimpleDataWrapperStream *wrapper_stream;
- CamelSimpleDataWrapper *wrapper;
- GByteArray *array;
- gint available;
-
- wrapper_stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (stream);
- wrapper = wrapper_stream->wrapper;
- g_return_val_if_fail (wrapper != NULL, -1);
- array = wrapper->byte_array;
-
- available = array->len - wrapper_stream->current_position;
- return MAX (available, 0);
-}
-
-static gboolean
-eos (CamelStream *stream)
-{
- if (available (stream) > 0)
- return TRUE;
- else
- return FALSE;
-}
-
-static void
-close (CamelStream *stream)
-{
- /* Nothing to do, we have no associated file descriptor. */
-}
-
-static gint
-seek (CamelStream *stream,
- gint offset,
- CamelStreamSeekPolicy policy)
-{
- CamelSimpleDataWrapperStream *wrapper_stream;
- gint new_position;
-
- wrapper_stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (stream);
-
- switch (policy) {
- case CAMEL_STREAM_SET:
- new_position = offset;
- break;
- case CAMEL_STREAM_CUR:
- new_position = wrapper_stream->current_position + offset;
- break;
- case CAMEL_STREAM_END:
- new_position = wrapper_stream->wrapper->byte_array->len;
- break;
- default:
- g_warning ("Unknown CamelStreamSeekPolicy %d.", policy);
- return -1;
- }
-
- wrapper_stream->current_position = new_position;
- return new_position;
-}
-
-
-/* This handles destruction of the associated CamelDataWrapper. */
-/* Hm, this should never happen though, because we gtk_object_ref() the
- wrapper. */
-static void
-wrapper_destroy_cb (GtkObject *object,
- gpointer data)
-{
- CamelSimpleDataWrapperStream *stream;
-
- g_warning ("CamelSimpleDataWrapperStream: associated CamelSimpleDataWrapper was destroyed.");
- stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (object);
- stream->wrapper = NULL;
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- CamelSimpleDataWrapperStream *stream;
-
- stream = CAMEL_SIMPLE_DATA_WRAPPER_STREAM (object);
-
- gtk_object_unref (GTK_OBJECT (stream->wrapper));
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-static void
-class_init (CamelSimpleDataWrapperStreamClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (camel_stream_get_type ());
-}
-
-static void
-init (CamelSimpleDataWrapperStream *simple_data_wrapper_stream)
-{
- simple_data_wrapper_stream->current_position = 0;
-}
-
-
-GtkType
-camel_simple_data_wrapper_stream_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "CamelSimpleDataWrapperStream",
- sizeof (CamelSimpleDataWrapperStream),
- sizeof (CamelSimpleDataWrapperStreamClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (camel_stream_get_type (), &info);
- }
-
- return type;
-}
-
-void
-camel_simple_data_wrapper_stream_construct (CamelSimpleDataWrapperStream *stream,
- CamelSimpleDataWrapper *wrapper)
-{
- g_return_if_fail (stream != NULL);
- g_return_if_fail (CAMEL_IS_SIMPLE_DATA_WRAPPER_STREAM (stream));
- g_return_if_fail (wrapper != NULL);
- g_return_if_fail (CAMEL_IS_SIMPLE_DATA_WRAPPER (wrapper));
-
- gtk_object_ref (GTK_OBJECT (wrapper));
- stream->wrapper = wrapper;
- gtk_signal_connect (GTK_OBJECT (wrapper), "destroy",
- wrapper_destroy_cb, stream);
-}
-
-CamelStream *
-camel_simple_data_wrapper_stream_new (CamelSimpleDataWrapper *wrapper)
-{
- CamelStream *stream;
-
- g_return_val_if_fail (wrapper != NULL, NULL);
- g_return_val_if_fail (CAMEL_IS_SIMPLE_DATA_WRAPPER (wrapper), NULL);
-
- stream = gtk_type_new (camel_simple_data_wrapper_stream_get_type ());
-
- camel_simple_data_wrapper_stream_construct
- (CAMEL_SIMPLE_DATA_WRAPPER_STREAM (stream), wrapper);
-
- return stream;
-}
diff --git a/camel/camel-simple-data-wrapper-stream.h b/camel/camel-simple-data-wrapper-stream.h
deleted file mode 100644
index 094f15faf7..0000000000
--- a/camel/camel-simple-data-wrapper-stream.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* camel-simple-data-wrapper-stream.h
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com)
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef __CAMEL_SIMPLE_DATA_WRAPPER_STREAM_H__
-#define __CAMEL_SIMPLE_DATA_WRAPPER_STREAM_H__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-#include "camel-simple-data-wrapper.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define CAMEL_TYPE_SIMPLE_DATA_WRAPPER_STREAM \
- (camel_simple_data_wrapper_stream_get_type ())
-#define CAMEL_SIMPLE_DATA_WRAPPER_STREAM(obj) \
- (GTK_CHECK_CAST ((obj), CAMEL_TYPE_SIMPLE_DATA_WRAPPER_STREAM, CamelSimpleDataWrapperStream))
-#define CAMEL_SIMPLE_DATA_WRAPPER_STREAM_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), CAMEL_TYPE_SIMPLE_DATA_WRAPPER_STREAM, CamelSimpleDataWrapperStreamClass))
-#define CAMEL_IS_SIMPLE_DATA_WRAPPER_STREAM(obj) \
- (GTK_CHECK_TYPE ((obj), CAMEL_TYPE_SIMPLE_DATA_WRAPPER_STREAM))
-#define CAMEL_IS_SIMPLE_DATA_WRAPPER_STREAM_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((obj), CAMEL_TYPE_SIMPLE_DATA_WRAPPER_STREAM))
-
-
-typedef struct _CamelSimpleDataWrapperStream CamelSimpleDataWrapperStream;
-typedef struct _CamelSimpleDataWrapperStreamClass CamelSimpleDataWrapperStreamClass;
-
-struct _CamelSimpleDataWrapperStream {
- CamelStream parent;
-
- CamelSimpleDataWrapper *wrapper;
- gint current_position;
-};
-
-struct _CamelSimpleDataWrapperStreamClass {
- CamelStreamClass parent_class;
-};
-
-
-GtkType camel_simple_data_wrapper_stream_get_type (void);
-CamelStream *camel_simple_data_wrapper_stream_new (CamelSimpleDataWrapper *wrapper);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __CAMEL_SIMPLE_DATA_WRAPPER_STREAM_H__ */
diff --git a/camel/camel-simple-data-wrapper.c b/camel/camel-simple-data-wrapper.c
deleted file mode 100644
index 943d8e902d..0000000000
--- a/camel/camel-simple-data-wrapper.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-simple-data-wrapper.c : simple implementation of a data wrapper */
-/* store the data in a glib byte array */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-
-#include "camel-simple-data-wrapper.h"
-#include "camel-simple-data-wrapper-stream.h"
-#include "camel-log.h"
-
-static CamelDataWrapperClass *parent_class=NULL;
-
-/* Returns the class for a CamelDataWrapper */
-#define CSDW_CLASS(so) CAMEL_SIMPLE_DATA_WRAPPER_CLASS (GTK_OBJECT(so)->klass)
-
-static void _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void _write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
-static void _finalize (GtkObject *object);
-static CamelStream *_get_stream (CamelDataWrapper *data_wrapper);
-
-static void
-camel_simple_data_wrapper_class_init (CamelSimpleDataWrapperClass *camel_simple_data_wrapper_class)
-{
- CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_simple_data_wrapper_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_data_wrapper_class);
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
- /* virtual method definition */
-
- /* virtual method overload */
- camel_data_wrapper_class->write_to_stream = _write_to_stream;
- camel_data_wrapper_class->construct_from_stream = _construct_from_stream;
-
- camel_data_wrapper_class->get_stream = _get_stream;
-
- gtk_object_class->finalize = _finalize;
-}
-
-
-static void
-camel_simple_data_wrapper_init (CamelSimpleDataWrapper *wrapper)
-{
- wrapper->stream = NULL;
-}
-
-GtkType
-camel_simple_data_wrapper_get_type (void)
-{
- static GtkType camel_simple_data_wrapper_type = 0;
-
- if (!camel_simple_data_wrapper_type) {
- GtkTypeInfo camel_simple_data_wrapper_info =
- {
- "CamelSimpleDataWrapper",
- sizeof (CamelSimpleDataWrapper),
- sizeof (CamelSimpleDataWrapperClass),
- (GtkClassInitFunc) camel_simple_data_wrapper_class_init,
- (GtkObjectInitFunc) camel_simple_data_wrapper_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_simple_data_wrapper_type = gtk_type_unique (camel_data_wrapper_get_type (), &camel_simple_data_wrapper_info);
- }
-
- return camel_simple_data_wrapper_type;
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelSimpleDataWrapper *simple_data_wrapper = CAMEL_SIMPLE_DATA_WRAPPER (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMimePart::finalize\n");
- if (simple_data_wrapper->byte_array) g_byte_array_free (simple_data_wrapper->byte_array, TRUE);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMimePart::finalize\n");
-}
-
-
-/**
- * camel_simple_data_wrapper_new: create a new CamelSimpleDataWrapper object
- *
- *
- *
- * Return value:
- **/
-CamelSimpleDataWrapper *
-camel_simple_data_wrapper_new ()
-{
- CamelSimpleDataWrapper *simple_data_wrapper;
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering new()\n");
-
- simple_data_wrapper = (CamelSimpleDataWrapper *)gtk_type_new (CAMEL_SIMPLE_DATA_WRAPPER_TYPE);
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Leaving new()\n");
- return simple_data_wrapper;
-}
-
-
-
-static void
-_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelSimpleDataWrapper *simple_data_wrapper = CAMEL_SIMPLE_DATA_WRAPPER (data_wrapper);
- GByteArray *array;
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering _write_to_stream\n");
-
- g_assert (data_wrapper);
- g_assert (stream);
- g_assert (simple_data_wrapper->byte_array);
- array = simple_data_wrapper->byte_array;
- if (array->len)
- camel_stream_write (stream, (gchar *)array->data, array->len);
-
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Leaving _write_to_stream\n");
-}
-
-
-#define _CMSDW_TMP_BUF_SIZE 100
-static void
-_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
-{
- CamelSimpleDataWrapper *simple_data_wrapper = CAMEL_SIMPLE_DATA_WRAPPER (data_wrapper);
- gint nb_bytes_read;
- static gchar *tmp_buf;
- GByteArray *array;
-
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering _construct_from_stream\n");
-
- g_assert (data_wrapper);
- g_assert (stream);
-
- if (!tmp_buf) {
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream allocating new temp buffer "
- "with %d bytes\n", _CMSDW_TMP_BUF_SIZE);
- tmp_buf = g_new (gchar, _CMSDW_TMP_BUF_SIZE);
- }
-
- array = simple_data_wrapper->byte_array;
- if (array) {
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream freeing old byte array\n");
- g_byte_array_free (array, FALSE);
- }
-
- array = g_byte_array_new ();
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream new byte array address:%p\n", array);
- simple_data_wrapper->byte_array = array;
- nb_bytes_read = camel_stream_read (stream, tmp_buf, _CMSDW_TMP_BUF_SIZE);
- while (nb_bytes_read>0) {
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::construct_from_stream read %d bytes from stream\n", nb_bytes_read);
- if (nb_bytes_read>0) g_byte_array_append (array, tmp_buf, nb_bytes_read);
- nb_bytes_read = camel_stream_read (stream, tmp_buf, _CMSDW_TMP_BUF_SIZE);
- };
-
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Leaving _construct_from_stream\n");
-}
-
-
-
-
-/**
- * camel_simple_data_wrapper_set_text: set some text as data wrapper content
- * @simple_data_wrapper: SimpleDataWrapper object
- * @text: the text to use
- *
- * Utility routine used to set up the content of a SimpleDataWrapper object
- * to be a character string.
- **/
-void
-camel_simple_data_wrapper_set_text (CamelSimpleDataWrapper *simple_data_wrapper, const gchar *text)
-{
- GByteArray *array;
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering set_text\n");
-
- array = simple_data_wrapper->byte_array;
- if (array) {
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::set_text freeing old byte array\n");
- g_byte_array_free (array, FALSE);
- }
-
- array = g_byte_array_new ();
- simple_data_wrapper->byte_array = array;
-
- g_byte_array_append (array, text, strlen (text));
-
- CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper:: Entering set_text\n");
-}
-
-
-
-static CamelStream *
-_get_stream (CamelDataWrapper *data_wrapper)
-{
- CamelSimpleDataWrapper *simple_data_wrapper;
-
- simple_data_wrapper = CAMEL_SIMPLE_DATA_WRAPPER (data_wrapper);
- if (simple_data_wrapper->stream == NULL) {
- CamelStream *s;
-
- s = camel_simple_data_wrapper_stream_new (simple_data_wrapper);
- simple_data_wrapper->stream = s;
- }
-
- return simple_data_wrapper->stream;
-}
diff --git a/camel/camel-simple-data-wrapper.h b/camel/camel-simple-data-wrapper.h
deleted file mode 100644
index 1a511b96c4..0000000000
--- a/camel/camel-simple-data-wrapper.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-simple-data-wrapper.c : simple implementation of a data wrapper */
-/* store the data in a glib byte array */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_SIMPLE_DATA_WRAPPER_H
-#define CAMEL_SIMPLE_DATA_WRAPPER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include "camel-stream.h"
-#include "camel-data-wrapper.h"
-
-
-
-#define CAMEL_SIMPLE_DATA_WRAPPER_TYPE (camel_simple_data_wrapper_get_type ())
-#define CAMEL_SIMPLE_DATA_WRAPPER(obj) (GTK_CHECK_CAST((obj), CAMEL_SIMPLE_DATA_WRAPPER_TYPE, CamelSimpleDataWrapper))
-#define CAMEL_SIMPLE_DATA_WRAPPER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SIMPLE_DATA_WRAPPER_TYPE, CamelSimpleDataWrapperClass))
-#define CAMEL_IS_SIMPLE_DATA_WRAPPER(o) (GTK_CHECK_TYPE((o), CAMEL_SIMPLE_DATA_WRAPPER_TYPE))
-
-
-typedef struct
-{
- CamelDataWrapper parent_object;
-
- GByteArray *byte_array;
- CamelStream *stream;
-} CamelSimpleDataWrapper;
-
-
-
-typedef struct {
- CamelDataWrapperClass parent_class;
-
-
-} CamelSimpleDataWrapperClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_simple_data_wrapper_get_type (void);
-
-
-/* public methods */
-
-CamelSimpleDataWrapper *camel_simple_data_wrapper_new ();
-void camel_simple_data_wrapper_set_text (CamelSimpleDataWrapper *simple_data_wrapper, const gchar *text);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_SIMPLE_DATA_WRAPPER_H */
diff --git a/camel/camel-store.c b/camel/camel-store.c
deleted file mode 100644
index 5b69490521..0000000000
--- a/camel/camel-store.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelStore.c : Abstract class for an email store */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-store.h"
-#include "camel-log.h"
-
-static CamelServiceClass *parent_class = NULL;
-
-/* Returns the class for a CamelStore */
-#define CS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-static void _set_separator(CamelStore *store, gchar sep);
-static CamelFolder *_get_root_folder(CamelStore *store);
-static CamelFolder *_get_default_folder(CamelStore *store);
-static void _init(CamelStore *store, CamelSession *session, const gchar *url_name);
-static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name);
-static gchar _get_separator (CamelStore *store);
-
-static void _finalize (GtkObject *object);
-
-static void
-camel_store_class_init (CamelStoreClass *camel_store_class)
-{
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_store_class);
-
- parent_class = gtk_type_class (camel_service_get_type ());
-
- /* virtual method definition */
- camel_store_class->init = _init;
- camel_store_class->set_separator = _set_separator;
- camel_store_class->get_separator = _get_separator;
- camel_store_class->get_folder = _get_folder;
- camel_store_class->get_root_folder = _get_root_folder;
- camel_store_class->get_default_folder = _get_default_folder;
-
- /* virtual method overload */
- gtk_object_class->finalize = _finalize;
-}
-
-
-
-
-
-
-
-GtkType
-camel_store_get_type (void)
-{
- static GtkType camel_store_type = 0;
-
- if (!camel_store_type) {
- GtkTypeInfo camel_store_info =
- {
- "CamelStore",
- sizeof (CamelStore),
- sizeof (CamelStoreClass),
- (GtkClassInitFunc) camel_store_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_store_type = gtk_type_unique (CAMEL_SERVICE_TYPE, &camel_store_info);
- }
-
- return camel_store_type;
-}
-
-
-
-
-
-/**
- * camel_store_init: call store's init method
- * @store: the store to initialize
- * @session: session which instantiates the store
- * @url_name: URL defining the store
- *
- * This routine is called by the session object from which this
- * store is created. It must not be called directly.
- *
- **/
-void
-camel_store_init (CamelStore *store, CamelSession *session, const gchar *url_name)
-{
- g_assert(store);
- CS_CLASS(store)->init (store, session, url_name);
-}
-
-
-/**
- * init: method called by a session object to initialize a store object
- * @store: the store to initialize
- * @session: session which instantiates the store
- * @url_name: URL defining the store
- *
- * This routine is called by the session object from which this
- * store is created. Be careful, @url_name is used as a private field
- * of the store object.
- *
- **/
-static void
-_init (CamelStore *store, CamelSession *session, const gchar *url_name)
-{
-
-#warning re-enable assertion here.
- g_assert(session);
- g_assert(url_name);
-
- store->session = session;
- gtk_object_ref (GTK_OBJECT (session));
- /*store->url_name = url_name;*/
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelStore *camel_store = CAMEL_STORE (object);
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStore::finalize\n");
-
- /* if (camel_store->url_name) g_free (camel_store->url_name); */
- if (camel_store->session) gtk_object_unref (GTK_OBJECT (camel_store->session));
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStore::finalize\n");
-}
-
-
-
-/**
- * camel_store_set_separator: set the character which separates this folder path from the folders names in a lower level of hierarchy.
- *
- * @store:
- * @sep:
- *
- **/
-static void
-_set_separator (CamelStore *store, gchar sep)
-{
- store->separator = sep;
-}
-
-
-
-
-
-static gchar
-_get_separator (CamelStore *store)
-{
- g_assert(store);
- return store->separator;
-}
-
-
-
-/**
- * camel_store_get_separator: return the character which separates this folder path from the folders names in a lower level of hierarchy.
- * @store: store
- *
- *
- *
- * Return value: the separator
- **/
-gchar
-camel_store_get_separator (CamelStore *store)
-{
- return CS_CLASS(store)->get_separator (store);
-}
-
-
-
-
-
-
-
-static CamelFolder *
-_get_folder (CamelStore *store, const gchar *folder_name)
-{
- return NULL;
-}
-
-
-/**
- * camel_store_get_folder: return the folder corresponding to a path.
- * @store: store
- * @folder_name: name of the folder to get
- *
- * Returns the folder corresponding to the path "name".
- * If the path begins with the separator caracter, it
- * is relative to the root folder. Otherwise, it is
- * relative to the default folder.
- * The folder does not necessarily exist on the store.
- * To make sure it already exists, use its "exists" method.
- * If it does not exist, you can create it with its
- * "create" method.
- *
- *
- * Return value: the folder
- **/
-CamelFolder *
-camel_store_get_folder (CamelStore *store, const gchar *folder_name)
-{
- return CS_CLASS(store)->get_folder (store, folder_name);
-}
-
-
-/**
- * camel_store_get_root_folder : return the toplevel folder
- *
- * Returns the folder which is at the top of the folder
- * hierarchy. This folder is generally different from
- * the default folder.
- *
- * @Return value: the tolevel folder.
- **/
-static CamelFolder *
-_get_root_folder (CamelStore *store)
-{
- return NULL;
-}
-
-/**
- * camel_store_get_default_folder : return the store default folder
- *
- * The default folder is the folder which is presented
- * to the user in the default configuration. The default
- * is often the root folder.
- *
- * @Return value: the default folder.
- **/
-static CamelFolder *
-_get_default_folder (CamelStore *store)
-{
- return NULL;
-}
-
-
-
diff --git a/camel/camel-store.h b/camel/camel-store.h
deleted file mode 100644
index 71f368e2e2..0000000000
--- a/camel/camel-store.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-store.h : Abstract class for an email store */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_STORE_H
-#define CAMEL_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-typedef struct _CamelStore CamelStore;
-
-#include "camel-folder.h"
-#include "camel-service.h"
-#include "camel-session.h"
-
-#define CAMEL_STORE_TYPE (camel_store_get_type ())
-#define CAMEL_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_STORE_TYPE, CamelStore))
-#define CAMEL_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STORE_TYPE, CamelStoreClass))
-#define CAMEL_IS_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_STORE_TYPE))
-
-
-struct _CamelStore
-{
- CamelService parent_object;
-
- CamelSession *session;
- /* gchar *url_name; */
- gchar separator;
-};
-
-
-
-typedef struct {
- CamelServiceClass parent_class;
-
- void (*init) (CamelStore *store, CamelSession *session, const gchar *url_name);
- void (*set_separator) (CamelStore *store, gchar sep);
- gchar (*get_separator) (CamelStore *store);
- CamelFolder * (*get_folder) (CamelStore *store, const gchar *folder_name);
- CamelFolder * (*get_root_folder) (CamelStore *store);
- CamelFolder * (*get_default_folder) (CamelStore *store);
-
-} CamelStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_store_get_type (void);
-
-void camel_store_init (CamelStore *store, CamelSession *session, const gchar *url_name);
-CamelFolder *camel_store_get_folder (CamelStore *store, const gchar *folder_name);
-gchar camel_store_get_separator (CamelStore *store);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STORE_H */
diff --git a/camel/camel-stream-buffered-fs.c b/camel/camel-stream-buffered-fs.c
deleted file mode 100644
index c42f47aa96..0000000000
--- a/camel/camel-stream-buffered-fs.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-buffered-fs.c : file system based stream with buffer*/
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-#include "camel-stream-buffered-fs.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include "camel-log.h"
-
-static CamelStreamFsClass *parent_class=NULL;
-
-
-/* Returns the class for a CamelStreamBufferedFs */
-#define CSBFS_CLASS(so) CAMEL_STREAM_BUFFERED_FS_CLASS (GTK_OBJECT(so)->klass)
-#define CSFS_CLASS(so) CAMEL_STREAM_FS_CLASS (GTK_OBJECT(so)->klass)
-#define CS_CLASS(so) CAMEL_STREAM_CLASS (GTK_OBJECT(so)->klass)
-
-static gint _read (CamelStream *stream, gchar *buffer, gint n);
-static gint _write (CamelStream *stream, const gchar *buffer, gint n);
-static void _flush (CamelStream *stream);
-static gint _available (CamelStream *stream);
-static gboolean _eos (CamelStream *stream);
-static void _close (CamelStream *stream);
-static gint _seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy);
-
-static void _finalize (GtkObject *object);
-static void _destroy (GtkObject *object);
-
-static void
-camel_stream_buffered_fs_class_init (CamelStreamBufferedFsClass *camel_stream_buffered_fs_class)
-{
- CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_buffered_fs_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_buffered_fs_class);
-
- parent_class = gtk_type_class (camel_stream_fs_get_type ());
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_stream_class->read = _read;
-
- gtk_object_class->finalize = _finalize;
- gtk_object_class->destroy = _destroy;
-
-}
-
-static void
-camel_stream_buffered_fs_init (gpointer object, gpointer klass)
-{
- CamelStreamBufferedFs *stream = CAMEL_STREAM_BUFFERED_FS (object);
-
- stream->buffer_size = 200;
- stream->read_buffer = g_new (gchar, stream->buffer_size);
- stream->write_buffer = g_new (gchar, stream->buffer_size);
- stream->read_pos = 0;
- stream->read_pos_max = 0;
- stream->write_pos = 0;
- stream->write_pos_max = stream->buffer_size;
-}
-
-GtkType
-camel_stream_buffered_fs_get_type (void)
-{
- static GtkType camel_stream_buffered_fs_type = 0;
-
- gdk_threads_enter ();
- if (!camel_stream_buffered_fs_type) {
- GtkTypeInfo camel_stream_buffered_fs_info =
- {
- "CamelStreamBufferedFs",
- sizeof (CamelStreamBufferedFs),
- sizeof (CamelStreamBufferedFsClass),
- (GtkClassInitFunc) camel_stream_buffered_fs_class_init,
- (GtkObjectInitFunc) camel_stream_buffered_fs_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_buffered_fs_type = gtk_type_unique (camel_stream_fs_get_type (), &camel_stream_buffered_fs_info);
- }
- gdk_threads_leave ();
- return camel_stream_buffered_fs_type;
-}
-
-
-static void
-_destroy (GtkObject *object)
-{
- CamelStreamBufferedFs *stream_buffered_fs = CAMEL_STREAM_BUFFERED_FS (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamBufferedFs::destroy\n");
-
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamBufferedFs::destroy\n");
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelStreamBufferedFs *stream_buffered_fs = CAMEL_STREAM_BUFFERED_FS (object);
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamBufferedFs::finalize\n");
-
- g_free (stream_buffered_fs->read_buffer);
- g_free (stream_buffered_fs->write_buffer);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamBufferedFs::finalize\n");
-}
-
-
-
-CamelStream *
-camel_stream_buffered_fs_new_with_name (const gchar *name, CamelStreamFsMode mode)
-{
- CamelStreamFs *stream_buffered_fs;
- stream_buffered_fs = gtk_type_new (camel_stream_buffered_fs_get_type ());
- CSFS_CLASS (stream_buffered_fs)->init_with_name (stream_buffered_fs, name, mode);
-
- return CAMEL_STREAM (stream_buffered_fs);
-
-}
-
-CamelStream *
-camel_stream_buffered_fs_new_with_fd (int fd)
-{
- CamelStreamFs *stream_buffered_fs;
-
- CAMEL_LOG_FULL_DEBUG ( "Entering CamelStream::new_with_fd fd=%d\n",fd);
- stream_buffered_fs = gtk_type_new (camel_stream_buffered_fs_get_type ());
- CSFS_CLASS (stream_buffered_fs)->init_with_fd (stream_buffered_fs, fd);
-
-
- return CAMEL_STREAM (stream_buffered_fs);
-}
-
-/**
- * _read: read bytes from a stream
- * @stream: stream
- * @buffer: buffer where bytes are stored
- * @n: max number of bytes to read
- *
- *
- *
- * Return value: number of bytes actually read.
- **/
-static gint
-_read (CamelStream *stream, gchar *buffer, gint n)
-{
- CamelStreamBufferedFs *sbf = CAMEL_STREAM_BUFFERED_FS (stream);
- gint v;
- gint nb_bytes_buffered;
- gint nb_bytes_to_read = n;
- gint nb_bytes_read = 0;
- gint bytes_chunk;
- gboolean eof = FALSE;
-
- g_return_val_if_fail (n>0, n);
-
- nb_bytes_buffered = sbf->read_pos_max - sbf->read_pos;
- while ( (!eof) && (nb_bytes_to_read>0)) {
- if (nb_bytes_buffered <= 0) {
- /* have to read some data on disk */
- v = CAMEL_STREAM_CLASS (parent_class)->read (stream, sbf->read_buffer, sbf->buffer_size);
- nb_bytes_buffered = v;
- sbf->read_pos_max = v;
- sbf->read_pos = 0;
- }
-
- /* nb of bytes to put inside buffer */
- bytes_chunk = MIN (nb_bytes_buffered, nb_bytes_to_read);
-
- if (bytes_chunk > 0) {
- /* copy some bytes from the cache */
- memcpy (buffer, sbf->read_buffer + sbf->read_pos, bytes_chunk);
- nb_bytes_buffered -= bytes_chunk;
- nb_bytes_to_read -= bytes_chunk;
- nb_bytes_read += bytes_chunk;
- sbf->read_pos += bytes_chunk;
-
- } else /* nb_bytes_to_read is >0 so if bytes_chunk is <0
- * there was no data available */
- eof = TRUE;
- }
-
-
-
- return nb_bytes_read;
-}
-
-
-static gint
-_write (CamelStream *stream, const gchar *buffer, gint n)
-{
- return 0;
-}
-
-
-
-static void
-_flush (CamelStream *stream)
-{
-
-}
-
-
-
-static gint
-_available (CamelStream *stream)
-{
- return 0;
-}
-
-
-static gboolean
-_eos (CamelStream *stream)
-{
- return FALSE;
-}
-
-
-
-static void
-_close (CamelStream *stream)
-{
-
-}
-
-
-static gint
-_seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy)
-{
- return 0;
-}
diff --git a/camel/camel-stream-buffered-fs.h b/camel/camel-stream-buffered-fs.h
deleted file mode 100644
index 778c7e88df..0000000000
--- a/camel/camel-stream-buffered-fs.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-bufered-fs.h :stream based on unix filesystem */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_STREAM_BUFFERED_FS_H
-#define CAMEL_STREAM_BUFFERED_FS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include "camel-stream-fs.h"
-
-#define CAMEL_STREAM_BUFFERED_FS_TYPE (camel_stream_buffered_fs_get_type ())
-#define CAMEL_STREAM_BUFFERED_FS(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_BUFFERED_FS_TYPE, CamelStreamBufferedFs))
-#define CAMEL_STREAM_BUFFERED_FS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_BUFFERED_FS_TYPE, CamelStreamBufferedFsClass))
-#define CAMEL_IS_STREAM_BUFFERED_FS(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_BUFFERED_FS_TYPE))
-
-typedef enum
-{
- CAMEL_STREAM_BUFFERED_FS_READ = 1,
- CAMEL_STREAM_BUFFERED_FS_WRITE = 2
-} CamelStreamBufferedFsMode;
-
-
-typedef struct
-{
- CamelStreamFs parent_object;
-
- gint buffer_size;
- gchar *read_buffer;
- gint read_pos;
- gint read_pos_max;
-
- gchar *write_buffer;
- gint write_pos;
- gint write_pos_max;
-
-} CamelStreamBufferedFs;
-
-
-
-typedef struct {
- CamelStreamFsClass parent_class;
-
- /* Virtual methods */
-
-} CamelStreamBufferedFsClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_stream_buffered_fs_get_type (void);
-
-
-/* public methods */
-CamelStream *camel_stream_buffered_fs_new_with_name (const gchar *name, CamelStreamBufferedFsMode mode);
-CamelStream *camel_stream_buffered_fs_new_with_fd (int fd);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_BUFFERED_FS_H */
diff --git a/camel/camel-stream-data-wrapper.c b/camel/camel-stream-data-wrapper.c
deleted file mode 100644
index f4dfbb29e9..0000000000
--- a/camel/camel-stream-data-wrapper.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* camel-stream-data-wrapper.c
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com)
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-
-#include "camel-stream-data-wrapper.h"
-
-
-static CamelDataWrapperClass *parent_class = NULL;
-
-
-/* CamelDataWrapper methods. */
-
-static void
-write_to_stream (CamelDataWrapper *data_wrapper,
- CamelStream *output_stream)
-{
-#define BUFFER_SIZE 4096
- gchar buffer[BUFFER_SIZE];
- CamelStreamDataWrapper *stream_data_wrapper;
- CamelStream *input_stream;
-
- stream_data_wrapper = CAMEL_STREAM_DATA_WRAPPER (data_wrapper);
- input_stream = stream_data_wrapper->stream;
-
- while (TRUE) {
- gchar *p;
- gint read, written;
-
- read = camel_stream_read (input_stream, buffer, BUFFER_SIZE);
- if (read == 0)
- break;
-
- p = buffer;
- while (read > 0) {
- written = camel_stream_write (output_stream, p, read);
-
- /* FIXME no way to report an error?! */
- if (written == -1)
- break;
-
- p += written;
- read -= written;
- }
- }
-#undef BUFFER_SIZE
-}
-
-static CamelStream *
-get_stream (CamelDataWrapper *data_wrapper)
-{
- CamelStreamDataWrapper *stream_data_wrapper;
-
- stream_data_wrapper = CAMEL_STREAM_DATA_WRAPPER (data_wrapper);
- return stream_data_wrapper->stream;
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- CamelStreamDataWrapper *stream_data_wrapper;
- GtkObject *stream_object;
-
- stream_data_wrapper = CAMEL_STREAM_DATA_WRAPPER (object);
-
- stream_object = GTK_OBJECT (object);
- stream_data_wrapper->stream = NULL;
-
- gtk_object_unref (stream_object);
-}
-
-
-/* This handles destruction of the associated CamelDataWrapper outside
- CamelStreamDataWrapper, for debuggin purposes (this should never happen). */
-static void
-stream_destroy_cb (GtkObject *object,
- gpointer data)
-{
- CamelStreamDataWrapper *wrapper;
-
- wrapper = CAMEL_STREAM_DATA_WRAPPER (data);
-
- /* Hack: when we destroy the stream ourselves, we set the `stream'
- member to NULL first, so that we can recognize when this is done out
- of our control. */
- if (wrapper->stream != NULL) {
- g_warning ("CamelSimpleDataWrapperStream: associated CamelSimpleDataWrapper was destroyed.");
- wrapper->stream = NULL;
- }
-}
-
-
-static void
-class_init (CamelStreamDataWrapperClass *class)
-{
- GtkObjectClass *object_class;
- CamelDataWrapperClass *data_wrapper_class;
-
- object_class = GTK_OBJECT_CLASS (class);
- object_class->destroy = destroy;
-
- data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (class);
- data_wrapper_class->write_to_stream = write_to_stream;
- data_wrapper_class->get_stream = get_stream;
-
- parent_class = gtk_type_class (camel_data_wrapper_get_type ());
-}
-
-static void
-init (CamelStreamDataWrapper *wrapper)
-{
- wrapper->stream = NULL;
-}
-
-
-GtkType
-camel_stream_data_wrapper_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "CamelStreamDataWrapper",
- sizeof (CamelStreamDataWrapper),
- sizeof (CamelStreamDataWrapperClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (camel_data_wrapper_get_type (), &info);
- }
-
- return type;
-}
-
-/**
- * camel_stream_data_wrapper_construct:
- * @wrapper: A CamelStreamDataWrapper object
- * @stream: A Camel stream object
- *
- * Construct @wrapper associating @stream to it. Notice that, after this call,
- * @stream is conceptually owned by @wrapper and will be destroyed when
- * @wrapper is destroyed.
- **/
-void
-camel_stream_data_wrapper_construct (CamelStreamDataWrapper *wrapper,
- CamelStream *stream)
-{
- g_return_if_fail (wrapper != NULL);
- g_return_if_fail (CAMEL_IS_STREAM_DATA_WRAPPER (wrapper));
- g_return_if_fail (stream != NULL);
- g_return_if_fail (CAMEL_IS_STREAM (stream));
-
- wrapper->stream = stream;
- gtk_signal_connect (GTK_OBJECT (stream), "destroy",
- GTK_SIGNAL_FUNC (stream_destroy_cb), wrapper);
-}
-
-/**
- * camel_stream_data_wrapper_new:
- * @stream: A Camel stream object
- *
- * Create a new stream data wrapper object for @stream. Notice that, after
- * this call, @stream is conceptually owned by the new wrapper and will be
- * destroyed when the wrapper is destroyed.
- *
- * Return value: A pointer to the new CamelStreamDataWrapper object.
- **/
-CamelDataWrapper *
-camel_stream_data_wrapper_new (CamelStream *stream)
-{
- CamelDataWrapper *wrapper;
-
- wrapper = gtk_type_new (camel_stream_data_wrapper_get_type ());
- camel_stream_data_wrapper_construct
- (CAMEL_STREAM_DATA_WRAPPER (wrapper), stream);
-
- return wrapper;
-}
diff --git a/camel/camel-stream-data-wrapper.h b/camel/camel-stream-data-wrapper.h
deleted file mode 100644
index d0b95e63a6..0000000000
--- a/camel/camel-stream-data-wrapper.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* camel-stream-data-wrapper.h
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef __CAMEL_STREAM_DATA_WRAPPER_H__
-#define __CAMEL_STREAM_DATA_WRAPPER_H__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include "camel-data-wrapper.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-
-#define CAMEL_TYPE_STREAM_DATA_WRAPPER \
- (camel_stream_data_wrapper_get_type ())
-#define CAMEL_STREAM_DATA_WRAPPER(obj) \
- (GTK_CHECK_CAST ((obj), CAMEL_TYPE_STREAM_DATA_WRAPPER, CamelStreamDataWrapper))
-#define CAMEL_STREAM_DATA_WRAPPER_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), CAMEL_TYPE_STREAM_DATA_WRAPPER, CamelStreamDataWrapperClass))
-#define CAMEL_IS_STREAM_DATA_WRAPPER(obj) \
- (GTK_CHECK_TYPE ((obj), CAMEL_TYPE_STREAM_DATA_WRAPPER))
-#define CAMEL_IS_STREAM_DATA_WRAPPER_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((obj), CAMEL_TYPE_STREAM_DATA_WRAPPER))
-
-
-typedef struct _CamelStreamDataWrapper CamelStreamDataWrapper;
-typedef struct _CamelStreamDataWrapperClass CamelStreamDataWrapperClass;
-
-struct _CamelStreamDataWrapper {
- CamelDataWrapper parent;
-
- CamelStream *stream;
-};
-
-struct _CamelStreamDataWrapperClass {
- CamelDataWrapperClass parent_class;
-};
-
-
-GtkType camel_stream_data_wrapper_get_type (void);
-CamelDataWrapper *camel_stream_data_wrapper_new (CamelStream *stream);
-void camel_stream_data_wrapper_construct (CamelStreamDataWrapper *wrapper,
- CamelStream *stream);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __CAMEL_STREAM_DATA_WRAPPER_H__ */
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
deleted file mode 100644
index c4d6e9be8c..0000000000
--- a/camel/camel-stream-fs.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-fs.c : file system based stream */
-
-/* inspired by gnome-stream-fs.c in bonobo by Miguel de Icaza */
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-stream-fs.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include "camel-log.h"
-
-static CamelStreamClass *parent_class=NULL;
-
-
-/* Returns the class for a CamelStreamFS */
-#define CSFS_CLASS(so) CAMEL_STREAM_FS_CLASS (GTK_OBJECT(so)->klass)
-
-static gint _read (CamelStream *stream, gchar *buffer, gint n);
-static gint _write (CamelStream *stream, const gchar *buffer, gint n);
-static void _flush (CamelStream *stream);
-static gint _available (CamelStream *stream);
-static gboolean _eos (CamelStream *stream);
-static void _close (CamelStream *stream);
-static gint _seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy);
-
-static void _finalize (GtkObject *object);
-static void _destroy (GtkObject *object);
-
-static void _init_with_fd (CamelStreamFs *stream_fs, int fd);
-static void _init_with_name (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode);
-
-static void
-camel_stream_fs_class_init (CamelStreamFsClass *camel_stream_fs_class)
-{
- CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_fs_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_fs_class);
-
- parent_class = gtk_type_class (camel_stream_get_type ());
-
- /* virtual method definition */
- camel_stream_fs_class->init_with_fd = _init_with_fd;
- camel_stream_fs_class->init_with_name = _init_with_name;
-
- /* virtual method overload */
- camel_stream_class->read = _read;
- camel_stream_class->write = _write;
- camel_stream_class->flush = _flush;
- camel_stream_class->available = _available;
- camel_stream_class->eos = _eos;
- camel_stream_class->close = _close;
- camel_stream_class->seek = _seek;
-
- gtk_object_class->finalize = _finalize;
- gtk_object_class->destroy = _destroy;
-
-}
-
-static void
-camel_stream_fs_init (gpointer object, gpointer klass)
-{
- CamelStreamFs *stream = CAMEL_STREAM_FS (object);
-
- stream->name = NULL;
-}
-
-
-GtkType
-camel_stream_fs_get_type (void)
-{
- static GtkType camel_stream_fs_type = 0;
-
- if (!camel_stream_fs_type) {
- GtkTypeInfo camel_stream_fs_info =
- {
- "CamelStreamFs",
- sizeof (CamelStreamFs),
- sizeof (CamelStreamFsClass),
- (GtkClassInitFunc) camel_stream_fs_class_init,
- (GtkObjectInitFunc) camel_stream_fs_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_fs_type = gtk_type_unique (camel_stream_get_type (), &camel_stream_fs_info);
- }
-
- return camel_stream_fs_type;
-}
-
-
-static void
-_destroy (GtkObject *object)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (object);
- gint close_error;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamFs::destroy\n");
-
- close_error = close (stream_fs->fd);
- if (close_error) {
- CAMEL_LOG_FULL_DEBUG ("CamelStreamFs::destroy Error while closing file descriptor\n");
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
- }
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamFs::destroy\n");
-}
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelStreamFs *stream_fs = CAMEL_STREAM_FS (object);
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamFs::finalize\n");
-
- g_free (stream_fs->name);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamFs::finalize\n");
-}
-
-static void
-_init_with_fd (CamelStreamFs *stream_fs, int fd)
-{
- stream_fs->fd = fd;
-}
-
-static void
-_init_with_name (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode)
-{
- struct stat s;
- int v, fd;
- int flags;
-
- g_assert (name);
- CAMEL_LOG_FULL_DEBUG ( "Entering CamelStream::new_with_name, name=\"%s\", mode=%d\n", name, mode);
- v = stat (name, &s);
-
- if (mode & CAMEL_STREAM_FS_READ){
- if (mode & CAMEL_STREAM_FS_WRITE)
- flags = O_RDWR | O_CREAT;
- else
- flags = O_RDONLY;
- } else {
- if (mode & CAMEL_STREAM_FS_WRITE)
- flags = O_WRONLY | O_CREAT;
- else
- return;
- }
- if ( (mode & CAMEL_STREAM_FS_READ) && !(mode & CAMEL_STREAM_FS_WRITE) )
- if (v == -1) return;
-
- fd = open (name, flags, 0600);
- if (fd==-1) {
- CAMEL_LOG_WARNING ( "CamelStreamFs::new_with_name can not obtain fd for file \"%s\"\n", name);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
- return;
- }
-
- stream_fs->name = g_strdup (name);
- CSFS_CLASS (stream_fs)->init_with_fd (stream_fs, fd);
-
-
-
-}
-
-
-CamelStream *
-camel_stream_fs_new_with_name (const gchar *name, CamelStreamFsMode mode)
-{
- CamelStreamFs *stream_fs;
- stream_fs = gtk_type_new (camel_stream_fs_get_type ());
- CSFS_CLASS (stream_fs)->init_with_name (stream_fs, name, mode);
-
- return CAMEL_STREAM (stream_fs);
-
-}
-
-CamelStream *
-camel_stream_fs_new_with_fd (int fd)
-{
- CamelStreamFs *stream_fs;
-
- CAMEL_LOG_FULL_DEBUG ( "Entering CamelStream::new_with_fd fd=%d\n",fd);
- stream_fs = gtk_type_new (camel_stream_fs_get_type ());
- CSFS_CLASS (stream_fs)->init_with_fd (stream_fs, fd);
-
-
- return CAMEL_STREAM (stream_fs);
-}
-
-/**
- * _read: read bytes from a stream
- * @stream: stream
- * @buffer: buffer where bytes are stored
- * @n: max number of bytes to read
- *
- *
- *
- * Return value: number of bytes actually read.
- **/
-static gint
-_read (CamelStream *stream, gchar *buffer, gint n)
-{
- gint v;
- do {
- v = read ( (CAMEL_STREAM_FS (stream))->fd, buffer, n);
- } while (v == -1 && errno == EINTR);
- if (v<0)
- CAMEL_LOG_FULL_DEBUG ("CamelStreamFs::read v=%d\n", v);
- return v;
-}
-
-
-/**
- * _write: read bytes to a stream
- * @stream: the stream
- * @buffer: byte buffer
- * @n: number of bytes to write
- *
- *
- *
- * Return value: the number of bytes actually written
- * in the stream.
- **/
-static gint
-_write (CamelStream *stream, const gchar *buffer, gint n)
-{
- int v;
- g_assert (stream);
- g_assert ((CAMEL_STREAM_FS (stream))->fd);
- CAMEL_LOG_FULL_DEBUG ( "CamelStreamFs:: entering write. n=%d\n", n);
- do {
- v = write ( (CAMEL_STREAM_FS (stream))->fd, buffer, n);
- } while (v == -1 && errno == EINTR);
-
-#if HARD_LOG_LEVEL >= FULL_DEBUG
- if (v==-1) {
- perror("");
- CAMEL_LOG_FULL_DEBUG ( "CamelStreamFs::write could not write bytes in stream\n");
- }
-#endif
- return v;
-
-}
-
-
-
-/**
- * _flush: flush pending changes
- * @stream: the stream
- *
- *
- **/
-static void
-_flush (CamelStream *stream)
-{
- fsync ((CAMEL_STREAM_FS (stream))->fd);
-}
-
-
-
-/**
- * _available: return the number of bytes available for reading
- * @stream: the stream
- *
- * Return the number of bytes available without blocking.
- *
- * Return value: the number of bytes available
- **/
-static gint
-_available (CamelStream *stream)
-{
- g_warning ("Not implemented yet");
- return -1;
-}
-
-
-/**
- * _eos: test if there are bytes left to read
- * @stream: the stream
- *
- *
- *
- * Return value: true if all stream has been read
- **/
-static gboolean
-_eos (CamelStream *stream)
-{
- g_warning ("Not implemented yet");
- return FALSE;
-}
-
-
-/**
- * _close: close a stream
- * @stream: the stream
- *
- *
- **/
-static void
-_close (CamelStream *stream)
-{
- close ((CAMEL_STREAM_FS (stream))->fd);
-}
-
-
-static gint
-_seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy)
-{
- int whence;
- switch (policy) {
- case CAMEL_STREAM_SET:
- whence = SEEK_SET;
- break;
- case CAMEL_STREAM_CUR:
- whence = SEEK_CUR;
- break;
- case CAMEL_STREAM_END:
- whence = SEEK_END;
- break;
- default:
- return -1;
- }
-
-
- return lseek ((CAMEL_STREAM_FS (stream))->fd, offset, whence);
-}
diff --git a/camel/camel-stream-fs.h b/camel/camel-stream-fs.h
deleted file mode 100644
index 85df8f3a2c..0000000000
--- a/camel/camel-stream-fs.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-fs.h :stream based on unix filesystem */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_STREAM_FS_H
-#define CAMEL_STREAM_FS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include "camel-stream.h"
-
-#define CAMEL_STREAM_FS_TYPE (camel_stream_fs_get_type ())
-#define CAMEL_STREAM_FS(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_FS_TYPE, CamelStreamFs))
-#define CAMEL_STREAM_FS_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_FS_TYPE, CamelStreamFsClass))
-#define CAMEL_IS_STREAM_FS(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_FS_TYPE))
-
-typedef enum
-{
- CAMEL_STREAM_FS_READ = 1,
- CAMEL_STREAM_FS_WRITE = 2
-} CamelStreamFsMode;
-
-
-typedef struct
-{
- CamelStream parent_object;
- gchar *name;
- int fd;
-} CamelStreamFs;
-
-
-
-typedef struct {
- CamelStreamClass parent_class;
-
- /* Virtual methods */
- void (*init_with_fd) (CamelStreamFs *stream_fs, int fd);
- void (*init_with_name) (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode);
-
-} CamelStreamFsClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_stream_fs_get_type (void);
-
-
-/* public methods */
-CamelStream *camel_stream_fs_new_with_name (const gchar *name, CamelStreamFsMode mode);
-CamelStream *camel_stream_fs_new_with_fd (int fd);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_FS_H */
diff --git a/camel/camel-stream-mem.c b/camel/camel-stream-mem.c
deleted file mode 100644
index df69fc0448..0000000000
--- a/camel/camel-stream-mem.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-mem.c : memory buffer based stream */
-
-/* inspired by gnome-stream-mem.c in bonobo by Miguel de Icaza */
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-stream-mem.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include "camel-log.h"
-
-static CamelStreamClass *parent_class=NULL;
-
-
-/* Returns the class for a CamelStreamMEM */
-#define CS_CLASS(so) CAMEL_STREAM_MEM_CLASS (GTK_OBJECT(so)->klass)
-
-static gint _read (CamelStream *stream, gchar *buffer, gint n);
-static gint _write (CamelStream *stream, const gchar *buffer, gint n);
-static void _flush (CamelStream *stream);
-static gint _available (CamelStream *stream);
-static gboolean _eos (CamelStream *stream);
-static void _close (CamelStream *stream);
-static gint _seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy);
-
-static void _finalize (GtkObject *object);
-
-static void
-camel_stream_mem_class_init (CamelStreamMemClass *camel_stream_mem_class)
-{
- CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_mem_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_mem_class);
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
-
- /* virtual method overload */
- camel_stream_class->read = _read;
- camel_stream_class->write = _write;
- camel_stream_class->flush = _flush;
- camel_stream_class->available = _available;
- camel_stream_class->eos = _eos;
- camel_stream_class->close = _close;
- camel_stream_class->seek = _seek;
-
- gtk_object_class->finalize = _finalize;
-
-}
-
-static void
-camel_stream_mem_init (gpointer object, gpointer klass)
-{
- CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (object);
- camel_stream_mem->position = 0;
-}
-
-GtkType
-camel_stream_mem_get_type (void)
-{
- static GtkType camel_stream_mem_type = 0;
-
- if (!camel_stream_mem_type) {
- GtkTypeInfo camel_stream_mem_info =
- {
- "CamelStreamMem",
- sizeof (CamelStreamMem),
- sizeof (CamelStreamMemClass),
- (GtkClassInitFunc) camel_stream_mem_class_init,
- (GtkObjectInitFunc) camel_stream_mem_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_mem_type = gtk_type_unique (camel_stream_get_type (), &camel_stream_mem_info);
- }
-
- return camel_stream_mem_type;
-}
-
-
-CamelStream *
-camel_stream_mem_new (CamelStreamMemMode mode)
-{
- CamelStreamMem *stream_mem;
- GByteArray *buffer;
-
- buffer = g_byte_array_new ();
- stream_mem = (CamelStreamMem *)camel_stream_mem_new_with_buffer (buffer, mode);
- return CAMEL_STREAM (stream_mem);
-}
-
-
-CamelStream *
-camel_stream_mem_new_with_buffer (GByteArray *buffer, CamelStreamMemMode mode)
-{
- CamelStreamMem *stream_mem;
-
- stream_mem = gtk_type_new (camel_stream_mem_get_type ());
- stream_mem->mode = mode;
- stream_mem->buffer = buffer;
-
- return CAMEL_STREAM (stream_mem);
-}
-
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelStreamMem *stream_mem = CAMEL_STREAM_MEM (object);
-
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelStreamMem::finalize\n");
- g_byte_array_free (stream_mem->buffer, TRUE);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelStreamMem::finalize\n");
-}
-
-
-
-/**
- * _read: read bytes from a stream
- * @stream: stream
- * @buffer: buffer where bytes are stored
- * @n: max number of bytes to read
- *
- *
- *
- * Return value: number of bytes actually read.
- **/
-static gint
-_read (CamelStream *stream, gchar *buffer, gint n)
-{
- CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (stream);
- gint nb_bytes_to_read;
-
- g_assert (stream);
- nb_bytes_to_read = MIN (n, (camel_stream_mem->buffer)->len - camel_stream_mem->position);
- if (nb_bytes_to_read>0) {
- memcpy (buffer, (camel_stream_mem->buffer)->data + camel_stream_mem->position, nb_bytes_to_read);
- camel_stream_mem->position += nb_bytes_to_read;
- } else nb_bytes_to_read = -1;
-
- return nb_bytes_to_read;
-}
-
-
-/**
- * _write: read bytes to a stream
- * @stream: the stream
- * @buffer: byte buffer
- * @n: number of bytes to write
- *
- *
- *
- * Return value: the number of bytes actually written
- * in the stream.
- **/
-static gint
-_write (CamelStream *stream, const gchar *buffer, gint n)
-{
- CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (stream);
-
- g_assert (stream);
- g_return_val_if_fail (camel_stream_mem->position>=0, -1);
- camel_stream_mem->buffer = g_byte_array_append (camel_stream_mem->buffer, (const guint8 *)buffer, n);
- camel_stream_mem->position += n;
-
- return n;
-}
-
-
-
-/**
- * _flush: flush pending changes
- * @stream: the stream
- *
- *
- **/
-static void
-_flush (CamelStream *stream)
-{
- g_warning ("Not implemented yet");
-}
-
-
-
-/**
- * _available: return the number of bytes available for reading
- * @stream: the stream
- *
- * Return the number of bytes available without blocking.
- *
- * Return value: the number of bytes available
- **/
-static gint
-_available (CamelStream *stream)
-{
- g_warning ("Not implemented yet");
- return -1;
-}
-
-
-/**
- * _eos: test if there are bytes left to read
- * @stream: the stream
- *
- *
- *
- * Return value: true if all stream has been read
- **/
-static gboolean
-_eos (CamelStream *stream)
-{
- g_warning ("Not implemented yet");
- return FALSE;
-}
-
-
-/**
- * _close: close a stream
- * @stream: the stream
- *
- *
- **/
-static void
-_close (CamelStream *stream)
-{
- g_warning ("Not implemented yet");
-}
-
-
-
-static gint
-_seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy)
-{
- gint position;
- CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (stream);
-
- switch (policy) {
- case CAMEL_STREAM_SET:
- position = offset;
- break;
- case CAMEL_STREAM_CUR:
- position = camel_stream_mem->position + offset;
- break;
- case CAMEL_STREAM_END:
- position = (camel_stream_mem->buffer)->len + offset;
- break;
- default:
- return -1;
- }
-
- position = MIN (position, (camel_stream_mem->buffer)->len);
- position = MAX (position, 0);
-
- camel_stream_mem->position = position;
-
- return position;
-}
diff --git a/camel/camel-stream-mem.h b/camel/camel-stream-mem.h
deleted file mode 100644
index 0ebcfead24..0000000000
--- a/camel/camel-stream-mem.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream-mem.h :stream based on memory buffer */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_STREAM_MEM_H
-#define CAMEL_STREAM_MEM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include "camel-stream.h"
-
-#define CAMEL_STREAM_MEM_TYPE (camel_stream_mem_get_type ())
-#define CAMEL_STREAM_MEM(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_MEM_TYPE, CamelStreamMem))
-#define CAMEL_STREAM_MEM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_MEM_TYPE, CamelStreamMemClass))
-#define CAMEL_IS_STREAM_MEM(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_MEM_TYPE))
-
-typedef enum
-{
- CAMEL_STREAM_MEM_READ = 1,
- CAMEL_STREAM_MEM_WRITE = 2,
- CAMEL_STREAM_MEM_RW = 3
-} CamelStreamMemMode;
-
-
-typedef struct
-{
- CamelStream parent_object;
-
- GByteArray *buffer;
- gint position;
- CamelStreamMemMode mode;
-} CamelStreamMem;
-
-
-
-typedef struct {
- CamelStreamClass parent_class;
-
- /* Virtual methods */
-
-} CamelStreamMemClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_stream_mem_get_type (void);
-
-
-/* public methods */
-CamelStream *camel_stream_mem_new (CamelStreamMemMode mode);
-CamelStream * camel_stream_mem_new_with_buffer (GByteArray *buffer,
- CamelStreamMemMode mode);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_MEM_H */
diff --git a/camel/camel-stream.c b/camel/camel-stream.c
deleted file mode 100644
index 26c346e1e5..0000000000
--- a/camel/camel-stream.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream.c : abstract class for a stream */
-
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include "camel-stream.h"
-
-static GtkObjectClass *parent_class = NULL;
-
-
-/* Returns the class for a CamelMimeMessage */
-#define CS_CLASS(so) CAMEL_STREAM_CLASS (GTK_OBJECT(so)->klass)
-
-static void
-default_camel_flush (CamelStream *stream)
-{
- /* nothing */
-}
-
-static void
-default_camel_close (CamelStream *stream)
-{
- /* nothing */
-}
-
-static gint
-default_camel_seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy)
-{
- /* nothing */
- return -1;
-}
-
-static void
-camel_stream_class_init (CamelStreamClass *camel_stream_class)
-{
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- /* virtual method definition */
- camel_stream_class->read = NULL;
- camel_stream_class->write = NULL;
- camel_stream_class->flush = default_camel_flush;
- camel_stream_class->available = NULL;
- camel_stream_class->eos = NULL;
- camel_stream_class->close = default_camel_close;
- camel_stream_class->seek = default_camel_seek;
-
- /* virtual method overload */
-}
-
-GtkType
-camel_stream_get_type (void)
-{
- static GtkType camel_stream_type = 0;
-
- if (!camel_stream_type) {
- GtkTypeInfo camel_stream_info =
- {
- "CamelStream",
- sizeof (CamelStream),
- sizeof (CamelStreamClass),
- (GtkClassInitFunc) camel_stream_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_stream_type = gtk_type_unique (gtk_object_get_type (), &camel_stream_info);
- }
-
- return camel_stream_type;
-}
-
-/**
- * camel_stream_read:
- * @stream: a CamelStream.
- * @buffer: buffer where bytes pulled from the stream are stored.
- * @n: max number of bytes to read.
- *
- * Read at most @n bytes from the @stream object and stores them
- * in the buffer pointed at by @buffer.
- *
- * Return value: number of bytes actually read.
- **/
-gint
-camel_stream_read (CamelStream *stream, gchar *buffer, gint n)
-{
- return CS_CLASS (stream)->read (stream, buffer, n);
-}
-
-/**
- * camel_stream_write:
- * @stream: a CamelStream object.
- * @buffer: buffer to write.
- * @n: number of bytes to write
- *
- * Write @n bytes from the buffer pointed at by @buffer into @stream.
- *
- * Return value: the number of bytes actually written
- * in the stream.
- **/
-gint
-camel_stream_write (CamelStream *stream, const gchar *buffer, gint n)
-{
- return CS_CLASS (stream)->write (stream, buffer, n);
-}
-
-/**
- * camel_stream_flush:
- * @stream: a CamelStream object
- *
- * Flushes the contents of the stream to its backing store.
- **/
-void
-camel_stream_flush (CamelStream *stream)
-{
- CS_CLASS (stream)->flush (stream);
-}
-
-/**
- * camel_stream_available:
- * @stream: a CamelStream object
- *
- * Return value: the number of bytes available.
- **/
-gint
-camel_stream_available (CamelStream *stream)
-{
- return CS_CLASS (stream)->available (stream);
-}
-
-/**
- * camel_stream_eos:
- * @stream: a CamelStream object
- *
- * Test if there are bytes left to read on the @stream object.
- *
- * Return value: %TRUE if all the contents on the stream has been read, or
- * %FALSE if information is still available.
- **/
-gboolean
-camel_stream_eos (CamelStream *stream)
-{
- return CS_CLASS (stream)->eos (stream);
-}
-
-
-/**
- * camel_stram_close:
- * @stream: a CamelStream object.
- *
- * Close the @stream object.
- **/
-void
-camel_stream_close (CamelStream *stream)
-{
- CS_CLASS (stream)->close (stream);
-}
-
-
-/**
- * camel_stream_seek:
- * @stream: a CamelStream object.
- * @offset: offset value
- * @policy: what to do with the offset
- *
- *
- *
- * Return value: new position, -1 if operation failed.
- **/
-gint
-camel_stream_seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy)
-{
- return CS_CLASS (stream)->seek (stream, offset, policy);
-}
-
-
-
-
-/***************** Utility functions ********************/
-
-/**
- * came_stream_write_strings:
- * @stream: a CamelStream object.
- * @...: A %NULL terminated list of strings.
- *
- * This is a utility function that writes the list of
- * strings into the @stream object.
- */
-void
-camel_stream_write_strings (CamelStream *stream, ... )
-{
- va_list args;
- const char *string;
-
- va_start(args, stream);
- string = va_arg (args, const char *);
-
- while (string) {
- camel_stream_write_string (stream, string);
- string = va_arg (args, char *);
- }
- va_end (args);
-}
diff --git a/camel/camel-stream.h b/camel/camel-stream.h
deleted file mode 100644
index b866dd5974..0000000000
--- a/camel/camel-stream.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-stream.h : class for an abstract stream */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_STREAM_H
-#define CAMEL_STREAM_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-
-#define CAMEL_STREAM_TYPE (camel_stream_get_type ())
-#define CAMEL_STREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_STREAM_TYPE, CamelStream))
-#define CAMEL_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_STREAM_TYPE, CamelStreamClass))
-#define CAMEL_IS_STREAM(o) (GTK_CHECK_TYPE((o), CAMEL_STREAM_TYPE))
-
-typedef enum
-{
- CAMEL_STREAM_SET,
- CAMEL_STREAM_CUR,
- CAMEL_STREAM_END
-} CamelStreamSeekPolicy;
-
-typedef struct
-{
- GtkObject parent_object;
-
-} CamelStream;
-
-
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /* Virtual methods */
- gint (*read) (CamelStream *stream, gchar *buffer, gint n);
- gint (*write) (CamelStream *stream, const gchar *buffer, gint n);
- void (*flush) (CamelStream *stream);
- gint (*available) (CamelStream *stream);
- gboolean (*eos) (CamelStream *stream);
- void (*close) (CamelStream *stream);
- gint (*seek) (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy);
-} CamelStreamClass;
-
-
-
-/* Standard Gtk function */
-GtkType camel_stream_get_type (void);
-
-
-/* public methods */
-gint camel_stream_read (CamelStream *stream, gchar *buffer, gint n);
-gint camel_stream_write (CamelStream *stream, const gchar *buffer, gint n);
-void camel_stream_flush (CamelStream *stream);
-gint camel_stream_available (CamelStream *stream);
-gboolean camel_stream_eos (CamelStream *stream);
-void camel_stream_close (CamelStream *stream);
-gint camel_stream_seek (CamelStream *stream, gint offset, CamelStreamSeekPolicy policy);
-
-/* utility macros and funcs */
-#define camel_stream_write_string(stream, string) camel_stream_write ((stream), (string), strlen (string))
-
-void camel_stream_write_strings (CamelStream *stream, ... );
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_STREAM_H */
diff --git a/camel/camel-thread-proxy.c b/camel/camel-thread-proxy.c
deleted file mode 100644
index 5ff176a7fb..0000000000
--- a/camel/camel-thread-proxy.c
+++ /dev/null
@@ -1,569 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.c : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#include <config.h>
-#include "camel-log.h"
-#include "camel-marshal-utils.h"
-#include "camel-thread-proxy.h"
-#include <pthread.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-
-
-/* vocabulary:
- * operation: commanded by the main thread, executed by the child thread
- * callback: commanded by the child thread, generally when an operation is
- * completed. Executed in the main thread,
- */
-
-/* needed for proper casts of async funcs when
- * calling pthreads_create
- */
-typedef void * (*thread_call_func) (void *);
-
-/* forward declarations */
-static gboolean
-_thread_notification_catch (GIOChannel *source,
- GIOCondition condition,
- gpointer data);
-
-static void
-_notify_availability (CamelThreadProxy *proxy, gchar op_name);
-
-static int
-_init_notify_system (CamelThreadProxy *proxy);
-
-
-
-/**
- * camel_thread_proxy_new: create a new proxy object
- *
- * Create a new proxy object. This proxy object can be used
- * to run async operations and this operations can trigger
- * callbacks. It can also be used to proxy signals.
- *
- * Return value: The newly created proxy object
- **/
-CamelThreadProxy *
-camel_thread_proxy_new ()
-{
- CamelThreadProxy *proxy;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::new\n");
-
- proxy = g_new (CamelThreadProxy, 1);
- if (!proxy)
- return NULL;
-
- proxy->server_op_queue = camel_op_queue_new ();
- proxy->client_op_queue = camel_op_queue_new ();
- proxy->signal_data_cond = g_cond_new();
- proxy->signal_data_mutex = g_mutex_new();
- if (_init_notify_system (proxy) < 0) {
- g_free (proxy);
- return NULL;
- }
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::new\n");
- return proxy;
-}
-
-
-/**
- * camel_thread_proxy_free: free a proxy object
- * @proxy: proxy object to free
- *
- * free a proxy object
- **/
-void
-camel_thread_proxy_free (CamelThreadProxy *proxy)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::free\n");
-
- g_cond_free (proxy->signal_data_cond);
- g_mutex_free (proxy->signal_data_mutex);
- camel_op_queue_free (proxy->server_op_queue);
- camel_op_queue_free (proxy->client_op_queue);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::free\n");
-}
-
-
-
-
-
-/* Operations handling */
-
-
-/**
- * _op_run_free_notify:
- * @folder: folder to notify when the operation is completed.
- * @op: operation to run.
- *
- * run an operation, free the operation field
- * and then notify the main thread of the op
- * completion.
- *
- * this routine is intended to be called
- * in a new thread (in _run_next_op_in_thread)
- *
- **/
-void
-_op_run_free_and_notify (CamelOp *op)
-{
- gboolean error;
- CamelThreadProxy *th_proxy;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_op_run_free_and_notify\n");
-
- camel_op_run (op);
- camel_op_free (op);
- th_proxy = camel_op_get_user_data (op);
- _notify_availability (th_proxy, 'a');
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_op_run_free_and_notify\n");
-}
-
-
-/**
- * _run_next_op_in_thread:
- * @proxy_object:
- *
- * run the next operation pending in the proxy
- * operation queue
- **/
-static void
-_run_next_op_in_thread (CamelThreadProxy *proxy)
-{
- CamelOp *op;
- CamelOpQueue *server_op_queue;
- CamelThreadProxy *th_proxy;
- pthread_t thread;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_run_next_op_in_thread\n");
-
- server_op_queue = proxy->server_op_queue;
- /* get the next pending operation */
- op = camel_op_queue_pop_op (server_op_queue);
- if (!op) {
- camel_op_queue_set_service_availability (server_op_queue, TRUE);
- return;
- }
-
- /* run the operation in a child thread */
- pthread_create (&thread, NULL, (thread_call_func) _op_run_free_and_notify, op);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_run_next_op_in_thread\n");
-}
-
-
-
-/**
- * camel_thread_proxy_push_op: push an operation in the proxy operation queue
- * @proxy: proxy object
- * @op: operation to push in the execution queue
- *
- * if no thread is currently running, executes the
- * operation directly, otherwise push the operation
- * in the proxy operation queue.
- **/
-void
-camel_thread_proxy_push_op (CamelThreadProxy *proxy, CamelOp *op)
-{
- CamelOpQueue *server_op_queue;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::camel_thread_proxy_push_op\n");
-
- g_assert (proxy);
- server_op_queue = proxy->server_op_queue;
-
- /* put the proxy object in the user data
- so that it can be notified when the
- operation is completed */
- camel_op_set_user_data (op, (gpointer)proxy);
-
- /* get next operation */
- camel_op_queue_push_op (server_op_queue, op);
-
- if (camel_op_queue_get_service_availability (server_op_queue)) {
- /* no thread is currently running, run
- * the next operation. */
- camel_op_queue_set_service_availability (server_op_queue, FALSE);
- /* when the operation is completed in the
- child thread the main thread gets
- notified and executes next operation
- (see _thread_notification_catch, case 'a')
- so there is no need to set the service
- availability to FALSE except here
- */
- _run_next_op_in_thread (proxy);
- }
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::camel_thread_proxy_push_op\n");
-}
-/**
- * _op_run_and_free: Run an operation and free it
- * @op: Operation object
- *
- * Run an operation object in the current thread
- * and free it.
- **/
-static void
-_op_run_and_free (CamelOp *op)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_op_run_and_free\n");
- camel_op_run (op);
- camel_op_free (op);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_op_run_and_free\n");
-}
-
-
-
-
-
-
-/* Callbacks handling */
-
-/**
- * _run_next_cb: Run next callback pending in a proxy object
- * @proxy: Proxy object
- *
- * Run next callback in the callback queue of a proxy object
- **/
-static void
-_run_next_cb (CamelThreadProxy *proxy)
-{
- CamelOp *op;
- CamelOpQueue *client_op_queue;
- CamelThreadProxy *th_proxy;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_run_next_cb\n");
- client_op_queue = proxy->client_op_queue;
-
- /* get the next pending operation */
- op = camel_op_queue_pop_op (client_op_queue);
- if (!op) return;
-
- /* run the operation in the main thread */
- _op_run_and_free (op);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_run_next_cb\n");
-}
-
-
-/**
- * camel_thread_proxy_push_cb: push a callback in the client queue
- * @proxy: proxy object concerned by the callback
- * @cb: callback to push
- *
- * Push an operation in the client queue, ie the queue
- * containing the operations (callbacks) intended to be
- * executed in the main thread.
- **/
-void
-camel_thread_proxy_push_cb (CamelThreadProxy *proxy, CamelOp *cb)
-{
- CamelOpQueue *client_op_queue;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::camel_thread_proxy_push_cb\n");
- client_op_queue = proxy->client_op_queue;
-
- /* put the proxy object in the user data
- so that it can be notified when the
- operation is completed */
- camel_op_set_user_data (cb, (gpointer)proxy);
-
- /* push the callback in the client queue */
- camel_op_queue_push_op (client_op_queue, cb);
-
- /* tell the main thread a new callback is there */
- _notify_availability (proxy, 'c');
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::camel_thread_proxy_push_cb\n");
-}
-
-
-
-/**
- * _init_notify_system: set the notify channel up
- * @proxy: proxy object
- *
- * called once to set the notification channel up
- **/
-static int
-_init_notify_system (CamelThreadProxy *proxy)
-{
- int filedes[2];
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_init_notify_system\n");
-
- /* set up the notification channel */
- if (pipe (filedes) < 0) {
- CAMEL_LOG_WARNING ("could not create pipe in CamelThreadProxy::_init_notify_system\n");
- CAMEL_LOG_FULL_DEBUG ("Full error message : %s\n", strerror(errno));
- return -1;
- }
-
-
- proxy->pipe_client_fd = filedes [0];
- proxy->pipe_server_fd = filedes [1];
- proxy->notify_source = g_io_channel_unix_new (filedes [0]);
- proxy->notify_channel = g_io_channel_unix_new (filedes [1]);
-
- /* the _thread_notification_catch function
- * will be called in the main thread when the
- * child thread writes some data in the channel */
- g_io_add_watch (proxy->notify_source, G_IO_IN,
- _thread_notification_catch,
- proxy);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_init_notify_system\n");
- return 1;
-}
-
-/**
- * _notify_availability: notify the main thread from an event
- * @proxy: proxy object
- * @op_name: operation name
- *
- * called by child thread to notify the main
- * thread something is available for him.
- * What this thing is depends on @op_name:
- *
- * 'a' : thread available. That means the thread is ready
- * to process an operation.
- * 's' : a signal is available. Used by the signal proxy.
- *
- */
-static void
-_notify_availability (CamelThreadProxy *proxy, gchar op_name)
-{
- GIOChannel *notification_channel;
- guint bytes_written;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_notify_availability\n");
-
- notification_channel = proxy->notify_channel;
-
- do {
- /* the write operation will trigger the
- * watch on the main thread side */
- g_io_channel_write (notification_channel,
- &op_name,
- 1,
- &bytes_written);
- } while (bytes_written < 1);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_notify_availability\n");
-}
-
-
-
-/* signal proxying */
-
-
-
-/**
- * _signal_marshaller_server_side: called in the child thread to proxy a signal
- * @object:
- * @data:
- * @n_args:
- * @args:
- *
- *
- **/
-static void
-_signal_marshaller_server_side (GtkObject *object,
- gpointer data,
- guint n_args,
- GtkArg *args)
-{
- CamelThreadProxy *proxy;
- guint signal_id;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_signal_marshaller_server_side\n");
- proxy = CAMEL_THREAD_PROXY (gtk_object_get_data (object, "__proxy__"));
- signal_id = (guint)data;
- g_assert (proxy);
-
- g_mutex_lock (proxy->signal_data_mutex);
-
- /* we are going to wait for the main client thread
- * to have emitted the last signal we asked him
- * to proxy.
- */
- while (proxy->signal_data.args)
- g_cond_wait (proxy->signal_data_cond,
- proxy->signal_data_mutex);
-
- proxy->signal_data.signal_id = signal_id;
- proxy->signal_data.args = args;
-
-
- g_mutex_unlock (proxy->signal_data_mutex);
-
- /* tell the main thread there is a signal pending */
- _notify_availability (proxy, 's');
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_signal_marshaller_server_side\n");
-}
-
-
-static void
-_signal_marshaller_client_side (CamelThreadProxy *proxy)
-{
- g_mutex_lock (proxy->signal_data_mutex);
- g_assert (proxy->signal_data.args);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_signal_marshaller_client_side\n");
- /* emit the pending signal */
- gtk_signal_emitv (GTK_OBJECT (proxy),
- proxy->signal_data.signal_id,
- proxy->signal_data.args);
-
- proxy->signal_data.args = NULL;
-
- /* if waiting for the signal to be treated,
- * awake the client thread up
- */
- g_cond_signal (proxy->signal_data_cond);
- g_mutex_unlock (proxy->signal_data_mutex);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_signal_marshaller_client_side\n");
-}
-
-
-/**
- * camel_thread_proxy_add_signals: init the signal proxy
- * @proxy: proxy
- * @proxy_object: Proxy Gtk Object
- * @real_object: Real Gtk Object
- * @signal_to_proxy: NULL terminated array of signal name
- *
- * Add some signals to the list of signals to be
- * proxied by the proxy object.
- * The signals emitted by the real object in the child
- * thread are reemited by the proxy object in the
- * main thread.
- **/
-void
-camel_thread_proxy_add_signals (CamelThreadProxy *proxy,
- GtkObject *proxy_object,
- GtkObject *real_object,
- char *signal_to_proxy[])
-{
- GtkType camel_folder_type;
- guint i;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::camel_thread_proxy_init_signals\n");
-
- for (i=0; signal_to_proxy[i]; i++) {
- /* connect the signal to the signal marshaller
- * user_data is the signal id */
- gtk_signal_connect_full (GTK_OBJECT (real_object),
- signal_to_proxy[i],
- NULL,
- _signal_marshaller_server_side,
- (gpointer)gtk_signal_lookup (signal_to_proxy[i],
- GTK_OBJECT_CLASS (real_object)->type),
- NULL,
- TRUE,
- FALSE);
- }
-
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::camel_thread_proxy_init_signals\n");
-
-
-}
-
-/**** catch notification from child thread ****/
-/**
- * _thread_notification_catch: call by glib loop when data is available on the thread io channel
- * @source:
- * @condition:
- * @data:
- *
- * called by watch set on the IO channel
- *
- * Return value: TRUE because we don't want the watch to be removed
- **/
-static gboolean
-_thread_notification_catch (GIOChannel *source,
- GIOCondition condition,
- gpointer data)
-{
- CamelThreadProxy *proxy = CAMEL_THREAD_PROXY (data);
- gchar op_name;
- guint bytes_read;
- GIOError error;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelThreadProxy::_thread_notification_catch\n");
-
-
- error = g_io_channel_read (source,
- &op_name,
- 1,
- &bytes_read);
-
- while ((!error) && (bytes_read == 1)) {
-
- switch (op_name) {
- case 'a': /* the thread is OK for a new operation */
- _run_next_op_in_thread (proxy);
- break;
- case 's': /* there is a pending signal to proxy */
- _signal_marshaller_client_side (proxy);
- break;
- case 'c': /* there is a cb pending in the main thread */
- _run_next_cb (proxy);
- break;
- }
-
- error = g_io_channel_read (source,
- &op_name,
- 1,
- &bytes_read);
-
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelThreadProxy::_thread_notification_catch\n");
-
- /* do not remove the io watch */
- return TRUE;
-}
-
-
-
-
-
-
-
-
-
-
-
diff --git a/camel/camel-thread-proxy.h b/camel/camel-thread-proxy.h
deleted file mode 100644
index 9ce7f0e11b..0000000000
--- a/camel/camel-thread-proxy.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-folder-pt-proxy.h : proxy folder using posix threads */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-
-
-#ifndef CAMEL_THREAD_PROXY_H
-#define CAMEL_THREAD_PROXY_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include "camel-op-queue.h"
-
-#define CAMEL_THREAD_PROXY(o) (CamelThreadProxy *)(o)
-
-
-typedef struct {
- guint signal_id;
- GtkArg *args;
-} CamelThreadProxySignalData;
-
-
-typedef struct {
-
- GtkObject *real_object;
- GtkObject *proxy_object;
-
- CamelOpQueue *server_op_queue;
- CamelOpQueue *client_op_queue;
-
-
- gint pipe_client_fd;
- gint pipe_server_fd;
- GIOChannel *notify_source;
- GIOChannel *notify_channel;
-
- /* signal proxy */
- GMutex *signal_data_mutex;
- GCond *signal_data_cond;
- CamelThreadProxySignalData signal_data;
-
-} CamelThreadProxy;
-
-
-CamelThreadProxy *camel_thread_proxy_new ();
-void camel_thread_proxy_free (CamelThreadProxy *proxy);
-
-void camel_thread_proxy_push_op (CamelThreadProxy *proxy, CamelOp *op);
-void camel_thread_proxy_push_cb (CamelThreadProxy *proxy, CamelOp *cb);
-
-void camel_thread_proxy_add_signals (CamelThreadProxy *proxy,
- GtkObject *proxy_object,
- GtkObject *real_object,
- char *signal_to_proxy[]);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_THREAD_PROXY_H */
-
-
diff --git a/camel/camel.c b/camel/camel.c
deleted file mode 100644
index b6b1012a66..0000000000
--- a/camel/camel.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "camel.h"
-
-gint
-camel_init()
-{
-#ifdef G_THREADS_ENABLED
- g_thread_init (NULL);
-#else /* G_THREADS_ENABLED */
- printf ("Threads are not supported by glib\n");
-#endif /* G_THREADS_ENABLED */
-
- /* return data_wrapper_repository_init (); */
-}
diff --git a/camel/camel.h b/camel/camel.h
deleted file mode 100644
index 0e41d32742..0000000000
--- a/camel/camel.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_H
-#define CAMEL_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include <camel/data-wrapper-repository.h>
-#include <camel/data-wrapper-repository.h>
-#include <camel/camel-log.h>
-#include <camel/camel-data-wrapper.h>
-#include <camel-simple-data-wrapper.h>
-#include <camel-folder.h>
-#include <camel-folder-pt-proxy.h>
-#include <camel-marshal-utils.h>
-#include <camel-mime-body-part.h>
-#include <camel-mime-message.h>
-#include <camel-mime-part.h>
-#include <camel-multipart.h>
-#include <camel-op-queue.h>
-#include <camel-provider.h>
-#include <camel-service.h>
-#include <camel-session.h>
-#include <camel-store.h>
-#include <camel-stream.h>
-#include <camel-stream-fs.h>
-#include <camel-stream-mem.h>
-#include <camel-thread-proxy.h>
-#include <data-wrapper-repository.h>
-#include <gmime-content-field.h>
-#include <gmime-utils.h>
-#include <gstring-util.h>
-#include <string-utils.h>
-#include <url-util.h>
-
-gint camel_init ();
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_H */
diff --git a/camel/data-wrapper-repository.c b/camel/data-wrapper-repository.c
deleted file mode 100644
index 7d1b1dc05f..0000000000
--- a/camel/data-wrapper-repository.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-
-#include "data-wrapper-repository.h"
-#include "camel-multipart.h"
-
-
-
-static DataWrapperRepository _repository;
-static _initialized = -1;
-GMimeContentField *_content_field;
-
-
-
-/**
- * data_wrapper_repository_init: initialize data wrapper repository
- *
- * initialize the data wrapper repository. When the repository has
- * already been initialized, returns -1.
- *
- * Return value: 1 if correctly initialized returns -1.
- **/
-gint
-data_wrapper_repository_init ()
-{
- if (_initialized != -1) return -1;
- _repository.mime_links = g_hash_table_new (g_str_hash, g_str_equal);
- data_wrapper_repository_set_data_wrapper_type ("multipart", camel_multipart_get_type());
- _content_field = gmime_content_field_new (NULL, NULL);
- _initialized = 1;
- return 1;
-}
-
-/**
- * data_wrapper_repository_set_data_wrapper_type: associate a data wrapper object type to a mime type
- * @mime_type: mime type
- * @object_type: object type
- *
- * Associate an object type to a mime type.
- **/
-void
-data_wrapper_repository_set_data_wrapper_type (const gchar *mime_type, GtkType object_type)
-{
- gboolean already_exists;
- gchar *old_mime_type;
- GtkType old_gtk_type;
-
- already_exists = g_hash_table_lookup_extended (_repository.mime_links, (gpointer)mime_type,
- (gpointer)&old_mime_type, (gpointer)&old_gtk_type);
- if (already_exists)
- g_hash_table_insert (_repository.mime_links, (gpointer)old_mime_type, (gpointer)object_type);
- else
- g_hash_table_insert (_repository.mime_links, (gpointer)g_strdup (mime_type), (gpointer)object_type);
-}
-
-
-
-/**
- * data_wrapper_repository_get_data_wrapper_type: get the gtk type object associated to a mime type
- * @mime_type: mime type
- *
- * returns the GtkType of the data wrapper object associated to
- * a particular mime type. The mime type must be a character string
- * of the form "type/subtype" or simply "type". When the complete
- * mime type ("type/subtype") is not associated to any particular
- * data wrapper object, this routine looks for a default data wrapper
- * for the main mime type ("type"). When no particular association is
- * found for this mime type, the type of the SimpleDataWrapper is
- * returned.
- *
- *
- * Return value: the associated data wrapper object type.
- **/
-GtkType
-data_wrapper_repository_get_data_wrapper_type (const gchar *mime_type)
-{
- gboolean exists;
- gchar *old_mime_type;
- GtkType gtk_type;
-
- /* find if the complete mime type exists */
- exists = g_hash_table_lookup_extended (_repository.mime_links, (gpointer)mime_type,
- (gpointer)&old_mime_type, (gpointer)&gtk_type);
- if (exists) /* the complete mime type exists, return it */
- return gtk_type;
- else {
- /* the complete mime type association does not exists */
- /* is there an association for the main mime type ? */
- gmime_content_field_construct_from_string (_content_field, mime_type);
- exists = g_hash_table_lookup_extended (_repository.mime_links, (gpointer)(_content_field->type),
- (gpointer)&old_mime_type, (gpointer)&gtk_type);
-
- if (exists) /* the main mime type association exists */
- return gtk_type;
- else return camel_simple_data_wrapper_get_type();
- }
-
-
-
-
-}
-
diff --git a/camel/data-wrapper-repository.h b/camel/data-wrapper-repository.h
deleted file mode 100644
index ec73025764..0000000000
--- a/camel/data-wrapper-repository.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef DATA_WRAPPER_REPOSITORY_H
-#define DATA_WRAPPER_REPOSITORY_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include "camel-data-wrapper.h"
-
-
-
-typedef struct {
- GHashTable *mime_links;
-} DataWrapperRepository;
-
-
-gint data_wrapper_repository_init ();
-void data_wrapper_repository_set_data_wrapper_type (const gchar *mime_type, GtkType object_type);
-GtkType data_wrapper_repository_get_data_wrapper_type (const gchar *mime_type);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* DATA_WRAPPER_REPOSITORY_H */
diff --git a/camel/gmime-base64.c b/camel/gmime-base64.c
deleted file mode 100644
index db784f7143..0000000000
--- a/camel/gmime-base64.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Base64 handlers
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- */
-#include <config.h>
-#include "gmime-base64.h"
-
-#define BSIZE 512
-
-/*
- * 64-based alphabet used by the the Base64 enconding
- */
-static char *base64_alphabet =
-"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-/**
- * gmime_encode_base64:
- * @input: The data source to be encoded in base64 format
- * @output: Where to put the encoded information in.
- *
- * This routine encodes the information pulled from @input using
- * base64 encoding and stores it on the @output CamelStream object
- */
-void
-gmime_encode_base64 (CamelStream *input, CamelStream *output)
-{
- char buffer [BSIZE];
- char obuf [80]; /* Output is limited to 76 characters, rfc2045 */
- int n, i, j, state;
- int keep = 0;
-
- state = 0;
- j = 0;
- while ((n = camel_stream_read (input, buffer, sizeof (buffer))) > 0){
- for (i = 0; i < n; i++, state++){
- char c = buffer [i];
-
- switch (state % 3){
- case 0:
- obuf [j++] = base64_alphabet [c >> 2];
- keep = (c & 3) << 4;
- break;
- case 1:
- obuf [j++] = base64_alphabet [keep | (c >> 4)];
- keep = (c & 0xf) << 2;
- break;
- case 2:
- obuf [j++] = base64_alphabet [keep | (c >> 6)];
- obuf [j++] = base64_alphabet [c & 0x3f];
- break;
- }
-
- if (j == 72){
- obuf [j++] = '\r';
- obuf [j++] = '\n';
- camel_stream_write (output, obuf, j);
- j = 0;
- }
- }
- }
-
- switch (state % 3){
- case 0:
- /* full ouput, nothing left to do */
- break;
-
- case 1:
- obuf [j++] = base64_alphabet [keep];
- obuf [j++] = '=';
- obuf [j++] = '=';
- break;
-
- case 2:
- obuf [j++] = base64_alphabet [keep];
- obuf [j++] = '=';
- break;
- }
- camel_stream_write (output, obuf, j);
- camel_stream_flush (output);
-}
-
-
-/**
- * gmime_decode_base64:
- * @input: A buffer in base64 format.
- * @output: Destination where the decoded information is stored.
- *
- * This routine decodes the base64 information pulled from @input
- * and stores it on the @output CamelStream object.
- */
-void
-gmime_decode_base64 (CamelStream *input, CamelStream *output)
-{
-}
diff --git a/camel/gmime-base64.h b/camel/gmime-base64.h
deleted file mode 100644
index 58ddd58722..0000000000
--- a/camel/gmime-base64.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Base64 handlers
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- */
-
-#ifndef _GMIME_BASE64_H
-#define _GMIME_BASE64_H
-
-#include "camel-stream.h"
-
-void gmime_encode_base64 (CamelStream *input, CamelStream *output);
-
-#endif
diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c
deleted file mode 100644
index 0a72246a0d..0000000000
--- a/camel/gmime-content-field.c
+++ /dev/null
@@ -1,370 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-content_field.c : mime content type field utilities */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "gmime-content-field.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include <string.h>
-
-
-/**
- * gmime_content_field_new: Creates a new GMimeContentField object
- * @type: mime type
- * @subtype: mime subtype
- *
- * Creates a GMimeContentField object and initialize it with
- * a mime type and a mime subtype. For example,
- * gmime_content_field_new ("application", "postcript");
- * will create a content field with complete mime type
- * "application/postscript"
- *
- * Return value: The newly created GMimeContentField object
- **/
-GMimeContentField *
-gmime_content_field_new (const gchar *type, const gchar *subtype)
-{
- GMimeContentField *ctf;
-
- ctf = g_new (GMimeContentField, 1);
- ctf->type = g_strdup (type);
- ctf->subtype = g_strdup (subtype);
- ctf->parameters = g_hash_table_new (g_str_hash, g_str_equal);
- ctf->ref = 1;
-
- return ctf;
-}
-
-
-static void
-_free_parameter (gpointer name, gpointer value, gpointer user_data)
-{
- g_free (name);
- g_free (value);
-}
-
-/**
- * gmime_content_field_free: free a GMimeContentField object
- * @content_field: GMimeContentField object
- *
- * This method destroys the object and should be used very carefully.
- * Use gmime_content_field_unref instead.
- *
- **/
-void
-gmime_content_field_free (GMimeContentField *content_field)
-{
- if (!content_field) return;
-
- g_hash_table_foreach (content_field->parameters, _free_parameter, NULL);
- g_free (content_field->type);
- g_free (content_field->subtype);
- g_hash_table_destroy (content_field->parameters);
- g_free (content_field);
-}
-
-/**
- * gmime_content_field_ref: add a reference to a GMimeContentField object
- * @content_field: GMimeContentField object
- *
- * Tell a GMimeContentField object that something holds a reference
- * on him. This, coupled with the corresponding
- * gmime_content_field_unref() method allow several
- * objects to use the same GMimeContentField object.
- **/
-void
-gmime_content_field_ref (GMimeContentField *content_field)
-{
- content_field->ref += 1;
-}
-
-/**
- * gmime_content_field_unref: remove a reference to a GMimeContentField object
- * @content_field: GMimeContentField object
- *
- * Tell a GMimeContentField object that something which
- * was holding a reference to him does not need it anymore.
- * When no more reference exist, the GMimeContentField object
- * is freed using gmime_content_field_free().
- *
- **/
-void
-gmime_content_field_unref (GMimeContentField *content_field)
-{
- if (!content_field) return;
-
- content_field->ref -= 1;
- if (content_field->ref <= 0)
- gmime_content_field_free (content_field);
-}
-
-
-
-/**
- * gmime_content_field_set_parameter: set a parameter for a GMimeContentField object
- * @content_field: content field
- * @attribute: parameter name
- * @value: paramteter value
- *
- * set a parameter (called attribute in RFC 2045) of a content field. Meaningfull
- * or valid parameters name depend on the content type object. For example,
- * gmime_content_field_set_parameter (cf, "charset", "us-ascii");
- * will make sense for a "text/plain" content field but not for a
- * "image/gif". This routine does not check parameter validity.
- **/
-void
-gmime_content_field_set_parameter (GMimeContentField *content_field, const gchar *attribute, const gchar *value)
-{
- gboolean attribute_exists;
- gchar *old_attribute;
- gchar *old_value;
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField:: Entering set_parameter\n");
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField:: set_parameter content_field=%p name=%s, value=%s\n", content_field, attribute, value);
- attribute_exists = g_hash_table_lookup_extended (content_field->parameters,
- attribute,
- (gpointer *) &old_attribute,
- (gpointer *) &old_value);
- /** CHECK THAT : is normal to free pointers before insertion ? **/
- if (attribute_exists) {
- g_free (old_value);
- g_free (old_attribute);
- }
-
- g_hash_table_insert (content_field->parameters, g_strdup (attribute), g_strdup (value));
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField:: Leaving set_parameter\n");
-}
-
-
-/**
- * _print_parameter: print a parameter/value pair to a stream as described in RFC 2045
- * @name: name of the parameter
- * @value: value of the parameter
- * @user_data: CamelStream object to write the text to.
- *
- *
- **/
-static void
-_print_parameter (gpointer name, gpointer value, gpointer user_data)
-{
- CamelStream *stream = (CamelStream *)user_data;
-
- camel_stream_write_strings (stream,
- "; \n ",
- (gchar *)name,
- "=",
- (gchar *)value,
- NULL);
-
-}
-
-/**
- * gmime_content_field_write_to_stream: write a mime content type to a stream
- * @content_field: content type object
- * @stream: the stream
- *
- *
- **/
-void
-gmime_content_field_write_to_stream (GMimeContentField *content_field, CamelStream *stream)
-{
- if (!content_field) return;
-
- g_assert (stream);
- if (content_field->type) {
- camel_stream_write_strings (stream, "Content-Type: ", content_field->type, NULL);
- if (content_field->subtype) {
- camel_stream_write_strings (stream, "/", content_field->subtype, NULL);
- }
- /* print all parameters */
- g_hash_table_foreach (content_field->parameters, _print_parameter, stream);
- camel_stream_write_string (stream, "\n");
- } else CAMEL_LOG_FULL_DEBUG ("GMimeContentField::write_to_stream no mime type found\n");
-}
-
-/**
- * gmime_content_field_get_mime_type: return the mime type of the content field object
- * @content_field: content field object
- *
- * A RFC 2045 content type field contains the mime type in the
- * form "type/subtype" (example : "application/postscript") and some
- * parameters (attribute/value pairs). This routine returns the mime type
- * in a gchar object.
- *
- * Return value: the mime type in the form "type/subtype" or NULL if not defined.
- **/
-gchar *
-gmime_content_field_get_mime_type (GMimeContentField *content_field)
-{
- gchar *mime_type;
-
- if (!content_field->type) return NULL;
-
- if (content_field->subtype)
- mime_type = g_strdup_printf ("%s/%s", content_field->type, content_field->subtype);
- else
- mime_type = g_strdup (content_field->type);
- return mime_type;
-}
-
-static void
-___debug_print_parameter (gpointer name, gpointer value, gpointer user_data)
-{
-
- printf ("****** parameter \"%s\"=\"%s\"\n", (gchar *)name, (gchar *)value);
-
-}
-
-/**
- * gmime_content_field_get_parameter: return the value of a mime type parameter
- * @content_field: content field object
- * @name: name of the parameter
- *
- * Returns the value of a parameter contained in the content field
- * object. The content type is formed of a mime type, a mime subtype,
- * and a parameter list. Each parameter is a name/value pair. This
- * routine returns the value assiciated to a given name.
- * When the parameter does not exist, NULL is returned.
- *
- * Return value: parameter value, or NULL if not found.
- **/
-const gchar *
-gmime_content_field_get_parameter (GMimeContentField *content_field, const gchar *name)
-{
- const gchar *parameter;
- const gchar *old_name;
- gboolean parameter_exists;
-
- CAMEL_LOG_FULL_DEBUG ("Entering GMimeContentField::get_parameter content_field =%p\n", content_field);
- g_assert (content_field->parameters);
- g_assert (name);
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField::get_parameter looking for parameter \"%s\"\n", name);
- /* parameter = (const gchar *)g_hash_table_lookup (content_field->parameters, name); */
- parameter_exists = g_hash_table_lookup_extended (content_field->parameters,
- name,
- (gpointer *) &old_name,
- (gpointer *) &parameter);
- if (!parameter_exists) {
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField::get_parameter, parameter not found\n");
- g_hash_table_foreach (content_field->parameters, ___debug_print_parameter, NULL);
- return NULL;
- }
- CAMEL_LOG_FULL_DEBUG ("Leaving GMimeContentField::get_parameter\n");
- return parameter;
-}
-
-
-
-
-/**
- * gmime_content_field_construct_from_string: construct a ContentType object by parsing a string.
- *
- * @content_field: content type object to construct
- * @string: string containing the content type field
- *
- * Parse a string containing a content type field as defined in
- * RFC 2045, and construct the corresponding ContentType object.
- * The string is not modified and not used in the ContentType
- * object. It can and must be freed by the calling part.
- **/
-void
-gmime_content_field_construct_from_string (GMimeContentField *content_field, const gchar *string)
-{
- gint first, len;
- gchar *str;
- gint i=0;
- gchar *type, *subtype;
- gchar *param_name, *param_value;
- gboolean param_end;
-
- CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, entering\n");
- g_assert (string);
- g_assert (content_field);
-
- g_free (content_field->type);
- g_free (content_field->subtype);
-
-
- first = 0;
- len = strlen (string);
- if (!len) return;
- CAMEL_LOG_FULL_DEBUG ("GMimeContentField::construct_from_string, All checks done\n");
-
- /* find the type */
- while ( (i<len) && (!strchr ("/;", string[i])) ) i++;
-
- if (i == 0) return;
-
- type = g_strndup (string, i);
- string_trim (type, " \t", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING);
- content_field->type = type;
- CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime type : \"%s\"\n", type);
- if (i >= len-1) {
- content_field->subtype = NULL;
- return;
- }
-
- first = i+1;
- /* find the subtype, if any */
- if (string[i++] == '/') {
- while ( (i<len) && (string[i] != ';') ) i++;
- if (i != first) {
- subtype = g_strndup (string+first, i-first);
- string_trim (subtype, " \t", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING);
- content_field->subtype = subtype;
- CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime subtype: \"%s\"\n", subtype);
- if (i >= len-1) return;
- }
- }
- first = i+1;
-
- /* parse parameters list */
- param_end = FALSE;
- do {
- while ( (i<len) && (string[i] != '=') ) i++;
- if ((i == len) || (i==first)) param_end = TRUE;
- else {
- /* we have found parameter name */
- param_name = g_strndup (string+first, i-first);
- string_trim (param_name, " ", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING);
- i++;
- first = i;
- /* Let's find parameter value */
- while ( (i<len) && (string[i] != ';') ) i++;
- if (i != first) param_value = g_strndup (string+first, i-first);
- else param_value = g_strdup ("");
- CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime parameter \"%s\"=\"%s\"\n", param_name, param_value);
- string_trim (param_value, " \t", STRING_TRIM_STRIP_TRAILING | STRING_TRIM_STRIP_LEADING);
- gmime_content_field_set_parameter (content_field, param_name, param_value);
- g_free (param_name);
- g_free (param_value);
- i++;
- first = i;
- }
- } while ((!param_end) && (first < len));
-
-
-}
-
diff --git a/camel/gmime-content-field.h b/camel/gmime-content-field.h
deleted file mode 100644
index 7558e4b735..0000000000
--- a/camel/gmime-content-field.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-content_field.h : mime content type field utilities */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef GMIME_CONTENT_FIELD_H
-#define GMIME_CONTENT_FIELD_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include <stdio.h>
-#include "camel-stream.h"
-
-typedef struct {
-
- gchar *type;
- gchar *subtype;
- GHashTable *parameters;
-
- gint ref;
-
-} GMimeContentField;
-
-GMimeContentField *gmime_content_field_new (const gchar *type, const gchar *subtype);
-void gmime_content_field_ref (GMimeContentField *content_field);
-void gmime_content_field_unref (GMimeContentField *content_field);
-
-void gmime_content_field_set_parameter (GMimeContentField *content_field, const gchar *attribute, const gchar *value);
-void gmime_content_field_write_to_stream (GMimeContentField *content_field, CamelStream *stream);
-void gmime_content_field_construct_from_string (GMimeContentField *content_field, const gchar *string);
-void gmime_content_field_free (GMimeContentField *content_field);
-gchar * gmime_content_field_get_mime_type (GMimeContentField *content_field);
-const gchar *gmime_content_field_get_parameter (GMimeContentField *content_field, const gchar *name);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* GMIME_CONTENT_FIELD_H */
diff --git a/camel/gmime-rfc2047.c b/camel/gmime-rfc2047.c
deleted file mode 100644
index 8dad887849..0000000000
--- a/camel/gmime-rfc2047.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* gmime-rfc2047.c: implemention of RFC2047 */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- *
- */
-
-/*
- * Authors: Robert Brady <rwb197@ecs.soton.ac.uk>
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <unicode.h>
-#include <string.h>
-
-#include "gmime-rfc2047.h"
-
-#define NOT_RANKED -1
-
-/* This should be changed ASAP to use the base64 code Miguel comitted */
-
-const char *base64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-static unsigned char base64_rank[256];
-static int base64_rank_table_built;
-static void build_base64_rank_table (void);
-
-static int
-hexval (gchar c) {
- if (isdigit (c)) return c-'0';
- c = tolower (c);
- return c - 'a' + 10;
-}
-
-static gchar *
-decode_quoted (const gchar *text, const gchar *end)
-{
- gchar *to = malloc(end - text + 1), *to_2 = to;
-
- if (!to) return NULL;
- while (*text && text < end) {
- if (*text == '=') {
- gchar a = hexval (text[1]);
- gchar b = hexval (text[2]);
- int c = (a << 4) + b;
- *to = c;
- to++;
- text+=3;
- } else if (*text == '_') {
- *to = ' ';
- to++;
- text++;
- } else {
- *to = *text;
- to++;
- text++;
- }
- }
- return to_2;
-}
-
-static gchar *
-decode_base64 (const gchar *data, const gchar *end)
-{
- unsigned short pattern = 0;
- int bits = 0;
- int delimiter = '=';
- gchar x;
- gchar *buffer = g_malloc((end - data) * 3);
- gchar *t = buffer;
- int Q = 0;
-
- if (!buffer) return NULL;
-
- while (*data != delimiter) {
- x = base64_rank[(unsigned char)(*data++)];
- if (x == NOT_RANKED)
- continue;
- pattern <<= 6;
- pattern |= x;
- bits += 6;
- if (bits >= 8) {
- x = (pattern >> (bits - 8)) & 0xff;
- *t++ = x;
- Q++;
- bits -= 8;
- }
- }
- *t = 0;
- return buffer;
-}
-
-static void
-build_base64_rank_table (void)
-{
- int i;
-
- if (!base64_rank_table_built) {
- for (i = 0; i < 256; i++)
- base64_rank[i] = NOT_RANKED;
- for (i = 0; i < 64; i++)
- base64_rank[(int) base64_alphabet[i]] = i;
- base64_rank_table_built = 1;
- }
-}
-
-
-static gchar *
-rfc2047_decode_word (const gchar *data, const gchar *into_what)
-{
- const char *charset = strstr (data, "=?"), *encoding, *text, *end;
-
- char *buffer, *b, *cooked_data;
-
- buffer = g_malloc (strlen(data) * 2);
- b = buffer;
-
- if (!charset) return strdup (data);
- charset+=2;
-
- encoding = strchr (charset, '?');
- if (!encoding) return strdup (data);
- encoding++;
-
- text = strchr(encoding, '?');
- if (!text) return strdup (data);
- text++;
-
- end = strstr(text, "?=");
- if (!end) return strdup (data);
-
- b[0] = 0;
-
- if (toupper(*encoding)=='Q')
- cooked_data = decode_quoted (text, end);
- else if (toupper (*encoding)=='B')
- cooked_data = decode_base64 (text, end);
- else
- return g_strdup(data);
-
- {
- char *c = strchr (charset, '?');
- char *q = g_malloc (c - charset + 1);
- char *cook_2 = cooked_data;
- int cook_len = strlen (cook_2);
- int b_len = 4096;
- unicode_iconv_t i;
- strncpy (q, charset, c - charset);
- q[c - charset] = 0;
- i = unicode_iconv_open (into_what, q);
- if (!i) {
- g_free (q);
- return g_strdup (buffer);
- }
- if (unicode_iconv (i, &cook_2, &cook_len, &b, &b_len)==-1)
- /* FIXME : use approximation code if we can't convert it properly. */
- ;
- unicode_iconv_close (i);
- *b = 0;
- }
-
- return g_strdup (buffer);
-}
-
-static const gchar *
-find_end_of_encoded_word (const gchar *data)
-{
- /* We can't just search for ?=,
- because of the case :
- "=?charset?q?=ff?=" :( */
- if (!data) return NULL;
- data = strstr (data, "=?");
- if (!data) return NULL;
- data = strchr(data+2, '?');
- if (!data) return NULL;
- data = strchr (data+1, '?');
- if (!data) return NULL;
- data = strstr (data+1, "?=");
- if (!data) return NULL;
- return data + 2;
-}
-
-gchar *
-gmime_rfc2047_decode (const gchar *data, const gchar *into_what)
-{
- char *buffer = malloc (strlen(data) * 4), *b = buffer;
-
- int was_encoded_word = 0;
-
- build_base64_rank_table ();
-
- while (data && *data) {
- char *word_start = strstr (data, "=?"), *decoded;
- if (!word_start) {
- strcpy (b, data);
- b[strlen (data)] = 0;
- return buffer;
- }
- if (word_start != data) {
-
- if (strspn (data, " \t\n\r") != (word_start - data)) {
- strncpy (b, data, word_start - data);
- b += word_start - data;
- *b = 0;
- }
- }
- decoded = rfc2047_decode_word (word_start, into_what);
- strcpy (b, decoded);
- b += strlen (decoded);
- *b = 0;
- g_free (decoded);
-
- data = find_end_of_encoded_word (data);
- }
-
- *b = 0;
- return buffer;
-}
-
-#define isnt_ascii(a) ((a) <= 0x1f || (a) >= 0x7f)
-
-static int
-rfc2047_clean (const gchar *string, const gchar *max)
-{
- /* if (strstr (string, "?=")) return 1; */
- while (string < max) {
- if (isnt_ascii ((unsigned char)*string))
- return 0;
- string++;
- }
- return 1;
-}
-
-static gchar *
-encode_word (const gchar *string, int length, const gchar *said_charset)
-{
- const gchar *max = string + length;
- if (rfc2047_clean(string, max)) {
- /* don't bother encoding it if it has no odd characters in it */
- return g_strndup (string, length);
- }
- {
- char *temp = malloc (length * 4 + 1), *t = temp;
- t += sprintf (t, "=?%s?q?", said_charset);
- while (string < max) {
- if (*string == ' ')
- *(t++) = '_';
- else if ((*string <= 0x1f) || (*string >= 0x7f) || (*string == '=') || (*string == '?'))
- t += sprintf (t, "=%2x", (unsigned char)*string);
- else
- *(t++) = *string;
-
- string++;
- }
- t += sprintf (t, "?=");
- *t = 0;
- return temp;
- }
-}
-
-static int
-words_in(char *a)
-{
- int words = 1;
- while (*a) {
- if (*(a++)==' ')
- words++;
- }
- return words;
-}
-
-struct word_data {
- const char *word;
- int word_length;
- const char *to_encode_in;
- char *encoded;
- enum {
- wt_None,
- wt_Address,
- } type;
-};
-
-static int string_can_fit_in(const char *a, int length, const char *charset)
-{
- while (length--) {
- if (*a < 0x1f || *a >= 0x7f) return 0;
- a++;
- }
- return 1;
-}
-
-static void
-show_entry(struct word_data *a)
-{
- a->type = wt_None;
-
- if (string_can_fit_in(a->word, a->word_length, "US-ASCII"))
- a->to_encode_in = "US-ASCII";
-
- if (a->word[0]=='<' && a->word[a->word_length-1]=='>') {
- a->type = wt_Address;
- }
-}
-
-static void
-break_into_words(const char *string, struct word_data *a, int words)
-{
- int i;
- for (i=0;i<words;i++) {
-
- char *next_space = strchr(string, ' ');
-
- if (!next_space) {
- a[i].word = string;
- a[i].word_length = strlen(string);
- a[i].to_encode_in = NULL; /* i.e. the default */
-
- show_entry(a+i);
-
- return;
- }
-
- a[i].word = string;
- a[i].word_length = next_space - string;
- a[i].to_encode_in = NULL;
-
- show_entry(a+i);
-
- string = next_space + 1;
-
- }
-}
-
-static void
-join_words(struct word_data *a, int words)
-{
- int i;
- for (i=(words-1);i>0;i--) {
- if (a[i].to_encode_in == a[i-1].to_encode_in) {
- a[i-1].word_length += 1 + a[i].word_length;
- a[i].word = 0;
- a[i].word_length = 0;
- }
-
- }
-}
-
-static void show_words(struct word_data *words, int count)
-{
- int i;
- for (i=0;i<count;i++)
- if (words[i].word)
- show_entry(words+i);
-}
-
-gchar *
-gmime_rfc2047_encode (const gchar *string, const gchar *charset)
-{
- int temp_len = strlen (string)*4 + 1, word_count;
- char *temp = g_malloc (temp_len), *temp_2 = temp;
- int string_length = strlen (string);
- char *encoded = NULL, *p;
- struct word_data *words;
-
- /* first, let us convert to UTF-8 */
- unicode_iconv_t i = unicode_iconv_open ("UTF-8", charset);
- unicode_iconv (i, &string, &string_length, &temp_2, &temp_len);
- unicode_iconv_close (i);
-
- /* null terminate it */
- *temp_2 = 0;
-
- /* now encode it as if it were a single word */
-
- word_count = words_in ( temp );
-
- words = g_malloc(sizeof (struct word_data) * word_count);
- break_into_words(temp, words, word_count);
-
- join_words(words, word_count);
-
- show_words(words, word_count);
-
- {
- size_t len = 0;
- int c = 0;
- for (c = 0;c<word_count;c++) {
- if (words[c].word)
- {
- words[c].encoded = encode_word(words[c].word, words[c].word_length,
- words[c].to_encode_in ? words[c].to_encode_in :
- "UTF-8");
- len += strlen(words[c].encoded) + 1;
- }
- }
-
- {
- encoded = g_malloc(len+1);
- p = encoded;
- for (c = 0; c < word_count;c++) if (words[c].word) {
- strcpy(p, words[c].encoded);
- p += strlen(p);
- strcpy(p, " ");
- p++;
- }
- *p = 0;
- }
- }
-
-
- /*
-
- real algorithm :
-
- we need to
-
- split it into words
-
- identify portions that have NOT to be encoded (i.e. <> and the comment starter/ender )
-
- identify the best character set for each word
-
- merge words which share a character set, allow jumping and merging with words which
- would be ok to encode in non-US-ASCII.
-
- if we have to use 2 character sets, try and collapse them into one.
-
- (e.g. if one word contains letters in latin-1, and another letters in latin-2, use
- latin-2 for the first word as well if possible).
-
- finally :
-
- if utf-8 will still be used, use it for everything.
-
- and then, at last, generate the encoded text, using base64/quoted-printable for
- each word depending upon which is more efficient.
-
- TODO :
- create a priority list of encodings
-
- i.e.
-
- US-ASCII, ISO-8859-1, ISO-8859-2, ISO-8859-3, KOI8,
-
- Should survey for most popular charsets :
- what do people usually use for the following scripts?
-
- * Chinese/Japanese/Korean
- * Greek
- * Cyrillic
-
- (any other scripts commonly used in mail/news?)
-
- This algorithm is probably far from optimal, but should be
- reasonably efficient for simple cases. (and almost free if
- the text is just in US-ASCII : like 99% of the text that will
- pass through it)
-
-
-
- current status :
-
- Algorithm now partially implemented.
-
- */
-
- g_free(words);
- g_free(temp);
-
- return encoded;
-}
diff --git a/camel/gmime-rfc2047.h b/camel/gmime-rfc2047.h
deleted file mode 100644
index 6efd8cc243..0000000000
--- a/camel/gmime-rfc2047.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* gmime-rfc2047.c: implemention of RFC2047 */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- *
- */
-
-/*
- * Authors: Robert Brady <rwb197@ecs.soton.ac.uk>
- */
-
-#ifndef GMIME_RFC2047_H
-#define GMIME_RFC2047_H 1
-#include <glib.h>
-
-gchar *gmime_rfc2047_decode (const gchar *text, const gchar* charset);
-gchar *gmime_rfc2047_encode (const gchar *text, const gchar* charset);
-
-/*
- * pass text and charset, (e.g. "UTF-8", or "ISO-8859-1"), and
- * it will encode or decode text according to RFC2047
- *
- * You will need to link with libunicode for these.
- *
- * TODO : Make it so that if charset==NULL, the charset specified (either
- * implicitly or explicity) in the locale is used.
- *
- * TODO : Run torture tests and fix the buffer overruns in these functions.
- *
- * The caller will need to free the memory for the string.
- */
-
-#endif /* GMIME_RFC2047_H */
diff --git a/camel/gmime-utils.c b/camel/gmime-utils.c
deleted file mode 100644
index e703e877e9..0000000000
--- a/camel/gmime-utils.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-utils.c : misc utilities for mime */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "gmime-utils.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "camel-stream.h"
-
-void
-gmime_write_header_pair_to_stream (CamelStream *stream, const gchar* name, const gchar *value)
-{
-
- gchar *strtmp;
-
- CAMEL_LOG_FULL_DEBUG ( "gmime_write_header_pair_to_stream:: Entering\n");
- g_assert(name);
-
- if (!value) return;
- strtmp = g_strdup_printf ("%s: %s\n", name, value);
-
- camel_stream_write_string (stream, strtmp);
- CAMEL_LOG_FULL_DEBUG ( "gmime_write_header_pair_to_stream:\n writing %s\n", strtmp);
-
- g_free (strtmp);
- CAMEL_LOG_FULL_DEBUG ( "gmime_write_header_pair_to_stream:: Leaving\n");
-
-}
-
-
-static void
-_write_one_header_to_stream (gpointer key, gpointer value, gpointer user_data)
-{
- gchar *header_name = (gchar *)key;
- gchar *header_value = (gchar *)value;
- CamelStream *stream = (CamelStream *)user_data;
-
- CAMEL_LOG_FULL_DEBUG ( "_write_one_header_to_stream:: Entering\n");
- if ((header_name) && (header_value))
- gmime_write_header_pair_to_stream (stream, header_name, header_value);
- CAMEL_LOG_FULL_DEBUG ( "_write_one_header_to_stream:: Leaving\n");
-}
-
-void
-gmime_write_header_table_to_stream (CamelStream *stream, GHashTable *header_table)
-{
- CAMEL_LOG_FULL_DEBUG ( "write_header_table_to_stream:: Entering\n");
- g_hash_table_foreach (header_table,
- _write_one_header_to_stream,
- (gpointer)stream);
- CAMEL_LOG_FULL_DEBUG ( "write_header_table_to_stream:: Leaving\n");
-}
-
-
-void
-gmime_write_header_with_glist_to_stream (CamelStream *stream,
- const gchar *header_name,
- GList *header_values,
- const gchar *separator)
-{
-
- gchar *current;
-
- CAMEL_LOG_FULL_DEBUG ( "write_header_with_glist_to_stream:: entering\n");
- if ( (header_name) && (header_values) )
- {
- gboolean first;
-
- camel_stream_write (stream, header_name, strlen (header_name) );
- camel_stream_write (stream, ": ", 2);
- first = TRUE;
- while (header_values) {
- current = (gchar *)header_values->data;
- if (current) {
- if (!first) camel_stream_write_string (stream, separator);
- else first = FALSE;
- camel_stream_write (stream, current, strlen (current));
- }
- header_values = g_list_next (header_values);
- }
- camel_stream_write (stream, "\n", 1);
- }
- CAMEL_LOG_FULL_DEBUG ("write_header_with_glist_to_stream:: leaving\n");
-
-}
-
-
-
-
-
-/* * * * * * * * * * * */
-/* scanning functions */
-
-static void
-_store_header_pair_from_string (GArray *header_array, gchar *header_line)
-{
- gchar dich_result;
- gchar *header_name, *header_value;
- Rfc822Header header;
-
- CAMEL_LOG_FULL_DEBUG ( "_store_header_pair_from_string:: Entering\n");
-
- g_assert (header_array);
- g_return_if_fail (header_line);
-
-
- if (header_line) {
- dich_result = string_dichotomy ( header_line, ':',
- &header_name, &header_value,
- STRING_DICHOTOMY_NONE);
- if (dich_result != 'o') {
- CAMEL_LOG_WARNING (
- "** WARNING **\n"
- "store_header_pair_from_string : dichotomy result is '%c'\n"
- "header line is :\n--\n%s\n--\n"
- "** \n", dich_result, header_line);
- if (header_name)
- g_free (header_name);
- if (header_value)
- g_free (header_value);
-
- } else {
- string_trim (header_value, " \t",
- STRING_TRIM_STRIP_LEADING | STRING_TRIM_STRIP_TRAILING);
-
- header.name = header_name;
- header.value = header_value;
- g_array_append_val (header_array, header);
- }
- }
-
- CAMEL_LOG_FULL_DEBUG ( "_store_header_pair_from_string:: Leaving\n");
-
-}
-
-
-
-
-GArray *
-get_header_array_from_stream (CamelStream *stream)
-{
-#warning Correct Lazy Implementation
- /* should not use GString. */
- /* should read the header line by line */
- /* and not char by char */
- gchar next_char;
- gint nb_char_read;
-
- gboolean crlf = FALSE;
- gboolean end_of_header_line = FALSE;
- gboolean end_of_headers = FALSE;
- gboolean end_of_file = FALSE;
-
- GString *header_line=NULL;
- gchar *str_header_line;
-
- GArray *header_array;
-
-
- CAMEL_LOG_FULL_DEBUG ( "gmime-utils:: Entering get_header_table_from_stream\n");
- header_array = g_array_new (FALSE, FALSE, sizeof (Rfc822Header));
-
- nb_char_read = camel_stream_read (stream, &next_char, 1);
- do {
- header_line = g_string_new ("");
- end_of_header_line = FALSE;
- crlf = FALSE;
-
- /* read a whole header line */
- do {
- if (nb_char_read>0) {
- switch (next_char) {
-
- case '\n': /* a blank line means end of headers */
- if (crlf) {
- end_of_headers=TRUE;
- end_of_header_line = TRUE;
- }
- else crlf = TRUE;
- break;
- case ' ':
- case '\t':
- if (crlf) {
- crlf = FALSE;
- next_char = ' ';
- }
-
- default:
- if (!crlf) header_line = g_string_append_c (header_line, next_char);
- else end_of_header_line = TRUE;
- }
- } else {
- end_of_file=TRUE;
- end_of_header_line = TRUE;
- }
- /* if we have read a whole header line, we have also read
- the first character of the next line to be sure the
- crlf was not followed by a space or a tab char */
- if (!end_of_header_line) nb_char_read = camel_stream_read (stream, &next_char, 1);
-
- } while ( !end_of_header_line );
- if ( strlen(header_line->str) ) {
- /* str_header_line = g_strdup (header_line->str); */
- _store_header_pair_from_string (header_array, header_line->str);
- }
- g_string_free (header_line, FALSE);
-
- } while ( (!end_of_headers) && (!end_of_file) );
-
- CAMEL_LOG_FULL_DEBUG ( "gmime-utils:: Leaving get_header_table_from_stream\n");
- return header_array;
-}
-
-
-gchar *
-gmime_read_line_from_stream (CamelStream *stream)
-{
- GString *new_line;
- gchar *result;
- gchar next_char;
- gboolean end_of_line = FALSE;
- gboolean end_of_stream = FALSE;
- gint nb_char_read;
-
- new_line = g_string_new ("");
- do {
- nb_char_read = camel_stream_read (stream, &next_char, 1);
- if (nb_char_read>0) {
- switch (next_char) {
- case '\n':
- end_of_line = TRUE;
- /* g_string_append_c (new_line, next_char); */
- break;
- default:
- g_string_append_c (new_line, next_char);
- }
- } else end_of_stream = TRUE;
- } while (!end_of_line && !end_of_stream);
-
- if (!end_of_stream)
- result = g_strdup (new_line->str);
- else result=NULL;
- g_string_free (new_line, TRUE);
- return result;
-}
diff --git a/camel/gmime-utils.h b/camel/gmime-utils.h
deleted file mode 100644
index 2e0682fcf9..0000000000
--- a/camel/gmime-utils.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mime-utils.h : misc utilities for mime */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef GMIME_UTILS_H
-#define GMIME_UTILS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-#include <stdio.h>
-#include <camel-stream.h>
-
-typedef struct
-{
- gchar *name;
- gchar *value;
-
-} Rfc822Header;
-
-
-void gmime_write_header_pair_to_stream (CamelStream *stream,
- const gchar* name,
- const gchar *value);
-
-void gmime_write_header_table_to_stream (CamelStream *stream,
- GHashTable *header_table);
-
-void gmime_write_header_with_glist_to_stream (CamelStream *stream,
- const gchar *header_name,
- GList *header_values,
- const gchar *separator);
-
-GArray *get_header_array_from_stream (CamelStream *stream);
-gchar *gmime_read_line_from_stream (CamelStream *stream);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* GMIME_UTILS_H */
diff --git a/camel/gstring-util.c b/camel/gstring-util.c
deleted file mode 100644
index 9794696c95..0000000000
--- a/camel/gstring-util.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* gstring-util : utilities for gstring object */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#include <config.h>
-#include "gstring-util.h"
-#include "camel-log.h"
-#include <string.h>
-
-/**
- * g_string_equals : test if two string are equal
- *
- * @string1 : first string
- * @string2 : second string
- *
- * @Return Value : true if the strings equal, false otherwise
- **/
-gboolean
-g_string_equals (GString *string1, GString *string2)
-{
- g_assert (string1);
- g_assert (string2);
- return !strcmp (string1->str, string2->str);
-}
-
-
-
-
-/**
- * g_string_clone : clone a GString
- *
- * @string : the string to clone
- *
- * @Return Value : the clone ...
- **/
-GString *
-g_string_clone (GString *string)
-{
- return g_string_new (g_strdup (string->str) );
-}
-
-
-
-
-/**
- * g_string_dichotomy:
- * @sep : separator
- * @prefix: pointer to be field by the prefix object
- * the prefix is not returned when the given pointer is NULL
- * @suffix: pointer to be field by the suffix object
- * the suffix is not returned when the given pointer is NULL
- *
- * Return the strings before and/or after
- * the last occurence of the specified separator
- *
- * This routine returns the string before and/or after
- * a character given as an argument.
- * if the separator is the last character, prefix and/or
- * suffix is set to NULL and result is set to 'l'
- * if the separator is not in the list, prefix and/or
- * suffix is set to NULL and result is set to 'n'
- * When the operation succedeed, the return value is 'o'
- *
- * @Return Value : result of the operation ('o', 'l' or 'n')
- *
- **/
-gchar
-g_string_dichotomy (GString *string, gchar sep, GString **prefix, GString **suffix,
- GStringDichotomyOption options)
-{
- gchar *str, *tmp;
- gint pos, len, first;
-
- CAMEL_LOG_FULL_DEBUG (\
- "Entering string_dichotomy: \n\tseparator=%c \n\tprefix=%p \n\tsuffix=%p \n\toptions=%ld\n",\
- sep, prefix, suffix, options);
- g_assert (tmp=string->str);
- len = strlen (tmp);
- if (!len) {
- if (prefix)
- *prefix=NULL;
- if (suffix)
- *suffix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: string is empty\n");
- return 'n';
- }
- first = 0;
-
- if ((options & GSTRING_DICHOTOMY_STRIP_LEADING ) && (tmp[first] == sep) )
- do {first++;} while ( (first<len) && (tmp[first] == sep) );
-
- if (options & GSTRING_DICHOTOMY_STRIP_TRAILING )
- while (tmp[len-1] == sep)
- len--;
-
- if (first==len) {
- if (prefix) *prefix=NULL;
- if (suffix) *suffix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: after stripping, string is empty\n");
- return 'n';
- }
-
- if (options & GSTRING_DICHOTOMY_RIGHT_DIR) {
- pos = len;
-
- do {
- pos--;
- } while ((pos>=first) && (tmp[pos]!=sep));
- } else {
- pos = first;
- do {
- pos++;
- } while ((pos<len) && (tmp[pos]!=sep));
-
- }
-
- if ( (pos<first) || (pos>=len) )
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator not found\n");
- return 'n';
- }
-
- /* if we have stripped trailing separators, we should */
- /* never enter here */
- if (pos==len-1)
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator is last character\n");
- return 'l';
- }
- /* if we have stripped leading separators, we should */
- /* never enter here */
- if (pos==first)
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator is first character\n");
- return 'l';
- }
-
- if (prefix) /* return the prefix */
- {
- str = g_strndup(tmp,pos);
- *prefix = g_string_new(str);
- g_free(str);
- }
- if (suffix) /* return the suffix */
- {
- str = g_strdup(tmp+pos+1);
- *suffix = g_string_new(str);
- g_free(str);
- }
-
- return 'o';
-}
-
-
-/**
- * g_string_append_g_string : append a GString to another GString
- *
- * @dest_string : string which will be appended
- * @other_string : string to append
- *
- **/
-void
-g_string_append_g_string(GString *dest_string, GString *other_string)
-{
- g_assert(other_string);
- g_assert(dest_string);
- g_assert(other_string->str);
-
- g_string_append(dest_string, other_string->str);
-}
-
-
-
-/**
- * g_string_equal_for_hash: test equality of two GStrings for hash tables
- * @v: string 1
- * @v2: string 2
- *
- *
- *
- * Return value:
- **/
-g_string_equal_for_hash (gconstpointer v, gconstpointer v2)
-{
- return strcmp ( ((const GString*)v)->str, ((const GString*)v2)->str) == 0;
-}
-
-g_string_equal_for_glist (gconstpointer v, gconstpointer v2)
-{
- return !strcmp ( ((const GString*)v)->str, ((const GString*)v2)->str) == 0;
-}
-
-
-/**
- * g_string_hash: computes a hash value for a Gstring
- * @v: Gstring object
- *
- *
- *
- * Return value:
- **/
-guint
-g_string_hash (gconstpointer v)
-{
- return g_str_hash(((const GString*)v)->str);
-}
-
-
-
-
-/* utility func : frees a GString element in a GList */
-static void
-__g_string_list_free_string (gpointer data, gpointer user_data)
-{
- GString *string = (GString *)data;
- g_string_free(string, TRUE);
-}
-
-
-void
-g_string_list_free (GList *string_list)
-{
- g_list_foreach(string_list, __g_string_list_free_string, NULL);
- g_list_free(string_list);
-}
-
-
-
-
-
-
-GList *
-g_string_split (GString *string, char sep, gchar *trim_chars, GStringTrimOption trim_options)
-{
- GList *result = NULL;
- gint first, last, pos;
- gchar *str;
- gchar *new_str;
- GString *new_gstring;
-
- g_assert (string);
- str = string->str;
- if (!str) return NULL;
-
- first = 0;
- last = strlen(str) - 1;
-
- /* strip leading and trailing separators */
- while ( (first<=last) && (str[first]==sep) )
- first++;
- while ( (first<=last) && (str[last]==sep) )
- last--;
-
-
- CAMEL_LOG_FULL_DEBUG ("g_string_split:: trim options: %d\n", trim_options);
-
- while (first<=last) {
- pos = first;
- /* find next separator */
- while ((pos<=last) && (str[pos]!=sep)) pos++;
- if (first != pos) {
- new_str = g_strndup (str+first, pos-first);
- new_gstring = g_string_new (new_str);
- g_free (new_str);
- /* could do trimming in line to speed up this code */
- if (trim_chars) g_string_trim (new_gstring, trim_chars, trim_options);
- result = g_list_append (result, new_gstring);
- }
- first = pos + 1;
- }
-
- return result;
-}
-
-
-void
-g_string_trim (GString *string, gchar *chars, GStringTrimOption options)
-{
- gint first_ok;
- gint last_ok;
- guint length;
- gchar *str;
-
- CAMEL_LOG_FULL_DEBUG ("**\nentering g_string_trim::\n");
-
- if ((!string) || (!string->str))
- return;
- str = string->str;
- length = strlen (str);
- if (!length)
- return;
-
- first_ok = 0;
- last_ok = length - 1;
-
- CAMEL_LOG_FULL_DEBUG ("g_string_trim:: trim_options:%d\n", options);
- if (options & GSTRING_TRIM_STRIP_LEADING)
- while ( (first_ok <= last_ok) && (strchr (chars, str[first_ok])) )
- first_ok++;
-
- if (options & GSTRING_TRIM_STRIP_TRAILING)
- while ( (first_ok <= last_ok) && (strchr (chars, str[last_ok])) )
- last_ok++;
- CAMEL_LOG_FULL_DEBUG ("g_string_trim::\n\t\"%s\":first ok:%d last_ok:%d\n",
- string->str, first_ok, last_ok);
-
- if (first_ok > 0)
- g_string_erase (string, 0, first_ok);
-
- if (last_ok < length-1)
- g_string_truncate (string, last_ok - first_ok +1);
-
-}
diff --git a/camel/gstring-util.h b/camel/gstring-util.h
deleted file mode 100644
index 10bbac3a56..0000000000
--- a/camel/gstring-util.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* gstring-util : utilities for gstring object */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#ifndef GSTRING_UTIL_H
-#define GSTRING_UTIL_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-
-typedef enum {
- GSTRING_DICHOTOMY_NONE = 0,
- GSTRING_DICHOTOMY_RIGHT_DIR = 1,
- GSTRING_DICHOTOMY_STRIP_TRAILING = 2,
- GSTRING_DICHOTOMY_STRIP_LEADING = 4
-
-} GStringDichotomyOption;
-
-typedef enum {
- GSTRING_TRIM_NONE = 0,
- GSTRING_TRIM_STRIP_TRAILING = 1,
- GSTRING_TRIM_STRIP_LEADING = 2
-} GStringTrimOption;
-
-
-gboolean g_string_equals (GString *string1, GString *string2);
-GString *g_string_clone (GString *string);
-gchar g_string_dichotomy (GString *string, gchar sep,
- GString **prefix, GString **suffix,
- GStringDichotomyOption options);
-void g_string_append_g_string (GString *dest_string,
- GString *other_string);
-
-gboolean g_string_equal_for_hash (gconstpointer v, gconstpointer v2);
-gboolean g_string_equal_for_glist (gconstpointer v, gconstpointer v2);
-guint g_string_hash (gconstpointer v);
-void g_string_list_free (GList *string_list);
-
-GList *g_string_split (GString *string, char sep,
- gchar *trim_chars, GStringTrimOption trim_options);
-void g_string_trim (GString *string, gchar *chars,
- GStringTrimOption options);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* GSTRING_UTIL_H */
diff --git a/camel/hash-table-utils.c b/camel/hash-table-utils.c
deleted file mode 100644
index fa326020cb..0000000000
--- a/camel/hash-table-utils.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* generic utilities for hash tables */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include "glib.h"
-#include "hash-table-utils.h"
-
-
-/*
- * free a (key/value) hash table pair.
- * to be called in a g_hash_table_foreach()
- * before g_hash_table_destroy().
- */
-void
-g_hash_table_generic_free (gpointer key, gpointer value, gpointer user_data)
-{
- g_free (key);
- g_free (value);
-}
-
-
-
-/***/
-/* use these two funcs for case insensitive hash table */
-
-gint
-g_strcase_equal (gconstpointer a, gconstpointer b)
-{
- return (g_strcasecmp ((gchar *)a, (gchar *)b) == 0);
-}
-
-
-/* modified g_str_hash from glib/gstring.c
- because it would have been too slow to
- us g_strdown() on the string */
-/* a char* hash function from ASU */
-guint
-g_strcase_hash (gconstpointer v)
-{
- const char *s = (char*)v;
- const char *p;
- char c;
- guint h=0, g;
-
- for(p = s; *p != '\0'; p += 1) {
- c = isupper ((guchar)*p) ? tolower ((guchar)*p) : *p;
- h = ( h << 4 ) + c;
- if ( ( g = h & 0xf0000000 ) ) {
- h = h ^ (g >> 24);
- h = h ^ g;
- }
- }
-
- return h /* % M */;
-}
-
-
-
-/***/
diff --git a/camel/hash-table-utils.h b/camel/hash-table-utils.h
deleted file mode 100644
index 99d33f59a0..0000000000
--- a/camel/hash-table-utils.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* generic utilities for hash tables */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef HASH_TABLE_UTILS_H
-#define HASH_TABLE_UTILS_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-void g_hash_table_generic_free (gpointer key, gpointer value, gpointer user_data);
-
-gint g_strcase_equal (gconstpointer a, gconstpointer b);
-guint g_strcase_hash (gconstpointer v);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* HASH_TABLE_UTILS_H */
diff --git a/camel/md5-utils.c b/camel/md5-utils.c
deleted file mode 100644
index 53f3373bb5..0000000000
--- a/camel/md5-utils.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to md5_init, call md5_update as
- * needed on buffers full of bytes, and then call md5_Final, which
- * will fill a supplied 16-byte array with the digest.
- */
-
-/* parts of this file are :
- * Written March 1993 by Branko Lankester
- * Modified June 1993 by Colin Plumb for altered md5.c.
- * Modified October 1995 by Erik Troan for RPM
- */
-
-
-#include "md5-utils.h"
-#include <stdio.h>
-
-static void md5_transform (guint32 buf[4], const guint32 in[16]);
-
-static gint _ie = 0x44332211;
-static union _endian { gint i; gchar b[4]; } *_endian = (union _endian *)&_ie;
-#define IS_BIG_ENDIAN() (_endian->b[0] == '\x44')
-#define IS_LITTLE_ENDIAN() (_endian->b[0] == '\x11')
-
-
-/*
- * Note: this code is harmless on little-endian machines.
- */
-static void
-_byte_reverse (guchar *buf, guint32 longs)
-{
- guint32 t;
- do {
- t = (guint32) ((guint32) buf[3] << 8 | buf[2]) << 16 |
- ((guint32) buf[1] << 8 | buf[0]);
- *(guint32 *) buf = t;
- buf += 4;
- } while (--longs);
-}
-
-/**
- * md5_init: Initialise an md5 context object
- * @ctx: md5 context
- *
- * Initialise an md5 buffer.
- *
- **/
-void
-md5_init (MD5Context *ctx)
-{
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
-
- ctx->bits[0] = 0;
- ctx->bits[1] = 0;
-
- if (IS_BIG_ENDIAN())
- ctx->doByteReverse = 1;
- else
- ctx->doByteReverse = 0;
-}
-
-
-
-/**
- * md5_update: add a buffer to md5 hash computation
- * @ctx: conetxt object used for md5 computaion
- * @buf: buffer to add
- * @len: buffer length
- *
- * Update context to reflect the concatenation of another buffer full
- * of bytes. Use this to progressively construct an md5 hash.
- **/
-void
-md5_update (MD5Context *ctx, const guchar *buf, guint32 len)
-{
- guint32 t;
-
- /* Update bitcount */
-
- t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((guint32) len << 3)) < t)
- ctx->bits[1]++; /* Carry from low to high */
- ctx->bits[1] += len >> 29;
-
- t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
-
- /* Handle any leading odd-sized chunks */
-
- if (t) {
- guchar *p = (guchar *) ctx->in + t;
-
- t = 64 - t;
- if (len < t) {
- memcpy (p, buf, len);
- return;
- }
- memcpy (p, buf, t);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- buf += t;
- len -= t;
- }
- /* Process data in 64-byte chunks */
-
- while (len >= 64) {
- memcpy (ctx->in, buf, 64);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- buf += 64;
- len -= 64;
- }
-
- /* Handle any remaining bytes of data. */
-
- memcpy (ctx->in, buf, len);
-}
-
-
-
-
-
-/*
- * Final wrapup - pad to 64-byte boundary with the bit pattern
- * 1 0* (64-bit count of bits processed, MSB-first)
- */
-/**
- * md5_final: copy the final md5 hash to a bufer
- * @digest: 16 bytes buffer
- * @ctx: context containing the calculated md5
- *
- * copy the final md5 hash to a bufer
- **/
-void
-md5_final (guchar digest[16], MD5Context *ctx)
-{
- guint32 count;
- guchar *p;
-
- /* Compute number of bytes mod 64 */
- count = (ctx->bits[0] >> 3) & 0x3F;
-
- /* Set the first char of padding to 0x80. This is safe since there is
- always at least one byte free */
- p = ctx->in + count;
- *p++ = 0x80;
-
- /* Bytes of padding needed to make 64 bytes */
- count = 64 - 1 - count;
-
- /* Pad out to 56 mod 64 */
- if (count < 8) {
- /* Two lots of padding: Pad the first block to 64 bytes */
- memset (p, 0, count);
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 16);
- md5_transform (ctx->buf, (guint32 *) ctx->in);
-
- /* Now fill the next block with 56 bytes */
- memset (ctx->in, 0, 56);
- } else {
- /* Pad block to 56 bytes */
- memset (p, 0, count - 8);
- }
- if (ctx->doByteReverse)
- _byte_reverse (ctx->in, 14);
-
- /* Append length in bits and transform */
- ((guint32 *) ctx->in)[14] = ctx->bits[0];
- ((guint32 *) ctx->in)[15] = ctx->bits[1];
-
- md5_transform (ctx->buf, (guint32 *) ctx->in);
- if (ctx->doByteReverse)
- _byte_reverse ((guchar *) ctx->buf, 4);
- memcpy (digest, ctx->buf, 16);
- memset (ctx, 0, sizeof(ctx)); /* In case it's sensitive */
-}
-
-
-
-
-/* The four core functions - F1 is optimized somewhat */
-
-/* #define F1(x, y, z) (x & y | ~x & z) */
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define F2(x, y, z) F1(z, x, y)
-#define F3(x, y, z) (x ^ y ^ z)
-#define F4(x, y, z) (y ^ (x | ~z))
-
-/* This is the central step in the MD5 algorithm. */
-#define MD5STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
-
-/*
- * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data. md5_Update blocks
- * the data and converts bytes into longwords for this routine.
- */
-static void
-md5_transform (guint32 buf[4], const guint32 in[16])
-{
- register guint32 a, b, c, d;
-
- a = buf[0];
- b = buf[1];
- c = buf[2];
- d = buf[3];
-
- MD5STEP (F1, a, b, c, d, in[0] + 0xd76aa478, 7);
- MD5STEP (F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
- MD5STEP (F1, c, d, a, b, in[2] + 0x242070db, 17);
- MD5STEP (F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
- MD5STEP (F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
- MD5STEP (F1, d, a, b, c, in[5] + 0x4787c62a, 12);
- MD5STEP (F1, c, d, a, b, in[6] + 0xa8304613, 17);
- MD5STEP (F1, b, c, d, a, in[7] + 0xfd469501, 22);
- MD5STEP (F1, a, b, c, d, in[8] + 0x698098d8, 7);
- MD5STEP (F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
- MD5STEP (F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
- MD5STEP (F1, b, c, d, a, in[11] + 0x895cd7be, 22);
- MD5STEP (F1, a, b, c, d, in[12] + 0x6b901122, 7);
- MD5STEP (F1, d, a, b, c, in[13] + 0xfd987193, 12);
- MD5STEP (F1, c, d, a, b, in[14] + 0xa679438e, 17);
- MD5STEP (F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
- MD5STEP (F2, a, b, c, d, in[1] + 0xf61e2562, 5);
- MD5STEP (F2, d, a, b, c, in[6] + 0xc040b340, 9);
- MD5STEP (F2, c, d, a, b, in[11] + 0x265e5a51, 14);
- MD5STEP (F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
- MD5STEP (F2, a, b, c, d, in[5] + 0xd62f105d, 5);
- MD5STEP (F2, d, a, b, c, in[10] + 0x02441453, 9);
- MD5STEP (F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
- MD5STEP (F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
- MD5STEP (F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
- MD5STEP (F2, d, a, b, c, in[14] + 0xc33707d6, 9);
- MD5STEP (F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
- MD5STEP (F2, b, c, d, a, in[8] + 0x455a14ed, 20);
- MD5STEP (F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
- MD5STEP (F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
- MD5STEP (F2, c, d, a, b, in[7] + 0x676f02d9, 14);
- MD5STEP (F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
- MD5STEP (F3, a, b, c, d, in[5] + 0xfffa3942, 4);
- MD5STEP (F3, d, a, b, c, in[8] + 0x8771f681, 11);
- MD5STEP (F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
- MD5STEP (F3, b, c, d, a, in[14] + 0xfde5380c, 23);
- MD5STEP (F3, a, b, c, d, in[1] + 0xa4beea44, 4);
- MD5STEP (F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
- MD5STEP (F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
- MD5STEP (F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
- MD5STEP (F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
- MD5STEP (F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
- MD5STEP (F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
- MD5STEP (F3, b, c, d, a, in[6] + 0x04881d05, 23);
- MD5STEP (F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
- MD5STEP (F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
- MD5STEP (F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
- MD5STEP (F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
- MD5STEP (F4, a, b, c, d, in[0] + 0xf4292244, 6);
- MD5STEP (F4, d, a, b, c, in[7] + 0x432aff97, 10);
- MD5STEP (F4, c, d, a, b, in[14] + 0xab9423a7, 15);
- MD5STEP (F4, b, c, d, a, in[5] + 0xfc93a039, 21);
- MD5STEP (F4, a, b, c, d, in[12] + 0x655b59c3, 6);
- MD5STEP (F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
- MD5STEP (F4, c, d, a, b, in[10] + 0xffeff47d, 15);
- MD5STEP (F4, b, c, d, a, in[1] + 0x85845dd1, 21);
- MD5STEP (F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
- MD5STEP (F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
- MD5STEP (F4, c, d, a, b, in[6] + 0xa3014314, 15);
- MD5STEP (F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
- MD5STEP (F4, a, b, c, d, in[4] + 0xf7537e82, 6);
- MD5STEP (F4, d, a, b, c, in[11] + 0xbd3af235, 10);
- MD5STEP (F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
- MD5STEP (F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
-}
-
-
-
-
-/**
- * md5_get_digest: get the md5 hash of a buffer
- * @buffer: byte buffer
- * @buffer_size: buffer size (in bytes)
- * @digest: 16 bytes buffer receiving the hash code.
- *
- * Get the md5 hash of a buffer. The result is put in
- * the 16 bytes buffer @digest .
- **/
-void
-md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16])
-{
- MD5Context ctx;
-
- md5_init (&ctx);
- md5_update (&ctx, buffer, buffer_size);
- md5_final (digest, &ctx);
-
-}
-
-
-/**
- * md5_get_digest_from_stream: get the md5 hash of a stream
- * @stream: stream
- * @digest: 16 bytes buffer receiving the hash code.
- *
- * Get the md5 hash of a stream. The result is put in
- * the 16 bytes buffer @digest .
- **/
-void
-md5_get_digest_from_stream (CamelStream *stream, guchar digest[16])
-{
- MD5Context ctx;
- guchar tmp_buf[1024];
- gint nb_bytes_read;
-
- md5_init (&ctx);
-
- nb_bytes_read = camel_stream_read (stream, tmp_buf, 1024);
- while (nb_bytes_read) {
- md5_update (&ctx, tmp_buf, nb_bytes_read);
- nb_bytes_read = camel_stream_read (stream, tmp_buf, 1024);
- }
-
- md5_final (digest, &ctx);
-
-}
-
-
-
-
-/**
- * md5_get_digest_from_file: get the md5 hash of a file
- * @filename: file name
- * @digest: 16 bytes buffer receiving the hash code.
- *
- * Get the md5 hash of a file. The result is put in
- * the 16 bytes buffer @digest .
- **/
-void
-md5_get_digest_from_file (const gchar *filename, guchar digest[16])
-{
- MD5Context ctx;
- guchar tmp_buf[1024];
- gint nb_bytes_read;
- FILE *fp;
-
- md5_init (&ctx);
- fp = fopen(filename, "r");
- if (!fp) {
- return;
- }
-
- while ((nb_bytes_read = fread (tmp_buf, sizeof (guchar), 1024, fp)) > 0)
- md5_update (&ctx, tmp_buf, nb_bytes_read);
-
- if (ferror(fp)) {
- fclose(fp);
- return;
- }
-
- md5_final (digest, &ctx);
-
-}
-
-
-
-
diff --git a/camel/md5-utils.h b/camel/md5-utils.h
deleted file mode 100644
index a2552d21b2..0000000000
--- a/camel/md5-utils.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to rpmMD5Init, call rpmMD5Update as
- * needed on buffers full of bytes, and then call rpmMD5Final, which
- * will fill a supplied 16-byte array with the digest.
- */
-
-/* parts of this file are :
- * Written March 1993 by Branko Lankester
- * Modified June 1993 by Colin Plumb for altered md5.c.
- * Modified October 1995 by Erik Troan for RPM
- */
-
-
-#ifndef MD5_UTILS_H
-#define MD5_UTILS_H
-
-#include <glib.h>
-#include "camel-stream.h"
-
-typedef struct {
- guint32 buf[4];
- guint32 bits[2];
- guchar in[64];
- gint doByteReverse;
-
-} MD5Context ;
-
-
-void md5_get_digest (const gchar *buffer, gint buffer_size, guchar digest[16]);
-void md5_get_digest_from_stream (CamelStream *stream, guchar digest[16]);
-
-/* use this one when speed is needed */
-/* for use in provider code only */
-void md5_get_digest_from_file (const gchar *filename, guchar digest[16]);
-
-/* raw routines */
-void md5_init (MD5Context *ctx);
-void md5_update (MD5Context *ctx, const guchar *buf, guint32 len);
-void md5_final (guchar digest[16], MD5Context *ctx);
-
-
-#endif /* MD5_UTILS_H */
diff --git a/camel/providers/.cvsignore b/camel/providers/.cvsignore
deleted file mode 100644
index b840c21800..0000000000
--- a/camel/providers/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile.in
-Makefile \ No newline at end of file
diff --git a/camel/providers/MH/.cvsignore b/camel/providers/MH/.cvsignore
deleted file mode 100644
index 2e7b174532..0000000000
--- a/camel/providers/MH/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile.in
-Makefile
-.deps
-*.lo
-*.la
-.libs
diff --git a/camel/providers/MH/Makefile.am b/camel/providers/MH/Makefile.am
deleted file mode 100644
index dab6bec199..0000000000
--- a/camel/providers/MH/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelmhincludedir = $(includedir)/camel
-
-
-lib_LTLIBRARIES = libcamelmh.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel
-
-libcamelmh_la_SOURCES = \
- camel-mh-folder.c \
- camel-mh-provider.c \
- camel-mh-store.c \
- mh-summary.c \
- mh-uid.c \
- mh-utils.c
-
-libcamelmhinclude_HEADERS = \
- camel-mh-folder.h \
- camel-mh-store.h \
- mh-summary.c \
- mh-uid.h \
- mh-utils.h
-
-
-libcamelmh_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-
-EXTRA_DIST =
diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c
deleted file mode 100644
index 86bbab46ba..0000000000
--- a/camel/providers/MH/camel-mh-folder.c
+++ /dev/null
@@ -1,1022 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-folder.c : Abstract class for an email folder */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#include <config.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include "camel-mh-folder.h"
-#include "camel-mh-store.h"
-#include "gstring-util.h"
-#include "camel-log.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-buffered-fs.h"
-#include "camel-folder-summary.h"
-#include "gmime-utils.h"
-#include "mh-utils.h"
-#include "mh-uid.h"
-#include "mh-summary.h"
-
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for a CamelMhFolder */
-#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMHS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void _set_name(CamelFolder *folder, const gchar *name, CamelException *ex);
-static void _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _create(CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message (CamelFolder *folder, gint number, CamelException *ex);
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static gint _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static void _expunge (CamelFolder *folder, CamelException *ex);
-static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex);
-static void _open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex);
-static void _close (CamelFolder *folder, gboolean expunge, CamelException *ex);
-
-static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-static GList *_get_uid_list (CamelFolder *folder, CamelException *ex);
-
-/* some utility functions */
-static int copy_reg (const char *src_path, const char *dst_path, CamelException *ex);
-
-static void
-camel_mh_folder_class_init (CamelMhFolderClass *camel_mh_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_mh_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->exists = _exists;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->list_subfolders = _list_subfolders;
- camel_folder_class->get_message = _get_message;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->append_message = _append_message;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->copy_message_to = _copy_message_to;
- camel_folder_class->open = _open;
- camel_folder_class->close = _close;
- camel_folder_class->get_message_uid = _get_message_uid;
- camel_folder_class->get_message_by_uid = _get_message_by_uid;
- camel_folder_class->get_uid_list = _get_uid_list;
-
-}
-
-
-
-
-
-
-
-GtkType
-camel_mh_folder_get_type (void)
-{
- static GtkType camel_mh_folder_type = 0;
-
- if (!camel_mh_folder_type) {
- GtkTypeInfo camel_mh_folder_info =
- {
- "CamelMhFolder",
- sizeof (CamelMhFolder),
- sizeof (CamelMhFolderClass),
- (GtkClassInitFunc) camel_mh_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mh_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_mh_folder_info);
- }
-
- return camel_mh_folder_type;
-}
-
-
-
-static gint
-_message_name_compare (gconstpointer a, gconstpointer b)
-{
- gchar *m1 = (gchar *)a;
- gchar *m2 = (gchar *)b;
- gint len_diff;
-
- return (atoi (m1) - atoi (m2));
-}
-
-
-static void
-_init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex)
-{
- /* call parent method */
- parent_class->init_with_store (folder, parent_store, ex);
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = TRUE;
- folder->has_uid_capability = TRUE;
-
- folder->summary = NULL;
-
-}
-
-
-
-static void
-_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- struct dirent *dir_entry;
- DIR *dir_handle;
-
-
- if (folder->open_state == FOLDER_OPEN) return;
-
-
- /* create message list */
- /* read the whole folder and sort message names */
- dir_handle = opendir (mh_folder->directory_path);
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, mh_folder->directory_path))
- /* add the file name to the list */
- mh_folder->file_name_list = g_list_insert_sorted (mh_folder->file_name_list,
- g_strdup (dir_entry->d_name),
- _message_name_compare);
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- /* get (or create) uid list */
- if (!(mh_load_uid_list (mh_folder) > 0))
- mh_generate_uid_list (mh_folder);
-
- /* get or create summary */
- /* it is important that it comes after uid list reading/generation */
- if (!(mh_load_summary (mh_folder) > 0))
- mh_generate_summary (folder);
- printf ("**** summary = %p\n", folder->summary);
-
-}
-
-
-
-static void
-_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
-
- /* save uid list, if any */
- if (mh_folder->uid_array)
- mh_save_uid_list (mh_folder);
-
- /* save summary, if any */
- if (folder->summary)
- mh_save_summary (mh_folder);
-
- /* call parent implementation */
- parent_class->close (folder, expunge, ex);
-}
-
-
-
-
-
-/**
- * camel_mh_folder_set_name: set the name of an MH folder
- * @folder: the folder to set the name
- * @name: a string representing the (short) name
- *
- *
- *
- **/
-static void
-_set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- const gchar *root_dir_path;
- gchar *full_name;
- const gchar *parent_full_name;
- gchar separator;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::set_name\n");
- g_assert (folder);
- g_assert (name);
- g_assert (folder->parent_store);
-
- /* call default implementation */
- parent_class->set_name (folder, name, ex);
-
- if (mh_folder->directory_path) g_free (mh_folder->directory_path);
-
- separator = camel_store_get_separator (folder->parent_store);
- root_dir_path = camel_mh_store_get_toplevel_dir (CAMEL_MH_STORE(folder->parent_store));
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::set_name full_name is %s\n", folder->full_name);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::set_name root_dir_path is %s\n", root_dir_path);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::separator is %c\n", separator);
-
- mh_folder->directory_path = g_strdup_printf ("%s%c%s", root_dir_path, separator, folder->full_name);
-
- if (!camel_folder_exists (folder, ex)) return;
-
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::set_name mh_folder->directory_path is %s\n",
- mh_folder->directory_path);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::set_name\n");
-}
-
-
-
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- struct stat stat_buf;
- gint stat_error;
- gboolean exists;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::exists\n");
- g_assert (folder);
-
- if (!mh_folder->directory_path) return FALSE;
-
- stat_error = stat (mh_folder->directory_path, &stat_buf);
- if (stat_error == -1) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::exists when executing stat on %s, stat_error = %d\n",
- mh_folder->directory_path, stat_error);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- return FALSE;
- }
- exists = S_ISDIR (stat_buf.st_mode);
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::exists\n");
- return exists;
-}
-
-
-static gboolean
-_create (CamelFolder *folder, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- mode_t dir_mode = S_IRWXU;
- gint mkdir_error;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->create (folder, ex);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (camel_folder_exists (folder, ex)) return TRUE;
-
- mkdir_error = mkdir (directory_path, dir_mode);
- return (mkdir_error == -1);
-}
-
-
-
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- gint rmdir_error = 0;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->delete (folder, recurse, ex);
- /* the default implementation will care about deleting
- messages first and recursing the operation if
- necessary */
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- /* physically delete the directory */
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::delete removing directory %s\n", directory_path);
- rmdir_error = rmdir (directory_path);
- if (rmdir_error == -1) {
- CAMEL_LOG_WARNING ("CamelMhFolder::delete Error when removing directory %s\n", directory_path);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
- }
-
- return (rmdir_error != -1);
-}
-
-
-static gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct stat stat_buf;
- gint stat_error = 0;
- gchar *entry_name;
- struct dirent *dir_entry;
- gint unlink_error = 0;
- DIR *dir_handle;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->delete_messages (folder, ex);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while ((stat_error != -1) && (unlink_error != -1) && (dir_entry != NULL)) {
-
- /* get the name of the next entry in the dir */
- entry_name = dir_entry->d_name;
- stat_error = stat (mh_folder->directory_path, &stat_buf);
-
- /* is it a regular file ? */
- if ((stat_error != -1) && S_ISREG(stat_buf.st_mode)) {
- /* yes, delete it */
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::delete_messages removing file %s\n", entry_name);
- unlink_error = unlink(entry_name);
-
- if (unlink_error == -1) {
- CAMEL_LOG_WARNING ("CamelMhFolder::delete_messages Error when deleting file %s\n",
- entry_name);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
- }
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- return ((stat_error != -1) && (unlink_error != -1));
-
-}
-
-
-
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- GList *subfolder_name_list = NULL;
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct stat stat_buf;
- gint stat_error = 0;
- GList *file_list;
- gchar *entry_name;
- gchar *full_entry_name;
- struct dirent *dir_entry;
- DIR *dir_handle;
-
- g_assert(folder);
-
- /* call default implementation */
- parent_class->delete_messages (folder, ex);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return NULL;
-
- if (!camel_folder_exists (folder, ex)) return NULL;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while ((stat_error != -1) && (dir_entry != NULL)) {
-
- /* get the name of the next entry in the dir */
- entry_name = dir_entry->d_name;
- full_entry_name = g_strdup_printf ("%s/%s", mh_folder->directory_path, entry_name);
- stat_error = stat (full_entry_name, &stat_buf);
- g_free (full_entry_name);
-
- /* is it a directory ? */
- if ((stat_error != -1) && S_ISDIR (stat_buf.st_mode)) {
- /* yes, add it to the list */
- if (entry_name[0] != '.') {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::list_subfolders adding %s\n", entry_name);
- subfolder_name_list = g_list_append (subfolder_name_list, g_strdup (entry_name));
- }
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- return subfolder_name_list;
-}
-
-
-
-
-
-static void
-_filename_free (gpointer data)
-{
- g_free ((gchar *)data);
-}
-
-
-/* slow routine, may be optimixed, or we should use
- caches if users complain */
-static CamelMimeMessage *
-_get_message (CamelFolder *folder, gint number, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- gchar *message_name;
- gchar *message_file_name;
- CamelStream *input_stream = NULL;
- CamelMimeMessage *message = NULL;
- GList *message_list = NULL;
-
- g_assert(folder);
-
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return NULL;
-
-
-
- message_name = g_list_nth_data (mh_folder->file_name_list, number);
-
- if (message_name != NULL) {
- CAMEL_LOG_FULL_DEBUG ("CanelMhFolder::get_message message number = %d, name = %s\n",
- number, message_name);
- message_file_name = g_strdup_printf ("%s/%s", directory_path, message_name);
- input_stream = camel_stream_buffered_fs_new_with_name (message_file_name, CAMEL_STREAM_BUFFERED_FS_READ);
-
- if (input_stream != NULL) {
-#warning use session field here
- message = camel_mime_message_new_with_session ( (CamelSession *)NULL);
- camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream);
- gtk_object_unref (GTK_OBJECT (input_stream));
- message->message_number = number;
- gtk_object_set_data_full (GTK_OBJECT (message), "filename",
- g_strdup (message_name), _filename_free);
-
-#warning Set flags and all this stuff here
- }
- g_free (message_file_name);
- } else
- CAMEL_LOG_FULL_DEBUG ("CanelMhFolder::get_message message number = %d, not found\n", number);
-
-
- return message;
-}
-
-
-
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
-
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct dirent *dir_entry;
- DIR *dir_handle;
- guint message_count = 0;
-
- g_assert(folder);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return -1;
-
- if (!camel_folder_exists (folder, ex)) return 0;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, directory_path))
- message_count++;
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::get_message_count found %d messages\n", message_count);
- return message_count;
-}
-
-
-
-static gboolean
-_find_next_free_message_file (CamelFolder *folder, gint *new_msg_number, gchar **new_msg_filename, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- struct dirent *dir_entry;
- DIR *dir_handle;
- gint last_max_message_number = 0;
- gint current_message_number;
-
- g_assert(folder);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return FALSE;
-
- if (!camel_folder_exists (folder, ex)) return FALSE;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, directory_path)) {
- /* see if the message number is the biggest found */
- current_message_number = atoi (dir_entry->d_name);
- if (current_message_number > last_max_message_number)
- last_max_message_number = current_message_number;
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
- closedir (dir_handle);
-
- *new_msg_number = last_max_message_number + 1;
- *new_msg_filename = g_strdup_printf ("%s/%d", directory_path, *new_msg_number);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::find_next_free_message_file new message path is %s\n",
- *new_msg_filename);
- return TRUE;
-
-
-}
-static gint
-_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- guint new_msg_number;
- gchar *new_msg_filename;
- CamelStream *output_stream;
- gboolean error;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::append_message\n");
- if (!_find_next_free_message_file (folder, &new_msg_number, &new_msg_filename, ex))
- return -1;
-
- output_stream = camel_stream_fs_new_with_name (new_msg_filename, CAMEL_STREAM_FS_WRITE);
- if (output_stream != NULL) {
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
- camel_stream_close (output_stream);
- } else {
- CAMEL_LOG_WARNING ("CamelMhFolder::append_message could not open %s for writing\n",
- new_msg_filename);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- error = TRUE;
- }
-
- g_free (new_msg_filename);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::append_message\n");
- if (error) return -1;
- else return new_msg_number;
-}
-
-
-
-
-
-static void
-_expunge (CamelFolder *folder, CamelException *ex)
-{
- /* For the moment, we look in the folder active message
- * list. I did not make my mind for the moment, should
- * the gtk_object->destroy signal be used to expunge
- * freed messages objects marked DELETED ?
- */
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- CamelMimeMessage *message;
- GList *message_node;
- gchar *fullpath;
- gchar *filename;
- gint unlink_error;
- const gchar *directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelFolder::expunge\n");
-
- message_node = folder->message_list;
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return;
-
- /* look in folder message list which messages
- * need to be expunged */
- while ( message_node) {
- message = CAMEL_MIME_MESSAGE (message_node->data);
-
- if (message && camel_mime_message_get_flag (message, "DELETED")) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::expunge, expunging message %d\n", message->message_number);
- /* expunge the message */
- filename = gtk_object_get_data (GTK_OBJECT (message), "filename");
- fullpath = g_strdup_printf ("%s/%s", directory_path, filename);
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::expunge, message fullpath is %s\n",
- fullpath);
- unlink_error = unlink(fullpath);
- if (unlink_error != -1) {
- message->expunged = TRUE;
- } else {
- CAMEL_LOG_WARNING ("CamelMhFolder:: could not unlink %s (message %d)\n",
- fullpath, message->message_number);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- }
- }
- message_node = message_node->next;
- CAMEL_LOG_FULL_DEBUG ("CamelFolder::expunge, examined message node %p\n", message_node);
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::expunge\n");
-}
-
-
-static void
-_copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex)
-{
- gchar *src_msg_filename;
- guint dest_msg_number;
- gchar *dest_msg_filename;
-
- if (IS_CAMEL_MH_FOLDER (dest_folder)) {
- /*g_return_if_fail (message->parent_folder == folder);*/
-
- if (!_find_next_free_message_file (dest_folder, &dest_msg_number, &dest_msg_filename, ex))
- return;
- src_msg_filename = gtk_object_get_data (GTK_OBJECT (message), "fullpath");
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::copy_to copy file %s to %s\n", src_msg_filename, dest_msg_filename);
- copy_reg (src_msg_filename, dest_msg_filename, ex);
-
- } else
- parent_class->copy_message_to (folder, message, dest_folder, ex);
-}
-
-
-
-/** UID **/
-
-static const gchar *
-_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- GArray *uid_array;
- gboolean found = FALSE;
- MhUidCouple *uid_couple;
- gchar *filename;
- guint file_number;
- gint i;
-
- /* if the message already has its uid stored,
- return it */
- if (message->message_uid)
- return (message->message_uid);
-
- /* else, it has a filename associated to it */
- filename = gtk_object_get_data (GTK_OBJECT (message), "filename");
- file_number = atoi (file_number);
-
- uid_array = mh_folder->uid_array;
- uid_couple = (MhUidCouple *)uid_array->data;
-
- /* look in the uid array for the file number */
- found = (uid_couple->file_number == file_number);
- for (i=0; (i<uid_array->len) && (!found); i++) {
- uid_couple++;
- found = (uid_couple->file_number == file_number);
- }
-
- if (found) return uid_couple->uid;
- else return NULL;
-
-}
-
-
-static CamelMimeMessage *
-_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- GArray *uid_array;
- gboolean found = FALSE;
- MhUidCouple *uid_couple;
- gint file_number;
- gchar *filename;
- CamelMimeMessage *message = NULL;
- CamelStream *input_stream;
- int i;
-
- /*
- * because they are constructed with md5
- * signatures, all MH uids are 16 bytes long
- */
- if (strlen (uid) != 16) return NULL;
-
- uid_array = mh_folder->uid_array;
- uid_couple = (MhUidCouple *)uid_array->data;
-
- found = !strncmp (uid, uid_couple->uid, 16 * sizeof (guchar));
- for (i=0; (i<uid_array->len) && (!found); i++) {
- uid_couple++;
- found = !strncmp (uid, uid_couple->uid, 16 * sizeof (guchar));
- }
- if (found) {
- /* physically retrieve the message */
- file_number = uid_couple->file_number;
- filename = g_strdup_printf ("%d", file_number);
- input_stream = camel_stream_buffered_fs_new_with_name (filename, CAMEL_STREAM_BUFFERED_FS_READ);
-
- if (input_stream != NULL) {
-#warning use session field here
- message = camel_mime_message_new_with_session ( (CamelSession *)NULL);
- camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream);
- gtk_object_unref (GTK_OBJECT (input_stream));
-
- /* set message UID in CamelMimeMessage */
- message->message_uid = g_strdup (uid);
-
- }
- g_free (filename);
- }
-
- return message;
-
-}
-
-static GList *
-_get_uid_list (CamelFolder *folder, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- GList *uid_list;
- GArray *uid_array;
- MhUidCouple *uid_couple;
- int i;
-
- uid_array = mh_folder->uid_array;
- uid_couple = (MhUidCouple *)uid_array->data;
-
- for (i=0; i<uid_array->len; i++) {
- uid_list = g_list_prepend (uid_list, uid_couple->uid);
- uid_couple++;
- }
-
- return uid_list;
-}
-
-
-
-
-
-
-
-
-/************************************************************************/
-
-/*** Took directly from GNU fileutils-4.0 ***/
-/* Copyright (C) 89, 90, 91, 95, 96, 97, 1998 Free Software Foundation. */
-/* This may be rwritten soon. -Bertrand */
-
-
-/* Write LEN bytes at PTR to descriptor DESC, retrying if interrupted.
- Return LEN upon success, write's (negative) error code otherwise. */
-int
-full_write (int desc, const char *ptr, size_t len)
-{
- int total_written;
-
- total_written = 0;
- while (len > 0)
- {
- int written = write (desc, ptr, len);
- if (written < 0)
- {
- if (errno == EINTR)
- continue;
- return written;
- }
- total_written += written;
- ptr += written;
- len -= written;
- }
- return total_written;
-}
-
-
-
-
-static int
-copy_reg (const char *src_path, const char *dst_path, CamelException *ex)
-{
- char *buf;
- int buf_size;
- int dest_desc;
- int source_desc;
- int n_read;
- struct stat sb;
- char *cp;
- int *ip;
- int return_val = 0;
- off_t n_read_total = 0;
- int last_write_made_hole = 0;
- int make_holes = TRUE;
-
- source_desc = open (src_path, O_RDONLY);
- if (source_desc < 0)
- {
- /* If SRC_PATH doesn't exist, then chances are good that the
- user did something like this `cp --backup foo foo': and foo
- existed to start with, but copy_internal renamed DST_PATH
- with the backup suffix, thus also renaming SRC_PATH. */
- if (errno == ENOENT)
- error (0, 0, "`%s' and `%s' are the same file",
- src_path, dst_path);
- else
- error (0, errno, "%s", src_path);
-
- return -1;
- }
-
- /* Create the new regular file with small permissions initially,
- to not create a security hole. */
-
- dest_desc = open (dst_path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
- if (dest_desc < 0)
- {
- error (0, errno, "cannot create regular file `%s'", dst_path);
- return_val = -1;
- goto ret2;
- }
-
- /* Find out the optimal buffer size. */
-
- if (fstat (dest_desc, &sb))
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- goto ret;
- }
-
- buf_size = 8192;
-
-
-
- /* Make a buffer with space for a sentinel at the end. */
-
- buf = (char *) alloca (buf_size + sizeof (int));
-
- for (;;)
- {
- n_read = read (source_desc, buf, buf_size);
- if (n_read < 0)
- {
- if (errno == EINTR)
- continue;
- error (0, errno, "%s", src_path);
- return_val = -1;
- goto ret;
- }
- if (n_read == 0)
- break;
-
- n_read_total += n_read;
-
- ip = 0;
- if (make_holes)
- {
- buf[n_read] = 1; /* Sentinel to stop loop. */
-
- /* Find first nonzero *word*, or the word with the sentinel. */
-
- ip = (int *) buf;
- while (*ip++ == 0)
- ;
-
- /* Find the first nonzero *byte*, or the sentinel. */
-
- cp = (char *) (ip - 1);
- while (*cp++ == 0)
- ;
-
- /* If we found the sentinel, the whole input block was zero,
- and we can make a hole. */
-
- if (cp > buf + n_read)
- {
- /* Make a hole. */
- if (lseek (dest_desc, (off_t) n_read, SEEK_CUR) < 0L)
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- goto ret;
- }
- last_write_made_hole = 1;
- }
- else
- /* Clear to indicate that a normal write is needed. */
- ip = 0;
- }
- if (ip == 0)
- {
- if (full_write (dest_desc, buf, n_read) < 0)
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- goto ret;
- }
- last_write_made_hole = 0;
- }
- }
-
- /* If the file ends with a `hole', something needs to be written at
- the end. Otherwise the kernel would truncate the file at the end
- of the last write operation. */
-
- if (last_write_made_hole)
- {
-#if HAVE_FTRUNCATE
- /* Write a null character and truncate it again. */
- if (full_write (dest_desc, "", 1) < 0
- || ftruncate (dest_desc, n_read_total) < 0)
-#else
- /* Seek backwards one character and write a null. */
- if (lseek (dest_desc, (off_t) -1, SEEK_CUR) < 0L
- || full_write (dest_desc, "", 1) < 0)
-#endif
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- }
- }
-
-ret:
- if (close (dest_desc) < 0)
- {
- error (0, errno, "%s", dst_path);
- return_val = -1;
- }
-ret2:
- if (close (source_desc) < 0)
- {
- error (0, errno, "%s", src_path);
- return_val = -1;
- }
-
- return return_val;
-}
diff --git a/camel/providers/MH/camel-mh-folder.h b/camel/providers/MH/camel-mh-folder.h
deleted file mode 100644
index 40800375eb..0000000000
--- a/camel/providers/MH/camel-mh-folder.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-folder.h : Abstract class for an email folder */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MH_FOLDER_H
-#define CAMEL_MH_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-folder.h"
-/* #include "camel-store.h" */
-
-#define CAMEL_MH_FOLDER_TYPE (camel_mh_folder_get_type ())
-#define CAMEL_MH_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_MH_FOLDER_TYPE, CamelMhFolder))
-#define CAMEL_MH_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MH_FOLDER_TYPE, CamelMhFolderClass))
-#define IS_CAMEL_MH_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_MH_FOLDER_TYPE))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- gchar *directory_path;
- GList *file_name_list;
- GArray *uid_array;
-
-} CamelMhFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMhFolderClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mh_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MH_FOLDER_H */
diff --git a/camel/providers/MH/camel-mh-provider.c b/camel/providers/MH/camel-mh-provider.c
deleted file mode 100644
index 316b8a0797..0000000000
--- a/camel/providers/MH/camel-mh-provider.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-provider.c: mh provider registration code */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-#include "camel-mh-store.h"
-#include "camel-provider.h"
-#include "camel-log.h"
-
-
-static CamelProvider _mh_provider = {
- (GtkType) 0,
- PROVIDER_STORE,
- "mh",
- "Camel default mh provider",
- "This is a very simple provider, mh is a bad protocol anyway",
- (GModule *) NULL
-};
-
-
-
-CamelProvider *
-camel_provider_module_init ()
-{
- _mh_provider.object_type = camel_mh_store_get_type();
- return &_mh_provider;
-}
diff --git a/camel/providers/MH/camel-mh-store.c b/camel/providers/MH/camel-mh-store.c
deleted file mode 100644
index 60ba07f47b..0000000000
--- a/camel/providers/MH/camel-mh-store.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mh-store.c : class for an mh store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-mh-store.h"
-#include "camel-mh-folder.h"
-#include "url-util.h"
-
-static CamelStoreClass *parent_class=NULL;
-
-/* Returns the class for a CamelMhStore */
-#define CMHS_CLASS(so) CAMEL_MH_STORE_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-static void _init (CamelStore *store, CamelSession *session, const gchar *url_name);
-static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name);
-
-
-static void
-camel_mh_store_class_init (CamelMhStoreClass *camel_mh_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_mh_store_class);
-
- parent_class = gtk_type_class (camel_store_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_store_class->init = _init;
- camel_store_class->get_folder = _get_folder;
-}
-
-
-
-static void
-camel_mh_store_init (gpointer object, gpointer klass)
-{
- CamelMhStore *mh_store = CAMEL_MH_STORE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- store->separator = '/';
-}
-
-
-
-
-GtkType
-camel_mh_store_get_type (void)
-{
- static GtkType camel_mh_store_type = 0;
-
- if (!camel_mh_store_type) {
- GtkTypeInfo camel_mh_store_info =
- {
- "CamelMhStore",
- sizeof (CamelMhStore),
- sizeof (CamelMhStoreClass),
- (GtkClassInitFunc) camel_mh_store_class_init,
- (GtkObjectInitFunc) camel_mh_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mh_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_mh_store_info);
- }
-
- return camel_mh_store_type;
-}
-
-
-
-
-/* These evil public functions are here for test only */
-void
-camel_mh_store_set_toplevel_dir (CamelMhStore *store, const gchar *toplevel)
-{
- store->toplevel_dir = g_strdup (toplevel);
- CAMEL_STORE(store)->separator = '/';
-}
-
-
-const gchar *
-camel_mh_store_get_toplevel_dir (CamelMhStore *store)
-{
- return store->toplevel_dir;
-}
-
-
-
-static void
-_init (CamelStore *store, CamelSession *session, const gchar *url_name)
-{
- CamelMhStore *mh_store = CAMEL_MH_STORE (store);
- Gurl *store_url;
-
- g_assert (url_name);
- /* call parent implementation */
- parent_class->init (store, session, url_name);
-
-
- /* find the path in the URL*/
- store_url = g_url_new (url_name);
-
- g_return_if_fail (store_url);
- g_return_if_fail (store_url->path);
-
- mh_store->toplevel_dir = g_strdup (store_url->path);
- g_url_free (store_url);
-
-
-
-}
-
-
-static CamelFolder *
-_get_folder (CamelStore *store, const gchar *folder_name)
-{
- CamelMhFolder *new_mh_folder;
- CamelFolder *new_folder;
-
- /* check if folder has already been created */
- /* call the standard routine for that when */
- /* it is done ... */
-
- new_mh_folder = gtk_type_new (CAMEL_MH_FOLDER_TYPE);
- new_folder = CAMEL_FOLDER (new_mh_folder);
-
- CF_CLASS (new_folder)->init_with_store (new_folder, store, NULL);
- CF_CLASS (new_folder)->set_name (new_folder, folder_name, NULL);
-
-
- return new_folder;
-}
diff --git a/camel/providers/MH/camel-mh-store.h b/camel/providers/MH/camel-mh-store.h
deleted file mode 100644
index 924a5a6fc5..0000000000
--- a/camel/providers/MH/camel-mh-store.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mhstore.h : class for an mh store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MH_STORE_H
-#define CAMEL_MH_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-store.h"
-
-#define CAMEL_MH_STORE_TYPE (camel_mh_store_get_type ())
-#define CAMEL_MH_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MH_STORE_TYPE, CamelMhStore))
-#define CAMEL_MH_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MH_STORE_TYPE, CamelMhStoreClass))
-#define IS_CAMEL_MH_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MH_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
- gchar *toplevel_dir;
-} CamelMhStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-
-} CamelMhStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mh_store_get_type (void);
-
-void camel_mh_store_set_toplevel_dir (CamelMhStore *store, const gchar *toplevel);
-const gchar *camel_mh_store_get_toplevel_dir (CamelMhStore *store);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MH_STORE_H */
-
-
diff --git a/camel/providers/MH/mh-summary.c b/camel/providers/MH/mh-summary.c
deleted file mode 100644
index 5a964696e0..0000000000
--- a/camel/providers/MH/mh-summary.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-
-#include "mh-uid.h"
-#include "camel-log.h"
-#include "camel-stream.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-buffered-fs.h"
-#include "gmime-utils.h"
-#include "mh-utils.h"
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-void
-mh_generate_summary (CamelFolder *folder)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER (folder);
- CamelFolderSummary *summary;
- CamelMessageInfo *message_info;
- CamelFolderInfo *subfolder_info;
- CamelStream *message_stream;
- guint file_number;
- gchar *message_fullpath;
- gchar *directory_path;
- GArray *header_array;
- MhUidCouple *uid_couple;
- Rfc822Header *cur_header;
- int i;
- int n_file;
- GArray *uid_array;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary entering \n");
-
- g_assert (folder);
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary folder has no directory path\n");
- return;
- }
-
- summary = camel_folder_summary_new ();
- folder->summary = summary;
-
- uid_array = mh_folder->uid_array;
-
- if (!uid_array) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary "
- "no uid list, that probably means there is "
- "no message in this folder, exiting \n");
- return;
- }
- uid_couple = (MhUidCouple *)uid_array->data;
-
- for (n_file=0; n_file<uid_array->len; n_file++) {
-
- file_number = uid_couple->file_number;
-
- message_info = g_new0 (CamelMessageInfo, 1);
- message_info->uid = g_new0 (guchar, 17);
- strncpy (message_info->uid, uid_couple->uid, 16);
-
-
- message_fullpath = g_strdup_printf ("%s/%d", directory_path, file_number);
- message_stream = camel_stream_buffered_fs_new_with_name (message_fullpath,
- CAMEL_STREAM_BUFFERED_FS_READ);
- if (!message_stream) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary "
- "could not open %d for reading\n", message_fullpath);
- g_free (message_fullpath);
- return;
- }
- g_free (message_fullpath);
-
- header_array = get_header_array_from_stream (message_stream);
- gtk_object_unref (GTK_OBJECT (message_stream));
-
- for (i=0; i<header_array->len; i++) {
- cur_header = (Rfc822Header *)header_array->data + i;
- if (!g_strcasecmp (cur_header->name, "subject")) {
- message_info->subject = cur_header->value;
- g_free (cur_header->name);
- } else if (!g_strcasecmp (cur_header->name, "sender")) {
- message_info->date = cur_header->value;
- g_free (cur_header->name);
- } else if (!g_strcasecmp (cur_header->name, "date")) {
- message_info->date = cur_header->value;
- g_free (cur_header->name);
- } else {
- g_free (cur_header->name);
- g_free (cur_header->value);
- }
- }
- g_array_free (header_array, TRUE);
-
- summary->message_info_list = g_list_append (summary->message_info_list, message_info);
-
- /* next message in the uid list */
- uid_couple++;
- }
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::generate_summary leaving \n");
-
-}
-
-
-void
-mh_save_summary (CamelMhFolder *mh_folder)
-{
- GArray *uid_array;
- MhUidCouple *first_uid_couple;
- CamelFolderSummary *summary;
- GList *msg_info_list;
- CamelMessageInfo *msg_info;
- gchar *directory_path = mh_folder->directory_path;
- gchar *summary_file_path;
- gint fd;
- gint i;
- gint field_lgth;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::save_summary entering \n");
-
- summary = CAMEL_FOLDER (mh_folder)->summary;
- if (!summary) return;
-
- summary_file_path = g_strdup_printf ("%s/%s", directory_path, ".camel-summary");
- CAMEL_LOG_FULL_DEBUG ("In the process of writing %s\n", summary_file_path);
- fd = open (summary_file_path, O_WRONLY | O_CREAT );
-
- if (!fd) {
- CAMEL_LOG_FULL_DEBUG ("could not open file %s for writing. Exiting.\n", summary_file_path);
- g_free (summary_file_path);
- return;
- }
- g_free (summary_file_path);
-
- msg_info_list = summary->message_info_list;
- while (msg_info_list) {
- msg_info = msg_info_list->data;
- /* write subject */
- field_lgth = msg_info->subject ? strlen (msg_info->subject) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->subject, field_lgth);
-
- /* write uid */
- field_lgth = msg_info->uid ? strlen (msg_info->uid) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->uid, field_lgth);
-
- /* write date */
- field_lgth = msg_info->date ? strlen (msg_info->date) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->date, field_lgth);
-
- /* write sender */
- field_lgth = msg_info->sender ? strlen (msg_info->sender) : 0;
- write (fd, &field_lgth, sizeof (gint));
- if (field_lgth)
- write (fd, msg_info->sender, field_lgth);
-
- msg_info_list = msg_info_list->next;
-
- }
-
- close (fd);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::save_summary leaving \n");
-
-}
-
-
-
-
-
-gint
-mh_load_summary (CamelMhFolder *mh_folder)
-{
- GArray *uid_array;
- MhUidCouple *first_uid_couple;
- CamelFolderSummary *summary;
- CamelMessageInfo *msg_info;
- gchar *directory_path = mh_folder->directory_path;
- gchar *summary_file_path;
- gint fd;
- gint i;
- gint field_lgth;
- gboolean file_eof;
- gint stat_error;
- struct stat stat_buf;
-
- summary = CAMEL_FOLDER (mh_folder)->summary;
- if (summary) return 1; /* should we regenerate it ? */
-
- summary_file_path = g_strdup_printf ("%s/%s", directory_path, ".camel-summary");
- CAMEL_LOG_FULL_DEBUG ("In the process of reading %s\n", summary_file_path);
- fd = open (summary_file_path, O_RDONLY);
- /* tests if file exists */
- stat_error = stat (summary_file_path, &stat_buf);
-
- if (!((stat_error != -1) && S_ISREG (stat_buf.st_mode))) {
- CAMEL_LOG_FULL_DEBUG ("could not open file %s for reading. Exiting.\n", summary_file_path);
- g_free (summary_file_path);
- return -1;
- }
- g_free (summary_file_path);
-
- for (;;) {
- /* read subject */
- file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (file_eof) break;
-
-
- /* allcate a summary if needed */
- if (!summary)
- summary = camel_folder_summary_new ();
- /* allocate a message info struct */
- msg_info = g_new0 (CamelMessageInfo, 1);
-
- if (!file_eof && (field_lgth > 0)) {
- msg_info->subject = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->subject, field_lgth);
- } else
- msg_info->subject = NULL;
-
- /* read uid */
- if (!file_eof) file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (!file_eof && (field_lgth > 0)) {
- msg_info->uid = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->uid, field_lgth);
- } else
- msg_info->uid = NULL;
-
- /* read date */
- if (!file_eof) file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (!file_eof && (field_lgth > 0)) {
- msg_info->date = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->date, field_lgth);
- } else
- msg_info->date = NULL;
-
- /* read sender */
- if (!file_eof) file_eof = (read (fd, &field_lgth, sizeof (gint)) <= 0);
- if (!file_eof && (field_lgth > 0)) {
- msg_info->sender = g_new0 (gchar, field_lgth + 1);
- read (fd, msg_info->sender, field_lgth);
- } else
- msg_info->sender = NULL;
-
- summary->message_info_list = g_list_prepend (summary->message_info_list,
- msg_info);
- }
-
- CAMEL_FOLDER (mh_folder)->summary = summary;
-
- close (fd);
- return 1;
-}
-
-
diff --git a/camel/providers/MH/mh-summary.h b/camel/providers/MH/mh-summary.h
deleted file mode 100644
index 27c9a21f60..0000000000
--- a/camel/providers/MH/mh-summary.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef MH_SUMMARY_H
-#define MH_SUMMARY_H 1
-
-#include <glib.h>
-#include "camel-mh-folder.h"
-
-void mh_generate_summary (CamelFolder *folder);
-void mh_save_summary (CamelMhFolder *mh_folder);
-gint mh_load_summary (CamelMhFolder *mh_folder);
-
-#endif /* MH_SUMMARY_H */
diff --git a/camel/providers/MH/mh-uid.c b/camel/providers/MH/mh-uid.c
deleted file mode 100644
index 7dbde4de00..0000000000
--- a/camel/providers/MH/mh-uid.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-
-#include "mh-uid.h"
-#include "camel-log.h"
-#include "camel-stream.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-buffered-fs.h"
-#include "gmime-utils.h"
-#include "md5-utils.h"
-#include "mh-utils.h"
-
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-void
-mh_uid_get_for_file (gchar *filename, guchar uid[16])
-{
- CamelStream *message_stream;
- GArray *header_array;
- Rfc822Header *cur_header;
- int i;
- MD5Context ctx;
-
-
- message_stream = camel_stream_buffered_fs_new_with_name (filename,
- CAMEL_STREAM_BUFFERED_FS_READ);
- header_array = get_header_array_from_stream (message_stream);
- gtk_object_unref (GTK_OBJECT (message_stream));
-
- md5_init (&ctx);
- for (i=0; i<header_array->len; i++) {
- cur_header = (Rfc822Header *)header_array->data + i;
- if (!g_strcasecmp (cur_header->name, "subject")) {
- md5_update (&ctx, cur_header->value, strlen (cur_header->value));
- } else if (!g_strcasecmp (cur_header->name, "sender")) {
- md5_update (&ctx, cur_header->value, strlen (cur_header->value));
- } else if (!g_strcasecmp (cur_header->name, "date")) {
- md5_update (&ctx, cur_header->value, strlen (cur_header->value));
- }
-
- g_free (cur_header->name);
- g_free (cur_header->value);
-
- }
-
- g_array_free (header_array, TRUE);
-
- md5_final (uid, &ctx);
-}
-
-
-
-
-void
-mh_save_uid_list (CamelMhFolder *mh_folder)
-{
- GArray *uid_array;
- MhUidCouple *first_uid_couple;
- gchar *directory_path = mh_folder->directory_path;
- gchar *uidfile_path;
- int fd;
- int i;
-
-
- uidfile_path = g_strdup_printf ("%s/%s", directory_path, ".camel-uid-list");
- CAMEL_LOG_FULL_DEBUG ("In the process of writing %s\n", uidfile_path);
- fd = open (uidfile_path, O_WRONLY | O_CREAT );
-
- if (!fd) {
- CAMEL_LOG_FULL_DEBUG ("could not open file %s for writing. Exiting.\n", uidfile_path);
- g_free (uidfile_path);
- return;
- }
- g_free (uidfile_path);
-
- uid_array = mh_folder->uid_array;
- first_uid_couple = (MhUidCouple *)uid_array->data;
-
- /* write the number of uid contained in the file */
- write (fd, &(uid_array->len), sizeof (guint));
- CAMEL_LOG_FULL_DEBUG ("%d entrie present in the list\n", uid_array->len);
- /* now write the array of uid self */
- write (fd, first_uid_couple, sizeof (MhUidCouple) * uid_array->len);
-
- close (fd);
-}
-
-
-gint
-mh_load_uid_list (CamelMhFolder *mh_folder)
-{
- GArray *new_uid_array;
- MhUidCouple *first_uid_couple;
- gchar *directory_path = mh_folder->directory_path;
- gchar *uidfile_path;
- int fd;
- guint uid_nb;
- struct stat stat_buf;
- gint stat_error = 0;
-
- uidfile_path = g_strdup_printf ("%s/%s", directory_path, ".camel-uid-list");
-
- /* tests if file exists */
- stat_error = stat (uidfile_path, &stat_buf);
-
-
- if (!((stat_error != -1) && S_ISREG (stat_buf.st_mode))) {
- CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::load_uid_list "
- "file %s does not exist. Exiting.\n", uidfile_path);
- g_free (uidfile_path);
- return -1;
- }
-
- fd = open (uidfile_path, O_RDONLY);
- g_free (uidfile_path);
- if (!fd) return -1;
-
- if (mh_folder->uid_array) g_array_free (mh_folder->uid_array, FALSE);
-
- /* read the number of uids in the file */
- read (fd, &uid_nb, sizeof (guint));
- CAMEL_LOG_FULL_DEBUG ("reading %d uid_entries\n", uid_nb);
- new_uid_array = g_array_new (FALSE, FALSE, sizeof (MhUidCouple));
- new_uid_array = g_array_set_size (new_uid_array, uid_nb);
- first_uid_couple = (MhUidCouple *)new_uid_array->data;
-
-
- read (fd, first_uid_couple, sizeof (MhUidCouple) * uid_nb);
-
- mh_folder->uid_array = new_uid_array;
-
- return 1;
-}
-
-
-gint
-mh_generate_uid_list (CamelMhFolder *mh_folder)
-{
- GArray *new_uid_array;
- const gchar *directory_path;
- struct dirent *dir_entry;
- DIR *dir_handle;
- gchar *msg_path;
- guint msg_count;
- MhUidCouple *uid_couple;
- guint file_number;
-
- g_assert (mh_folder);
- CAMEL_LOG_FULL_DEBUG ("in the process of creating uid list \n");
- directory_path = mh_folder->directory_path;
- if (!directory_path) {
- CAMEL_LOG_FULL_DEBUG ("folder has no directory path. Exiting\n");
- return -1;
- }
-
- msg_count = camel_folder_get_message_count (CAMEL_FOLDER (mh_folder), NULL);
- if (!msg_count) {
- CAMEL_LOG_FULL_DEBUG ("no message in %s. Exiting\n", directory_path);
- return -1;
- }
-
- new_uid_array = g_array_new (FALSE, FALSE, sizeof (MhUidCouple));
- new_uid_array = g_array_set_size (new_uid_array, msg_count);
- uid_couple = (MhUidCouple *)new_uid_array->data;
-
- dir_handle = opendir (directory_path);
-
- /* read first entry in the directory */
- dir_entry = readdir (dir_handle);
- while (dir_entry != NULL) {
-
- /* tests if the entry correspond to a message file */
- if (mh_is_a_message_file (dir_entry->d_name, directory_path)) {
-
- /* get the uid for this message */
- msg_path = g_strdup_printf ("%s/%s", directory_path, dir_entry->d_name);
- mh_uid_get_for_file (msg_path, uid_couple->uid);
- g_free (msg_path);
-
- /* convert filename into file number */
- uid_couple->file_number = atoi (dir_entry->d_name);
- uid_couple++;
- }
-
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
- mh_folder->uid_array = new_uid_array;
-}
diff --git a/camel/providers/MH/mh-uid.h b/camel/providers/MH/mh-uid.h
deleted file mode 100644
index 63dfe5b159..0000000000
--- a/camel/providers/MH/mh-uid.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef MH_UID_H
-#define MH_UID_H 1
-
-#include <glib.h>
-#include "camel-mh-folder.h"
-
-
-typedef struct {
- gchar uid[16];
- guint file_number;
-} MhUidCouple;
-
-void mh_uid_get_for_file (gchar *filename, guchar uid[16]);
-void mh_save_uid_list (CamelMhFolder *mh_folder);
-gint mh_load_uid_list (CamelMhFolder *mh_folder);
-gint mh_generate_uid_list (CamelMhFolder *mh_folder);
-
-#endif /* MH_UID_H */
diff --git a/camel/providers/MH/mh-utils.c b/camel/providers/MH/mh-utils.c
deleted file mode 100644
index 51bb84bc65..0000000000
--- a/camel/providers/MH/mh-utils.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include "mh-utils.h"
-
-#include <sys/stat.h>
-
-gboolean
-mh_is_a_message_file (const gchar *file_name, const gchar *file_path)
-{
- struct stat stat_buf;
- gint stat_error = 0;
- gboolean ok;
- gchar *full_file_name;
- int i;
-
- /* test if the name is a number */
- i=0;
- while ((file_name[i] != '\0') && (file_name[i] >= '0') && (file_name[i] <= '9'))
- i++;
- if ((i==0) || (file_name[i] != '\0')) return FALSE;
-
- /* is it a regular file ? */
- full_file_name = g_strdup_printf ("%s/%s", file_path, file_name);
- stat_error = stat (full_file_name, &stat_buf);
- g_free (full_file_name);
-
- return ((stat_error != -1) && S_ISREG (stat_buf.st_mode));
-}
-
diff --git a/camel/providers/MH/mh-utils.h b/camel/providers/MH/mh-utils.h
deleted file mode 100644
index 968228b0a3..0000000000
--- a/camel/providers/MH/mh-utils.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef MH_UTILS_H
-#define MH_UTILS_H 1
-
-#include <glib.h>
-
-gboolean mh_is_a_message_file (const gchar *file_name, const gchar *file_path);
-
-#endif /* MH_UTILS_H */
diff --git a/camel/providers/Makefile.am b/camel/providers/Makefile.am
deleted file mode 100644
index 2ed9c0cecc..0000000000
--- a/camel/providers/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS = mbox
-# this ones are disabled for the moment.
-# MH maildir
diff --git a/camel/providers/maildir/.cvsignore b/camel/providers/maildir/.cvsignore
deleted file mode 100644
index 2e7b174532..0000000000
--- a/camel/providers/maildir/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile.in
-Makefile
-.deps
-*.lo
-*.la
-.libs
diff --git a/camel/providers/maildir/Makefile.am b/camel/providers/maildir/Makefile.am
deleted file mode 100644
index 51a0d7327b..0000000000
--- a/camel/providers/maildir/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelmaildirincludedir = $(includedir)/camel
-
-lib_LTLIBRARIES = libcamelmaildir.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(top_srcdir)/intl -I$(top_srcdir)/camel \
- $(GTK_INCLUDEDIR) -I$(includedir)
-
-libcamelmaildir_la_SOURCES = \
- camel-maildir-folder.c \
- camel-maildir-provider.c \
- camel-maildir-store.c
-
-libcamelmaildirinclude_HEADERS = \
- camel-maildir-folder.h \
- camel-maildir-store.h
-
-libcamelmaildir_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-EXTRA_DIST =
diff --git a/camel/providers/maildir/camel-maildir-folder.c b/camel/providers/maildir/camel-maildir-folder.c
deleted file mode 100644
index 4ad5409658..0000000000
--- a/camel/providers/maildir/camel-maildir-folder.c
+++ /dev/null
@@ -1,803 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-folder.c : camel-folder subclass for maildir folders */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * AUTHORS : Jukka Zitting
- *
- */
-
-
-#include <config.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <errno.h>
-#include <time.h>
-#include <string.h>
-#include "camel-maildir-folder.h"
-#include "camel-maildir-store.h"
-#include "camel-stream-fs.h"
-#include "camel-log.h"
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for a CamelMaildirFolder */
-#define CMAILDIRF_CLASS(so) CAMEL_MAILDIR_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMAILDIRS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-static void _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex);
-static void _set_name (CamelFolder *folder, const gchar *name, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _create (CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *_get_message (CamelFolder *folder, gint number, CamelException *ex);
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static void _expunge (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-
-/* fs utility functions */
-static DIR * _xopendir (const gchar *path);
-static gboolean _xstat (const gchar *path, struct stat *buf);
-static gboolean _xmkdir (const gchar *path);
-static gboolean _xrename (const gchar *from, const gchar *to);
-static gboolean _xunlink (const gchar *path);
-static gboolean _xrmdir (const gchar *path);
-/* ** */
-
-static void
-camel_maildir_folder_class_init (CamelMaildirFolderClass *camel_maildir_folder_class)
-{
- CamelFolderClass *camel_folder_class =
- CAMEL_FOLDER_CLASS (camel_maildir_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->exists = _exists;
- camel_folder_class->create = _create;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->get_message = _get_message;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->list_subfolders = _list_subfolders;
-}
-
-GtkType
-camel_maildir_folder_get_type (void)
-{
- static GtkType camel_maildir_folder_type = 0;
-
- if (!camel_maildir_folder_type) {
- GtkTypeInfo camel_maildir_folder_info =
- {
- "CamelMaildirFolder",
- sizeof (CamelMaildirFolder),
- sizeof (CamelMaildirFolderClass),
- (GtkClassInitFunc) camel_maildir_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_maildir_folder_type =
- gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_maildir_folder_info);
- }
-
- return camel_maildir_folder_type;
-}
-
-
-
-
-
-
-/**
- * CamelMaildirFolder::init_with_store: initializes the folder object
- * @folder: folder object to initialize
- * @parent_store: parent store object of the folder
- *
- * Simply tells that the folder can contain messages but not subfolders.
- * Perhaps we'll later implement subfolders too...
- */
-static void
-_init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::init_with_store\n");
- g_assert (folder);
- g_assert (parent_store);
-
- /* call parent method */
- parent_class->init_with_store (folder, parent_store, ex);
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = FALSE;
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::init_with_store\n");
-}
-
-/**
- * CamelMaildirFolder::set_name: sets the name of the folder
- * @folder: folder object
- * @name: name of the folder
- *
- * Sets the name of the folder object. The existence of a folder with
- * the given name is not checked in this function.
- */
-static void
-_set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder;
- CamelMaildirStore *maildir_store;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::set_name\n");
- g_assert (folder);
- g_assert (name);
- g_assert (folder->parent_store);
-
- maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- maildir_store = CAMEL_MAILDIR_STORE (folder->parent_store);
-
- /* call default implementation */
- parent_class->set_name (folder, name, ex);
-
- if (maildir_folder->directory_path)
- g_free (maildir_folder->directory_path);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name full_name is %s\n", folder->full_name);
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name toplevel_dir is %s\n", maildir_store->toplevel_dir);
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name separator is %c\n", camel_store_get_separator (folder->parent_store));
-
- if (folder->full_name && folder->full_name[0])
- maildir_folder->directory_path =
- g_strconcat (maildir_store->toplevel_dir, G_DIR_SEPARATOR_S,
- folder->full_name, NULL);
- else
- maildir_folder->directory_path = g_strdup (maildir_store->toplevel_dir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::set_name: name set to %s\n", name);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::set_name\n");
-}
-
-/**
- * CamelMaildirFolder::exists: tests whether the named maildir exists
- * @folder: folder object
- *
- * A created maildir folder object doesn't necessarily exist yet in the
- * filesystem. This function checks whether the maildir exists.
- * The structure of the maildir is stated in the maildir.5 manpage.
- *
- * maildir.5:
- * A directory in maildir format has three subdirectories,
- * all on the same filesystem: tmp, new, and cur.
- *
- * Return value: TRUE if the maildir exists, FALSE otherwise
- */
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- static const gchar *dir[3] = { "new", "cur", "tmp" };
- gint i;
- struct stat statbuf;
- const gchar *maildir;
- gchar *path;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::exists\n");
- g_assert (folder);
- g_return_val_if_fail (maildir_folder->directory_path, FALSE);
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMailFolder::exists: checking maildir %s\n",
- maildir);
-
- /* check whether the toplevel directory exists */
- rv = _xstat (maildir, &statbuf) && S_ISDIR (statbuf.st_mode);
-
- /* check whether the maildir subdirectories exist */
- for (i = 0; rv && i < 3; i++) {
- path = g_strconcat (maildir, G_DIR_SEPARATOR_S, dir[i], NULL);
-
- rv = _xstat (path, &statbuf) && S_ISDIR (statbuf.st_mode);
-
- g_free (path);
- }
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::exists: %s\n",
- (rv) ? "maildir found" : "maildir not found");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::exists\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::create: creates the named maildir
- * @folder: folder object
- *
- * A created maildir folder object doesn't necessarily exist yet in the
- * filesystem. This function creates the maildir if it doesn't yet exist.
- * The structure of the maildir is stated in the maildir.5 manpage.
- *
- * maildir.5:
- * A directory in maildir format has three subdirectories,
- * all on the same filesystem: tmp, new, and cur.
- *
- * Return value: TRUE if the maildir existed already or was created,
- * FALSE otherwise
- */
-static gboolean
-_create (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- static const gchar *dir[3] = { "new", "cur", "tmp" };
- gint i;
- const gchar *maildir;
- gchar *path;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::create\n");
- g_assert (folder);
-
- /* check whether the maildir already exists */
- if (camel_folder_exists (folder, ex)) return TRUE;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMailFolder::create: creating maildir %s\n",
- maildir);
-
- /* create the toplevel directory */
- rv = _xmkdir (maildir);
-
- /* create the maildir subdirectories */
- for (i = 0; rv && i < 3; i++) {
- path = g_strconcat (maildir, G_DIR_SEPARATOR_S, dir[i], NULL);
-
- rv = _xmkdir (path);
-
- g_free (path);
- }
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::create: %s\n",
- rv ? "maildir created" : "an error occurred");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::create\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::delete: delete the maildir folder
- * @folder: the folder object
- * @recurse:
- *
- * This function empties and deletes the maildir folder. The subdirectories
- * "tmp", "cur", and "new" are removed first and then the toplevel maildir
- * directory is deleted. All files from the directories are deleted as well,
- * so you should be careful when using this function. If a subdirectory cannot
- * be deleted, then the operation it is stopped. Thus if an error occurs, the
- * maildir directory won't be removed, but it might no longer be a valid maildir.
- */
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- static const gchar *dir[3] = { "new", "cur", "tmp" };
- gint i;
- const gchar *maildir;
- gchar *path;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::create\n");
- g_assert (folder);
-
- /* check whether the maildir already exists */
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMailFolder::delete: deleting maildir %s\n",
- maildir);
-
- /* delete the maildir subdirectories */
- for (i = 0; rv && i < 3; i++) {
- path = g_strconcat (maildir, G_DIR_SEPARATOR_S, dir[i], NULL);
-
- rv = _xrmdir (path);
-
- g_free (path);
- }
-
- /* create the toplevel directory */
- if (rv)
- rv = _xrmdir (maildir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::delete: %s\n",
- rv ? "maildir deleted" : "an error occurred");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::delete\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::delete_messages: empty the maildir folder
- * @folder: the folder object
- *
- * This function empties the maildir folder. All messages from the
- * "cur" subdirectory are deleted. If a message cannot be deleted, then
- * it is just skipped and the rest of the messages are still deleted.
- * Files with names starting with a dot are skipped as described in the
- * maildir.5 manpage.
- *
- * maildir.5:
- * It is a good idea for readers to skip all filenames in new
- * and cur starting with a dot. Other than this, readers
- * should not attempt to parse filenames.
- *
- * Return value: FALSE on error and if some messages could not be deleted.
- * TRUE otherwise.
- */
-static gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- const gchar *maildir;
- gchar *curdir, *file;
- DIR *dir_handle;
- struct dirent *dir_entry;
- gboolean rv = TRUE;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::delete_messages\n");
- g_assert (folder);
-
- /* call default implementation */
- parent_class->delete_messages (folder, ex);
-
- /* Check if the folder didn't exist */
- if (!camel_folder_exists (folder, ex)) return TRUE;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::delete_messages: "
- "deleting messages from %s\n", maildir);
-
- /* delete messages from the maildir subdirectory "cur" */
- curdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "cur", NULL);
-
- dir_handle = _xopendir (curdir);
- if (dir_handle) {
- while ((dir_entry = readdir (dir_handle))) {
- if (dir_entry->d_name[0] == '.') continue;
- file = g_strconcat (curdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
-
- if (!_xunlink (file)) rv = FALSE;
-
- g_free (file);
- }
- closedir (dir_handle);
- } else
- rv = FALSE;
-
- g_free (curdir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::delete_messages: %s\n",
- rv ? "messages deleted" : "an error occurred");
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::delete_messages\n");
- return rv;
-}
-
-/**
- * CamelMaildirFolder::get_message: get a message from maildir
- * @folder: the folder object
- * @number: number of the message within the folder
- *
- * Return value: the message, NULL on error
- */
-static CamelMimeMessage *
-_get_message (CamelFolder *folder, gint number, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER(folder);
- DIR *dir_handle;
- struct dirent *dir_entry;
- CamelStream *stream;
- CamelMimeMessage *message = NULL;
- const gchar *maildir;
- gchar *curdir, *file = NULL;
- gint count = -1;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::get_message\n");
- g_assert(folder);
-
- /* Check if the folder exists */
- if (!camel_folder_exists (folder, ex)) return NULL;
-
- maildir = maildir_folder->directory_path;
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message: "
- "getting message #%d from %s\n", number, maildir);
-
- /* Count until the desired message is reached */
- curdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "cur", NULL);
- if ((dir_handle = _xopendir (curdir))) {
- while ((count < number) && (dir_entry = readdir (dir_handle)))
- if (dir_entry->d_name[0] != '.') count++;
-
- if (count == number)
- file = g_strconcat (curdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
-
- closedir (dir_handle);
- }
- g_free (curdir);
- if (!file) return NULL;
-
- /* Create the message object */
-#warning use session field here
- message = camel_mime_message_new_with_session ((CamelSession *) NULL);
- stream = camel_stream_fs_new_with_name (file, CAMEL_STREAM_FS_READ);
-
- if (!message || !stream) {
- g_free (file);
- if (stream) gtk_object_unref (GTK_OBJECT (stream));
- if (message) gtk_object_unref (GTK_OBJECT (message));
- return NULL;
- }
-
- camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (message),
- stream);
- gtk_object_unref (GTK_OBJECT (stream));
- gtk_object_set_data_full (GTK_OBJECT (message),
- "fullpath", file, g_free);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message: "
- "message %p created from %s\n", message, file);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::get_message\n");
- return message;
-}
-
-/**
- * CamelMaildirFolder::get_message_count: count messages in maildir
- * @folder: the folder object
- *
- * Returns the number of messages in the maildir folder. New messages
- * are included in this count.
- *
- * Return value: number of messages in the maildir, -1 on error
- */
-static gint
-_get_message_count (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER(folder);
- const gchar *maildir;
- gchar *newdir, *curdir, *newfile, *curfile;
- DIR *dir_handle;
- struct dirent *dir_entry;
- guint count = 0;
-
- CAMEL_LOG_FULL_DEBUG ("Entering "
- "CamelMaildirFolder::get_message_count\n");
- g_assert(folder);
-
- /* check if the maildir exists */
- if (!camel_folder_exists (folder, ex)) return -1;
-
- maildir = maildir_folder->directory_path;
-
- newdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "new", NULL);
- curdir = g_strconcat (maildir, G_DIR_SEPARATOR_S, "cur", NULL);
-
- /* Check new messages */
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message_count: "
- "getting new messages from %s\n", newdir);
- if ((dir_handle = _xopendir (newdir))) {
- while ((dir_entry = readdir (dir_handle))) {
- if (dir_entry->d_name[0] == '.') continue;
- newfile = g_strconcat (newdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
- curfile = g_strconcat (curdir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, ":2,", NULL);
-
- _xrename (newfile, curfile);
-
- g_free (curfile);
- g_free (newfile);
- }
- closedir (dir_handle);
- }
-
- /* Count messages */
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message_count: "
- "counting messages in %s\n", curdir);
- if ((dir_handle = _xopendir (curdir))) {
- while ((dir_entry = readdir (dir_handle)))
- if (dir_entry->d_name[0] != '.') count++;
- closedir (dir_handle);
- }
-
- g_free (curdir);
- g_free (newdir);
-
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::get_message_count: "
- " found %d messages\n", count);
- CAMEL_LOG_FULL_DEBUG ("Leaving "
- "CamelMaildirFolder::get_message_count\n");
- return count;
-}
-
-
-
-
-/**
- * CamelMaildirFolder::expunge: expunge messages marked as deleted
- * @folder: the folder object
- *
- * Physically deletes the messages marked as deleted in the folder.
- */
-static void
-_expunge (CamelFolder *folder, CamelException *ex)
-{
- CamelMimeMessage *message;
- GList *node;
- gchar *fullpath;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::expunge\n");
- g_assert(folder);
-
- /* expunge messages marked for deletion */
- for (node = folder->message_list; node; node = g_list_next(node)) {
- message = CAMEL_MIME_MESSAGE (node->data);
- if (!message) {
- CAMEL_LOG_WARNING ("CamelMaildirFolder::expunge: "
- "null message in node %p\n", node);
- continue;
- }
-
- if (camel_mime_message_get_flag (message, "DELETED")) {
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::expunge: "
- "expunging message #%d\n",
- message->message_number);
-
- /* expunge the message */
- fullpath = gtk_object_get_data (GTK_OBJECT (message),
- "fullpath");
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::expunge: "
- "message fullpath is %s\n",
- fullpath);
-
- if (_xunlink (fullpath))
- message->expunged = TRUE;
- } else {
- CAMEL_LOG_FULL_DEBUG ("CamelMaildirFolder::expunge: "
- "skipping message #%d\n",
- message->message_number);
- }
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::expunge\n");
-}
-
-
-
-
-/**
- * CamelMaildirFolder::list_subfolders: return a list of subfolders
- * @folder: the folder object
- *
- * Returns the names of the maildir subfolders in a list.
- *
- * Return value: list of subfolder names
- */
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- CamelMaildirFolder *maildir_folder = CAMEL_MAILDIR_FOLDER (folder);
- const gchar *maildir;
- gchar *subdir;
- struct stat statbuf;
- struct dirent *dir_entry;
- DIR *dir_handle;
- GList *subfolders = NULL;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMaildirFolder::list_subfolders\n");
- g_assert (folder);
-
- /* check if the maildir exists */
- if (!camel_folder_exists (folder, ex)) return NULL;
-
- /* scan through the maildir toplevel directory */
- maildir = maildir_folder->directory_path;
- if ((dir_handle = _xopendir (maildir))) {
- while ((dir_entry = readdir (dir_handle))) {
- if (dir_entry->d_name[0] == '.') continue;
- if (strcmp (dir_entry->d_name, "new") == 0) continue;
- if (strcmp (dir_entry->d_name, "cur") == 0) continue;
- if (strcmp (dir_entry->d_name, "tmp") == 0) continue;
-
- subdir = g_strconcat (maildir, G_DIR_SEPARATOR_S,
- dir_entry->d_name, NULL);
-
- if (_xstat (subdir, &statbuf)
- && S_ISDIR (statbuf.st_mode))
- subfolders =
- g_list_append (
- subfolders,
- g_strdup (dir_entry->d_name));
-
- g_free (subdir);
- }
- closedir (dir_handle);
- }
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMaildirFolder::list_subfolders\n");
- return subfolders;
-}
-
-
-
-
-
-
-
-/*
- * fs utility function
- *
- */
-
-static DIR *
-_xopendir (const gchar *path)
-{
- DIR *handle;
- g_assert (path);
-
- handle = opendir (path);
- if (!handle) {
- CAMEL_LOG_WARNING ("ERROR: opendir (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- }
-
- return handle;
-}
-
-static gboolean
-_xstat (const gchar *path, struct stat *buf)
-{
- gint stat_error;
- g_assert (path);
- g_assert (buf);
-
- stat_error = stat (path, buf);
- if (stat_error == 0) {
- return TRUE;
- } else if (errno == ENOENT) {
- buf->st_mode = 0;
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: stat (%s, %p);\n", path, buf);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-static gboolean
-_xmkdir (const gchar *path)
-{
- g_assert (path);
-
- if (mkdir (path, S_IRWXU) == -1) {
- CAMEL_LOG_WARNING ("ERROR: mkdir (%s, S_IRWXU);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-_xrename (const gchar *from, const gchar *to)
-{
- g_assert (from);
- g_assert (to);
-
- if (rename (from, to) == 0) {
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: rename (%s, %s);\n", from, to);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-static gboolean
-_xunlink (const gchar *path)
-{
- g_assert (path);
-
- if (unlink (path) == 0) {
- return TRUE;
- } else if (errno == ENOENT) {
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: unlink (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-static gboolean
-_xrmdir (const gchar *path)
-{
- DIR *dir_handle;
- struct dirent *dir_entry;
- gchar *file;
- struct stat statbuf;
- g_assert (path);
-
- dir_handle = opendir (path);
- if (!dir_handle && errno == ENOENT) {
- return TRUE;
- } else if (!dir_handle) {
- CAMEL_LOG_WARNING ("ERROR: opendir (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-
- while ((dir_entry = readdir (dir_handle))) {
- file = g_strconcat (path, G_DIR_SEPARATOR_S, dir_entry->d_name,
- NULL);
- if (_xstat (file, &statbuf) && S_ISREG (statbuf.st_mode))
- _xunlink (file);
- g_free (file);
- }
-
- closedir (dir_handle);
-
- if (rmdir (path) == 0) {
- return TRUE;
- } else if (errno == ENOENT) {
- return TRUE;
- } else {
- CAMEL_LOG_WARNING ("ERROR: rmdir (%s);\n", path);
- CAMEL_LOG_FULL_DEBUG (" Full error text is: (%d) %s\n",
- errno, strerror(errno));
- return FALSE;
- }
-}
-
-/** *** **/
-
diff --git a/camel/providers/maildir/camel-maildir-folder.h b/camel/providers/maildir/camel-maildir-folder.h
deleted file mode 100644
index 5997da2011..0000000000
--- a/camel/providers/maildir/camel-maildir-folder.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-folder.h : Abstract class for an email folder */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#ifndef CAMEL_MAILDIR_FOLDER_H
-#define CAMEL_MAILDIR_FOLDER_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-folder.h"
-/* #include "camel-store.h" */
-
-#define CAMEL_MAILDIR_FOLDER_TYPE (camel_maildir_folder_get_type ())
-#define CAMEL_MAILDIR_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_MAILDIR_FOLDER_TYPE, CamelMaildirFolder))
-#define CAMEL_MAILDIR_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MAILDIR_FOLDER_TYPE, CamelMaildirFolderClass))
-#define IS_CAMEL_MAILDIR_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_MAILDIR_FOLDER_TYPE))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- gchar *directory_path;
-} CamelMaildirFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMaildirFolderClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_maildir_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MAILDIR_FOLDER_H */
diff --git a/camel/providers/maildir/camel-maildir-provider.c b/camel/providers/maildir/camel-maildir-provider.c
deleted file mode 100644
index cd5521adc0..0000000000
--- a/camel/providers/maildir/camel-maildir-provider.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-provider.c: maildir provider registration code */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "config.h"
-#include "camel-maildir-store.h"
-#include "camel-provider.h"
-#include "camel-log.h"
-
-
-static CamelProvider _maildir_provider = {
- (GtkType) 0,
- PROVIDER_STORE,
- "maildir",
- "Maildir provider for Camel",
- "This maildir provider is based on the default MH provider of Camel",
- (GModule *) NULL
-};
-
-
-
-CamelProvider *
-camel_provider_module_init ()
-{
- _maildir_provider.object_type = camel_maildir_store_get_type();
- return &_maildir_provider;
-}
diff --git a/camel/providers/maildir/camel-maildir-store.c b/camel/providers/maildir/camel-maildir-store.c
deleted file mode 100644
index 8f37494003..0000000000
--- a/camel/providers/maildir/camel-maildir-store.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildir-store.c : class for an maildir store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-maildir-store.h"
-#include "camel-maildir-folder.h"
-#include "url-util.h"
-
-static CamelStoreClass *parent_class=NULL;
-
-/* Returns the class for a CamelMaildirStore */
-#define CMAILDIRS_CLASS(so) CAMEL_MAILDIR_STORE_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMAILDIRF_CLASS(so) CAMEL_MAILDIR_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-static void _init (CamelStore *store, CamelSession *session,
- const gchar *url_name);
-static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name);
-
-static void
-camel_maildir_store_class_init (
- CamelMaildirStoreClass *camel_maildir_store_class)
-{
- CamelStoreClass *camel_store_class =
- CAMEL_STORE_CLASS (camel_maildir_store_class);
-
- parent_class = gtk_type_class (camel_store_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_store_class->init = _init;
- camel_store_class->get_folder = _get_folder;
-}
-
-static void
-camel_maildir_store_init (gpointer object, gpointer klass)
-{
- CamelMaildirStore *maildir_store = CAMEL_MAILDIR_STORE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- store->separator = G_DIR_SEPARATOR;
-}
-
-GtkType
-camel_maildir_store_get_type (void)
-{
- static GtkType camel_maildir_store_type = 0;
-
- if (!camel_maildir_store_type) {
- GtkTypeInfo camel_maildir_store_info =
- {
- "CamelMaildirStore",
- sizeof (CamelMaildirStore),
- sizeof (CamelMaildirStoreClass),
- (GtkClassInitFunc) camel_maildir_store_class_init,
- (GtkObjectInitFunc) camel_maildir_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_maildir_store_type =
- gtk_type_unique (CAMEL_STORE_TYPE,
- &camel_maildir_store_info);
- }
-
- return camel_maildir_store_type;
-}
-
-static void
-_init (CamelStore *store, CamelSession *session, const gchar *url_name)
-{
- CamelMaildirStore *maildir_store = CAMEL_MAILDIR_STORE (store);
- Gurl *store_url;
- g_assert (url_name);
-
- /* call parent implementation */
- parent_class->init (store, session, url_name);
-
- /* find the path in the URL*/
- store_url = g_url_new (url_name);
-
- g_return_if_fail (store_url);
- g_return_if_fail (store_url->path);
-
- maildir_store->toplevel_dir = g_strdup (store_url->path);
-
- g_url_free (store_url);
-}
-
-static CamelFolder *
-_get_folder (CamelStore *store, const gchar *folder_name)
-{
- CamelMaildirStore *maildir_store = CAMEL_MAILDIR_STORE (store);
- CamelMaildirFolder *new_maildir_folder;
- CamelFolder *new_folder;
-
- new_maildir_folder = gtk_type_new (CAMEL_MAILDIR_FOLDER_TYPE);
- new_folder = CAMEL_FOLDER (new_maildir_folder);
-
- CF_CLASS (new_folder)->init_with_store (new_folder, store, NULL);
- CF_CLASS (new_folder)->set_name (new_folder, folder_name, NULL);
-
- return new_folder;
-}
diff --git a/camel/providers/maildir/camel-maildir-store.h b/camel/providers/maildir/camel-maildir-store.h
deleted file mode 100644
index 1a95ed1436..0000000000
--- a/camel/providers/maildir/camel-maildir-store.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-maildirstore.h : class for an maildir store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MAILDIR_STORE_H
-#define CAMEL_MAILDIR_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-store.h"
-
-#define CAMEL_MAILDIR_STORE_TYPE (camel_maildir_store_get_type ())
-#define CAMEL_MAILDIR_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MAILDIR_STORE_TYPE, CamelMaildirStore))
-#define CAMEL_MAILDIR_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MAILDIR_STORE_TYPE, CamelMaildirStoreClass))
-#define IS_CAMEL_MAILDIR_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MAILDIR_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
- gchar *toplevel_dir;
-} CamelMaildirStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-
-} CamelMaildirStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_maildir_store_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MAILDIR_STORE_H */
-
-
diff --git a/camel/providers/mbox/.cvsignore b/camel/providers/mbox/.cvsignore
deleted file mode 100644
index fd6b811c68..0000000000
--- a/camel/providers/mbox/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-.deps
-*.lo
-*.la
diff --git a/camel/providers/mbox/Makefile.am b/camel/providers/mbox/Makefile.am
deleted file mode 100644
index b614a63036..0000000000
--- a/camel/providers/mbox/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS =
-
-libcamelmboxincludedir = $(includedir)/camel
-
-
-lib_LTLIBRARIES = libcamelmbox.la
-
-INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \
- -I$(top_srcdir)/intl \
- $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel
-
-libcamelmbox_la_SOURCES = \
- camel-mbox-folder.c \
- camel-mbox-store.c
-
-libcamelmboxinclude_HEADERS = \
- camel-mbox-folder.h \
- camel-mbox-store.h
-
-
-libcamelmbox_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-
-
-EXTRA_DIST =
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
deleted file mode 100644
index 966218fcc6..0000000000
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ /dev/null
@@ -1,811 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-folder.c : Abstract class for an email folder */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <bertrand@helixcode.com> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-
-#include <sys/types.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-
-#include "camel-mbox-folder.h"
-#include "camel-mbox-store.h"
-#include "string-utils.h"
-#include "camel-log.h"
-#include "camel-stream-buffered-fs.h"
-#include "camel-folder-summary.h"
-#include "gmime-utils.h"
-
-#include "camel-exception.h"
-
-#if 0
-#include "mbox-utils.h"
-#include "mbox-uid.h"
-#include "mbox-summary.h"
-#endif
-
-static CamelFolderClass *parent_class=NULL;
-
-/* Returns the class for a CamelMboxFolder */
-#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMBOXS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-
-
-static void _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex);
-static void _set_name(CamelFolder *folder, const gchar *name, CamelException *ex);
-
-
-static void _open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex);
-static void _close (CamelFolder *folder, gboolean expunge, CamelException *ex);
-static gboolean _exists (CamelFolder *folder, CamelException *ex);
-static gboolean _create(CamelFolder *folder, CamelException *ex);
-static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
-static gboolean _delete_messages (CamelFolder *folder, CamelException *ex);
-static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
-#if 0
-static CamelMimeMessage *_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex);
-static gint _get_message_count (CamelFolder *folder, CamelException *ex);
-static gint _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static void _expunge (CamelFolder *folder, CamelException *ex);
-static void _copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex);
-static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-static GList *_get_uid_list (CamelFolder *folder, CamelException *ex);
-#endif
-
-static void _finalize (GtkObject *object);
-
-static void
-camel_mbox_folder_class_init (CamelMboxFolderClass *camel_mbox_folder_class)
-{
- CamelFolderClass *camel_folder_class = CAMEL_FOLDER_CLASS (camel_mbox_folder_class);
- GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_folder_class);
-
- parent_class = gtk_type_class (camel_folder_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_folder_class->init_with_store = _init_with_store;
- camel_folder_class->set_name = _set_name;
- camel_folder_class->open = _open;
- camel_folder_class->close = _close;
- camel_folder_class->exists = _exists;
- camel_folder_class->create = _create;
- camel_folder_class->delete = _delete;
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->list_subfolders = _list_subfolders;
-#if 0
- camel_folder_class->get_message_by_number = _get_message_by_number;
- camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->append_message = _append_message;
- camel_folder_class->expunge = _expunge;
- camel_folder_class->copy_message_to = _copy_message_to;
- camel_folder_class->get_message_uid = _get_message_uid;
- camel_folder_class->get_message_by_uid = _get_message_by_uid;
- camel_folder_class->get_uid_list = _get_uid_list;
-#endif
- gtk_object_class->finalize = _finalize;
-
-}
-
-
-
-static void
-_finalize (GtkObject *object)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (object);
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelFolder::finalize\n");
-
-
- g_free (mbox_folder->folder_file_path);
- g_free (mbox_folder->folder_dir_path);
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::finalize\n");
-}
-
-
-
-
-
-GtkType
-camel_mbox_folder_get_type (void)
-{
- static GtkType camel_mbox_folder_type = 0;
-
- if (!camel_mbox_folder_type) {
- GtkTypeInfo camel_mbox_folder_info =
- {
- "CamelMboxFolder",
- sizeof (CamelMboxFolder),
- sizeof (CamelMboxFolderClass),
- (GtkClassInitFunc) camel_mbox_folder_class_init,
- (GtkObjectInitFunc) NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mbox_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_mbox_folder_info);
- }
-
- return camel_mbox_folder_type;
-}
-
-
-
-
-
-
-static void
-_init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException *ex)
-{
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMhFolder::init_with_store\n");
-
- /* call parent method */
- parent_class->init_with_store (folder, parent_store, ex);
- if (camel_exception_get_id (ex)) return;
-
- /* we assume that the parent init_with_store
- method checks for the existance of @folder */
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = TRUE;
- folder->has_uid_capability = TRUE;
-
- folder->summary = NULL;
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::init_with_store\n");
-}
-
-
-
-
-
-
-static void
-_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- struct dirent *dir_entry;
- DIR *dir_handle;
-
-
- if (folder->open_state == FOLDER_OPEN) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_STATE,
- "folder is already open");
- return;
- }
-
-
-#if 0
- Here, we need to check for the summary file
- existence and create it if necessary.
- /* get (or create) uid list */
- if (!(mbox_load_uid_list (mbox_folder) > 0))
- mbox_generate_uid_list (mbox_folder);
-
- /* get or create summary */
- /* it is important that it comes after uid list reading/generation */
- if (!(mbox_load_summary (mbox_folder) > 0))
- mbox_generate_summary (folder);
-
-#endif
-}
-
-
-
-
-
-
-static void
-_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
-
-
- /* call parent implementation */
- parent_class->close (folder, expunge, ex);
-}
-
-
-
-
-static void
-_set_name (CamelFolder *folder, const gchar *name, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- const gchar *root_dir_path;
- gchar *full_name;
- const gchar *parent_full_name;
- gchar separator;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::set_name\n");
-
- /* call default implementation */
- parent_class->set_name (folder, name, ex);
- if (camel_exception_get_id (ex)) return;
-
- g_free (mbox_folder->folder_file_path);
- g_free (mbox_folder->folder_dir_path);
-
- separator = camel_store_get_separator (folder->parent_store);
- root_dir_path = camel_mbox_store_get_toplevel_dir (CAMEL_MBOX_STORE(folder->parent_store));
-
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name full_name is %s\n", folder->full_name);
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name root_dir_path is %s\n", root_dir_path);
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::separator is %c\n", separator);
-
- mbox_folder->folder_file_path = g_strdup_printf ("%s%c%s", root_dir_path, separator, folder->full_name);
- mbox_folder->folder_dir_path = g_strdup_printf ("%s%c%s.sdb", root_dir_path, separator, folder->full_name);
-
-
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name mbox_folder->folder_file_path is %s\n",
- mbox_folder->folder_file_path);
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name mbox_folder->folder_dir_path is %s\n",
- mbox_folder->folder_dir_path);
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::set_name\n");
-}
-
-
-
-
-
-
-static gboolean
-_exists (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- struct stat stat_buf;
- gint stat_error;
- gboolean exists;
-
- CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::exists\n");
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- /* check if the mbox file path is determined */
- if (!mbox_folder->folder_file_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "undetermined folder file path. Maybe use set_name ?");
- return FALSE;
- }
-
- /* check if the mbox dir path is determined */
- if (!mbox_folder->folder_dir_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "undetermined folder directory path. Maybe use set_name ?");
- return FALSE;
- }
-
- /* check if the mbox directory exists */
- stat_error = stat (mbox_folder->folder_dir_path, &stat_buf);
- if (stat_error == -1) {
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::exists when executing stat on %s, stat_error = %d\n",
- mbox_folder->folder_dir_path, stat_error);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- strerror(errno));
- return FALSE;
- }
- exists = S_ISDIR (stat_buf.st_mode);
- if (!exists) return FALSE;
-
- /* check if the mbox file exists */
- stat_error = stat (mbox_folder->folder_file_path, &stat_buf);
- if (stat_error == -1) {
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::exists when executing stat on %s, stat_error = %d\n",
- mbox_folder->folder_file_path, stat_error);
- CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno));
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- strerror(errno));
- return FALSE;
- }
-
- exists = S_REG (stat_buf.st_mode);
- /* we should check the rights here */
-
- CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::exists\n");
- return exists;
-}
-
-
-
-
-
-
-
-
-static gboolean
-_create (CamelFolder *folder, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- const gchar *folder_file_path, *folder_dir_path;
- mode_t dir_mode = S_IRWXU;
- gint mkdir_error;
- gboolean folder_already_exists;
- int creat_fd;
- mode_t old_umask;
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
-
- /* call default implementation */
- parent_class->create (folder, ex);
-
- /* get the paths of what we need to create */
- folder_file_path = mbox_folder->folder_file_path;
- folder_dir_path = mbox_folder->folder_file_path;
-
- if (!(folder_file_path || folder_dir_path)) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* if the folder already exists, simply return */
- folder_already_exists = camel_folder_exists (folder,ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (folder_already_exists) return TRUE;
-
-
- /* create the directory for the subfolders */
- mkdir_error = mkdir (folder_dir_path, dir_mode);
- if (mkdir_error == -1) goto io_error;
-
-
- /* create the mbox file */
- /* it must be rw for the user and none for the others */
- old_umask = umask (0700);
- creat_fd = open (folder_file_path,
- O_WRONLY | O_CREAT | O_APPEND,
- S_IRUSR | S_IWUSR);
- umask (old_umask);
- if (creat_fd == -1) goto io_error;
- close (creat_fd);
-
- return TRUE;
-
- /* exception handling for io errors */
- io_error :
-
- CAMEL_LOG_WARNING ("CamelMboxFolder::create, error when creating %s and %s\n",
- folder_dir_path, folder_file_path);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
-
- if (errno == EACCES) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "You don't have the permission to create the mbox file.");
- return FALSE;
- } else {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to create the mbox file.");
- return FALSE;
- }
-}
-
-
-
-
-
-
-
-
-static gboolean
-_delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
-{
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- const gchar *folder_file_path, *folder_dir_path;
- gint rmdir_error = 0;
- gint unlink_error = 0;
- gboolean folder_already_exists;
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
-
- /* in the case where the folder does not exist,
- return immediatly */
- folder_already_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (!folder_already_exists) return TRUE;
-
-
- /* call default implementation.
- It should delete the messages in the folder
- and recurse the operation to subfolders */
- parent_class->delete (folder, recurse, ex);
-
-
- /* get the paths of what we need to delete */
- folder_file_path = mbox_folder->folder_file_path;
- folder_dir_path = mbox_folder->folder_file_path;
-
- if (!(folder_file_path || folder_dir_path)) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* physically delete the directory */
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::delete removing directory %s\n", folder_dir_path);
- rmdir_error = rmdir (folder_dir_path);
- if (rmdir_error == -1)
- switch errno {
- case EACCES :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Not enough permission to delete the mbox folder");
- return FALSE;
- break;
-
- case ENOTEMPTY :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
- "mbox folder not empty. Cannot delete it. Maybe use recurse flag ?");
- return FALSE;
- break;
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
- return FALSE;
- }
-
- /* physically delete the file */
- unlink_error = unlink (folder_dir_path);
- if (unlink_error == -1)
- switch errno {
- case EACCES :
- case EPERM :
- case EROFS :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Not enough permission to delete the mbox file");
- return FALSE;
- break;
-
- case EFAULT :
- case ENOENT :
- case ENOTDIR :
- case EISDIR :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
- "Invalid mbox file");
- return FALSE;
- break;
-
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
- return FALSE;
- }
-
-
- return TRUE;
-}
-
-
-
-
-gboolean
-_delete_messages (CamelFolder *folder, CamelException *ex)
-{
-
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- const gchar *folder_file_path;
- gboolean folder_already_exists;
- int creat_fd;
- mode_t old_umask;
-
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
- /* in the case where the folder does not exist,
- return immediatly */
- folder_already_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (!folder_already_exists) return TRUE;
-
-
-
- /* get the paths of the mbox file we need to delete */
- folder_file_path = mbox_folder->folder_file_path;
-
- if (!folder_file_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- /* create the mbox file */
- /* it must be rw for the user and none for the others */
- old_umask = umask (0700);
- creat_fd = open (folder_file_path,
- O_WRONLY | O_TRUNC,
- S_IRUSR | S_IWUSR);
- umask (old_umask);
- if (creat_fd == -1) goto io_error;
- close (creat_fd);
-
- return TRUE;
-
- /* exception handling for io errors */
- io_error :
-
- CAMEL_LOG_WARNING ("CamelMboxFolder::create, error when deleting files %s\n",
- folder_file_path);
- CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno));
-
- if (errno == EACCES) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "You don't have the permission to write in the mbox file.");
- return FALSE;
- } else {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to write in the mbox file.");
- return FALSE;
- }
-
-
-}
-
-
-
-
-
-
-
-
-
-static GList *
-_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- GList *subfolder_name_list = NULL;
-
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder);
- const gchar *folder_dir_path;
- gboolean folder_exists;
-
- struct stat stat_buf;
- gint stat_error = 0;
- GList *file_list;
- gchar *entry_name;
- gchar *full_entry_name;
- gchar *real_folder_name;
- struct dirent *dir_entry;
- DIR *dir_handle;
- gboolean folder_suffix_found;
-
- gchar *io_error_text;
-
-
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
-
- /* in the case the folder does not exist,
- raise an exception */
- folder_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (!folder_exists) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "Inexistant folder.");
- return FALSE;
- }
-
-
- /* get the mbox subfolders directories */
- folder_dir_path = mbox_folder->folder_file_path;
- if (!folder_dir_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "Invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- dir_handle = opendir (folder_dir_path);
-
- /* read the first entry in the directory */
- dir_entry = readdir (dir_handle);
- while ((stat_error != -1) && (dir_entry != NULL)) {
-
- /* get the name of the next entry in the dir */
- entry_name = dir_entry->d_name;
- full_entry_name = g_strdup_printf ("%s/%s", folder_dir_path, entry_name);
- stat_error = stat (full_entry_name, &stat_buf);
- g_free (full_entry_name);
-
- /* is it a directory ? */
- if ((stat_error != -1) && S_ISDIR (stat_buf.st_mode)) {
- /* yes, add it to the list */
- if (entry_name[0] != '.') {
- CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::list_subfolders adding "
- "%s\n", entry_name);
-
- /* if the folder is a netscape folder, remove the
- ".sdb" from the name */
- real_folder_name = string_prefix (entry_name, ".sdb", &folder_suffix_found);
- /* stick here the tests for other folder suffixes if any */
-
- if (!folder_suffix_found) real_folder_name = g_strdup (entry_name);
-
- /* add the folder name to the list */
- subfolder_name_list = g_list_append (subfolder_name_list,
- real_folder_name);
- }
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- return subfolder_name_list;
-
-
-
- /* io exception handling */
- io_error :
-
- switch errno {
- case EACCES :
-
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Unable to list the directory. Full Error text is : %s ",
- strerror (errno));
- break;
-
- case ENOENT :
- case ENOTDIR :
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
- "Invalid mbox folder path. Full Error text is : %s ",
- strerror (errno));
- break;
-
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
-
- }
-
- g_list_free (subfolder_name_list);
- return NULL;
-}
-
-
-
-
-
-
-
-
-
-
-
-static CamelMimeMessage *
-_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
-{
- CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
- const gchar *directory_path;
- gchar *message_name;
- gchar *message_file_name;
- CamelStream *input_stream = NULL;
- CamelMimeMessage *message = NULL;
- GList *message_list = NULL;
-
- g_assert(folder);
-
-
- directory_path = mh_folder->directory_path;
- if (!directory_path) return NULL;
-
-
-
- message_name = g_list_nth_data (mh_folder->file_name_list, number);
-
- if (message_name != NULL) {
- CAMEL_LOG_FULL_DEBUG ("CanelMhFolder::get_message message number = %d, name = %s\n",
- number, message_name);
- message_file_name = g_strdup_printf ("%s/%s", directory_path, message_name);
- input_stream = camel_stream_buffered_fs_new_with_name (message_file_name, CAMEL_STREAM_BUFFERED_FS_READ);
-
- if (input_stream != NULL) {
-#warning use session field here
- message = camel_mime_message_new_with_session ( (CamelSession *)NULL);
- camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream);
- gtk_object_unref (GTK_OBJECT (input_stream));
- message->message_number = number;
- gtk_object_set_data_full (GTK_OBJECT (message), "filename",
- g_strdup (message_name), _filename_free);
-
-#warning Set flags and all this stuff here
- }
- g_free (message_file_name);
- } else
- CAMEL_LOG_FULL_DEBUG ("CanelMhFolder::get_message message number = %d, not found\n", number);
-
-
- return message;
-}
diff --git a/camel/providers/mbox/camel-mbox-folder.h b/camel/providers/mbox/camel-mbox-folder.h
deleted file mode 100644
index 6a0d8d66db..0000000000
--- a/camel/providers/mbox/camel-mbox-folder.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-folder.h : Abstract class for an email folder */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <bertrand@helixcode.com> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MBOX_FOLDER_H
-#define CAMEL_MBOX_FOLDER_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-folder.h"
-/* #include "camel-store.h" */
-
-#define CAMEL_MBOX_FOLDER_TYPE (camel_mbox_folder_get_type ())
-#define CAMEL_MBOX_FOLDER(obj) (GTK_CHECK_CAST((obj), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolder))
-#define CAMEL_MBOX_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MBOX_FOLDER_TYPE, CamelMboxFolderClass))
-#define IS_CAMEL_MBOX_FOLDER(o) (GTK_CHECK_TYPE((o), CAMEL_MBOX_FOLDER_TYPE))
-
-
-typedef struct {
- CamelFolder parent_object;
-
- gchar *folder_file_path; /* contains the messages */
- gchar *folder_dir_path; /* contains the subfolders */
- GArray *uid_array;
-
-} CamelMboxFolder;
-
-
-
-typedef struct {
- CamelFolderClass parent_class;
-
- /* Virtual methods */
-
-} CamelMboxFolderClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mbox_folder_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MBOX_FOLDER_H */
diff --git a/camel/providers/mbox/camel-mbox-parser.c b/camel/providers/mbox/camel-mbox-parser.c
deleted file mode 100644
index a13032a391..0000000000
--- a/camel/providers/mbox/camel-mbox-parser.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-parser.c : mbox folder parser */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <bertrand@helixcode.com> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#include <config.h>
-#include "camel-mbox-parser.h"
-#include "camel-log.h"
-#include "camel-exception.h"
-
-#include <sys/types.h>
-#include <unistd.h>
-
-
-
-
-GList *
-camel_mbox_find_message_positions (int fd, gint first_position, CamelException *ex)
-{
-#define MBOX_PARSER_BUF_SIZE 1000
-
- off_t seek_res;
- GList *message_positions = NULL;
- char buffer[MBOX_PARSER_BUF_SIZE];
- ssize_t buf_nb_read;
-
-
- /* set the initial position */
- seek_res = lseek (fd, first_position, SEEK_SET);
- if (seek_res == (off_t)-1) goto io_error;
-
- /* populate the buffer and initialize the search proc */
- buf_nb_read = read (fd, buffer, MBOX_PARSER_BUF_SIZE);
-
- while (buf_nb_read>0) {
- current_pos = 0;
-
-
-
-
- /* read the next chunk of data in the folder file */
- buf_nb_read = read (fd, buffer, MBOX_PARSER_BUF_SIZE);
- }
-
-
-
-
-
-
- /* io exception handling */
- io_error :
-
- switch errno {
- case EACCES :
-
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Unable to list the directory. Full Error text is : %s ",
- strerror (errno));
- break;
-
- case ENOENT :
- case ENOTDIR :
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
- "Invalid mbox folder path. Full Error text is : %s ",
- strerror (errno));
- break;
-
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
-
- }
-
-}
diff --git a/camel/providers/mbox/camel-mbox-parser.h b/camel/providers/mbox/camel-mbox-parser.h
deleted file mode 100644
index 19b7a42dc8..0000000000
--- a/camel/providers/mbox/camel-mbox-parser.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-parser.c : mbox folder parser */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <bertrand@helixcode.com> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c
deleted file mode 100644
index d0b1d15cbc..0000000000
--- a/camel/providers/mbox/camel-mbox-store.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-store.c : class for an mbox store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <bertrand@helixcode.com> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include "camel-mbox-store.h"
-#include "camel-mbox-folder.h"
-#include "url-util.h"
-
-static CamelStoreClass *parent_class=NULL;
-
-/* Returns the class for a CamelMboxStore */
-#define CMBOXS_CLASS(so) CAMEL_MBOX_STORE_CLASS (GTK_OBJECT(so)->klass)
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-#define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (GTK_OBJECT(so)->klass)
-
-static void _init (CamelStore *store, CamelSession *session, const gchar *url_name);
-static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name);
-
-
-static void
-camel_mbox_store_class_init (CamelMboxStoreClass *camel_mbox_store_class)
-{
- CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_mbox_store_class);
-
- parent_class = gtk_type_class (camel_store_get_type ());
-
- /* virtual method definition */
- /* virtual method overload */
- camel_store_class->init = _init;
- camel_store_class->get_folder = _get_folder;
-}
-
-
-
-static void
-camel_mbox_store_init (gpointer object, gpointer klass)
-{
- CamelMboxStore *mbox_store = CAMEL_MBOX_STORE (object);
- CamelStore *store = CAMEL_STORE (object);
-
- store->separator = '/';
-}
-
-
-
-
-GtkType
-camel_mbox_store_get_type (void)
-{
- static GtkType camel_mbox_store_type = 0;
-
- if (!camel_mbox_store_type) {
- GtkTypeInfo camel_mbox_store_info =
- {
- "CamelMboxStore",
- sizeof (CamelMboxStore),
- sizeof (CamelMboxStoreClass),
- (GtkClassInitFunc) camel_mbox_store_class_init,
- (GtkObjectInitFunc) camel_mbox_store_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- camel_mbox_store_type = gtk_type_unique (CAMEL_STORE_TYPE, &camel_mbox_store_info);
- }
-
- return camel_mbox_store_type;
-}
-
-
-
-
-/* These evil public functions are here for test only */
-void
-camel_mbox_store_set_toplevel_dir (CamelMboxStore *store, const gchar *toplevel)
-{
- store->toplevel_dir = g_strdup (toplevel);
- CAMEL_STORE(store)->separator = '/';
-}
-
-
-const gchar *
-camel_mbox_store_get_toplevel_dir (CamelMboxStore *store)
-{
- return store->toplevel_dir;
-}
-
-
-
-static void
-_init (CamelStore *store, CamelSession *session, const gchar *url_name)
-{
- CamelMboxStore *mbox_store = CAMEL_MBOX_STORE (store);
- Gurl *store_url;
-
- g_assert (url_name);
- /* call parent implementation */
- parent_class->init (store, session, url_name);
-
-
- /* find the path in the URL*/
- store_url = g_url_new (url_name);
-
- g_return_if_fail (store_url);
- g_return_if_fail (store_url->path);
-
- mbox_store->toplevel_dir = g_strdup (store_url->path);
- g_url_free (store_url);
-
-
-
-}
-
-
-static CamelFolder *
-_get_folder (CamelStore *store, const gchar *folder_name)
-{
- CamelMboxFolder *new_mbox_folder;
- CamelFolder *new_folder;
-
- /* check if folder has already been created */
- /* call the standard routine for that when */
- /* it is done ... */
-
- new_mbox_folder = gtk_type_new (CAMEL_MBOX_FOLDER_TYPE);
- new_folder = CAMEL_FOLDER (new_mbox_folder);
-
- CF_CLASS (new_folder)->init_with_store (new_folder, store, NULL);
- CF_CLASS (new_folder)->set_name (new_folder, folder_name, NULL);
-
-
- return new_folder;
-}
diff --git a/camel/providers/mbox/camel-mbox-store.h b/camel/providers/mbox/camel-mbox-store.h
deleted file mode 100644
index 2f93c98c0e..0000000000
--- a/camel/providers/mbox/camel-mbox-store.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-mbox-store.h : class for an mbox store */
-
-/*
- *
- * Copyright (C) 1999 Bertrand Guiheneuf <bertrand@helixcode.com> .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef CAMEL_MBOX_STORE_H
-#define CAMEL_MBOX_STORE_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <gtk/gtk.h>
-#include "camel-store.h"
-
-#define CAMEL_MBOX_STORE_TYPE (camel_mbox_store_get_type ())
-#define CAMEL_MBOX_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MBOX_STORE_TYPE, CamelMboxStore))
-#define CAMEL_MBOX_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MBOX_STORE_TYPE, CamelMboxStoreClass))
-#define IS_CAMEL_MBOX_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MBOX_STORE_TYPE))
-
-
-typedef struct {
- CamelStore parent_object;
-
- gchar *toplevel_dir;
-} CamelMboxStore;
-
-
-
-typedef struct {
- CamelStoreClass parent_class;
-
-
-} CamelMboxStoreClass;
-
-
-/* public methods */
-
-/* Standard Gtk function */
-GtkType camel_mbox_store_get_type (void);
-
-void camel_mbox_store_set_toplevel_dir (CamelMboxStore *store, const gchar *toplevel);
-const gchar *camel_mbox_store_get_toplevel_dir (CamelMboxStore *store);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* CAMEL_MBOX_STORE_H */
-
-
diff --git a/camel/string-utils.c b/camel/string-utils.c
deleted file mode 100644
index 3f9ce4805d..0000000000
--- a/camel/string-utils.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* string-util : utilities for gchar* strings */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#include <config.h>
-#include "string-utils.h"
-#include "camel-log.h"
-#include "string.h"
-
-
-
-gboolean
-string_equal_for_glist (gconstpointer v, gconstpointer v2)
-{
- return (!strcmp ( ((const gchar *)v), ((const gchar*)v2))) == 0;
-}
-
-/**
- * string_dichotomy:
- * @sep : separator
- * @prefix: pointer to be field by the prefix object
- * the prefix is not returned when the given pointer is NULL
- * @suffix: pointer to be field by the suffix object
- * the suffix is not returned when the given pointer is NULL
- *
- * Return the strings before and/or after
- * the last occurence of the specified separator
- *
- * This routine returns the string before and/or after
- * a character given as an argument.
- * if the separator is the last character, prefix and/or
- * suffix is set to NULL and result is set to 'l'
- * if the separator is not in the list, prefix and/or
- * suffix is set to NULL and result is set to 'n'
- * When the operation succedeed, the return value is 'o'
- *
- * @Return Value : result of the operation ('o', 'l' or 'n')
- *
- **/
-gchar
-string_dichotomy (const gchar *string, gchar sep, gchar **prefix, gchar **suffix,
- StringDichotomyOption options)
-{
- gchar *tmp_str;
- gint sep_pos, first, last, len;
-
- g_assert (string);
- CAMEL_LOG_FULL_DEBUG (\
- "string_dichotomy:: string=\"%s\"\n\tseparator=\"%c\" \n\tprefix=%p \n\tsuffix=%p \n\toptions=%ld\n",\
- string, sep, prefix, suffix, options);
- len = strlen (string);
- if (!len) {
- if (prefix)
- *prefix=NULL;
- if (suffix)
- *suffix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy:: input string is empty\n");
- return 'n';
- }
- first = 0;
- last = len-1;
-
- if ( (options & STRING_DICHOTOMY_STRIP_LEADING ) && (string[first] == sep) )
- do {first++;} while ( (first<len) && (string[first] == sep) );
-
- if (options & STRING_DICHOTOMY_STRIP_TRAILING )
- while ((string[last] == sep) && (last>first))
- last--;
-
- if (first==last) {
- if (prefix) *prefix=NULL;
- if (suffix) *suffix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: after stripping, string is empty\n");
- return 'n';
- }
-
- if (options & STRING_DICHOTOMY_RIGHT_DIR) {
- sep_pos = last;
- while ((sep_pos>=first) && (string[sep_pos]!=sep)) {
- sep_pos--;
- }
- } else {
- sep_pos = first;
- while ((sep_pos<=last) && (string[sep_pos]!=sep)) {
- sep_pos++;
- }
-
- }
-
- if ( (sep_pos<first) || (sep_pos>last) )
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator not found\n");
- return 'n';
- }
-
- /* if we have stripped trailing separators, we should */
- /* never enter here */
- if (sep_pos==last)
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator is last character\n");
- return 'l';
- }
- /* if we have stripped leading separators, we should */
- /* never enter here */
- if (sep_pos==first)
- {
- if (suffix) *suffix=NULL;
- if (prefix) *prefix=NULL;
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator is first character\n");
- return 'l';
- }
- CAMEL_LOG_FULL_DEBUG ("string_dichotomy: separator found at :%d\n", sep_pos);
- if (prefix) { /* return the prefix */
- *prefix = g_strndup (string+first,sep_pos-first);
- CAMEL_LOG_FULL_DEBUG ( "string_dichotomy:: prefix:\"%s\"\n", *prefix);
- }
- if (suffix) { /* return the suffix */
- *suffix = g_strndup (string+sep_pos+1, last-sep_pos);
- CAMEL_LOG_FULL_DEBUG ( "string_dichotomy:: suffix:\"%s\"\n", *suffix);
- }
-
- return 'o';
-}
-
-
-
-
-
-
-/* utility func : frees a gchar element in a GList */
-static void
-__string_list_free_string (gpointer data, gpointer user_data)
-{
- gchar *string = (gchar *)data;
- g_free (string);
-}
-
-
-void
-string_list_free (GList *string_list)
-{
- if (string_list == NULL) return;
-
- g_list_foreach (string_list, __string_list_free_string, NULL);
- g_list_free (string_list);
-}
-
-
-
-
-
-
-GList *
-string_split (const gchar *string, char sep, const gchar *trim_chars, StringTrimOption trim_options)
-{
- GList *result = NULL;
- gint first, last, pos;
- gchar *new_string;
-
- g_assert (string);
-
- first = 0;
- last = strlen(string) - 1;
-
- /* strip leading and trailing separators */
- while ( (first<=last) && (string[first]==sep) )
- first++;
- while ( (first<=last) && (string[last]==sep) )
- last--;
-
-
- CAMEL_LOG_FULL_DEBUG ("string_split:: trim options: %d\n", trim_options);
-
- while (first<=last) {
- pos = first;
- /* find next separator */
- while ((pos<=last) && (string[pos]!=sep)) pos++;
- if (first != pos) {
- new_string = g_strndup (string+first, pos-first);
- /* could do trimming in line to speed up this code */
- if (trim_chars) string_trim (new_string, trim_chars, trim_options);
- result = g_list_append (result, new_string);
- }
- first = pos + 1;
- }
-
- return result;
-}
-
-
-void
-string_trim (gchar *string, const gchar *trim_chars, StringTrimOption options)
-{
- gint first_ok;
- gint last_ok;
- guint length;
-
- CAMEL_LOG_FULL_DEBUG ("string-utils:: Entering string_trim::\n");
- CAMEL_LOG_FULL_DEBUG ("string_trim:: trim_chars:\"%s\"", trim_chars);
- CAMEL_LOG_FULL_DEBUG ("string_trim:: trim_options:%d\n", options);
-
- g_return_if_fail (string);
- length = strlen (string);
- g_return_if_fail (length > 0);
-
- first_ok = 0;
- last_ok = length - 1;
-
- if (options & STRING_TRIM_STRIP_LEADING)
- while ( (first_ok <= last_ok) && (strchr (trim_chars, string[first_ok])!=NULL) )
- first_ok++;
-
- if (options & STRING_TRIM_STRIP_TRAILING)
- while ( (first_ok <= last_ok) && (strchr (trim_chars, string[last_ok])!=NULL) )
- last_ok--;
- CAMEL_LOG_FULL_DEBUG ("string_trim::\n\t\"%s\":first ok:%d last_ok:%d\n",
- string, first_ok, last_ok);
-
- if (first_ok > 0)
- memmove (string, string+first_ok, last_ok - first_ok +2);
-
-}
-
-
-
-
-
-/**
- * remove_suffix: remove a suffix from a string
- * @s: the string to remove the suffix from.
- * @suffix: the suffix to remove
- * @suffix_found : suffix found flag
- *
- * Remove a suffix from a string. If the
- * string ends with the full suffix, a copy
- * of the string without the suffix is returned and
- * @suffix_found is set to %TRUE.
- * Otherwise, NULL is returned and
- * @suffix_found is set to %FALSE.
- *
- * Return value: an allocated copy of the string without the suffix or NULL if the suffix was not found.
- **/
-gchar *
-string_prefix (const gchar *s, const gchar *suffix, gboolean *suffix_found)
-{
- guint s_len, suf_len;
- guint suffix_pos;
- char *result_string;
-
- g_assert (s);
- g_assert (suffix);
- g_assert (suffix_found);
-
- s_len = strlen (s);
- suf_len = strlen (suffix);
-
- /* if the string is shorter than the suffix, do nothing */
- if (s_len < suf_len) {
- *suffix_found = FALSE;
- return NULL;
- }
-
- /* theoretical position of the prefix */
- suffix_pos = s_len - suf_len;
-
- /* compare the right hand side of the string with the suffix */
- if (!strncmp (s+suffix_pos, suffix, suf_len)) {
-
- /* if the suffix matches, check that there are
- characters before */
- if (suffix_pos == 0) {
- result_string = NULL;
- *suffix_found = TRUE;
- } else {
- result_string = g_strndup (s, suffix_pos);
- *suffix_found = TRUE;
- }
-
- } else {
- result_string = NULL;
- *suffix_found = FALSE;
- }
-
- return result_string;
-}
diff --git a/camel/string-utils.h b/camel/string-utils.h
deleted file mode 100644
index f37abbd08b..0000000000
--- a/camel/string-utils.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* string-util : utilities for normal gchar * strings */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com) .
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-#ifndef STRING_UTIL_H
-#define STRING_UTIL_H 1
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus }*/
-
-#include <glib.h>
-
-
-
-typedef enum {
- STRING_DICHOTOMY_NONE = 0,
- STRING_DICHOTOMY_RIGHT_DIR = 1,
- STRING_DICHOTOMY_STRIP_TRAILING = 2,
- STRING_DICHOTOMY_STRIP_LEADING = 4
-
-} StringDichotomyOption;
-
-
-typedef enum {
- STRING_TRIM_NONE = 0,
- STRING_TRIM_STRIP_TRAILING = 1,
- STRING_TRIM_STRIP_LEADING = 2
-} StringTrimOption;
-
-
-
-gboolean string_equal_for_glist (gconstpointer v, gconstpointer v2);
-
-gchar string_dichotomy (const gchar *string, gchar sep,
- gchar **prefix, gchar **suffix,
- StringDichotomyOption options);
-void string_list_free (GList *string_list);
-
-GList *string_split (const gchar *string, char sep,
- const gchar *trim_chars, StringTrimOption trim_options);
-void string_trim (gchar *string, const gchar *chars,
- StringTrimOption options);
-
-gchar *string_prefix (const gchar *s, const gchar *suffix, gboolean *suffix_found);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* STRING_UTIL_H */
diff --git a/camel/url-util.c b/camel/url-util.c
deleted file mode 100644
index ba6bb1e813..0000000000
--- a/camel/url-util.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* url-util.c : utility functions to parse URLs */
-
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com)
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-
-/*
- Here we deal with URL following the general scheme:
- protocol://user:password@host:port/name
- where name is a path-like string (ie dir1/dir2/....)
- See rfc1738 for the complete description of
- Uniform Ressource Locators
-
- Bertrand. */
-/*
- XXX TODO: recover the words between #'s or ?'s after the path */
-
-#include <config.h>
-#include "url-util.h"
-
-/* general item finder */
-/* it begins the search at position @position in @url,
- returns true when the item is found, amd set position after the item */
-typedef gboolean find_item_func(const gchar *url, gchar **item, guint *position, gboolean *error);
-
-/* used to find one item (protocol, then user .... */
-typedef struct {
- char *item_name; /* item name : for debug only */
- gchar **item_value; /* where the item value will go */
- find_item_func *find_func; /* item finder */
-} FindStepStruct;
-
-static gboolean _find_protocol (const gchar *url, gchar **item, guint *position, gboolean *error);
-static gboolean _find_user (const gchar *url, gchar **item, guint *position, gboolean *error);
-static gboolean _find_passwd (const gchar *url, gchar **item, guint *position, gboolean *error);
-static gboolean _find_host (const gchar *url, gchar **item, guint *position, gboolean *error);
-static gboolean _find_port (const gchar *url, gchar **item, guint *position, gboolean *error);
-static gboolean _find_path (const gchar *url, gchar **item, guint *position, gboolean *error);
-
-
-
-/**
- * g_url_new: create an Gurl object from a string
- *
- * @url_string: The string containing the URL to scan
- *
- * This routine takes a gchar and parses it as an
- * URL of the form:
- * protocol://user:password@host:port/path
- * there is no test on the values. For example,
- * "port" can be a string, not only a number !
- * The Gurl structure fields ar filled with
- * the scan results. When a member of the
- * general URL can not be found, the corresponding
- * Gurl member is NULL
- * Fields filled in the Gurl structure are allocated
- * and url_string is not modified.
- *
- * Return value: a Gurl structure containing the URL items.
- **/
-Gurl *g_url_new (const gchar* url_string)
-{
- Gurl *g_url;
-
- gchar *protocol;
- gchar *user;
- gchar *passwd;
- gchar *host;
- gchar *port;
- gchar *path;
-
- guint position = 0;
- gboolean error;
- gboolean found;
- guint i;
-
- g_url = g_new (Gurl,1);
-
-#define NB_STEP_URL 6
- {
- FindStepStruct step[NB_STEP_URL] = {
- { "protocol", &(g_url->protocol), _find_protocol},
- { "user", &(g_url->user), _find_user},
- { "password", &(g_url->passwd), _find_passwd},
- { "host", &(g_url->host), _find_host},
- { "port", &(g_url->port), _find_port},
- { "path", &(g_url->path), _find_path}
- };
-
- for (i = 0; i < NB_STEP_URL; i++) {
- found = step[i].find_func (url_string,
- step[i].item_value,
- &position,
- &error);
- }
- }
-
- return g_url;
-}
-
-
-
-void
-g_url_free (Gurl *url)
-{
- g_assert (url);
-
- g_free (url->protocol);
- g_free (url->user);
- g_free (url->passwd);
- g_free (url->host);
- g_free (url->port);
- g_free (url->path);
-
- g_free (url);
-
-}
-
-/**** PARSING FUNCTIONS ****/
-
-/* So, yes, I must admit there would have been more elegant
- ways to do this, but it works, and quite well :) */
-
-
-static gboolean
-_find_protocol (const gchar *url, gchar **item, guint *position, gboolean *error)
-{
-
- guint i;
- gint len_url;
-
- g_assert (url);
- g_assert (item);
- g_assert (position);
-
- len_url = strlen (url);
-
- *item = NULL;
- *error = FALSE;
- i = *position;
-
- /* find a ':' */
- while ((i < len_url) && (url[i] != ':')) i++;
-
- if (i == len_url) return FALSE;
- i++;
-
- /* check if it is followed by a "//" */
- if ((i < len_url) && (url[i++] == '/'))
- if ((i < len_url) && (url[i++] == '/'))
- {
- *item = g_strndup (url, i-3);
- *position = i;
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-
-
-static gboolean
-_find_user (const gchar *url, gchar **item, guint *position, gboolean *error)
-{
- guint i;
- guint at_pos;
- gint len_url;
-
- g_assert (url);
- g_assert (item);
- g_assert (position);
-
- len_url = strlen (url);
- *item = NULL;
- i = *position;
-
- /* find a '@' */
- while ((i < len_url) && (url[i] != '@')) i++;
-
- if (i == len_url) return FALSE;
- at_pos = i;
- i = *position;
-
- /* find a ':' */
- while ((i < at_pos) && (url[i] != ':')) i++;
-
- /* now if i has not been incremented at all, there is no user */
- if (i == *position) {
- (*position)++;
- return FALSE;
- }
-
- *item = g_strndup (url+ *position, i - *position);
- if (i < at_pos) *position = i + 1; /* there was a ':', skip it */
- else *position = i;
-
- return TRUE;
-}
-
-static gboolean
-_find_passwd (const gchar *url, gchar **item, guint *position, gboolean *error)
-{
- guint i;
- gint len_url;
- gchar *str_passwd;
-
- g_assert (url);
- g_assert (item);
- g_assert (position);
-
- len_url = strlen (url);
- *item = NULL;
- i = *position;
-
- /* find a '@' */
- while ((i < len_url) && (url[i] != '@')) i++;
-
- if (i == len_url) return FALSE;
- /*i has not been incremented at all, there is no passwd */
- if (i == *position) {
- *position = i + 1;
- return FALSE;
- }
-
- *item = g_strndup (url + *position, i - *position);
- *position = i + 1; /* skip it the '@' */
-
- return TRUE;
-}
-
-
-
-static gboolean
-_find_host (const gchar *url, gchar **item, guint *position, gboolean *error)
-{
- guint i;
- guint slash_pos;
- gint len_url;
-
- g_assert (url);
- g_assert (item);
- g_assert (position);
-
- len_url = strlen (url);
- *item = NULL;
- i = *position;
-
- /* find a '/' */
- while ((i < len_url) && (url[i] != '/')) i++;
-
- slash_pos = i;
- i = *position;
-
- /* find a ':' */
- while ( (i < slash_pos) && (url[i] != ':') ) i++;
-
- /* at this point if i has not been incremented at all,
- there is no host */
- if (i == *position) {
- /* if we have not met / or \0, we have : and must skip it */
- if (i < slash_pos) (*position)++;
- return FALSE;
- }
-
- *item = g_strndup (url + *position, i - *position);
- if (i < slash_pos) *position = i + 1; /* there was a ':', skip it */
- else *position=i;
-
- return TRUE;
-}
-
-
-static gboolean
-_find_port (const gchar *url, gchar **item, guint *position, gboolean *error)
-{
- guint i;
- guint slash_pos;
- gint len_url;
-
- g_assert (url);
- g_assert (item);
- g_assert (position);
-
- len_url = strlen (url);
- *item = NULL;
- i=*position;
-
- /* find a '/' */
- while ((i < len_url) && (url[i] != '/')) i++;
-
- slash_pos = i;
- i = *position;
-
- /* find a ':' */
- while ((i < slash_pos) && (url[i] != ':')) i++;
-
- /* at this point if i has not been incremented at all, */
- /* there is no port */
- if (i == *position) return FALSE;
-
- *item = g_strndup (url+ *position, i - *position);
- *position = i;
- return TRUE;
-}
-
-
-static gboolean
-_find_path (const gchar *url, gchar **item, guint *position, gboolean *error)
-{
- guint i;
- gint len_url;
-
- g_assert (url);
- g_assert (item);
- g_assert (position);
-
- len_url = strlen (url);
- *item = NULL;
- i = *position;
-
-
- /* find a '#' */
- while ((i < len_url) && (url[i] != '#') && (url[i] != '?')) i++;
-
- /*i has not been incremented at all, there is no path */
- if (i == *position) return FALSE;
-
- *item = g_strndup (url + *position, i - *position);
- *position=i;
-
- return TRUE;
-}
-
-
-
-
-
-/**** TEST ROUTINE - NOT COMPILED BY DEFAULT ****/
-
-/* to tests this file :
- gcc -o test_url_util `glib-config --cflags` -I.. -DTEST_URL_UTIL url-util.c `glib-config --libs`
- ./test_url_util URL
-*/
-#ifdef TEST_URL_UTIL
-
-
-
-int
-main (int argc, char **argv)
-{
-
- gchar *url;
- gchar *protocol;
- gchar *user;
- gchar *passwd;
- gchar *host;
- gchar *port;
- gchar *path;
- guint position=0;
- gboolean error;
- gboolean found;
- guint i;
- guint i_pos;
-
-#define NB_STEP_TEST 6
- FindStepStruct test_step[NB_STEP_TEST] = {
- { "protocol", &protocol, _find_protocol},
- { "user", &user, _find_user},
- { "password", &passwd, _find_passwd},
- { "host", &host, _find_host},
- { "port", &port, _find_port},
- { "path", &path, _find_path}
- };
- url = argv[1];
- printf("URL to test : %s\n\n", url);
- for (i=0; i<NB_STEP_TEST; i++) {
- found = test_step[i].find_func (url,
- test_step[i].item_value,
- &position,
- &error);
- if (found) {
- printf ("\t\t\t\t** %s found : %s\n",
- test_step[i].item_name,
- *(test_step[i].item_value));
- } else printf ("** %s not found in URL\n", test_step[i].item_name);
- printf ("next item position:\n");
- printf ("%s\n", url);
- for (i_pos = 0; i_pos < position; i_pos++) printf (" ");
- printf ("^\n");
-
- }
-
-}
-
-#endif /* TEST_URL_UTIL */
diff --git a/camel/url-util.h b/camel/url-util.h
deleted file mode 100644
index 6afed454d5..0000000000
--- a/camel/url-util.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* url-util.h : utility functions to parse URLs */
-
-/*
- * Author :
- * Bertrand Guiheneuf <bertrand@helixcode.com>
- *
- * Copyright 1999, 2000 HelixCode (http://www.helixcode.com)
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-
-#ifndef URL_UTIL_H
-#define URL_UTIL_H 1
-
-#include <glib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-typedef struct {
- gchar *protocol;
- gchar *user;
- gchar *passwd;
- gchar *host;
- gchar *port;
- gchar *path;
-
-} Gurl;
-
-/* the cache system has been disabled because it would
- need the user to use accessors instead of modifying the
- structure field. As the speed is not so important here,
- I chose not to use it */
-
-Gurl *g_url_new (const gchar *url_string);
-void g_url_free (Gurl *url);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* URL_UTIL_H */
diff --git a/composer/.cvsignore b/composer/.cvsignore
deleted file mode 100644
index 09980ae6ba..0000000000
--- a/composer/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
diff --git a/composer/ChangeLog b/composer/ChangeLog
deleted file mode 100644
index 744d633eae..0000000000
--- a/composer/ChangeLog
+++ /dev/null
@@ -1,20 +0,0 @@
-1999-11-17 Ettore Perazzoli <ettore@gnu.org>
-
- * Makefile.am: New Makefile to compile the message composer
- executable.
-
- * main.c: New file.
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_to_message): Use
- `CAMEL_RECIPIENT*' macros instead of the old `RECIPIENT*' ones
- that do not exist anymore.
-
- * e-msg-composer-address-dialog.c
- (e_msg_composer_address_dialog_construct): Use `E_GLADEDIR'
- instead of `E_GUIDIR'.
- * e-msg-composer-attachment.c (e_msg_composer_attachment_edit):
- Likewise.
- * e-msg-composer.c (e_msg_composer_construct): Likewise.
-
-(See `$(top_srcdir)/widgets/ChangeLog' for previous changes to the
-message composer.)
diff --git a/composer/Makefile.am b/composer/Makefile.am
deleted file mode 100644
index 4b2c3720dc..0000000000
--- a/composer/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-gladedir = $(datadir)/evolution/glade
-
-glade_DATA = \
- e-msg-composer-address-dialog.glade \
- e-msg-composer-attachment.glade \
- e-msg-composer.glade
-
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- -I$(top_srcdir)/camel \
- -I$(top_builddir)/camel \
- $(GNOME_INCLUDEDIR)
-
-CPPFLAGS = \
- -DE_GLADEDIR=\"$(gladedir)\"
-
-bin_PROGRAMS = \
- evolution-msg-composer
-
-evolution_msg_composer_SOURCES = \
- e-msg-composer-address-dialog.c \
- e-msg-composer-address-dialog.h \
- e-msg-composer-address-entry.c \
- e-msg-composer-address-entry.h \
- e-msg-composer-attachment-bar.c \
- e-msg-composer-attachment-bar.h \
- e-msg-composer-attachment.c \
- e-msg-composer-attachment.h \
- e-msg-composer-hdrs.c \
- e-msg-composer-hdrs.h \
- e-msg-composer.c \
- e-msg-composer.h \
- main.c
-
-evolution_msg_composer_LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) \
- $(INTLLIBS) \
- $(PTHREAD_LIB) \
- $(EXTRA_GNOME_LIBS)
-
-
-EXTRA_DIST = \
- $(glade_DATA) \
- ChangeLog
diff --git a/composer/e-msg-composer-address-dialog.c b/composer/e-msg-composer-address-dialog.c
deleted file mode 100644
index 42a594756d..0000000000
--- a/composer/e-msg-composer-address-dialog.c
+++ /dev/null
@@ -1,660 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-address-dialog.c
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#include <gnome.h>
-#include "e-msg-composer-address-dialog.h"
-
-
-enum {
- APPLY,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static GnomeDialogClass *parent_class = NULL;
-
-
-/* This function should load the addresses we know of into the dialog. We
- don't have a precise setup for the addressbook yet, so we will just put some
- fake entries in. */
-static void
-load_addresses (EMsgComposerAddressDialog *dialog)
-{
- gchar *text[][3] = {
- { "Bertrand Guiheneuf", "Bertrand.Guiheneuf@aful.org", NULL },
- { "Ettore Perazzoli", "ettore@gnu.org", NULL },
- { "Miguel de Icaza", "miguel@gnu.org", NULL },
- { "Nat Friedman", "nat@nat.org", NULL },
- { NULL, NULL, NULL }
- };
- GtkCList *clist;
- guint i;
-
- clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, "address_clist"));
-
- for (i = 0; text[i][0] != NULL; i++)
- gtk_clist_append (clist, text[i]);
-}
-
-/* Combine name and email into an address, e.g. "Ettore Perazzoli
- <ettore@gnu.org>". FIXME FIXME FIXME this does not handle quoting (commas
- will cause troubles), but it should. */
-static gchar *
-make_full_address (const gchar *name,
- const gchar *email)
-{
- return g_strconcat (name, " <", email, ">", NULL);
-}
-
-/* This loads the selected address in the address GtkCList into the requested
- GtkList. */
-static void
-add_address (EMsgComposerAddressDialog *dialog,
- const gchar *list_name)
-{
- GtkCList *src_clist;
- GtkCList *dest_clist;
- gchar *name, *email;
- gchar *text[2];
- guint row;
-
- src_clist = GTK_CLIST (glade_xml_get_widget (dialog->gui,
- "address_clist"));
- if (src_clist->selection == NULL)
- return;
-
- dest_clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, list_name));
- row = GPOINTER_TO_INT (src_clist->selection->data);
-
- gtk_clist_get_text (src_clist, row, 0, &name);
- gtk_clist_get_text (src_clist, row, 1, &email);
-
- text[0] = make_full_address (name, email);
- text[1] = NULL;
-
- gtk_clist_append (dest_clist, text);
-
- g_free (text[0]);
-}
-
-static void
-apply (EMsgComposerAddressDialog *dialog)
-{
- gtk_signal_emit (GTK_OBJECT (dialog), signals[APPLY]);
-}
-
-
-/* Recipient list popup menu. */
-
-struct _RecipientListInfo {
- EMsgComposerAddressDialog *dialog;
- GtkCList *clist;
- gint row; /* -1 if menu was popped up in an empty
- area. */
-};
-typedef struct _RecipientListInfo RecipientListInfo;
-
-static void
-copy_recipient (RecipientListInfo *info,
- gboolean remove)
-{
- gchar *text;
- gint row;
-
- if (info->clist->selection == NULL)
- return;
-
- row = GPOINTER_TO_INT (info->clist->selection->data);
- gtk_clist_get_text (info->clist, row, 0, &text);
-
- g_free (info->dialog->cut_buffer);
- info->dialog->cut_buffer = g_strdup (text);
-
- if (remove)
- gtk_clist_remove (info->clist, row);
-
- gtk_selection_owner_set (GTK_WIDGET (info->clist),
- GDK_SELECTION_PRIMARY,
- GDK_CURRENT_TIME);
-}
-
-static void
-copy_recipient_cb (GtkWidget *widget,
- gpointer data)
-{
- RecipientListInfo *info;
-
- info = (RecipientListInfo *) data;
- copy_recipient (info, FALSE);
- g_free (info);
-}
-
-static void
-cut_recipient_cb (GtkWidget *widget,
- gpointer data)
-{
- RecipientListInfo *info;
-
- info = (RecipientListInfo *) data;
- copy_recipient (info, TRUE);
- g_free (info);
-}
-
-static void
-paste_recipient_cb (GtkWidget *widget,
- gpointer data)
-{
- RecipientListInfo *info;
- GdkAtom atom;
- gchar *text[2];
-
- info = (RecipientListInfo *) data;
-
- atom = gdk_atom_intern ("STRING", FALSE);
- gtk_selection_convert (GTK_WIDGET (info->clist),
- GDK_SELECTION_PRIMARY,
- atom,
- GDK_CURRENT_TIME);
-
- g_free (info);
-}
-
-static GnomeUIInfo recipient_list_item_popup_info[] = {
- GNOMEUIINFO_ITEM_STOCK (N_("Cut"),
- N_("Cut selected item into clipboard"),
- cut_recipient_cb,
- GNOME_STOCK_MENU_CUT),
- GNOMEUIINFO_ITEM_STOCK (N_("Copy"),
- N_("Copy selected item into clipboard"),
- copy_recipient_cb,
- GNOME_STOCK_MENU_COPY),
- GNOMEUIINFO_ITEM_STOCK (N_("Paste"),
- N_("Paste item from clipboard"),
- paste_recipient_cb,
- GNOME_STOCK_MENU_PASTE),
- GNOMEUIINFO_END
-};
-
-static GnomeUIInfo recipient_list_popup_info[] = {
- GNOMEUIINFO_ITEM_STOCK (N_("Paste"),
- N_("Paste item from clipboard"),
- paste_recipient_cb,
- GNOME_STOCK_MENU_PASTE),
- GNOMEUIINFO_END
-};
-
-
-/* Signals. */
-
-static void
-add_to_cb (GtkWidget *widget,
- gpointer data)
-{
- add_address (E_MSG_COMPOSER_ADDRESS_DIALOG (data), "to_clist");
-}
-
-static void
-add_cc_cb (GtkWidget *widget,
- gpointer data)
-{
- add_address (E_MSG_COMPOSER_ADDRESS_DIALOG (data), "cc_clist");
-}
-
-static void
-add_bcc_cb (GtkWidget *widget,
- gpointer data)
-{
- add_address (E_MSG_COMPOSER_ADDRESS_DIALOG (data), "bcc_clist");
-}
-
-static void
-glade_connect (GladeXML *gui,
- const gchar *widget_name,
- const gchar *signal_name,
- GtkSignalFunc callback,
- gpointer callback_data)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget (gui, widget_name);
- if (widget == NULL)
- g_warning ("Widget `%s' was not found.", widget_name);
- else
- gtk_signal_connect (GTK_OBJECT (widget), signal_name,
- GTK_SIGNAL_FUNC (callback), callback_data);
-}
-
-static gint
-recipient_clist_button_press_cb (GtkWidget *widget,
- GdkEventButton *event,
- gpointer data)
-{
- EMsgComposerAddressDialog *dialog;
- RecipientListInfo *info;
- GtkWidget *popup;
- GtkCList *clist;
- gboolean on_row;
- gint row, column;
-
- dialog = E_MSG_COMPOSER_ADDRESS_DIALOG (data);
-
- clist = GTK_CLIST (widget);
-
- if (event->window != clist->clist_window || event->button != 3)
- return FALSE;
-
- on_row = gtk_clist_get_selection_info (clist, event->x, event->y,
- &row, &column);
-
- info = g_new (RecipientListInfo, 1);
- info->dialog = dialog;
- info->clist = clist;
-
- if (on_row) {
- gtk_clist_unselect_all (clist);
- gtk_clist_select_row (clist, row, 0);
- info->row = row;
- popup = gnome_popup_menu_new (recipient_list_item_popup_info);
- } else {
- info->row = -1;
- popup = gnome_popup_menu_new (recipient_list_popup_info);
- }
-
- gnome_popup_menu_do_popup_modal (popup, NULL, NULL, event, info);
-
- gtk_widget_destroy (popup);
-
- return TRUE;
-}
-
-/* FIXME needs more work. */
-static void
-recipient_clist_selection_received_cb (GtkWidget *widget,
- GtkSelectionData *selection_data,
- guint time,
- gpointer data)
-{
- GtkCList *clist;
- gchar *text[2];
- gchar *p;
-
- puts (__FUNCTION__);
-
- if (selection_data->length < 0)
- return;
-
- clist = GTK_CLIST (widget);
-
- /* FIXME quoting. */
- text[0] = g_strdup (selection_data->data);
- text[1] = NULL;
-
- /* It is a common mistake to paste `\n's, let's work around that. */
- for (p = text[0]; *p != '\0'; p++) {
- if (*p == '\n') {
- *p = '\0';
- break;
- }
- }
-
- if (clist->selection != NULL) {
- gint row;
-
- row = GPOINTER_TO_INT (clist->selection->data);
- gtk_clist_insert (clist, row, text);
- } else {
- gtk_clist_append (clist, text);
- }
-
- g_free (text[0]);
-}
-
-static void
-recipient_clist_selection_get_cb (GtkWidget *widget,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer data)
-{
- EMsgComposerAddressDialog *dialog;
- GdkAtom atom;
-
- puts (__FUNCTION__);
-
- dialog = E_MSG_COMPOSER_ADDRESS_DIALOG (data);
- if (dialog->cut_buffer == NULL)
- return; /* FIXME should I do something special? */
-
- atom = gdk_atom_intern ("STRING", FALSE);
- gtk_selection_data_set (selection_data, atom, 8,
- dialog->cut_buffer,
- strlen (dialog->cut_buffer));
-}
-
-static void
-recipient_clist_selection_clear_event_cb (GtkWidget *widget,
- GdkEventSelection *selection,
- gpointer data)
-{
- EMsgComposerAddressDialog *dialog;
-
- dialog = E_MSG_COMPOSER_ADDRESS_DIALOG (data);
- g_free (dialog->cut_buffer);
- dialog->cut_buffer = NULL;
-}
-
-static void
-setup_recipient_list_signals (EMsgComposerAddressDialog *dialog,
- const gchar *name)
-{
- glade_connect (dialog->gui, name, "button_press_event",
- GTK_SIGNAL_FUNC (recipient_clist_button_press_cb),
- dialog);
- glade_connect (dialog->gui, name, "selection_received",
- GTK_SIGNAL_FUNC (recipient_clist_selection_received_cb),
- dialog);
- glade_connect (dialog->gui, name, "selection_get",
- GTK_SIGNAL_FUNC (recipient_clist_selection_get_cb),
- dialog);
- glade_connect (dialog->gui, name, "selection_clear_event",
- GTK_SIGNAL_FUNC (recipient_clist_selection_clear_event_cb),
- dialog);
-}
-
-static void
-setup_signals (EMsgComposerAddressDialog *dialog)
-{
- glade_connect (dialog->gui, "to_add_button", "clicked",
- GTK_SIGNAL_FUNC (add_to_cb), dialog);
- glade_connect (dialog->gui, "cc_add_button", "clicked",
- GTK_SIGNAL_FUNC (add_cc_cb), dialog);
- glade_connect (dialog->gui, "bcc_add_button", "clicked",
- GTK_SIGNAL_FUNC (add_bcc_cb), dialog);
-
- setup_recipient_list_signals (dialog, "to_clist");
- setup_recipient_list_signals (dialog, "cc_clist");
- setup_recipient_list_signals (dialog, "bcc_clist");
-}
-
-
-static void
-setup_selection_targets (EMsgComposerAddressDialog *dialog)
-{
- gtk_selection_add_target (glade_xml_get_widget (dialog->gui, "to_clist"),
- GDK_SELECTION_PRIMARY,
- GDK_SELECTION_TYPE_STRING, 0);
- gtk_selection_add_target (glade_xml_get_widget (dialog->gui, "cc_clist"),
- GDK_SELECTION_PRIMARY,
- GDK_SELECTION_TYPE_STRING, 0);
- gtk_selection_add_target (glade_xml_get_widget (dialog->gui, "bcc_clist"),
- GDK_SELECTION_PRIMARY,
- GDK_SELECTION_TYPE_STRING, 0);
-}
-
-
-/* GnomeDialog methods. */
-
-static void
-clicked (GnomeDialog *dialog,
- gint button_number)
-{
- switch (button_number) {
- case 0: /* OK */
- apply (E_MSG_COMPOSER_ADDRESS_DIALOG (dialog));
- gnome_dialog_close (dialog);
- break;
- case 1: /* Apply */
- apply (E_MSG_COMPOSER_ADDRESS_DIALOG (dialog));
- break;
- case 2: /* Cancel */
- gnome_dialog_close (dialog);
- break;
- }
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- EMsgComposerAddressDialog *dialog;
- GtkCList *address_clist;
- GList *p;
-
- dialog = E_MSG_COMPOSER_ADDRESS_DIALOG (object);
-
- gtk_object_unref (GTK_OBJECT (dialog->gui));
- g_free (dialog->cut_buffer);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-/* Initialization. */
-
-static void
-class_init (EMsgComposerAddressDialogClass *class)
-{
- GtkObjectClass *object_class;
- GnomeDialogClass *gnome_dialog_class;
-
- object_class = GTK_OBJECT_CLASS (class);
- object_class->destroy = destroy;
-
- gnome_dialog_class = GNOME_DIALOG_CLASS (class);
- gnome_dialog_class->clicked = clicked;
-
- parent_class = gtk_type_class (gnome_dialog_get_type ());
-
- signals[APPLY]
- = gtk_signal_new ("apply",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerAddressDialogClass,
- apply),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-init (EMsgComposerAddressDialog *dialog)
-{
- dialog->gui = NULL;
- dialog->cut_buffer = NULL;
-}
-
-
-GtkType
-e_msg_composer_address_dialog_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "EMsgComposerAddressDialog",
- sizeof (EMsgComposerAddressDialog),
- sizeof (EMsgComposerAddressDialogClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gnome_dialog_get_type (), &info);
- }
-
- return type;
-}
-
-void
-e_msg_composer_address_dialog_construct (EMsgComposerAddressDialog *dialog)
-{
- static const gchar *buttons[] = {
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_APPLY,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL
- };
-
- g_return_if_fail (dialog != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_ADDRESS_DIALOG (dialog));
-
- gnome_dialog_constructv (GNOME_DIALOG (dialog),
- _("Select recipients' addresses"),
- buttons);
-
- dialog->gui = glade_xml_new
- (E_GLADEDIR "/e-msg-composer-address-dialog.glade",
- "main_table");
- if (dialog->gui == NULL) {
- g_warning ("Cannot load `e-msg-composer-address-dialog.glade");
- return;
- }
-
- gtk_container_add (GTK_CONTAINER (GNOME_DIALOG (dialog)->vbox),
- glade_xml_get_widget (dialog->gui, "main_table"));
-
- setup_selection_targets (dialog);
- load_addresses (dialog);
- setup_signals (dialog);
-}
-
-GtkWidget *
-e_msg_composer_address_dialog_new (void)
-{
- EMsgComposerAddressDialog *new;
-
- new = gtk_type_new (e_msg_composer_address_dialog_get_type ());
- e_msg_composer_address_dialog_construct (new);
-
- return GTK_WIDGET (new);
-}
-
-
-static void
-set_list (EMsgComposerAddressDialog *dialog,
- const gchar *list_name,
- GList *list)
-{
- GtkCList *clist;
- GList *p;
- gchar *text[2];
-
- clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, list_name));
-
- gtk_clist_freeze (clist);
- gtk_clist_clear (clist);
-
- text[1] = NULL;
- for (p = list; p != NULL; p = p->next) {
- text[0] = (gchar *) p->data;
- gtk_clist_append (clist, text);
- }
-
- gtk_clist_thaw (clist);
-}
-
-void
-e_msg_composer_address_dialog_set_to_list (EMsgComposerAddressDialog *dialog,
- GList *to_list)
-{
- g_return_if_fail (dialog != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_ADDRESS_DIALOG (dialog));
-
- set_list (dialog, "to_clist", to_list);
-}
-
-void
-e_msg_composer_address_dialog_set_cc_list (EMsgComposerAddressDialog *dialog,
- GList *cc_list)
-{
- g_return_if_fail (dialog != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_ADDRESS_DIALOG (dialog));
-
- set_list (dialog, "cc_clist", cc_list);
-}
-
-void
-e_msg_composer_address_dialog_set_bcc_list (EMsgComposerAddressDialog *dialog,
- GList *bcc_list)
-{
- g_return_if_fail (dialog != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_ADDRESS_DIALOG (dialog));
-
- set_list (dialog, "bcc_clist", bcc_list);
-}
-
-
-static GList *
-get_list (EMsgComposerAddressDialog *dialog,
- const gchar *clist_name)
-{
- GtkCList *address_clist;
- GtkCList *clist;
- GList *list;
- guint i;
-
- clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, clist_name));
-
- list = NULL;
- for (i = 0; i < clist->rows; i++) {
- gchar *addr;
-
- gtk_clist_get_text (clist, i, 0, &addr);
- list = g_list_prepend (list, g_strdup (addr));
- }
-
- return g_list_reverse (list);
-}
-
-GList *
-e_msg_composer_address_dialog_get_to_list (EMsgComposerAddressDialog *dialog)
-{
- g_return_val_if_fail (dialog != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_ADDRESS_DIALOG (dialog), NULL);
-
- return get_list (dialog, "to_clist");
-}
-
-GList *
-e_msg_composer_address_dialog_get_cc_list (EMsgComposerAddressDialog *dialog)
-{
- g_return_val_if_fail (dialog != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_ADDRESS_DIALOG (dialog), NULL);
-
- return get_list (dialog, "cc_clist");
-}
-
-GList *
-e_msg_composer_address_dialog_get_bcc_list (EMsgComposerAddressDialog *dialog)
-{
- g_return_val_if_fail (dialog != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_ADDRESS_DIALOG (dialog), NULL);
-
- return get_list (dialog, "bcc_clist");
-}
diff --git a/composer/e-msg-composer-address-dialog.glade b/composer/e-msg-composer-address-dialog.glade
deleted file mode 100644
index 2249c27daf..0000000000
--- a/composer/e-msg-composer-address-dialog.glade
+++ /dev/null
@@ -1,575 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>address-composer</name>
- <program_name>address-composer</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>False</use_widget_names>
- <output_main_file>True</output_main_file>
- <output_support_files>True</output_support_files>
- <output_build_files>True</output_build_files>
- <backup_source_files>True</backup_source_files>
- <main_source_file>interface.c</main_source_file>
- <main_header_file>interface.h</main_header_file>
- <handler_source_file>callbacks.c</handler_source_file>
- <handler_header_file>callbacks.h</handler_header_file>
- <support_source_file>support.c</support_source_file>
- <support_header_file>support.h</support_header_file>
- <translatable_strings_file></translatable_strings_file>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog1</name>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkTable</class>
- <name>main_table</name>
- <rows>3</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>0</row_spacing>
- <column_spacing>2</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label3</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>False</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <label>Recipient list:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>5</spacing>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>False</xfill>
- <yfill>False</yfill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label2</name>
- <label>Name:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>name_entry</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <padding>5</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>search_button</name>
- <width>65</width>
- <can_focus>True</can_focus>
- <label>Search...</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow1</name>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>5</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkCList</class>
- <name>address_clist</name>
- <width>180</width>
- <height>200</height>
- <can_focus>True</can_focus>
- <columns>2</columns>
- <column_widths>128,107</column_widths>
- <selection_mode>GTK_SELECTION_BROWSE</selection_mode>
- <show_titles>True</show_titles>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>label5</name>
- <width>50</width>
- <label>Name</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>label6</name>
- <width>100</width>
- <label>Address</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox2</name>
- <homogeneous>True</homogeneous>
- <spacing>10</spacing>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button5</name>
- <can_focus>True</can_focus>
- <label>Properties...</label>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button6</name>
- <can_focus>True</can_focus>
- <label>Add...</label>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table2</name>
- <rows>3</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>0</row_spacing>
- <column_spacing>0</column_spacing>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>5</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>to_add_button</name>
- <width>60</width>
- <can_focus>True</can_focus>
- <label>To: &gt;&gt;</label>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>5</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>cc_add_button</name>
- <width>60</width>
- <can_focus>True</can_focus>
- <label>Cc: &gt;&gt;</label>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>5</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>bcc_add_button</name>
- <width>60</width>
- <can_focus>True</can_focus>
- <label>Bcc: &gt;&gt;</label>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>5</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow4</name>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>2</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkCList</class>
- <name>bcc_clist</name>
- <width>180</width>
- <height>100</height>
- <can_focus>True</can_focus>
- <columns>1</columns>
- <column_widths>80</column_widths>
- <selection_mode>GTK_SELECTION_BROWSE</selection_mode>
- <show_titles>False</show_titles>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>label9</name>
- <label>label9</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow2</name>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>2</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkCList</class>
- <name>to_clist</name>
- <width>180</width>
- <height>100</height>
- <can_focus>True</can_focus>
- <columns>1</columns>
- <column_widths>80</column_widths>
- <selection_mode>GTK_SELECTION_BROWSE</selection_mode>
- <show_titles>False</show_titles>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>label7</name>
- <label>label7</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow3</name>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>2</xpad>
- <ypad>4</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkCList</class>
- <name>cc_clist</name>
- <width>180</width>
- <height>100</height>
- <can_focus>True</can_focus>
- <columns>1</columns>
- <column_widths>80</column_widths>
- <selection_mode>GTK_SELECTION_BROWSE</selection_mode>
- <show_titles>False</show_titles>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>label8</name>
- <label>label8</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <can_default>True</can_default>
- <has_default>True</has_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button2</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button3</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/composer/e-msg-composer-address-dialog.h b/composer/e-msg-composer-address-dialog.h
deleted file mode 100644
index 19ffeda703..0000000000
--- a/composer/e-msg-composer-address-dialog.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-address-dialog.h
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-#ifndef __E_MSG_COMPOSER_ADDRESS_DIALOG_H__
-#define __E_MSG_COMPOSER_ADDRESS_DIALOG_H__
-
-#include <gnome.h>
-#include <glade/glade-xml.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-
-#define E_TYPE_MSG_COMPOSER_ADDRESS_DIALOG (e_msg_composer_address_dialog_get_type ())
-#define E_MSG_COMPOSER_ADDRESS_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_DIALOG, EMsgComposerAddressDialog))
-#define E_MSG_COMPOSER_ADDRESS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER_ADDRESS_DIALOG, EMsgComposerAddressDialogClass))
-#define E_IS_MSG_COMPOSER_ADDRESS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_DIALOG))
-#define E_IS_MSG_COMPOSER_ADDRESS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_DIALOG))
-
-
-typedef struct _EMsgComposerAddressDialog EMsgComposerAddressDialog;
-typedef struct _EMsgComposerAddressDialogClass EMsgComposerAddressDialogClass;
-
-struct _EMsgComposerAddressDialog {
- GnomeDialog parent;
-
- GladeXML *gui;
-
- gchar *cut_buffer;
-};
-
-struct _EMsgComposerAddressDialogClass {
- GnomeDialogClass parent_class;
-
- void (* apply) (EMsgComposerAddressDialog *dialog);
-};
-
-
-GtkType e_msg_composer_address_dialog_get_type (void);
-GtkWidget *e_msg_composer_address_dialog_new (void);
-void e_msg_composer_address_dialog_construct (EMsgComposerAddressDialog *dialog);
-void e_msg_composer_address_dialog_set_to_list (EMsgComposerAddressDialog *dialog, GList *to_list);
-void e_msg_composer_address_dialog_set_cc_list (EMsgComposerAddressDialog *dialog, GList *cc_list);
-void e_msg_composer_address_dialog_set_bcc_list (EMsgComposerAddressDialog *dialog, GList *bcc_list);
-GList *e_msg_composer_address_dialog_get_to_list (EMsgComposerAddressDialog *dialog);
-GList *e_msg_composer_address_dialog_get_cc_list (EMsgComposerAddressDialog *dialog);
-GList *e_msg_composer_address_dialog_get_bcc_list (EMsgComposerAddressDialog *dialog);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_MSG_COMPOSER_ADDRESS_DIALOG_H__ */
diff --git a/composer/e-msg-composer-address-entry.c b/composer/e-msg-composer-address-entry.c
deleted file mode 100644
index be63c815f5..0000000000
--- a/composer/e-msg-composer-address-entry.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-address-entry.c
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-/* This is a custom GtkEntry for entering address lists. For now, it does not
- have any fancy features, but in the future we might want to make it
- cooler. */
-
-#include <gnome.h>
-
-#include "e-msg-composer-address-entry.h"
-
-
-static GtkEntryClass *parent_class = NULL;
-
-
-/* Initialization. */
-
-static void
-class_init (EMsgComposerAddressEntryClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (gtk_entry_get_type ());
-}
-
-static void
-init (EMsgComposerAddressEntry *msg_composer_address_entry)
-{
-}
-
-GtkType
-e_msg_composer_address_entry_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "EMsgComposerAddressEntry",
- sizeof (EMsgComposerAddressEntry),
- sizeof (EMsgComposerAddressEntryClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gtk_entry_get_type (), &info);
- }
-
- return type;
-}
-
-
-GtkWidget *
-e_msg_composer_address_entry_new (void)
-{
- GtkWidget *new;
-
- new = gtk_type_new (e_msg_composer_address_entry_get_type ());
-
- return new;
-}
-
-
-/**
- * e_msg_composer_address_entry_get_addresses:
- * @entry: An address entry widget
- *
- * Retrieve the list of addresses stored in @entry.
- *
- * Return value: A GList of pointers to strings representing the addresses.
- * Notice that the strings must be freed by the caller when not needed anymore.
- **/
-GList *
-e_msg_composer_address_entry_get_addresses (EMsgComposerAddressEntry *entry)
-{
- GList *list;
- const gchar *s;
- const gchar *p, *oldp;
- gboolean in_quotes;
-
- s = gtk_entry_get_text (GTK_ENTRY (entry));
-
- in_quotes = FALSE;
- list = NULL;
-
- p = s;
- oldp = s;
-
- while (1) {
- if (*p == '"') {
- in_quotes = ! in_quotes;
- p++;
- } else if ((! in_quotes && *p == ',') || *p == 0) {
- if (p != oldp) {
- gchar *new_addr;
-
- new_addr = g_strndup (oldp, p - oldp);
- new_addr = g_strstrip (new_addr);
- if (*new_addr != '\0')
- list = g_list_prepend (list, new_addr);
- else
- g_free (new_addr);
- }
-
- while (*p == ',' || *p == ' ' || *p == '\t')
- p++;
-
- if (*p == 0)
- break;
-
- oldp = p;
- } else {
- p++;
- }
- }
-
- return g_list_reverse (list);
-}
-
-/**
- * e_msg_composer_address_entry_set_list:
- * @entry: An address entry
- * @list: List of pointers to strings representing the addresses that must
- * appear in the entry
- *
- * Set the address list from @list.
- **/
-void
-e_msg_composer_address_entry_set_list (EMsgComposerAddressEntry *entry,
- GList *list)
-{
- GString *string;
- GList *p;
-
- g_return_if_fail (entry != NULL);
-
- if (list == NULL) {
- gtk_editable_delete_text (GTK_EDITABLE (entry), -1, -1);
- return;
- }
-
- string = g_string_new (NULL);
- for (p = list; p != NULL; p = p->next) {
- if (string->str[0] != '\0')
- g_string_append (string, ", ");
- g_string_append (string, p->data);
- }
-
- gtk_entry_set_text (GTK_ENTRY (entry), string->str);
- g_string_free (string, TRUE);
-}
diff --git a/composer/e-msg-composer-address-entry.h b/composer/e-msg-composer-address-entry.h
deleted file mode 100644
index 8e926272e4..0000000000
--- a/composer/e-msg-composer-address-entry.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-address-entry.h
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef __E_MSG_COMPOSER_ADDRESS_ENTRY_H__
-#define __E_MSG_COMPOSER_ADDRESS_ENTRY_H__
-
-#include <gnome.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_MSG_COMPOSER_ADDRESS_ENTRY (e_msg_composer_address_entry_get_type ())
-#define E_MSG_COMPOSER_ADDRESS_ENTRY(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_ENTRY, EMsgComposerAddressEntry))
-#define E_MSG_COMPOSER_ADDRESS_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER_ADDRESS_ENTRY, EMsgComposerAddressEntryClass))
-#define E_IS_MSG_COMPOSER_ADDRESS_ENTRY(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_ENTRY))
-#define E_IS_MSG_COMPOSER_ADDRESS_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_ENTRY))
-
-
-typedef struct _EMsgComposerAddressEntry EMsgComposerAddressEntry;
-typedef struct _EMsgComposerAddressEntryClass EMsgComposerAddressEntryClass;
-
-struct _EMsgComposerAddressEntry {
- GtkEntry parent;
-};
-
-struct _EMsgComposerAddressEntryClass {
- GtkEntryClass parent_class;
-};
-
-
-GtkType e_msg_composer_address_entry_get_type (void);
-GtkWidget *e_msg_composer_address_entry_new (void);
-GList *e_msg_composer_address_entry_get_addresses (EMsgComposerAddressEntry *entry);
-void e_msg_composer_address_entry_set_list (EMsgComposerAddressEntry *entry,
- GList *list);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_MSG_COMPOSER_ADDRESS_ENTRY_H__ */
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
deleted file mode 100644
index b55a4cbad4..0000000000
--- a/composer/e-msg-composer-attachment-bar.c
+++ /dev/null
@@ -1,665 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-attachment-bar.c
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#include <gnome.h>
-#include <glade/glade.h>
-
-#include "e-msg-composer-attachment.h"
-#include "e-msg-composer-attachment-bar.h"
-
-
-#define ICON_WIDTH 64
-#define ICON_SEPARATORS " /-_"
-#define ICON_SPACING 2
-#define ICON_ROW_SPACING ICON_SPACING
-#define ICON_COL_SPACING ICON_SPACING
-#define ICON_BORDER 2
-#define ICON_TEXT_SPACING 2
-
-
-static GnomeIconListClass *parent_class = NULL;
-
-struct _EMsgComposerAttachmentBarPrivate {
- GList *attachments;
- guint num_attachments;
-
- GtkWidget *context_menu;
- GtkWidget *icon_context_menu;
-};
-
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-
-static void update (EMsgComposerAttachmentBar *bar);
-
-
-static gchar *
-size_to_string (gulong size)
-{
- gchar *size_string;
-
- /* FIXME: The following should probably go into a separate module, as
- we might have to do the same thing in other places as well. Also,
- I am not sure this will be OK for all the languages. */
-
- if (size < 1e3L) {
- if (size == 1)
- size_string = g_strdup (_("1 byte"));
- else
- size_string = g_strdup_printf (_("%u bytes"),
- (guint) size);
- } else {
- gdouble displayed_size;
-
- if (size < 1e6L) {
- displayed_size = (gdouble) size / 1.0e3;
- size_string = g_strdup_printf (_("%.1fK"),
- displayed_size);
- } else if (size < 1e9L) {
- displayed_size = (gdouble) size / 1.0e6;
- size_string = g_strdup_printf (_("%.1fM"),
- displayed_size);
- } else {
- displayed_size = (gdouble) size / 1.0e9;
- size_string = g_strdup_printf (_("%.1fG"),
- displayed_size);
- }
- }
-
- return size_string;
-}
-
-
-/* Sorting. */
-
-static gint
-attachment_sort_func (gconstpointer a, gconstpointer b)
-{
- const EMsgComposerAttachment *attachment_a, *attachment_b;
-
- attachment_a = (EMsgComposerAttachment *) a;
- attachment_b = (EMsgComposerAttachment *) b;
-
- return strcmp (attachment_a->description, attachment_b->description);
-}
-
-static void
-sort (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposerAttachmentBarPrivate *priv;
-
- priv = bar->priv;
-
- priv->attachments = g_list_sort (priv->attachments,
- attachment_sort_func);
-}
-
-
-/* Attachment handling functions. */
-
-static void
-free_attachment_list (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposerAttachmentBarPrivate *priv;
- GList *p;
-
- priv = bar->priv;
-
- for (p = priv->attachments; p != NULL; p = p->next)
- gtk_object_unref (GTK_OBJECT (p->data));
-}
-
-static void
-attachment_changed_cb (EMsgComposerAttachment *attachment,
- gpointer data)
-{
- update (E_MSG_COMPOSER_ATTACHMENT_BAR (data));
-}
-
-static void
-add_from_file (EMsgComposerAttachmentBar *bar,
- const gchar *file_name)
-{
- EMsgComposerAttachment *attachment;
-
- attachment = e_msg_composer_attachment_new (file_name);
-
- gtk_signal_connect (GTK_OBJECT (attachment), "changed",
- GTK_SIGNAL_FUNC (attachment_changed_cb),
- bar);
-
- bar->priv->attachments = g_list_append (bar->priv->attachments,
- attachment);
- bar->priv->num_attachments++;
-
- sort (bar);
- update (bar);
-
- gtk_signal_emit (GTK_OBJECT (bar), signals[CHANGED]);
-}
-
-static void
-remove_attachment (EMsgComposerAttachmentBar *bar,
- EMsgComposerAttachment *attachment)
-{
- bar->priv->attachments = g_list_remove (bar->priv->attachments,
- attachment);
- bar->priv->num_attachments--;
-
- gtk_object_unref (GTK_OBJECT (attachment));
-
- gtk_signal_emit (GTK_OBJECT (bar), signals[CHANGED]);
-}
-
-
-/* Icon list contents handling. */
-
-static void
-update (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposerAttachmentBarPrivate *priv;
- GnomeIconList *icon_list;
- GList *p;
-
- priv = bar->priv;
- icon_list = GNOME_ICON_LIST (bar);
-
- gnome_icon_list_freeze (icon_list);
-
- gnome_icon_list_clear (icon_list);
-
- /* FIXME could be faster, but we don't care. */
-
- for (p = priv->attachments; p != NULL; p = p->next) {
- EMsgComposerAttachment *attachment;
- const gchar *icon_name;
- gchar *size_string;
- gchar *label;
-
- attachment = p->data;
- icon_name = gnome_mime_get_value (attachment->mime_type,
- "icon-filename");
-
- /* FIXME we need some better default icon. */
- if (icon_name == NULL)
- icon_name = gnome_mime_get_value ("text/plain",
- "icon-filename");
-
- size_string = size_to_string (attachment->size);
-
- /* FIXME: If GnomeIconList honoured "\n", the result would be a
- lot better. */
- label = g_strconcat (attachment->description, "\n(",
- size_string, ")", NULL);
-
- gnome_icon_list_append (icon_list, icon_name, label);
-
- g_free (label);
- g_free (size_string);
- }
-
- gnome_icon_list_thaw (icon_list);
-}
-
-static void
-remove_selected (EMsgComposerAttachmentBar *bar)
-{
- GnomeIconList *icon_list;
- EMsgComposerAttachment *attachment;
- GList *attachment_list;
- GList *p;
- gint num;
-
- icon_list = GNOME_ICON_LIST (bar);
-
- /* Weee! I am especially proud of this piece of cheesy code: it is
- truly awful. But unless one attaches a huge number of files, it
- will not be as greedy as intended. FIXME of course. */
-
- attachment_list = NULL;
- for (p = icon_list->selection; p != NULL; p = p->next) {
- num = GPOINTER_TO_INT (p->data);
- attachment = E_MSG_COMPOSER_ATTACHMENT
- (g_list_nth (bar->priv->attachments, num)->data);
- attachment_list = g_list_prepend (attachment_list, attachment);
- }
-
- for (p = attachment_list; p != NULL; p = p->next)
- remove_attachment (bar, E_MSG_COMPOSER_ATTACHMENT (p->data));
-
- g_list_free (attachment_list);
-
- update (bar);
-}
-
-static void
-edit_selected (EMsgComposerAttachmentBar *bar)
-{
- GnomeIconList *icon_list;
- EMsgComposerAttachment *attachment;
- gint num;
-
- icon_list = GNOME_ICON_LIST (bar);
-
- num = GPOINTER_TO_INT (icon_list->selection->data);
- attachment = g_list_nth (bar->priv->attachments, num)->data;
-
- e_msg_composer_attachment_edit (attachment, GTK_WIDGET (bar));
-}
-
-
-/* "Attach" dialog. */
-
-static void
-attach_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposerAttachmentBar *bar;
- GtkWidget *file_selection;
- const gchar *file_name;
-
- file_selection = gtk_widget_get_toplevel (widget);
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (data);
-
- file_name = gtk_file_selection_get_filename
- (GTK_FILE_SELECTION (file_selection));
- add_from_file (bar, file_name);
-
- gtk_widget_hide (file_selection);
-}
-
-static void
-add_from_user (EMsgComposerAttachmentBar *bar)
-{
- GtkWidget *file_selection;
- GtkWidget *cancel_button;
- GtkWidget *ok_button;
-
- file_selection = gtk_file_selection_new (_("Add attachment"));
- gtk_window_set_position (GTK_WINDOW (file_selection),
- GTK_WIN_POS_MOUSE);
-
- ok_button = GTK_FILE_SELECTION (file_selection)->ok_button;
- gtk_signal_connect (GTK_OBJECT (ok_button),
- "clicked", GTK_SIGNAL_FUNC (attach_cb), bar);
-
- cancel_button = GTK_FILE_SELECTION (file_selection)->cancel_button;
- gtk_signal_connect_object (GTK_OBJECT (cancel_button),
- "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_hide),
- GTK_OBJECT (file_selection));
-
- gtk_widget_show (GTK_WIDGET (file_selection));
-}
-
-
-/* Callbacks. */
-
-static void
-add_cb (GtkWidget *widget,
- gpointer data)
-{
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
-
- add_from_user (E_MSG_COMPOSER_ATTACHMENT_BAR (data));
-}
-
-static void
-properties_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposerAttachmentBar *bar;
-
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
-
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (data);
- edit_selected (data);
-}
-
-static void
-remove_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposerAttachmentBar *bar;
-
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
-
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (data);
- remove_selected (bar);
-}
-
-
-/* Popup menu handling. */
-
-static GnomeUIInfo icon_context_menu_info[] = {
- GNOMEUIINFO_ITEM (N_("Remove"),
- N_("Remove selected items from the attachment list"),
- remove_cb, NULL),
- GNOMEUIINFO_MENU_PROPERTIES_ITEM (properties_cb, NULL),
- GNOMEUIINFO_END
-};
-
-static GtkWidget *
-get_icon_context_menu (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposerAttachmentBarPrivate *priv;
-
- priv = bar->priv;
- if (priv->icon_context_menu == NULL)
- priv->icon_context_menu = gnome_popup_menu_new
- (icon_context_menu_info);
-
- return priv->icon_context_menu;
-}
-
-static void
-popup_icon_context_menu (EMsgComposerAttachmentBar *bar,
- gint num,
- GdkEventButton *event)
-{
- GtkWidget *menu;
-
- menu = get_icon_context_menu (bar);
- gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar);
-}
-
-static GnomeUIInfo context_menu_info[] = {
- GNOMEUIINFO_ITEM (N_("Add attachment..."),
- N_("Attach a file to the message"),
- add_cb, NULL),
- GNOMEUIINFO_END
-};
-
-static GtkWidget *
-get_context_menu (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposerAttachmentBarPrivate *priv;
-
- priv = bar->priv;
- if (priv->context_menu == NULL)
- priv->context_menu = gnome_popup_menu_new (context_menu_info);
-
- return priv->context_menu;
-}
-
-static void
-popup_context_menu (EMsgComposerAttachmentBar *bar,
- GdkEventButton *event)
-{
- GtkWidget *menu;
-
- menu = get_context_menu (bar);
- gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar);
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- EMsgComposerAttachmentBar *bar;
-
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (object);
-
- free_attachment_list (bar);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-/* GtkWidget methods. */
-
-static gint
-button_press_event (GtkWidget *widget,
- GdkEventButton *event)
-{
- EMsgComposerAttachmentBar *bar;
- GnomeIconList *icon_list;
- gint icon_number;
-
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (widget);
- icon_list = GNOME_ICON_LIST (widget);
-
- if (event->button != 3)
- return GTK_WIDGET_CLASS (parent_class)->button_press_event
- (widget, event);
-
- icon_number = gnome_icon_list_get_icon_at (icon_list,
- event->x, event->y);
-
- if (icon_number >= 0) {
- gnome_icon_list_select_icon (icon_list, icon_number);
- popup_icon_context_menu (bar, icon_number, event);
- } else {
- popup_context_menu (bar, event);
- }
-
- return TRUE;
-}
-
-
-/* GnomeIconList methods. */
-
-static gboolean
-text_changed (GnomeIconList *gil,
- gint num,
- const gchar *new_text)
-{
- EMsgComposerAttachmentBar *bar;
- EMsgComposerAttachment *attachment;
- GList *p;
-
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (gil);
- p = g_list_nth (bar->priv->attachments, num);
- attachment = p->data;
-
- g_free (attachment->description);
- attachment->description = g_strdup (new_text);
-
- return TRUE;
-}
-
-
-/* Initialization. */
-
-static void
-class_init (EMsgComposerAttachmentBarClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GnomeIconListClass *icon_list_class;
-
- object_class = GTK_OBJECT_CLASS (class);
- widget_class = GTK_WIDGET_CLASS (class);
- icon_list_class = GNOME_ICON_LIST_CLASS (class);
-
- parent_class = gtk_type_class (gnome_icon_list_get_type ());
-
- object_class->destroy = destroy;
-
- widget_class->button_press_event = button_press_event;
-
- icon_list_class->text_changed = text_changed;
-
- /* Setup signals. */
-
- signals[CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerAttachmentBarClass,
- changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-init (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposerAttachmentBarPrivate *priv;
- guint icon_size;
-
- priv = g_new (EMsgComposerAttachmentBarPrivate, 1);
-
- priv->attachments = NULL;
- priv->context_menu = NULL;
- priv->icon_context_menu = NULL;
-
- priv->num_attachments = 0;
-
- bar->priv = priv;
-
- /* FIXME partly hardcoded. We should compute height from the font, and
- allow at least 2 lines for every item. */
- icon_size = ICON_WIDTH + ICON_SPACING + ICON_BORDER + ICON_TEXT_SPACING;
- icon_size += 24;
-
- gtk_widget_set_usize (GTK_WIDGET (bar), icon_size * 4, icon_size);
-}
-
-
-GtkType
-e_msg_composer_attachment_bar_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "EMsgComposerAttachmentBar",
- sizeof (EMsgComposerAttachmentBar),
- sizeof (EMsgComposerAttachmentBarClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gnome_icon_list_get_type (), &info);
- }
-
- return type;
-}
-
-GtkWidget *
-e_msg_composer_attachment_bar_new (GtkAdjustment *adj)
-{
- EMsgComposerAttachmentBar *new;
- GnomeIconList *icon_list;
-
- gtk_widget_push_visual (gdk_imlib_get_visual ());
- gtk_widget_push_colormap (gdk_imlib_get_colormap ());
- new = gtk_type_new (e_msg_composer_attachment_bar_get_type ());
- gtk_widget_pop_visual ();
- gtk_widget_pop_colormap ();
-
- icon_list = GNOME_ICON_LIST (new);
-
- gnome_icon_list_construct (icon_list, ICON_WIDTH, adj, 0);
-
- gnome_icon_list_set_separators (icon_list, ICON_SEPARATORS);
- gnome_icon_list_set_row_spacing (icon_list, ICON_ROW_SPACING);
- gnome_icon_list_set_col_spacing (icon_list, ICON_COL_SPACING);
- gnome_icon_list_set_icon_border (icon_list, ICON_BORDER);
- gnome_icon_list_set_text_spacing (icon_list, ICON_TEXT_SPACING);
- gnome_icon_list_set_selection_mode (icon_list, GTK_SELECTION_MULTIPLE);
-
- return GTK_WIDGET (new);
-}
-
-
-static void
-attach_to_multipart (CamelMultipart *multipart,
- EMsgComposerAttachment *attachment)
-{
- CamelMimeBodyPart *part;
-
- /* FIXME encoding etc. etc. ? */
- /* FIXME I am not sure how to add an attachment through the Camel
- API. :-/ */
-
- part = camel_mime_body_part_new ();
- camel_mime_part_set_disposition (CAMEL_MIME_PART (part), "attachment");
- camel_mime_part_set_filename (CAMEL_MIME_PART (part),
- g_strdup (g_basename (attachment->file_name)));
- camel_mime_part_set_description (CAMEL_MIME_PART (part),
- g_strdup (attachment->description));
- camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (part),
- g_strdup (attachment->mime_type));
-}
-
-void
-e_msg_composer_attachment_bar_to_multipart (EMsgComposerAttachmentBar *bar,
- CamelMultipart *multipart)
-{
- EMsgComposerAttachmentBarPrivate *priv;
- GList *p;
-
- g_return_if_fail (bar != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar));
- g_return_if_fail (multipart != NULL);
- g_return_if_fail (CAMEL_IS_MULTIPART (multipart));
-
- priv = bar->priv;
-
- for (p = priv->attachments; p != NULL; p = p->next) {
- EMsgComposerAttachment *attachment;
-
- attachment = E_MSG_COMPOSER_ATTACHMENT (p->data);
- attach_to_multipart (multipart, attachment);
- }
-}
-
-
-guint
-e_msg_composer_attachment_bar_get_num_attachments (EMsgComposerAttachmentBar *bar)
-{
- g_return_val_if_fail (bar != NULL, 0);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar), 0);
-
- return bar->priv->num_attachments;
-}
-
-
-void
-e_msg_composer_attachment_bar_attach (EMsgComposerAttachmentBar *bar,
- const gchar *file_name)
-{
- g_return_if_fail (bar != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar));
-
- if (file_name == NULL)
- add_from_user (bar);
- else
- add_from_file (bar, file_name);
-}
diff --git a/composer/e-msg-composer-attachment-bar.h b/composer/e-msg-composer-attachment-bar.h
deleted file mode 100644
index 803b51a954..0000000000
--- a/composer/e-msg-composer-attachment-bar.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* msg-composer-attachment-bar.h
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef __E_MSG_COMPOSER_ATTACHMENT_BAR_H__
-#define __E_MSG_COMPOSER_ATTACHMENT_BAR_H__
-
-#include <gnome.h>
-#include <camel/camel-multipart.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_MSG_COMPOSER_ATTACHMENT_BAR \
- (e_msg_composer_attachment_bar_get_type ())
-#define E_MSG_COMPOSER_ATTACHMENT_BAR(obj) \
- (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT_BAR, EMsgComposerAttachmentBar))
-#define E_MSG_COMPOSER_ATTACHMENT_BAR_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER_ATTACHMENT_BAR, EMsgComposerAttachmentBarClass))
-#define E_IS_MSG_COMPOSER_ATTACHMENT_BAR(obj) \
- (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT_BAR))
-#define E_IS_MSG_COMPOSER_ATTACHMENT_BAR_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT_BAR))
-
-
-typedef struct _EMsgComposerAttachmentBarPrivate EMsgComposerAttachmentBarPrivate;
-
-struct _EMsgComposerAttachmentBar {
- GnomeIconList parent;
-
- EMsgComposerAttachmentBarPrivate *priv;
-};
-typedef struct _EMsgComposerAttachmentBar EMsgComposerAttachmentBar;
-
-struct _EMsgComposerAttachmentBarClass {
- GnomeIconListClass parent_class;
-
- void (* changed) (EMsgComposerAttachmentBar *bar);
-};
-typedef struct _EMsgComposerAttachmentBarClass EMsgComposerAttachmentBarClass;
-
-
-GtkType e_msg_composer_attachment_bar_get_type (void);
-GtkWidget *e_msg_composer_attachment_bar_new (GtkAdjustment *adj);
-void e_msg_composer_attachment_bar_to_multipart (EMsgComposerAttachmentBar *bar, CamelMultipart *multipart);
-guint e_msg_composer_attachment_bar_get_num_attachments (EMsgComposerAttachmentBar *bar);
-void e_msg_composer_attachment_bar_attach (EMsgComposerAttachmentBar *bar, const gchar *file_name);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_MSG_COMPOSER_ATTACHMENT_BAR_H__ */
diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c
deleted file mode 100644
index f4741d987f..0000000000
--- a/composer/e-msg-composer-attachment.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-attachment.c
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-/* This is the object representing an email attachment. It is implemented as a
- GtkObject to make it easier for the application to handle it. For example,
- the "changed" signal is emitted whenever something changes in the
- attachment. Also, this contains the code to let users edit the
- attachment manually. */
-
-#include <sys/stat.h>
-
-#include <gnome.h>
-
-#include "e-msg-composer-attachment.h"
-
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static GtkObjectClass *parent_class = NULL;
-
-
-/* Utility functions. */
-
-static const gchar *
-get_mime_type (const gchar *file_name)
-{
- const gchar *mime_type;
-
- mime_type = gnome_mime_type_of_file (file_name);
- if (mime_type == NULL)
- mime_type = "application/octet-stream";
-
- return mime_type;
-}
-
-static void
-init_mime_type (EMsgComposerAttachment *attachment)
-{
- attachment->mime_type = g_strdup (get_mime_type (attachment->file_name));
-}
-
-static void
-set_mime_type (EMsgComposerAttachment *attachment)
-{
- g_free (attachment->mime_type);
- init_mime_type (attachment);
-}
-
-static void
-changed (EMsgComposerAttachment *attachment)
-{
- gtk_signal_emit (GTK_OBJECT (attachment), signals[CHANGED]);
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- EMsgComposerAttachment *attachment;
-
- attachment = E_MSG_COMPOSER_ATTACHMENT (object);
-
- g_free (attachment->file_name);
- g_free (attachment->description);
- g_free (attachment->mime_type);
-}
-
-
-/* Signals. */
-
-static void
-real_changed (EMsgComposerAttachment *msg_composer_attachment)
-{
- g_return_if_fail (msg_composer_attachment != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT (msg_composer_attachment));
-}
-
-
-static void
-class_init (EMsgComposerAttachmentClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- object_class->destroy = destroy;
-
- signals[CHANGED] = gtk_signal_new ("changed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET
- (EMsgComposerAttachmentClass,
- changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-
- klass->changed = real_changed;
-}
-
-static void
-init (EMsgComposerAttachment *msg_composer_attachment)
-{
- msg_composer_attachment->editor_gui = NULL;
- msg_composer_attachment->file_name = NULL;
- msg_composer_attachment->description = NULL;
- msg_composer_attachment->mime_type = NULL;
- msg_composer_attachment->size = 0;
-}
-
-GtkType
-e_msg_composer_attachment_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "EMsgComposerAttachment",
- sizeof (EMsgComposerAttachment),
- sizeof (EMsgComposerAttachmentClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-
-/**
- * e_msg_composer_attachment_new:
- * @file_name:
- *
- * Return value:
- **/
-EMsgComposerAttachment *
-e_msg_composer_attachment_new (const gchar *file_name)
-{
- EMsgComposerAttachment *new;
- struct stat statbuf;
-
- g_return_val_if_fail (file_name != NULL, NULL);
-
- new = gtk_type_new (e_msg_composer_attachment_get_type ());
-
- new->editor_gui = NULL;
-
- new->file_name = g_strdup (file_name);
- new->description = g_strdup (g_basename (new->file_name));
-
- if (stat (file_name, &statbuf) < 0)
- new->size = 0;
- else
- new->size = statbuf.st_size;
-
- init_mime_type (new);
-
- return new;
-}
-
-
-/* The attachment property dialog. */
-
-struct _DialogData {
- GtkWidget *dialog;
- GtkEntry *file_name_entry;
- GtkEntry *description_entry;
- GtkEntry *mime_type_entry;
- GtkWidget *browse_widget;
- EMsgComposerAttachment *attachment;
-};
-typedef struct _DialogData DialogData;
-
-static void
-destroy_dialog_data (DialogData *data)
-{
- if (data->browse_widget != NULL)
- gtk_widget_destroy (data->browse_widget);
- g_free (data);
-}
-
-static void
-update_mime_type (DialogData *data)
-{
- const gchar *mime_type;
- const gchar *file_name;
-
- file_name = gtk_entry_get_text (data->file_name_entry);
- mime_type = get_mime_type (file_name);
-
- gtk_entry_set_text (data->mime_type_entry, mime_type);
-}
-
-static void
-browse_ok_cb (GtkWidget *widget,
- gpointer data)
-{
- GtkWidget *file_selection;
- DialogData *dialog_data;
- const gchar *file_name;
-
- dialog_data = (DialogData *) data;
- file_selection = gtk_widget_get_toplevel (widget);
-
- file_name = gtk_file_selection_get_filename
- (GTK_FILE_SELECTION (file_selection));
-
- gtk_entry_set_text (dialog_data->file_name_entry, file_name);
-
- update_mime_type (dialog_data);
-
- gtk_widget_hide (file_selection);
-}
-
-static void
-browse (DialogData *data)
-{
- if (data->browse_widget == NULL) {
- GtkWidget *file_selection;
- GtkWidget *cancel_button;
- GtkWidget *ok_button;
-
- file_selection
- = gtk_file_selection_new (_("Select attachment"));
- gtk_window_set_position (GTK_WINDOW (file_selection),
- GTK_WIN_POS_MOUSE);
- gtk_window_set_transient_for (GTK_WINDOW (file_selection),
- GTK_WINDOW (data->dialog));
-
- ok_button = GTK_FILE_SELECTION (file_selection)->ok_button;
- gtk_signal_connect (GTK_OBJECT (ok_button),
- "clicked", GTK_SIGNAL_FUNC (browse_ok_cb),
- data);
-
- cancel_button
- = GTK_FILE_SELECTION (file_selection)->cancel_button;
- gtk_signal_connect_object (GTK_OBJECT (cancel_button),
- "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_hide),
- GTK_OBJECT (file_selection));
-
- data->browse_widget = file_selection;
- }
-
- gtk_widget_show (GTK_WIDGET (data->browse_widget));
-}
-
-static void
-set_entry (GladeXML *xml,
- const gchar *widget_name,
- const gchar *value)
-{
- GtkEntry *entry;
-
- entry = GTK_ENTRY (glade_xml_get_widget (xml, widget_name));
- if (entry == NULL)
- g_warning ("Entry for `%s' not found.", widget_name);
- gtk_entry_set_text (entry, value);
-}
-
-static void
-connect_entry_changed (GladeXML *gui,
- const gchar *name,
- GtkSignalFunc func,
- gpointer data)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget (gui, name);
- gtk_signal_connect (GTK_OBJECT (widget), "changed", func, data);
-}
-
-static void
-connect_widget (GladeXML *gui,
- const gchar *name,
- const gchar *signal_name,
- GtkSignalFunc func,
- gpointer data)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget (gui, name);
- gtk_signal_connect (GTK_OBJECT (widget), signal_name, func, data);
-}
-
-static void
-apply (DialogData *data)
-{
- EMsgComposerAttachment *attachment;
-
- attachment = data->attachment;
-
- g_free (attachment->file_name);
- attachment->file_name = g_strdup (gtk_entry_get_text
- (data->file_name_entry));
-
- g_free (attachment->description);
- attachment->description = g_strdup (gtk_entry_get_text
- (data->description_entry));
-
- g_free (attachment->mime_type);
- attachment->mime_type = g_strdup (gtk_entry_get_text
- (data->mime_type_entry));
-
- changed (attachment);
-}
-
-static void
-entry_changed_cb (GtkWidget *widget, gpointer data)
-{
- DialogData *dialog_data;
- GladeXML *gui;
- GtkWidget *apply_button;
-
- dialog_data = (DialogData *) data;
- gui = dialog_data->attachment->editor_gui;
-
- apply_button = glade_xml_get_widget (gui, "apply_button");
- gtk_widget_set_sensitive (apply_button, TRUE);
-}
-
-static void
-close_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposerAttachment *attachment;
- DialogData *dialog_data;
-
- dialog_data = (DialogData *) data;
- attachment = dialog_data->attachment;
-
- gtk_widget_destroy (glade_xml_get_widget (attachment->editor_gui,
- "dialog"));
- gtk_object_unref (GTK_OBJECT (attachment->editor_gui));
- attachment->editor_gui = NULL;
-
- destroy_dialog_data (dialog_data);
-}
-
-static void
-apply_cb (GtkWidget *widget,
- gpointer data)
-{
- DialogData *dialog_data;
-
- dialog_data = (DialogData *) data;
- apply (dialog_data);
-}
-
-static void
-ok_cb (GtkWidget *widget,
- gpointer data)
-{
- apply_cb (widget, data);
- close_cb (widget, data);
-}
-
-static void
-browse_cb (GtkWidget *widget,
- gpointer data)
-{
- DialogData *dialog_data;
-
- dialog_data = (DialogData *) data;
- browse (dialog_data);
-}
-
-static void
-file_name_focus_out_cb (GtkWidget *widget,
- GdkEventFocus *event,
- gpointer data)
-{
- DialogData *dialog_data;
-
- dialog_data = (DialogData *) data;
- update_mime_type (dialog_data);
-}
-
-
-void
-e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
- GtkWidget *parent)
-{
- DialogData *dialog_data;
- GladeXML *editor_gui;
-
- g_return_if_fail (attachment != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT (attachment));
-
- if (attachment->editor_gui != NULL) {
- GtkWidget *window;
-
- window = glade_xml_get_widget (attachment->editor_gui,
- "dialog");
- gdk_window_show (window->window);
- return;
- }
-
- editor_gui = glade_xml_new (E_GLADEDIR "/e-msg-composer-attachment.glade",
- NULL);
- if (editor_gui == NULL) {
- g_warning ("Cannot load `e-msg-composer-attachment.glade'");
- return;
- }
-
- attachment->editor_gui = editor_gui;
-
- gtk_window_set_transient_for
- (GTK_WINDOW (glade_xml_get_widget (editor_gui, "dialog")),
- GTK_WINDOW (gtk_widget_get_toplevel (parent)));
-
- dialog_data = g_new (DialogData, 1);
- dialog_data->browse_widget = NULL;
- dialog_data->attachment = attachment;
- dialog_data->dialog = glade_xml_get_widget (editor_gui, "dialog");
- dialog_data->file_name_entry = GTK_ENTRY (glade_xml_get_widget
- (editor_gui,
- "file_name_entry"));
- dialog_data->description_entry = GTK_ENTRY (glade_xml_get_widget
- (editor_gui,
- "description_entry"));
- dialog_data->mime_type_entry = GTK_ENTRY (glade_xml_get_widget
- (editor_gui,
- "mime_type_entry"));
-
- if (attachment != NULL) {
- set_entry (editor_gui, "file_name_entry", attachment->file_name);
- set_entry (editor_gui, "description_entry", attachment->description);
- set_entry (editor_gui, "mime_type_entry", attachment->mime_type);
- }
-
- connect_entry_changed (editor_gui, "file_name_entry",
- entry_changed_cb, dialog_data);
- connect_entry_changed (editor_gui, "description_entry",
- entry_changed_cb, dialog_data);
-
- connect_widget (editor_gui, "ok_button", "clicked", ok_cb, dialog_data);
- connect_widget (editor_gui, "apply_button", "clicked", apply_cb, dialog_data);
- connect_widget (editor_gui, "close_button", "clicked", close_cb, dialog_data);
-
- connect_widget (editor_gui, "browse_button", "clicked", browse_cb, dialog_data);
-
- connect_widget (editor_gui, "file_name_entry", "focus_out_event",
- file_name_focus_out_cb, dialog_data);
-}
diff --git a/composer/e-msg-composer-attachment.glade b/composer/e-msg-composer-attachment.glade
deleted file mode 100644
index 72c0132639..0000000000
--- a/composer/e-msg-composer-attachment.glade
+++ /dev/null
@@ -1,290 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>e-msg-composer-attachment</name>
- <program_name>e-msg-composer-attachment</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>False</use_widget_names>
- <output_main_file>True</output_main_file>
- <output_support_files>True</output_support_files>
- <output_build_files>True</output_build_files>
- <backup_source_files>True</backup_source_files>
- <main_source_file>interface.c</main_source_file>
- <main_header_file>interface.h</main_header_file>
- <handler_source_file>callbacks.c</handler_source_file>
- <handler_header_file>callbacks.h</handler_header_file>
- <support_source_file>support.c</support_source_file>
- <support_header_file>support.h</support_header_file>
- <translatable_strings_file></translatable_strings_file>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog</name>
- <title>Attachment properties</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkTable</class>
- <name>table1</name>
- <rows>3</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>10</row_spacing>
- <column_spacing>5</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <label>Description:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>False</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label3</name>
- <label>MIME type:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>False</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>description_entry</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label2</name>
- <label>File name:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>False</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox3</name>
- <homogeneous>False</homogeneous>
- <spacing>10</spacing>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>True</xshrink>
- <yshrink>True</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <name>file_name_entry</name>
- <width>290</width>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>browse_button</name>
- <width>80</width>
- <can_focus>True</can_focus>
- <label>Browse...</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>mime_type_entry</name>
- <sensitive>False</sensitive>
- <can_focus>True</can_focus>
- <editable>False</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>ok_button</name>
- <can_default>True</can_default>
- <has_default>True</has_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>apply_button</name>
- <sensitive>False</sensitive>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>close_button</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/composer/e-msg-composer-attachment.h b/composer/e-msg-composer-attachment.h
deleted file mode 100644
index 7e3c88238b..0000000000
--- a/composer/e-msg-composer-attachment.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-attachment.h
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-#ifndef __E_MSG_COMPOSER_ATTACHMENT_H__
-#define __E_MSG_COMPOSER_ATTACHMENT_H__
-
-#include <gnome.h>
-#include <glade/glade-xml.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_MSG_COMPOSER_ATTACHMENT (e_msg_composer_attachment_get_type ())
-#define E_MSG_COMPOSER_ATTACHMENT(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT, EMsgComposerAttachment))
-#define E_MSG_COMPOSER_ATTACHMENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER_ATTACHMENT, EMsgComposerAttachmentClass))
-#define E_IS_MSG_COMPOSER_ATTACHMENT(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT))
-#define E_IS_MSG_COMPOSER_ATTACHMENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT))
-
-
-typedef struct _EMsgComposerAttachment EMsgComposerAttachment;
-typedef struct _EMsgComposerAttachmentClass EMsgComposerAttachmentClass;
-
-struct _EMsgComposerAttachment {
- GtkObject parent;
-
- GladeXML *editor_gui;
-
- gchar *file_name;
- gchar *description;
- gchar *mime_type;
-
- gulong size;
-};
-
-struct _EMsgComposerAttachmentClass {
- GtkObjectClass parent_class;
-
- void (*changed) (EMsgComposerAttachment *msg_composer_attachment);
-};
-
-
-GtkType e_msg_composer_attachment_get_type (void);
-EMsgComposerAttachment *e_msg_composer_attachment_new (const gchar *file_name);
-void e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
- GtkWidget *parent);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_MSG_COMPOSER_ATTACHMENT_H__ */
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c
deleted file mode 100644
index 2c27531bb8..0000000000
--- a/composer/e-msg-composer-hdrs.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* msg-composer-hdrs.c
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef _HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gnome.h>
-#include <camel/camel.h>
-
-#include "e-msg-composer-address-entry.h"
-#include "e-msg-composer-hdrs.h"
-
-
-struct _EMsgComposerHdrsPrivate {
- /* Total number of headers that we have. */
- guint num_hdrs;
-
- /* The tooltips. */
- GtkTooltips *tooltips;
-
- /* Standard headers. */
- GtkWidget *to_entry;
- GtkWidget *cc_entry;
- GtkWidget *bcc_entry;
- GtkWidget *subject_entry;
-};
-
-
-static GtkTableClass *parent_class = NULL;
-
-enum {
- SHOW_ADDRESS_DIALOG,
- LAST_SIGNAL
-};
-
-static gint signals[LAST_SIGNAL];
-
-
-static void
-address_button_clicked_cb (GtkButton *button,
- gpointer data)
-{
- gtk_signal_emit (GTK_OBJECT (data), signals[SHOW_ADDRESS_DIALOG]);
-}
-
-static GtkWidget *
-add_header (EMsgComposerHdrs *hdrs,
- const gchar *name,
- const gchar *tip,
- const gchar *tip_private,
- gboolean addrbook_button)
-{
- EMsgComposerHdrsPrivate *priv;
- GtkWidget *label;
- GtkWidget *entry;
- guint pad;
-
- priv = hdrs->priv;
-
- if (addrbook_button) {
- label = gtk_button_new_with_label (name);
- gtk_signal_connect (GTK_OBJECT (label), "clicked",
- GTK_SIGNAL_FUNC (address_button_clicked_cb),
- hdrs);
- pad = 2;
- gtk_tooltips_set_tip (hdrs->priv->tooltips, label,
- _("Click here for the address book"),
- NULL);
- } else {
- label = gtk_label_new (name);
- pad = GNOME_PAD;
- }
-
- gtk_table_attach (GTK_TABLE (hdrs), label,
- 0, 1, priv->num_hdrs, priv->num_hdrs + 1,
- GTK_FILL, GTK_FILL,
- pad, pad);
- gtk_widget_show (label);
-
- entry = e_msg_composer_address_entry_new ();
- gtk_table_attach (GTK_TABLE (hdrs), entry,
- 1, 2, priv->num_hdrs, priv->num_hdrs + 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL,
- 2, 2);
- gtk_widget_show (entry);
-
- gtk_tooltips_set_tip (hdrs->priv->tooltips, entry, tip, tip_private);
-
- priv->num_hdrs++;
-
- return entry;
-}
-
-static void
-setup_headers (EMsgComposerHdrs *hdrs)
-{
- EMsgComposerHdrsPrivate *priv;
-
- priv = hdrs->priv;
-
- priv->to_entry = add_header
- (hdrs, _("To:"),
- _("Enter the recipients of the message"),
- NULL,
- TRUE);
- priv->cc_entry = add_header
- (hdrs, _("Cc:"),
- _("Enter the addresses that will receive a carbon copy of "
- "the message"),
- NULL,
- TRUE);
- priv->bcc_entry = add_header
- (hdrs, _("Bcc:"),
- _("Enter the addresses that will receive a carbon copy of "
- "the message without appearing in the recipient list of "
- "the message."),
- NULL,
- TRUE);
- priv->subject_entry = add_header
- (hdrs, _("Subject:"),
- _("Enter the subject of the mail"),
- NULL,
- FALSE);
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- EMsgComposerHdrs *hdrs;
- EMsgComposerHdrsPrivate *priv;
-
- hdrs = E_MSG_COMPOSER_HDRS (object);
- priv = hdrs->priv;
-
- gtk_object_destroy (GTK_OBJECT (priv->tooltips));
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-static void
-class_init (EMsgComposerHdrsClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (class);
- object_class->destroy = destroy;
-
- parent_class = gtk_type_class (gtk_table_get_type ());
-
- signals[SHOW_ADDRESS_DIALOG] =
- gtk_signal_new ("show_address_dialog",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerHdrsClass,
- show_address_dialog),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-init (EMsgComposerHdrs *hdrs)
-{
- EMsgComposerHdrsPrivate *priv;
-
- priv = g_new (EMsgComposerHdrsPrivate, 1);
-
- priv->to_entry = NULL;
- priv->cc_entry = NULL;
- priv->bcc_entry = NULL;
- priv->subject_entry = NULL;
-
- priv->tooltips = gtk_tooltips_new ();
-
- priv->num_hdrs = 0;
-
- hdrs->priv = priv;
-}
-
-
-GtkType
-e_msg_composer_hdrs_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "EMsgComposerHdrs",
- sizeof (EMsgComposerHdrs),
- sizeof (EMsgComposerHdrsClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gtk_table_get_type (), &info);
- }
-
- return type;
-}
-
-GtkWidget *
-e_msg_composer_hdrs_new (void)
-{
- EMsgComposerHdrs *new;
-
- new = gtk_type_new (e_msg_composer_hdrs_get_type ());
-
- setup_headers (E_MSG_COMPOSER_HDRS (new));
-
- return GTK_WIDGET (new);
-}
-
-
-static void
-set_recipients (CamelMimeMessage *msg,
- GtkWidget *entry_widget,
- const gchar *type)
-{
- EMsgComposerAddressEntry *entry;
- GList *list;
- GList *p;
-
- entry = E_MSG_COMPOSER_ADDRESS_ENTRY (entry_widget);
- list = e_msg_composer_address_entry_get_addresses (entry);
-
- /* FIXME leak? */
-
- for (p = list; p != NULL; p = p->next) {
- printf ("Adding `%s:' header: %s\n", type, (gchar *) p->data);
- camel_mime_message_add_recipient (msg, type, (gchar *) p->data);
- }
-
- g_list_free (list);
-}
-
-void
-e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
- CamelMimeMessage *msg)
-{
- const gchar *s;
-
- g_return_if_fail (hdrs != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
- g_return_if_fail (msg != NULL);
- g_return_if_fail (CAMEL_IS_MIME_MESSAGE (msg));
-
- s = gtk_entry_get_text (GTK_ENTRY (hdrs->priv->subject_entry));
- camel_mime_message_set_subject (msg, g_strdup (s));
-
- set_recipients (msg, hdrs->priv->to_entry, CAMEL_RECIPIENT_TYPE_TO);
- set_recipients (msg, hdrs->priv->cc_entry, CAMEL_RECIPIENT_TYPE_CC);
- set_recipients (msg, hdrs->priv->bcc_entry, CAMEL_RECIPIENT_TYPE_BCC);
-}
-
-
-void
-e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs,
- GList *to_list)
-{
- EMsgComposerAddressEntry *entry;
-
- g_return_if_fail (hdrs != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
- entry = E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->to_entry);
- e_msg_composer_address_entry_set_list (entry, to_list);
-}
-
-void
-e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs,
- GList *cc_list)
-{
- EMsgComposerAddressEntry *entry;
-
- g_return_if_fail (hdrs != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
- entry = E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->cc_entry);
- e_msg_composer_address_entry_set_list (entry, cc_list);
-}
-
-void
-e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs,
- GList *bcc_list)
-{
- EMsgComposerAddressEntry *entry;
-
- g_return_if_fail (hdrs != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
- entry = E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->bcc_entry);
- e_msg_composer_address_entry_set_list (entry, bcc_list);
-}
-
-
-GList *
-e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs)
-{
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- return e_msg_composer_address_entry_get_addresses
- (E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->to_entry));
-}
-
-GList *
-e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs)
-{
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- return e_msg_composer_address_entry_get_addresses
- (E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->cc_entry));
-}
-
-GList *
-e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs)
-{
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- return e_msg_composer_address_entry_get_addresses
- (E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->bcc_entry));
-}
-
diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h
deleted file mode 100644
index d053573d85..0000000000
--- a/composer/e-msg-composer-hdrs.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* msg-composer-hdrs.h
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef ___E_MSG_COMPOSER_HDRS_H__
-#define ___E_MSG_COMPOSER_HDRS_H__
-
-#include <gnome.h>
-#include <camel/camel-mime-message.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_MSG_COMPOSER_HDRS (e_msg_composer_hdrs_get_type ())
-#define E_MSG_COMPOSER_HDRS(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER_HDRS, EMsgComposerHdrs))
-#define E_MSG_COMPOSER_HDRS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER_HDRS, EMsgComposerHdrsClass))
-#define E_IS_MSG_COMPOSER_HDRS(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER_HDRS))
-#define E_IS_MSG_COMPOSER_HDRS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER_HDRS))
-
-
-typedef struct _EMsgComposerHdrs EMsgComposerHdrs;
-typedef struct _EMsgComposerHdrsClass EMsgComposerHdrsClass;
-typedef struct _EMsgComposerHdrsPrivate EMsgComposerHdrsPrivate;
-
-struct _EMsgComposerHdrs {
- GtkTable parent;
-
- EMsgComposerHdrsPrivate *priv;
-};
-
-struct _EMsgComposerHdrsClass {
- GtkTableClass parent_class;
-
- void (* show_address_dialog) (EMsgComposerHdrs *hdrs);
-};
-
-
-GtkType e_msg_composer_hdrs_get_type (void);
-GtkWidget *e_msg_composer_hdrs_new (void);
-void e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
- CamelMimeMessage *msg);
-
-void e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs,
- GList *to_list);
-void e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs,
- GList *cc_list);
-void e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs,
- GList *bcc_list);
-
-GList *e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs);
-GList *e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs);
-GList *e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs);
-
-#ifdef _cplusplus
-}
-#endif /* _cplusplus */
-
-
-#endif /* __E_MSG_COMPOSER_HDRS_H__ */
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
deleted file mode 100644
index f4271ea7e6..0000000000
--- a/composer/e-msg-composer.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer.c
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-/*
-
- TODO
-
- - Somehow users should be able to see if any file(s) are attached even when
- the attachment bar is not shown.
-
-*/
-
-#ifdef _HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gnome.h>
-#include <glade/glade.h>
-#include <camel/camel.h>
-
-#include "e-msg-composer.h"
-#include "e-msg-composer-address-dialog.h"
-#include "e-msg-composer-attachment-bar.h"
-#include "e-msg-composer-hdrs.h"
-
-
-#define DEFAULT_WIDTH 600
-#define DEFAULT_HEIGHT 500
-
-
-enum {
- SEND,
- POSTPONE,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static GnomeAppClass *parent_class = NULL;
-
-
-static void
-free_string_list (GList *list)
-{
- GList *p;
-
- if (list == NULL)
- return;
-
- for (p = list; p != NULL; p = p->next)
- g_free (p->data);
-
- g_list_free (list);
-}
-
-/* This functions builds a CamelMimeMessage for the message that the user has
- composed in `composer'. */
-static CamelMimeMessage *
-build_message (EMsgComposer *composer)
-{
- CamelMimeMessage *new;
- CamelMimeBodyPart *body_part;
- CamelMultipart *multipart;
- gchar *text;
-
- new = camel_mime_message_new_with_session (NULL);
-
- e_msg_composer_hdrs_to_message (E_MSG_COMPOSER_HDRS (composer->hdrs),
- new);
-
- multipart = camel_multipart_new ();
- body_part = camel_mime_body_part_new ();
-
- text = gtk_editable_get_chars (GTK_EDITABLE (composer->text), 0, -1);
- camel_mime_part_set_text (CAMEL_MIME_PART (body_part), text);
- camel_multipart_add_part (multipart, body_part);
-
- e_msg_composer_attachment_bar_to_multipart
- (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar),
- multipart);
-
- camel_medium_set_content_object (CAMEL_MEDIUM (new),
- CAMEL_DATA_WRAPPER (multipart));
-
- /* FIXME refcounting is most certainly wrong. We want all the stuff to
- be destroyed when we unref() the message. */
-
- return new;
-}
-
-
-static void
-show_attachments (EMsgComposer *composer,
- gboolean show)
-{
- if (show) {
- gtk_widget_show (composer->attachment_scrolled_window);
- gtk_widget_show (composer->attachment_bar);
- } else {
- gtk_widget_hide (composer->attachment_scrolled_window);
- gtk_widget_hide (composer->attachment_bar);
- }
-
- composer->attachment_bar_visible = show;
-
- /* Update the GUI. */
-
- gtk_check_menu_item_set_active
- (GTK_CHECK_MENU_ITEM
- (glade_xml_get_widget (composer->menubar_gui,
- "menu_view_attachments")),
- show);
-
- /* XXX we should update the toggle toolbar item as well. At
- this point, it is not a toggle because Glade is broken. */
-}
-
-
-/* Address dialog callbacks. */
-
-static void
-address_dialog_destroy_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (data);
- composer->address_dialog = NULL;
-}
-
-static void
-address_dialog_apply_cb (EMsgComposerAddressDialog *dialog,
- gpointer data)
-{
- EMsgComposerHdrs *hdrs;
- GList *list;
-
- hdrs = E_MSG_COMPOSER_HDRS (E_MSG_COMPOSER (data)->hdrs);
-
- list = e_msg_composer_address_dialog_get_to_list (dialog);
- e_msg_composer_hdrs_set_to (hdrs, list);
-
- list = e_msg_composer_address_dialog_get_cc_list (dialog);
- e_msg_composer_hdrs_set_cc (hdrs, list);
-
- list = e_msg_composer_address_dialog_get_bcc_list (dialog);
- e_msg_composer_hdrs_set_bcc (hdrs, list);
-}
-
-
-/* Message composer window callbacks. */
-
-static void
-send_cb (GtkWidget *widget,
- gpointer data)
-{
- gtk_signal_emit (GTK_OBJECT (data), signals[SEND]);
-}
-
-static void
-menu_view_attachments_activate_cb (GtkWidget *widget,
- gpointer data)
-{
- e_msg_composer_show_attachments (E_MSG_COMPOSER (data),
- GTK_CHECK_MENU_ITEM (widget)->active);
-}
-
-static void
-toolbar_view_attachments_clicked_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (data);
-
- e_msg_composer_show_attachments (composer,
- ! composer->attachment_bar_visible);
-}
-
-static void
-add_attachment_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (data);
-
- e_msg_composer_attachment_bar_attach
- (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar),
- NULL);
-}
-
-/* Create the address dialog if not created already. */
-static void
-setup_address_dialog (EMsgComposer *composer)
-{
- EMsgComposerAddressDialog *dialog;
- EMsgComposerHdrs *hdrs;
- GList *list;
-
- if (composer->address_dialog != NULL)
- return;
-
- composer->address_dialog = e_msg_composer_address_dialog_new ();
- dialog = E_MSG_COMPOSER_ADDRESS_DIALOG (composer->address_dialog);
- hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs);
-
- gtk_signal_connect (GTK_OBJECT (dialog),
- "destroy", address_dialog_destroy_cb, composer);
- gtk_signal_connect (GTK_OBJECT (dialog),
- "apply", address_dialog_apply_cb, composer);
-
- list = e_msg_composer_hdrs_get_to (hdrs);
- e_msg_composer_address_dialog_set_to_list (dialog, list);
-
- list = e_msg_composer_hdrs_get_cc (hdrs);
- e_msg_composer_address_dialog_set_cc_list (dialog, list);
-
- list = e_msg_composer_hdrs_get_bcc (hdrs);
- e_msg_composer_address_dialog_set_bcc_list (dialog, list);
-}
-
-static void
-address_dialog_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposer *composer;
-
- /* FIXME maybe we should hide the dialog on Cancel/OK instead of
- destroying it. */
-
- composer = E_MSG_COMPOSER (data);
-
- setup_address_dialog (composer);
-
- gtk_widget_show (composer->address_dialog);
- gdk_window_show (composer->address_dialog->window);
-}
-
-static void
-glade_connect (GladeXML *gui,
- const gchar *widget_name,
- const gchar *signal_name,
- GtkSignalFunc callback,
- gpointer callback_data)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget (gui, widget_name);
- if (widget == NULL)
- g_warning ("Widget `%s' was not found.", widget_name);
- else
- gtk_signal_connect (GTK_OBJECT (widget), signal_name,
- GTK_SIGNAL_FUNC (callback), callback_data);
-}
-
-static void
-attachment_bar_changed (EMsgComposerAttachmentBar *bar,
- gpointer data)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (data);
-
- if (e_msg_composer_attachment_bar_get_num_attachments (bar) > 0)
- e_msg_composer_show_attachments (composer, TRUE);
- else
- e_msg_composer_show_attachments (composer, FALSE);
-}
-
-static void
-setup_signals (EMsgComposer *composer)
-{
- glade_connect (composer->menubar_gui, "menu_send",
- "activate", GTK_SIGNAL_FUNC (send_cb), composer);
- glade_connect (composer->toolbar_gui, "toolbar_send",
- "clicked", GTK_SIGNAL_FUNC (send_cb), composer);
-
- glade_connect (composer->menubar_gui, "menu_view_attachments",
- "activate",
- GTK_SIGNAL_FUNC (menu_view_attachments_activate_cb),
- composer);
- glade_connect (composer->toolbar_gui, "toolbar_view_attachments",
- "clicked",
- GTK_SIGNAL_FUNC (toolbar_view_attachments_clicked_cb),
- composer);
-
- glade_connect (composer->menubar_gui, "menu_add_attachment",
- "activate",
- GTK_SIGNAL_FUNC (add_attachment_cb), composer);
- glade_connect (composer->toolbar_gui, "toolbar_add_attachment",
- "clicked",
- GTK_SIGNAL_FUNC (add_attachment_cb), composer);
-
- glade_connect (composer->menubar_gui, "menubar_address_dialog",
- "activate",
- GTK_SIGNAL_FUNC (address_dialog_cb), composer);
- glade_connect (composer->toolbar_gui, "toolbar_address_dialog",
- "clicked",
- GTK_SIGNAL_FUNC (address_dialog_cb), composer);
-
- gtk_signal_connect (GTK_OBJECT (composer->attachment_bar),
- "changed",
- GTK_SIGNAL_FUNC (attachment_bar_changed),
- composer);
-
- gtk_signal_connect (GTK_OBJECT (composer->hdrs), "show_address_dialog",
- GTK_SIGNAL_FUNC (address_dialog_cb),
- composer);
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (object);
-
- gtk_object_unref (GTK_OBJECT (composer->menubar_gui));
- gtk_object_unref (GTK_OBJECT (composer->toolbar_gui));
- gtk_object_unref (GTK_OBJECT (composer->appbar_gui));
-
- if (composer->address_dialog != NULL)
- gtk_widget_destroy (composer->address_dialog);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-static void
-class_init (EMsgComposerClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) klass;
-
- object_class->destroy = destroy;
-
- parent_class = gtk_type_class (gnome_app_get_type ());
-
- signals[SEND] =
- gtk_signal_new ("send",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerClass, send),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- signals[POSTPONE] =
- gtk_signal_new ("postpone",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerClass, postpone),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-init (EMsgComposer *composer)
-{
- composer->menubar_gui = NULL;
- composer->toolbar_gui = NULL;
- composer->appbar_gui = NULL;
-
- composer->hdrs = NULL;
-
- composer->text = NULL;
- composer->text_scrolled_window = NULL;
-
- composer->address_dialog = NULL;
-
- composer->attachment_bar = NULL;
- composer->attachment_scrolled_window = NULL;
-}
-
-
-GtkType
-e_msg_composer_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "EMsgComposer",
- sizeof (EMsgComposer),
- sizeof (EMsgComposerClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gnome_app_get_type (), &info);
- }
-
- return type;
-}
-
-
-/**
- * e_msg_composer_construct:
- * @composer: A message composer widget
- *
- * Construct @composer.
- **/
-void
-e_msg_composer_construct (EMsgComposer *composer)
-{
- GtkWidget *vbox;
-
- gtk_window_set_default_size (GTK_WINDOW (composer),
- DEFAULT_WIDTH, DEFAULT_HEIGHT);
-
- gnome_app_construct (GNOME_APP (composer), "e-msg-composer",
- "Compose a message");
-
- composer->menubar_gui = glade_xml_new (E_GLADEDIR "/e-msg-composer.glade",
- "menubar");
- gnome_app_set_menus (GNOME_APP (composer),
- GTK_MENU_BAR (glade_xml_get_widget (composer->menubar_gui,
- "menubar")));
-
- composer->toolbar_gui = glade_xml_new (E_GLADEDIR "/e-msg-composer.glade",
- "toolbar");
- gnome_app_set_toolbar (GNOME_APP (composer),
- GTK_TOOLBAR (glade_xml_get_widget (composer->toolbar_gui,
- "toolbar")));
-
- composer->appbar_gui = glade_xml_new (E_GLADEDIR "/e-msg-composer.glade",
- "appbar");
- gnome_app_set_statusbar (GNOME_APP (composer),
- glade_xml_get_widget (composer->appbar_gui,
- "appbar"));
-
- vbox = gtk_vbox_new (FALSE, 0);
-
- composer->hdrs = e_msg_composer_hdrs_new ();
- gtk_box_pack_start (GTK_BOX (vbox), composer->hdrs, FALSE, TRUE, 0);
- gtk_widget_show (composer->hdrs);
-
- /* GtkText for message body editing, wrapped into a
- GtkScrolledWindow. */
-
- composer->text_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy
- (GTK_SCROLLED_WINDOW (composer->text_scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- composer->text = gtk_text_new (NULL, NULL);
- gtk_text_set_word_wrap (GTK_TEXT (composer->text), FALSE);
- gtk_text_set_editable (GTK_TEXT (composer->text), TRUE);
- gtk_container_add (GTK_CONTAINER (composer->text_scrolled_window),
- composer->text);
- gtk_widget_show (composer->text);
- gtk_box_pack_start (GTK_BOX (vbox), composer->text_scrolled_window,
- TRUE, TRUE, 0);
- gtk_widget_show (composer->text_scrolled_window);
-
- /* Attachment editor, wrapped into a GtkScrolledWindow. We don't
- show it for now. */
-
- composer->attachment_scrolled_window = gtk_scrolled_window_new (NULL,
- NULL);
- gtk_scrolled_window_set_policy
- (GTK_SCROLLED_WINDOW (composer->attachment_scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- composer->attachment_bar = e_msg_composer_attachment_bar_new (NULL);
- GTK_WIDGET_SET_FLAGS (composer->attachment_bar, GTK_CAN_FOCUS);
- gtk_container_add (GTK_CONTAINER (composer->attachment_scrolled_window),
- composer->attachment_bar);
- gtk_box_pack_start (GTK_BOX (vbox),
- composer->attachment_scrolled_window,
- FALSE, TRUE, GNOME_PAD_SMALL);
-
- gnome_app_set_contents (GNOME_APP (composer), vbox);
- gtk_widget_show (vbox);
-
- e_msg_composer_show_attachments (composer, FALSE);
-
- setup_signals (composer);
-}
-
-/**
- * e_msg_composer_new:
- *
- * Create a new message composer widget.
- *
- * Return value: A pointer to the newly created widget
- **/
-GtkWidget *
-e_msg_composer_new (void)
-{
- GtkWidget *new;
-
- new = gtk_type_new (e_msg_composer_get_type ());
- e_msg_composer_construct (E_MSG_COMPOSER (new));
-
- return new;
-}
-
-
-/**
- * e_msg_composer_show_attachments:
- * @composer: A message composer widget
- * @show: A boolean specifying whether the attachment bar should be shown or
- * not
- *
- * If @show is %FALSE, hide the attachment bar. Otherwise, show it.
- **/
-void
-e_msg_composer_show_attachments (EMsgComposer *composer,
- gboolean show)
-{
- g_return_if_fail (composer != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
- show_attachments (composer, show);
-}
-
-
-/**
- * e_msg_composer_get_message:
- * @composer: A message composer widget
- *
- * Retrieve the message edited by the user as a CamelMimeMessage. The
- * CamelMimeMessage object is created on the fly; subsequent calls to this
- * function will always create new objects from scratch.
- *
- * Return value: A pointer to the new CamelMimeMessage object
- **/
-CamelMimeMessage *
-e_msg_composer_get_message (EMsgComposer *composer)
-{
- g_return_val_if_fail (composer != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
-
- return build_message (composer);
-}
diff --git a/composer/e-msg-composer.glade b/composer/e-msg-composer.glade
deleted file mode 100644
index b747c6f979..0000000000
--- a/composer/e-msg-composer.glade
+++ /dev/null
@@ -1,587 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>Message Composer</name>
- <program_name>e-msg-composer</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>False</use_widget_names>
- <output_main_file>True</output_main_file>
- <output_support_files>True</output_support_files>
- <output_build_files>True</output_build_files>
- <backup_source_files>True</backup_source_files>
- <main_source_file>interface.c</main_source_file>
- <main_header_file>interface.h</main_header_file>
- <handler_source_file>callbacks.c</handler_source_file>
- <handler_header_file>callbacks.h</handler_header_file>
- <support_source_file>support.c</support_source_file>
- <support_header_file>support.h</support_header_file>
- <translatable_strings_file></translatable_strings_file>
-</project>
-
-<widget>
- <class>GnomeApp</class>
- <name>app1</name>
- <title>Message Composer</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <enable_layout_config>True</enable_layout_config>
-
- <widget>
- <class>GnomeDock</class>
- <child_name>GnomeApp:dock</child_name>
- <name>dock1</name>
- <allow_floating>True</allow_floating>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GnomeDockItem</class>
- <name>dockitem1</name>
- <border_width>2</border_width>
- <placement>GNOME_DOCK_TOP</placement>
- <band>0</band>
- <position>0</position>
- <offset>0</offset>
- <locked>False</locked>
- <exclusive>True</exclusive>
- <never_floating>False</never_floating>
- <never_vertical>True</never_vertical>
- <never_horizontal>False</never_horizontal>
- <shadow_type>GTK_SHADOW_OUT</shadow_type>
-
- <widget>
- <class>GtkMenuBar</class>
- <name>menubar</name>
- <shadow_type>GTK_SHADOW_NONE</shadow_type>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>file</name>
- <stock_item>GNOMEUIINFO_MENU_FILE_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>file_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>open</name>
- <signal>
- <name>activate</name>
- <handler>on_open_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:25:08 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_OPEN_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>save</name>
- <signal>
- <name>activate</name>
- <handler>on_save_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:25:13 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_SAVE_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>save_as</name>
- <signal>
- <name>activate</name>
- <handler>on_save_as_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:25:16 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_SAVE_AS_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>save_in_folder</name>
- <signal>
- <name>activate</name>
- <handler>on_save_in_folder_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:25:20 GMT</last_modification_time>
- </signal>
- <label>Save in _Folder...</label>
- <right_justify>False</right_justify>
- <stock_icon>GNOME_STOCK_MENU_SAVE_AS</stock_icon>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator8</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>menu_send</name>
- <signal>
- <name>activate</name>
- <handler>on_send_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:25:29 GMT</last_modification_time>
- </signal>
- <label>S_end</label>
- <right_justify>False</right_justify>
- <stock_icon>GNOME_STOCK_MENU_MAIL_SND</stock_icon>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>postpone</name>
- <signal>
- <name>activate</name>
- <handler>on_postpone_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:25:37 GMT</last_modification_time>
- </signal>
- <label>_Postpone</label>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator1</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>exit</name>
- <signal>
- <name>activate</name>
- <handler>on_exit_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:25:59 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_EXIT_ITEM</stock_item>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>edit</name>
- <stock_item>GNOMEUIINFO_MENU_EDIT_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>edit_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>undo</name>
- <signal>
- <name>activate</name>
- <handler>on_undo_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:26:10 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_UNDO_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>redo</name>
- <signal>
- <name>activate</name>
- <handler>on_redo_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:26:15 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_REDO_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator3</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>cut</name>
- <signal>
- <name>activate</name>
- <handler>on_cut_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:26:21 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_CUT_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>copy</name>
- <signal>
- <name>activate</name>
- <handler>on_copy_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:26:26 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_COPY_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>paste</name>
- <signal>
- <name>activate</name>
- <handler>on_paste_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:26:31 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_PASTE_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator2</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>select_all</name>
- <signal>
- <name>activate</name>
- <handler>on_select_all_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:26:37 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_SELECT_ALL_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator5</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>find</name>
- <signal>
- <name>activate</name>
- <handler>on_find_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:26:42 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_FIND_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>find_again</name>
- <signal>
- <name>activate</name>
- <handler>on_find_again_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:26:47 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_FIND_AGAIN_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>replace</name>
- <signal>
- <name>activate</name>
- <handler>on_replace_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:26:53 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_REPLACE_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator6</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>properties</name>
- <signal>
- <name>activate</name>
- <handler>on_properties_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:26:58 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_PROPERTIES_ITEM</stock_item>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>view1</name>
- <stock_item>GNOMEUIINFO_MENU_VIEW_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>view1_menu</name>
-
- <widget>
- <class>GtkCheckMenuItem</class>
- <name>menu_view_attachments</name>
- <signal>
- <name>activate</name>
- <handler>on_view_attachments_activate</handler>
- <last_modification_time>Fri, 05 Nov 1999 18:31:16 GMT</last_modification_time>
- </signal>
- <label>Attachments</label>
- <active>False</active>
- <always_show_toggle>False</always_show_toggle>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>insert</name>
- <label>_Insert</label>
- <right_justify>False</right_justify>
-
- <widget>
- <class>GtkMenu</class>
- <name>insert_menu</name>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>menu_add_attachment</name>
- <signal>
- <name>activate</name>
- <handler>on_attachment_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:27:05 GMT</last_modification_time>
- </signal>
- <label>Attachment...</label>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>text_from_file</name>
- <signal>
- <name>activate</name>
- <handler>on_text_from_file_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:27:16 GMT</last_modification_time>
- </signal>
- <label>Text from file...</label>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator6</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>hypertext_link</name>
- <signal>
- <name>activate</name>
- <handler>on_hypertext_link_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:27:21 GMT</last_modification_time>
- </signal>
- <label>Hypertext link...</label>
- <right_justify>False</right_justify>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>settings</name>
- <stock_item>GNOMEUIINFO_MENU_SETTINGS_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>settings_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>preferences</name>
- <signal>
- <name>activate</name>
- <handler>on_preferences_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:27:37 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_PREFERENCES_ITEM</stock_item>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>tools</name>
- <label>_Tools</label>
- <right_justify>False</right_justify>
-
- <widget>
- <class>GtkMenu</class>
- <name>tools_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>spell_check1</name>
- <signal>
- <name>activate</name>
- <handler>on_spell_check_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:27:44 GMT</last_modification_time>
- </signal>
- <label>_Spell check</label>
- <right_justify>False</right_justify>
- <stock_icon>GNOME_STOCK_MENU_SPELLCHECK</stock_icon>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator7</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>check_names</name>
- <signal>
- <name>activate</name>
- <handler>on_check_names_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:27:49 GMT</last_modification_time>
- </signal>
- <label>Check names</label>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>menubar_address_dialog</name>
- <signal>
- <name>activate</name>
- <handler>on_address_book_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:27:53 GMT</last_modification_time>
- </signal>
- <label>Address book...</label>
- <right_justify>False</right_justify>
- <stock_icon>GNOME_STOCK_MENU_BOOK_RED</stock_icon>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>help</name>
- <stock_item>GNOMEUIINFO_MENU_HELP_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>help_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>about</name>
- <signal>
- <name>activate</name>
- <handler>on_about_activate</handler>
- <last_modification_time>Wed, 27 Oct 1999 22:28:01 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_ABOUT_ITEM</stock_item>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GnomeDockItem</class>
- <name>dockitem2</name>
- <border_width>1</border_width>
- <placement>GNOME_DOCK_TOP</placement>
- <band>1</band>
- <position>0</position>
- <offset>0</offset>
- <locked>False</locked>
- <exclusive>True</exclusive>
- <never_floating>False</never_floating>
- <never_vertical>False</never_vertical>
- <never_horizontal>False</never_horizontal>
- <shadow_type>GTK_SHADOW_OUT</shadow_type>
-
- <widget>
- <class>GtkToolbar</class>
- <name>toolbar</name>
- <border_width>1</border_width>
- <orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
- <type>GTK_TOOLBAR_BOTH</type>
- <space_size>16</space_size>
- <space_style>GTK_TOOLBAR_SPACE_LINE</space_style>
- <relief>GTK_RELIEF_NONE</relief>
- <tooltips>True</tooltips>
-
- <widget>
- <class>GtkButton</class>
- <child_name>Toolbar:button</child_name>
- <name>toolbar_send</name>
- <tooltip>Send this message</tooltip>
- <label>Send
-</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_MAIL_SND</stock_pixmap>
- </widget>
-
- <widget>
- <class>GtkToggleButton</class>
- <child_name>Toolbar:button</child_name>
- <name>toolbar_view_attachments</name>
- <tooltip>Show attachments for this message</tooltip>
- <label>Show
-attachments</label>
- <active>False</active>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <child_name>Toolbar:button</child_name>
- <name>toolbar_add_attachment</name>
- <tooltip>Attach a file</tooltip>
- <label>Attach
-file</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <child_name>Toolbar:button</child_name>
- <name>toolbar_address_dialog</name>
- <tooltip>Go to addressbook</tooltip>
- <label>Edit
-addresses</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_BOOK_RED</stock_pixmap>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>Placeholder</class>
- <child_name>GnomeDock:contents</child_name>
- </widget>
- </widget>
-
- <widget>
- <class>GnomeAppBar</class>
- <child_name>GnomeApp:appbar</child_name>
- <name>appbar</name>
- <has_progress>True</has_progress>
- <has_status>True</has_status>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
deleted file mode 100644
index 3028dedca3..0000000000
--- a/composer/e-msg-composer.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer.h
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef ___E_MSG_COMPOSER_H__
-#define ___E_MSG_COMPOSER_H__
-
-#include <gnome.h>
-#include <glade/glade.h>
-
-#include "e-msg-composer-attachment-bar.h"
-#include "e-msg-composer-hdrs.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-
-#define E_TYPE_MSG_COMPOSER (e_msg_composer_get_type ())
-#define E_MSG_COMPOSER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER, EMsgComposer))
-#define E_MSG_COMPOSER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER, EMsgComposerClass))
-#define E_IS_MSG_COMPOSER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER))
-#define E_IS_MSG_COMPOSER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER))
-
-
-typedef struct _EMsgComposer EMsgComposer;
-typedef struct _EMsgComposerClass EMsgComposerClass;
-
-struct _EMsgComposer {
- GnomeApp parent;
-
- GladeXML *menubar_gui;
- GladeXML *toolbar_gui;
- GladeXML *appbar_gui;
-
- GtkWidget *hdrs;
-
- GtkWidget *text;
- GtkWidget *text_scrolled_window;
-
- GtkWidget *attachment_bar;
- GtkWidget *attachment_scrolled_window;
-
- GtkWidget *address_dialog;
-
- gboolean attachment_bar_visible : 1;
-};
-
-struct _EMsgComposerClass {
- GnomeAppClass parent_class;
-
- void (* send) (EMsgComposer *composer);
- void (* postpone) (EMsgComposer *composer);
-};
-
-
-GtkType e_msg_composer_get_type (void);
-void e_msg_composer_construct (EMsgComposer *composer);
-GtkWidget *e_msg_composer_new (void);
-void e_msg_composer_show_attachments (EMsgComposer *composer, gboolean show);
-CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* ___E_MSG_COMPOSER_H__ */
diff --git a/composer/main.c b/composer/main.c
deleted file mode 100644
index 8fbf01b5e8..0000000000
--- a/composer/main.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-#include <gnome.h>
-
-#include <camel/camel-data-wrapper.h>
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream.h>
-
-#include "e-msg-composer.h"
-
-static void
-send_cb (EMsgComposer *composer,
- gpointer data)
-{
- CamelMimeMessage *message;
- CamelStream *stream;
- gint stdout_dup;
-
- message = e_msg_composer_get_message (composer);
-
- stdout_dup = dup (1);
- stream = camel_stream_fs_new_with_fd (stdout_dup);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message),
- stream);
- camel_stream_close (stream);
-
- gtk_object_unref (GTK_OBJECT (message));
-
-#if 0
- gtk_widget_destroy (GTK_WIDGET (composer));
- gtk_main_quit ();
-#endif
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *composer;
-
- gnome_init ("test", "0.0", argc, argv);
- glade_gnome_init ();
-
- composer = e_msg_composer_new ();
- gtk_widget_show (composer);
-
- gtk_signal_connect (GTK_OBJECT (composer), "send",
- GTK_SIGNAL_FUNC (send_cb), NULL);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/configure.in b/configure.in
deleted file mode 100644
index f3d635a58c..0000000000
--- a/configure.in
+++ /dev/null
@@ -1,135 +0,0 @@
-# Process this file with autoconf to produce a configure script.
-AC_INIT(camel)
-AM_CONFIG_HEADER(config.h)
-
-cflags_set=${CFLAGS+set}
-
-EVOLUTION_MAJOR_VERSION=0
-EVOLUTION_MINOR_VERSION=0
-EVOLUTION_MICRO_VERSION=1
-VERSION=$EVOLUTION_MAJOR_VERSION.$EVOLUTION_MINOR_VERSION.$EVOLUTION_MICRO_VERSION
-PACKAGE=evolution
-
-AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
-AC_SUBST(VERSION)
-
-
-dnl Initialize libtool
-AM_PROG_LIBTOOL
-
-dnl Initialize maintainer mode
-AM_MAINTAINER_MODE
-
-AC_CANONICAL_HOST
-
-AM_ACLOCAL_INCLUDE(macros)
-GNOME_INIT
-GNOME_COMPILE_WARNINGS
-AC_ISC_POSIX
-AC_PROG_CC
-AC_PROG_CPP
-AC_STDC_HEADERS
-AC_ARG_PROGRAM
-AC_PROG_INSTALL
-AC_PROG_LN_S
-AC_PROG_MAKE_SET
-
-ALL_LINGUAS=""
-
-AM_GNOME_GETTEXT
-
-GNOME_X_CHECKS
-
-dnl **************************************************
-dnl * Posix thread support
-dnl **************************************************
-GNOME_PTHREAD_CHECK
-if test "x$PTHREAD_LIB" = "x" ; then
- have_pthread=false
-else
- have_pthread=true
-fi
-
-AM_CONDITIONAL(HAVE_PTHREAD, $have_pthread)
-
-
-dnl **************************************************
-dnl * ORBit support
-dnl **************************************************
-dnl GNOMEGNORBA_LIBS="$GNOMEGNORBA_LIBS"
-dnl AC_SUBST(GNOMEGNORBA_LIBS)
-
-
-dnl ******************************
-dnl Check for Bonobo
-dnl ******************************
-AC_MSG_CHECKING(for Bonobo > 0.4)
-if gnome-config --libs bonobo > /dev/null 2>&1; then
- vers=`gnome-config --modversion bonobo`
- case $vers
- in
- bonobo-0.[[01234]]) bonobo_ok=false ;;
- *) bonobo_ok=true ;;
- esac
-else
- bonobo_ok=false
-fi
-
-if $bonobo_ok; then
- AC_MSG_RESULT(found)
-else
- AC_MSG_ERROR(Bonobo 0.5 is required to compile Evolution)
-fi
-
-
-dnl ******************************
-dnl LibGlade checking
-dnl ******************************
-AC_MSG_CHECKING(For Glade libraries)
-if gnome-config --libs libglade > /dev/null 2>&1; then
- AC_MSG_RESULT(found)
-else
- AC_MSG_ERROR(Did not find libGlade installed)
-fi
-
-EXTRA_GNOME_LIBS="`gnome-config --libs gnomeui libglade `"
-EXTRA_GNOME_CFLAGS="`gnome-config --cflags gnomeui libglade `"
-AC_SUBST(EXTRA_GNOME_LIBS)
-AC_SUBST(EXTRA_GNOME_CFLAGS)
-
-BONOBO_GNOME_LIBS="`gnome-config --libs gnomeui bonobo libglade `"
-BONOBO_GNOME_CFLAGS="`gnome-config --cflags gnomeui bonobo libglade `"
-AC_SUBST(BONOBO_GNOME_LIBS)
-AC_SUBST(BONOBO_GNOME_CFLAGS)
-
-EXTRA_GNOME_LIBS_THREADS="`gnome-config --libs gnomeui libglade ` `glib-config --libs gthread`"
-EXTRA_GNOME_CFLAGS_THREADS="`gnome-config --cflags gnomeui libglade ` `glib-config --cflags gthread`"
-AC_SUBST(EXTRA_GNOME_LIBS_THREADS)
-AC_SUBST(EXTRA_GNOME_CFLAGS_THREADS)
-
-
-AC_ARG_WITH(camel-hard-log-level, [ --with-camel-hard-log-level=level value of log level in camel (0-10)],
- camel_hard_log_level="$withval", camel_hard_log_level="0")
-AC_DEFINE_UNQUOTED(CAMEL_HARD_LOG_LEVEL, $camel_hard_log_level)
-
-AC_OUTPUT([
-Makefile
-macros/Makefile
-po/Makefile.in
-e-util/Makefile
-camel/Makefile
-camel/providers/Makefile
-camel/providers/MH/Makefile
-camel/providers/maildir/Makefile
-camel/providers/mbox/Makefile
-composer/Makefile
-devel-docs/Makefile
-devel-docs/camel/Makefile
-tests/Makefile
-tests/ui-tests/Makefile
-widgets/Makefile
-widgets/meeting-time-sel/Makefile
-widgets/shortcut-bar/Makefile
-widgets/e-table/Makefile
-shell/Makefile
-])
diff --git a/devel-docs/.cvsignore b/devel-docs/.cvsignore
deleted file mode 100644
index d436efd0f7..0000000000
--- a/devel-docs/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile.in
-Makefile
-
diff --git a/devel-docs/Makefile.am b/devel-docs/Makefile.am
deleted file mode 100644
index 74a5ff5b60..0000000000
--- a/devel-docs/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS=camel
diff --git a/devel-docs/camel/.cvsignore b/devel-docs/camel/.cvsignore
deleted file mode 100644
index 56d9506207..0000000000
--- a/devel-docs/camel/.cvsignore
+++ /dev/null
@@ -1,12 +0,0 @@
-sgml
-html
-Makefile.in
-Makefile
-camel.signals
-camel.hierarchy
-camel.args
-camel-decl.txt
-camel-unused.txt
-camel.html
-camel-decl-list.txt
-
diff --git a/devel-docs/camel/Makefile.am b/devel-docs/camel/Makefile.am
deleted file mode 100644
index 276059cf88..0000000000
--- a/devel-docs/camel/Makefile.am
+++ /dev/null
@@ -1,101 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-# The name of the module.
-DOC_MODULE=camel
-
-# The top-level SGML file.
-DOC_MAIN_SGML_FILE=camel-docs.sgml
-
-# The directory containing the source code (if it contains documentation).
-DOC_SOURCE_DIR=$(top_srcdir)/camel
-
-CFLAGS=`gtk-config --cflags gtk`
-LDFLAGS="-lcamel `gtk-config --libs gtk` "
-
-
-HTML_DIR=$(datadir)/gnome/html
-
-
-
-TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
-
-tmpl_sources = \
- tmpl/camel-data-wrapper.sgml \
- tmpl/camel-folder.sgml \
- tmpl/camel-mime-message.sgml \
- tmpl/camel-mime-part.sgml \
- tmpl/camel-recipient.sgml \
- tmpl/camel-service.sgml \
- tmpl/camel-store.sgml \
- tmpl/camel-stream.sgml
-
-
-camel_docdir = $(HTML_DIR)
-camel_doc_DATA = \
- camel.html \
- camel.hierarchy \
- camel.types \
- camel-scan.c \
- camel-decl.txt \
- camel-sections.txt
-
-EXTRA_DIST = $(camel_doc_DATA)
-
-camel.html: html/book1.html
- -cd $(srcdir) && cp html/book1.html camel.html
-
-html/book1.html: sgml/camel-doc.bottom
- $(MAKE) html
-
-sgml/camel-doc.bottom: $(tmpl_sources)
- $(MAKE) sgml
-
-camel-scan.c:
-
-scan: camel-scan.c
- CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) gtkdoc-scanobj --module=$(DOC_MODULE)
- gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR)
-
-templates: scan
- gtkdoc-mktmpl --module=$(DOC_MODULE)
-
-sgml:
- gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR)
-
-html:
- if ! test -d html ; then mkdir html ; fi
- -cd html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
-
-clean-local:
- rm -f *~ *.bak *.hierarchy *.signals *.args *-unused.txt camel.html
-
-maintainer-clean-local: clean
- rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt Makefile.in
-
-install-data-local:
- $(mkinstalldirs) $(TARGET_DIR)
- (installfiles=`echo $(srcdir)/html/*.html`; \
- if test "$$installfiles" = '$(srcdir)/html/*.html'; \
- then echo '-- Nothing to install' ; \
- else \
- for i in $$installfiles; do \
- echo '-- Installing '$$i ; \
- $(INSTALL_DATA) $$i $(TARGET_DIR); \
- done; \
- echo '-- Installing $(srcdir)/html/index.sgml' ; \
- $(INSTALL_DATA) $(srcdir)/html/index.sgml $(TARGET_DIR); \
- echo '-- Fixing Crossreferences' ; \
- gtkdoc-fixxref --module=$(DOC_MODULE) --html-dir=$(HTML_DIR)|| true; \
- fi)
-
-dist-hook:
- mkdir $(distdir)/html
- mkdir $(distdir)/sgml
- mkdir $(distdir)/tmpl
- -cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
- -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
- -cp $(srcdir)/sgml/*.sgml $(distdir)/sgml
- -cp $(srcdir)/sgml/*.bottom $(srcdir)/sgml/*.top $(distdir)/sgml
-
-
-.PHONY : html sgml templates scan
diff --git a/devel-docs/camel/README_AND_TODO.txt b/devel-docs/camel/README_AND_TODO.txt
deleted file mode 100644
index 5feeb1e4e9..0000000000
--- a/devel-docs/camel/README_AND_TODO.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-Camel is currently (conceptualy) separated in four parts:
-
-* the session handling
-* the storage mechanism.
-* the (mime) message handling.
-* some general utilities class/functions.
-
-
-
-* Session handling
-------------------
-
-(This is not gnome session managing related)
-CamelSession is an object used to store some parameters on a user
-basis. This can be a permanent (fs based) or volatile
-(ram only) storage depending on user preferences.
-The session object is, for example, responsible for
-remembering authentication datas during application lifetime.
-It is also responsible for selecting and loading providers
-corresponding to protocols. In the case where only one
-provider exists for a given protocol, the task is trivial,
-but when multiple providers exist for a given protocol, the
-user can choose their prefered one. Given its relationship
-with providers, the session object is also used to instanciate
-a store given an URL.
-
-Associated Classes:
- CamelSession
- implementation: 5%
-
-Associated Files:
- camel-provider.[ch]
- implementation: 2.5% (a struct in camel-provider.h)
-
-
-* the storage mechanism.
-------------------------
-
-The storage mechanism is mainly represented by
-the Store class and the Folder class.
-* the (mime) message handling.
-* some general utilities class/functions.
-
diff --git a/devel-docs/camel/camel-docs.sgml b/devel-docs/camel/camel-docs.sgml
deleted file mode 100644
index 33c6623731..0000000000
--- a/devel-docs/camel/camel-docs.sgml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
-<!entity CamelDataWrapper SYSTEM "sgml/camel-data-wrapper.sgml">
-<!entity CamelFolder SYSTEM "sgml/camel-folder.sgml">
-<!entity CamelMimeMessage SYSTEM "sgml/camel-mime-message.sgml">
-<!entity CamelMimePart SYSTEM "sgml/camel-mime-part.sgml">
-<!entity CamelRecipient SYSTEM "sgml/camel-recipient.sgml">
-<!entity CamelService SYSTEM "sgml/camel-service.sgml">
-<!entity CamelStore SYSTEM "sgml/camel-store.sgml">
-<!entity CamelStream SYSTEM "sgml/camel-stream.sgml">
-]>
-
-<book>
- <bookinfo>
- <title>Camel Messaging Library Reference Manual</title>
- </bookinfo>
-
- <chapter id="camel-objects">
- <title>Camel Objects</title>
- &CamelMimeMessage;
- &CamelService;
- &CamelStore;
- &CamelFolder;
- &CamelMimePart;
- &CamelDataWrapper;
- &CamelRecipient;
-
- </chapter>
-</book>
diff --git a/devel-docs/camel/camel-sections.txt b/devel-docs/camel/camel-sections.txt
deleted file mode 100644
index 1f6d45c03c..0000000000
--- a/devel-docs/camel/camel-sections.txt
+++ /dev/null
@@ -1,154 +0,0 @@
-
-<INCLUDE>gnome.h</INCLUDE>
-<INCLUDE>camel-data-wrapper.h</INCLUDE>
-
-
-<SECTION>
-<FILE>camel-data-wrapper</FILE>
-CamelDataWrapper
-<TITLE>CamelDataWrapper</TITLE>
-camel_data_wrapper_write_to_stream
-<SUBSECTION Standard>
-CAMEL_DATA_WRAPPER
-camel_data_wrapper_get_type
-CAMEL_DATA_WRAPPER_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>camel-recipient</FILE>
-CamelRecipientTable
-<TITLE>CamelRecipientTable</TITLE>
-camel_recipient_table_new
-camel_recipient_table_get
-camel_recipient_table_add
-camel_recipient_table_add_list
-camel_recipient_table_remove
-camel_recipient_table_ref
-camel_recipient_table_unref
-</SECTION>
-
-<SECTION>
-<FILE>camel-mime-part</FILE>
-CamelMimePart
-<TITLE>CamelMimePart</TITLE>
-camel_mime_part_add_header
-camel_mime_part_set_content_object
-camel_mime_part_set_filename
-camel_mime_part_get_disposition
-camel_mime_part_get_content_MD5
-camel_mime_part_get_encoding
-camel_mime_part_set_header_lines
-camel_mime_part_get_content_object
-camel_mime_part_get_content_id
-camel_mime_part_set_description
-camel_mime_part_set_text
-camel_mime_part_set_encoding
-camel_mime_part_set_disposition
-camel_mime_part_remove_header
-camel_mime_part_get_filename
-camel_mime_part_get_content_languages
-camel_mime_part_set_content_languages
-camel_mime_part_get_header_lines
-camel_mime_part_get_description
-camel_mime_part_get_header
-<SUBSECTION Standard>
-CAMEL_MIME_PART
-camel_mime_part_get_type
-CAMEL_MIME_PART_CLASS
-</SECTION>
-
-
-
-<SECTION>
-<FILE>camel-mime-message</FILE>
-CamelMimeMessage
-<TITLE>CamelMimeMessage</TITLE>
-camel_mime_message_remove_recipient
-camel_mime_message_get_recipients
-camel_mime_message_set_flag
-camel_mime_message_set_subject
-camel_mime_message_get_reply_to
-camel_mime_message_get_from
-camel_mime_message_set_reply_to
-camel_mime_message_get_sent_date
-camel_mime_message_new_with_session
-camel_mime_message_add_recipient
-camel_mime_message_get_subject
-camel_mime_message_set_from
-camel_mime_message_get_flag
-camel_mime_message_get_message_number
-camel_mime_message_get_received_date
-camel_mime_message_set_received_date
-<SUBSECTION Standard>
-CAMEL_MIME_MESSAGE
-camel_mime_message_get_type
-CAMEL_MIME_MESSAGE_CLASS
-</SECTION>
-
-
-<SECTION>
-<FILE>camel-folder</FILE>
-CamelFolder
-<TITLE>CamelFolder</TITLE>
-camel_folder_get_folder
-camel_folder_create
-camel_folder_delete
-camel_folder_delete_messages
-camel_folder_get_parent_folder
-camel_folder_get_parent_store
-camel_folder_get_mode
-camel_folder_list_subfolders
-<SUBSECTION Standard>
-CAMEL_FOLDER
-camel_folder_get_type
-CAMEL_FOLDER_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>camel-service</FILE>
-CamelService
-<TITLE>CamelService</TITLE>
-camel_service_connect
-camel_service_is_connected
-camel_service_connect_to_with_login_passwd
-camel_service_connect_to_with_login_passwd_port
-camel_service_get_url
-<SUBSECTION Standard>
-CAMEL_SERVICE
-camel_service_get_type
-CAMEL_SERVICE_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>camel-store</FILE>
-CamelStore
-<TITLE>CamelStore</TITLE>
-camel_store_get_separator
-camel_store_get_folder
-<SUBSECTION Standard>
-CAMEL_STORE
-camel_store_get_type
-CAMEL_STORE_CLASS
-</SECTION>
-
-
-<SECTION>
-<FILE>camel-stream</FILE>
-CamelStream
-<TITLE>CamelStream</TITLE>
-camel_stream_seek
-camel_stream_write
-camel_stream_flush
-camel_stream_eos
-camel_stream_write_string
-camel_stream_close
-camel_stream_write_strings
-camel_stream_read
-camel_stream_available
-<SUBSECTION Standard>
-CAMEL_STREAM
-camel_stream_get_type
-CAMEL_STREAM_CLASS
-</SECTION>
-
-
diff --git a/devel-docs/camel/camel.types b/devel-docs/camel/camel.types
deleted file mode 100644
index 93142d8692..0000000000
--- a/devel-docs/camel/camel.types
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <gtk/gtk.h>
-#include <camel/camel-data-wrapper.h>
-camel_data_wrapper_get_type
-camel_folder_get_type
-camel_mime_message_get_type
-camel_mime_part_get_type
-camel_service_get_type
-camel_store_get_type
-camel_stream_get_type
diff --git a/devel-docs/camel/tmpl/.cvsignore b/devel-docs/camel/tmpl/.cvsignore
deleted file mode 100644
index 29db8d052d..0000000000
--- a/devel-docs/camel/tmpl/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-camel-unused.sgml
-
diff --git a/devel-docs/camel/tmpl/camel-data-wrapper.sgml b/devel-docs/camel/tmpl/camel-data-wrapper.sgml
deleted file mode 100644
index 6fce9eb128..0000000000
--- a/devel-docs/camel/tmpl/camel-data-wrapper.sgml
+++ /dev/null
@@ -1,26 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-CamelDataWrapper
-
-<!-- ##### SECTION Short_Description ##### -->
-data container with streaming methods
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-A CamelDataWrapper is wrapper around data which can save them to a stream
-and restore them from a stream.
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### FUNCTION camel_data_wrapper_write_to_stream ##### -->
-<para>
-
-</para>
-
-@data_wrapper:
-@stream:
-
-
diff --git a/devel-docs/camel/tmpl/camel-folder.sgml b/devel-docs/camel/tmpl/camel-folder.sgml
deleted file mode 100644
index 882d63499c..0000000000
--- a/devel-docs/camel/tmpl/camel-folder.sgml
+++ /dev/null
@@ -1,96 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-CamelFolder
-
-<!-- ##### SECTION Short_Description ##### -->
-Represents a folder of messages on a store.
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-CamelFolder represents a folder in a message store.
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### STRUCT CamelFolder ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### FUNCTION camel_folder_get_folder ##### -->
-<para>
-
-</para>
-
-@folder:
-@folder_name:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_folder_create ##### -->
-<para>
-
-</para>
-
-@folder:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_folder_delete ##### -->
-<para>
-
-</para>
-
-@folder:
-@recurse:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_folder_delete_messages ##### -->
-<para>
-
-</para>
-
-@folder:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_folder_get_parent_folder ##### -->
-<para>
-
-</para>
-
-@folder:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_folder_get_parent_store ##### -->
-<para>
-
-</para>
-
-@folder:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_folder_get_mode ##### -->
-<para>
-
-</para>
-
-@folder:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_folder_list_subfolders ##### -->
-<para>
-
-</para>
-
-@folder:
-@Returns:
-
-
diff --git a/devel-docs/camel/tmpl/camel-mime-message.sgml b/devel-docs/camel/tmpl/camel-mime-message.sgml
deleted file mode 100644
index 704f3d3572..0000000000
--- a/devel-docs/camel/tmpl/camel-mime-message.sgml
+++ /dev/null
@@ -1,171 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-CamelMimeMessage
-
-<!-- ##### SECTION Short_Description ##### -->
-
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### STRUCT CamelMimeMessage ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### FUNCTION camel_mime_message_remove_recipient ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@recipient_type:
-@recipient:
-
-
-<!-- ##### FUNCTION camel_mime_message_get_recipients ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@recipient_type:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_message_set_flag ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@flag:
-@value:
-
-
-<!-- ##### FUNCTION camel_mime_message_set_subject ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@subject:
-
-
-<!-- ##### FUNCTION camel_mime_message_get_reply_to ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_message_get_from ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_message_set_reply_to ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@reply_to:
-
-
-<!-- ##### FUNCTION camel_mime_message_get_sent_date ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_message_new_with_session ##### -->
-<para>
-
-</para>
-
-@session:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_message_add_recipient ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@recipient_type:
-@recipient:
-
-
-<!-- ##### FUNCTION camel_mime_message_get_subject ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_message_set_from ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@from:
-
-
-<!-- ##### FUNCTION camel_mime_message_get_flag ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@flag:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_message_get_message_number ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_message_get_received_date ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_message_set_received_date ##### -->
-<para>
-
-</para>
-
-@mime_message:
-@received_date:
-
-
diff --git a/devel-docs/camel/tmpl/camel-mime-part.sgml b/devel-docs/camel/tmpl/camel-mime-part.sgml
deleted file mode 100644
index 2db158b25f..0000000000
--- a/devel-docs/camel/tmpl/camel-mime-part.sgml
+++ /dev/null
@@ -1,151 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-CamelMimePart
-
-<!-- ##### SECTION Short_Description ##### -->
-
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### FUNCTION camel_mime_part_set_filename ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@filename:
-
-
-<!-- ##### FUNCTION camel_mime_part_get_disposition ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_part_get_content_MD5 ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_part_get_encoding ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_part_set_header_lines ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@header_lines:
-
-
-<!-- ##### FUNCTION camel_mime_part_get_content_id ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_part_set_description ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@description:
-
-
-<!-- ##### FUNCTION camel_mime_part_set_text ##### -->
-<para>
-
-</para>
-
-@camel_mime_part:
-@text:
-
-
-<!-- ##### FUNCTION camel_mime_part_set_encoding ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@encoding:
-
-
-<!-- ##### FUNCTION camel_mime_part_set_disposition ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@disposition:
-
-
-<!-- ##### FUNCTION camel_mime_part_get_filename ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_part_get_content_languages ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_part_set_content_languages ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@content_languages:
-
-
-<!-- ##### FUNCTION camel_mime_part_get_header_lines ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_mime_part_get_description ##### -->
-<para>
-
-</para>
-
-@mime_part:
-@Returns:
-
-
diff --git a/devel-docs/camel/tmpl/camel-recipient.sgml b/devel-docs/camel/tmpl/camel-recipient.sgml
deleted file mode 100644
index 4af84cf58e..0000000000
--- a/devel-docs/camel/tmpl/camel-recipient.sgml
+++ /dev/null
@@ -1,88 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-CamelRecipientTable
-
-<!-- ##### SECTION Short_Description ##### -->
-
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### STRUCT CamelRecipientTable ##### -->
-<para>
-
-</para>
-
-@recipient_hash_table:
-@ref_count:
-
-<!-- ##### FUNCTION camel_recipient_table_new ##### -->
-<para>
-
-</para>
-
-@Returns:
-
-
-<!-- ##### FUNCTION camel_recipient_table_unref ##### -->
-<para>
-
-</para>
-
-@recipient_table:
-
-
-<!-- ##### FUNCTION camel_recipient_table_get ##### -->
-<para>
-
-</para>
-
-@recipient_table:
-@recipient_type:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_recipient_table_add ##### -->
-<para>
-
-</para>
-
-@recipient_table:
-@recipient_type:
-@recipient:
-
-
-<!-- ##### FUNCTION camel_recipient_table_remove ##### -->
-<para>
-
-</para>
-
-@recipient_table:
-@recipient_type:
-@recipient:
-
-
-<!-- ##### FUNCTION camel_recipient_table_add_list ##### -->
-<para>
-
-</para>
-
-@recipient_table:
-@recipient_type:
-@recipient_list:
-
-
-<!-- ##### FUNCTION camel_recipient_table_ref ##### -->
-<para>
-
-</para>
-
-@recipient_table:
-
-
diff --git a/devel-docs/camel/tmpl/camel-service.sgml b/devel-docs/camel/tmpl/camel-service.sgml
deleted file mode 100644
index 5b51ea902e..0000000000
--- a/devel-docs/camel/tmpl/camel-service.sgml
+++ /dev/null
@@ -1,72 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-CamelService
-
-<!-- ##### SECTION Short_Description ##### -->
-
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### STRUCT CamelService ##### -->
-<para>
-
-</para>
-
-@e:
-
-<!-- ##### FUNCTION camel_service_connect ##### -->
-<para>
-
-</para>
-
-@service:
-
-
-<!-- ##### FUNCTION camel_service_is_connected ##### -->
-<para>
-
-</para>
-
-@service:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_service_connect_to_with_login_passwd ##### -->
-<para>
-
-</para>
-
-@service:
-@host:
-@login:
-@passwd:
-
-
-<!-- ##### FUNCTION camel_service_connect_to_with_login_passwd_port ##### -->
-<para>
-
-</para>
-
-@service:
-@host:
-@login:
-@passwd:
-@port:
-
-
-<!-- ##### FUNCTION camel_service_get_url ##### -->
-<para>
-
-</para>
-
-@service:
-@Returns:
-
-
diff --git a/devel-docs/camel/tmpl/camel-store.sgml b/devel-docs/camel/tmpl/camel-store.sgml
deleted file mode 100644
index 2882c09986..0000000000
--- a/devel-docs/camel/tmpl/camel-store.sgml
+++ /dev/null
@@ -1,45 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-CamelStore
-
-<!-- ##### SECTION Short_Description ##### -->
-
-A class representing a message (local or distant) repository
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-The store class models a place where messages can be stored and retreived. It can be a local
-store (for example an mbox-style store) or a distant server (for example an POP3 server). Messages are
-not retreived or stored directly with a CamelStore object. Instead, a CamelFolder object must be
-obtained from the store first.
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### STRUCT CamelStore ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### FUNCTION camel_store_get_separator ##### -->
-<para>
-
-</para>
-
-@store:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_store_get_folder ##### -->
-<para>
-
-</para>
-
-@store:
-@folder_name:
-@Returns:
-
-
diff --git a/devel-docs/camel/tmpl/camel-stream.sgml b/devel-docs/camel/tmpl/camel-stream.sgml
deleted file mode 100644
index e965db2e45..0000000000
--- a/devel-docs/camel/tmpl/camel-stream.sgml
+++ /dev/null
@@ -1,101 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-CamelStream
-
-<!-- ##### SECTION Short_Description ##### -->
-
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### FUNCTION camel_stream_seek ##### -->
-<para>
-
-</para>
-
-@stream:
-@offset:
-@policy:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_stream_write ##### -->
-<para>
-
-</para>
-
-@stream:
-@buffer:
-@n:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_stream_flush ##### -->
-<para>
-
-</para>
-
-@stream:
-
-
-<!-- ##### FUNCTION camel_stream_eos ##### -->
-<para>
-
-</para>
-
-@stream:
-@Returns:
-
-
-<!-- ##### MACRO camel_stream_write_string ##### -->
-<para>
-
-</para>
-
-@stream:
-@string:
-
-
-<!-- ##### FUNCTION camel_stream_close ##### -->
-<para>
-
-</para>
-
-@stream:
-
-
-<!-- ##### FUNCTION camel_stream_write_strings ##### -->
-<para>
-
-</para>
-
-@stream:
-@Varargs:
-
-
-<!-- ##### FUNCTION camel_stream_read ##### -->
-<para>
-
-</para>
-
-@stream:
-@buffer:
-@n:
-@Returns:
-
-
-<!-- ##### FUNCTION camel_stream_available ##### -->
-<para>
-
-</para>
-
-@stream:
-@Returns:
-
-
diff --git a/devel-docs/misc/ref_and_id_proposition.txt b/devel-docs/misc/ref_and_id_proposition.txt
deleted file mode 100644
index 2127b45a57..0000000000
--- a/devel-docs/misc/ref_and_id_proposition.txt
+++ /dev/null
@@ -1,237 +0,0 @@
-Author: Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org>
-Date: August 9th 1999
-Last revision date : September 3rd 1999
-Version: 0.2
-
-The last version of this document is always available in gnome CVS in
-the gnome-mailer module: devel-docs/misc/ref_and_id_proposition.txt
-
-
-
-A) Identifying messages within folders
---------------------------------------
-
-Currently, in Camel there is only one way to retrieve a message from a
-mail store:
- CamelMimeMessage *
- get_message (CamelFolder *folder, gint number)
-
-where number is an integer representing the message rank within its
-parent folder.
-
-This is a traditional method (JavaMail, MAPI) and it is very useful
-because this is often the only way to get a message in from a
-classical store (pop3 for example).
-
-Moreover, various documents ([1], [2]) proposed to generalize the URL
-scheme used in Camel ([3]) to access mail stores in order to identify
-messages. Such an URL would be, for instance:
-
-pop3://po.myisp.com:1
-
-Meaning: "Access message 1 on Pop3 server po.myisp.com"
-
-
-However, referencing a message with its number within a folder is a
-very unreliable method:
-
-1) Message order in a folder can change during a session:
-
- The user can move or remove messages from the folder, thus
- completely changing message numbers. We could however imagine to
- follow message operations in order to keep camel in a coherent
- state at each time instant. This could be quite complex but may
- be feasible using gtk signal system.
-
-2) Message order can change between sessions:
-
- Gnome-mailer was designed from the begining to allow messages to be
- stored in classical mailboxes (mbox, maildir, MH, IMAP ...), in
- order to allow users to run other MUA on their mailboxes if
- necessary. These other MUA can change message order within folders
- without any chance for Camel to trace the operations.
-
-These two scenarii show that it is quite impossible to use reliable
-folder caching or message referencing if messages are referenced only
-by their position within their parent folder.
-
-
-We thus have to find a general way to identify and retreive a message
-within its folder. One thing is sure, however: all folders
-implementation won't allow this method. Pop3 stores will always access
-messages using their rank on the server. MUA using Camel will thus
-have to be prepared to access some stores providing only the old
-fashionned message number access method.
-
-Basically, we have two choices:
-
-1) Accessing messages using (mailbox) Unique ID (UID)
-
- A UID is a string identifier associated to a message, which is
- guaranteed to be unique within its parent folder and which will not
- change between sessions.
-
-2) Accessing messages using Message ID
-
- A Message ID is a string identifier associated to a messages which
- is guaranteed to be unique in the world, that is, no other message
- can have the same Message ID. The message ID is defined in RFC 822,
- and is stored as the message header "Message-id"
-
-Method (1) already exists in IMAP.
-It is quite simple to define on local stores (MH, mbox, ....) but it
-may not resist to message modification by other MUA.
-Methods based on Message-id matching or message content checksum seem
-to be the best one. Using an "X-" header is another possibility for
-non read-only folders. A combination of these three methods may be the
-most reliable solution.
-The UID is impossible to implement in a POP3 store provider.
-
-(2) Can be used with IMAP, but would be very ineficient.
-The main issue with this method is its dependancy upon other MUAs and
-MTAs. Message-id is set before or during message transport. Moreover,
-some rfc822 compliant messages may not even have any Message-id
-header.
-These are major issues when accessing read-only stores.
-The M-ID is also impossible to implement in a POP3 store provider.
-
-
-We may not rely on external MUA and MTA to guarentee the uniqueness of
-the identifier . We may loose messages by never being able to read them
-if two had the same uid. It would be possible to find workarounds, but
-it could make Camel use a bit tricky.
-
-Given that most users will use IMAP or a database based store as their
-main mail store, and given that this stores allow UID very
-easily, I suggest that we use method (1). Discussion is still open,
-though.
-
-Here are the public methods I propose to add to CamelFolder:
-
-gboolean camel_folder_supports_uid (CamelFolder *folder)
- returns true if the folder can get messages
- by their uid.
-
-gchar * camel_folder_get_uid_by_number (CamelFolder *folder, gint message_number)
- return the uid of message which number in the folder
- is %message_number.
-
-gchar * camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message)
- return the uid of the message within the folder.
-
-CamelMimeMessage *camel_folder_get_message_by_uid (CamelFolder *folder, gchar *uid)
- return the message which uid is %uid
-
-In addition, the CamelMessage Class will have a new public method
-
-gchar * camel_mime_message_get_uid (CamelMimeMessage *message)
- return the uid associated to the message in its physical parent
- folder.
-
-
-
-B) Handling message references in (v)folders.
----------------------------------------------
-
-
-We want the future Gnome mailer to be able to build (virtual) folders
-holding references to messages physically located in other
-folders. More generally, we would like folders to be able to hold:
-
-1) messages
-2) subfolders
-3) references to messages
-
-(1) and (2) are already implemented in Camel because most mail stores
-can hold messages and/or subfolders.
-
-(3) is a different issue, because no existing mail store can currently
-hold, within folders, references to messages in other folders.
-It will thus be a specific gnome-mailer extension.
-
-
-One of the main issue is to determine what kind of behaviour we expect
-from folders holding references. Here is a possible API.
-
-( the world (v)folder is used to distinguish between the physical
-parent folder and the folder holding a reference to the message, when
-a confusion may arise)
-
-Addition to CamelFolder:
-
-gboolean camel_folder_can_hold_references (CamelFolder *folder)
- return true if the folder can contain references
-
-void camel_folder_add_reference_by_uid (CamelFolder *folder, gchar *folder_url, gchar *message_uid)
- add a reference into a folder. %folder_url is the url of
- the folder, %message_uid is the uid of the message within
- its physical parent folder.
-
-void camel_folder_add_reference_by_message (CamelFolder *folder, CamelMessage *message)
- add a reference. The place where the reference points
- to is found using CamelMessage methods
-
-void camel_folder_remove_reference_by_uid (CamelFolder *folder, gchar *uid)
- remove a message reference form a folder. Reference
- is identified using its uid within the folder.
-
-gboolean camel_folder_uid_is_reference (CamelFolder *folder, gchar *uid)
- return true if the message corresponding to the uid is a reference.
-
-Then all usual operations on the folder act if the message was
-actually physically stored in this folder. For example, when the mailer
-uses camel_folder_get_message_by_uid onto the (v)folder, the actual
-message is retreived from its physical store.
-
-As you can see, the uid of the message within its physical parent
-folder is different than its uid within the (v)folder. This is because
-there is no way to guarantee that the uids of two messages in two
-different folders would be different. Using references on this two
-message in the same vfolder would break uniqueness of the uid in the
-(v)folder.
-
-A couple of other methods could be defined but all the basics are
-described here.
-
-This draft API is far from complete nor perfect, and is described here
-only to stimulate discussions before the actual implementation.
-
-
-The question now is to know how we store references. There are basically
-two ways:
-
-1) references are stored using the URL of the physical folder
- and the uid of the message within the folder
-
-2) a list of reference is kept, and in this list, reference are stored
-as in (1). Folders would refer to the actual message using index in
-the list
-
-
-
-The main problem with (1) is that references get lost as soon
-as the actual message is moved. There is no way to find in which
-folders references to the message exist.
-
-(2) is a way to solve this issue. When messages are used, Camel looks
-in the list to see if the message is refered somewhere, and actualize
-the URL and the uid with their new values.
-
-The problem with (2) is that we need to keep this information in a file
-and libraries writing automatically to files are generally a bad idea.
-
-As in additional remark, it is clear that Camel will only be able to
-hold references to messages on stores supporting UIDs.
-
-
-Thanks in advance for your comments and ideas,
-
-
- Bertrand <Bertrand.Guiheneuf@aful.org>
-
-
---
-
-[1] : http://www.selequa.com/%7epurp/gnomail/mail2db.html
-[2] : http://www.selequa.com/%7epurp/gnomail/dbRecFmt.html
-[3] : http://www.gnome.org/mailing-lists/archives/gnome-mailer-list/1999-April/0248.shtml
diff --git a/devel-docs/query/virtual-folder-in-depth.sgml b/devel-docs/query/virtual-folder-in-depth.sgml
deleted file mode 100644
index d3e3e0504b..0000000000
--- a/devel-docs/query/virtual-folder-in-depth.sgml
+++ /dev/null
@@ -1,407 +0,0 @@
-<!doctype article PUBLIC "-//Davenport//DTD DocBook V3.0//EN" []>
-
-<!-- SGMLized by Bertrand <Bertrand.Guiheneuf@aful.org> -->
-
-<article id="index">
- <artheader>
- <authorgroup>
- <author>
- <firstname>Giao</firstname>
- <surname>Nguyen</surname>
- </author>
- </authorgroup>
-
- <title>An in-depth look at the virtual folder mechanism</title>
- <abstract>
- <para>
- This document describes a different way of approaching mail
- organization and how all things are possible in this brave new
- world. This document does not describe physical storage issues
- nor interface issues.
- </para>
- <para>
- Historically mail has been organized into folders. These
- folders usually mapped to a single storage medium. The
- relationship between mail organization and storage medium was
- one to one. There was one mail organization for every storage
- medium. This scheme had its limitations.
- </para>
- <para>
- Efforts at categorizations are only meaningful at the instance that
- one categorized. To find any piece of data, regardless of how well
- it was categorized, required some amount of searching. Therefore, any
- attempts to nullify searching is doomed to fail. It's time to embrace
- searching as a way of life.
- </para>
- <para>
- These are the terms and their definitions. The example rules used are
- based on the syntax for VM (http://www.wonderworks.com/vm/) by Kyle
- Jones whose ideas form the basis for this. I'm only adding the
- existence of summary files to aid in scaling. I currently use VM and
- it's virtual-folder rules for my daily mail purposes. To date, my only
- complaints are speed (it has no caches) and for the unitiated, it's
- not very user-friendly.
- </para>
- <para>
- Comments, questions, rants, etc. should be directed at Giao Nguyen
- (grail@cafebabe.org) who will try to address issues in a timely
- manner.
- </para>
- </abstract>
- </artheader>
-
- <!-- Definitions -->
- <sect1 id="definitions">
- <title>Definitions</title>
- <sect2>
- <title>Store</title>
- <para>
- A location where mail can be found. This may be a file (Berkeley
- mbox), directory (MH), IMAP server, POP3 server, Exchange server,
- Lotus Notes server, a stack of Post-Its by your monitor fed through
- some OCR system.
- </para>
- </sect2>
-
- <sect2>
- <title>Message</title>
- <para>
- An individual mail message.
- </para>
- </sect2>
- <sect2>
- <title>Vfolder</title>
- <para>
- A group of messages sharing some commonality. This is the result of a
- query. The vfolder maybe contained in a store, but it is not necessary
- that a store holds only one vfolder. There is always an implicit
- vfolder rule which matches all messages. A store contains the vfolder
- which is the result of the query (any). It's short for virtual folder
- or maybe view folder. I dunno.
- </para>
- </sect2>
- <sect2>
- <title>Default-vfolder</title>
- <para>
- The vfolder defined by (any) applied to the store. This is not the
- inbox. The inbox could easily be defined by a query. A default rule
- for the inbox could be (new) but it doesn't have to be. Mine happens
- to be (or (unread) (new)).
- </para>
- </sect2>
- <sect2>
- <title>Folder</title>
- <para>
- The classical mail folder approach: one message organization per
- store.
- </para>
- </sect2>
- <sect2>
- <title>Query</title>
- <para>
- A search for messages. The result of this is a vfolder. There are two
- kinds of queries: named queries and lambda queries. More on this
- later.
- </para>
- </sect2>
- <sect2>
- <title>Summary file </title>
- <para>
- An external file that contains pointers to messages which are matches
- for a named query. In addition to pointers, the summary file should
- also contain signatures of the store for sanity checks. When the term
- "index" is used as a verb, it means to build a summary file for a
- given name-value pair.
- </para>
- </sect2>
- </sect1>
-
- <!-- Queries -->
- <sect1>
- <title>Queries</title>
- <para>
- Named queries are analogous to classical mail folders. Because named
- queries maybe reused, summary files are kept as caches to reduce
- the overall cost of viewing a vfolder. Summary files are superior to
- folders in that they allow for the same messages to appear in multiple
- vfolders without message duplications. Duplications of messages
- defeats attempts at tagging a message with additional user information
- like annotations. Named queries will define folders.
- </para>
- <para>
- Lambda queries are similar to named queries except that they have no
- name. These are created on the fly by the user to filter out or
- include certain messages.
- </para>
- <para>
- All queries can be layered on top of each other. A lambda query can be
- layered on a named query and a named query can be layered on a lambda
- query. The possibilities are endless.
- </para>
- <para>
- The layerings can be done as boolean operations (and, or, not). Short
- circuiting should be used.
- </para>
- <para>
- Examples:
- <programlisting>
-(and (author "Giao")
- (unread))
- </programlisting>
- The (unread) query should only be evaluated on the results of (author
- "Giao").
- <programlisting>
-(or (author "Giao")
- (unread))
- </programlisting>
- Both of these queries should be evaluated. Any matches are added to the
- resulting vfolder.
- </para>
- </sect1>
-
- <!-- Summary files -->
- <sect1>
- <title>Summary files</title>
- <para>
- Summary files are only meaningful when applied to the context of the
- default-vfolder of a store.
- </para>
- <para>
- Summary files should be generated for queries of the form:
- <programlisting>
-(function "constant value")
- </programlisting>
- Summary files should never be generated for queries of the form:
- <programlisting>
- (function (function1))
-
- (and (function "value")
- (another-function "another value"))
- </programlisting>
- Given a query of the form:
- <programlisting>
- (and (function "value")
- (another-function "another value"))
- </programlisting>
- The system should use one summary file for (function "value") and
- another summary file for (another-function "another value"). I will
- call the prior form the "plain form".
- </para>
- <para>
- It should be noted that the signature of the store should be based on
- the assumption that new data may have been added to the store since
- the application generated the summary file. Signatures generated on
- the entirety of the store will most likely be meaningless for things
- like POP/IMAP servers.
- </para>
- </sect1>
-
- <!-- Incremental Indexing -->
- <sect1>
- <title>Incremental indexing</title>
- <para>
- When new messages are detected, all known queries should be evaluated
- on the new messages. vfolders should be notified of new messages that
- are positive matches for their queries. The indexes generated by this
- process should be merged into the current indexes for the vfolder.
- </para>
- </sect1>
-
- <!-- Can I have multiple stores -->
- <sect1>
- <title>Can I have multiple stores?</title>
- <para>
- I don't see why not. Again, the inbox is a vfolder so you can get a
- unified inbox consisting of all new mail sent to all your stores or
- your can get inboxes for each store or any combination your heart
- desire. You get your cake, eat it, and someone else cleans the dishes!
- </para>
- </sect1>
-
- <!-- Why all this? -->
- <sect1>
- <title>Why all this?</title>
- <para>
- Consider the dynamic nature of the following query:
- <programlisting>
-(and (author "Giao")
- (sent-after (today-midnight)))
- </programlisting>
- today-midnight would be a function that is evaluated at run-time to
- calculate the appropriate object.
- </para>
- </sect1>
-
- <!-- Scenarios of usage and their solutions -->
- <sect1>
- <title>Scenarios of usage and their solutions</title>
- <sect2>
- <title>Mesage alterations</title>
- <para>
- This is a fuzzy area that should be left to the UI to handle. Messages
- are altered. Read status are altered when a new message is read for
- example. How do we handle this if our query is for unread messages?
- Upon viewing the state would change.
- </para>
- <para>
- One idea is to not evaluate the queries unless we're changing between
- vfolder views. This assumes that one can only view a particular
- vfolder at a time. For multi-vfolder viewing, a message change should
- propagate through the vfolder system. Certain effects (as in our
- example) would not be intuitive.
- </para>
- <para>
- It would not be a clean solution to make special cases but they may be
- necessary where certain defined fields are ignored when they are
- changed. Some combination of the above rules can be used. I don't
- think it's an easy solution.
- </para>
- </sect2>
- <sect2>
- <title>Message inclusion and exclusion</title>
- <para>
- Messages are included and excluded also with queries. The final query
- will have the form of:
- <programlisting>
- (and (author "Giao")
- (criteria value)
- (not (criteria other-value)))
- </programlisting>
- Userland criterias may be a label of some sort. These may be userland
- labels or Message-IDs. What are the performance issues involved in
- this? With short circuiting, it's not a major problem.
- </para>
- <para>
- The criterias and values are determined by the UI. The vfolder
- mechanism isn't concerned with such issues.
- </para>
- <para>
- Messages can be included and excluded at will. The idea is often
- called "arbitrary inclusion/exclusion". This can be done by
- Message-IDs or other fields. It's been noted that Message-IDs are not
- unique.
- </para>
- <para>
- I propose that any given vfolder is allocated an inclusion label and an
- exclusion label. These should be randomly generated. This should be
- part of the vfolder description. It should be noted that the vfolder
- description has not been drafted yet.
- </para>
- <para>
- The result is such that the rules for a given named query is:
- <programlisting>
- (and (user-query)
- (label inclusion-label)
- (not exclusion-label))
- </programlisting>
- </para>
- </sect2>
- <sect2>
- <title>Query scheduling</title>
- <para>
- Consider the following extremely dynamic queries:
- <programlisting>
- A:
- (and (author "Giao")
- (sent-after (today-midnight)))
-
- B:
- (and (sent-after (today-midnight))
- (author "Giao"))
-
- C:
- (or (author "Giao")
- (sent-after (today-midnight)))
- </programlisting>
- Query A would be significantly faster because (author "Giao") is not
- dynamic. A summary file could be generated for this query. Query B is
- slow and can be optimized if there was a query compiler of some
- sort. Query C demonstrates a query in which there is no good
- optimization which can be applied. These come with a certain amount of
- baggage.
- </para>
- <para>
- It seems then that for boolean 'and' operations, plain forms should be
- moved forward and other queries should be moved such that they are
- evaluated later. I would expect that the majority of queries would be
- of the plain form.
- </para>
- <para>
- First is that the summary file is tied to the query and the store
- where the query originates from. Second, a hashing function for
- strings needs to be calculated for the query so that the query and the
- summary file can be associated. This hashing function could be similar
- to the hashing function described in Rob Pike's "The Practice of
- Programming". (FIXME: Stick page number here)
- </para>
- </sect2>
- <sect2>
- <title>Archives</title>
- <para>
- Many people are concerned that archives won't be preserved, archives
- aren't supported, and many other archive related issues. This is the
- short version.
- </para>
- <para>
- Archives are just that, archives. Archives are stores. Take your
- vfolder, export it to a store. You are done. If you load up the store
- again, then the default-vfolder of that store is the view of the
- vfolder, except the query is different.
- </para>
- <para>
- The point to vfolder is not to do away with classical folder
- representation but to move the queries to the front where it would
- make data management easier for people who don't think in terms of
- files but in terms of queries because ordinary people don't think in
- terms of files.
- </para>
- </sect2>
- </sect1>
-
- <!-- Miscellany -->
- <sect1>
- <title>Miscellany</title>
- <sect2>
- <title>Annotations</title>
- <para>
- There should be a scheme to add annotations to messages. Common mail
- user agents have used a tag in the message header to mark messages as
- read/unread for example. Extending on this we have the ability to add
- our own data to a message to add meaning to it. If we have a good
- scheme for doing this, new possibilities are opened.
- </para>
- <sect3>
- <title>Keywords</title>
- <para>
- When sending a message, a message could have certain keywords attached
- to it. While this can be done with the subject line, the subject line
- has a tendency to be munged by other mail applications. One popular
- example is the "[rR]e:" prefix. Using the subject line also breaks the
- "contract" with other mail user agents. Using keywords in another
- field in the message header allows the sender to assist the recipient
- in organizing data automatically. Note that the sender can only
- provide hints as the sender is unlikely to know the organization
- schemes of the recipient.
- </para>
- </sect3>
- </sect2>
- <sect2>
- <title>Scope</title>
- <para>
- Let us assume that we have multiple stores. Does a query work on a
- given store? Or does it work on all stores? Or is it configurable such
- that a query can work on a user-selected list of stores?
- </para>
- </sect2>
- </sect1>
-
- <!-- Alternatives to the above -->
- <sect1>
- <title>Alternatives to the above</title>
- <para>
- Jim Meyer (purp@selequa.com) is putting some notes on where
- annotations needs to be located. They'll be located here as well as
- any contributions I may have to them.
- </para>
- </sect1>
-</article>
diff --git a/devel-docs/query/virtual-folder-in-depth.txt b/devel-docs/query/virtual-folder-in-depth.txt
deleted file mode 100644
index 01718a5f05..0000000000
--- a/devel-docs/query/virtual-folder-in-depth.txt
+++ /dev/null
@@ -1,309 +0,0 @@
-TITLE: An in-depth look at the virtual folder mechanism
-AUTHOR: Giao Nguyen <grail@cafebabe.org>
-
-* introduction
-
-This document describes a different way of approaching mail
-organization and how all things are possible in this brave new
-world. This document does not describe physical storage issues nor
-interface issues.
-
-Historically mail has been organized into folders. These folders
-usually mapped to a single storage medium. The relationship between
-mail organization and storage medium was one to one. There was one
-mail organization for every storage medium. This scheme had its
-limitations.
-
-Efforts at categorizations are only meaningful at the instance that
-one categorized. To find any piece of data, regardless of how well
-it was categorized, required some amount of searching. Therefore, any
-attempts to nullify searching is doomed to fail. It's time to embrace
-searching as a way of life.
-
-These are the terms and their definitions. The example rules used are
-based on the syntax for VM (http://www.wonderworks.com/vm/) by Kyle
-Jones whose ideas form the basis for this. I'm only adding the
-existence of summary files to aid in scaling. I currently use VM and
-it's virtual-folder rules for my daily mail purposes. To date, my only
-complaints are speed (it has no caches) and for the unitiated, it's
-not very user-friendly.
-
-Comments, questions, rants, etc. should be directed at Giao Nguyen
-<grail@cafebabe.org> who will try to address issues in a timely
-manner.
-
-* Definitions
-
-** store
-
-A location where mail can be found. This may be a file (Berkeley
-mbox), directory (MH), IMAP server, POP3 server, Exchange server,
-Lotus Notes server, a stack of Post-Its by your monitor fed through
-some OCR system.
-
-** message
-
-An individual mail message.
-
-** vfolder
-
-A group of messages sharing some commonality. This is the result of a
-query. The vfolder maybe contained in a store, but it is not necessary
-that a store holds only one vfolder. There is always an implicit
-vfolder rule which matches all messages. A store contains the vfolder
-which is the result of the query (any). It's short for virtual folder
-or maybe view folder. I dunno.
-
-** default-vfolder
-
-The vfolder defined by (any) applied to the store. This is not the
-inbox. The inbox could easily be defined by a query. A default rule
-for the inbox could be (new) but it doesn't have to be. Mine happens
-to be (or (unread) (new)).
-
-** folder
-
-The classical mail folder approach: one message organization per
-store.
-
-** query
-
-A search for messages. The result of this is a vfolder. There are two
-kinds of queries: named queries and lambda queries. More on this
-later.
-
-** summary file
-
-An external file that contains pointers to messages which are matches
-for a named query. In addition to pointers, the summary file should
-also contain signatures of the store for sanity checks. When the term
-"index" is used as a verb, it means to build a summary file for a
-given name-value pair.
-
-* Queries
-
-Named queries are analogous to classical mail folders. Because named
-queries maybe reused, summary files are kept as caches to reduce
-the overall cost of viewing a vfolder. Summary files are superior to
-folders in that they allow for the same messages to appear in multiple
-vfolders without message duplications. Duplications of messages
-defeats attempts at tagging a message with additional user information
-like annotations. Named queries will define folders.
-
-Lambda queries are similar to named queries except that they have no
-name. These are created on the fly by the user to filter out or
-include certain messages.
-
-All queries can be layered on top of each other. A lambda query can be
-layered on a named query and a named query can be layered on a lambda
-query. The possibilities are endless.
-
-The layerings can be done as boolean operations (and, or, not). Short
-circuiting should be used.
-
-Examples:
-
-(and (author "Giao")
- (unread))
-
-The (unread) query should only be evaluated on the results of (author
-"Giao").
-
-(or (author "Giao")
- (unread))
-
-Both of these queries should be evaluated. Any matches are added to the
-resulting vfolder.
-
-* Summary files
-
-Summary files are only meaningful when applied to the context of the
-default-vfolder of a store.
-
-Summary files should be generated for queries of the form:
-
-(function "constant value")
-
-Summary files should never be generated for queries of the form:
-
-(function (function1))
-
-(and (function "value")
- (another-function "another value"))
-
-Given a query of the form:
-
-(and (function "value")
- (another-function "another value"))
-
-The system should use one summary file for (function "value") and
-another summary file for (another-function "another value"). I will
-call the prior form the "plain form".
-
-It should be noted that the signature of the store should be based on
-the assumption that new data may have been added to the store since
-the application generated the summary file. Signatures generated on
-the entirety of the store will most likely be meaningless for things
-like POP/IMAP servers.
-
-* Incremental indexing
-
-When new messages are detected, all known queries should be evaluated
-on the new messages. vfolders should be notified of new messages that
-are positive matches for their queries. The indexes generated by this
-process should be merged into the current indexes for the vfolder.
-
-* Can I have multiple stores?
-
-I don't see why not. Again, the inbox is a vfolder so you can get a
-unified inbox consisting of all new mail sent to all your stores or
-your can get inboxes for each store or any combination your heart
-desire. You get your cake, eat it, and someone else cleans the dishes!
-
-* Why all this?
-
-Consider the dynamic nature of the following query:
-
-(and (author "Giao")
- (sent-after (today-midnight)))
-
-today-midnight would be a function that is evaluated at run-time to
-calculate the appropriate object.
-
-* Scenarios of usage and their solutions
-
-** Mesage alterations
-
-This is a fuzzy area that should be left to the UI to handle. Messages
-are altered. Read status are altered when a new message is read for
-example. How do we handle this if our query is for unread messages?
-Upon viewing the state would change.
-
-One idea is to not evaluate the queries unless we're changing between
-vfolder views. This assumes that one can only view a particular
-vfolder at a time. For multi-vfolder viewing, a message change should
-propagate through the vfolder system. Certain effects (as in our
-example) would not be intuitive.
-
-It would not be a clean solution to make special cases but they may be
-necessary where certain defined fields are ignored when they are
-changed. Some combination of the above rules can be used. I don't
-think it's an easy solution.
-
-** Message inclusion and exclusion
-
-Messages are included and excluded also with queries. The final query
-will have the form of:
-
-(and (author "Giao")
- (criteria value)
- (not (criteria other-value)))
-
-Userland criterias may be a label of some sort. These may be userland
-labels or Message-IDs. What are the performance issues involved in
-this? With short circuiting, it's not a major problem.
-
-The criterias and values are determined by the UI. The vfolder
-mechanism isn't concerned with such issues.
-
-Messages can be included and excluded at will. The idea is often
-called "arbitrary inclusion/exclusion". This can be done by
-Message-IDs or other fields. It's been noted that Message-IDs are not
-unique.
-
-I propose that any given vfolder is allocated an inclusion label and an
-exclusion label. These should be randomly generated. This should be
-part of the vfolder description. It should be noted that the vfolder
-description has not been drafted yet.
-
-The result is such that the rules for a given named query is:
-
-(and (user-query)
- (label inclusion-label)
- (not exclusion-label))
-
-** Query scheduling
-
-Consider the following extremely dynamic queries:
-
-A:
-(and (author "Giao")
- (sent-after (today-midnight)))
-
-B:
-(and (sent-after (today-midnight))
- (author "Giao"))
-
-C:
-(or (author "Giao")
- (sent-after (today-midnight)))
-
-Query A would be significantly faster because (author "Giao") is not
-dynamic. A summary file could be generated for this query. Query B is
-slow and can be optimized if there was a query compiler of some
-sort. Query C demonstrates a query in which there is no good
-optimization which can be applied. These come with a certain amount of
-baggage.
-
-It seems then that for boolean 'and' operations, plain forms should be
-moved forward and other queries should be moved such that they are
-evaluated later. I would expect that the majority of queries would be
-of the plain form.
-
-First is that the summary file is tied to the query and the store
-where the query originates from. Second, a hashing function for
-strings needs to be calculated for the query so that the query and the
-summary file can be associated. This hashing function could be similar
-to the hashing function described in Rob Pike's "The Practice of
-Programming". (FIXME: Stick page number here)
-
-** Archives
-
-Many people are concerned that archives won't be preserved, archives
-aren't supported, and many other archive related issues. This is the
-short version.
-
-Archives are just that, archives. Archives are stores. Take your
-vfolder, export it to a store. You are done. If you load up the store
-again, then the default-vfolder of that store is the view of the
-vfolder, except the query is different.
-
-The point to vfolder is not to do away with classical folder
-representation but to move the queries to the front where it would
-make data management easier for people who don't think in terms of
-files but in terms of queries because ordinary people don't think in
-terms of files.
-
-* Miscellany
-
-** Annotations
-
-There should be a scheme to add annotations to messages. Common mail
-user agents have used a tag in the message header to mark messages as
-read/unread for example. Extending on this we have the ability to add
-our own data to a message to add meaning to it. If we have a good
-scheme for doing this, new possibilities are opened.
-
-*** Keywords
-
-When sending a message, a message could have certain keywords attached
-to it. While this can be done with the subject line, the subject line
-has a tendency to be munged by other mail applications. One popular
-example is the "[rR]e:" prefix. Using the subject line also breaks the
-"contract" with other mail user agents. Using keywords in another
-field in the message header allows the sender to assist the recipient
-in organizing data automatically. Note that the sender can only
-provide hints as the sender is unlikely to know the organization
-schemes of the recipient.
-
-** Scope
-
-Let us assume that we have multiple stores. Does a query work on a
-given store? Or does it work on all stores? Or is it configurable such
-that a query can work on a user-selected list of stores?
-
-* Alternatives to the above
-
-Jim Meyer <purp@selequa.com> is putting some notes on where
-annotations needs to be located. They'll be located here as well as
-any contributions I may have to them.
diff --git a/doc/Camel-Classes b/doc/Camel-Classes
deleted file mode 100644
index da32d69460..0000000000
--- a/doc/Camel-Classes
+++ /dev/null
@@ -1,24 +0,0 @@
-CamelException
-CamelProvider
-CamelThreadProxy
-GtkObject
- + CamelDataWrapper
- | + CameStreamDataWrapper
- | + CamelMedium
- | | + CamelMimePart
- | | + CamelMimeBodyPart
- | | + CamelMimeMessage
- | + CamelMultipart
- | + CamelSimpleDataWrapper
- + CamelFolder
- | + CamelFolderPtProxy
- + CamelFolderSummary
- + CamelService
- | + CamelStore
- + CamelSession
- + CamelStream
- | + CameDataWrapperStream
- | + CamelStreamFs
- | + CamelStreamBufferedFs
- | + CamelStreamMem
- + CamelThreadProxy \ No newline at end of file
diff --git a/doc/Design b/doc/Design
deleted file mode 100644
index ae5cb911eb..0000000000
--- a/doc/Design
+++ /dev/null
@@ -1,135 +0,0 @@
-
-The Evolution Project specification
-Miguel de Icaza.
-
-
-* Introduction
-
- Evolution is a project aiming at providing the free software
- community with a professional, high-quality tool for managing
- mail, appointments, tasks and other personal information
- tools.
-
- We want to make Evolution a system that addresses our needs
- (the free software development community) and we believe that
- by addressing our needs, we will provide a system that will
- scale in the years to come for other users that are just
- starting to use computers and the internet.
-
- The main objectives of Evolution are to provide these powerful
- features, and to make the user interface as pretty and
- polished as possible.
-
- Evolution is a GNOME application.
-
- Evolution will copy the best user interface bits and the best
- ideas and features found on contemporary groupware systems.
-
-* The overall organization
-
- A bar similar to outlook provides shortcuts for accessing the
- various resources managed by Evolution: mail folders,
- contacts, tasks, journal entries, notes, messages and other
- user-defined destinations.
-
-* User interface widgets
-
-** The ETable package
-
- This package provides a way of displaying and editing tables.
-
- Tables are displayed based on a TableColumn definition that
- defines the layout used for the display. Table Columns can be
- nested, and the package does grouping of information displayed
- according to the criteria defined there.
-
- This is used in multiple places troughout evolution: it is
- used for the Mail summary display, for the TODO display and
- TODO new data entry and for the address book.
-
- Nesting in the address book can be performed on various
- fields. For example, a first level of nesting could be
- "Company" and a second level would be "Country" the result is
- a 2-level tree that can be collapsed expanded and contains the
- information sorted/grouped by those two criteria.
-
- The user interface for this will be copied from Outlook: the
- possibility of adding and removing fields with drag and drop
- as well as grouping using drag and drop.
-
-* The Mail system
-
-** The Mail sources
-
- The mail system will support 4 sources of mail:
-
- POP3 (transfer to a local file).
- IMAP
- Local mbox format in $MAIL.
- Local mbox format that have other delivery points.
-
- On top of that, it will be possible to browse existing mbox
- archives (and possibly other formats in the future, like
- Mailbox and Maildir).
-
-** Storing the mail
-
- Mail that gets incorporated into the system is stored in mbox
- format, and summary files are provided for quick access to the
- files. No modifications to the file on disk is performed (I
- am not quite sure about this, perhaps we want to add the
- status flags and some method for adding metadata to the mail).
-
- Summary files are rebuilt on demand or rebuild if the mbox
- file and the summary file have got out of sync.
-
- A Metadata system that will enable us to attach information to
- a message will have to be designed and implemented (enabling
- users to add annotations to mails, and special keywords and
- flags in a per-message fashion).
-
-** Virtual folders
-
- Virtual folders will enable users to read/browse their mail in
- new ways: by specifying search criterias, these folders will
- contain messages that match the criteria given.
-
- There is more information about this in the libcamel
- directory.
-
- We will index all headers from a message, and possible the
- contents of messages and keep those on a separate file, to
- enable users to query their mail database.
-
-** Mail summary display
-
- The summary will be displayed using the ETable package, to
- enable users to add a number of sorting criteria and various
- display methods for the summary view.
-
- The Outlook methods for displaying will be present on the
- system.
-
- Message threading will be supported in Evolution.
-
-** Message display engine
-
- We are going to be using a combination of
- libcamel/limime/libjamie to parse messages and render them
- into an HTML buffer.
-
-* The HTML engine
-
- The GtkHTML engine will be used to display messages, and will
- be extended to support a number of features that we require:
- internal handling of characters will be based on Unicode
-
-* The message composer
-
- Regular features found in composers will be added: connecting
- the composer to the address book, support for drag and drop
- for including attachments, editing the message, archiving
- drafts and archiving messages sent.
-
- We will probably be extending the GtkHTML engine to support
- editing of HTML text.
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
deleted file mode 100644
index d920da1fd4..0000000000
--- a/e-util/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-INCLUDES = \
- $(GNOME_INCLUDEDIR)
-
-noinst_LIBRARIES = libeutil.a
-
-libeutil_a_SOURCES = \
- e-cursors.c \
- e-cursors.h \
- e-gui-utils.c \
- e-gui-utils.h \
- e-util.h \ No newline at end of file
diff --git a/e-util/e-cursors.c b/e-util/e-cursors.c
deleted file mode 100644
index 150b84b90a..0000000000
--- a/e-util/e-cursors.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * cursors.c: cursor handling for Evolution.
- * copied from Gnumeric.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- */
-#include <config.h>
-#include <gnome.h>
-#include "e-cursors.h"
-
-static GdkColor black, white;
-
-#define GDK_INTERNAL_CURSOR -1
-
-typedef struct {
- GdkCursor *cursor;
- int hot_x, hot_y;
- char **xpm;
-} CursorDef;
-
-static CursorDef cursors [] = {
- { NULL, GDK_INTERNAL_CURSOR, GDK_CROSSHAIR, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_LEFT_PTR, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_FLEUR, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SB_H_DOUBLE_ARROW, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SB_V_DOUBLE_ARROW, NULL },
- { NULL, 0, 0, NULL }
-};
-
-
-static void
-create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, gchar **xpm)
-{
- int height, width, colors;
- char pixmap_buffer [(32 * 32)/8];
- char mask_buffer [(32 * 32)/8];
- int x, y, pix, yofs;
- int transparent_color, black_color;
-
- sscanf (xpm [0], "%d %d %d %d", &height, &width, &colors, &pix);
-
- g_assert (height == 32);
- g_assert (width == 32);
- g_assert (colors <= 3);
-
- transparent_color = ' ';
- black_color = '.';
-
- yofs = colors + 1;
- for (y = 0; y < 32; y++){
- for (x = 0; x < 32;){
- char value = 0, maskv = 0;
-
- for (pix = 0; pix < 8; pix++, x++){
- if (xpm [y + yofs][x] != transparent_color){
- maskv |= 1 << pix;
-
- /*
- * Invert the colours here because it seems
- * to workaround a bug the Matrox G100 Xserver?
- * We reverse the foreground & background in the next
- * routine to compensate.
- */
- if (xpm [y + yofs][x] == black_color){
- value |= 1 << pix;
- }
- }
- }
- pixmap_buffer [(y * 4 + x/8)-1] = value;
- mask_buffer [(y * 4 + x/8)-1] = maskv;
- }
- }
- *bitmap = gdk_bitmap_create_from_data (NULL, pixmap_buffer, 32, 32);
- *mask = gdk_bitmap_create_from_data (NULL, mask_buffer, 32, 32);
-}
-
-void
-e_cursors_init (void)
-{
- GdkColormap *colormap;
- int i;
-
- colormap = gtk_widget_get_default_colormap ();
- gdk_color_white (colormap, &white);
- gdk_color_black (colormap, &black);
-
- for (i = 0; cursors [i].hot_x; i++){
- GdkBitmap *bitmap, *mask;
-
- if (cursors [i].hot_x < 0)
- cursors [i].cursor = gdk_cursor_new (cursors [i].hot_y);
- else {
- create_bitmap_and_mask_from_xpm (&bitmap, &mask, cursors [i].xpm);
-
- /* The foreground and background colours are reversed.
- * See comment above for explanation.
- */
- cursors [i].cursor =
- gdk_cursor_new_from_pixmap (
- bitmap, mask,
- &black, &white,
- cursors [i].hot_x,
- cursors [i].hot_y);
- }
- }
-
- g_assert (i == E_NUM_CURSORS);
-}
-
-void
-e_cursors_shutdown (void)
-{
- int i;
-
- for (i = 0; cursors [i].hot_x; i++)
- gdk_cursor_destroy (cursors [i].cursor);
-}
-
-
-/* Returns a cursor given its type */
-GdkCursor *
-e_cursor_get (ECursorType type)
-{
- g_return_val_if_fail (type >= 0 && type < E_NUM_CURSORS, NULL);
-
- return cursors [type].cursor;
-}
diff --git a/e-util/e-cursors.h b/e-util/e-cursors.h
deleted file mode 100644
index 771e5f6d4d..0000000000
--- a/e-util/e-cursors.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef E_CURSORS_H
-#define E_CURSORS_H
-
-/* Copied from Gnumeric */
-
-typedef enum {
- E_CURSOR_THIN_CROSS,
- E_CURSOR_ARROW,
- E_CURSOR_MOVE,
- E_CURSOR_SIZE_X,
- E_CURSOR_SIZE_Y,
- E_NUM_CURSORS
-} ECursorType;
-
-void e_cursors_init (void);
-void e_cursors_shutdown (void);
-
-#define e_cursor_set(win, c) \
-G_STMT_START { \
- if (win) \
- gdk_window_set_cursor (win, e_cursor_get (c)); \
-} G_STMT_END
-
-#define e_cursor_set_widget(w, c) \
-G_STMT_START { \
- if (GTK_WIDGET (w)->window) \
- gdk_window_set_cursor (GTK_WIDGET (w)->window, e_cursor_get (c)); \
-} G_STMT_END
-
-GdkCursor *e_cursor_get (ECursorType type);
-
-#endif /* E_CURSORS_H */
-
diff --git a/e-util/e-gui-utils.c b/e-util/e-gui-utils.c
deleted file mode 100644
index 7d9f4d49d9..0000000000
--- a/e-util/e-gui-utils.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * GUI utility functions
- *
- * Author:
- * Miguel de Icaza (miguel@helixcode.com)
- *
- * (C) 1999 Miguel de Icaza
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-messagebox.h>
-#include <libgnomeui/gnome-stock.h>
-#include "e-gui-utils.h"
-
-void
-e_notice (GtkWindow *window, const char *type, const char *str)
-{
- GtkWidget *dialog;
-
- dialog = gnome_message_box_new (str, type, GNOME_STOCK_BUTTON_OK, NULL);
-
- if (window)
- gnome_dialog_set_parent (GNOME_DIALOG (dialog), window);
-
- gnome_dialog_run (GNOME_DIALOG (dialog));
-}
-
-static void
-kill_popup_menu (GtkWidget *widget, GtkMenu *menu)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- gtk_object_unref (GTK_OBJECT (menu));
-}
-
-void
-e_auto_kill_popup_menu_on_hide (GtkMenu *menu)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- gtk_signal_connect (GTK_OBJECT (menu), "hide",
- GTK_SIGNAL_FUNC (kill_popup_menu), menu);
-}
-
-void
-e_popup_menu (GtkMenu *menu, GdkEventButton *event)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- e_auto_kill_popup_menu_on_hide (menu);
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button, event->time);
-}
-
-
diff --git a/e-util/e-gui-utils.h b/e-util/e-gui-utils.h
deleted file mode 100644
index 95b8f0b5a1..0000000000
--- a/e-util/e-gui-utils.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef E_GUI_UTILS_H
-#define E_GUI_UTILS_H
-
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkwindow.h>
-
-void e_popup_menu (GtkMenu *menu, GdkEventButton *event);
-void e_auto_kill_popup_menu_on_hide (GtkMenu *menu);
-void e_notice (GtkWindow *window, const char *type, const char *str);
-
-
-#endif /* E_GUI_UTILS_H */
diff --git a/e-util/e-util.h b/e-util/e-util.h
deleted file mode 100644
index ad4d754770..0000000000
--- a/e-util/e-util.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _E_UTIL_H_
-#define _E_UTIL_H_
-
-#define E_MAKE_TYPE(l,str,t,ci,i,parent) \
-GtkType l##_get_type(void)\
-{\
- static GtkType type = 0;\
- if (!type){\
- GtkTypeInfo info = {\
- str,\
- sizeof (t),\
- sizeof (t##Class),\
- (GtkClassInitFunc) ci,\
- (GtkObjectInitFunc) i,\
- NULL, /* reserved 1 */\
- NULL, /* reserved 2 */\
- (GtkClassInitFunc) NULL\
- };\
- type = gtk_type_unique (parent, &info);\
- }\
- return type;\
-}\
-
-#endif /* _E_UTIL_H_ */
diff --git a/e-util/e-util.h-29002 b/e-util/e-util.h-29002
deleted file mode 100644
index ad4d754770..0000000000
--- a/e-util/e-util.h-29002
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _E_UTIL_H_
-#define _E_UTIL_H_
-
-#define E_MAKE_TYPE(l,str,t,ci,i,parent) \
-GtkType l##_get_type(void)\
-{\
- static GtkType type = 0;\
- if (!type){\
- GtkTypeInfo info = {\
- str,\
- sizeof (t),\
- sizeof (t##Class),\
- (GtkClassInitFunc) ci,\
- (GtkObjectInitFunc) i,\
- NULL, /* reserved 1 */\
- NULL, /* reserved 2 */\
- (GtkClassInitFunc) NULL\
- };\
- type = gtk_type_unique (parent, &info);\
- }\
- return type;\
-}\
-
-#endif /* _E_UTIL_H_ */
diff --git a/ebook/e-book.c b/ebook/e-book.c
deleted file mode 100644
index 4230394904..0000000000
--- a/ebook/e-book.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * The Evolution addressbook client object.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 1999, Helix Code, Inc.
- */
-
-#include <ebook/e-book.h>
-
-/**
- * e_book_new:
- * @uri: A URI string describing the location of the backend
- * which the new #EBook will use.
- *
- * Returns: A new #EBook object, bound to the backend specified
- * by @uri, or %NULL if an error occurs.
- */
-EBook *
-e_book_new (const char *uri)
-{
- e_book_get_card (
-}
-
-/**
- * e_book_get_type:
- *
- * Returns: The #GtkType for #EBook.
- */
-GtkType
-e_book_get_type (void)
-{
-}
-
-/**
- * e_book_get_card:
- * @book: An #EBook object.
- * @id: A unique ID which specified a card stored inside
- * @book's backend store.
- *
- * This function fetches the card specified by @id from @book's
- * backend, parses it into a new #ECard object, and returns it.
- *
- * Returns: A newly created #ECard, filled with the card data
- * specified by @id. The #EBook may maintain an internal card cache,
- * and will therefore hold a reference to each #ECard itself. The
- * reference count on the returned #ECard will be incremented when the
- * card is returned. When the client wishes to destroy the returned
- * #ECard, he should just dereference it.
- */
-ECard *
-e_book_get_card (EBook *book, const char *id)
-{
-}
-
-/**
- * e_book_get_cards:
- * @book: An #EBook object.
- *
- * Returns: A #GList of all the #ECards stored in @book's backend.
- * The #GList is newly-allocated for the client and must be freed by
- * him. The #ECard objects in the #GList are each referenced, and
- * must be unreferenced when the client is done using them.
- */
-GList *
-e_book_get_cards (EBook *book)
-{
-}
-
-/**
- * e_book_get_ids:
- * @book: An #EBook object.
- *
- * Returns: A #GList of all the unique card ID strings stored in
- * @book's backend. The #GList is newly-allocated, as are all of the
- * #ECard objects stored in it. The client must free the #GList and
- * unreference all fo the cards when he is done with them.
- */
-GList *
-e_book_get_ids (EBook *book)
-{
-}
-
-/**
- * e_book_sync_card:
- * @book: An #EBook object.
- * @card: A dirty #ECard object.
- *
- * Writes all the changes in @card into @book's card store.
- */
-void
-e_book_sync_card (EBook *book)
-{
-}
-
-/**
- * e_book_update_card:
- * @book: An #EBook object.
- * @card: An #ECard object which has become out-of-date
- * and no longer contains the most current card data
- * in @book's card store.
- *
- * Updates @card with any changes which may have occured in its
- * corresponding backend data.
- */
-void
-e_book_update_card (EBook *book, ECard *card)
-{
-}
-
-/**
- * e_book_add_card:
- * @book: An #EBook object.
- * @card: A newly-created ECard object.
- *
- * Adds @card to @book's card store. Creates a unique ID for @card
- * and sets @card's ID field. This action will cause a #card_added
- * signal to be raised on @book.
- *
- * Returns: The newly-created unique ID for @card. The copy
- * returned is the same copy which is stored in @card. The #EBook
- * may reference @card and keep a handle to it.
- */
-const char *
-e_book_add_card (EBook *book, ECard *card)
-{
-}
-
-/**
- * e_book_remove_card:
- * @book: An #EBook object.
- * @id: A unique ID for a card stored in @book.
- *
- * Removes the card specified by @id from @book's card store. If the
- * client has kept around an old #ECard object for the card being
- * removed, he will have to remove it himself. The #ECard will not
- * receive a #card_removed signals. A #card_removed signal will be
- * raised on @book, the card will be removed from the #EBook card
- * cache, and the corresponding #ECard's reference count will be
- * decremented.
- */
-void
-e_book_remove_card (EBook *book, const char *id)
-{
-}
-
-/**
- * e_book_complete:
- * @book: An #EBook object.
- * @str: A string.
- *
- * The purpose of this function is to provide an easy way for the
- * client application to to implement typing completion in its address
- * entry dialogs. The #EBook will compute a list of cards which
- * potentially complete @str. The basis for the completion (address,
- * nickname, etc) is implementation-dependent, and I may add some
- * configurability to this later.
- *
- * Returns: A list of #ECard objects which are potentially what the
- * user was getting at when he typed @str. The list is sorted in
- * descending order of likelihood. The returned #GList must be freed
- * by the client. The #ECard objects in the #GList may have come from
- * @book's cache, and the client may already hold other references to
- * them. For this reason, the reference count on each #ECard object
- * is incremented when the object is returned.
- */
-GList *
-e_book_complete (EBook *book, const char *str)
-{
-}
-
-/**
- * e_book_get_name:
- * @book: An #EBook object.
- *
- * Returns: The name of the card store to which @book is bound.
- * The returned string must be freed by the client.
- */
-char *
-e_book_get_name (EBook *book)
-{
-}
-
-/**
- * e_book_set_name:
- * @book: An #EBook object.
- * @name: A string containing a new name for @book.
- *
- * Sets @book's name to @name.
- */
-char *
-e_book_set_name (EBook *book, const char *namen)
-{
-}
diff --git a/ebook/e-book.h b/ebook/e-book.h
deleted file mode 100644
index 0aab676e65..0000000000
--- a/ebook/e-book.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * The Evolution addressbook client object.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 1999, Helix Code, Inc.
- */
-
-#ifndef __E_BOOK_H__
-#define __E_BOOK_H__
-
-typedef struct {
- GtkObject parent;
- EBookPrivate *priv;
-} EBook;
-
-typedef struct {
- GtkObjectClass parent;
-
- /*
- * Signals.
- */
- void (card_changed *) (const char *id);
- void (card_removed *) (const char *id);
- void (card_added *) (const char *id);
-} EBookClass;
-
-/* Creating a new addressbook. */
-EBook *e_book_new (const char *uri);
-GtkType e_book_get_type (void);
-
-/* Fetching cards and card IDs out of the addressbook. */
-ECard *e_book_get_card (EBook *book,
- const char *id);
-GList *e_book_get_cards (EBook *book);
-GList *e_book_get_ids (EBook *book);
-
-/* Getting/putting card changes. */
-void e_book_sync_card (EBook *book,
- ECard *card);
-void e_book_update_card (EBook *book,
- ECard *card);
-
-/* Adding and deleting cards. */
-const char *e_book_add_card (EBook *book,
- ECard *card);
-void e_book_remove_card (EBook *book,
- const char *id);
-
-/* Typing completion... */
-GList *e_book_complete (EBook *book,
- const char *str);
-
-/* Information about this addresbook. */
-char *e_book_get_name (EBook *book);
-void e_book_set_name (EBook *book,
- const char *name);
-
-#endif /* ! __E_BOOK_H__ */
diff --git a/ebook/e-card-fields.h b/ebook/e-card-fields.h
deleted file mode 100644
index c1822ca981..0000000000
--- a/ebook/e-card-fields.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ECard field type definitions.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 1999, Helix Code, Inc.
- */
-
-#ifndef __E_CARD_FIELDS_H__
-#define __E_CARD_FIELDS_H__
-
-typedef struct {
- int year;
- int month;
- int day;
-} ECardDate;
-
-typedef struct {
- char *addr;
-
- char *desc;
- char *id;
-} ECardEmail;
-
-typedef struct {
- char *addr1;
- char *addr2;
- char *city;
- char *postcode;
- char *region;
- char *country;
-
- char *desc;
- char *id;
-} ECardAddress;
-
-typedef struct {
- char *phone;
-
- char *desc;
- char *id;
-} ECardPhone;
-
-typedef struct {
- char *url;
-
- char *desc;
- char *id;
-} ECardURL;
-
-#endif /* ! __E_CARD_FIELDS_H__ */
-
diff --git a/ebook/e-card.h b/ebook/e-card.h
deleted file mode 100644
index 4778b62e2c..0000000000
--- a/ebook/e-card.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * The Evolution addressbook card object.
- *
- * Author:
- * Nat Friedman (nat@helixcode.com)
- *
- * Copyright 1999, Helix Code, Inc.
- */
-
-#ifndef __E_CARD_H__
-#define __E_CARD_H__
-
-#include <ebook/e-card-fields.h>
-
-typedef enum {
-} ECardDirtyFlags;
-
-typedef struct _ECardPrivate ECardPrivate;
-
-typedef struct {
- GtkObject parent;
- ECardPrivate *priv;
-} ECard;
-
-typedef struct {
- GtkObjectClass parent;
-
- /*
- * Signals.
- */
- void (changed *) (ECardDirtyFlags dirty);
-} ECardClass;
-
-
-ECard *e_card_new (void);
-GtkType e_card_get_type (void);
-
-/* Name */
-char *e_card_get_full_name (ECard *card);
-
-/* Email */
-GList *e_card_get_emails (ECard *card);
-ECardEmail *e_card_get_email (ECard *card);
-
-/* Snail mail */
-GList *e_card_get_addresses (ECard *card);
-ECardAddress *e_card_get_address (ECard *card);
-
-/* Telephone */
-GList *e_card_get_phones (ECard *card);
-ECardPhone *e_card_get_phone (Ecard *card);
-
-/* Title, position, groups */
-char *e_card_get_title (ECard *card);
-GList *e_card_get_categories (ECard *card);
-
-/* Home page, other URLs associated with this person */
-GList *e_card_get_urls (ECard *card);
-ECardURL *e_card_get_url (ECard *card);
-
-#endif /* ! __E_CARD_H__ */
diff --git a/ebook/e-commerce.h b/ebook/e-commerce.h
deleted file mode 100644
index 788bad0be4..0000000000
--- a/ebook/e-commerce.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef __E_COMMERCE_H__
-#define __E_COMMERCE_H__
-
-typedef {
- GtkObject parent;
-} ECommerce;
-
-typedef {
- GtkObjectClass parent;
-} ECommerceClass;
-
-ECommerce *e_commerce_new (void)
-
-#endif /* ! __E_COMMERCE_H__ */
-
diff --git a/help/Camel-Classes b/help/Camel-Classes
deleted file mode 100644
index da32d69460..0000000000
--- a/help/Camel-Classes
+++ /dev/null
@@ -1,24 +0,0 @@
-CamelException
-CamelProvider
-CamelThreadProxy
-GtkObject
- + CamelDataWrapper
- | + CameStreamDataWrapper
- | + CamelMedium
- | | + CamelMimePart
- | | + CamelMimeBodyPart
- | | + CamelMimeMessage
- | + CamelMultipart
- | + CamelSimpleDataWrapper
- + CamelFolder
- | + CamelFolderPtProxy
- + CamelFolderSummary
- + CamelService
- | + CamelStore
- + CamelSession
- + CamelStream
- | + CameDataWrapperStream
- | + CamelStreamFs
- | + CamelStreamBufferedFs
- | + CamelStreamMem
- + CamelThreadProxy \ No newline at end of file
diff --git a/help/Design b/help/Design
deleted file mode 100644
index ae5cb911eb..0000000000
--- a/help/Design
+++ /dev/null
@@ -1,135 +0,0 @@
-
-The Evolution Project specification
-Miguel de Icaza.
-
-
-* Introduction
-
- Evolution is a project aiming at providing the free software
- community with a professional, high-quality tool for managing
- mail, appointments, tasks and other personal information
- tools.
-
- We want to make Evolution a system that addresses our needs
- (the free software development community) and we believe that
- by addressing our needs, we will provide a system that will
- scale in the years to come for other users that are just
- starting to use computers and the internet.
-
- The main objectives of Evolution are to provide these powerful
- features, and to make the user interface as pretty and
- polished as possible.
-
- Evolution is a GNOME application.
-
- Evolution will copy the best user interface bits and the best
- ideas and features found on contemporary groupware systems.
-
-* The overall organization
-
- A bar similar to outlook provides shortcuts for accessing the
- various resources managed by Evolution: mail folders,
- contacts, tasks, journal entries, notes, messages and other
- user-defined destinations.
-
-* User interface widgets
-
-** The ETable package
-
- This package provides a way of displaying and editing tables.
-
- Tables are displayed based on a TableColumn definition that
- defines the layout used for the display. Table Columns can be
- nested, and the package does grouping of information displayed
- according to the criteria defined there.
-
- This is used in multiple places troughout evolution: it is
- used for the Mail summary display, for the TODO display and
- TODO new data entry and for the address book.
-
- Nesting in the address book can be performed on various
- fields. For example, a first level of nesting could be
- "Company" and a second level would be "Country" the result is
- a 2-level tree that can be collapsed expanded and contains the
- information sorted/grouped by those two criteria.
-
- The user interface for this will be copied from Outlook: the
- possibility of adding and removing fields with drag and drop
- as well as grouping using drag and drop.
-
-* The Mail system
-
-** The Mail sources
-
- The mail system will support 4 sources of mail:
-
- POP3 (transfer to a local file).
- IMAP
- Local mbox format in $MAIL.
- Local mbox format that have other delivery points.
-
- On top of that, it will be possible to browse existing mbox
- archives (and possibly other formats in the future, like
- Mailbox and Maildir).
-
-** Storing the mail
-
- Mail that gets incorporated into the system is stored in mbox
- format, and summary files are provided for quick access to the
- files. No modifications to the file on disk is performed (I
- am not quite sure about this, perhaps we want to add the
- status flags and some method for adding metadata to the mail).
-
- Summary files are rebuilt on demand or rebuild if the mbox
- file and the summary file have got out of sync.
-
- A Metadata system that will enable us to attach information to
- a message will have to be designed and implemented (enabling
- users to add annotations to mails, and special keywords and
- flags in a per-message fashion).
-
-** Virtual folders
-
- Virtual folders will enable users to read/browse their mail in
- new ways: by specifying search criterias, these folders will
- contain messages that match the criteria given.
-
- There is more information about this in the libcamel
- directory.
-
- We will index all headers from a message, and possible the
- contents of messages and keep those on a separate file, to
- enable users to query their mail database.
-
-** Mail summary display
-
- The summary will be displayed using the ETable package, to
- enable users to add a number of sorting criteria and various
- display methods for the summary view.
-
- The Outlook methods for displaying will be present on the
- system.
-
- Message threading will be supported in Evolution.
-
-** Message display engine
-
- We are going to be using a combination of
- libcamel/limime/libjamie to parse messages and render them
- into an HTML buffer.
-
-* The HTML engine
-
- The GtkHTML engine will be used to display messages, and will
- be extended to support a number of features that we require:
- internal handling of characters will be based on Unicode
-
-* The message composer
-
- Regular features found in composers will be added: connecting
- the composer to the address book, support for drag and drop
- for including attachments, editing the message, archiving
- drafts and archiving messages sent.
-
- We will probably be extending the GtkHTML engine to support
- editing of HTML text.
diff --git a/po/.cvsignore b/po/.cvsignore
deleted file mode 100644
index 607fa46017..0000000000
--- a/po/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-*.gmo
-*.mo
-Makefile
-Makefile.in
-Makefile.in.in
-POTFILES
-cat-id-tbl.c
-gnome-objc.pot
-gnome.pot
-stamp-cat-id
-
diff --git a/po/ChangeLog b/po/ChangeLog
deleted file mode 100644
index 7d7a252a7c..0000000000
--- a/po/ChangeLog
+++ /dev/null
@@ -1,7 +0,0 @@
-1998-07-23 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
-
- * pt.po: Added Portuguese translation.
-
-1996-06-12 Tristan Tarrant <ttarrant@suntlc.etnoteam.it>
-
- * it.po : Italian translations added
diff --git a/po/POTFILES.in b/po/POTFILES.in
deleted file mode 100644
index e69de29bb2..0000000000
--- a/po/POTFILES.in
+++ /dev/null
diff --git a/shell/.cvsignore b/shell/.cvsignore
deleted file mode 100644
index f15acb65be..0000000000
--- a/shell/.cvsignore
+++ /dev/null
@@ -1,9 +0,0 @@
-.deps
-.libs
-Shell-stubs.c
-Shell-skels.c
-Shell-common.c
-Shell.h
-evolution
-Makefile.in
-Makefile
diff --git a/shell/Makefile.am b/shell/Makefile.am
deleted file mode 100644
index 03848c6110..0000000000
--- a/shell/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-
-bin_PROGRAMS = evolution
-
-INCLUDES = \
- -DEVOLUTION_VERSION=\""$(VERSION)"\" \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
- -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \
- -I$(srcdir)/../widgets \
- $(BONOBO_GNOME_CFLAGS)
-
-evolution_SOURCES = \
- main.c \
- e-folder.c \
- e-folder.h \
- e-folder-mail.c \
- e-folder-mail.h \
- e-init.c \
- e-init.h \
- e-shell.c \
- e-shell.h
-
-
-evolution_LDADD = \
- ../widgets/shortcut-bar/libshortcut-bar.a \
- ../e-util/libeutil.a \
- $(BONOBO_GNOME_LIBS)
-
diff --git a/shell/Shell.idl b/shell/Shell.idl
deleted file mode 100644
index 0d615b6b3b..0000000000
--- a/shell/Shell.idl
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * CORBA interface for the Evolution shell
- *
- * Authors:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * (C) 2000 Helix Code, Inc.
- */
-#include <bonobo.idl>
-
-module GNOME {
-
- module Evolution {
-
- interface Shell : GNOME::Unknown {
-
- };
- };
-};
diff --git a/shell/e-folder-mail.c b/shell/e-folder-mail.c
deleted file mode 100644
index 72010194c5..0000000000
--- a/shell/e-folder-mail.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * e-folder-mail.c: Mail folder
- *
- * Author:
- * Miguel de Icaza (miguel@helixcode.com)
- *
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include "e-util/e-util.h"
-#include "e-folder-mail.h"
-
-#define PARENT_TYPE e_folder_get_type ()
-
-static const char *
-efm_get_type_name (EFolder *efolder)
-{
- return _("Folder containing Mail Items");
-}
-
-static void
-e_folder_mail_class_init (GtkObjectClass *object_class)
-{
- EFolderClass *efc = (EFolderClass *) object_class;
-
- efc->get_type_name = efm_get_type_name;
-}
-
-static void
-e_folder_mail_init (GtkObject *object)
-{
-}
-
-E_MAKE_TYPE (e_folder_mail, "EFolderMail", EFolderMail, e_folder_mail_class_init, e_folder_mail_init, PARENT_TYPE)
-
-EFolder *
-e_folder_mail_new (const char *uri, const char *name, const char *desc,
- const char *home_page, const char *view_name)
-{
- EFolderMail *efm = gtk_type_new (e_folder_mail_get_type ());
-
- e_folder_construct (E_FOLDER (efm), uri, name, desc, home_page, view_name);
-
- return E_FOLDER (efm);
-}
-
-
diff --git a/shell/e-folder-mail.h b/shell/e-folder-mail.h
deleted file mode 100644
index 76098c6182..0000000000
--- a/shell/e-folder-mail.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _E_FOLDER_MAIL_H_
-#define _E_FOLDER_MAIL_H_
-
-#include "e-folder.h"
-
-#define E_FOLDER_MAIL_TYPE (e_folder_mail_get_type ())
-#define E_FOLDER_MAIL(o) (GTK_CHECK_CAST ((o), E_FOLDER_MAIL_TYPE, EFolderMail))
-#define E_FOLDER_MAIL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_FOLDER_MAIL_TYPE, EFolderMailClass))
-#define E_IS_FOLDER_MAIL(o) (GTK_CHECK_TYPE ((o), E_FOLDER_MAIL_TYPE))
-#define E_IS_FOLDER_MAIL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_FOLDER_MAIL_TYPE))
-
-typedef struct {
- EFolder parent;
-} EFolderMail;
-
-typedef struct {
- EFolderClass parent;
-} EFolderMailClass;
-
-GtkType e_folder_mail_get_type (void);
-EFolder *e_folder_mail_new (const char *uri, const char *name, const char *desc,
- const char *home_page, const char *view_name);
-
-#endif /* _E_FOLDER_MAIL_H_ */
-
-
-
-
diff --git a/shell/e-folder.c b/shell/e-folder.c
deleted file mode 100644
index 566ead1274..0000000000
--- a/shell/e-folder.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * e-folder.c: Abstract class for Evolution folders
- *
- * Author:
- * Miguel de Icaza (miguel@helixcode.com)
- *
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-util/e-util.h"
-#include "e-folder.h"
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-static GtkObjectClass *parent_class;
-
-#define EFC(o) E_FOLDER_CLASS (GTK_OBJECT (o)->klass)
-
-enum {
- VIEW_CHANGED,
- LAST_SIGNAL
-};
-static guint efolder_signals [LAST_SIGNAL] = { 0, };
-
-static void
-e_folder_destroy (GtkObject *object)
-{
- EFolder *efolder = E_FOLDER (object);
-
- if (efolder->uri)
- g_free (efolder->uri);
-
- if (efolder->desc)
- g_free (efolder->desc);
-
- if (efolder->home_page)
- g_free (efolder->home_page);
-
- parent_class->destroy (object);
-}
-
-static void
-e_folder_class_init (GtkObjectClass *object_class)
-{
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = e_folder_destroy;
-
- efolder_signals [VIEW_CHANGED] =
- gtk_signal_new ("view_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EFolderClass, view_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE,
- 0);
- /* Register our signals */
- gtk_object_class_add_signals (
- object_class, efolder_signals, LAST_SIGNAL);
-}
-
-E_MAKE_TYPE (e_folder, "EFolder", EFolder, e_folder_class_init, NULL, PARENT_TYPE)
-
-void
-e_folder_set_uri (EFolder *efolder, const char *uri)
-{
- g_return_if_fail (efolder != NULL);
- g_return_if_fail (E_IS_FOLDER (efolder));
- g_return_if_fail (uri != NULL);
-
- if (efolder->uri)
- g_free (efolder->uri);
-
- efolder->uri = g_strdup (uri);
-}
-
-const char *
-e_folder_get_uri (EFolder *efolder)
-{
- g_return_val_if_fail (efolder != NULL, NULL);
- g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
-
- return efolder->uri;
-}
-
-void
-e_folder_set_description (EFolder *efolder, const char *desc)
-{
- g_return_if_fail (efolder != NULL);
- g_return_if_fail (E_IS_FOLDER (efolder));
- g_return_if_fail (desc != NULL);
-
- if (efolder->desc)
- g_free (efolder->desc);
-
- efolder->desc = g_strdup (desc);
-}
-
-const char *
-e_folder_get_description (EFolder *efolder)
-{
- g_return_val_if_fail (efolder != NULL, NULL);
- g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
-
- return efolder->desc;
-}
-
-void
-e_folder_set_home_page (EFolder *efolder, const char *home_page)
-{
- g_return_if_fail (efolder != NULL);
- g_return_if_fail (E_IS_FOLDER (efolder));
- g_return_if_fail (home_page != NULL);
-
- if (efolder->home_page)
- g_free (efolder->home_page);
-
- efolder->home_page = g_strdup (home_page);
-}
-
-const char *
-e_folder_get_home_page (EFolder *efolder)
-{
- g_return_val_if_fail (efolder != NULL, NULL);
- g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
-
- return efolder->home_page;
-}
-
-const char *
-e_folder_get_type_name (EFolder *efolder)
-{
- g_return_val_if_fail (efolder != NULL, NULL);
- g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
-
- return EFC (efolder)->get_type_name (efolder);
-}
-
-void
-e_folder_construct (EFolder *efolder,
- const char *uri, const char *name,
- const char *desc, const char *home_page,
- const char *view_name)
-{
- g_return_if_fail (efolder != NULL);
- g_return_if_fail (E_IS_FOLDER (efolder));
-
- if (uri)
- efolder->uri = g_strdup (uri);
- if (name)
- efolder->name = g_strdup (name);
- if (desc)
- efolder->desc = g_strdup (desc);
- if (home_page)
- efolder->home_page = g_strdup (home_page);
- if (view_name)
- efolder->view_name = g_strdup (view_name);
-}
-
-const char *
-e_folder_get_name (EFolder *efolder)
-{
- g_return_val_if_fail (efolder != NULL, NULL);
- g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
-
- return efolder->name;
-}
-
-void
-e_folder_set_name (EFolder *efolder, const char *name)
-{
- g_return_if_fail (efolder != NULL);
- g_return_if_fail (E_IS_FOLDER (efolder));
-
- if (efolder->name)
- g_free (efolder->name);
-
- efolder->name = g_strdup (name);
-}
-
-const char *
-e_folder_get_view_name (EFolder *efolder)
-{
- g_return_val_if_fail (efolder != NULL, NULL);
- g_return_val_if_fail (E_IS_FOLDER (efolder), NULL);
-
- return efolder->view_name;
-}
-
-void
-e_folder_set_view_name (EFolder *efolder, const char *view_name)
-{
- g_return_if_fail (efolder != NULL);
- g_return_if_fail (E_IS_FOLDER (efolder));
-
- if (efolder->view_name)
- g_free (efolder->view_name);
-
- efolder->view_name = g_strdup (view_name);
-
- gtk_signal_emit (GTK_OBJECT (efolder),
- efolder_signals [VIEW_CHANGED]);
-}
diff --git a/shell/e-folder.h b/shell/e-folder.h
deleted file mode 100644
index d41a02e6ce..0000000000
--- a/shell/e-folder.h
+++ /dev/null
@@ -1,74 +0,0 @@
-#ifndef _E_FOLDER_H_
-#define _E_FOLDER_H_
-
-#include <gtk/gtkobject.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#define E_FOLDER_TYPE (e_folder_get_type ())
-#define E_FOLDER(o) (GTK_CHECK_CAST ((o), E_FOLDER_TYPE, EFolder))
-#define E_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_FOLDER_TYPE, EFolderClass))
-#define E_IS_FOLDER(o) (GTK_CHECK_TYPE ((o), E_FOLDER_TYPE))
-#define E_IS_FOLDER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_FOLDER_TYPE))
-
-typedef enum {
- E_FOLDER_DND_AS_FORWARD,
- E_FOLDER_DND_AS_MOVE_COPY
-} EFolderDragDropAction;
-
-typedef struct {
- GtkObject parent_object;
-
- /*
- * General properties
- */
- char *uri; /* Location */
- char *name; /* Short name */
- char *desc; /* Full description */
- char *home_page; /* Home page for this folder */
-
- /*
- * Administration properties
- */
- char *view_name; /* View name */
-} EFolder;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Virtual methods
- */
- /* eg: "Folder containing mail items */
- const char *(*get_type_name) (EFolder *efolder);
-
- /*
- * Signals
- */
- void (*view_changed) (EFolder *efolder);
-} EFolderClass;
-
-GtkType e_folder_get_type (void);
-void e_folder_construct (EFolder *efolder,
- const char *uri, const char *name,
- const char *desc, const char *home_page,
- const char *view_name);
-
-void e_folder_set_uri (EFolder *efolder, const char *uri);
-const char *e_folder_get_uri (EFolder *efolder);
-
-void e_folder_set_description (EFolder *efolder, const char *desc);
-const char *e_folder_get_description (EFolder *efolder);
-
-void e_folder_set_home_page (EFolder *efolder, const char *desc);
-const char *e_folder_get_home_page (EFolder *efolder);
-
-const char *e_folder_get_name (EFolder *efolder);
-void e_folder_set_name (EFolder *efolder, const char *name);
-
-const char *e_folder_get_view_name (EFolder *efolder);
-void e_folder_set_view_name (EFolder *efolder, const char *view_name);
-
-const char *e_folder_get_type_name (EFolder *efolder);
-
-#endif /* _E_FOLDER_H_ */
-
diff --git a/shell/e-init.c b/shell/e-init.c
deleted file mode 100644
index 34ccdbcfc3..0000000000
--- a/shell/e-init.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * e-init.c: Initializes Evolution for first time users
- *
- */
-#include <config.h>
-#include <gnome.h>
-#include "e-init.h"
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "e-util/e-gui-utils.h"
-
-char *evolution_base_dir;
-
-static void
-e_init_local (void)
-{
- evolution_base_dir = g_concat_dir_and_file (g_get_home_dir (), "Evolution");
-
- if (g_file_exists (evolution_base_dir))
- return;
-
- if (-1 == mkdir (evolution_base_dir, 0755)){
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Evolution can not create its local folders"));
- exit (0);
- }
-}
-
-void
-e_init (void)
-{
- e_init_local ();
-}
diff --git a/shell/e-init.h b/shell/e-init.h
deleted file mode 100644
index 5684f87b44..0000000000
--- a/shell/e-init.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef E_INIT_H
-#define E_INIT_H
-
-extern char *evolution_base_dir;
-
-void e_init (void);
-
-#endif /* E_INIT_H */
diff --git a/shell/e-shell.c b/shell/e-shell.c
deleted file mode 100644
index 805d207406..0000000000
--- a/shell/e-shell.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * E-shell.c: Shell object for Evolution
- *
- * Authors:
- * Miguel de Icaza (miguel@helixcode.com)
- *
- * (C) 1999 Miguel de Icaza
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include "Shell.h"
-#include "e-util/e-util.h"
-#include "e-shell.h"
-
-#define PARENT_TYPE (gnome_object_get_type ())
-
-static GnomeObjectClass *e_shell_parent_class;
-POA_GNOME_Evolution_Shell__vepv eshell_vepv;
-
-GtkType e_shell_get_type (void);
-
-static POA_GNOME_Evolution_Shell__epv *
-e_shell_get_epv (void)
-{
- POA_GNOME_Evolution_Shell__epv *epv;
-
- epv = g_new0 (POA_GNOME_Evolution_Shell__epv, 1);
-
- return epv;
-}
-
-static void
-init_e_shell_corba_class (void)
-{
- eshell_vepv.GNOME_Unknown_epv = gnome_object_get_epv ();
- eshell_vepv.GNOME_Evolution_Shell_epv = e_shell_get_epv ();
-}
-
-static void
-e_shell_destroy (GtkObject *object)
-{
- EShell *eshell = E_SHELL (object);
-
- if (eshell->base_uri)
- g_free (eshell->base_uri);
-
- GTK_OBJECT_CLASS (e_shell_parent_class)->destroy (object);
-}
-
-static void
-e_shell_class_init (GtkObjectClass *object_class)
-{
- e_shell_parent_class = gtk_type_class (PARENT_TYPE);
- init_e_shell_corba_class ();
-
- object_class->destroy = e_shell_destroy;
-}
-
-static void
-e_shell_init (GtkObject *object)
-{
-}
-
-void
-e_shell_set_base_uri (EShell *eshell, const char *base_uri)
-{
- g_return_if_fail (eshell != NULL);
- g_return_if_fail (!E_IS_SHELL (eshell));
- g_return_if_fail (base_uri != NULL);
-
- if (eshell->base_uri)
- g_free (eshell->base_uri);
-
- eshell->base_uri = g_strdup (base_uri);
-}
-
-const char *
-e_shell_get_base_uri (EShell *eshell)
-{
- g_return_val_if_fail (eshell != NULL, NULL);
- g_return_val_if_fail (!E_IS_SHELL (eshell), NULL);
-
- return eshell->base_uri;
-}
-
-EShell *
-e_shell_new (const char *base_uri)
-{
- EShell *eshell;
-
- g_return_val_if_fail (base_uri != NULL, NULL);
-
- eshell = gtk_type_new (e_shell_get_type ());
- e_shell_set_base_uri (eshell, base_uri);
-
- return eshell;
-}
-
-E_MAKE_TYPE (e_shell, "EShell", EShell, e_shell_class_init, e_shell_init, PARENT_TYPE);
-
-
-
-
diff --git a/shell/e-shell.h b/shell/e-shell.h
deleted file mode 100644
index dd408f40dd..0000000000
--- a/shell/e-shell.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef E_SHELL_H
-#define E_SHELL_H
-
-#include <bonobo/gnome-object.h>
-
-#define E_SHELL_GOAD_ID "GOADID:GNOME:Evolution:Shell:1.0"
-#define E_SHELL_FACTORY_GOAD_ID "GOADID:GNOME:Evolution:ShellFactory:1.0"
-
-#define E_SHELL_TYPE (e_shell_get_type ())
-#define E_SHELL(o) (GTK_CHECK_CAST ((o), E_SHELL_TYPE, EShell))
-#define E_SHELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SHELL_TYPE, EShellClass))
-#define E_IS_SHELL(o) (GTK_CHECK_TYPE ((o), E_SHELL_TYPE))
-#define E_IS_SHELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SHELL_TYPE))
-
-typedef struct {
- GnomeObject base_object;
-
- char *base_uri;
-} EShell;
-
-typedef struct {
- GnomeObjectClass *parent_class;
-} EShellClass;
-
-EShell *e_shell_new (const char *base_uri);
-void e_shell_set_base_uri (EShell *eshell, const char *base_uri);
-const char *e_shell_get_base_uri (EShell *eshell);
-
-#endif /* EVOLUTION_SHELL_H */
diff --git a/shell/main.c b/shell/main.c
deleted file mode 100644
index 76375375dd..0000000000
--- a/shell/main.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Main evolution shell application
- *
- * Authors:
- * Miguel de Icaza (miguel@helixcode.com)
- *
- */
-#include <config.h>
-#include <gnome.h>
-#include <libgnorba/gnorba.h>
-#include <bonobo/gnome-bonobo.h>
-#include <e-util/e-gui-utils.h>
-#include <e-util/e-cursors.h>
-#include <glade/glade.h>
-#include <glade/glade-xml.h>
-
-int shell_debugging = 0;
-
-poptContext ctx;
-
-const struct poptOption shell_popt_options [] = {
- { "debug", '\0', POPT_ARG_INT, &shell_debugging, 0,
- N_("Enables some debugging functions"), N_("LEVEL") },
- { NULL, '\0', 0, NULL, 0 }
-};
-
-int
-main (int argc, char *argv [])
-{
- CORBA_Environment ev;
-
- bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR);
- textdomain (PACKAGE);
-
- CORBA_exception_init (&ev);
- gnome_CORBA_init_with_popt_table (
- "Evolution", VERSION, &argc, argv,
- shell_popt_options, 0, &ctx, GNORBA_INIT_SERVER_FUNC, &ev);
- CORBA_exception_free (&ev);
-
- if (bonobo_init (gnome_CORBA_ORB (), NULL, NULL) == FALSE){
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Failed to initialize the Bonobo component system"));
- return 0;
- }
-
- e_cursors_init ();
-
- glade_gnome_init ();
-
- bonobo_activate ();
-
- gtk_main ();
-
- /* shutdown */
- e_cursors_shutdown ();
-
- return 0;
-}
diff --git a/stamp.h.in b/stamp.h.in
deleted file mode 100644
index 8b13789179..0000000000
--- a/stamp.h.in
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/tests/.cvsignore b/tests/.cvsignore
deleted file mode 100644
index 2a1c36ad1f..0000000000
--- a/tests/.cvsignore
+++ /dev/null
@@ -1,13 +0,0 @@
-test1
-test2
-test3
-test4
-test5
-test6
-test7
-Makefile.in
-Makefile
-.deps
-.libs
-mail1.test
-mail2.test
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index c9aa1b7d68..0000000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-# process this file with automake to create Makefile.in
-
-INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) -I$(top_srcdir)/camel/providers/MH
-LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(GNOME_LIBDIR) \
- $(GNOMEUI_LIBS) $(INTLLIBS) $(PTHREAD_LIB) $(EXTRA_GNOME_LIBS_THREADS)
-# $(BONOBO_LIBS)
-
-
-
-
-#test4_LDADD = \
-# $(top_builddir)/camel/libcamel.la \
-# $(top_builddir)/camel/providers/MH/libcamelmh.la \
-# $(GNOME_LIBDIR) \
-# $(GNOMEUI_LIBS) $(INTLLIBS) $(PTHREAD_LIB)
-
-
-noinst_PROGRAMS = \
- test1 \
- test2 \
- test3 \
- test4 test5 test6 \
- test7 \
- test8
diff --git a/tests/test1.c b/tests/test1.c
deleted file mode 100644
index 5caac29c74..0000000000
--- a/tests/test1.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <stdio.h>
-
-#include "camel-mime-message.h"
-#include "camel-mime-body-part.h"
-#include "camel-multipart.h"
-#include "camel-stream.h"
-#include "camel-stream-fs.h"
-#include "camel-stream-data-wrapper.h"
-#include "camel-log.h"
-#include "camel.h"
-
-int
-main (int argc, char**argv)
-{
- CamelMimeMessage *message;
- CamelMultipart *multipart;
- CamelMimeBodyPart *body_part;
- CamelMimeBodyPart *attachment_part;
- CamelStream *attachment_stream;
-
- /* FILE *output_file; */
- CamelStream *stream;
-
- gtk_init (&argc, &argv);
- camel_init ();
-
- if (argc < 2) {
- attachment_stream = NULL;
- } else {
- if (argc == 2) {
- attachment_stream = camel_stream_fs_new_with_name
- (argv[1], CAMEL_STREAM_FS_READ);
- if (attachment_stream == NULL) {
- fprintf (stderr, "Cannot open `%s'\n",
- argv[1]);
- return 1;
- }
- } else {
- fprintf (stderr, "Usage: %s [<attachment>]\n",
- argv[0]);
- return 1;
- }
- }
-
- message = camel_mime_message_new_with_session ((CamelSession *)NULL);
-
- camel_mime_part_set_description (CAMEL_MIME_PART (message), "a test");
-
- camel_medium_add_header (CAMEL_MEDIUM (message), "X-test1", "the value of a test");
- camel_medium_add_header (CAMEL_MEDIUM (message), "X-test2", "the value of another test");
- /*camel_mime_part_add_content_language (CAMEL_MIME_PART (message), g_string_new ("es-ca"));*/
-
- camel_mime_message_set_received_date (message, g_strdup ("Thu, 20 May 1999, 10:39:14 +0200"));
- camel_mime_message_set_subject (message, g_strdup ("A test message"));
- camel_mime_message_set_reply_to (message, g_strdup ("toto@toto.com"));
- camel_mime_message_set_from (message, g_strdup ("Bertrand.Guiheneuf@aful.org"));
-
- camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO,
- g_strdup ("franck.dechamps@alseve.fr"));
- camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO,
- g_strdup ("mc@alseve.fr"));
- camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_TO,
- g_strdup ("richard.lengagne@aful.org"));
- camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC,
- g_strdup ("Francois.fleuret@aful.org"));
- camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC,
- g_strdup ("maury@justmagic.com"));
- camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_BCC,
- g_strdup ("Bertrand.Guiheneuf@aful.org"));
-
- multipart = camel_multipart_new ();
- body_part = camel_mime_body_part_new ();
- camel_mime_part_set_text (CAMEL_MIME_PART (body_part), "This is a test.\nThis is only a test.\n");
- camel_multipart_add_part (multipart, body_part);
-
- if (attachment_stream == NULL) {
- attachment_part = NULL;
- } else {
- CamelDataWrapper *stream_wrapper;
-
- stream_wrapper = camel_stream_data_wrapper_new
- (attachment_stream);
-
- attachment_part = camel_mime_body_part_new ();
- camel_mime_part_set_encoding (CAMEL_MIME_PART (attachment_part),
- CAMEL_MIME_PART_ENCODING_BASE64);
- camel_medium_set_content_object (CAMEL_MEDIUM (attachment_part),
- stream_wrapper);
- camel_multipart_add_part (multipart, attachment_part);
-
- gtk_object_unref (GTK_OBJECT (stream_wrapper));
- }
-
- camel_medium_set_content_object (CAMEL_MEDIUM (message), CAMEL_DATA_WRAPPER (multipart));
-
- stream = camel_stream_fs_new_with_name ("mail1.test", CAMEL_STREAM_FS_WRITE );
- if (!stream) {
- CAMEL_LOG_FULL_DEBUG ("could not open output file");
- exit(2);
- }
-
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message),
- stream);
- camel_stream_close (stream);
- gtk_object_unref (GTK_OBJECT (stream));
-
- gtk_object_unref (GTK_OBJECT (message));
- gtk_object_unref (GTK_OBJECT (multipart));
- gtk_object_unref (GTK_OBJECT (body_part));
-
- if (attachment_part != NULL)
- gtk_object_unref (GTK_OBJECT (attachment_part));
-
- printf ("Test1 finished\n");
- return 1;
-}
-
diff --git a/tests/test2.c b/tests/test2.c
deleted file mode 100644
index 20e8b739b9..0000000000
--- a/tests/test2.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* tests mime message file parsing */
-#include "gmime-utils.h"
-#include "stdio.h"
-#include "camel-log.h"
-#include "camel-mime-message.h"
-#include "camel-mime-part.h"
-#include "camel-stream.h"
-#include "camel-stream-fs.h"
-#include "camel.h"
-
-int
-main (int argc, char**argv)
-{
- GHashTable *header_table;
- CamelMimeMessage *message;
- CamelStream *input_stream, *output_stream;
-
- gtk_init (&argc, &argv);
- camel_init ();
- camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG;
- message = camel_mime_message_new_with_session( (CamelSession *)NULL);
-
-
- input_stream = camel_stream_fs_new_with_name ("mail.test", CAMEL_STREAM_FS_READ);
- if (!input_stream) {
- perror ("could not open input file");
- printf ("You must create the file mail.test before running this test");
- exit(2);
- }
-
- camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream);
- camel_medium_get_content_object (CAMEL_MEDIUM (message));
- camel_stream_close (input_stream);
- gtk_object_unref (GTK_OBJECT (input_stream));
-
- output_stream = camel_stream_fs_new_with_name ("mail2.test", CAMEL_STREAM_FS_WRITE);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream);
- camel_stream_close (output_stream);
- gtk_object_unref (GTK_OBJECT (output_stream));
-
- gtk_object_unref (GTK_OBJECT (message));
-
- return 0;
-
-}
diff --git a/tests/test3.c b/tests/test3.c
deleted file mode 100644
index 9893e2e507..0000000000
--- a/tests/test3.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#include "camel.h"
-
-int
-main (int argc, char**argv)
-{
- GtkType type;
-
- gtk_init (&argc, &argv);
- camel_init ();
-
- printf ("Test 3 : data wrapper repository\n");
-
- printf ("\nMime type : \"multipart\"\n");
- type = data_wrapper_repository_get_data_wrapper_type ("multipart");
- printf ("Type found %s\n", gtk_type_name (type) );
-
- printf ("\nMime type : \"multipart/alternative\"\n");
- type = data_wrapper_repository_get_data_wrapper_type ("multipart/alternative");
- printf ("Type found %s\n", gtk_type_name (type) );
-
- printf ("\nMime type : \"toto/titi\"\n");
- type = data_wrapper_repository_get_data_wrapper_type ("toto/titi");
- printf ("Type found %s\n", gtk_type_name (type) );
-
- printf ("Test3 finished\n");
- return 1;
-}
-
diff --git a/tests/test4.c b/tests/test4.c
deleted file mode 100644
index 99285cec43..0000000000
--- a/tests/test4.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* testing mh providers
- do not use CamelMhFolder and CamelMhStore directly.
- We do it here for test purpose only */
-
-
-
-#include "camel-folder.h"
-#include "camel-mh-folder.h"
-#include "camel-mh-store.h"
-#include "camel.h"
-#include "camel-log.h"
-
-int
-main (int argc, char**argv)
-{
- CamelStore *store;
- CamelFolder *inbox_folder;
- CamelFolder *root_mh_folder;
- GList *mh_subfolders_name;
- CamelMimeMessage *message_1;
- gboolean inbox_exists;
-
- camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG;
-
- gtk_init (&argc, &argv);
- camel_init ();
-
-
- store = gtk_type_new (CAMEL_MH_STORE_TYPE);
- camel_store_init (store, (CamelSession *)NULL, g_strdup ("mh:///root/Mail"));
-
- root_mh_folder = camel_store_get_folder (store, "");
- mh_subfolders_name = camel_folder_list_subfolders (root_mh_folder, NULL);
-
- printf ("\n------------- Listing root Mh folder subfolders --------\n");
- while (mh_subfolders_name) {
- printf ("\t\"%s\"\n", (gchar *)mh_subfolders_name->data);
- mh_subfolders_name = mh_subfolders_name->next;
- }
- printf ("--------------------------------------------------------\n\n");
-
- inbox_folder = camel_store_get_folder (store, "inbox");
- if (!inbox_folder) {
- printf ("** Error: could not get inbox folder from store\n");
- return 1;
- }
-
- /* test existence */
- inbox_exists = camel_folder_exists (inbox_folder, NULL);
- if (inbox_exists)
- printf ("MH folder inbox exists, continuing tests\n");
- else {
- printf ("MH folder inbox does not exist. Stopping \n");
- return 1;
- }
-
- printf ("\n Inbox folder contains %d messages\n", camel_folder_get_message_count (inbox_folder, NULL));
- printf ("\n------------- Gettting message numer 3 in inbox --------\n");
- message_1 = camel_folder_get_message (inbox_folder, 3, NULL);
- printf ("--------------------------------------------------------\n\n");
-
-
- return 1;
-
-
-}
diff --git a/tests/test5.c b/tests/test5.c
deleted file mode 100644
index 2f47fda418..0000000000
--- a/tests/test5.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* test for the RFC 2047 decoder */
-
-#include <string.h>
-#include <unicode.h>
-
-#include "gmime-utils.h"
-#include "stdio.h"
-#include "camel-log.h"
-#include "camel-mime-message.h"
-#include "camel-mime-part.h"
-#include "camel-stream.h"
-#include "camel-stream-fs.h"
-#include "camel.h"
-#include "gmime-rfc2047.h"
-
-#define TERMINAL_CHARSET "UTF-8"
-
-/*
- * Info on many unicode issues, including, utf-8 xterms from :
- *
- * http://www.cl.cam.ac.uk/~mgk/unicode.html
- *
- */
-
-const char *tests[] =
-{
-/* these strings come from RFC 2047. Ought to add a few torture cases here. */
- "=?US-ASCII?Q?Keith_Moore?= <moore@cs.utk.edu>",
- "=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>",
- "=?ISO-8859-1?Q?Andr=E9?= Pirard <PIRARD@vm1.ulg.ac.be>",
- "=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=",
- "=?ISO-8859-1?Q?Olle_J=E4rnefors?= <ojarnef@admin.kth.se>",
- "=?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= <paf@nada.kth.se>",
- "Nathaniel Borenstein <nsb@thumper.bellcore.com> (=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=)",
- "",
- "(=?ISO-8859-1?Q?a?=)", /* should be displayed as (a) */
- "(=?ISO-8859-1?Q?a?= b)", /* (a b) */
- "(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)", /* (ab) */
- "(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)", /* (ab) */
- "(=?ISO-8859-1?Q?a?= \n=?ISO-8859-1?Q?b?=)", /* (ab) */
- "(=?ISO-8859-1?Q?a_b?=)", /* (a b) */
- "(=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=)", /* (ab) */
- NULL
-};
-
-
-int
-main (int argc, char**argv)
-{
- const char **b = tests;
- while (*b) {
- printf("%s\n", gmime_rfc2047_decode(*b, TERMINAL_CHARSET));
- b++;
- }
-
- return 0;
-
-}
diff --git a/tests/test6.c b/tests/test6.c
deleted file mode 100644
index ead8312c52..0000000000
--- a/tests/test6.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* test for the RFC 2047 encoder */
-
-#include <string.h>
-#include <unicode.h>
-
-#include "gmime-utils.h"
-#include "stdio.h"
-#include "camel-log.h"
-#include "camel-mime-message.h"
-#include "camel-mime-part.h"
-#include "camel-stream.h"
-#include "camel-stream-fs.h"
-#include "camel.h"
-#include "gmime-rfc2047.h"
-
-#define TERMINAL_CHARSET "UTF-8"
-
-/*
- * Info on many unicode issues, including, utf-8 xterms from :
- *
- * http://www.cl.cam.ac.uk/~mgk25/unicode.html
- *
- */
-
-const char *tests[] =
-{
- "Ðis is a test", "ISO-8859-1",
- "Iñtérñàtiönælîçation", "ISO-8859-1",
- "ΚαλημέÏα κόσμε", "UTF-8",
- "コンニãƒãƒ", "UTF-8",
- "ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn", "UTF-8",
- NULL
-};
-
-
-int
-main (int argc, char**argv)
-{
- const char **b = tests;
- while (*b) {
- char *e = gmime_rfc2047_encode(b[0], b[1]);
- printf("%s\t%s\n", e, gmime_rfc2047_decode(e, TERMINAL_CHARSET));
- b+=2;
- }
-
- return 0;
-
-}
diff --git a/tests/test7.c b/tests/test7.c
deleted file mode 100644
index 44c73d275b..0000000000
--- a/tests/test7.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* test provider stuff */
-
-
-#include "camel.h"
-
-
-int
-main (int argc, char**argv)
-{
- const CamelProvider *new_provider;
-
- camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG;
-
- gtk_init (&argc, &argv);
- camel_init ();
-
-
- new_provider = camel_provider_register_as_module ("../camel/providers/MH/.libs/libcamelmh.so");
-
-
- return 1;
-}
diff --git a/tests/test8.c b/tests/test8.c
deleted file mode 100644
index 1f446e171d..0000000000
--- a/tests/test8.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* test posix thread folder proxy */
-
-
-#include "camel.h"
-#include "camel-log.h"
-
-CamelThreadProxy *proxy;
-CamelFuncDef *func_def;
-
-
-void
-test_sync_func (int num)
-{
- printf ("Sync function number %d\n", num);
- printf ("Sync function : current thread : %d\n", pthread_self ());
-
-}
-
-
-void
-test_async_cb (int num)
-{
- printf ("Callback number %d\n", num);
- printf ("Callback : current thread : %d\n", pthread_self ());
-}
-
-void
-test_async_func (int num)
-{
- CamelOp *cb;
-
- printf ("Async function number %d\n", num);
- printf ("Async function : current thread : %d\n", pthread_self ());
- sleep (1);
- cb = camel_marshal_create_op (func_def, test_async_cb, num);
- camel_thread_proxy_push_cb (proxy, cb);
-
-
-}
-
-int
-main (int argc, char **argv)
-{
- int i;
- CamelOp *op;
-
- camel_debug_level = CAMEL_LOG_LEVEL_WARNING;
-
- camel_init ();
-
- func_def =
- camel_func_def_new (camel_marshal_NONE__INT,
- 1,
- GTK_TYPE_INT);
-
- printf ("--== Testing Simple marshalling system ==--\n");
- for (i=0; i<5; i++) {
- printf ("Iterration number %d\n", i);
- op = camel_marshal_create_op (func_def, test_sync_func, i);
- camel_op_run (op);
- camel_op_free (op);
-
- }
- printf ("\n\n");
-
- proxy = camel_thread_proxy_new ();
-
- printf ("--== Testing Asynchronous Operation System ==--\n");
- for (i=0; i<5; i++) {
- printf ("Pushing async operation number %d for execution\n", i);
- op = camel_marshal_create_op (func_def, test_async_func, i);
- camel_thread_proxy_push_op (proxy, op);
- }
- printf ("\n\n");
- printf ("--== Operations execution planned ==--\n");
- gtk_main ();
-}
-
diff --git a/tests/ui-tests/.cvsignore b/tests/ui-tests/.cvsignore
deleted file mode 100644
index 10c9ca5909..0000000000
--- a/tests/ui-tests/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile.in
-Makefile
-.deps
-.libs
-store_listing
-msg-composer-test
diff --git a/tests/ui-tests/Makefile.am b/tests/ui-tests/Makefile.am
deleted file mode 100644
index 7c26399bbb..0000000000
--- a/tests/ui-tests/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-# process this file with automake to create Makefile.in
-
-INCLUDES = \
- -I$(top_srcdir)/intl \
- -I$(top_srcdir)/camel \
- -I$(includedir) \
- -I$(top_srcdir)/camel/providers/MH \
- -I$(top_srcdir)/widgets \
- $(EXTRA_GNOME_CFLAGS)
-
-LDADD = \
- $(top_builddir)/widgets/libevolutionwidgets.la \
- $(top_builddir)/camel/libcamel.la \
- $(INTLLIBS) \
- $(EXTRA_GNOME_LIBS) \
- $(PTHREAD_LIB)
diff --git a/tests/ui-tests/store_listing.c b/tests/ui-tests/store_listing.c
deleted file mode 100644
index fb7c2ae0f7..0000000000
--- a/tests/ui-tests/store_listing.c
+++ /dev/null
@@ -1,424 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Author : Bertrand.Guiheneuf@aful.org */
-
-
-
-/* A simple and very dirty hack written to test
- (and perhaps demonstrate) Camel */
-
-
-#include <gnome.h>
-#include <glade/glade.h>
-
-#include "camel-folder.h"
-#include "camel-mh-folder.h"
-#include "camel-mh-store.h"
-#include "camel.h"
-#include "camel-folder-summary.h"
-
-static GladeXML *xml;
-static CamelSession *_session;
-static CamelFolder *currently_selected_folder = NULL;
-
-static GList *store_list;
-static GList *folder_list;
-
-static void add_mail_store (const gchar *store_url);
-static void show_folder_messages (CamelFolder *folder);
-
-
-
-static void
-_destroy_menu (gpointer data)
-{
- gtk_widget_destroy (GTK_WIDGET (data));
-}
-
-static void
-_copy_message (GtkWidget *widget, gpointer data)
-{
- CamelFolder *dest_folder = CAMEL_FOLDER (data);
- GtkWidget *message_clist;
- gint current_row;
- GList *selected;
- gint selected_row;
-
- CamelMimeMessage *message;
-
- printf ("Selected \"copy to folder\" with destination folder %s\n", camel_folder_get_name (dest_folder));
- message_clist = glade_xml_get_widget (xml, "message-clist");
- selected = GTK_CLIST (message_clist)->selection;
- while (selected) {
- selected_row = GPOINTER_TO_INT (selected->data);
- message = CAMEL_MIME_MESSAGE (gtk_clist_get_row_data (GTK_CLIST (message_clist), selected_row));
- camel_folder_copy_message_to (currently_selected_folder, message, dest_folder);
- selected = selected->next;
- }
-
-}
-
-static GnomeUIInfo mailbox_popup_menu[] = {
- GNOMEUIINFO_ITEM_STOCK ("_Copy selected message here", NULL, _copy_message, GNOME_STOCK_MENU_NEW),
- GNOMEUIINFO_END
-};
-
-static void
-_show_mailbox_context_menu (CamelFolder *folder) {
- GtkWidget *menu;
- GtkCTree *mailbox_and_store_tree;
-
- mailbox_and_store_tree = GTK_CTREE (glade_xml_get_widget (xml, "store-and-mailbox-tree"));
- menu = gtk_object_get_data (GTK_OBJECT (mailbox_and_store_tree), "mailbox_popup_menu");
- if (!menu) {
- menu = gnome_popup_menu_new (mailbox_popup_menu);
- gtk_object_set_data_full (GTK_OBJECT (mailbox_and_store_tree), "mailbox_popup_menu", menu, _destroy_menu);
- }
-
- gnome_popup_menu_do_popup (menu, NULL, NULL, NULL, folder);
-
-
-}
-static gboolean
-mailbox_button_clicked_on_row (gint button, gint row)
-{
- GtkCTreeNode *mailbox_node;
- CamelFolder *folder;
- GtkCTree *mailbox_and_store_tree;
- const gchar *mailbox_name;
-
- mailbox_and_store_tree = GTK_CTREE (glade_xml_get_widget (xml, "store-and-mailbox-tree"));
-
- mailbox_node = gtk_ctree_node_nth (mailbox_and_store_tree, row);
-
- folder = gtk_ctree_node_get_row_data (mailbox_and_store_tree, mailbox_node);
- if (folder && IS_CAMEL_FOLDER (folder)) {
-
- mailbox_name = camel_folder_get_name (folder);
- printf ("mailbox %s clicked with button %d\n", mailbox_name, button);
- switch (button) {
- case 1:
- currently_selected_folder = folder;
- show_folder_messages (folder);
- break;
- case 2:
- break;
- case 3:
- _show_mailbox_context_menu (folder);
- }
- return TRUE;
- } else {
- printf ("Node is a store\n");
- return FALSE;
- }
-}
-
-
-static void
-message_destroy_notify (gpointer data)
-{
- CamelMimeMessage *message = CAMEL_MIME_MESSAGE (data);
-
- gtk_object_unref (GTK_OBJECT (message));
-
-}
-
-
-
-
-
-static void
-show_folder_messages (CamelFolder *folder)
-{
- GtkWidget *message_clist;
- gint folder_message_count;
- CamelMimeMessage *message;
- gint i;
- const gchar *clist_row_text[3];
- const char *sent_date, *subject, *sender;
- gint current_row;
- CamelFolderSummary *summary;
-
- message_clist = glade_xml_get_widget (xml, "message-clist");
-
- /* clear old message list */
- gtk_clist_clear (GTK_CLIST (message_clist));
-
- if (camel_folder_has_summary_capability (folder)) {
- const GList *message_info_list;
- CamelMessageInfo *msg_info;
-
- printf ("Folder has summary. Good\n");
- summary = camel_folder_get_summary (folder);
- message_info_list = camel_folder_summary_get_message_info_list (summary);
- printf ("message_info_list = %p\n", message_info_list);
- while (message_info_list) {
- msg_info = (CamelMessageInfo *)message_info_list->data;
- clist_row_text [0] = msg_info->date;
- clist_row_text [1] = msg_info->sender;
- clist_row_text [2] = msg_info->subject;
-
- current_row = gtk_clist_append (GTK_CLIST (message_clist), clist_row_text);
-
- message_info_list = message_info_list->next;
- }
- } else {
- printf ("Folder does not have summary. Opening all messages\n");
- folder_message_count = camel_folder_get_message_count (folder);
-
- for (i=0; i<folder_message_count; i++) {
- message = camel_folder_get_message (folder, i);
- gtk_object_ref (GTK_OBJECT (message));
- sent_date = camel_mime_message_get_sent_date (message);
- sender = camel_mime_message_get_from (message);
- subject = camel_mime_message_get_subject (message);
-
-
- if (sent_date) clist_row_text [0] = sent_date;
- else clist_row_text [0] = NULL;
- if (sender) clist_row_text [1] = sender;
- else clist_row_text [1] = NULL;
- if (subject) clist_row_text [2] = subject;
- else clist_row_text [2] = NULL;
-
- current_row = gtk_clist_append (GTK_CLIST (message_clist), clist_row_text);
- gtk_clist_set_row_data_full (GTK_CLIST (message_clist), current_row, (gpointer)message, message_destroy_notify);
- }
-
- }
-}
-
-
-/* add a mail store given by its URL */
-static void
-add_mail_store (const gchar *store_url)
-{
-
- CamelStore *store;
- GtkWidget *mailbox_and_store_tree;
- GtkCTreeNode* new_store_node;
- GtkCTreeNode* new_folder_node;
- char *new_tree_text[1];
- GList *subfolder_list;
- CamelFolder *root_folder;
- CamelFolder *new_folder;
-
-
-
- store = camel_session_get_store (_session, store_url);
- if (!store) return;
-
- /* remember store */
- store_list = g_list_prepend (store_list, store);
-
- //store_list = g_list_append (store_list, (gpointer)store);
- mailbox_and_store_tree = glade_xml_get_widget (xml, "store-and-mailbox-tree");
- new_tree_text[0] = g_strdup (store_url);
- new_store_node = gtk_ctree_insert_node (GTK_CTREE (mailbox_and_store_tree),
- NULL,
- NULL,
- new_tree_text,
- 0,
- NULL,
- NULL,
- NULL,
- NULL,
- FALSE,
- FALSE);
-
- /* normally, use get_root_folder */
- root_folder = camel_store_get_folder (store, "");
- camel_folder_open (root_folder, FOLDER_OPEN_RW);
- subfolder_list = camel_folder_list_subfolders (root_folder);
- while (subfolder_list) {
- new_tree_text[0] = subfolder_list->data;
- new_folder = camel_store_get_folder (store, subfolder_list->data);
- camel_folder_open (new_folder, FOLDER_OPEN_RW);
- folder_list = g_list_prepend (folder_list, new_folder);
-
- new_folder_node = gtk_ctree_insert_node (GTK_CTREE (mailbox_and_store_tree),
- new_store_node,
- NULL,
- new_tree_text,
- 0,
- NULL,
- NULL,
- NULL,
- NULL,
- FALSE,
- FALSE);
-
-
- gtk_ctree_node_set_row_data (GTK_CTREE (mailbox_and_store_tree), new_folder_node, (gpointer)new_folder);
- subfolder_list = subfolder_list->next;
- }
-}
-
-static void
-delete_selected_messages ()
-{
- GtkWidget *message_clist;
- gint current_row;
- GList *selected;
- gint selected_row;
-
- CamelMimeMessage *message;
- message_clist = glade_xml_get_widget (xml, "message-clist");
- selected = GTK_CLIST (message_clist)->selection;
- while (selected) {
- selected_row = GPOINTER_TO_INT (selected->data);
- message = CAMEL_MIME_MESSAGE (gtk_clist_get_row_data (GTK_CLIST (message_clist), selected_row));
- camel_mime_message_set_flag (message, "DELETED", TRUE);
- selected = selected->next;
- }
-
-}
-
-
-static void
-expunge_selected_folders ()
-{
- GtkWidget *mailbox_and_store_tree;
- CamelFolder *folder;
- GtkCTreeNode* selected_node;
- GList *selected;
- const gchar *folder_name;
-
- mailbox_and_store_tree = glade_xml_get_widget (xml, "store-and-mailbox-tree");
-
- selected = GTK_CLIST (mailbox_and_store_tree)->selection;
- while (selected) {
-
- selected_node= GTK_CTREE_NODE (selected->data);
- folder = CAMEL_FOLDER (gtk_ctree_node_get_row_data (GTK_CTREE (mailbox_and_store_tree),
- selected_node));
- if (folder && IS_CAMEL_FOLDER (folder)) {
- folder_name = camel_folder_get_name (folder);
- printf ("folder to expunge : %s\n", folder_name);
- camel_folder_expunge (folder, FALSE);
- /* reshowing the folder this way is uggly
- but allows to check the message are
- correctly renoved and the cache works correctly */
- show_folder_messages (folder);
-
- } else {
- printf ("A selected node is a store\n");
- }
-
- selected = selected->next;
- }
-
-
-}
-
-void
-close_all ()
-{
- while (folder_list) {
- camel_folder_close (CAMEL_FOLDER (folder_list->data), TRUE);
- folder_list = folder_list->next;
- }
-
- while (store_list) {
- //camel_store_close (CAMEL_STORE (store_list->data));
- store_list = store_list->next;
- }
-
-}
-
-/* ----- libglade callbacks */
-void
-on_exit_activate (GtkWidget *widget, void *data)
-{
- close_all ();
- gtk_main_quit ();
-}
-
-
-void
-on_about_activate (GtkWidget *widget, void *data)
-{
- GtkWidget *about_widget;
-
- about_widget = glade_xml_get_widget (xml, "about_widget");
- gtk_widget_show (about_widget);
-}
-
-void
-on_new_store_activate (GtkWidget *widget, void *data)
-{
- GtkWidget *new_store_dialog;
- GtkWidget *new_store_gnome_entry;
- GtkWidget *new_store_entry;
- gchar *url_text;
-
-
- gint pressed_button;
-
- new_store_dialog = glade_xml_get_widget (xml, "new_store_dialog");
- pressed_button = gnome_dialog_run (GNOME_DIALOG (new_store_dialog));
-
- if ((pressed_button != 0) && (pressed_button != 1))
- return;
-
- new_store_gnome_entry = glade_xml_get_widget (xml, "new-store-entry");
- new_store_entry = gnome_entry_gtk_entry (GNOME_ENTRY (new_store_gnome_entry));
- url_text = gtk_entry_get_text (GTK_ENTRY (new_store_entry));
-
- if (url_text)
- add_mail_store (url_text);
-
-}
-
-
-void
-on_expunge_activate (GtkWidget *widget, void *data)
-{
- expunge_selected_folders ();
-}
-
-
-void
-on_message_delete_activate (GtkWidget *widget, void *data)
-{
- delete_selected_messages();
-}
-
-gboolean
-on_store_and_mailbox_tree_button_press_event (GtkWidget *widget, GdkEventButton *event, void *data)
-{
- gint row;
- GtkCList *clist = GTK_CLIST (widget);
-
- if (!gtk_clist_get_selection_info (clist, event->x, event->y, &row, NULL))
- return FALSE;
- if (!mailbox_button_clicked_on_row (event->button, row))
- return FALSE;
-
- return TRUE;
-
-}
-
-/* ----- init */
-int
-main(int argc, char *argv[])
-{
- GtkWidget *new_store_gnome_entry;
-
- gnome_init ("store_listing", "1.0", argc, argv);
-
- glade_gnome_init ();
- camel_init ();
- xml = glade_xml_new ("store_listing.glade", NULL);
- if (xml) glade_xml_signal_autoconnect (xml);
-
- _session = camel_session_new ();
- camel_provider_register_as_module ("../../camel/providers/MH/.libs/libcamelmh.so");
-
- new_store_gnome_entry = glade_xml_get_widget (xml, "new-store-entry");
- gnome_entry_load_history (GNOME_ENTRY (new_store_gnome_entry));
- gtk_main ();
- gnome_entry_save_history (GNOME_ENTRY (new_store_gnome_entry));
-
- return 0;
-}
-
diff --git a/tests/ui-tests/store_listing.glade b/tests/ui-tests/store_listing.glade
deleted file mode 100644
index d551c90dbb..0000000000
--- a/tests/ui-tests/store_listing.glade
+++ /dev/null
@@ -1,489 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>store_listing</name>
- <program_name>store_listing</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>False</use_widget_names>
- <output_main_file>True</output_main_file>
- <output_support_files>True</output_support_files>
- <output_build_files>True</output_build_files>
- <backup_source_files>True</backup_source_files>
- <main_source_file>interface.c</main_source_file>
- <main_header_file>interface.h</main_header_file>
- <handler_source_file>callbacks.c</handler_source_file>
- <handler_header_file>callbacks.h</handler_header_file>
- <support_source_file>support.c</support_source_file>
- <support_header_file>support.h</support_header_file>
- <translatable_strings_file></translatable_strings_file>
-</project>
-
-<widget>
- <class>GnomeApp</class>
- <name>app1</name>
- <width>600</width>
- <height>400</height>
- <title>store_listing</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <enable_layout_config>True</enable_layout_config>
-
- <widget>
- <class>GnomeDock</class>
- <child_name>GnomeApp:dock</child_name>
- <name>dock1</name>
- <allow_floating>True</allow_floating>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GnomeDockItem</class>
- <name>dockitem1</name>
- <border_width>2</border_width>
- <placement>GNOME_DOCK_TOP</placement>
- <band>0</band>
- <position>0</position>
- <offset>0</offset>
- <locked>False</locked>
- <exclusive>True</exclusive>
- <never_floating>False</never_floating>
- <never_vertical>True</never_vertical>
- <never_horizontal>False</never_horizontal>
- <shadow_type>GTK_SHADOW_OUT</shadow_type>
-
- <widget>
- <class>GtkMenuBar</class>
- <name>menubar1</name>
- <shadow_type>GTK_SHADOW_NONE</shadow_type>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>file1</name>
- <stock_item>GNOMEUIINFO_MENU_FILE_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>file1_menu</name>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator1</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>exit</name>
- <signal>
- <name>activate</name>
- <handler>on_exit_activate</handler>
- <last_modification_time>Tue, 10 Aug 1999 12:06:35 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_EXIT_ITEM</stock_item>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>store2</name>
- <label>_Store</label>
- <right_justify>False</right_justify>
-
- <widget>
- <class>GtkMenu</class>
- <name>store2_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>new_store</name>
- <signal>
- <name>activate</name>
- <handler>on_new_store_activate</handler>
- <last_modification_time>Tue, 10 Aug 1999 10:29:12 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_NEW_ITEM</stock_item>
- <label>_New store</label>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>folder1</name>
- <signal>
- <name>activate</name>
- <handler>on_folder1_activate</handler>
- <last_modification_time>Sat, 14 Aug 1999 17:23:25 GMT</last_modification_time>
- </signal>
- <label>Folder</label>
- <right_justify>False</right_justify>
-
- <widget>
- <class>GtkMenu</class>
- <name>folder1_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>expunge</name>
- <signal>
- <name>activate</name>
- <handler>on_expunge_activate</handler>
- <last_modification_time>Sat, 14 Aug 1999 16:36:03 GMT</last_modification_time>
- </signal>
- <label>_Expunge</label>
- <right_justify>False</right_justify>
- <stock_icon>GNOME_STOCK_MENU_CONVERT</stock_icon>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>message_menu</name>
- <label>_Message</label>
- <right_justify>False</right_justify>
-
- <widget>
- <class>GtkMenu</class>
- <name>message_menu_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>message_delete</name>
- <signal>
- <name>activate</name>
- <handler>on_message_delete_activate</handler>
- <last_modification_time>Sat, 14 Aug 1999 14:54:04 GMT</last_modification_time>
- </signal>
- <label>_Delete</label>
- <right_justify>False</right_justify>
- <stock_icon>GNOME_STOCK_MENU_TRASH</stock_icon>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>help1</name>
- <stock_item>GNOMEUIINFO_MENU_HELP_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>help1_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>about</name>
- <signal>
- <name>activate</name>
- <handler>on_about_activate</handler>
- <last_modification_time>Tue, 10 Aug 1999 12:06:58 GMT</last_modification_time>
- </signal>
- <stock_item>GNOMEUIINFO_MENU_ABOUT_ITEM</stock_item>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GnomeDockItem</class>
- <name>dockitem2</name>
- <border_width>1</border_width>
- <placement>GNOME_DOCK_TOP</placement>
- <band>1</band>
- <position>0</position>
- <offset>0</offset>
- <locked>False</locked>
- <exclusive>True</exclusive>
- <never_floating>False</never_floating>
- <never_vertical>False</never_vertical>
- <never_horizontal>False</never_horizontal>
- <shadow_type>GTK_SHADOW_OUT</shadow_type>
-
- <widget>
- <class>GtkToolbar</class>
- <name>toolbar1</name>
- <border_width>1</border_width>
- <orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
- <type>GTK_TOOLBAR_BOTH</type>
- <space_size>16</space_size>
- <space_style>GTK_TOOLBAR_SPACE_LINE</space_style>
- <relief>GTK_RELIEF_NONE</relief>
- <tooltips>True</tooltips>
-
- <widget>
- <class>GtkButton</class>
- <child_name>Toolbar:button</child_name>
- <name>new_store_button</name>
- <signal>
- <name>clicked</name>
- <handler>on_new_store_activate</handler>
- <last_modification_time>Tue, 10 Aug 1999 12:17:17 GMT</last_modification_time>
- </signal>
- <label>new store</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_NEW</stock_pixmap>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHPaned</class>
- <child_name>GnomeDock:contents</child_name>
- <name>hpaned1</name>
- <handle_size>10</handle_size>
- <gutter_size>6</gutter_size>
- <position>0</position>
-
- <widget>
- <class>GtkCTree</class>
- <name>store-and-mailbox-tree</name>
- <width>150</width>
- <can_focus>True</can_focus>
- <signal>
- <name>button_press_event</name>
- <handler>on_store_and_mailbox_tree_button_press_event</handler>
- <last_modification_time>Mon, 16 Aug 1999 13:06:15 GMT</last_modification_time>
- </signal>
- <columns>1</columns>
- <column_widths>80</column_widths>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- <show_titles>True</show_titles>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
- <child>
- <shrink>True</shrink>
- <resize>False</resize>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CTree:title</child_name>
- <name>store_and_inbox_name</name>
- <label>name</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
-
- <widget>
- <class>GtkCList</class>
- <name>message-clist</name>
- <can_focus>True</can_focus>
- <columns>3</columns>
- <column_widths>80,80,80</column_widths>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- <show_titles>True</show_titles>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
- <child>
- <shrink>True</shrink>
- <resize>True</resize>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>message_date_label</name>
- <label>Date</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>message_sender_label</name>
- <label>Sender</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>message_subject_label</name>
- <label>Subject</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GnomeAppBar</class>
- <child_name>GnomeApp:appbar</child_name>
- <name>appbar1</name>
- <has_progress>True</has_progress>
- <has_status>True</has_status>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-</widget>
-
-<widget>
- <class>GnomeAbout</class>
- <name>about_widget</name>
- <visible>False</visible>
- <modal>True</modal>
- <copyright></copyright>
- <authors>Bertrand Guiheneuf &lt;Bertrand.Guiheneuf@aful.org&gt;
-</authors>
- <comments>This is a very simple program to test Camel</comments>
-</widget>
-
-<widget>
- <class>GnomeDialog</class>
- <name>new_store_dialog</name>
- <visible>False</visible>
- <title>New store</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>True</auto_close>
- <hide_on_close>True</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>new_store_label</name>
- <label>Enter complete store URL</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>29</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GnomeEntry</class>
- <name>new-store-entry</name>
- <history_id>store_name_history</history_id>
- <max_saved>15</max_saved>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <child_name>GnomeEntry:entry</child_name>
- <name>new-store-dialog-combo-entry</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button2</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button3</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/widgets/.cvsignore b/widgets/.cvsignore
deleted file mode 100644
index 0963d457d9..0000000000
--- a/widgets/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
-table-test
diff --git a/widgets/LICENSE b/widgets/LICENSE
deleted file mode 100644
index b1f6ae08a4..0000000000
--- a/widgets/LICENSE
+++ /dev/null
@@ -1 +0,0 @@
-This code is released under the terms of the GNU GPL.
diff --git a/widgets/Makefile.am b/widgets/Makefile.am
deleted file mode 100644
index 0408acc872..0000000000
--- a/widgets/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-
-SUBDIRS = \
- meeting-time-sel shortcut-bar e-table
diff --git a/widgets/e-cursors.c b/widgets/e-cursors.c
deleted file mode 100644
index 150b84b90a..0000000000
--- a/widgets/e-cursors.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * cursors.c: cursor handling for Evolution.
- * copied from Gnumeric.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- */
-#include <config.h>
-#include <gnome.h>
-#include "e-cursors.h"
-
-static GdkColor black, white;
-
-#define GDK_INTERNAL_CURSOR -1
-
-typedef struct {
- GdkCursor *cursor;
- int hot_x, hot_y;
- char **xpm;
-} CursorDef;
-
-static CursorDef cursors [] = {
- { NULL, GDK_INTERNAL_CURSOR, GDK_CROSSHAIR, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_LEFT_PTR, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_FLEUR, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SB_H_DOUBLE_ARROW, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SB_V_DOUBLE_ARROW, NULL },
- { NULL, 0, 0, NULL }
-};
-
-
-static void
-create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, gchar **xpm)
-{
- int height, width, colors;
- char pixmap_buffer [(32 * 32)/8];
- char mask_buffer [(32 * 32)/8];
- int x, y, pix, yofs;
- int transparent_color, black_color;
-
- sscanf (xpm [0], "%d %d %d %d", &height, &width, &colors, &pix);
-
- g_assert (height == 32);
- g_assert (width == 32);
- g_assert (colors <= 3);
-
- transparent_color = ' ';
- black_color = '.';
-
- yofs = colors + 1;
- for (y = 0; y < 32; y++){
- for (x = 0; x < 32;){
- char value = 0, maskv = 0;
-
- for (pix = 0; pix < 8; pix++, x++){
- if (xpm [y + yofs][x] != transparent_color){
- maskv |= 1 << pix;
-
- /*
- * Invert the colours here because it seems
- * to workaround a bug the Matrox G100 Xserver?
- * We reverse the foreground & background in the next
- * routine to compensate.
- */
- if (xpm [y + yofs][x] == black_color){
- value |= 1 << pix;
- }
- }
- }
- pixmap_buffer [(y * 4 + x/8)-1] = value;
- mask_buffer [(y * 4 + x/8)-1] = maskv;
- }
- }
- *bitmap = gdk_bitmap_create_from_data (NULL, pixmap_buffer, 32, 32);
- *mask = gdk_bitmap_create_from_data (NULL, mask_buffer, 32, 32);
-}
-
-void
-e_cursors_init (void)
-{
- GdkColormap *colormap;
- int i;
-
- colormap = gtk_widget_get_default_colormap ();
- gdk_color_white (colormap, &white);
- gdk_color_black (colormap, &black);
-
- for (i = 0; cursors [i].hot_x; i++){
- GdkBitmap *bitmap, *mask;
-
- if (cursors [i].hot_x < 0)
- cursors [i].cursor = gdk_cursor_new (cursors [i].hot_y);
- else {
- create_bitmap_and_mask_from_xpm (&bitmap, &mask, cursors [i].xpm);
-
- /* The foreground and background colours are reversed.
- * See comment above for explanation.
- */
- cursors [i].cursor =
- gdk_cursor_new_from_pixmap (
- bitmap, mask,
- &black, &white,
- cursors [i].hot_x,
- cursors [i].hot_y);
- }
- }
-
- g_assert (i == E_NUM_CURSORS);
-}
-
-void
-e_cursors_shutdown (void)
-{
- int i;
-
- for (i = 0; cursors [i].hot_x; i++)
- gdk_cursor_destroy (cursors [i].cursor);
-}
-
-
-/* Returns a cursor given its type */
-GdkCursor *
-e_cursor_get (ECursorType type)
-{
- g_return_val_if_fail (type >= 0 && type < E_NUM_CURSORS, NULL);
-
- return cursors [type].cursor;
-}
diff --git a/widgets/e-cursors.h b/widgets/e-cursors.h
deleted file mode 100644
index 771e5f6d4d..0000000000
--- a/widgets/e-cursors.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef E_CURSORS_H
-#define E_CURSORS_H
-
-/* Copied from Gnumeric */
-
-typedef enum {
- E_CURSOR_THIN_CROSS,
- E_CURSOR_ARROW,
- E_CURSOR_MOVE,
- E_CURSOR_SIZE_X,
- E_CURSOR_SIZE_Y,
- E_NUM_CURSORS
-} ECursorType;
-
-void e_cursors_init (void);
-void e_cursors_shutdown (void);
-
-#define e_cursor_set(win, c) \
-G_STMT_START { \
- if (win) \
- gdk_window_set_cursor (win, e_cursor_get (c)); \
-} G_STMT_END
-
-#define e_cursor_set_widget(w, c) \
-G_STMT_START { \
- if (GTK_WIDGET (w)->window) \
- gdk_window_set_cursor (GTK_WIDGET (w)->window, e_cursor_get (c)); \
-} G_STMT_END
-
-GdkCursor *e_cursor_get (ECursorType type);
-
-#endif /* E_CURSORS_H */
-
diff --git a/widgets/e-table/.cvsignore b/widgets/e-table/.cvsignore
deleted file mode 100644
index 0963d457d9..0000000000
--- a/widgets/e-table/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
-table-test
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
deleted file mode 100644
index 47e410e613..0000000000
--- a/widgets/e-table/ChangeLog
+++ /dev/null
@@ -1,579 +0,0 @@
-1999-12-30 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-item.c (eti_attach_cell_views): New routine, creates the
- cell views.
- (eti_detach_cell_views): Detaches the cell_views from the
- ETableItem.
- (eti_realize_cell_views, eti_unrealize_cell_views): Simplified to
- just do realize/unrealize notification.
- (eti_add_table_model): Only attach the cells when we have both the
- table model and the header model.
-
- * e-cell.h (ECellClass): Added two new methods: new_view and
- kill_view which drive the view process (instead of putting that on
- realize/unrealize).
-
- * e-cell.c: Adapt the code to use the new scheme for view
- instantiation.
-
- * e-cell-text.c, e-cell-toggle.c: Adapted to the new class
- changes.
-
-1999-12-22 Miguel de Icaza <miguel@helixcode.com>
-
- * e-table-item.c (e_table_item_focus): grab focus here with the
- canvas method.
-
-1999-12-20 Miguel de Icaza <miguel@helixcode.com>
-
- * e-table-group.c (etg_update): Change the dimensions only if the
- child changes its own.
-
- * e-table-item.c (eti_table_model_changed): Emit new signal on
- table height change.
- (eti_class_init): Register new "height_change" signal.
-
-1999-12-19 Damon Chaplin <damon@karuna.freeserve.co.uk>
-
- * Makefile.am (SUBDIRS): created SUBDIRS with meeting-time-sel.
-
- * meeting-time-sel/Makefile.am:
- * meeting-time-sel/.cvsignore:
- * meeting-time-sel/e-meeting-time-sel.h:
- * meeting-time-sel/e-meeting-time-sel.c:
- * meeting-time-sel/e-meeting-time-sel-item.h:
- * meeting-time-sel/e-meeting-time-sel-item.c:
- * meeting-time-sel/e-meeting-time-sel-list-item.h:
- * meeting-time-sel/e-meeting-time-sel-list-item.c:
- * meeting-time-sel/e-meeting-time-sel-mail.xpm:
- * meeting-time-sel/e-meeting-time-sel-no-mail.xpm:
- * meeting-time-sel/test-meeting-time-sel.c: new files implementing
- the meeting time selector.
-
-1999-12-12 Miguel de Icaza <miguel@helixcode.com>
-
- * e-table-item.c (eti_class_init): X and Y arguments are now
- doubles (to make it consistent with the rest of the canvas x, y
- arguments).
-
- * e-table.c (e_table_create_leaf): Use new argument values here
-
- * test-*.c: Update to new argument types for x and y
-
- * e-table-group.c: New implementation as a canvas item used to
- group childs.
-
- * e-table-item.c (eti_update): Make this play nicely with groups.
- (eti_draw): ditto.
- (eti_request_region_redraw): ditto.
- (eti_item_region_redraw): New function.
-
- * e-table-subset.c (etss_proxy_model_row_changed): Added model
- proxying.
-
- * e-cell.h: Drop ETableModel from the ECell;
- (realize): Now takes an ETableModel
-
- * e-cell-checkbox.c: Adapted to new class
- changes;
- * e-cell-toggle.c: ditto
-
- * e-table-subset.c (etss_row_count): Fix this guy.
-
-1999-12-11 Miguel de Icaza <miguel@helixcode.com>
-
- * e-table-item.c (eti_unrealize_cell_views): Null the cell views.
- (eti_header_structure_changed): Only unrealize/realize if we were
- realized before.
-
- * e-table-header.c (e_table_header_add_column): Allow -1 as an
- insert position
-
-1999-12-11 Miguel de Icaza <miguel@helixcode.com>
-
- * e-table.c: Massive fixage.
-
- * test-table.c: Updates to test the mega widget.
-
-1999-12-10 Miguel de Icaza <miguel@helixcode.com>
-
- * e-table.c: New file, implements the mega widget.
-
-1999-12-09 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-header.c (e_table_header_col_diff): fix this routine.
-
-1999-12-04 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-header-item.c (ethi_event): Started drag and drop
- support.
-
- * e-table-item.c (eti_table_model_changed): The columns are
- controled by the Header, not by the TableModel.
-
- * e-table-header-item.c (ethi_draw): Fixed redraw logic to support
- arbitrary header positioning.
-
- * e-cell.h: Revamped e-cell interface. We now provide the model
- column and the view column to all methods (so that the methods can
- talk to the view and to the model at the same time).
-
- * e-table-item.c: Update to new API
- * e-cell-test.c: Update to new API
-
-1999-12-03 Miguel de Icaza <miguel@gnu.org>
-
- * e-cell.c (e_cell_class_init): Provide emtpy methods for
- enter_edit, and leave_edit.
-
- * e-table-item.c: Killed draw cell.
- (eti_draw): Perform column mapping here.
- (e_table_item_leave_edit): ditto.
- (e_table_item_enter_edit): ditto.
- (eti_event): ditto.
-
-1999-12-02 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-header.c (e_table_header_index): fixed api.
-
-1999-12-01 Miguel de Icaza <miguel@gnu.org>
-
- * test-cols.c (multi_cols_test): Update to simplified API.
- * test-check.c (check_test): ditto
- * test-table.c (table_browser_test): ditto
-
- * e-table-simple.c (e_table_simple_class_init): Kill column_name method.
-
- * e-table-model.h: Kill column_name method.
-
- * e-table-col.c (e_table_col_new): Instead of using a column name,
- use a column index.
-
- * e-cell-text.c (ect_draw): Keep track of the originally allocated
- piece of code.
-
- * e-table-header-item.c (ethi_unrealize): Removed change cursor
- from here.
-
- * e-cell-text.c (ect_draw): Memory leak fix.
-
- * table-test.c (main): Enhance the demo to load sample.table
- automatically, to get memprof working.
-
- * e-table-header.c (eth_do_remove): Take an argument: do -remove.
-
- * e-table-header.c (e_table_header_add_column): Sink ETableCol to
- own the object.
-
- * e-table-col.h: Made ETableCol a GtkObject to make reference
- counting the lifecycle method for these objects.
-
- * e-table-col.c (e_table_col_destroy): New API call.
-
- * e-table-subset.c (e_table_subset_get_toplevel): New API call.
-
-1999-11-30 Miguel de Icaza <miguel@gnu.org>
-
- * e-cell-checkbox.c (e_cell_checkbox_new): This one derives from
- e-cell-toggle.
-
- * check-emtpy.xpm, check-filled.xpm: new files.
-
- * e-cell-toggle.c (etog_draw): Paint in white.
- If we have transparency enabled, do the nice alpha computation.
-
- * test-table.c, test-cols.c: new files; They implement the split
- tests.
-
-1999-11-29 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-col.c (e_table_col_new): Set etc->resizeable.
-
- * e-table-header-item.c (ethi_event): Handle non-resizeables
- columns; Add support for minimum width.
-
- * e-cell-toggle.c, e-cell-toggle.h: New file. Implement a
- multi-state image toggle cell object.
-
- * e-cell-text.c (ect_leave_edit): Handle the case of us calling
- leave edit manually.
- (ect_stop_editing): Leave manually editing here.
- (ect_draw): Add one pixel to the border for left and right;
- Handle off-screen cursor (must be improved).
- (ect_edit_select_all): New function.
- (ect_event): Select all text on editing start
-
- * e-table-item.c (eti_event): Map mouse events and dispatch them.
- (eti_event): Add spreadsheet mode for editing; Enter editing only
- with visual characters;
- Leave editing mode when a different row has been selected.
- (eti_get_height): Fix the computation for this; Fix logic for the
- length_threshold.
-
- (eti_draw): Add borders on all sides of the box;
- Only draw focus if the cell is not being edited.
-
-1999-11-28 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-item.c (eti_draw): Focus inside, not outside.
- (eti_realize): Enhance our focus gc.
-
- * e-cell-text.c (ect_enter_edit, ect_leave_edit): New methods;
- They implement editing.
-
- * e-cell.h: new methods: enter_edit, leave_edit
-
- * e-table-model.h (set_value_at): make val argument const.
-
- * e-table-simple.c (simple_set_value_at): Make value argument const;
-
- * e-table-item.c (eti_set_arg): Add new mode: draw_focus;
-
-1999-11-27 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-item.c (eti_event): beginning of the keyboard navigation.
-
- * e-table-model.c (e_table_model_row_changed): new function.
- (e_table_model_cell_changed): new function.
- (e_table_model_class_init): New signals.
-
- * e-table-item.c (eti_request_region_redraw): x2, y2 offsets were
- wrong.
- (eti_select): Repaint selected region.
- (eti_request_region_redraw): Fix range.
- (eti_draw): Correct offset computation here.
- (e_table_item_class_init): New method: row_selection, handles the
- selection.
-
- Now it implement GTK_SELECTION_SINGLE and GTK_SELECTION_MULTIPLE.
-
- Focusing and selection should be correct now.
-
-1999-11-26 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-item.c (eti_realize): Compute height using the ecell
- methods here.
- (eti_get_height): new method to compute dimensions.
-
- * e-cursors.c: use a different cursor.
-
- * e-table-model.h: kill height and row_height methods.
-
- * e-cell.c (ec_height): New method.
-
- * e-cell-text.c (ect_realize): Load the font from the canvas.
- (ect_draw): New color setup.
- Center in the row.
- (ect_height): Implement new method.
-
-1999-11-26 Michael Meeks <mmeeks@gnu.org>
-
- * ROADMAP.e-table: small spelling/typo fixes.
-
-1999-11-25 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-item.c (eti_event): Work on mouse-button event
- propagation to cells.
-
- * e-cell-text.c (ect_draw): Use CellViews now.
-
- * e-table-item.c (eti_realize_cell_views): New routine: Realizes
- the cell views
- (eti_unrealize_cell_views): New routine: unrealizes the cell views.
-
- * e-table-item.h: Move cell_views array here.
-
- * table-test.c (value_at): Fix return value.
- (main): use new invocation method.
-
- * e-table-header-item.c (ethi_realize): Realize cells.
-
- * e-table-item.c (eti_header_dim_changed): redraw before and after.
-
- * e-table-header-item.c (ethi_event): Add continuous resizing.
-
-1999-11-24 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-subset.h, e-table-subset.c: New files, used to implement
- subset tables.
-
- * e-table-sorted.h, e-table-sorted.c: Now they derive from
- e-table-subset.
-
- * e-cell.c, e-cell.h: realize method now return per view instance
- data.
-
-1999-11-20 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-item.c (eti_draw): WOOOOHOOOOOoO! It took me quite a
- while to figure this one out. Fixed.
-
- * e-table-header-item.c (ethi_set_arg): Compute width, keep track
- of it.
- (ethi_add_table_header): Monitor changes to the Header model;
- Queue updates.
- (ethi_draw): Fix the redraw logic here.
-
- * table-test.c (main): Change the sample code, so we can better
- debug this.
-
- * e-table-item.c (eti_header_structure_changed): Keep track of
- width;
- (eti_header_dim_changed): ditto.
- (eti_draw): Many redraw fixes.
-
-1999-11-19 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-item.c (eti_realize): Hook up; Load gcs.
- (eti_unrealize): Hook up.
-
- * e-table-sorted.c: Finished implementing.
-
-1999-11-18 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-model.c (e_table_model_class_init): Add model_changed
- signal here.
-
- * e-table-item.c, e-table-item.h: New files. They implement the
- view of the ETableModel as Canvas Items.
-
- * e-table-header-item.c (ethi_set_arg): Ref header here.
- (ethi_destroy): Unref it here.
-
-1999-11-17 Ettore Perazzoli <ettore@gnu.org>
-
- * e-msg-composer-address-dialog.c: Moved to `$(srcdir)/composer'.
- * e-msg-composer-address-dialog.h: Likewise.
- * e-msg-composer-address-entry.c: Likewise.
- * e-msg-composer-address-entry.h: Likewise.
- * e-msg-composer-attachment-bar.c: Likewise.
- * e-msg-composer-attachment-bar.h: Likewise.
- * e-msg-composer-attachment.c: Likewise.
- * e-msg-composer-attachment.h: Likewise.
- * e-msg-composer-hdrs.c: Likewise.
- * e-msg-composer-hdrs.h: Likewise.
- * e-msg-composer.c: Likewise.
- * e-msg-composer.h: Likewise.
- * e-msg-composer-address-dialog.glade: Likewise.
- * e-msg-composer-attachment.glade: Likewise.
- * e-msg-composer.glade: Likewise.
- * Makefile.am: Updated accordingly.
-
-Nov 14 1999 Elliot Lee
- * Makefile.am: It's libevolutionwidgets.la, not .a
-
-1999-11-14 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-header-item.c (is_pointer_on_division): Add resizing
- capabilities.
-
- * e-table-sorted.c: Finish implementation.
-
-1999-11-13 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-sorted.c: Implement e-table-sorted object.
-
-1999-11-12 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-header-item.c: Make the thing configurable.
-
- * e-table-header-item.h: Add font field, location, height.
-
-1999-11-12 Ettore Perazzoli <ettore@gnu.org>
-
- * e-msg-composer-hdrs.c: New member `tooltips' in `struct
- _EMsgComposerHdrsPrivate'.
- (init): Initialize it.
- (destroy): New function.
- (class_init): Install it as the `destroy' GtkObject method.
- (add_header): New parameters `tip', `tip_private'. Setup a
- tooltip for the entry with them.
- (setup_headers): Updated accordingly.
-
-1999-11-11 Miguel de Icaza <miguel@gnu.org>
-
- * e-table-header.c (e_table_header_add_column): Update offsets.
- (eth_update_offsets): New routine.
-
- * e-table-col.h, e-table-col.c: New files.
-
- * e-table-header.h (e_table_header_get_selected_indexes):
- Pretify.
-
- * table-test.c (main): New file; used for testing ETable package.
-
- * e-table-simple.h: Fix type.
-
-1999-11-12 Ettore Perazzoli <ettore@gnu.org>
-
- * e-msg-composer-address-dialog.glade: Cosmetical changes.
-
- * e-msg-composer-attachment-bar.c (size_to_string): New helper
- function.
- (update): Put the size in the icon's label using this function.
- (ICON_SEPARATORS): Remove '.' to avoid wrapping of the size string
- on the decimal dot. But gnome-libs is broken and this has no real
- effect! :-(
- (e_msg_composer_attachment_bar_new): No longer make text editable.
- Use the `GTK_SELECTION_MULTIPLE' selection mode.
- (remove_selected): No longer assume only one attachment is
- selected.
-
- * e-msg-composer-attachment.c: #include <sys/stat.h>
- (init): Initialize all the members.
- (e_msg_composer_attachment_new): Set size using `stat()'.
-
- * e-msg-composer-attachment.h: New member `size' in `struct
- _EMsgComposerAttachment'.
-
- * e-msg-composer.c (setup_signals): Connect `address_dialog_cb' to
- the "show_address_dialog" signal of the header widget.
-
- * e-msg-composer-hdrs.c (add_address_header): Renamed to
- `add_header'. New parameter `addrbook_button': if true, use a
- button instead of a label and make it trigger an
- "show_address_dialog" signal.
- (address_button_clicked_cb): Signal handler to handle this on a
- "clicked" signal from the button.
- (setup_headers): Updated accordingly. Also, make "Subject" the
- last item. (This makes it look more like Outlook and friends.)
-
- * e-msg-composer-hdrs.c: New signal "show_address_dialog".
- * e-msg-composer-hdrs.h: Updated accordingly.
-
- * e-msg-composer-hdrs.c (add_address_header): Reduce padding
- considerably.
-
- * e-msg-composer.c (e_msg_composer_construct): Do not use any
- padding in the main vbox.
-
- * Makefile.am: Moved the `e-table*' sources to `EXTRA_DIST'.
- Compile as a shared library.
-
-1999-11-08 Ettore Perazzoli <ettore@gnu.org>
-
- * e-msg-composer-address-dialog.c: Implemented cut & paste for the
- recipient lists.
- (init): Initialize `cut_buffer'.
- (destroy): Free it.
- (recipient_clist_selection_get_cb): New function.
- (recipient_clist_selection_received_cb): New function.
- (recipient_clist_selection_clear_event_cb): New function.
- (setup_recipient_list_signals): Install them as signal handlers
- for "selection_get", "selection_received" and
- "selection_clear_event" respectively.
- (copy_recipient_cb): New function implementing the "copy"
- operation.
- (cut_recipient_cb): New function implementing the "cut" operation.
- (paste_recipient_cb): New function implementing the "paste"
- operation.
-
- * e-msg-composer-address-dialog.h: New member `cut_buffer' in
- `struct _EMsgComposerAddressDialog'.
-
-1999-11-07 Ettore Perazzoli <ettore@gnu.org>
-
- * e-msg-composer-address-dialog.c: New context menu
- `recipient_list_popup_info' for the recipient CLists.
- (recipient_clist_button_press_cb): New function.
- (setup_signals): Install it as the "button_press_event" signal
- handler for popping up the CList context menu.
-
- * e-msg-composer.c (free_string_list): New helper function.
- (setup_address_dialog): Setup the initial values in the address
- dialog according to the ones in the header widget.
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_get_to): New function.
- (e_msg_composer_hdrs_get_cc): New function.
- (e_msg_composer_hdrs_get_bcc): New function.
-
- * e-msg-composer.c (setup_address_dialog): New helper function.
- (address_dialog_cb): Use it.
-
- * e-msg-composer-address-dialog.c (add_address): Do not set the
- row data anymore. Instead, put the full address description
- (i.e. complete with the email address, not just the full name) in
- the CList.
- (add_address): Do nothing if no item is selected in the address
- CList.
- (get_list): Get the address list from the CList without passing
- through the address CList.
- (set_list): New helper function.
- (e_msg_composer_address_dialog_set_to_list): New function.
- (e_msg_composer_address_dialog_set_cc_list): New function.
- (e_msg_composer_address_dialog_set_bcc_list): New function.
-
- * e-msg-composer.c (address_dialog_apply_cb): Apply values from
- the address dialog into the composer.
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_set_to): New function.
- (e_msg_composer_hdrs_set_cc): New function.
- (e_msg_composer_hdrs_set_bcc): New function.
-
- * e-msg-composer-address-entry.c
- (e_msg_composer_address_entry_set_list): New function.
-
- * e-msg-composer-address-dialog.c (apply): New helper function.
- (clicked): New function, `clicked' method for the `GnomeDialog'
- class.
- (class_init): Install it.
-
-1999-11-06 Ettore Perazzoli <ettore@gnu.org>
-
- * e-msg-composer-attachment-bar.c (destroy): Call the destroy
- method of the parent class.
-
- * e-msg-composer.c: #include "e-msg-composer-address-dialog.h".
- (address_dialog_cb): New callback to start the address dialog.
- (setup_signals): Connect it to the appropriate button/menu item.
- (init): Initialize the new `address_dialog' member to NULL.
- (destroy): Destroy the `address_dialog' if not NULL.
-
- * e-msg-composer.h: New member `address_dialog' in `struct
- _EMsgComposer'.
-
- * e-msg-composer.glade: Added button to activate the address
- composition dialog.
-
- * e-msg-composer-address-dialog.h, e-msg-composer-address-dialog.c:
- New files implementing the address composition dialog for Evolution.
-
- * e-msg-composer-address-dialog.glade: New file.
-
- * e-msg-composer-attachment.c: `signals' made static.
-
-1999-11-05 Ettore Perazzoli <ettore@gnu.org>
-
- * Makefile.am: Compile the new files in a `libevolutionwidgets'
- library.
- (CPPFLAGS): #define `E_GUIDIR'.
-
- * e-msg-composer.c, e-msg-composer.h: New files implementing an
- initial version of the Evolution message composer widget.
-
- * e-msg-composer-address-entry.c, e-msg-composer-address-entry.h:
- New files implementing a GtkEntry customized for entering email
- address lists.
-
- * e-msg-composer-attachment-bar.c, e-msg-composer-attachment-bar.h:
- New files implementing a widget for editing mail attachments.
-
- * e-msg-composer-attachment.c, e-msg-composer-attachment.h: New
- files implementing file attachment objects for the message
- composer.
-
- * e-msg-composer-hdrs.c, e-msg-composer-hdrs.h: New files
- implementing a widget for editing of email message headers.
-
- * e-msg-composer-attachment.glade: New file.
- * e-msg-composer.glade: New file.
-
-1999-10-31 Miguel de Icaza <miguel@gnu.org>
-
- * widgets/e-table-column.c, e-table-column.h: New file, implements the
- e-table-column object.
-
- * widget/e-table-model.h, e-table-model.c, e-table-simple.c,
- e-table-simple.h: New files. Implements the column model and
- a simple table wrapper.
-
diff --git a/widgets/e-table/LICENSE b/widgets/e-table/LICENSE
deleted file mode 100644
index b1f6ae08a4..0000000000
--- a/widgets/e-table/LICENSE
+++ /dev/null
@@ -1 +0,0 @@
-This code is released under the terms of the GNU GPL.
diff --git a/widgets/e-table/Makefile.am b/widgets/e-table/Makefile.am
deleted file mode 100644
index 3d972991f4..0000000000
--- a/widgets/e-table/Makefile.am
+++ /dev/null
@@ -1,60 +0,0 @@
-INCLUDES = \
- $(GNOME_INCLUDEDIR) \
- -I$(top_srcdir)/e-util \
- -I$(top_srcdir)
-
-noinst_LIBRARIES = \
- libetable.a
-
-libetable_a_SOURCES = \
- e-cell.c \
- e-cell.h \
- e-cell-checkbox.c \
- e-cell-checkbox.h \
- e-cell-text.c \
- e-cell-text.h \
- e-cell-toggle.c \
- e-cell-toggle.h \
- e-table.c \
- e-table.h \
- e-table-col.c \
- e-table-col.h \
- e-table-group.c \
- e-table-group.h \
- e-table-header.c \
- e-table-header.h \
- e-table-header-item.c \
- e-table-header-item.h \
- e-table-item.c \
- e-table-item.h \
- e-table-model.c \
- e-table-model.h \
- e-table-simple.c \
- e-table-simple.h \
- e-table-sorted.c \
- e-table-sorted.h \
- e-table-subset.c \
- e-table-subset.h
-
-noinst_PROGRAMS = \
- table-test
-
-table_test_SOURCES = \
- test-table.c \
- test-check.c \
- test-cols.c \
- table-test.c
-
-table_test_LDADD = \
- $(EXTRA_GNOME_LIBS) \
- libetable.a \
- $(top_builddir)/e-util/libeutil.a
-
-table_test_LDFLAGS = `gnome-config --libs gdk_pixbuf`
-
-EXTRA_DIST = \
- sample.table \
- add-col.xpm \
- check-empty.xpm \
- check-filled.xpm \
- remove-col.xpm
diff --git a/widgets/e-table/ROADMAP.e-table b/widgets/e-table/ROADMAP.e-table
deleted file mode 100644
index 4edacced86..0000000000
--- a/widgets/e-table/ROADMAP.e-table
+++ /dev/null
@@ -1,113 +0,0 @@
-
-The E-Table package implements an editable table that provides
-user-defined rendering, user-defined editing, sorting and grouping of
-the objects displayed.
-
-It is inspired by Java's Swing JTable object. There are models for
-the actual table contents and for the table headers; they are the
-actual repository of information.
-
-The objects are rendered by various view objects. In the current code
-base, we use we use GnomeCanvasItems to do the rendering. One for
-each table and one for the headers.
-
-* The main widget
-
-e-table.c, e-table.h:
-
- Implements a full widget. Uses various components described
- below. Handles column display as well as grouping/nesting
-
-* The Models
-
-All of them are GtkObjects.
-
-e-table-model.h, e-table-model.c:
-
- These implement the abstract E-Table-Model class. You
- can derive this object to create your own data repository.
-
- These emits signals to notify the views about selection, and
- changes in the model.
-
-e-table-simple.h, e-table-simple.c:
-
- A simple implementation of e-table-model that uses callback
- routines (you provide the callbacks). For lazy people, like
- me.
-
-e-cell.c, e-cell.h:
-
- These are actually mis-named. Objects of type e-cell know
- about rendering a single cell, and these are attached to the
- e-table-cols (described next).
-
- The user provides the various rendering modes as e-cells (they
- are actually column-rendering repositories).
-
- This is just an abstract class. I will provide various
- e-cells: a text cell, a checkbox cell, an image cell, and
- perhaps an n-state image cell (one that switches the image when
- the cell is clicked).
-
-e-table-col.h, e-table-col.c:
-
- Describes a single column (the size, the string displayed, the
- rendering function for each row and comparison function for
- this field).
-
-
-* The Views
-
-e-table-header.h, e-table-header.c:
-
- These implement the ETableHeaderItem canvas item. This item is
- used both to control the columns displayed as well as displaying them.
-
- They describe what columns are shown in the screen and in
- which order.
-
- These emit signals: column-size-changed and structure-changed
- (if a column is added/removed)
-
-e-table-item.c, e-table-item.h
-
- This is a canvas item that renders the contents of a
- ETableModel into the screen.
-
-e-table-header-item.c, e-table-header-item.h
-
- This canvas item renders the ETableHeader headings.
-
-e-cell-text.c, e-cell-text.h
-
- Not really a view, but actually a derivative of e-cell that
- implements text display: supports justification and font
- setting. Will add color in the future most likely
-
-e-cell-toggle.c, e-cell-toggle.h
-
- A derivative of e-cell as well that support N-toggle values
- using images.
-
-e-cell-check.c, e-cell-check.h
-
- An e-cell-toggle with two states only (for checkboxes).
-
-* The Filters
-
-e-table-sorted.c, e-table-sorted.h
-
- This is an ETableModel that can sort an existing ETableModel.
-
-e-table-subset.c, e-table-subset.h
-
- Not finished, but it is just an ETableModel that happens to be
- a subset of another ETableModel.
-
-* Everything
-
-e-table.c, e-table.h
-
- In the future these guys will implement the whole widget for
- doing table editing. Nothing done about these yet.
diff --git a/widgets/e-table/TODO b/widgets/e-table/TODO
deleted file mode 100644
index 29dbd454e5..0000000000
--- a/widgets/e-table/TODO
+++ /dev/null
@@ -1,24 +0,0 @@
-Implement e-cell-height
-Implement computation of heights from the e-cell-heights
-Make sure we compute the height from that
-Include spacing in columns and rows for the decoration lines
-Add threshold to compute a "global" size
-Implement the two methods for row finding: by full thing, or by a factor.
-
-
-Add editing
-mouse grabbing for scrolling
-
-
-1. Make sure that all values are updated on header changes and table
- model changes (they are slightly out of sync now)
-
-* Correctness
-
- * Make sure we can boot and shutdown with no memory leaks.
-
- * Run Insure on the thing.
-
-* Propagation
-
- * Row changes should be reflected in the subsets.
diff --git a/widgets/e-table/add-col.xpm b/widgets/e-table/add-col.xpm
deleted file mode 100644
index 9c5f314c8e..0000000000
--- a/widgets/e-table/add-col.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static char * add_col_xpm[] = {
-"16 16 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" ",
-" ",
-" .............. ",
-" .++++++++++++. ",
-" .++++++++++++. ",
-" ....+++....... ",
-" .+. ",
-" . ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/e-table/check-empty.xpm b/widgets/e-table/check-empty.xpm
deleted file mode 100644
index 2dd873e137..0000000000
--- a/widgets/e-table/check-empty.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static char * check_empty_xpm[] = {
-"16 16 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" ............ ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" ............ ",
-" ",
-" "};
diff --git a/widgets/e-table/check-filled.xpm b/widgets/e-table/check-filled.xpm
deleted file mode 100644
index 689d7a7967..0000000000
--- a/widgets/e-table/check-filled.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static char * check_filled_xpm[] = {
-"16 16 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" ............ ",
-" . . ",
-" . . . ",
-" . .. . ",
-" . ... . ",
-" . . ... . ",
-" . .. ... . ",
-" . ..... . ",
-" . ... . ",
-" . . . ",
-" . . ",
-" ............ ",
-" ",
-" "};
diff --git a/widgets/e-table/e-cell-checkbox.c b/widgets/e-table/e-cell-checkbox.c
deleted file mode 100644
index 431c1663d1..0000000000
--- a/widgets/e-table/e-cell-checkbox.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * e-cell-checkbox.c: Checkbox cell renderer
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-canvas.h>
-#include "e-cell-checkbox.h"
-#include "e-util/e-util.h"
-#include "e-table-item.h"
-
-#include "check-empty.xpm"
-#include "check-filled.xpm"
-
-#define PARENT_TYPE e_cell_toggle_get_type()
-
-static GdkPixbuf *checks [2];
-
-static void
-e_cell_checkbox_class_init (GtkObjectClass *object_class)
-{
- checks [0] = gdk_pixbuf_new_from_xpm_data (check_empty_xpm);
- checks [1] = gdk_pixbuf_new_from_xpm_data (check_filled_xpm);
-}
-
-E_MAKE_TYPE(e_cell_checkbox, "ECellCheckbox", ECellCheckbox, e_cell_checkbox_class_init, NULL, PARENT_TYPE);
-
-ECell *
-e_cell_checkbox_new (void)
-{
- ECellCheckbox *eccb = gtk_type_new (e_cell_checkbox_get_type ());
-
- e_cell_toggle_construct (E_CELL_TOGGLE (eccb), 2, 2, checks);
-
- return (ECell *) eccb;
-}
diff --git a/widgets/e-table/e-cell-checkbox.h b/widgets/e-table/e-cell-checkbox.h
deleted file mode 100644
index 969e4a5edc..0000000000
--- a/widgets/e-table/e-cell-checkbox.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _E_CELL_CHECKBOX_H_
-#define _E_CELL_CHECKBOX_H_
-
-#include "e-cell-toggle.h"
-
-#define E_CELL_CHECKBOX_TYPE (e_cell_checkbox_get_type ())
-#define E_CELL_CHECKBOX(o) (GTK_CHECK_CAST ((o), E_CELL_CHECKBOX_TYPE, ECellCheckbox))
-#define E_CELL_CHECKBOX_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_CHECKBOX_TYPE, ECellCheckboxClass))
-#define E_IS_CELL_CHECKBOX(o) (GTK_CHECK_TYPE ((o), E_CELL_CHECKBOX_TYPE))
-#define E_IS_CELL_CHECKBOX_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_CHECKBOX_TYPE))
-
-typedef struct {
- ECellToggle parent;
-} ECellCheckbox;
-
-typedef struct {
- ECellToggleClass parent_class;
-} ECellCheckboxClass;
-
-GtkType e_cell_checkbox_get_type (void);
-ECell *e_cell_checkbox_new (void);
-
-#endif /* _E_CELL_CHECKBOX_H_ */
-
diff --git a/widgets/e-table/e-cell-string.c b/widgets/e-table/e-cell-string.c
deleted file mode 100644
index 992b1bd10e..0000000000
--- a/widgets/e-table/e-cell-string.c
+++ /dev/null
@@ -1,9 +0,0 @@
-ECell *
-e_cell_string_new (void)
-{
- ECell *ecell;
-
- ecell = gtk_type_new (ecell);
-
- return ecell;
-}
diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c
deleted file mode 100644
index fead3d4654..0000000000
--- a/widgets/e-table/e-cell-text.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * e-cell-text.c: Text cell renderer
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <stdio.h>
-#include "e-cell-text.h"
-#include "e-util/e-util.h"
-#include "e-table-item.h"
-
-#define PARENT_TYPE e_cell_get_type()
-
-#define TEXT_PAD 2
-
-typedef struct {
- char *old_text;
- GtkWidget *entry_top;
- GtkEntry *entry;
-
- /*
- * Where the editing is taking place
- */
- int model_col, view_col, row;
-} CellEdit;
-
-typedef struct {
- ECellView cell_view;
- GdkGC *gc;
- GdkFont *font;
- GnomeCanvas *canvas;
-
- /*
- * During edition.
- */
- CellEdit *edit;
-} ECellTextView;
-
-static ECellClass *parent_class;
-
-static void
-ect_queue_redraw (ECellTextView *text_view, int view_col, int view_row)
-{
- e_table_item_redraw_range (
- text_view->cell_view.e_table_item_view,
- view_col, view_row, view_col, view_row);
-}
-
-/*
- * Accept the currently edited text
- */
-static void
-ect_accept_edits (ECellTextView *text_view)
-{
- const char *text = gtk_entry_get_text (text_view->edit->entry);
- CellEdit *edit = text_view->edit;
-
- e_table_model_set_value_at (text_view->cell_view.e_table_model, edit->model_col, edit->row, text);
-}
-
-/*
- * Shuts down the editing process
- */
-static void
-ect_stop_editing (ECellTextView *text_view)
-{
- CellEdit *edit = text_view->edit;
-
- g_free (edit->old_text);
- edit->old_text = NULL;
- gtk_widget_destroy (edit->entry_top);
- edit->entry_top = NULL;
- edit->entry = NULL;
-
- g_free (edit);
-
- text_view->edit = NULL;
-
- e_table_item_leave_edit (text_view->cell_view.e_table_item_view);
-}
-
-/*
- * Cancels the edits
- */
-static void
-ect_cancel_edit (ECellTextView *text_view)
-{
- ect_queue_redraw (text_view, text_view->edit->view_col, text_view->edit->row);
- ect_stop_editing (text_view);
-}
-
-/*
- * ECell::new_view method
- */
-static ECellView *
-ect_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- ECellText *ect = E_CELL_TEXT (ecell);
- ECellTextView *text_view = g_new0 (ECellTextView, 1);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (e_table_item_view)->canvas;
-
- text_view->cell_view.ecell = ecell;
- text_view->cell_view.e_table_model = table_model;
- text_view->cell_view.e_table_item_view = e_table_item_view;
-
- if (ect->font_name){
- GdkFont *f;
-
- f = gdk_fontset_load (ect->font_name);
- text_view->font = f;
- }
- if (!text_view->font){
- text_view->font = GTK_WIDGET (canvas)->style->font;
-
- gdk_font_ref (text_view->font);
- }
-
- text_view->canvas = canvas;
-
- return (ECellView *)text_view;
-}
-
-/*
- * ECell::kill_view method
- */
-static void
-ect_kill_view (ECellView *ecv)
-{
- ECellTextView *text_view = (ECellTextView *) ecv;
-
- gdk_font_unref (text_view->font);
- text_view->font = NULL;
-
- g_free (text_view);
-}
-
-/*
- * ECell::realize method
- */
-static void
-ect_realize (ECellView *ecell_view)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
-
- text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window);
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-ect_unrealize (ECellView *ecv)
-{
- ECellTextView *text_view = (ECellTextView *) ecv;
-
- gdk_gc_unref (text_view->gc);
- text_view->gc = NULL;
-}
-
-/*
- * ECell::draw method
- */
-static void
-ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected,
- int x1, int y1, int x2, int y2)
-{
- ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- GtkWidget *w = GTK_WIDGET (text_view->canvas);
- GdkRectangle rect;
- const char *str = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
- GdkFont *font = text_view->font;
- const int height = font->ascent + font->descent;
- int xoff;
- gboolean edit_display = FALSE;
-
- /*
- * Figure if this cell is being edited
- */
- if (text_view->edit){
- CellEdit *edit = text_view->edit;
-
- if ((edit->view_col == view_col) && (edit->row == row))
- edit_display = TRUE;
- }
-
- /*
- * Be a nice citizen: clip to the region we are supposed to draw on
- */
- rect.x = x1;
- rect.y = y1;
- rect.width = x2 - x1;
- rect.height = y2 - y1;
- gdk_gc_set_clip_rectangle (text_view->gc, &rect);
-
- if (edit_display){
- CellEdit *edit = text_view->edit;
- const char *text = gtk_entry_get_text (edit->entry);
- GdkWChar *p, *text_wc = g_new (GdkWChar, strlen (text) + 1);
- int text_wc_len = gdk_mbstowcs (text_wc, text, strlen (text));
- const int cursor_pos = GTK_EDITABLE (edit->entry)->current_pos;
- const int left_len = gdk_text_width_wc (text_view->font, text_wc, cursor_pos);
-
- text_wc [text_wc_len] = 0;
- /*
- * Paint
- */
- gdk_gc_set_foreground (text_view->gc, &w->style->base [GTK_STATE_NORMAL]);
- gdk_draw_rectangle (drawable, text_view->gc, TRUE,
- rect.x, rect.y, rect.width, rect.height);
- gdk_gc_set_foreground (text_view->gc, &w->style->text [GTK_STATE_NORMAL]);
-
- {
- GdkGC *gc = text_view->gc;
- const int y = y2 - font->descent - ((y2-y1-height)/2);
- int px, i;
-
- /*
- * Border
- */
- x1 += 2;
- x2--;
-
- px = x1;
-
- /*
- * If the cursor is outside the visible range
- *
- * FIXME: we really want a better behaviour.
- */
- if ((px + left_len) > x2)
- px -= left_len - (x2-x1);
-
- /*
- * Draw
- */
- for (i = 0, p = text_wc; *p; p++, i++){
- gdk_draw_text_wc (
- drawable, font, gc, px, y, p, 1);
-
- if (i == cursor_pos){
- gdk_draw_line (
- drawable, gc,
- px, y - font->ascent,
- px, y + font->descent - 1);
- }
-
- px += gdk_text_width_wc (font, p, 1);
- }
-
- if (i == cursor_pos){
- gdk_draw_line (
- drawable, gc,
- px, y - font->ascent,
- px, y + font->descent - 1);
- }
- }
- g_free (text_wc);
- } else {
- /*
- * Regular cell
- */
- GdkColor *background, *foreground;
- int width;
-
- /*
- * Border
- */
- x1++;
- x2--;
-
- /*
- * Compute draw mode
- */
- switch (ect->justify){
- case GTK_JUSTIFY_LEFT:
- xoff = 1;
- break;
-
- case GTK_JUSTIFY_RIGHT:
- width = 1 + gdk_text_width (font, str, strlen (str));
- xoff = (x2 - x1) - width;
- break;
-
- case GTK_JUSTIFY_CENTER:
- xoff = ((x2 - x1) - gdk_text_width (font, str, strlen (str))) / 2;
- break;
- default:
- xoff = 0;
- g_warning ("Can not handle GTK_JUSTIFY_FILL");
- break;
- }
-
-
- if (selected){
- background = &w->style->bg [GTK_STATE_SELECTED];
- foreground = &w->style->text [GTK_STATE_SELECTED];
- } else {
- background = &w->style->base [GTK_STATE_NORMAL];
- foreground = &w->style->text [GTK_STATE_NORMAL];
- }
-
- gdk_gc_set_foreground (text_view->gc, background);
- gdk_draw_rectangle (drawable, text_view->gc, TRUE,
- rect.x, rect.y, rect.width, rect.height);
- gdk_gc_set_foreground (text_view->gc, foreground);
-
- gdk_draw_string (
- drawable, font, text_view->gc,
- x1 + xoff,
- y2 - font->descent - ((y2-y1-height)/2), str);
- }
-}
-
-/*
- * Selects the entire string
- */
-static void
-ect_edit_select_all (ECellTextView *text_view)
-{
- g_assert (text_view->edit);
-
- gtk_editable_select_region (GTK_EDITABLE (text_view->edit->entry), 0, -1);
-}
-
-/*
- * ECell::event method
- */
-static gint
-ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
-
- switch (event->type){
- case GDK_BUTTON_PRESS:
- /*
- * Adjust for the border we use
- */
- event->button.x++;
-
- printf ("Button pressed at %g %g\n", event->button.x, event->button.y);
- if (text_view->edit){
- printf ("FIXME: Should handle click here\n");
- } else
- e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row);
- break;
-
- case GDK_BUTTON_RELEASE:
- /*
- * Adjust for the border we use
- */
- event->button.x++;
- printf ("Button released at %g %g\n", event->button.x, event->button.y);
- return TRUE;
-
- case GDK_KEY_PRESS:
- if (event->key.keyval == GDK_Escape){
- ect_cancel_edit (text_view);
- return TRUE;
- }
-
- if (!text_view->edit){
- e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row);
- ect_edit_select_all (text_view);
- }
-
- gtk_widget_event (GTK_WIDGET (text_view->edit->entry), event);
- ect_queue_redraw (text_view, view_col, row);
- break;
-
- case GDK_KEY_RELEASE:
- break;
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-/*
- * ECell::height method
- */
-static int
-ect_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
-
- return (text_view->font->ascent + text_view->font->descent) + TEXT_PAD;
-}
-
-/*
- * Callback: invoked when the user pressed "enter" on the GtkEntry
- */
-static void
-ect_entry_activate (GtkEntry *entry, ECellTextView *text_view)
-{
- e_table_item_leave_edit (text_view->cell_view.e_table_item_view);
-}
-
-/*
- * ECellView::enter_edit method
- */
-static void *
-ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- const char *str = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
- CellEdit *edit;
-
- edit = g_new (CellEdit, 1);
- text_view->edit = edit;
-
- edit->model_col = model_col;
- edit->view_col = view_col;
- edit->row = row;
-
- edit->entry = (GtkEntry *) gtk_entry_new ();
- gtk_entry_set_text (edit->entry, str);
- edit->old_text = g_strdup (str);
- gtk_signal_connect (GTK_OBJECT (edit->entry), "activate",
- GTK_SIGNAL_FUNC (ect_entry_activate), text_view);
-
- /*
- * The hack: create this window off-screen
- */
- edit->entry_top = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_container_add (GTK_CONTAINER (edit->entry_top), GTK_WIDGET (edit->entry));
- gtk_widget_set_uposition (edit->entry_top, 20000, 20000);
- gtk_widget_show_all (edit->entry_top);
-
- ect_queue_redraw (text_view, view_col, row);
-
- return NULL;
-}
-
-/*
- * ECellView::leave_edit method
- */
-static void
-ect_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
-
- if (text_view->edit){
- ect_accept_edits (text_view);
- ect_stop_editing (text_view);
- } else {
- /*
- * We did invoke this leave edit internally
- */
- }
-}
-
-/*
- * GtkObject::destroy method
- */
-static void
-ect_destroy (GtkObject *object)
-{
- ECellText *ect = E_CELL_TEXT (object);
-
- g_free (ect->font_name);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-e_cell_text_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->destroy = ect_destroy;
-
- ecc->new_view = ect_new_view;
- ecc->kill_view = ect_kill_view;
- ecc->realize = ect_realize;
- ecc->unrealize = ect_unrealize;
- ecc->draw = ect_draw;
- ecc->event = ect_event;
- ecc->height = ect_height;
- ecc->enter_edit = ect_enter_edit;
- ecc->leave_edit = ect_leave_edit;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, NULL, PARENT_TYPE);
-
-ECell *
-e_cell_text_new (ETableModel *etm, const char *fontname, GtkJustification justify)
-{
- ECellText *ect = gtk_type_new (e_cell_text_get_type ());
-
- ect->font_name = g_strdup (fontname);
- ect->justify = justify;
-
- return (ECell *) ect;
-}
diff --git a/widgets/e-table/e-cell-text.h b/widgets/e-table/e-cell-text.h
deleted file mode 100644
index de9629b97b..0000000000
--- a/widgets/e-table/e-cell-text.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _E_CELL_TEXT_H_
-#define _E_CELL_TEXT_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include "e-cell.h"
-
-#define E_CELL_TEXT_TYPE (e_cell_text_get_type ())
-#define E_CELL_TEXT(o) (GTK_CHECK_CAST ((o), E_CELL_TEXT_TYPE, ECellText))
-#define E_CELL_TEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TEXT_TYPE, ECellTextClass))
-#define E_IS_CELL_TEXT(o) (GTK_CHECK_TYPE ((o), E_CELL_TEXT_TYPE))
-#define E_IS_CELL_TEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TEXT_TYPE))
-
-typedef struct {
- ECell parent;
-
- GtkJustification justify;
- char *font_name;
-} ECellText;
-
-typedef struct {
- ECellClass parent_class;
-} ECellTextClass;
-
-GtkType e_cell_text_get_type (void);
-ECell *e_cell_text_new (ETableModel *model, const char *fontname, GtkJustification justify);
-
-#endif /* _E_CELL_TEXT_H_ */
-
diff --git a/widgets/e-table/e-cell-toggle.c b/widgets/e-table/e-cell-toggle.c
deleted file mode 100644
index 679d04a0ca..0000000000
--- a/widgets/e-table/e-cell-toggle.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * e-cell-toggle.c: Multi-state image toggle cell object.
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-canvas.h>
-#include "e-cell-toggle.h"
-#include "e-util/e-util.h"
-#include "e-table-item.h"
-
-#define PARENT_TYPE e_cell_get_type()
-
-typedef struct {
- ECellView cell_view;
- GdkGC *gc;
- GnomeCanvas *canvas;
-} ECellToggleView;
-
-static ECellClass *parent_class;
-
-static void
-etog_queue_redraw (ECellToggleView *text_view, int view_col, int view_row)
-{
- e_table_item_redraw_range (
- text_view->cell_view.e_table_item_view,
- view_col, view_row, view_col, view_row);
-}
-
-/*
- * ECell::realize method
- */
-static ECellView *
-etog_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- ECellToggleView *toggle_view = g_new0 (ECellToggleView, 1);
- ETableItem *eti = E_TABLE_ITEM (e_table_item_view);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas;
-
- toggle_view->cell_view.ecell = ecell;
- toggle_view->cell_view.e_table_model = table_model;
- toggle_view->cell_view.e_table_item_view = e_table_item_view;
- toggle_view->canvas = canvas;
-
- return (ECellView *) toggle_view;
-}
-
-static void
-etog_kill_view (ECellView *ecell_view)
-{
- g_free (ecell_view);
-}
-
-static void
-etog_realize (ECellView *ecell_view)
-{
- ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
-
- toggle_view->gc = gdk_gc_new (GTK_WIDGET (toggle_view->canvas)->window);
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-etog_unrealize (ECellView *ecv)
-{
- ECellToggleView *toggle_view = (ECellToggleView *) ecv;
-
- gdk_gc_unref (toggle_view->gc);
- toggle_view->gc = NULL;
-}
-
-/*
- * ECell::draw method
- */
-static void
-etog_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected,
- int x1, int y1, int x2, int y2)
-{
- ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
- ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
- GdkPixbuf *image;
- ArtPixBuf *art;
- int x, y, width, height;
- const int value = GPOINTER_TO_INT (
- e_table_model_value_at (ecell_view->e_table_model, model_col, row));
-
- if (value >= toggle->n_states){
- g_warning ("Value from the table model is %d, the states we support are [0..%d)\n",
- value, toggle->n_states);
- return;
- }
-
- /*
- * Paint the background
- */
- gdk_draw_rectangle (drawable, GTK_WIDGET (toggle_view->canvas)->style->white_gc, TRUE, x1, y1, x2 - x1, y2 - y1);
-
- image = toggle->images [value];
- art = image->art_pixbuf;
-
- if ((x2 - x1) < art->width){
- x = x1;
- width = x2 - x1;
- } else {
- x = x1 + ((x2 - x1) - art->width) / 2;
- width = art->width;
- }
-
- if ((y2 - y1) < art->height){
- y = y1;
- height = y2 - y1;
- } else {
- y = y1 + ((y2 - y1) - art->height) / 2;
- height = art->height;
- }
-
- width = y2 - y1;
-
- if (image->art_pixbuf->has_alpha){
- GdkColor background;
- guchar *buffer;
- int alpha, ix, iy;
-
- buffer = g_malloc (art->rowstride * art->height * 3);
-
- background.red = 255;
- background.green = 255;
- background.blue = 255;
-
- for (iy = 0; iy < art->height; iy++){
- unsigned char *dest;
- unsigned char *src;
-
- dest = buffer + (iy * art->rowstride);
- src = art->pixels + (iy * art->rowstride);
-
- for (ix = 0; ix < art->width; ix++){
- alpha = src [3];
- if (alpha == 0){
- *dest++ = background.red;
- *dest++ = background.green;
- *dest++ = background.blue;
- src += 3;
- } else if (alpha == 255){
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- } else {
- *dest++ = (background.red + ((*src++ - background.red) * alpha + 0x80)) >> 8;
- *dest++ = (background.green + ((*src++ - background.green) * alpha + 0x80)) >> 8;
- *dest++ = (background.blue + ((*src++ - background.blue) * alpha + 0x80)) >> 8;
- }
- src++;
- }
- }
-
- gdk_draw_rgb_image_dithalign (
- drawable, toggle_view->gc, x, y, width, height,
- GDK_RGB_DITHER_NORMAL, buffer, art->rowstride, 0, 0);
-
- g_free (buffer);
- } else
- gdk_draw_rgb_image_dithalign (
- drawable, toggle_view->gc, x, y, width, height,
- GDK_RGB_DITHER_NORMAL, art->pixels, art->rowstride, 0, 0);
-}
-
-static void
-etog_set_value (ECellToggleView *toggle_view, int model_col, int view_col, int row, int value)
-{
- ECell *ecell = toggle_view->cell_view.ecell;
- ECellToggle *toggle = E_CELL_TOGGLE (ecell);
-
- if (value >= toggle->n_states)
- value = 0;
-
- e_table_model_set_value_at (toggle_view->cell_view.e_table_model,
- model_col, row, GINT_TO_POINTER (value));
- etog_queue_redraw (toggle_view, view_col, row);
-}
-
-/*
- * ECell::event method
- */
-static gint
-etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row)
-{
- ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
- void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
- const int value = GPOINTER_TO_INT (_value);
-
- switch (event->type){
- case GDK_BUTTON_RELEASE:
- etog_set_value (toggle_view, model_col, view_col, row, value + 1);
- return TRUE;
-
- case GDK_KEY_PRESS:
- if (event->key.keyval == GDK_space){
- etog_set_value (toggle_view, model_col, view_col, row, value + 1);
- return TRUE;
- }
- return FALSE;
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-/*
- * ECell::height method
- */
-static int
-etog_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
-
- return toggle->height;
-}
-
-static void
-etog_destroy (GtkObject *object)
-{
- ECellToggle *etog = E_CELL_TOGGLE (object);
- int i;
-
- for (i = 0; i < etog->n_states; i++)
- gdk_pixbuf_unref (etog->images [i]);
-
- g_free (etog->images);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-e_cell_toggle_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->destroy = etog_destroy;
-
- ecc->new_view = etog_new_view;
- ecc->kill_view = etog_kill_view;
- ecc->realize = etog_realize;
- ecc->unrealize = etog_unrealize;
- ecc->draw = etog_draw;
- ecc->event = etog_event;
- ecc->height = etog_height;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-E_MAKE_TYPE(e_cell_toggle, "ECellToggle", ECellToggle, e_cell_toggle_class_init, NULL, PARENT_TYPE);
-
-void
-e_cell_toggle_construct (ECellToggle *etog, int border, int n_states, GdkPixbuf **images)
-{
- int max_height = 0;
- int i;
-
- etog->border = border;
- etog->n_states = n_states;
-
- etog->images = g_new (GdkPixbuf *, n_states);
-
- for (i = 0; i < n_states; i++){
- etog->images [i] = images [i];
- gdk_pixbuf_ref (images [i]);
-
- if (images [i]->art_pixbuf->height > max_height)
- max_height = images [i]->art_pixbuf->height;
- }
-
- etog->height = max_height;
-}
-
-ECell *
-e_cell_toggle_new (int border, int n_states, GdkPixbuf **images)
-{
- ECellToggle *etog = gtk_type_new (e_cell_toggle_get_type ());
-
- e_cell_toggle_construct (etog, border, n_states, images);
-
- return (ECell *) etog;
-}
-
-
diff --git a/widgets/e-table/e-cell-toggle.h b/widgets/e-table/e-cell-toggle.h
deleted file mode 100644
index d5773b454a..0000000000
--- a/widgets/e-table/e-cell-toggle.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _E_CELL_TOGGLE_H_
-#define _E_CELL_TOGGLE_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "e-cell.h"
-
-#define E_CELL_TOGGLE_TYPE (e_cell_toggle_get_type ())
-#define E_CELL_TOGGLE(o) (GTK_CHECK_CAST ((o), E_CELL_TOGGLE_TYPE, ECellToggle))
-#define E_CELL_TOGGLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TOGGLE_TYPE, ECellToggleClass))
-#define E_IS_CELL_TOGGLE(o) (GTK_CHECK_TYPE ((o), E_CELL_TOGGLE_TYPE))
-#define E_IS_CELL_TOGGLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TOGGLE_TYPE))
-
-typedef struct {
- ECell parent;
-
- int border;
- int n_states;
- GdkPixbuf **images;
-
- int height;
-} ECellToggle;
-
-typedef struct {
- ECellClass parent_class;
-} ECellToggleClass;
-
-GtkType e_cell_toggle_get_type (void);
-ECell *e_cell_toggle_new (int border, int n_states, GdkPixbuf **images);
-void e_cell_toggle_construct (ECellToggle *etog, int border,
- int n_states, GdkPixbuf **images);
-
-#endif /* _E_CELL_TOGGLE_H_ */
-
-
diff --git a/widgets/e-table/e-cell.c b/widgets/e-table/e-cell.c
deleted file mode 100644
index f1345e8c6b..0000000000
--- a/widgets/e-table/e-cell.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * e-cell.c: base class for cell renderers in e-table
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include "e-cell.h"
-#include "e-util/e-util.h"
-
-#define PARENT_TYPE gtk_object_get_type()
-
-static ECellView *
-ec_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- return NULL;
-}
-
-static void
-ec_realize (ECellView *e_cell)
-{
-}
-
-static void
-ec_kill_view (ECellView *ecell_view)
-{
-}
-
-static void
-ec_unrealize (ECellView *e_cell)
-{
-}
-
-static void
-ec_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected,
- int x1, int y1, int x2, int y2)
-{
- g_error ("e-cell-draw invoked\n");
-}
-
-static gint
-ec_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row)
-{
- g_error ("e-cell-event invoked\n");
- return 0;
-}
-
-static gint
-ec_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- g_error ("e-cell-event invoked\n");
- return 0;
-}
-
-static void
-ec_focus (ECellView *ecell_view, int model_col, int view_col, int row, int x1, int y1, int x2, int y2)
-{
- ecell_view->focus_col = view_col;
- ecell_view->focus_row = row;
- ecell_view->focus_x1 = x1;
- ecell_view->focus_y1 = y1;
- ecell_view->focus_x2 = x2;
- ecell_view->focus_y2 = y2;
-}
-
-static void
-ec_unfocus (ECellView *ecell_view)
-{
- ecell_view->focus_col = -1;
- ecell_view->focus_row = -1;
- ecell_view->focus_x1 = -1;
- ecell_view->focus_y1 = -1;
- ecell_view->focus_x2 = -1;
- ecell_view->focus_y2 = -1;
-}
-
-static void *
-ec_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- return NULL;
-}
-
-static void
-ec_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *context)
-{
-}
-
-static void
-e_cell_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- ecc->realize = ec_realize;
- ecc->unrealize = ec_unrealize;
- ecc->new_view = ec_new_view;
- ecc->kill_view = ec_kill_view;
- ecc->draw = ec_draw;
- ecc->event = ec_event;
- ecc->focus = ec_focus;
- ecc->unfocus = ec_unfocus;
- ecc->height = ec_height;
- ecc->enter_edit = ec_enter_edit;
- ecc->leave_edit = ec_leave_edit;
-}
-
-static void
-e_cell_init (GtkObject *object)
-{
-}
-
-E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE);
-
-
-void
-e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row)
-{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->event (
- ecell_view, event, model_col, view_col, row);
-}
-
-ECellView *
-e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- return E_CELL_CLASS (GTK_OBJECT (ecell)->klass)->new_view (
- ecell, table_model, e_table_item_view);
-}
-
-void
-e_cell_view_realize (ECellView *ecell_view)
-{
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->realize (ecell_view);
-}
-
-void
-e_cell_kill_view (ECellView *ecell_view)
-{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->kill_view (ecell_view);
-}
-
-void
-e_cell_unrealize (ECellView *ecell_view)
-{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->unrealize (ecell_view);
-}
-
-void
-e_cell_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected, int x1, int y1, int x2, int y2)
-{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->draw (
- ecell_view, drawable, model_col, view_col, row, selected, x1, y1, x2, y2);
-}
-
-int
-e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->height (
- ecell_view, model_col, view_col, row);
-}
-
-void *
-e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->enter_edit (
- ecell_view, model_col, view_col, row);
-}
-
-void
-e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
-{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->leave_edit (
- ecell_view, model_col, view_col, row, edit_context);
-}
diff --git a/widgets/e-table/e-cell.h b/widgets/e-table/e-cell.h
deleted file mode 100644
index 3c258689e4..0000000000
--- a/widgets/e-table/e-cell.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef _E_CELL_H_
-#define _E_CELL_H_
-
-#include <gdk/gdktypes.h>
-#include "e-table-model.h"
-
-#define E_CELL_TYPE (e_cell_get_type ())
-#define E_CELL(o) (GTK_CHECK_CAST ((o), E_CELL_TYPE, ECell))
-#define E_CELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass))
-#define E_IS_CELL(o) (GTK_CHECK_TYPE ((o), E_CELL_TYPE))
-#define E_IS_CELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TYPE))
-
-typedef struct _ECell ECell;
-typedef struct _ECellView ECellView;
-
-struct _ECell {
- GtkObject object;
-};
-
-struct _ECellView {
- ECell *ecell;
- ETableModel *e_table_model;
- void *e_table_item_view;
-
- gint focus_x1, focus_y1, focus_x2, focus_y2;
- gint focus_col, focus_row;
-};
-
-#define E_CELL_IS_FOCUSED(ecell_view) (ecell_view->focus_x1 != -1)
-
-typedef struct {
- GtkObjectClass parent_class;
-
- ECellView *(*new_view) (ECell *ecell, ETableModel *table_model, void *e_table_item_view);
- void (*kill_view) (ECellView *ecell_view);
-
- void (*realize) (ECellView *ecell_view);
- void (*unrealize) (ECellView *ecell_view);
-
- void (*draw) (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row,
- gboolean selected, int x1, int y1, int x2, int y2);
- gint (*event) (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row);
- void (*focus) (ECellView *ecell_view, int model_col, int view_col,
- int row, int x1, int y1, int x2, int y2);
- void (*unfocus) (ECellView *ecell_view);
- int (*height) (ECellView *ecell_view, int model_col, int view_col, int row);
-
- void *(*enter_edit)(ECellView *ecell_view, int model_col, int view_col, int row);
- void (*leave_edit)(ECellView *ecell_view, int model_col, int view_col, int row, void *context);
-} ECellClass;
-
-GtkType e_cell_get_type (void);
-ECellView *e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view);
-void e_cell_kill_view (ECellView *ecell_view);
-
-void e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row);
-
-void e_cell_realize (ECellView *ecell_view);
-void e_cell_unrealize (ECellView *ecell_view);
-
-void e_cell_draw (ECellView *ecell_view, GdkDrawable *dr,
- int model_col, int view_col, int row, gboolean selected,
- int x1, int y1, int x2, int y2);
-void e_cell_focus (ECellView *ecell_view, int model_col, int view_col, int row,
- int x1, int y1, int x2, int y2);
-void e_cell_unfocus (ECellView *ecell_view);
-int e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row);
-
-void *e_cell_enter_edit(ECellView *ecell_view, int model_col, int view_col, int row);
-void e_cell_leave_edit(ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context);
-
-#endif /* _E_CELL_H_ */
diff --git a/widgets/e-table/e-table-col-dnd.h b/widgets/e-table/e-table-col-dnd.h
deleted file mode 100644
index c1c26175c7..0000000000
--- a/widgets/e-table/e-table-col-dnd.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _E_TABLE_COL_DND_H_
-#define _E_TABLE_COL_DND_H_
-
-#define TARGET_ETABLE_COL_TYPE "application/x-etable-column-header"
-
-enum {
- TARGET_ETABLE_COL_HEADER
-};
-
-#endif /* _E_TABLE_COL_DND_H_ */
diff --git a/widgets/e-table/e-table-col.c b/widgets/e-table/e-table-col.c
deleted file mode 100644
index 6f475158a5..0000000000
--- a/widgets/e-table/e-table-col.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * E-table-col.c: ETableCol implementation
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
-#include "e-table-col.h"
-#include "e-util/e-util.h"
-
-#define PARENT_TYPE (gtk_object_get_type ())
-
-static GtkObjectClass *parent_class;
-
-static void
-etc_destroy (GtkObject *object)
-{
- ETableCol *etc = E_TABLE_COL (object);
-
- g_free (etc->text);
-
- (*parent_class->destroy)(object);
-}
-
-static void
-e_table_col_class_init (GtkObjectClass *object_class)
-{
- parent_class = gtk_type_class (PARENT_TYPE);
- object_class->destroy = etc_destroy;
-}
-
-E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, NULL, PARENT_TYPE);
-
-ETableCol *
-e_table_col_new (int col_idx, const char *text, int width, int min_width,
- ECell *ecell, GCompareFunc compare, gboolean resizable)
-{
- ETableCol *etc;
-
- g_return_val_if_fail (width >= 0, NULL);
- g_return_val_if_fail (min_width >= 0, NULL);
- g_return_val_if_fail (width >= min_width, NULL);
- g_return_val_if_fail (compare != NULL, NULL);
-
- etc = gtk_type_new (E_TABLE_COL_TYPE);
-
- etc->col_idx = col_idx;
- etc->text = g_strdup (text);
- etc->width = width;
- etc->min_width = min_width;
- etc->ecell = ecell;
- etc->compare = compare;
-
- etc->selected = 0;
- etc->resizeable = resizable;
-
- return etc;
-}
-
-
diff --git a/widgets/e-table/e-table-col.h b/widgets/e-table/e-table-col.h
deleted file mode 100644
index 54f03ae237..0000000000
--- a/widgets/e-table/e-table-col.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _E_TABLE_COL_H_
-#define _E_TABLE_COL_H_
-
-#include "e-cell.h"
-
-#define E_TABLE_COL_TYPE (e_table_col_get_type ())
-#define E_TABLE_COL(o) (GTK_CHECK_CAST ((o), E_TABLE_COL_TYPE, ETableCol))
-#define E_TABLE_COL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_COL_TYPE, ETableColClass))
-#define E_IS_TABLE_COL(o) (GTK_CHECK_TYPE ((o), E_TABLE_COL_TYPE))
-#define E_IS_TABLE_COL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_COL_TYPE))
-
-typedef struct _ETableCol ETableCol;
-
-/*
- * Information about a single column
- */
-struct _ETableCol {
- GtkObject base;
- char *text;
- short width;
- short min_width;
- short x;
- GCompareFunc compare;
- unsigned int selected:1;
- unsigned int resizeable:1;
- int col_idx;
-
- ECell *ecell;
-};
-
-typedef struct {
- GtkObjectClass parent_class;
-} ETableColClass;
-
-GtkType e_table_col_get_type (void);
-ETableCol *e_table_col_new (int col_idx, const char *text,
- int width, int min_width,
- ECell *ecell, GCompareFunc compare,
- gboolean resizable);
-void e_table_col_destroy (ETableCol *etc);
-
-
-#endif /* _E_TABLE_COL_H_ */
-
diff --git a/widgets/e-table/e-table-column-item.c b/widgets/e-table/e-table-column-item.c
deleted file mode 100644
index 0616327a93..0000000000
--- a/widgets/e-table/e-table-column-item.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * E-table-column-view.c: A canvas view of the TableColumn.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * Copyright 1999, Helix Code, Inc.
- */
-#include <config.h>
-#include "e-table-column.h"
-#include "e-table-column-view.h"
-
-#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
-
-static GnomeCanvasItemClass *etci_parent_class;
-
-enum {
- ARG_0,
- ARG_TABLE_COLUMN
-};
-
-static void
-etci_destroy (GtkObject *object)
-{
- ETableColumnItem *etcv = E_TABLE_COLUMN_VIEW (object);
-
- gtk_object_unref (GTK_OBJECT (etcv));
-
- if (GTK_OBJECT_CLASS (etcv_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (etcv_parent_class)->destroy) (object);
-}
-
-static void
-etci_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- if (GNOME_CANVAS_ITEM_CLASS(item_bar_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS(item_bar_parent_class)->update)(item, affine, clip_path, flags);
-
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = INT_MAX;
- item->y2 = INT_MAX;
- gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
-}
-
-static void
-etci_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ETableColumnItem *etci;
- int v;
-
- item = GNOME_CANVAS_ITEM (o);
- etci = E_TABLE_COLUMN_ITEM (o);
-
- switch (arg_id){
- case ARG_TABLE_COLUMN:
- etci->etci = GTK_VALUE_POINTER (*arg);
- break;
- }
- etci_update (item, NULL, NULL, 0);
-}
-
-static void
-etci_realize (GnomeCanvasItem *item)
-{
- ETableColumnItem *etci = E_TABLE_COLUMN_ITEM (item);
- GdkWindow *window;
- GdkColor c;
-
- if (GNOME_CANVAS_ITEM_CLASS (etci_parent_class)-> realize)
- (*GNOME_CANVAS_ITEM_CLASS (etci_parent_class)->realize)(item);
-
- window = GTK_WIDGET (item->canvas)->window;
-
- etci->gc = gdk_gc_new (window);
- gnome_canvas_get_color (item->canvas, "black", &c);
- gdk_gc_set_foreground (etci->gc, &c);
-
- etci->normal_cursor = gdk_cursor_new (GDK_ARROW);
-}
-
-static void
-etci_unrealize (GnomeCanvasItem *item)
-{
- ETableColumnItem *etci = E_TABLE_COLUMN_ITEM (item);
-
- gdk_gc_unref (etci->gc);
- etci->gc = NULL;
-
- gdk_cursor_destroy (etci->change_cursor);
- etci->change_cursor = NULL;
-
- gdk_cursor_destroy (etci->normal_cursor);
- etci->normal_cursor = NULL;
-
- if (GNOME_CANVAS_ITEM_CLASS (etci_parent_class)->unrealize)
- (*GNOME_CANVAS_ITEM_CLASS (etci_parent_class)->unrealize)(item);
-}
-
-static void
-etci_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x1, int y1, int width, int height)
-{
- ETableColumnItem *etci = E_TABLE_COLUMN_ITEM (item);
- GnomeCanvas *canvas = item->canvas;
- GdkGC *gc;
- const int cols = e_table_column_count (etci->etc);
- int x2 = x1 + width;
- int col, total;
-
- total = 0;
- for (col = 0; col < cols; col++){
- ETableCol *col = e_table_column_get_column (etci->etc, col);
- const int col_width = col->width;
-
- if (x1 > total + col_width)
- continue;
-
- if (x2 < total)
- return;
-
- gc = canvas->style->bg_gc [GTK_STATE_ACTIVE];
- gdk_draw_rectangle (drawble, gc, TRUE,
- gtk_draw_shadow (canvas->style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- x, y, width, height
- }
-}
-
-static double
-etci_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = *item;
- return 0.0;
-}
-
-static void
-etci_event (GnomeCanvasItem *item, GdkEvent *e)
-{
- switch (e->type){
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-etci_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- object_class->destroy = etci_destroy;
- object_class->set_arg = etci_set_arg;
-
- item_class->update = etci_update;
- item_class->realize = etci_realize;
- item_class->unrealize = etci_unrealize;
- item_class->draw = etci_draw;
- item_class->point = etci_point;
- item_class->event = etci_event;
-
- gtk_object_add_arg_type ("ETableColumnItem::ETableColumn", GTK_TYPE_POINTER,
- GTK_ARG_WRITABLE, ARG_TABLE_COLUMN);
-}
-
-static void
-etci_init (GnomeCanvasItem *item)
-{
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = 0;
- item->y2 = 0;
-}
-
-GtkType
-e_table_column_view_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableColumnItem",
- sizeof (ETableColumnItem),
- sizeof (ETableColumnItemClass),
- (GtkClassInitFunc) etci_class_init,
- (GtkObjectInitFunc) etci_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_OBJECT_TYPE, &info);
- }
-
- return type;
-}
-
-
-
diff --git a/widgets/e-table/e-table-column-item.h b/widgets/e-table/e-table-column-item.h
deleted file mode 100644
index fd38681a73..0000000000
--- a/widgets/e-table/e-table-column-item.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _E_TABLE_COLUMN_VIEW_H
-#defein _E_TABLE_COLUMN_VIEW_H
-
-#include "e-table-column.h"
-
-typedef struct {
- GnomeCanvasItem parent;
- ETableColumn *etc;
-
- GdkGC *gc;
- GdkCursor *change_cursor, *normal_cursor;
-} ETableColumnView;
-
-typedef struct {
- GnomeCanvasItemClass parent_class;
-} ETableColumnViewClass;
-
-GtkType e_table_column_item_get_type (void);
-
-#endif /* _E_TABLE_COLUMN_VIEW_H */
diff --git a/widgets/e-table/e-table-column-model.h b/widgets/e-table/e-table-column-model.h
deleted file mode 100644
index 043dd783ca..0000000000
--- a/widgets/e-table/e-table-column-model.h
+++ /dev/null
@@ -1,5 +0,0 @@
-
-class ETableColumnModel {
- virtual void add_column (ETableCol *et) = 0;
- virtual ETableCol *get_column (int column);
- virtual
diff --git a/widgets/e-table/e-table-column.c b/widgets/e-table/e-table-column.c
deleted file mode 100644
index d17a285321..0000000000
--- a/widgets/e-table/e-table-column.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * e-table-column.c: TableColumn implementation
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include "e-table-column.h"
-
-enum {
- STRUCTURE_CHANGE,
- DIMENSION_CHANGE,
- LAST_SIGNAL
-};
-
-static guint etc_signals [LAST_SIGNAL] = { 0, };
-
-static GtkObjectClass *e_table_column_parent_class;
-
-static void
-e_table_column_destroy (GtkObject *object)
-{
- ETableColumn *etc = E_TABLE_COLUMN (object);
- const int cols = etc->col_count;
-
- /*
- * Destroy listeners
- */
- for (l = etc->listeners; l; l = l->next)
- g_free (l->data);
- g_slist_free (etc->listeners);
- etc->listeners = NULL;
-
- /*
- * Destroy columns
- */
- for (i = 0; i < cols; i++)
- e_table_column_remove (etc, i);
-
- if (e_table_column_parent_class->destroy)
- e_table_column_parent_class->destroy (object);
-}
-
-static void
-e_table_column_class_init (GtkObjectClass *object_class)
-{
- object_class->destroy = e_table_column_destroy;
-
- e_table_column_parent_class = (gtk_type_class (gtk_object_get_type ()));
-
- etc_signals [STRUCTURE_CHANGE] =
- gtk_signal_new ("structure_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableColumn, structure_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- etc_signals [DIMENSION_CHANGE] =
- gtk_signal_new ("dimension_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableColumn, dimension_change),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, etc_signals, LAST_SIGNAL);
-}
-
-GtkType
-e_table_column_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableColumn",
- sizeof (ETableColumn),
- sizeof (ETableColumnClass),
- (GtkClassInitFunc) e_table_column_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-static void
-etc_do_insert (ETableColumn *etc, int pos, ETableCol *val)
-{
- memcpy (&etc->columns [pos+1], &etc->columns [pos],
- sizeof (ETableCol *) * (etc->col_count - pos));
- etc->columns [pos] = val;
-}
-
-void
-e_table_column_add_column (ETableColumn *etc, ETableCol *tc, int pos)
-{
- ETableCol **new_ptr;
-
- g_return_if_fail (etc != NULL);
- g_return_if_fail (E_IS_TABLE_COLUMN (etc));
- g_return_if_fail (tc != NULL);
- g_return_if_fail (pos >= 0 && pos < etc->col_count);
-
- if (pos == -1)
- pos = etc->col_count;
- etc->columns = g_realloc (etc->columns, sizeof (ETableCol *) * (etc->col_count + 1));
- etc_do_insert (etc, pos, tc);
- etc->col_count++;
-
- gtk_signal_emit (GTK_OBJECT (etc), etc_signals [STRUCTURE_CHANGE]);
-}
-
-ETableCol *
-e_table_column_get_column (ETableColumn *etc, int column)
-{
- g_return_val_if_fail (etc != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), NULL);
-
- if (column < 0)
- return NULL;
-
- if (column >= etc->col_count)
- return NULL;
-
- return etc->columns [column];
-}
-
-int
-e_table_column_count (ETableColumn *etc)
-{
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
-
- return etc->col_count;
-}
-
-int
-e_table_column_index (ETableColumn *etc, const char *identifier)
-{
- int i;
-
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
- g_return_val_if_fail (identifier != NULL, 0);
-
- for (i = 0; i < etc->col_count; i++){
- ETableCol *tc = etc->columns [i];
-
- if (strcmp (i->id, identifier) == 0)
- return i;
- }
-
- return -1;
-}
-
-int
-e_table_column_get_index_at (ETableColumn *etc, int x_offset)
-{
- int i, total;
-
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
- g_return_val_if_fail (identifier != NULL, 0);
-
- total = 0;
- for (i = 0; i < etc->col_count; i++){
- total += etc->columns [i]->width;
-
- if (x_offset < total)
- return i;
- }
-
- return -1;
-}
-
-ETableCol **
-e_table_column_get_columns (ETableColumn *etc)
-{
- ETableCol **ret;
- int i;
-
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
-
- ret = g_new (ETableCol *, etc->col_count + 1);
- memcpy (ret, etc->columns, sizeof (ETableCol *) * etc->col_count);
- ret [etc->col_count] = NULL;
-
- return ret;
-}
-
-gboolean
-e_table_column_selection_ok (ETableColumn *etc)
-{
- g_return_val_if_fail (etc != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), FALSE);
-
- return etc->selectable;
-}
-
-int
-ve_table_column_get_selected (ETableColumn *etc)
-{
- int i;
- int selected = 0;
-
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
-
- for (i = 0; i < etc->col_count; i++){
- if (etc->columns [i]->selected)
- selected++;
- }
-
- return selected;
-}
-
-int
-e_table_column_total_width (ETableColumn *etc)
-{
- int total;
-
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
-
- total = 0;
- for (i = 0; i < etc->col_count; i++)
- total += etc->columns [i].width;
-
- return total;
-}
-
-static void
-etc_do_remove (ETableColumn *etc, int idx)
-{
- memcpy (&etc->columns [idx], &etc->columns [idx+1],
- sizeof (ETableCol *) * etc->col_count - idx);
- etc->col_count--;
-}
-
-void
-e_table_column_move (ETableColumn *etc, int source_index, int target_index)
-{
- g_return_if_fail (etc != NULL);
- g_return_if_fail (E_IS_TABLE_COLUMN (etc));
- g_return_if_fail (source_index >= 0);
- g_return_if_fail (target_index >= 0);
- g_return_if_fail (source_index < etc->col_count);
- g_return_if_fail (target_index < etc->col_count);
-
- old = etc->columns [source_index];
- etc_do_remove (etc, source_index);
- etc_do_insert (etc, target_index, old);
- gtk_signal_emit (GTK_OBJECT (etc), etc_signals [STRUCTURE_CHANGE]);
-}
-
-void
-e_table_column_remove (ETableColumn *etc, int idx)
-{
- g_return_if_fail (etc != NULL);
- g_return_if_fail (E_IS_TABLE_COLUMN (etc));
- g_return_if_fail (idx >= 0);
- g_return_if_fail (idx < etc->col_count);
-
- etc_do_remove (etc, idx);
- gtk_signal_emit (GTK_OBJECT (etc), etc_signals [STRUCTURE_CHANGE]);
-}
-
-void
-e_table_column_set_selection (ETableColumn *etc, gboolean allow_selection);
-{
-}
-
-void
-e_table_column_set_size (ETableColumn *etc, int idx, int size)
-{
- g_return_if_fail (etc != NULL);
- g_return_if_fail (E_IS_TABLE_COLUMN (etc));
- g_return_if_fail (idx >= 0);
- g_return_if_fail (idx < etc->col_count);
- g_return_if_fail (size > 0);
-
- etc->columns [idx]->width = size;
- gtk_signal_emit (GTK_OBJECT (etc), etc_signals [SIZE_CHANGE], idx);
-}
diff --git a/widgets/e-table/e-table-group.c b/widgets/e-table/e-table-group.c
deleted file mode 100644
index 8783fbaa02..0000000000
--- a/widgets/e-table/e-table-group.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * E-Table-Group.c: Implements the grouping objects for elements on a table
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org()
- *
- * Copyright 1999, Helix Code, Inc.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-table-group.h"
-#include "e-table-item.h"
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-util/e-util.h"
-
-#define TITLE_HEIGHT 16
-#define GROUP_INDENT 10
-
-#define PARENT_TYPE gnome_canvas_group_get_type ()
-
-static GnomeCanvasGroupClass *etg_parent_class;
-
-enum {
- HEIGHT_CHANGED,
- LAST_SIGNAL
-};
-
-static gint etg_signals [LAST_SIGNAL] = { 0, };
-
-static void
-etg_destroy (GtkObject *object)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
-
- GTK_OBJECT_CLASS (etg_parent_class)->destroy (object);
-}
-
-static void
-etg_dim (ETableGroup *etg, int *width, int *height)
-{
- GSList *l;
-
- *width = *height = 0;
-
- for (l = etg->children; l; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- *height += child->y2 - child->y1;
- *width += child->x2 - child->x1;
- }
-
- if (!etg->transparent){
- *height += TITLE_HEIGHT;
- *width += GROUP_INDENT;
- }
-}
-
-void
-e_table_group_construct (GnomeCanvasGroup *parent, ETableGroup *etg,
- ETableCol *ecol, gboolean open,
- gboolean transparent)
-{
- gnome_canvas_item_constructv (GNOME_CANVAS_ITEM (etg), parent, 0, NULL);
-
- etg->ecol = ecol;
- etg->open = open;
- etg->transparent = transparent;
-
- etg_dim (etg, &etg->width, &etg->height);
-
- if (!etg->transparent)
- etg->rect = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (etg),
- gnome_canvas_rect_get_type (),
- "fill_color", "gray",
- "outline_color", "gray20",
- "x1", 0.0,
- "y1", 0.0,
- "x2", (double) etg->width,
- "y2", (double) etg->height,
- NULL);
-
-#if 0
- /*
- * Reparent the child into our space.
- */
- gnome_canvas_item_reparent (child, GNOME_CANVAS_GROUP (etg));
-
- gnome_canvas_item_set (
- child,
- "x", (double) GROUP_INDENT,
- "y", (double) TITLE_HEIGHT,
- NULL);
-
- /*
- * Force dimension computation
- */
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->update (
- GNOME_CANVAS_ITEM (etg), NULL, NULL, GNOME_CANVAS_UPDATE_REQUESTED);
-#endif
-}
-
-GnomeCanvasItem *
-e_table_group_new (GnomeCanvasGroup *parent, ETableCol *ecol,
- gboolean open, gboolean transparent)
-{
- ETableGroup *etg;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (ecol != NULL, NULL);
-
- etg = gtk_type_new (e_table_group_get_type ());
-
- e_table_group_construct (parent, etg, ecol, open, transparent);
-
- return GNOME_CANVAS_ITEM (etg);
-}
-
-static void
-etg_relayout (GnomeCanvasItem *eti, ETableGroup *etg)
-{
- GSList *l;
- int height = etg->transparent ? 0 : GROUP_INDENT;
- gboolean move = FALSE;
-
- printf ("Relaying out\n");
-
- for (l = etg->children; l->next; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- height += child->y2 - child->y1;
-
- if (child == eti)
- move = TRUE;
-
- if (move){
- printf ("Moving item %p\n", child);
- gnome_canvas_item_set (
- child,
- "y", (double) height,
- NULL);
- }
- }
- if (height != etg->height){
- etg->height = height;
- gtk_signal_emit (GTK_OBJECT (etg), etg_signals [HEIGHT_CHANGED]);
- }
-}
-
-void
-e_table_group_add (ETableGroup *etg, GnomeCanvasItem *item)
-{
- double x1, y1, x2, y2;
-
- g_return_if_fail (etg != NULL);
- g_return_if_fail (item != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- etg->children = g_slist_append (etg->children, item);
-
- GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (etg)->klass)->bounds (etg, &x1, &y1, &x2, &y2);
-
- if (GTK_OBJECT (etg)->flags & GNOME_CANVAS_ITEM_REALIZED){
- GSList *l;
- int height = etg->transparent ? 0 : TITLE_HEIGHT;
- int x = etg->transparent ? 0 : GROUP_INDENT;
-
- for (l = etg->children; l->next; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- height += child->y2 - child->y1;
- }
-
- printf ("Positioning item %p at %d\n", item, height);
- gnome_canvas_item_set (
- item,
- "y", (double) height,
- "x", (double) x,
- NULL);
-
-
- if (E_IS_TABLE_ITEM (item)){
-
- printf ("Table item! ---------\n");
- gtk_signal_connect (GTK_OBJECT (item), "height_changed",
- GTK_SIGNAL_FUNC (etg_relayout), etg);
- }
- }
-}
-
-static void
-etg_realize (GnomeCanvasItem *item)
-{
- ETableGroup *etg = E_TABLE_GROUP (item);
- GSList *l;
- int height = 0;
-
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->realize (item);
-
- for (l = etg->children; l; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- printf ("During realization for child %p -> %d\n", child, height);
- gnome_canvas_item_set (
- child,
- "y", (double) height,
- NULL);
-
- height += child->y2 - child->y1;
- }
-}
-
-static void
-etg_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableGroup *etg = E_TABLE_GROUP (item);
-
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->update (item, affine, clip_path, flags);
-
- if (!etg->transparent){
- int current_width, current_height;
-
- etg_dim (etg, &current_width, &current_height);
-
- if ((current_height != etg->height) || (current_width != etg->width)){
- etg->width = current_width;
- etg->height = current_height;
-
- gnome_canvas_item_set (
- etg->rect,
- "x1", 0.0,
- "y1", 0.0,
- "x2", (double) etg->width,
- "y2", (double) etg->height,
- NULL);
- }
- }
-}
-
-static void
-etg_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- object_class->destroy = etg_destroy;
-
- item_class->realize = etg_realize;
- item_class->update = etg_update;
-
- etg_parent_class = gtk_type_class (PARENT_TYPE);
-
- etg_signals [HEIGHT_CHANGED] =
- gtk_signal_new ("height_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableGroupClass, height_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, etg_signals, LAST_SIGNAL);
-
-}
-
-E_MAKE_TYPE (e_table_group, "ETableGroup", ETableGroup, etg_class_init, NULL, PARENT_TYPE);
-
-
-
diff --git a/widgets/e-table/e-table-group.h b/widgets/e-table/e-table-group.h
deleted file mode 100644
index 468d5dd794..0000000000
--- a/widgets/e-table/e-table-group.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef _E_TABLE_TREE_H_
-#define _E_TABLE_TREE_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include "e-table-model.h"
-#include "e-table-header.h"
-
-#define E_TABLE_GROUP_TYPE (e_table_group_get_type ())
-#define E_TABLE_GROUP(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_TYPE, ETableGroup))
-#define E_TABLE_GROUP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_GROUP_TYPE, ETableGroupClass))
-#define E_IS_TABLE_GROUP(o) (GTK_CHECK_TYPE ((o), E_TABLE_GROUP_TYPE))
-#define E_IS_TABLE_GROUP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_TYPE))
-
-typedef struct {
- GnomeCanvasGroup group;
-
- /*
- * The ETableCol used to group this set
- */
- ETableCol *ecol;
-
- /*
- * The canvas rectangle that contains the children
- */
- GnomeCanvasItem *rect;
-
- /*
- * Dimensions of the ETableGroup
- */
- int width, height;
-
- /*
- * State: the ETableGroup is open or closed
- */
- guint open:1;
-
- /*
- * Whether we should add indentation and open/close markers,
- * or if we just act as containers of subtables.
- */
- guint transparent:1;
-
- /*
- * List of GnomeCanvasItems we stack
- */
- GSList *children;
-} ETableGroup;
-
-typedef struct {
- GnomeCanvasGroupClass parent_class;
- void (*height_changed) (ETableGroup *etg);
-} ETableGroupClass;
-
-GnomeCanvasItem *e_table_group_new (GnomeCanvasGroup *parent, ETableCol *ecol,
- gboolean open, gboolean transparent);
-void e_table_group_construct (GnomeCanvasGroup *parent, ETableGroup *etg,
- ETableCol *ecol, gboolean open, gboolean transparent);
-
-void e_table_group_add (ETableGroup *etg, GnomeCanvasItem *child);
-
-GtkType e_table_group_get_type (void);
-
-#endif /* _E_TABLE_TREE_H_ */
diff --git a/widgets/e-table/e-table-header-item.c b/widgets/e-table/e-table-header-item.c
deleted file mode 100644
index 5f23f06fa3..0000000000
--- a/widgets/e-table/e-table-header-item.c
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * E-table-column-view.c: A canvas item based view of the ETableColumn.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * Copyright 1999, Helix Code, Inc.
- */
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkdnd.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <libgnomeui/gnome-canvas-util.h>
-#include <libgnomeui/gnome-canvas-polygon.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-util/e-cursors.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-col-dnd.h"
-
-#include "add-col.xpm"
-#include "remove-col.xpm"
-
-/* Padding above and below of the string in the header display */
-#define PADDING 4
-
-/* Defines the tolerance for proximity of the column division to the cursor position */
-#define TOLERANCE 2
-
-#define ETHI_RESIZING(x) ((x)->resize_col != -1)
-
-#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
-
-#define ELEMENTS(x) (sizeof (x) / sizeof (x[0]))
-
-static GnomeCanvasItemClass *ethi_parent_class;
-
-/*
- * DnD icons
- */
-static GdkColormap *dnd_colormap;
-static GdkPixmap *remove_col_pixmap, *remove_col_mask;
-static GdkPixmap *add_col_pixmap, *add_col_mask;
-
-enum {
- ARG_0,
- ARG_TABLE_HEADER,
- ARG_TABLE_X,
- ARG_TABLE_Y,
- ARG_TABLE_FONTSET
-};
-
-static GtkTargetEntry ethi_drag_types [] = {
- { TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
-};
-
-static GtkTargetEntry ethi_drop_types [] = {
- { TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
-};
-
-static void
-ethi_destroy (GtkObject *object)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (object);
-
- gtk_object_unref (GTK_OBJECT (ethi->eth));
-
- if (GTK_OBJECT_CLASS (ethi_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (ethi_parent_class)->destroy) (object);
-}
-
-static void
-ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
-
- if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)(item, affine, clip_path, flags);
-
- item->x1 = ethi->x1;
- item->y1 = ethi->y1;
- item->x2 = ethi->x1 + ethi->width;
- item->y2 = ethi->y1 + ethi->height;
-
- gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
-}
-
-static void
-ethi_font_load (ETableHeaderItem *ethi, char *font)
-{
- if (ethi->font)
- gdk_font_unref (ethi->font);
-
- ethi->font = gdk_fontset_load (font);
- if (ethi->font == NULL)
- ethi->font = gdk_font_load ("fixed");
-
- ethi->height = ethi->font->ascent + ethi->font->descent + PADDING;
-}
-
-static void
-ethi_drop_table_header (ETableHeaderItem *ethi)
-{
- GtkObject *header;
-
- if (!ethi->eth)
- return;
-
- header = GTK_OBJECT (ethi->eth);
- gtk_signal_disconnect (header, ethi->structure_change_id);
- gtk_signal_disconnect (header, ethi->dimension_change_id);
-
- gtk_object_unref (header);
- ethi->eth = NULL;
- ethi->width = 0;
-}
-
-static void
-structure_changed (ETableHeader *header, ETableHeaderItem *ethi)
-{
- ethi->width = e_table_header_total_width (header);
-
- ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
-}
-
-static void
-dimension_changed (ETableHeader *header, int col, ETableHeaderItem *ethi)
-{
- ethi->width = e_table_header_total_width (header);
-
- ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
-}
-
-static void
-ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header)
-{
- ethi->eth = header;
- gtk_object_ref (GTK_OBJECT (ethi->eth));
- ethi->width = e_table_header_total_width (header);
-
- ethi->structure_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "structure_change",
- GTK_SIGNAL_FUNC(structure_changed), ethi);
- ethi->dimension_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "dimension_change",
- GTK_SIGNAL_FUNC(dimension_changed), ethi);
-}
-
-static void
-ethi_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ETableHeaderItem *ethi;
-
- item = GNOME_CANVAS_ITEM (o);
- ethi = E_TABLE_HEADER_ITEM (o);
-
- switch (arg_id){
- case ARG_TABLE_HEADER:
- ethi_drop_table_header (ethi);
- ethi_add_table_header (ethi, GTK_VALUE_POINTER (*arg));
- break;
-
- case ARG_TABLE_X:
- ethi->x1 = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_TABLE_Y:
- ethi->y1 = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_TABLE_FONTSET:
- ethi_font_load (ethi, GTK_VALUE_STRING (*arg));
- break;
-
- }
- ethi_update (item, NULL, NULL, 0);
-}
-
-static int
-ethi_find_col_by_x (ETableHeaderItem *ethi, int x)
-{
- const int cols = e_table_header_count (ethi->eth);
- int x1 = ethi->x1;
- int col;
-
- if (x < x1)
- return -1;
-
- for (col = 0; col < cols; col++){
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
-
- if ((x >= x1) && (x <= x1 + ecol->width))
- return col;
-
- x1 += ecol->width;
- }
- return -1;
-}
-
-static void
-ethi_remove_drop_marker (ETableHeaderItem *ethi)
-{
- if (ethi->drag_mark == -1)
- return;
-
- ethi->drag_mark = -1;
- gtk_object_destroy (GTK_OBJECT (ethi->drag_mark_item));
- ethi->drag_mark_item = NULL;
-}
-
-static void
-ethi_add_drop_marker (ETableHeaderItem *ethi, int col)
-{
- GnomeCanvasPoints *points;
- int x;
-
- if (ethi->drag_mark == col)
- return;
-
- if (ethi->drag_mark_item)
- gtk_object_destroy (GTK_OBJECT (ethi->drag_mark_item));
-
- ethi->drag_mark = col;
-
- ethi->drag_mark_item = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (GNOME_CANVAS_ITEM (ethi)->canvas->root),
- gnome_canvas_group_get_type (),
- "x", 0,
- "y", 0,
- NULL);
-
- points = gnome_canvas_points_new (3);
-
- x = e_table_header_col_diff (ethi->eth, 0, col);
-
- points->coords [0] = ethi->x1 + x - 5;
- points->coords [1] = ethi->y1;
- points->coords [2] = points->coords [0] + 10;
- points->coords [3] = points->coords [1];
- points->coords [4] = ethi->x1 + x;
- points->coords [5] = ethi->y1 + 5;
-
- gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (ethi->drag_mark_item),
- gnome_canvas_polygon_get_type (),
- "points", points,
- "fill_color", "red",
- NULL);
-
- points->coords [0] --;
- points->coords [1] += ethi->height - 1;
- points->coords [3] = points->coords [1];
- points->coords [5] = points->coords [1] - 6;
-
- gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (ethi->drag_mark_item),
- gnome_canvas_polygon_get_type (),
- "points", points,
- "fill_color", "red",
- NULL);
-
- gnome_canvas_points_unref (points);
-}
-
-#define gray50_width 2
-#define gray50_height 2
-static char gray50_bits [] = {
- 0x02, 0x01, };
-
-static void
-ethi_add_destroy_marker (ETableHeaderItem *ethi)
-{
- double x1;
-
- if (ethi->remove_item)
- gtk_object_destroy (GTK_OBJECT (ethi->remove_item));
-
- if (!ethi->stipple)
- ethi->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height);
-
- x1 = ethi->x1 + (double) e_table_header_col_diff (ethi->eth, 0, ethi->drag_col);
- ethi->remove_item = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (GNOME_CANVAS_ITEM (ethi)->canvas->root),
- gnome_canvas_rect_get_type (),
- "x1", x1 + 1,
- "y1", (double) ethi->y1 + 1,
- "x2", (double) x1 + e_table_header_col_diff (ethi->eth, ethi->drag_col, ethi->drag_col+1) - 2,
- "y2", (double) ethi->y1 + ethi->height - 2,
- "fill_color", "red",
- "fill_stipple", ethi->stipple,
- NULL);
-}
-
-static void
-ethi_remove_destroy_marker (ETableHeaderItem *ethi)
-{
- if (!ethi->remove_item)
- return;
-
- gtk_object_destroy (GTK_OBJECT (ethi->remove_item));
- ethi->remove_item = NULL;
-}
-
-static gboolean
-ethi_drag_motion (GtkObject *canvas, GdkDragContext *context,
- gint x, gint y, guint time,
- ETableHeaderItem *ethi)
-{
-
- if ((x >= ethi->x1) && (x <= (ethi->x1 + ethi->width)) &&
- (y >= ethi->y1) && (y <= (ethi->y1 + ethi->height))){
- int col;
-
- col = ethi_find_col_by_x (ethi, x);
-
- if (col != -1){
- ethi_remove_destroy_marker (ethi);
- ethi_add_drop_marker (ethi, col);
- } else {
- ethi_remove_drop_marker (ethi);
- ethi_add_destroy_marker (ethi);
- }
- } else {
- ethi_remove_drop_marker (ethi);
- ethi_add_destroy_marker (ethi);
- }
-
- gdk_drag_status (context, context->suggested_action, time);
-
- return TRUE;
-}
-
-static void
-ethi_drag_end (GtkWidget *canvas, GdkDragContext *context, ETableHeaderItem *ethi)
-{
- ethi_remove_drop_marker (ethi);
- ethi_remove_destroy_marker (ethi);
- ethi->drag_col = -1;
-}
-
-static void
-ethi_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, ETableHeaderItem *ethi)
-{
- ethi_remove_drop_marker (ethi);
- ethi_add_destroy_marker (ethi);
-}
-
-static void
-ethi_realize (GnomeCanvasItem *item)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
- GdkWindow *window;
- GdkColor c;
-
- if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)-> realize)
- (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->realize)(item);
-
- window = GTK_WIDGET (item->canvas)->window;
-
- ethi->gc = gdk_gc_new (window);
- gnome_canvas_get_color (item->canvas, "black", &c);
- gdk_gc_set_foreground (ethi->gc, &c);
-
- ethi->normal_cursor = gdk_cursor_new (GDK_ARROW);
-
- if (!ethi->font)
- ethi_font_load (ethi, "fixed");
-
- /*
- * Now, configure DnD
- */
- gtk_drag_dest_set (GTK_WIDGET (item->canvas), GTK_DEST_DEFAULT_ALL,
- ethi_drop_types, ELEMENTS (ethi_drop_types),
- GDK_ACTION_MOVE);
-
- ethi->drag_motion_id = gtk_signal_connect (
- GTK_OBJECT (item->canvas), "drag_motion",
- GTK_SIGNAL_FUNC (ethi_drag_motion), ethi);
-
- ethi->drag_leave_id = gtk_signal_connect (
- GTK_OBJECT (item->canvas), "drag_leave",
- GTK_SIGNAL_FUNC (ethi_drag_leave), ethi);
-
- ethi->drag_end_id = gtk_signal_connect (
- GTK_OBJECT (item->canvas), "drag_end",
- GTK_SIGNAL_FUNC (ethi_drag_end), ethi);
-}
-
-static void
-ethi_unrealize (GnomeCanvasItem *item)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
-
- gdk_gc_unref (ethi->gc);
- ethi->gc = NULL;
-
- gdk_cursor_destroy (ethi->normal_cursor);
- ethi->normal_cursor = NULL;
-
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_motion_id);
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_end_id);
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_leave_id);
-
- if (ethi->stipple){
- gdk_bitmap_unref (ethi->stipple);
- ethi->stipple = NULL;
- }
-
- if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->unrealize)
- (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->unrealize)(item);
-}
-
-static void
-draw_button (ETableHeaderItem *ethi, ETableCol *col,
- GdkDrawable *drawable, GdkGC *gc, GtkStyle *style,
- int x, int y, int width, int height)
-{
- GdkRectangle clip;
- int xtra;
-
- gdk_draw_rectangle (
- drawable, gc, TRUE,
- x + 1, y + 1, width - 2, height -2);
-
- gtk_draw_shadow (
- style, drawable,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- x , y, width, height);
-
- clip.x = x + 2;
- clip.y = y + 2;
- clip.width = width - 4;
- clip.height = ethi->height;
-
- gdk_gc_set_clip_rectangle (ethi->gc, &clip);
-
- /* Center the thing */
- xtra = (clip.width - gdk_string_measure (ethi->font, col->text))/2;
-
- if (xtra < 0)
- xtra = 0;
-
- /* Skip over border */
- x += xtra + 2;
-
- gdk_draw_text (
- drawable, ethi->font,
- ethi->gc, x, y + ethi->height - PADDING,
- col->text, strlen (col->text));
-}
-
-static void
-ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
- GnomeCanvas *canvas = item->canvas;
- GdkGC *gc;
- const int cols = e_table_header_count (ethi->eth);
- int x1, x2;
- int col;
-
-#if 0
- printf ("My coords are: %g %g %g %g\n",
- item->x1, item->y1, item->x2, item->y2);
-#endif
- x1 = x2 = ethi->x1;
- for (col = 0; col < cols; col++, x1 = x2){
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
- int col_width;
-
- if (col == ethi->resize_col)
- col_width = ethi->resize_width;
- else
- col_width = ecol->width;
-
- x2 += col_width;
-
- if (x1 > (x + width))
- break;
-
- if (x2 < x)
- continue;
-
- gc = GTK_WIDGET (canvas)->style->bg_gc [GTK_STATE_ACTIVE];
-
- draw_button (ethi, ecol, drawable, gc,
- GTK_WIDGET (canvas)->style,
- x1 - x, ethi->y1 - y, col_width, ethi->height);
- }
-}
-
-static double
-ethi_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = item;
- return 0.0;
-}
-
-/*
- * is_pointer_on_division:
- *
- * Returns whether @pos is a column header division; If @the_total is not NULL,
- * then the actual position is returned here. If @return_ecol is not NULL,
- * then the ETableCol that actually contains this point is returned here
- */
-static gboolean
-is_pointer_on_division (ETableHeaderItem *ethi, int pos, int *the_total, int *return_col)
-{
- const int cols = e_table_header_count (ethi->eth);
- int col, total;
-
- total = 0;
- for (col = 0; col < cols; col++){
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
-
- total += ecol->width;
-
- if ((total - TOLERANCE < pos ) && (pos < total + TOLERANCE)){
- if (return_col)
- *return_col = col;
- if (the_total)
- *the_total = total;
-
- return TRUE;
- }
-
- if (total > pos + TOLERANCE)
- return FALSE;
- }
-
- return FALSE;
-}
-
-#define convert(c,sx,sy,x,y) gnome_canvas_w2c (c,sx,sy,x,y)
-
-static void
-set_cursor (ETableHeaderItem *ethi, int pos)
-{
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
-
- /* We might be invoked before we are realized */
- if (!canvas->window)
- return;
-
- if (is_pointer_on_division (ethi, pos, NULL, NULL))
- e_cursor_set (canvas->window, E_CURSOR_SIZE_X);
- else
- e_cursor_set (canvas->window, E_CURSOR_ARROW);
-}
-
-static void
-ethi_request_redraw (ETableHeaderItem *ethi)
-{
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (ethi)->canvas;
-
- /*
- * request a redraw
- */
- gnome_canvas_request_redraw (
- canvas, ethi->x1, ethi->y1, ethi->x1 + ethi->width, ethi->x1 + ethi->height);
-}
-
-static void
-ethi_end_resize (ETableHeaderItem *ethi, int new_size)
-{
- e_table_header_set_size (ethi->eth, ethi->resize_col, new_size);
-
- ethi->resize_col = -1;
- ethi_request_redraw (ethi);
-}
-
-static gboolean
-ethi_maybe_start_drag (ETableHeaderItem *ethi, GdkEventMotion *event)
-{
- if (!ethi->maybe_drag)
- return FALSE;
-
- if (MAX (abs (ethi->click_x - event->x),
- abs (ethi->click_y - event->y)) <= 3)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
-{
- GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
- GtkTargetList *list;
- GdkDragContext *context;
-
- ethi->drag_col = ethi_find_col_by_x (ethi, event->motion.x);
- if (ethi->drag_col == -1)
- return;
-
- list = gtk_target_list_new (ethi_drag_types, ELEMENTS (ethi_drag_types));
- context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event);
- ethi->maybe_drag = FALSE;
-}
-
-/*
- * Handles the events on the ETableHeaderItem, particularly it handles resizing
- */
-static int
-ethi_event (GnomeCanvasItem *item, GdkEvent *e)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
- GnomeCanvas *canvas = item->canvas;
- const gboolean resizing = ETHI_RESIZING (ethi);
- int x, y, start, col;
-
- switch (e->type){
- case GDK_ENTER_NOTIFY:
- convert (canvas, e->crossing.x, e->crossing.y, &x, &y);
- set_cursor (ethi, x);
- break;
-
- case GDK_LEAVE_NOTIFY:
- e_cursor_set (GTK_WIDGET (canvas)->window, E_CURSOR_ARROW);
- break;
-
- case GDK_MOTION_NOTIFY:
- convert (canvas, e->motion.x, e->motion.y, &x, &y);
- if (resizing){
- int new_width;
-
- if (ethi->resize_guide == NULL){
- /* Quick hack until I actually bind the views */
- ethi->resize_guide = GINT_TO_POINTER (1);
- gnome_canvas_item_grab (item,
- GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_RELEASE_MASK,
- e_cursor_get (E_CURSOR_SIZE_X),
- e->button.time);
- }
-
- new_width = x - ethi->resize_start_pos;
- if (new_width <= 0)
- break;
-
- if (new_width < ethi->resize_min_width)
- break;
-
- ethi_request_redraw (ethi);
-
- ethi->resize_width = new_width;
- e_table_header_set_size (ethi->eth, ethi->resize_col, ethi->resize_width);
-
- ethi_request_redraw (ethi);
- } else if (ethi_maybe_start_drag (ethi, &e->motion)){
- ethi_start_drag (ethi, e);
- } else
- set_cursor (ethi, x);
- break;
-
- case GDK_BUTTON_PRESS:
- convert (canvas, e->button.x, e->button.y, &x, &y);
-
- if (is_pointer_on_division (ethi, x, &start, &col)){
- ETableCol *ecol;
-
- /*
- * Record the important bits.
- *
- * By setting resize_pos to a non -1 value,
- * we know that we are being resized (used in the
- * other event handlers).
- */
- ecol = e_table_header_get_column (ethi->eth, col);
-
- if (!ecol->resizeable)
- break;
- ethi->resize_col = col;
- ethi->resize_width = ecol->width;
- ethi->resize_start_pos = start - ecol->width;
- ethi->resize_min_width = ecol->min_width;
- } else {
- if (e->button.button == 1){
- ethi->click_x = e->button.x;
- ethi->click_y = e->button.y;
- ethi->maybe_drag = TRUE;
- }
- }
- break;
-
- case GDK_2BUTTON_PRESS:
- if (!resizing)
- break;
-
- if (e->button.button != 1)
- break;
- break;
-
- case GDK_BUTTON_RELEASE: {
- gboolean needs_ungrab = FALSE;
-
- if (ethi->resize_col != -1){
- needs_ungrab = (ethi->resize_guide != NULL);
- ethi_end_resize (ethi, ethi->resize_width);
- }
- if (needs_ungrab)
- gnome_canvas_item_ungrab (item, e->button.time);
-
- ethi->maybe_drag = FALSE;
- break;
- }
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-ethi_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- ethi_parent_class = gtk_type_class (PARENT_OBJECT_TYPE);
-
- object_class->destroy = ethi_destroy;
- object_class->set_arg = ethi_set_arg;
-
- item_class->update = ethi_update;
- item_class->realize = ethi_realize;
- item_class->unrealize = ethi_unrealize;
- item_class->draw = ethi_draw;
- item_class->point = ethi_point;
- item_class->event = ethi_event;
-
- gtk_object_add_arg_type ("ETableHeaderItem::ETableHeader", GTK_TYPE_POINTER,
- GTK_ARG_WRITABLE, ARG_TABLE_HEADER);
- gtk_object_add_arg_type ("ETableHeaderItem::x", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_TABLE_X);
- gtk_object_add_arg_type ("ETableHeaderItem::y", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_TABLE_Y);
- gtk_object_add_arg_type ("ETableHeaderItem::fontset", GTK_TYPE_STRING,
- GTK_ARG_WRITABLE, ARG_TABLE_FONTSET);
-
- /*
- * Create our pixmaps for DnD
- */
- dnd_colormap = gtk_widget_get_default_colormap ();
- remove_col_pixmap = gdk_pixmap_colormap_create_from_xpm_d (
- NULL, dnd_colormap,
- &remove_col_mask, NULL, remove_col_xpm);
-
- add_col_pixmap = gdk_pixmap_colormap_create_from_xpm_d (
- NULL, dnd_colormap,
- &add_col_mask, NULL, add_col_xpm);
-}
-
-static void
-ethi_init (GnomeCanvasItem *item)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
-
- ethi->resize_col = -1;
-
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = 0;
- item->y2 = 0;
-
- ethi->drag_col = -1;
- ethi->drag_mark = -1;
-}
-
-GtkType
-e_table_header_item_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableHeaderItem",
- sizeof (ETableHeaderItem),
- sizeof (ETableHeaderItemClass),
- (GtkClassInitFunc) ethi_class_init,
- (GtkObjectInitFunc) ethi_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_OBJECT_TYPE, &info);
- }
-
- return type;
-}
-
diff --git a/widgets/e-table/e-table-header-item.h b/widgets/e-table/e-table-header-item.h
deleted file mode 100644
index 5522d24fae..0000000000
--- a/widgets/e-table/e-table-header-item.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef _E_TABLE_HEADER_ITEM_H_
-#define _E_TABLE_HEADER_ITEM_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include "e-table-header.h"
-
-#define E_TABLE_HEADER_ITEM_TYPE (e_table_header_item_get_type ())
-#define E_TABLE_HEADER_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItem))
-#define E_TABLE_HEADER_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItemClass))
-#define E_IS_TABLE_HEADER_ITEM(o) (GTK_CHECK_TYPE ((o), E_TABLE_HEADER_ITEM_TYPE))
-#define E_IS_TABLE_HEADER_ITEM_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_ITEM_TYPE))
-
-typedef struct {
- GnomeCanvasItem parent;
- ETableHeader *eth;
-
- GdkGC *gc;
- GdkCursor *change_cursor, *normal_cursor;
-
- short x1, y1, height, width;
- GdkFont *font;
-
- /*
- * Used during resizing; Could be shorts
- */
- int resize_col;
- int resize_width;
- int resize_start_pos;
- int resize_min_width;
-
- GtkObject *resize_guide;
-
- /*
- * Ids
- */
- int structure_change_id, dimension_change_id;
-
- /*
- * For dragging columns
- */
- guint maybe_drag:1;
- guint dnd_ready:1;
- int click_x, click_y;
- int drag_col, drag_mark;
- guint drag_motion_id, drag_end_id, drag_leave_id;
- GnomeCanvasItem *drag_mark_item, *remove_item;
- GdkBitmap *stipple;
-} ETableHeaderItem;
-
-typedef struct {
- GnomeCanvasItemClass parent_class;
-} ETableHeaderItemClass;
-
-GtkType e_table_header_item_get_type (void);
-
-#endif /* _E_TABLE_HEADER_ITEM_H_ */
diff --git a/widgets/e-table/e-table-header.c b/widgets/e-table/e-table-header.c
deleted file mode 100644
index 7c54bd936e..0000000000
--- a/widgets/e-table/e-table-header.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * E-table-col-head.c: TableColHead implementation
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
-#include "e-table-header.h"
-
-enum {
- STRUCTURE_CHANGE,
- DIMENSION_CHANGE,
- LAST_SIGNAL
-};
-
-static guint eth_signals [LAST_SIGNAL] = { 0, };
-
-static GtkObjectClass *e_table_header_parent_class;
-
-static void
-e_table_header_destroy (GtkObject *object)
-{
- ETableHeader *eth = E_TABLE_HEADER (object);
- const int cols = eth->col_count;
- int i;
-
- /*
- * Destroy columns
- */
- for (i = 0; i < cols; i++){
- e_table_header_remove (eth, i);
- }
-
- if (e_table_header_parent_class->destroy)
- e_table_header_parent_class->destroy (object);
-}
-
-static void
-e_table_header_class_init (GtkObjectClass *object_class)
-{
- object_class->destroy = e_table_header_destroy;
-
- e_table_header_parent_class = (gtk_type_class (gtk_object_get_type ()));
-
- eth_signals [STRUCTURE_CHANGE] =
- gtk_signal_new ("structure_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableHeaderClass, structure_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- eth_signals [DIMENSION_CHANGE] =
- gtk_signal_new ("dimension_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableHeaderClass, dimension_change),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, eth_signals, LAST_SIGNAL);
-}
-
-GtkType
-e_table_header_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableHeader",
- sizeof (ETableHeader),
- sizeof (ETableHeaderClass),
- (GtkClassInitFunc) e_table_header_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-ETableHeader *
-e_table_header_new (void)
-{
- ETableHeader *eth;
-
- eth = gtk_type_new (e_table_header_get_type ());
-
- return eth;
-}
-
-static void
-eth_do_insert (ETableHeader *eth, int pos, ETableCol *val)
-{
- memcpy (&eth->columns [pos+1], &eth->columns [pos],
- sizeof (ETableCol *) * (eth->col_count - pos));
- eth->columns [pos] = val;
-}
-
-static void
-eth_update_offsets (ETableHeader *eth)
-{
- int i;
- int x = 0;
-
- for (i = 0; i < eth->col_count; i++){
- ETableCol *etc = eth->columns [i];
-
- etc->x = x;
- x += etc->width;
- }
-}
-
-void
-e_table_header_add_column (ETableHeader *eth, ETableCol *tc, int pos)
-{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
- g_return_if_fail (tc != NULL);
- g_return_if_fail (E_IS_TABLE_COL (tc));
- g_return_if_fail (pos >= -1 && pos <= eth->col_count);
-
- if (pos == -1)
- pos = eth->col_count;
- eth->columns = g_realloc (eth->columns, sizeof (ETableCol *) * (eth->col_count + 1));
-
- /*
- * We are the primary owners of the column
- */
- gtk_object_ref (GTK_OBJECT (tc));
- gtk_object_sink (GTK_OBJECT (tc));
-
- eth_do_insert (eth, pos, tc);
- eth->col_count++;
- eth_update_offsets (eth);
-
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
-}
-
-ETableCol *
-e_table_header_get_column (ETableHeader *eth, int column)
-{
- g_return_val_if_fail (eth != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), NULL);
-
- if (column < 0)
- return NULL;
-
- if (column >= eth->col_count)
- return NULL;
-
- return eth->columns [column];
-}
-
-int
-e_table_header_count (ETableHeader *eth)
-{
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- return eth->col_count;
-}
-
-int
-e_table_header_index (ETableHeader *eth, int col)
-{
- g_return_val_if_fail (eth != NULL, -1);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), -1);
- g_return_val_if_fail (col < eth->col_count, -1);
-
- return eth->columns [col]->col_idx;
-}
-
-int
-e_table_header_get_index_at (ETableHeader *eth, int x_offset)
-{
- int i, total;
-
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- total = 0;
- for (i = 0; i < eth->col_count; i++){
- total += eth->columns [i]->width;
-
- if (x_offset < total)
- return i;
- }
-
- return -1;
-}
-
-ETableCol **
-e_table_header_get_columns (ETableHeader *eth)
-{
- ETableCol **ret;
-
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- ret = g_new (ETableCol *, eth->col_count + 1);
- memcpy (ret, eth->columns, sizeof (ETableCol *) * eth->col_count);
- ret [eth->col_count] = NULL;
-
- return ret;
-}
-
-gboolean
-e_table_header_selection_ok (ETableHeader *eth)
-{
- g_return_val_if_fail (eth != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), FALSE);
-
- return eth->selectable;
-}
-
-int
-e_table_header_get_selected (ETableHeader *eth)
-{
- int i;
- int selected = 0;
-
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- for (i = 0; i < eth->col_count; i++){
- if (eth->columns [i]->selected)
- selected++;
- }
-
- return selected;
-}
-
-int
-e_table_header_total_width (ETableHeader *eth)
-{
- int total, i;
-
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- total = 0;
- for (i = 0; i < eth->col_count; i++)
- total += eth->columns [i]->width;
-
- return total;
-}
-
-static void
-eth_do_remove (ETableHeader *eth, int idx, gboolean do_unref)
-{
- if (do_unref)
- gtk_object_unref (GTK_OBJECT (eth->columns [idx]));
-
- memcpy (&eth->columns [idx], &eth->columns [idx+1],
- sizeof (ETableCol *) * eth->col_count - idx);
- eth->col_count--;
-}
-
-void
-e_table_header_move (ETableHeader *eth, int source_index, int target_index)
-{
- ETableCol *old;
-
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
- g_return_if_fail (source_index >= 0);
- g_return_if_fail (target_index >= 0);
- g_return_if_fail (source_index < eth->col_count);
- g_return_if_fail (target_index < eth->col_count);
-
- old = eth->columns [source_index];
- eth_do_remove (eth, source_index, FALSE);
- eth_do_insert (eth, target_index, old);
- eth_update_offsets (eth);
-
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
-}
-
-void
-e_table_header_remove (ETableHeader *eth, int idx)
-{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
- g_return_if_fail (idx >= 0);
- g_return_if_fail (idx < eth->col_count);
-
- eth_do_remove (eth, idx, TRUE);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
-}
-
-void
-e_table_header_set_selection (ETableHeader *eth, gboolean allow_selection)
-{
-}
-
-void
-e_table_header_set_size (ETableHeader *eth, int idx, int size)
-{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
- g_return_if_fail (idx >= 0);
- g_return_if_fail (idx < eth->col_count);
- g_return_if_fail (size > 0);
-
- eth->columns [idx]->width = size;
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE], idx);
-}
-
-int
-e_table_header_col_diff (ETableHeader *eth, int start_col, int end_col)
-{
- int total, col;
-
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- {
- const int max_col = eth->col_count;
-
- total = 0;
- for (col = start_col; col < end_col; col++){
-
- if (col == max_col)
- break;
- total += eth->columns [col]->width;
- }
- }
-
- return total;
-}
diff --git a/widgets/e-table/e-table-header.h b/widgets/e-table/e-table-header.h
deleted file mode 100644
index 96e65fdc2f..0000000000
--- a/widgets/e-table/e-table-header.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef _E_TABLE_COLUMN_H_
-#define _E_TABLE_COLUMN_H_
-
-#include <gtk/gtkobject.h>
-#include <gdk/gdk.h>
-#include "e-table-col.h"
-
-typedef struct _ETableHeader ETableHeader;
-
-#define E_TABLE_HEADER_TYPE (e_table_header_get_type ())
-#define E_TABLE_HEADER(o) (GTK_CHECK_CAST ((o), E_TABLE_HEADER_TYPE, ETableHeader))
-#define E_TABLE_HEADER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_HEADER_TYPE, ETableHeaderClass))
-#define E_IS_TABLE_HEADER(o) (GTK_CHECK_TYPE ((o), E_TABLE_HEADER_TYPE))
-#define E_IS_TABLE_HEADER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_TYPE))
-
-/*
- * A Columnar header.
- */
-struct _ETableHeader {
- GtkObject base;
-
- int col_count;
- ETableCol **columns;
- gboolean selectable;
-};
-
-typedef struct {
- GtkObjectClass parent_class;
-
- void (*structure_change) (ETableHeader *eth);
- void (*dimension_change) (ETableHeader *eth, int col);
-} ETableHeaderClass;
-
-GtkType e_table_header_get_type (void);
-ETableHeader *e_table_header_new (void);
-
-void e_table_header_add_column (ETableHeader *eth,
- ETableCol *tc, int pos);
-ETableCol * e_table_header_get_column (ETableHeader *eth,
- int column);
-int e_table_header_count (ETableHeader *eth);
-int e_table_header_index (ETableHeader *eth,
- int col);
-int e_table_header_get_index_at (ETableHeader *eth,
- int x_offset);
-ETableCol **e_table_header_get_columns (ETableHeader *eth);
-gboolean e_table_header_selection_ok (ETableHeader *eth);
-int e_table_header_get_selected (ETableHeader *eth);
-int e_table_header_total_width (ETableHeader *eth);
-void e_table_header_move (ETableHeader *eth,
- int source_index,
- int target_index);
-void e_table_header_remove (ETableHeader *eth, int idx);
-void e_table_header_set_size (ETableHeader *eth, int idx, int size);
-void e_table_header_set_selection (ETableHeader *eth,
- gboolean allow_selection);
-
-int e_table_header_col_diff (ETableHeader *eth,
- int start_col, int end_col);
-
-GList *e_table_header_get_selected_indexes(ETableHeader *eth);
-
-
-#endif /* _E_TABLE_HEADER_H_ */
-
diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c
deleted file mode 100644
index 33f0c18616..0000000000
--- a/widgets/e-table/e-table-item.c
+++ /dev/null
@@ -1,1316 +0,0 @@
-/*
- * E-table-item.c: A GnomeCanvasItem that is a view of an ETableModel.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * TODO:
- * Add a border to the thing, so that focusing works properly.
- *
- */
-#include <config.h>
-#include <stdio.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <math.h>
-#include "e-table-item.h"
-#include "e-cell.h"
-
-#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
-
-#define FOCUSED_BORDER 2
-
-static GnomeCanvasItemClass *eti_parent_class;
-
-enum {
- ROW_SELECTION,
- HEIGHT_CHANGED,
- LAST_SIGNAL
-};
-
-static gint eti_signals [LAST_SIGNAL] = { 0, };
-
-enum {
- ARG_0,
- ARG_TABLE_HEADER,
- ARG_TABLE_MODEL,
- ARG_TABLE_X,
- ARG_TABLE_Y,
- ARG_TABLE_DRAW_GRID,
- ARG_TABLE_DRAW_FOCUS,
- ARG_MODE_SPREADSHEET,
- ARG_LENGHT_THRESHOLD
-};
-
-static gboolean
-eti_editing (ETableItem *eti)
-{
- if (eti->editing_col == -1)
- return FALSE;
- else
- return TRUE;
-}
-
-/*
- * During realization, we have to invoke the per-ecell realize routine
- * (On our current setup, we have one e-cell per column.
- *
- * We might want to optimize this to only realize the unique e-cells:
- * ie, a strings-only table, uses the same e-cell for every column, and
- * we might want to avoid realizing each e-cell.
- */
-static void
-eti_realize_cell_views (ETableItem *eti)
-{
- int i;
-
- for (i = 0; i < eti->n_cells; i++)
- e_cell_view_realize (eti->cell_views [i], eti);
- eti->cell_views_realized = 1;
-}
-
-static void eti_compute_height (ETableItem *eti);
-
-static void
-eti_attach_cell_views (ETableItem *eti)
-{
- int i;
-
- g_assert (eti->header);
- g_assert (eti->table_model);
-
- /*
- * Now realize the various ECells
- */
- eti->n_cells = eti->cols;
- eti->cell_views = g_new (ECellView *, eti->n_cells);
-
- for (i = 0; i < eti->n_cells; i++){
- ETableCol *col = e_table_header_get_column (eti->header, i);
-
- eti->cell_views [i] = e_cell_new_view (col->ecell, eti->table_model, eti);
- }
-
- eti_compute_height (eti);
-}
-
-/*
- * During unrealization: we invoke every e-cell (one per column in the current
- * setup) to dispose all X resources allocated
- */
-static void
-eti_unrealize_cell_views (ETableItem *eti)
-{
- int i;
-
- if (eti->cell_views_realized == 0)
- return;
-
- for (i = 0; i < eti->n_cells; i++)
- e_cell_unrealize (eti->cell_views [i]);
- eti->cell_views_realized = 0;
-}
-
-static void
-eti_detach_cell_views (ETableItem *eti)
-{
- int i;
-
- for (i = 0; i < eti->n_cells; i++){
- e_cell_kill_view (eti->cell_views [i]);
- eti->cell_views [i] = NULL;
- }
-
- g_free (eti->cell_views);
- eti->cell_views = NULL;
- eti->n_cells = 0;
-}
-
-static void
-eti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
-{
- double i2c [6];
- ArtPoint c1, c2, i1, i2;
- ETableItem *eti = E_TABLE_ITEM (item);
-
- gnome_canvas_item_i2c_affine (item, i2c);
- i1.x = eti->x1;
- i1.y = eti->y1;
- i2.x = eti->x1 + eti->width;
- i2.y = eti->y1 + eti->height;
- art_affine_point (&c1, &i1, i2c);
- art_affine_point (&c2, &i2, i2c);
-
- item->x1 = c1.x;
- item->y1 = c1.y;
- item->x2 = c2.x;
- item->y2 = c2.y;
-}
-
-
-/*
- * GnomeCanvasItem::update method
- */
-static void
-eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags);
-
- eti_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2);
- gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
-}
-
-/*
- * eti_remove_table_model:
- *
- * Invoked to release the table model associated with this ETableItem
- */
-static void
-eti_remove_table_model (ETableItem *eti)
-{
- if (!eti->table_model)
- return;
-
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
- eti->table_model_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
- eti->table_model_row_change_id);
- gtk_object_unref (GTK_OBJECT (eti->table_model));
-
- eti->table_model_change_id = 0;
- eti->table_model_row_change_id = 0;
- eti->table_model = NULL;
-}
-
-/*
- * eti_remove_header_model:
- *
- * Invoked to release the header model associated with this ETableItem
- */
-static void
-eti_remove_header_model (ETableItem *eti)
-{
- if (!eti->header)
- return;
-
- gtk_signal_disconnect (GTK_OBJECT (eti->header),
- eti->header_structure_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->header),
- eti->header_dim_change_id);
-
- if (eti->cell_views){
- eti_unrealize_cell_views (eti);
- eti_detach_cell_views (eti);
- }
- gtk_object_unref (GTK_OBJECT (eti->header));
-
-
- eti->header_structure_change_id = 0;
- eti->header_dim_change_id = 0;
- eti->header = NULL;
-}
-
-/*
- * eti_row_height:
- *
- * Returns the height used by row @row. This does not include the one-pixel
- * used as a separator between rows
- */
-static int
-eti_row_height (ETableItem *eti, int row)
-{
- const int cols = e_table_header_count (eti->header);
- int col;
- int h, max_h;
-
- g_assert (eti->cell_views);
-
- max_h = 0;
-
- for (col = 0; col < cols; col++){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
-
- h = e_cell_height (eti->cell_views [col], ecol->col_idx, col, row);
-
- if (h > max_h)
- max_h = h;
- }
- return max_h;
-}
-
-/*
- * eti_get_height:
- *
- * Returns the height of the ETableItem.
- *
- * The ETableItem might compute the whole height by asking every row its
- * size. There is a special mode (designed to work when there are too
- * many rows in the table that performing the previous step could take
- * too long) set by the ETableItem->length_threshold that would determine
- * when the height is computed by using the first row as the size for
- * every other row in the ETableItem.
- */
-static int
-eti_get_height (ETableItem *eti)
-{
- const int rows = eti->rows;
- int row;
- int height;
-
- if (rows == 0)
- return 0;
-
- if (eti->length_threshold != -1){
- if (rows > eti->length_threshold){
- height = (eti_row_height (eti, 0) + 1) * rows;
-
- /*
- * 1 pixel at the top
- */
- return height + 1;
- }
- }
-
- height = 1;
- for (row = 0; row < rows; row++)
- height += eti_row_height (eti, row) + 1;
-
- return height;
-}
-
-static void
-eti_compute_height (ETableItem *eti)
-{
- int new_height = eti_get_height (eti);
-
- if (new_height != eti->height){
- double x1, y1, x2, y2;
- printf ("Emitting!\n");
-
- eti->height = new_height;
- eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0);
-
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [HEIGHT_CHANGED]);
- }
-}
-
-/*
- * Callback routine: invoked when the ETableModel has suffered a change
- */
-static void
-eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
-{
- eti->rows = e_table_model_row_count (eti->table_model);
-
- if (eti->cell_views)
- eti_compute_height (eti);
-
- eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0);
-}
-
-static void
-eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1)
-{
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
- ArtDRect rect;
- double i2c [6];
-
- rect.x0 = x0;
- rect.y0 = y0;
- rect.x1 = x1;
- rect.y1 = y1;
-
- gnome_canvas_item_i2c_affine (item, i2c);
- art_drect_affine_transform (&rect, &rect, i2c);
-
- gnome_canvas_request_redraw (item->canvas, rect.x0, rect.y0, rect.x1, rect.y1);
-}
-
-/*
- * eti_request_redraw:
- *
- * Queues a canvas redraw for the entire ETableItem.
- */
-static void
-eti_request_redraw (ETableItem *eti)
-{
- eti_item_region_redraw (eti, eti->x1, eti->y1, eti->x1 + eti->width + 1, eti->y1 + eti->height + 1);
-}
-
-/*
- * Computes the distance between @start_row and @end_row in pixels
- */
-static int
-eti_row_diff (ETableItem *eti, int start_row, int end_row)
-{
- int row, total;
-
- total = 0;
-
- for (row = start_row; row < end_row; row++)
- total += eti_row_height (eti, row) + 1;
-
- return total;
-}
-
-/*
- * eti_request_region_redraw:
- *
- * Request a canvas redraw on the range (start_col, start_row) to (end_col, end_row).
- * This is inclusive (ie, you can use: 0,0-0,0 to redraw the first cell).
- *
- * The @border argument is a number of pixels around the region that should also be queued
- * for redraw. This is typically used by the focus routines to queue a redraw for the
- * border as well.
- */
-static void
-eti_request_region_redraw (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row, int border)
-{
- int x1, y1, width, height;
-
- x1 = e_table_header_col_diff (eti->header, 0, start_col);
- y1 = eti_row_diff (eti, 0, start_row);
- width = e_table_header_col_diff (eti->header, start_col, end_col + 1);
- height = eti_row_diff (eti, start_row, end_row + 1);
-
- eti_item_region_redraw (eti, eti->x1 + x1 - border,
- eti->y1 + y1 - border,
- eti->x1 + x1 + width + 1 + border,
- eti->y1 + y1 + height + 1 + border);
-}
-
-static void
-eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti)
-{
- if (eti->renderers_can_change_size){
- eti_table_model_changed (table_model, eti);
- return;
- }
-
- eti_request_region_redraw (eti, 0, row, eti->cols, row, 0);
-}
-
-void
-e_table_item_redraw_range (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row)
-{
- int border;
-
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if ((start_col == eti->focused_col) ||
- (end_col == eti->focused_col) ||
- (start_row == eti->focused_row) ||
- (end_row == eti->focused_row))
- border = 2;
- else
- border = 0;
-
- eti_request_region_redraw (eti, start_col, start_row, end_col, end_row, border);
-}
-
-static void
-eti_add_table_model (ETableItem *eti, ETableModel *table_model)
-{
- g_assert (eti->table_model == NULL);
-
- eti->table_model = table_model;
- gtk_object_ref (GTK_OBJECT (eti->table_model));
-
- eti->table_model_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_changed",
- GTK_SIGNAL_FUNC (eti_table_model_changed), eti);
-
- eti->table_model_row_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_row_changed",
- GTK_SIGNAL_FUNC (eti_table_model_row_changed), eti);
-
- if (eti->header){
- eti_detach_cell_views (eti);
- eti_attach_cell_views (eti);
- }
-
- eti_table_model_changed (table_model, eti);
-}
-
-static void
-eti_header_dim_changed (ETableHeader *eth, int col, ETableItem *eti)
-{
- eti_request_redraw (eti);
-
- eti->width = e_table_header_total_width (eti->header);
- eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0);
-
- eti_request_redraw (eti);
-}
-
-static void
-eti_header_structure_changed (ETableHeader *eth, ETableItem *eti)
-{
- eti_request_redraw (eti);
-
- eti->cols = e_table_header_count (eti->header);
- eti->width = e_table_header_total_width (eti->header);
-
- if (eti->cell_views){
- eti_unrealize_cell_views (eti);
- eti_detach_cell_views (eti);
- eti_attach_cell_views (eti);
- eti_realize_cell_views (eti);
- } else {
- if (eti->table_model){
- eti_detach_cell_views (eti);
- eti_attach_cell_views (eti);
- }
- }
-
- eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0);
-
- eti_request_redraw (eti);
-}
-
-static void
-eti_add_header_model (ETableItem *eti, ETableHeader *header)
-{
- g_assert (eti->header == NULL);
-
- eti->header = header;
- gtk_object_ref (GTK_OBJECT (header));
-
- eti_header_structure_changed (header, eti);
-
- eti->header_dim_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "dimension_change",
- GTK_SIGNAL_FUNC (eti_header_dim_changed), eti);
-
- eti->header_structure_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "structure_change",
- GTK_SIGNAL_FUNC (eti_header_structure_changed), eti);
-}
-
-/*
- * GtkObject::destroy method
- */
-static void
-eti_destroy (GtkObject *object)
-{
- ETableItem *eti = E_TABLE_ITEM (object);
-
- eti_remove_header_model (eti);
- eti_remove_table_model (eti);
-
- g_slist_free (eti->selection);
-
- if (GTK_OBJECT_CLASS (eti_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (eti_parent_class)->destroy) (object);
-}
-
-static void
-eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ETableItem *eti;
-
- item = GNOME_CANVAS_ITEM (o);
- eti = E_TABLE_ITEM (o);
-
- switch (arg_id){
- case ARG_TABLE_HEADER:
- eti_remove_header_model (eti);
- eti_add_header_model (eti, GTK_VALUE_POINTER (*arg));
- break;
-
- case ARG_TABLE_MODEL:
- eti_remove_table_model (eti);
- eti_add_table_model (eti, GTK_VALUE_POINTER (*arg));
- break;
-
- case ARG_TABLE_X:
- eti->x1 = GTK_VALUE_DOUBLE (*arg);
- break;
-
- case ARG_TABLE_Y:
- eti->y1 = GTK_VALUE_DOUBLE (*arg);
- break;
-
- case ARG_LENGHT_THRESHOLD:
- eti->length_threshold = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_TABLE_DRAW_GRID:
- eti->draw_grid = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_TABLE_DRAW_FOCUS:
- eti->draw_focus = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_MODE_SPREADSHEET:
- eti->mode_spreadsheet = GTK_VALUE_BOOL (*arg);
- break;
- }
- eti_update (item, NULL, NULL, 0);
-}
-
-static void
-eti_init (GnomeCanvasItem *item)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
-
- eti->focused_col = -1;
- eti->focused_row = -1;
- eti->editing_col = -1;
- eti->editing_row = -1;
- eti->height = 0;
-
- eti->length_threshold = -1;
- eti->renderers_can_change_size = 0;
-
- eti->selection_mode = GTK_SELECTION_SINGLE;
-}
-
-#define gray50_width 2
-#define gray50_height 2
-static const char gray50_bits[] = {
- 0x02, 0x01, };
-
-static void
-eti_realize (GnomeCanvasItem *item)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
- GtkWidget *canvas_widget = GTK_WIDGET (item->canvas);
- GdkWindow *window;
-
- if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)
- (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)(item);
-
- /*
- * Gdk Resource allocation
- */
- window = canvas_widget->window;
-
- eti->fill_gc = canvas_widget->style->white_gc;
- gdk_gc_ref (canvas_widget->style->white_gc);
-
- eti->grid_gc = gdk_gc_new (window);
-#if 0
- /* This sets it to gray */
-/* gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); */
-#else
- gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->black);
-#endif
- eti->focus_gc = gdk_gc_new (window);
- gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]);
- gdk_gc_set_background (eti->focus_gc, &canvas_widget->style->fg [GTK_STATE_NORMAL]);
- eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height);
- gdk_gc_set_ts_origin (eti->focus_gc, 0, 0);
- gdk_gc_set_stipple (eti->focus_gc, eti->stipple);
- gdk_gc_set_fill (eti->focus_gc, GDK_OPAQUE_STIPPLED);
-
- if (eti->cell_views == NULL)
- eti_attach_cell_views (eti);
-
- eti_realize_cell_views (eti);
-
- eti_compute_height (eti);
-
- eti_update (item, NULL, NULL, 0);
-}
-
-static void
-eti_unrealize (GnomeCanvasItem *item)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
-
- gdk_gc_unref (eti->fill_gc);
- eti->fill_gc = NULL;
- gdk_gc_unref (eti->grid_gc);
- eti->grid_gc = NULL;
- gdk_gc_unref (eti->focus_gc);
- eti->focus_gc = NULL;
- gdk_bitmap_unref (eti->stipple);
- eti->stipple = NULL;
-
- eti_unrealize_cell_views (eti);
-
- eti->height = 0;
-
- if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->unrealize)
- (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->unrealize)(item);
-}
-
-static void
-eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
- const int rows = eti->rows;
- const int cols = eti->cols;
- int row, col, y1, y2;
- int first_col, last_col, x_offset;
- int first_row, last_row, y_offset, yd;
- int x1, x2;
- int f_x1, f_x2, f_y1, f_y2;
- gboolean f_found;
- double i2c [6];
- ArtPoint eti_base, eti_base_item;
-
- /*
- * Clear the background
- */
-#if 0
- gdk_draw_rectangle (
- drawable, eti->fill_gc, TRUE,
- eti->x1 - x, eti->y1 - y, eti->width, eti->height);
-#endif
-
- /*
- * Find out our real position after grouping
- */
- gnome_canvas_item_i2c_affine (item, i2c);
- eti_base_item.x = eti->x1;
- eti_base_item.y = eti->y1;
- art_affine_point (&eti_base, &eti_base_item, i2c);
-
- /*
- * First column to draw, last column to draw
- */
- first_col = -1;
- last_col = x_offset = 0;
- x1 = x2 = floor (eti_base.x);
- for (col = 0; col < cols; col++, x1 = x2){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
-
- x2 = x1 + ecol->width;
-
- if (x1 > (x + width))
- break;
- if (x2 < x)
- continue;
- if (first_col == -1){
- x_offset = x1 - x;
- first_col = col;
- }
- }
- last_col = col;
-
- /*
- * Nothing to paint
- */
- if (first_col == -1)
- return;
-
- /*
- * Compute row span.
- */
- first_row = -1;
- y_offset = 0;
- y1 = y2 = floor (eti_base.y) + 1;
- for (row = 0; row < rows; row++, y1 = y2){
-
- y2 += eti_row_height (eti, row) + 1;
-
- if (y1 > y + height)
- break;
-
- if (y2 < y)
- continue;
-
- if (first_row == -1){
- y_offset = y1 - y;
- first_row = row;
- }
- }
- last_row = row;
-
- if (first_row == -1)
- return;
-
- /*
- * Draw cells
- */
- yd = y_offset;
- f_x1 = f_x2 = f_y1 = f_y2 = -1;
- f_found = FALSE;
-
- if (eti->draw_grid && first_row == 0){
- gdk_draw_line (
- drawable, eti->grid_gc,
- eti_base.x - x, yd, eti_base.x + eti->width - x, yd);
- }
- yd++;
-
- for (row = first_row; row < last_row; row++){
- int xd, height;
- gboolean selected;
-
- height = eti_row_height (eti, row);
-
- xd = x_offset;
-/* printf ("paint: %d %d\n", yd, yd + height); */
-
- selected = g_slist_find (eti->selection, GINT_TO_POINTER (row)) != NULL;
-
- for (col = first_col; col < last_col; col++){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
- ECellView *ecell_view = eti->cell_views [col];
-
- e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, selected,
- xd, yd, xd + ecol->width, yd + height);
-
- if (col == eti->focused_col && row == eti->focused_row){
- f_x1 = xd;
- f_x2 = xd + ecol->width;
- f_y1 = yd;
- f_y2 = yd + height;
- f_found = TRUE;
- }
-
- xd += ecol->width;
- }
- yd += height;
-
- if (eti->draw_grid)
- gdk_draw_line (
- drawable, eti->grid_gc,
- eti_base.x - x, yd, eti_base.x + eti->width - x, yd);
- yd++;
- }
-
- if (eti->draw_grid){
- int xd = x_offset;
-
- for (col = first_col; col <= last_col; col++){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
-
- gdk_draw_line (
- drawable, eti->grid_gc,
- xd, y_offset, xd, yd - 1);
-
- /*
- * This looks wierd, but it is to draw the last line
- */
- if (ecol)
- xd += ecol->width;
- }
- }
-
- /*
- * Draw focus
- */
- if (f_found && eti->draw_focus){
-
- if (!eti_editing (eti))
- gdk_draw_rectangle (
- drawable, eti->focus_gc, FALSE,
- f_x1 + 1, f_y1, f_x2 - f_x1 - 2, f_y2 - f_y1 - 1);
- }
-}
-
-static double
-eti_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = item;
-
- return 0.0;
-}
-
-static gboolean
-find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, double *x1_res, double *y1_res)
-{
- const int cols = eti->cols;
- const int rows = eti->rows;
- gdouble x1, y1, x2, y2;
- int col, row;
-
- /* FIXME: this routine is inneficient, fix later */
-
- x -= eti->x1;
- y -= eti->y1;
-
- x1 = 0;
- for (col = 0; col < cols; col++, x1 = x2){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
-
- if (x < x1)
- return FALSE;
-
- x2 = x1 + ecol->width;
-
- if (x > x2)
- continue;
-
- *col_res = col;
- if (x1_res)
- *x1_res = x - x1;
- break;
- }
-
- y1 = y2 = 0;
- for (row = 0; row < rows; row++, y1 = y2){
- if (y < y1)
- return FALSE;
-
- y2 += eti_row_height (eti, row) + 1;
-
- if (y > y2)
- continue;
-
- *row_res = row;
- if (y1_res)
- *y1_res = y - y1;
- break;
- }
-
- return TRUE;
-}
-
-static void
-eti_cursor_move_left (ETableItem *eti)
-{
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col - 1, eti->focused_row);
-}
-
-static void
-eti_cursor_move_right (ETableItem *eti)
-{
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col + 1, eti->focused_row);
-}
-
-static void
-eti_cursor_move_up (ETableItem *eti)
-{
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col, eti->focused_row - 1);
-}
-
-static void
-eti_cursor_move_down (ETableItem *eti)
-{
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col, eti->focused_row + 1);
-}
-
-static int
-eti_event (GnomeCanvasItem *item, GdkEvent *e)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
- ECellView *ecell_view;
- ETableCol *ecol;
-
- switch (e->type){
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_2BUTTON_PRESS: {
- double x1, y1;
- int col, row;
-
- gnome_canvas_item_w2i (item, &e->button.x, &e->button.y);
-
- if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1))
- return TRUE;
-
- if (eti->focused_row == row && eti->focused_col == col){
-
- ecol = e_table_header_get_column (eti->header, col);
- ecell_view = eti->cell_views [col];
-
- /*
- * Adjust the event positions
- */
- e->button.x = x1;
- e->button.y = y1;
-
- e_cell_event (ecell_view, e, ecol->col_idx, col, row);
- } else {
- /*
- * Focus the cell, and select the row
- */
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, col, row);
- e_table_item_select_row (eti, row);
- }
- break;
- }
-
- case GDK_MOTION_NOTIFY: {
- int col, row;
- double x1, y1;
-
- gnome_canvas_item_w2i (item, &e->button.x, &e->button.y);
-
- if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1))
- return TRUE;
-
- if (eti->focused_row == row && eti->focused_col == col){
- ecol = e_table_header_get_column (eti->header, col);
- ecell_view = eti->cell_views [col];
-
- /*
- * Adjust the event positions
- */
- e->button.x -= (x1 + eti->x1);
- e->button.y -= (y1 + eti->y1);
-
- e_cell_event (ecell_view, e, ecol->col_idx, col, row);
- }
- break;
- }
-
- case GDK_KEY_PRESS:
- if (eti->focused_col == -1)
- return FALSE;
-
- switch (e->key.keyval){
- case GDK_Left:
- if (!eti->mode_spreadsheet && eti_editing (eti))
- break;
-
- if (eti->focused_col > 0)
- eti_cursor_move_left (eti);
-
- return TRUE;
-
- case GDK_Right:
- if (!eti->mode_spreadsheet && eti_editing (eti))
- break;
-
- if ((eti->focused_col + 1) < eti->cols)
- eti_cursor_move_right (eti);
- return TRUE;
-
- case GDK_Up:
- if (eti->focused_row > 0)
- eti_cursor_move_up (eti);
- return TRUE;
-
- case GDK_Down:
- if ((eti->focused_row + 1) < eti->rows)
- eti_cursor_move_down (eti);
-
- return TRUE;
-
- case GDK_Tab:
- if ((e->key.state & GDK_SHIFT_MASK) != 0){
- /* shift tab */
- if (eti->focused_col > 0)
- eti_cursor_move_left (eti);
- else if (eti->focused_row > 0){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->cols - 1, eti->focused_row - 1);
- } else {
- /* FIXME: request focus leave backward */
- }
- } else {
- if ((eti->focused_col + 1) < eti->cols)
- eti_cursor_move_right (eti);
- else if ((eti->focused_row + 1) < eti->rows){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, 0, eti->rows - 1);
- } else {
- /* FIXME: request focus leave forward */
- }
- }
- break;
-
- default:
- if (!eti_editing (eti)){
- if ((e->key.state & (GDK_MOD1_MASK | GDK_CONTROL_MASK)) != 0)
- return 0;
-
- if (!(e->key.keyval >= 0x20 && e->key.keyval <= 0xff))
- return 0;
- }
- }
-
- ecol = e_table_header_get_column (eti->header, eti->focused_col);
- ecell_view = eti->cell_views [eti->focused_col];
- e_cell_event (ecell_view, e, ecol->col_idx, eti->focused_col, eti->focused_row);
- break;
-
- case GDK_KEY_RELEASE:
- if (eti->focused_col == -1)
- return FALSE;
-
- if (eti_editing (eti)){
- ecell_view = eti->cell_views [eti->editing_col];
- ecol = e_table_header_get_column (eti->header, eti->editing_col);
- e_cell_event (ecell_view, e, ecol->col_idx, eti->editing_col, eti->editing_row);
- }
- break;
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-/*
- * ETableItem::row_selection method
- */
-static void
-eti_row_selection (ETableItem *eti, int row, gboolean selected)
-{
- eti_request_region_redraw (eti, 0, row, eti->cols - 1, row, 0);
-
- if (selected)
- eti->selection = g_slist_prepend (eti->selection, GINT_TO_POINTER (row));
- else
- eti->selection = g_slist_remove (eti->selection, GINT_TO_POINTER (row));
-
-}
-
-static void
-eti_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
- ETableItemClass *eti_class = (ETableItemClass *) object_class;
-
- eti_parent_class = gtk_type_class (PARENT_OBJECT_TYPE);
-
- object_class->destroy = eti_destroy;
- object_class->set_arg = eti_set_arg;
-
- item_class->update = eti_update;
- item_class->realize = eti_realize;
- item_class->unrealize = eti_unrealize;
- item_class->draw = eti_draw;
- item_class->point = eti_point;
- item_class->event = eti_event;
- item_class->bounds = eti_bounds;
-
- eti_class->row_selection = eti_row_selection;
-
- gtk_object_add_arg_type ("ETableItem::ETableHeader", GTK_TYPE_POINTER,
- GTK_ARG_WRITABLE, ARG_TABLE_HEADER);
- gtk_object_add_arg_type ("ETableItem::ETableModel", GTK_TYPE_POINTER,
- GTK_ARG_WRITABLE, ARG_TABLE_MODEL);
- gtk_object_add_arg_type ("ETableItem::x", GTK_TYPE_DOUBLE,
- GTK_ARG_WRITABLE, ARG_TABLE_X);
- gtk_object_add_arg_type ("ETableItem::y", GTK_TYPE_DOUBLE,
- GTK_ARG_WRITABLE, ARG_TABLE_Y);
- gtk_object_add_arg_type ("ETableItem::drawgrid", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID);
- gtk_object_add_arg_type ("ETableItem::drawfocus", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_DRAW_FOCUS);
- gtk_object_add_arg_type ("ETableItem::spreadsheet", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_MODE_SPREADSHEET);
-
- eti_signals [ROW_SELECTION] =
- gtk_signal_new ("row_selection",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableItemClass, row_selection),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- eti_signals [HEIGHT_CHANGED] =
- gtk_signal_new ("height_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableItemClass, height_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, eti_signals, LAST_SIGNAL);
-
-}
-
-GtkType
-e_table_item_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableItem",
- sizeof (ETableItem),
- sizeof (ETableItemClass),
- (GtkClassInitFunc) eti_class_init,
- (GtkObjectInitFunc) eti_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_OBJECT_TYPE, &info);
- }
-
- return type;
-}
-
-void
-e_table_item_focus (ETableItem *eti, int col, int row)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if (eti->focused_col != -1)
- e_table_item_unfocus (eti);
-
- eti->focused_col = col;
- eti->focused_row = row;
-
- eti_request_region_redraw (eti, col, row, col, row, FOCUSED_BORDER);
-
- /*
- * make sure we have the Gtk Focus
- */
- gnome_canvas_item_grab_focus (GNOME_CANVAS_ITEM (eti));
-}
-
-void
-e_table_item_unfocus (ETableItem *eti)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if (eti->focused_row == -1)
- return;
-
- {
- const int col = eti->focused_col;
- const int row = eti->focused_row;
-
- eti_request_region_redraw (eti, col, row, col, row, FOCUSED_BORDER);
- }
- eti->focused_col = -1;
- eti->focused_row = -1;
-}
-
-const GSList *
-e_table_item_get_selection (ETableItem *eti)
-{
- g_return_val_if_fail (eti != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_ITEM (eti), NULL);
-
- return eti->selection;
-}
-
-GtkSelectionMode
-e_table_item_get_selection_mode (ETableItem *eti)
-{
- g_return_val_if_fail (eti != NULL, GTK_SELECTION_SINGLE);
- g_return_val_if_fail (E_IS_TABLE_ITEM (eti), GTK_SELECTION_SINGLE);
-
- return eti->selection_mode;
-}
-
-void
-e_table_item_set_selection_mode (ETableItem *eti, GtkSelectionMode selection_mode)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if (selection_mode == GTK_SELECTION_BROWSE ||
- selection_mode == GTK_SELECTION_EXTENDED){
- g_error ("GTK_SELECTION_BROWSE and GTK_SELECTION_EXTENDED are not implemented");
- }
-
- eti->selection_mode = selection_mode;
-}
-
-gboolean
-e_table_item_is_row_selected (ETableItem *eti, int row)
-{
- g_return_val_if_fail (eti != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_ITEM (eti), FALSE);
-
- if (g_slist_find (eti->selection, GINT_TO_POINTER (row)))
- return TRUE;
- else
- return FALSE;
-}
-
-void
-e_table_item_unselect_row (ETableItem *eti, int row)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if (e_table_item_is_row_selected (eti, row)){
- gtk_signal_emit (
- GTK_OBJECT (eti), eti_signals [ROW_SELECTION],
- row, 0);
- }
-}
-
-void
-e_table_item_select_row (ETableItem *eti, int row)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- switch (eti->selection_mode){
- case GTK_SELECTION_SINGLE:
- if (eti->selection){
- gtk_signal_emit (
- GTK_OBJECT (eti), eti_signals [ROW_SELECTION],
- GPOINTER_TO_INT (eti->selection->data), 0);
- }
- g_slist_free (eti->selection);
- eti->selection = NULL;
-
- gtk_signal_emit (
- GTK_OBJECT (eti), eti_signals [ROW_SELECTION],
- GINT_TO_POINTER (row), 1);
- break;
-
- case GTK_SELECTION_MULTIPLE:
- if (g_slist_find (eti->selection, GINT_TO_POINTER (row)))
- return;
- gtk_signal_emit (
- GTK_OBJECT (eti), eti_signals [ROW_SELECTION],
- GINT_TO_POINTER (row), 1);
- break;
-
- default:
-
- }
-}
-
-void
-e_table_item_enter_edit (ETableItem *eti, int col, int row)
-{
- ETableCol *ecol;
-
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- eti->editing_col = col;
- eti->editing_row = row;
-
- ecol = e_table_header_get_column (eti->header, col);
- eti->edit_ctx = e_cell_enter_edit (eti->cell_views [col], ecol->col_idx, col, row);
-}
-
-void
-e_table_item_leave_edit (ETableItem *eti)
-{
- ETableCol *ecol;
-
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if (!eti_editing (eti))
- return;
-
- ecol = e_table_header_get_column (eti->header, eti->editing_col);
- e_cell_leave_edit (
- eti->cell_views [eti->editing_col],
- ecol->col_idx, eti->editing_col,
- eti->editing_row, eti->edit_ctx);
- eti->editing_col = -1;
- eti->editing_row = -1;
- eti->edit_ctx = NULL;
-}
-
diff --git a/widgets/e-table/e-table-item.h b/widgets/e-table/e-table-item.h
deleted file mode 100644
index f19819f2fc..0000000000
--- a/widgets/e-table/e-table-item.h
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef _E_TABLE_ITEM_H_
-#define _E_TABLE_ITEM_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include "e-table-model.h"
-#include "e-table-header.h"
-
-#define E_TABLE_ITEM_TYPE (e_table_item_get_type ())
-#define E_TABLE_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_ITEM_TYPE, ETableItem))
-#define E_TABLE_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_ITEM_TYPE, ETableItemClass))
-#define E_IS_TABLE_ITEM(o) (GTK_CHECK_TYPE ((o), E_TABLE_ITEM_TYPE))
-#define E_IS_TABLE_ITEM_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_ITEM_TYPE))
-
-typedef struct {
- GnomeCanvasItem parent;
- ETableModel *table_model;
- ETableHeader *header;
-
- int x1, y1;
- int width, height;
-
- int cols, rows;
-
- /*
- * Ids for the signals we connect to
- */
- int header_dim_change_id;
- int header_structure_change_id;
- int table_model_change_id;
- int table_model_row_change_id;
-
- GdkGC *fill_gc;
- GdkGC *grid_gc;
- GdkGC *focus_gc;
- GdkBitmap *stipple;
-
- unsigned int draw_grid:1;
- unsigned int draw_focus:1;
- unsigned int mode_spreadsheet:1;
- unsigned int renderers_can_change_size:1;
- unsigned int cell_views_realized:1;
-
- int focused_col, focused_row;
-
- /*
- * Realized views, per column
- */
- ECellView **cell_views;
- int n_cells;
-
- /*
- * Lengh Threshold: above this, we stop computing correctly
- * the size
- */
- int length_threshold;
-
- GSList *selection;
- GtkSelectionMode selection_mode;
-
- /*
- * During edition
- */
- int editing_col, editing_row;
- void *edit_ctx;
-} ETableItem;
-
-typedef struct {
- GnomeCanvasItemClass parent_class;
-
- void (*row_selection) (ETableItem *eti, int row, gboolean selected);
- void (*height_changed) (ETableItem *eti);
-} ETableItemClass;
-
-GtkType e_table_item_get_type (void);
-
-/*
- * Focus
- */
-void e_table_item_focus (ETableItem *eti, int col, int row);
-void e_table_item_unfocus (ETableItem *eti);
-
-/*
- * Selection
- */
-void e_table_item_select_row (ETableItem *e_table_Item, int row);
-void e_table_item_unselect_row (ETableItem *e_table_Item, int row);
-
-/*
- * Handling the selection
- */
-const GSList*e_table_item_get_selection (ETableItem *e_table_Item);
-
-GtkSelectionMode e_table_item_get_selection_mode (ETableItem *e_table_Item);
-void e_table_item_set_selection_mode (ETableItem *e_table_Item,
- GtkSelectionMode selection_mode);
-gboolean e_table_item_is_row_selected (ETableItem *e_table_Item,
- int row);
-
-void e_table_item_leave_edit (ETableItem *eti);
-void e_table_item_enter_edit (ETableItem *eti, int col, int row);
-
-void e_table_item_redraw_range (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row);
-
-#endif /* _E_TABLE_ITEM_H_ */
diff --git a/widgets/e-table/e-table-model.c b/widgets/e-table/e-table-model.c
deleted file mode 100644
index 9e397710ef..0000000000
--- a/widgets/e-table/e-table-model.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * e-table-model.c: a Table Model
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc.
- */
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-table-model.h"
-
-#define ETM_CLASS(e) ((ETableModelClass *)((GtkObject *)e)->klass)
-
-static GtkObjectClass *e_table_model_parent_class;
-
-enum {
- MODEL_CHANGED,
- MODEL_ROW_CHANGED,
- MODEL_CELL_CHANGED,
- ROW_SELECTION,
- LAST_SIGNAL
-};
-
-static guint e_table_model_signals [LAST_SIGNAL] = { 0, };
-
-int
-e_table_model_column_count (ETableModel *e_table_model)
-{
- g_return_val_if_fail (e_table_model != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), 0);
-
- return ETM_CLASS (e_table_model)->column_count (e_table_model);
-}
-
-
-int
-e_table_model_row_count (ETableModel *e_table_model)
-{
- g_return_val_if_fail (e_table_model != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), 0);
-
- return ETM_CLASS (e_table_model)->row_count (e_table_model);
-}
-
-void *
-e_table_model_value_at (ETableModel *e_table_model, int col, int row)
-{
- g_return_val_if_fail (e_table_model != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL);
-
- return ETM_CLASS (e_table_model)->value_at (e_table_model, col, row);
-}
-
-void
-e_table_model_set_value_at (ETableModel *e_table_model, int col, int row, const void *data)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- ETM_CLASS (e_table_model)->set_value_at (e_table_model, col, row, data);
-
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_ROW_CHANGED], row);
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_CELL_CHANGED], col, row);
-
- /*
- * Notice that "model_changed" is not emitted
- */
-}
-
-gboolean
-e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row)
-{
- g_return_val_if_fail (e_table_model != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE);
-
- return ETM_CLASS (e_table_model)->is_cell_editable (e_table_model, col, row);
-}
-
-static void
-e_table_model_destroy (GtkObject *object)
-{
- if (e_table_model_parent_class->destroy)
- (*e_table_model_parent_class->destroy)(object);
-}
-
-static void
-e_table_model_class_init (GtkObjectClass *object_class)
-{
- e_table_model_parent_class = gtk_type_class (gtk_object_get_type ());
-
- object_class->destroy = e_table_model_destroy;
-
- e_table_model_signals [MODEL_CHANGED] =
- gtk_signal_new ("model_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableModelClass, model_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_table_model_signals [MODEL_ROW_CHANGED] =
- gtk_signal_new ("model_row_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableModelClass, model_row_changed),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- e_table_model_signals [MODEL_CELL_CHANGED] =
- gtk_signal_new ("model_cell_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableModelClass, model_cell_changed),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, e_table_model_signals, LAST_SIGNAL);
-}
-
-GtkType
-e_table_model_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableModel",
- sizeof (ETableModel),
- sizeof (ETableModelClass),
- (GtkClassInitFunc) e_table_model_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-void
-e_table_model_changed (ETableModel *e_table_model)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_CHANGED]);
-}
-
-void
-e_table_model_row_changed (ETableModel *e_table_model, int row)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_ROW_CHANGED], row);
-}
-
-void
-e_table_model_cell_changed (ETableModel *e_table_model, int col, int row)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_CELL_CHANGED], col, row);
-}
-
-
diff --git a/widgets/e-table/e-table-model.h b/widgets/e-table/e-table-model.h
deleted file mode 100644
index 2d08f3744e..0000000000
--- a/widgets/e-table/e-table-model.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef _E_TABLE_MODEL_H_
-#define _E_TABLE_MODEL_H_
-
-#include <gtk/gtkobject.h>
-
-#define E_TABLE_MODEL_TYPE (e_table_model_get_type ())
-#define E_TABLE_MODEL(o) (GTK_CHECK_CAST ((o), E_TABLE_MODEL_TYPE, ETableModel))
-#define E_TABLE_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_MODEL_TYPE, ETableModelClass))
-#define E_IS_TABLE_MODEL(o) (GTK_CHECK_TYPE ((o), E_TABLE_MODEL_TYPE))
-#define E_IS_TABLE_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_MODEL_TYPE))
-
-typedef struct {
- GtkObject base;
-} ETableModel;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Virtual methods
- */
- int (*column_count) (ETableModel *etm);
- int (*row_count) (ETableModel *etm);
- void *(*value_at) (ETableModel *etm, int col, int row);
- void (*set_value_at) (ETableModel *etm, int col, int row, const void *value);
- gboolean (*is_cell_editable) (ETableModel *etm, int col, int row);
-
- /*
- * Signals
- */
-
- /*
- * Major structural changes: model_changed
- * Changes only in a row: row_changed
- * Only changes in a cell: cell_changed
- */
- void (*model_changed) (ETableModel *etm);
- void (*model_row_changed) (ETableModel *etm, int row);
- void (*model_cell_changed) (ETableModel *etm, int col, int row);
-} ETableModelClass;
-
-GtkType e_table_model_get_type (void);
-
-int e_table_model_column_count (ETableModel *e_table_model);
-const char *e_table_model_column_name (ETableModel *e_table_model, int col);
-int e_table_model_row_count (ETableModel *e_table_model);
-void *e_table_model_value_at (ETableModel *e_table_model, int col, int row);
-void e_table_model_set_value_at (ETableModel *e_table_model, int col, int row, const void *data);
-gboolean e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row);
-
-/*
- * Routines for emitting signals on the e_table
- */
-void e_table_model_changed (ETableModel *e_table_model);
-void e_table_model_row_changed (ETableModel *e_table_model, int row);
-void e_table_model_cell_changed (ETableModel *e_table_model, int col, int row);
-
-#endif /* _E_TABLE_MODEL_H_ */
diff --git a/widgets/e-table/e-table-render.c b/widgets/e-table/e-table-render.c
deleted file mode 100644
index 49d742132b..0000000000
--- a/widgets/e-table/e-table-render.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * E-table-render.c: Various renderers
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * Copyright 1999, Helix Code, Inc.
- */
-#include <config.h>
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-col.h"
-#include "e-table-render.h"
-
-void
-e_table_render_string (ERenderContext *ctxt)
-{
- printf ("Rendering string: %s\n", ctxt->render_data);
-}
-
diff --git a/widgets/e-table/e-table-render.h b/widgets/e-table/e-table-render.h
deleted file mode 100644
index ebc65968f0..0000000000
--- a/widgets/e-table/e-table-render.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef E_TABLE_RENDER_H
-#define E_TABLE_RENDER_H
-
-#include <libgnomeui/gnome-canvas.h>
-
-struct ERenderContext {
- ETableCol *etc;
- int row;
- int base_x, base_y;
- GnomeCanvasItem *gnome_canvas_item;
- GdkDrawable *drawable;
- int drawable_width;
- int drawable_height;
- void *render_data;
- void *closure;
-};
-
-void e_table_render_string (ERenderContext *ctxt);
-
-
-#endif
diff --git a/widgets/e-table/e-table-simple.c b/widgets/e-table/e-table-simple.c
deleted file mode 100644
index 943a3291e9..0000000000
--- a/widgets/e-table/e-table-simple.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * e-table-model.c: a simple table model implementation that uses function
- * pointers to simplify the creation of new, exotic and colorful tables in
- * no time.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc.
- */
-
-#include <config.h>
-#include "e-table-simple.h"
-
-#define PARENT_TYPE e_table_model_get_type()
-
-static int
-simple_column_count (ETableModel *etm)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- return simple->col_count (etm, simple->data);
-}
-
-static int
-simple_row_count (ETableModel *etm)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- return simple->row_count (etm, simple->data);
-}
-
-static void *
-simple_value_at (ETableModel *etm, int col, int row)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- return simple->value_at (etm, col, row, simple->data);
-}
-
-static void
-simple_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- simple->set_value_at (etm, col, row, val, simple->data);
-}
-
-static gboolean
-simple_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- return simple->is_cell_editable (etm, col, row, simple->data);
-}
-
-static void
-e_table_simple_class_init (GtkObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- model_class->column_count = simple_column_count;
- model_class->row_count = simple_row_count;
- model_class->value_at = simple_value_at;
- model_class->set_value_at = simple_set_value_at;
- model_class->is_cell_editable = simple_is_cell_editable;
-}
-
-GtkType
-e_table_simple_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableSimple",
- sizeof (ETableSimple),
- sizeof (ETableSimpleClass),
- (GtkClassInitFunc) e_table_simple_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-ETableModel *
-e_table_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleRowCountFn row_count,
- ETableSimpleValueAtFn value_at,
- ETableSimpleSetValueAtFn set_value_at,
- ETableSimpleIsCellEditableFn is_cell_editable,
- void *data)
-{
- ETableSimple *et;
-
- et = gtk_type_new (e_table_simple_get_type ());
-
- et->col_count = col_count;
- et->row_count = row_count;
- et->value_at = value_at;
- et->set_value_at = set_value_at;
- et->is_cell_editable = is_cell_editable;
-
- return (ETableModel *) et;
-}
diff --git a/widgets/e-table/e-table-simple.h b/widgets/e-table/e-table-simple.h
deleted file mode 100644
index d890245386..0000000000
--- a/widgets/e-table/e-table-simple.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _E_TABLE_SIMPLE_H_
-#define _E_TABLE_SIMPLE_H_
-
-#include "e-table-model.h"
-
-typedef int (*ETableSimpleColumnCountFn) (ETableModel *etm, void *data);
-typedef int (*ETableSimpleRowCountFn) (ETableModel *etm, void *data);
-typedef void *(*ETableSimpleValueAtFn) (ETableModel *etm, int col, int row, void *data);
-typedef void (*ETableSimpleSetValueAtFn) (ETableModel *etm, int col, int row, const void *val, void *data);
-typedef gboolean (*ETableSimpleIsCellEditableFn) (ETableModel *etm, int col, int row, void *data);
-
-typedef struct {
- ETableModel parent;
-
- ETableSimpleColumnCountFn col_count;
- ETableSimpleRowCountFn row_count;
- ETableSimpleValueAtFn value_at;
- ETableSimpleSetValueAtFn set_value_at;
- ETableSimpleIsCellEditableFn is_cell_editable;
- void *data;
-} ETableSimple;
-
-typedef struct {
- ETableModelClass parent_class;
-} ETableSimpleClass;
-
-GtkType e_table_simple_get_type (void);
-
-ETableModel *e_table_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleRowCountFn row_count,
- ETableSimpleValueAtFn value_at,
- ETableSimpleSetValueAtFn set_value_at,
- ETableSimpleIsCellEditableFn is_cell_editable,
- void *data);
-
-#endif /* _E_TABLE_SIMPLE_H_ */
-
diff --git a/widgets/e-table/e-table-sorted.c b/widgets/e-table/e-table-sorted.c
deleted file mode 100644
index 16644a45b1..0000000000
--- a/widgets/e-table/e-table-sorted.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * E-table-sorted.c: Implements a table that sorts another table
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc.
- */
-#include <config.h>
-#include <stdlib.h>
-#include "e-util/e-util.h"
-#include "e-table-sorted.h"
-
-#define PARENT_TYPE E_TABLE_SUBSET_TYPE
-
-static ETableModelClass *ets_parent_class;
-
-static void
-ets_class_init (GtkObjectClass *klass)
-{
- ets_parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-E_MAKE_TYPE(e_table_sorted, "ETableSorted", ETableSorted, ets_class_init, NULL, PARENT_TYPE);
-
-static ETableSorted *sort_ets;
-
-static int
-my_sort (const void *a, const void *b)
-{
- ETableModel *source = E_TABLE_SUBSET (sort_ets)->source;
- const int *ia = (const int *) a;
- const int *ib = (const int *) b;
- void *va, *vb;
-
- va = e_table_model_value_at (source, sort_ets->sort_col, *ia);
- vb = e_table_model_value_at (source, sort_ets->sort_col, *ib);
-
- return (*sort_ets->compare) (va, vb);
-}
-
-static void
-do_sort (ETableSorted *ets)
-{
- ETableSubset *etss = E_TABLE_SUBSET (ets);
- g_assert (sort_ets == NULL);
-
- sort_ets = ets;
- qsort (etss->map_table, etss->n_map, sizeof (unsigned int), my_sort);
- sort_ets = NULL;
-}
-
-ETableModel *
-e_table_sorted_new (ETableModel *source, int col, GCompareFunc compare)
-{
- ETableSorted *ets = gtk_type_new (E_TABLE_SORTED_TYPE);
- ETableSubset *etss = E_TABLE_SUBSET (ets);
- const int nvals = e_table_model_row_count (source);
- int i;
-
- if (e_table_subset_construct (etss, source, nvals) == NULL){
- gtk_object_destroy (GTK_OBJECT (ets));
- return NULL;
- }
-
- ets->compare = compare;
- ets->sort_col = col;
-
- /* Init */
- for (i = 0; i < nvals; i++)
- etss->map_table [i] = i;
-
- do_sort (ets);
-
- return (ETableModel *) ets;
-}
-
-void
-e_table_sorted_resort (ETableSorted *ets, int col, GCompareFunc compare)
-{
- if (col == -1 || compare == NULL)
- do_sort (ets);
- else {
- ets->sort_col = col;
- ets->compare = compare;
- do_sort (ets);
- }
-}
-
diff --git a/widgets/e-table/e-table-sorted.h b/widgets/e-table/e-table-sorted.h
deleted file mode 100644
index 2ec52df2e7..0000000000
--- a/widgets/e-table/e-table-sorted.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef _E_TABLE_SORTED_H_
-#define _E_TABLE_SORTED_H_
-
-#include <gtk/gtkobject.h>
-#include "e-table-model.h"
-#include "e-table-subset.h"
-
-#define E_TABLE_SORTED_TYPE (e_table_sorted_get_type ())
-#define E_TABLE_SORTED(o) (GTK_CHECK_CAST ((o), E_TABLE_SORTED_TYPE, ETableSorted))
-#define E_TABLE_SORTED_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SORTED_TYPE, ETableSortedClass))
-#define E_IS_TABLE_SORTED(o) (GTK_CHECK_TYPE ((o), E_TABLE_SORTED_TYPE))
-#define E_IS_TABLE_SORTED_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_TYPE))
-
-typedef struct {
- ETableSubset base;
-
- short sort_col;
- GCompareFunc compare;
-} ETableSorted;
-
-typedef struct {
- ETableSubset parent_class;
-} ETableSortedClass;
-
-GtkType e_table_sorted_get_type (void);
-ETableModel *e_table_sorted_new (ETableModel *etm, int col, GCompareFunc compare);
-void e_table_sorted_resort (ETableSorted *ets, int col, GCompareFunc compare);
-
-#endif /* _E_TABLE_SORTED_H_ */
diff --git a/widgets/e-table/e-table-subset.c b/widgets/e-table/e-table-subset.c
deleted file mode 100644
index a9e4a5c5a4..0000000000
--- a/widgets/e-table/e-table-subset.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * E-table-subset.c: Implements a table that contains a subset of another table.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc.
- */
-#include <config.h>
-#include <stdlib.h>
-#include <gtk/gtksignal.h>
-#include "e-util/e-util.h"
-#include "e-table-subset.h"
-
-#define PARENT_TYPE E_TABLE_MODEL_TYPE
-
-static ETableModelClass *etss_parent_class;
-
-static void
-etss_destroy (GtkObject *object)
-{
- ETableSubset *etss = E_TABLE_SUBSET (object);
-
- if (etss->source)
- gtk_object_unref (GTK_OBJECT (etss->source));
-
- if (etss->map_table)
- free (etss->map_table);
-
- GTK_OBJECT_CLASS (etss_parent_class)->destroy (object);
-}
-
-static int
-etss_column_count (ETableModel *etm)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_column_count (etss->source);
-}
-
-static int
-etss_row_count (ETableModel *etm)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return etss->n_map;
-}
-
-static void *
-etss_value_at (ETableModel *etm, int col, int row)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_value_at (etss->source, col, etss->map_table [row]);
-}
-
-static void
-etss_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_set_value_at (etss->source, col, etss->map_table [row], val);
-}
-
-static gboolean
-etss_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_is_cell_editable (etss->source, col, etss->map_table [row]);
-}
-
-static void
-etss_class_init (GtkObjectClass *klass)
-{
- ETableModelClass *table_class = (ETableModelClass *) klass;
-
- etss_parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->destroy = etss_destroy;
-
- table_class->column_count = etss_column_count;
- table_class->row_count = etss_row_count;
- table_class->value_at = etss_value_at;
- table_class->set_value_at = etss_set_value_at;
- table_class->is_cell_editable = etss_is_cell_editable;
-}
-
-E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, NULL, PARENT_TYPE);
-
-static void
-etss_proxy_model_changed (ETableModel *etm, ETableSubset *etss)
-{
- e_table_model_changed (E_TABLE_MODEL (etss));
-}
-
-static void
-etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss)
-{
- const int n = etss->n_map;
- const int * const map_table = etss->map_table;
- int i;
-
- for (i = 0; i < n; i++){
- if (map_table [i] == row){
- e_table_model_row_changed (E_TABLE_MODEL (etss), i);
- return;
- }
- }
-}
-
-static void
-etss_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSubset *etss)
-{
- const int n = etss->n_map;
- const int * const map_table = etss->map_table;
- int i;
-
- for (i = 0; i < n; i++){
- if (map_table [i] == row){
- e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i);
- return;
- }
- }
-}
-
-ETableModel *
-e_table_subset_construct (ETableSubset *etss, ETableModel *source, int nvals)
-{
- unsigned int *buffer;
- int i;
-
- buffer = (unsigned int *) malloc (sizeof (unsigned int) * nvals);
- if (buffer == NULL)
- return NULL;
- etss->map_table = buffer;
- etss->n_map = nvals;
- etss->source = source;
- gtk_object_ref (GTK_OBJECT (source));
-
- /* Init */
- for (i = 0; i < nvals; i++)
- etss->map_table [i] = i;
-
- gtk_signal_connect (GTK_OBJECT (source), "model_changed",
- GTK_SIGNAL_FUNC (etss_proxy_model_changed), etss);
- gtk_signal_connect (GTK_OBJECT (source), "model_row_changed",
- GTK_SIGNAL_FUNC (etss_proxy_model_row_changed), etss);
- gtk_signal_connect (GTK_OBJECT (source), "model_cell_changed",
- GTK_SIGNAL_FUNC (etss_proxy_model_cell_changed), etss);
-
- return E_TABLE_MODEL (etss);
-}
-
-ETableModel *
-e_table_subset_new (ETableModel *source, const int nvals)
-{
- ETableSubset *etss = gtk_type_new (E_TABLE_SUBSET_TYPE);
-
- if (e_table_subset_construct (etss, source, nvals) == NULL){
- gtk_object_destroy (GTK_OBJECT (etss));
- return NULL;
- }
-
- return (ETableModel *) etss;
-}
-
-ETableModel *
-e_table_subset_get_toplevel (ETableSubset *table)
-{
- g_return_val_if_fail (table != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_SUBSET (table), NULL);
-
- if (E_IS_TABLE_SUBSET (table->source))
- return e_table_subset_get_toplevel (E_TABLE_SUBSET (table->source));
- else
- return table->source;
-}
diff --git a/widgets/e-table/e-table-subset.h b/widgets/e-table/e-table-subset.h
deleted file mode 100644
index 314f28aea6..0000000000
--- a/widgets/e-table/e-table-subset.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef _E_TABLE_SUBSET_H_
-#define _E_TABLE_SUBSET_H_
-
-#include <gtk/gtkobject.h>
-#include "e-table-model.h"
-
-#define E_TABLE_SUBSET_TYPE (e_table_subset_get_type ())
-#define E_TABLE_SUBSET(o) (GTK_CHECK_CAST ((o), E_TABLE_SUBSET_TYPE, ETableSubset))
-#define E_TABLE_SUBSET_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SUBSET_TYPE, ETableSubsetClass))
-#define E_IS_TABLE_SUBSET(o) (GTK_CHECK_TYPE ((o), E_TABLE_SUBSET_TYPE))
-#define E_IS_TABLE_SUBSET_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SUBSET_TYPE))
-
-typedef struct {
- ETableModel base;
-
- ETableModel *source;
- int n_map;
- int *map_table;
-} ETableSubset;
-
-typedef struct {
- ETableModelClass parent_class;
-} ETableSubsetClass;
-
-GtkType e_table_subset_get_type (void);
-ETableModel *e_table_subset_new (ETableModel *etm, int n_vals);
-ETableModel *e_table_subset_construct (ETableSubset *ets, ETableModel *source, int nvals);
-
-ETableModel *e_table_subset_get_toplevel (ETableSubset *table_model);
-
-#endif /* _E_TABLE_SUBSET_H_ */
-
diff --git a/widgets/e-table/e-table-tree.h b/widgets/e-table/e-table-tree.h
deleted file mode 100644
index e7e125a6af..0000000000
--- a/widgets/e-table/e-table-tree.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _E_TABLE_TREE_H_
-#define _E_TABLE_TREE_H_
-
-typedef struct {
- char *title;
-
- union {
- ETableModel *table;
- GList *children;
- } u;
-
- guint expanded :1;
- guint is_leaf :1;
-} ETableGroup;
-
-ETableGroup *e_table_group_new (const char *title, ETableModel *table);
-ETableGroup *e_table_group_new_leaf (const char *title);
-
-#endif /* _E_TABLE_TREE_H_ */
diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c
deleted file mode 100644
index a42aaf111b..0000000000
--- a/widgets/e-table/e-table.c
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * E-table-view.c: A graphical view of a Table.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * Copyright 1999, Helix Code, Inc
- */
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <alloca.h>
-#include <stdio.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <gtk/gtksignal.h>
-#include "e-util/e-util.h"
-#include "e-table.h"
-#include "e-table-header-item.h"
-#include "e-table-subset.h"
-#include "e-table-item.h"
-#include "e-table-group.h"
-
-#define COLUMN_HEADER_HEIGHT 16
-#define TITLE_HEIGHT 16
-#define GROUP_INDENT 10
-
-#define PARENT_TYPE gtk_table_get_type ()
-
-static GtkObjectClass *e_table_parent_class;
-
-static void
-et_destroy (GtkObject *object)
-{
- ETable *et = E_TABLE (object);
-
- gtk_object_unref (GTK_OBJECT (et->model));
- gtk_object_unref (GTK_OBJECT (et->full_header));
- gtk_object_unref (GTK_OBJECT (et->header));
-
- g_free (et->group_spec);
-
- (*e_table_parent_class->destroy)(object);
-}
-
-static void
-e_table_init (GtkObject *object)
-{
- ETable *e_table = E_TABLE (object);
-
- e_table->draw_grid = 1;
- e_table->draw_focus = 1;
- e_table->spreadsheet = 1;
-}
-
-static ETableHeader *
-e_table_make_header (ETable *e_table, ETableHeader *full_header, const char *cols)
-{
- ETableHeader *nh;
- char *copy = alloca (strlen (cols) + 1);
- char *p, *state;
- const int max_cols = e_table_header_count (full_header);
-
- nh = e_table_header_new ();
- strcpy (copy, cols);
- while ((p = strtok_r (copy, ",", &state)) != NULL){
- int col = atoi (p);
-
- copy = NULL;
- if (col >= max_cols)
- continue;
-
- e_table_header_add_column (nh, e_table_header_get_column (full_header, col), -1);
- }
-
- return nh;
-}
-
-static void
-header_canvas_size_alocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table)
-{
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_table->header_canvas),
- 0, 0, alloc->width, COLUMN_HEADER_HEIGHT);
-}
-
-static void
-e_table_setup_header (ETable *e_table)
-{
- e_table->header_canvas = GNOME_CANVAS (gnome_canvas_new ());
-
- gtk_widget_show (GTK_WIDGET (e_table->header_canvas));
-
- e_table->header_item = gnome_canvas_item_new (
- gnome_canvas_root (e_table->header_canvas),
- e_table_header_item_get_type (),
- "ETableHeader", e_table->header,
- "x", 0,
- "y", 0,
- NULL);
-
- gtk_signal_connect (
- GTK_OBJECT (e_table->header_canvas), "size_allocate",
- GTK_SIGNAL_FUNC (header_canvas_size_alocate), e_table);
-
- gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -1, COLUMN_HEADER_HEIGHT);
-
- gtk_table_attach (
- GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas),
- 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
-
-}
-
-typedef struct {
- void *value;
- GArray *array;
-} group_key_t;
-
-static GArray *
-e_table_create_groups (ETableModel *etm, int key_col, GCompareFunc comp)
-{
- GArray *groups;
- const int rows = e_table_model_row_count (etm);
- int row, i;
-
- groups = g_array_new (FALSE, FALSE, sizeof (group_key_t));
-
- for (row = 0; row < rows; row++){
- void *val = e_table_model_value_at (etm, key_col, row);
- const int n_groups = groups->len;
-
- /*
- * Should replace this with a bsearch later
- */
- for (i = 0; i < n_groups; i++){
- group_key_t *g = &g_array_index (groups, group_key_t, i);
-
- if ((*comp) (g->value, val)){
- g_array_append_val (g->array, row);
- break;
- }
- }
- if (i != n_groups)
- continue;
-
- /*
- * We need to create a new group
- */
- {
- group_key_t gk;
-
- gk.value = val;
- gk.array = g_array_new (FALSE, FALSE, sizeof (int));
-
- g_array_append_val (gk.array, row);
- g_array_append_val (groups, gk);
- }
- }
-
- return groups;
-}
-
-static void
-e_table_destroy_groups (GArray *groups)
-{
- const int n = groups->len;
- int i;
-
- for (i = 0; i < n; i++){
- group_key_t *g = &g_array_index (groups, group_key_t, i);
-
- g_array_free (g->array, TRUE);
- }
- g_array_free (groups, TRUE);
-}
-
-static ETableModel **
-e_table_make_subtables (ETableModel *model, GArray *groups)
-{
- const int n_groups = groups->len;
- ETableModel **tables;
- int i;
-
- tables = g_new (ETableModel *, n_groups+1);
-
- for (i = 0; i < n_groups; i++){
- group_key_t *g = &g_array_index (groups, group_key_t, i);
- const int sub_size = g->array->len;
- ETableSubset *ss;
- int j;
-
- tables [i] = e_table_subset_new (model, sub_size);
- ss = E_TABLE_SUBSET (tables [i]);
-
- for (j = 0; j < sub_size; j++)
- ss->map_table [j] = g_array_index (g->array, int, j);
- }
- tables [i] = NULL;
-
- return (ETableModel **) tables;
-}
-
-typedef struct _Node Node;
-
-struct _Node {
- Node *parent;
- GnomeCanvasItem *item;
- ETableModel *table_model;
- GSList *children;
-
- guint is_leaf:1;
-};
-
-static Node *
-leaf_new (GnomeCanvasItem *table_item, ETableModel *table_model, Node *parent)
-{
- Node *node = g_new (Node, 1);
-
- g_assert (table_item != NULL);
- g_assert (table_model != NULL);
- g_assert (parent != NULL);
-
- node->item = table_item;
- node->parent = parent;
- node->table_model = table_model;
- node->is_leaf = 1;
-
- g_assert (!parent->is_leaf);
-
- parent->children = g_slist_append (parent->children, node);
-
- e_table_group_add (E_TABLE_GROUP (parent->item), table_item);
-
- return node;
-}
-
-static Node *
-node_new (GnomeCanvasItem *group_item, ETableModel *table_model, Node *parent)
-{
- Node *node = g_new (Node, 1);
-
- g_assert (table_model != NULL);
-
- node->children = NULL;
- node->item = group_item;
- node->parent = parent;
- node->table_model = table_model;
- node->is_leaf = 0;
-
- if (parent){
- parent->children = g_slist_append (parent->children, node);
-
- e_table_group_add (E_TABLE_GROUP (parent->item), group_item);
- }
-
- return node;
-}
-
-static Node *
-e_table_create_leaf (ETable *e_table, ETableModel *etm, Node *parent)
-{
- GnomeCanvasItem *table_item;
- static double last_y;
- Node *leaf;
-
- table_item = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (parent->item),
- e_table_item_get_type (),
- "ETableHeader", e_table->header,
- "ETableModel", etm,
- "drawgrid", e_table->draw_grid,
- "drawfocus", e_table->draw_focus,
- "spreadsheet", e_table->spreadsheet,
- NULL);
-
- leaf = leaf_new (table_item, etm, parent);
-
- return leaf;
-}
-
-static int
-leaf_height (Node *leaf)
-{
- const GnomeCanvasItem *item = leaf->item;
-
- return item->y2 - item->y1;
-}
-
-static int
-leaf_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- static int last_x = -1;
- static int last_y = -1;
-
- if (event->type == GDK_BUTTON_PRESS){
- last_x = event->button.x;
- last_y = event->button.y;
- } else if (event->type == GDK_BUTTON_RELEASE){
- last_x = -1;
- last_y = -1;
- } else if (event->type == GDK_MOTION_NOTIFY){
- if (last_x == -1)
- return FALSE;
-
- gnome_canvas_item_move (item, event->motion.x - last_x, event->motion.y - last_y);
- last_x = event->motion.x;
- last_y = event->motion.y;
- } else
- return FALSE;
- return TRUE;
-}
-
-static Node *
-e_table_create_nodes (ETable *e_table, ETableModel *model, ETableHeader *header,
- GnomeCanvasGroup *root, Node *parent, int *groups_list)
-{
- GArray *groups;
- ETableModel **tables;
- ETableCol *ecol;
- int key_col, i;
- GnomeCanvasItem *group_item;
- Node *group;
-
- key_col = *groups_list;
- g_assert (key_col != -1);
-
- /*
- * Create groups
- */
- ecol = e_table_header_get_column (header, key_col);
-
- g_assert (ecol != NULL);
-
- groups = e_table_create_groups (model, key_col, ecol->compare);
- tables = e_table_make_subtables (e_table->model, groups);
- e_table_destroy_groups (groups);
-
- group_item = e_table_group_new (root, ecol, TRUE, parent == NULL);
- group = node_new (group_item, model, parent);
-
- for (i = 0; tables [i] != NULL; i++){
- Node *node;
-
- /*
- * Leafs
- */
- if (groups_list [1] == -1){
- GnomeCanvasItem *item_leaf_header;
- Node *leaf_header;
-
- item_leaf_header = e_table_group_new (
- GNOME_CANVAS_GROUP (group_item), ecol, TRUE, FALSE);
- leaf_header = node_new (item_leaf_header, tables [i], group);
-
- e_table_create_leaf (e_table, tables [i], leaf_header);
- } else {
- e_table_create_nodes (
- e_table, tables [i], header, GNOME_CANVAS_GROUP (group_item),
- group, &groups_list [1]);
- }
- }
-
- return group;
-}
-
-static int *
-group_spec_to_desc (const char *group_spec)
-{
- int a_size = 10;
- int *elements;
- char *p, *copy, *follow;
- int n_elements = 0;
-
- if (group_spec == NULL)
- return NULL;
-
- elements = g_new (int, a_size);
- copy = alloca (strlen (group_spec) + 1);
- strcpy (copy, group_spec);
-
- while ((p = strtok_r (copy, ",", &follow)) != NULL){
- elements [n_elements] = atoi (p);
- ++n_elements;
- if (n_elements+1 == a_size){
- int *new_e;
-
- n_elements += 10;
- new_e = g_renew (int, elements, n_elements);
- if (new_e == NULL){
- g_free (elements);
- return NULL;
- }
- elements = new_e;
- }
- copy = NULL;
- }
-
- /* Tag end */
- elements [n_elements] = -1;
-
- return elements;
-}
-
-/*
- * The ETableCanvas object is just used to enable us to
- * hook up to the realize/unrealize phases of the canvas
- * initialization (as laying out the subtables requires us to
- * know the actual size of the subtables we are inserting
- */
-
-#define E_TABLE_CANVAS_PARENT_TYPE gnome_canvas_get_type ()
-
-typedef struct {
- GnomeCanvas base;
-
- ETable *e_table;
-} ETableCanvas;
-
-typedef struct {
- GnomeCanvasClass base_class;
-} ETableCanvasClass;
-
-static GnomeCanvasClass *e_table_canvas_parent_class;
-
-static void
-e_table_canvas_realize (GtkWidget *widget)
-{
- ETableCanvas *e_table_canvas = (ETableCanvas *) widget;
- ETable *e_table = e_table_canvas->e_table;
- int *groups;
- Node *leaf;
-
- GTK_WIDGET_CLASS (e_table_canvas_parent_class)->realize (widget);
-
- groups = group_spec_to_desc (e_table->group_spec);
-
- e_table->root = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (e_table->table_canvas->root),
- gnome_canvas_group_get_type (),
- "x", 0.0,
- "y", 0.0,
- NULL);
-
- leaf = e_table_create_nodes (
- e_table, e_table->model,
- e_table->header, GNOME_CANVAS_GROUP (e_table->root), 0, groups);
-
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_table_canvas),
- 0, 0,
- e_table_header_total_width (e_table->header) + 200,
- leaf_height (leaf));
-
- if (groups)
- g_free (groups);
-}
-
-static void
-e_table_canvas_unrealize (GtkWidget *widget)
-{
- ETableCanvas *e_table_canvas = (ETableCanvas *) widget;
- ETable *e_table = e_table_canvas->e_table;
-
- gtk_object_destroy (GTK_OBJECT (e_table->root));
- e_table->root = NULL;
-
- GTK_WIDGET_CLASS (e_table_canvas_parent_class)->unrealize (widget);
-}
-
-static void
-e_table_canvas_class_init (GtkObjectClass *object_class)
-{
- GtkWidgetClass *widget_class = (GtkWidgetClass *) object_class;
-
- widget_class->realize = e_table_canvas_realize;
- widget_class->unrealize = e_table_canvas_unrealize;
-
- e_table_canvas_parent_class = gtk_type_class (E_TABLE_CANVAS_PARENT_TYPE);
-}
-
-static void
-e_table_canvas_init (GtkObject *canvas)
-{
- GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS);
-}
-
-GtkType e_table_canvas_get_type (void);
-
-E_MAKE_TYPE (e_table_canvas, "ETableCanvas", ETableCanvas, e_table_canvas_class_init,
- e_table_canvas_init, E_TABLE_CANVAS_PARENT_TYPE);
-
-static GnomeCanvas *
-e_table_canvas_new (ETable *e_table)
-{
- ETableCanvas *e_table_canvas;
-
- e_table_canvas = gtk_type_new (e_table_canvas_get_type ());
- e_table_canvas->e_table = e_table;
-
- return GNOME_CANVAS (e_table_canvas);
-}
-
-static void
-e_table_setup_table (ETable *e_table)
-{
- e_table->table_canvas = e_table_canvas_new (e_table);
-
- gtk_widget_show (GTK_WIDGET (e_table->table_canvas));
- gtk_table_attach (
- GTK_TABLE (e_table), GTK_WIDGET (e_table->table_canvas),
- 0, 1, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
-}
-
-void
-e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
- const char *cols_spec, const char *group_spec)
-{
- GTK_TABLE (e_table)->homogeneous = FALSE;
-
- gtk_table_resize (GTK_TABLE (e_table), 1, 2);
-
- e_table->full_header = full_header;
- gtk_object_ref (GTK_OBJECT (full_header));
-
- e_table->model = etm;
- gtk_object_ref (GTK_OBJECT (etm));
-
- e_table->header = e_table_make_header (e_table, full_header, cols_spec);
-
- e_table_setup_header (e_table);
- e_table_setup_table (e_table);
-
- e_table->group_spec = g_strdup (group_spec);
-
-}
-
-GtkWidget *
-e_table_new (ETableHeader *full_header, ETableModel *etm, const char *cols_spec, const char *group_spec)
-{
- ETable *e_table;
-
- e_table = gtk_type_new (e_table_get_type ());
-
- e_table_construct (e_table, full_header, etm, cols_spec, group_spec);
-
- return (GtkWidget *) e_table;
-}
-
-static void
-e_table_class_init (GtkObjectClass *object_class)
-{
- e_table_parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = et_destroy;
-}
-
-E_MAKE_TYPE(e_table, "ETable", ETable, e_table_class_init, e_table_init, PARENT_TYPE);
-
diff --git a/widgets/e-table/e-table.h b/widgets/e-table/e-table.h
deleted file mode 100644
index 63c131324f..0000000000
--- a/widgets/e-table/e-table.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef _E_TABLE_H_
-#define _E_TABLE_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gtk/gtktable.h>
-#include "e-table-model.h"
-#include "e-table-header.h"
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_TYPE (e_table_get_type ())
-#define E_TABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_TYPE, ETable))
-#define E_TABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_TYPE, ETableClass))
-#define E_IS_TABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_TYPE))
-#define E_IS_TABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_TYPE))
-
-typedef struct {
- GtkTable parent;
-
- ETableModel *model;
-
- ETableHeader *full_header, *header;
-
- GnomeCanvas *header_canvas, *table_canvas;
-
- GnomeCanvasItem *header_item, *root;
-
- guint draw_grid:1;
- guint draw_focus:1;
- guint spreadsheet:1;
-
- char *group_spec;
-} ETable;
-
-typedef struct {
- GtkTableClass parent_class;
-} ETableClass;
-
-GtkType e_table_get_type (void);
-void e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
- const char *cols_spec, const char *group_spec);
-GtkWidget *e_table_new (ETableHeader *full_header, ETableModel *etm,
- const char *cols_spec, const char *group_spec);
-
-
-END_GNOME_DECLS
-
- #endif /* _E_TABLE_H_ */
diff --git a/widgets/e-table/image1.png b/widgets/e-table/image1.png
deleted file mode 100644
index 8326ac241f..0000000000
--- a/widgets/e-table/image1.png
+++ /dev/null
Binary files differ
diff --git a/widgets/e-table/image2.png b/widgets/e-table/image2.png
deleted file mode 100644
index e6a4c75dbe..0000000000
--- a/widgets/e-table/image2.png
+++ /dev/null
Binary files differ
diff --git a/widgets/e-table/image3.png b/widgets/e-table/image3.png
deleted file mode 100644
index 50e16e8620..0000000000
--- a/widgets/e-table/image3.png
+++ /dev/null
Binary files differ
diff --git a/widgets/e-table/remove-col.xpm b/widgets/e-table/remove-col.xpm
deleted file mode 100644
index ff1024f0c9..0000000000
--- a/widgets/e-table/remove-col.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static char * remove_col_xpm[] = {
-"16 16 3 1",
-" c None",
-". c #000000",
-"+ c #FF0000",
-"... ...",
-".++. .++.",
-".+++. .+++.",
-" .+++. .+++. ",
-" .+++. .+++. ",
-" .+++..+++. ",
-" .++++++. ",
-" .++++. ",
-" .++++. ",
-" .++++++. ",
-" .+++..+++. ",
-" .+++. .+++. ",
-" .+++. .+++. ",
-".+++. .+++.",
-".++. .++.",
-"... ..."};
diff --git a/widgets/e-table/sample.table b/widgets/e-table/sample.table
deleted file mode 100644
index 45c8ff0691..0000000000
--- a/widgets/e-table/sample.table
+++ /dev/null
@@ -1,11 +0,0 @@
-Col1 Col2 Address Title Dorks
-c1.a c2.a a.a tit-1 DorkA
-c1.b c2.b a.b tit-2 DDork
-c1.c c2.c a.c tit-1 DorkB
-c1.d c2.d a.d tit-2 ADork
-c1.e c2.e a.e tit-1 DorkC
-c1.f c2.f a.f tit-2 UDork
-c1.g c2.g a.g tit-3 Dork---
-j k k tit-1 DorkA
-
-
diff --git a/widgets/e-table/table-test.c b/widgets/e-table/table-test.c
deleted file mode 100644
index e18f38c5ec..0000000000
--- a/widgets/e-table/table-test.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Test code for the ETable package
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <gnome.h>
-#include "e-util/e-cursors.h"
-#include "table-test.h"
-
-int
-main (int argc, char *argv [])
-{
-
- if (isatty (0)){
- int fd;
-
- close (0);
- fd = open ("sample.table", O_RDONLY);
- if (fd == -1){
- fprintf (stderr, "Could not find sample.table, try feeding a table on stdin");
- exit (1);
- }
- dup2 (fd, 0);
- }
-
- gnome_init ("TableTest", "TableTest", argc, argv);
- e_cursors_init ();
-
- table_browser_test ();
- multi_cols_test ();
- check_test ();
- e_table_test ();
-
- gtk_main ();
-
- e_cursors_shutdown ();
- return 0;
-}
diff --git a/widgets/e-table/table-test.h b/widgets/e-table/table-test.h
deleted file mode 100644
index ad8cfcc083..0000000000
--- a/widgets/e-table/table-test.h
+++ /dev/null
@@ -1,4 +0,0 @@
-void table_browser_test (void);
-void multi_cols_test (void);
-void check_test (void);
-void e_table_test (void);
diff --git a/widgets/e-table/test-check.c b/widgets/e-table/test-check.c
deleted file mode 100644
index 8cc5f6834e..0000000000
--- a/widgets/e-table/test-check.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Test code for the ETable package
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <gnome.h>
-#include "e-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-util/e-cursors.h"
-#include "e-cell-text.h"
-#include "e-cell-checkbox.h"
-
-#include "table-test.h"
-
-#define LINES 4
-
-static struct {
- int value;
- char *string;
-} my_table [LINES] = {
- { 0, "Buy food" },
- { 1, "Breathe " },
- { 0, "Cancel gdb session with shrink" },
- { 1, "Make screenshots" },
-};
-/*
- * ETableSimple callbacks
- */
-static int
-col_count (ETableModel *etc, void *data)
-{
- return 2;
-}
-
-static int
-row_count (ETableModel *etc, void *data)
-{
- return LINES;
-}
-
-static void *
-value_at (ETableModel *etc, int col, int row, void *data)
-{
- g_assert (col < 2);
- g_assert (row < LINES);
-
- if (col == 0)
- return GINT_TO_POINTER (my_table [row].value);
- else
- return my_table [row].string;
-
-}
-
-static void
-set_value_at (ETableModel *etc, int col, int row, const void *val, void *data)
-{
- g_assert (col < 2);
- g_assert (row < LINES);
-
- if (col == 0){
- my_table [row].value = GPOINTER_TO_INT (val);
- printf ("Value at %d,%d set to %d\n", col, row, GPOINTER_TO_INT (val));
- } else {
- my_table [row].string = g_strdup (val);
- printf ("Value at %d,%d set to %s\n", col, row, (char *) val);
- }
-}
-
-static gboolean
-is_cell_editable (ETableModel *etc, int col, int row, void *data)
-{
- return TRUE;
-}
-
-static void
-set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc)
-{
- gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height);
-}
-
-void
-check_test (void)
-{
- GtkWidget *canvas, *window;
- ETableModel *e_table_model;
- ETableHeader *e_table_header;
- ETableCol *col_0, *col_1;
- ECell *cell_left_just, *cell_image_check;
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- e_table_model = e_table_simple_new (
- col_count, row_count, value_at,
- set_value_at, is_cell_editable, NULL);
-
- /*
- * Header
- */
- e_table_header = e_table_header_new ();
-
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- cell_image_check = e_cell_checkbox_new ();
- col_0 = e_table_col_new (0, "", 18, 18, cell_image_check, g_int_equal, TRUE);
- e_table_header_add_column (e_table_header, col_0, 0);
-
- col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
- e_table_header_add_column (e_table_header, col_1, 1);
-
- /*
- * GUI
- */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- canvas = gnome_canvas_new ();
-
- gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate",
- GTK_SIGNAL_FUNC (set_canvas_size), NULL);
-
- gtk_container_add (GTK_CONTAINER (window), canvas);
- gtk_widget_show_all (window);
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_header_item_get_type (),
- "ETableHeader", e_table_header,
- "x", 0,
- "y", 0,
- NULL);
-
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_item_get_type (),
- "ETableHeader", e_table_header,
- "ETableModel", e_table_model,
- "x", (double) 0,
- "y", (double) 30,
- "drawgrid", TRUE,
- "drawfocus", TRUE,
- "spreadsheet", TRUE,
- NULL);
-
-}
-
-
-
-
-
diff --git a/widgets/e-table/test-cols.c b/widgets/e-table/test-cols.c
deleted file mode 100644
index 288e2bd408..0000000000
--- a/widgets/e-table/test-cols.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Test code for the ETable package
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <gnome.h>
-#include "e-util/e-cursors.h"
-#include "e-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-cell-text.h"
-#include "e-cell-toggle.h"
-
-#include "table-test.h"
-
-#define LINES 4
-
-static struct {
- int value;
- char *string;
-} my_table [LINES] = {
- { 0, "You are not" },
- { 1, "A beautiful and unique " },
- { 0, "Snowflake" },
- { 2, "You are not your wallet" },
-};
-/*
- * ETableSimple callbacks
- */
-static int
-col_count (ETableModel *etc, void *data)
-{
- return 2;
-}
-
-static int
-row_count (ETableModel *etc, void *data)
-{
- return LINES;
-}
-
-static void *
-value_at (ETableModel *etc, int col, int row, void *data)
-{
- g_assert (col < 2);
- g_assert (row < LINES);
-
- if (col == 0)
- return GINT_TO_POINTER (my_table [row].value);
- else
- return my_table [row].string;
-
-}
-
-static void
-set_value_at (ETableModel *etc, int col, int row, const void *val, void *data)
-{
- g_assert (col < 2);
- g_assert (row < LINES);
-
- if (col == 0){
- my_table [row].value = GPOINTER_TO_INT (val);
- printf ("Value at %d,%d set to %d\n", col, row, GPOINTER_TO_INT (val));
- } else {
- my_table [row].string = g_strdup (val);
- printf ("Value at %d,%d set to %s\n", col, row, (char *) val);
- }
-}
-
-static gboolean
-is_cell_editable (ETableModel *etc, int col, int row, void *data)
-{
- return TRUE;
-}
-
-static void
-set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc)
-{
- gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height);
-}
-
-void
-multi_cols_test (void)
-{
- GtkWidget *canvas, *window;
- ETableModel *e_table_model;
- ETableHeader *e_table_header, *e_table_header_multiple;
- ETableCol *col_0, *col_1;
- ECell *cell_left_just, *cell_image_toggle;
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- e_table_model = e_table_simple_new (
- col_count, row_count, value_at,
- set_value_at, is_cell_editable, NULL);
-
- /*
- * Header
- */
- e_table_header = e_table_header_new ();
-
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- {
- GdkPixbuf **images = g_new (GdkPixbuf *, 3);
- int i;
-
- images [0] = gdk_pixbuf_new_from_file ("image1.png");
- images [1] = gdk_pixbuf_new_from_file ("image2.png");
- images [2] = gdk_pixbuf_new_from_file ("image3.png");
-
- cell_image_toggle = e_cell_toggle_new (0, 3, images);
-
- for (i = 0; i < 3; i++)
- gdk_pixbuf_unref (images [i]);
-
- g_free (images);
- }
-
- col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
- e_table_header_add_column (e_table_header, col_1, 0);
-
- col_0 = e_table_col_new (0, "A", 48, 48, cell_image_toggle, g_int_equal, TRUE);
- e_table_header_add_column (e_table_header, col_0, 1);
-
- /*
- * Second test
- */
- e_table_header_multiple = e_table_header_new ();
- e_table_header_add_column (e_table_header_multiple, col_0, 0);
- e_table_header_add_column (e_table_header_multiple, col_1, 1);
- e_table_header_add_column (e_table_header_multiple, col_1, 2);
-
- /*
- * GUI
- */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- canvas = gnome_canvas_new ();
-
- gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate",
- GTK_SIGNAL_FUNC (set_canvas_size), NULL);
-
- gtk_container_add (GTK_CONTAINER (window), canvas);
- gtk_widget_show_all (window);
-
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_header_item_get_type (),
- "ETableHeader", e_table_header,
- "x", 0,
- "y", 0,
- NULL);
-
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_item_get_type (),
- "ETableHeader", e_table_header,
- "ETableModel", e_table_model,
- "x", (double) 0,
- "y", (double) 30,
- "drawgrid", TRUE,
- "drawfocus", TRUE,
- "spreadsheet", TRUE,
- NULL);
-
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_header_item_get_type (),
- "ETableHeader", e_table_header_multiple,
- "x", 300,
- "y", 0,
- NULL);
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_item_get_type (),
- "ETableHeader", e_table_header_multiple,
- "ETableModel", e_table_model,
- "x", (double) 300,
- "y", (double) 30,
- "drawgrid", TRUE,
- "drawfocus", TRUE,
- "spreadsheet", TRUE,
- NULL);
-
-}
-
-
-
-
-
diff --git a/widgets/e-table/test-table.c b/widgets/e-table/test-table.c
deleted file mode 100644
index 053f81cfa6..0000000000
--- a/widgets/e-table/test-table.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Test code for the ETable package
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <gnome.h>
-#include "e-util/e-cursors.h"
-#include "e-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-cell-text.h"
-#include "e-table.h"
-
-#include "table-test.h"
-
-char buffer [1024];
-char **column_labels;
-char ***table_data;
-int cols = 0;
-int lines = 0;
-int lines_alloc = 0;
-
-static void
-parse_headers ()
-{
- char *p, *s;
- int in_value = 0, i;
-
- fgets (buffer, sizeof (buffer)-1, stdin);
-
- for (p = buffer; *p; p++){
- if (*p == ' ' || *p == '\t'){
- if (in_value){
- cols++;
- in_value = 0;
- }
- } else
- in_value = 1;
- }
- if (in_value)
- cols++;
-
- if (!cols){
- fprintf (stderr, "No columns in first row\n");
- exit (1);
- }
-
- column_labels = g_new0 (char *, cols);
-
- p = buffer;
- for (i = 0; (s = strtok (p, " \t")) != NULL; i++){
- column_labels [i] = g_strdup (s);
- p = NULL;
- }
-
- printf ("%d headers:\n", cols);
- for (i = 0; i < cols; i++){
- printf ("header %d: %s\n", i, column_labels [i]);
- }
-}
-
-static char **
-load_line (char *buffer, int cols)
-{
- char **line = g_new0 (char *, cols);
- char *p;
- int i;
-
- for (i = 0; i < cols; i++){
- p = strtok (buffer, " \t\n");
- if (p == NULL){
- for (; i < cols; i++)
- line [i] = g_strdup ("");
- return line;
- } else
- line [i] = g_strdup (p);
- buffer = NULL;
- }
- return line;
-}
-
-static void
-append_line (char **line)
-{
- if (lines <= lines_alloc){
- lines_alloc = lines + 50;
- table_data = g_renew (char **, table_data, lines_alloc);
- }
- table_data [lines] = line;
- lines++;
-}
-
-static void
-load_data ()
-{
- int i;
-
- {
- static int loaded;
-
- if (loaded)
- return;
-
- loaded = TRUE;
- }
-
-
- parse_headers ();
-
- while (fgets (buffer, sizeof (buffer)-1, stdin) != NULL){
- char **line;
-
- if (buffer [0] == '\n')
- continue;
- line = load_line (buffer, cols);
- append_line (line);
- }
-
- for (i = 0; i < lines; i++){
- int j;
-
- printf ("Line %d: ", i);
- for (j = 0; j < cols; j++)
- printf ("[%s] ", table_data [i][j]);
- printf ("\n");
- }
-}
-
-/*
- * ETableSimple callbacks
- */
-static int
-col_count (ETableModel *etc, void *data)
-{
- return cols;
-}
-
-static int
-row_count (ETableModel *etc, void *data)
-{
- return lines;
-}
-
-static void *
-value_at (ETableModel *etc, int col, int row, void *data)
-{
- g_assert (col < cols);
- g_assert (row < lines);
-
- return (void *) table_data [row][col];
-}
-
-static void
-set_value_at (ETableModel *etc, int col, int row, const void *val, void *data)
-{
- g_assert (col < cols);
- g_assert (row < lines);
-
- g_free (table_data [row][col]);
- table_data [row][col] = g_strdup (val);
-
- printf ("Value at %d,%d set to %s\n", col, row, (char *) val);
-}
-
-static gboolean
-is_cell_editable (ETableModel *etc, int col, int row, void *data)
-{
- return TRUE;
-}
-
-static void
-set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc)
-{
- gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height);
-}
-
-void
-table_browser_test (void)
-{
- GtkWidget *canvas, *window;
- ETableModel *e_table_model;
- ETableHeader *e_table_header;
- ECell *cell_left_just;
- GnomeCanvasItem *group;
- int i;
-
- load_data ();
-
- /*
- * Data model
- */
- e_table_model = e_table_simple_new (
- col_count, row_count, value_at,
- set_value_at, is_cell_editable, NULL);
-
- /*
- * Header
- */
- e_table_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- for (i = 0; i < cols; i++){
- ETableCol *ecol = e_table_col_new (
- i, column_labels [i],
- 80, 20, cell_left_just,
- g_str_equal, TRUE);
-
- e_table_header_add_column (e_table_header, ecol, i);
- }
-
- /*
- * Setup GUI
- */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- canvas = gnome_canvas_new ();
-
- gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate",
- GTK_SIGNAL_FUNC (set_canvas_size), NULL);
-
- gtk_container_add (GTK_CONTAINER (window), canvas);
- gtk_widget_show_all (window);
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_header_item_get_type (),
- "ETableHeader", e_table_header,
- "x", 0,
- "y", 0,
- NULL);
-
- group = gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- gnome_canvas_group_get_type (),
- "x", 30.0,
- "y", 30.0,
- NULL);
-
- gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (group),
- e_table_item_get_type (),
- "ETableHeader", e_table_header,
- "ETableModel", e_table_model,
- "x", (double) 0,
- "y", (double) 0,
- "drawgrid", TRUE,
- "drawfocus", TRUE,
- "spreadsheet", TRUE,
- NULL);
-}
-
-static void
-do_e_table_demo (const char *col_spec, const char *group_spec)
-{
- GtkWidget *e_table, *window;
- ETableModel *e_table_model;
- ECell *cell_left_just;
- ETableHeader *full_header;
- int i;
-
- /*
- * Data model
- */
- e_table_model = e_table_simple_new (
- col_count, row_count, value_at,
- set_value_at, is_cell_editable, NULL);
-
- full_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- for (i = 0; i < cols; i++){
- ETableCol *ecol = e_table_col_new (
- i, column_labels [i],
- 80, 20, cell_left_just,
- g_str_equal, TRUE);
-
- e_table_header_add_column (full_header, ecol, i);
- }
-
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- e_table = e_table_new (full_header, e_table_model, col_spec, group_spec);
-
- gtk_container_add (GTK_CONTAINER (window), e_table);
-
- gtk_widget_set_usize (window, 200, 200);
- gtk_widget_show (e_table);
- gtk_widget_show (window);
-}
-
-void
-e_table_test (void)
-{
- load_data ();
-
- if (getenv ("DO")){
- do_e_table_demo ("0,1,2,3,4", NULL);
- do_e_table_demo ("0,1,2,3,4", "3,4");
- }
- do_e_table_demo ("0,1,2,3,4", "3");
-}
diff --git a/widgets/e-table/test.c b/widgets/e-table/test.c
deleted file mode 100644
index 0eece34467..0000000000
--- a/widgets/e-table/test.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <config.h>
-#include "e-table-simple.h"
-
-struct {
- char *str;
- int val;
-} data [] = {
- { "Miguel", 10 },
- { "Nat", 20 },
- { NULL, 0 },
-};
-
-main ()
-{
-
-}
-
diff --git a/widgets/meeting-time-sel/.cvsignore b/widgets/meeting-time-sel/.cvsignore
deleted file mode 100644
index 21ce3ebb95..0000000000
--- a/widgets/meeting-time-sel/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
-test-meeting-time-selector
diff --git a/widgets/meeting-time-sel/LICENSE b/widgets/meeting-time-sel/LICENSE
deleted file mode 100644
index 9babf4395f..0000000000
--- a/widgets/meeting-time-sel/LICENSE
+++ /dev/null
@@ -1 +0,0 @@
-This code is licensed under the terms of the GNU GPL
diff --git a/widgets/meeting-time-sel/Makefile.am b/widgets/meeting-time-sel/Makefile.am
deleted file mode 100644
index fdf6e90b67..0000000000
--- a/widgets/meeting-time-sel/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-
-INCLUDES = \
- $(GNOME_INCLUDEDIR)
-
-noinst_LIBRARIES = \
- libevolutionmtsel.a
-
-libevolutionmtsel_a_SOURCES = \
- e-meeting-time-sel.c \
- e-meeting-time-sel.h \
- e-meeting-time-sel-item.c \
- e-meeting-time-sel-item.h \
- e-meeting-time-sel-list-item.c \
- e-meeting-time-sel-list-item.h
-
-noinst_PROGRAMS = \
- test-meeting-time-selector
-
-test_meeting_time_selector_SOURCES = \
- test-meeting-time-sel.c
-
-test_meeting_time_selector_LDADD = \
- libevolutionmtsel.a
-
-test_meeting_time_selector_LDFLAGS = `gnome-config --libs gnomeui`
-
-EXTRA_DIST = \
- e-meeting-time-sel-mail.xpm \
- e-meeting-time-sel-no-mail.xpm
-
diff --git a/widgets/meeting-time-sel/e-meeting-time-sel-item.c b/widgets/meeting-time-sel/e-meeting-time-sel-item.c
deleted file mode 100644
index cb716d6f08..0000000000
--- a/widgets/meeting-time-sel/e-meeting-time-sel-item.c
+++ /dev/null
@@ -1,924 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * EMeetingTimeSelectorItem - A GnomeCanvasItem which is used for both the main
- * display canvas and the top display (with the dates, times & All Attendees).
- * I didn't make these separate GnomeCanvasItems since they share a lot of
- * code.
- */
-
-#include <config.h>
-#include <time.h>
-#include "e-meeting-time-sel-item.h"
-#include "e-meeting-time-sel.h"
-
-/* Initially the grid lines were drawn at the bottom of cells, but this didn't
- line up well with the GtkEntry widgets, which in the default theme draw a
- black shadow line across the top. So I've switched our code to draw the
- lines across the top of cells. */
-#define E_MEETING_TIME_SELECTOR_DRAW_GRID_LINES_AT_BOTTOM 0
-
-static void e_meeting_time_selector_item_class_init (EMeetingTimeSelectorItemClass *mts_item_class);
-static void e_meeting_time_selector_item_init (EMeetingTimeSelectorItem *mts_item);
-static void e_meeting_time_selector_item_destroy (GtkObject *object);
-
-static void e_meeting_time_selector_item_set_arg (GtkObject *o, GtkArg *arg,
- guint arg_id);
-static void e_meeting_time_selector_item_realize (GnomeCanvasItem *item);
-static void e_meeting_time_selector_item_unrealize (GnomeCanvasItem *item);
-static void e_meeting_time_selector_item_update (GnomeCanvasItem *item,
- double *affine,
- ArtSVP *clip_path, int flags);
-static void e_meeting_time_selector_item_draw (GnomeCanvasItem *item,
- GdkDrawable *drawable,
- int x, int y,
- int width, int height);
-static double e_meeting_time_selector_item_point (GnomeCanvasItem *item,
- double x, double y,
- int cx, int cy,
- GnomeCanvasItem **actual_item);
-static gint e_meeting_time_selector_item_event (GnomeCanvasItem *item,
- GdkEvent *event);
-static gint e_meeting_time_selector_item_button_press (EMeetingTimeSelectorItem *mts_item,
- GdkEvent *event);
-static gint e_meeting_time_selector_item_button_release (EMeetingTimeSelectorItem *mts_item,
- GdkEvent *event);
-static gint e_meeting_time_selector_item_motion_notify (EMeetingTimeSelectorItem *mts_item,
- GdkEvent *event);
-
-static void e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item,
- GdkDrawable *drawable,
- GDate *date,
- int x, int scroll_y,
- int width, int height);
-static void e_meeting_time_selector_item_paint_all_attendees_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, GDate *date, int x, int y, int width, int height);
-static void e_meeting_time_selector_item_paint_day (EMeetingTimeSelectorItem *mts_item,
- GdkDrawable *drawable,
- GDate *date,
- int x, int scroll_y,
- int width, int height);
-static void e_meeting_time_selector_item_paint_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, GDate *date, int x, int scroll_y, int width, int height);
-static gint e_meeting_time_selector_item_find_first_busy_period (EMeetingTimeSelectorItem *mts_item, GDate *date, gint row);
-static void e_meeting_time_selector_item_paint_attendee_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, int row, int x, int y, int width, int first_period, EMeetingTimeSelectorBusyType busy_type);
-
-static EMeetingTimeSelectorPosition e_meeting_time_selector_item_get_drag_position (EMeetingTimeSelectorItem *mts_item, gint x, gint y);
-
-static GnomeCanvasItemClass *parent_class;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_MEETING_TIME_SELECTOR
-};
-
-
-GtkType
-e_meeting_time_selector_item_get_type (void)
-{
- static GtkType e_meeting_time_selector_item_type = 0;
-
- if (!e_meeting_time_selector_item_type) {
- GtkTypeInfo e_meeting_time_selector_item_info = {
- "EMeetingTimeSelectorItem",
- sizeof (EMeetingTimeSelectorItem),
- sizeof (EMeetingTimeSelectorItemClass),
- (GtkClassInitFunc) e_meeting_time_selector_item_class_init,
- (GtkObjectInitFunc) e_meeting_time_selector_item_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- e_meeting_time_selector_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &e_meeting_time_selector_item_info);
- }
-
- return e_meeting_time_selector_item_type;
-}
-
-
-static void
-e_meeting_time_selector_item_class_init (EMeetingTimeSelectorItemClass *mts_item_class)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- parent_class = gtk_type_class (gnome_canvas_item_get_type());
-
- object_class = (GtkObjectClass *) mts_item_class;
- item_class = (GnomeCanvasItemClass *) mts_item_class;
-
- gtk_object_add_arg_type ("EMeetingTimeSelectorItem::meeting_time_selector",
- GTK_TYPE_POINTER, GTK_ARG_WRITABLE,
- ARG_MEETING_TIME_SELECTOR);
-
- object_class->destroy = e_meeting_time_selector_item_destroy;
- object_class->set_arg = e_meeting_time_selector_item_set_arg;
-
- /* GnomeCanvasItem method overrides */
- item_class->realize = e_meeting_time_selector_item_realize;
- item_class->unrealize = e_meeting_time_selector_item_unrealize;
- item_class->update = e_meeting_time_selector_item_update;
- item_class->draw = e_meeting_time_selector_item_draw;
- item_class->point = e_meeting_time_selector_item_point;
- item_class->event = e_meeting_time_selector_item_event;
-}
-
-
-static void
-e_meeting_time_selector_item_init (EMeetingTimeSelectorItem *mts_item)
-{
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (mts_item);
-
- mts_item->mts = NULL;
-
- mts_item->main_gc = NULL;
-
- /* Create the cursors. */
- mts_item->normal_cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
- mts_item->resize_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
- mts_item->last_cursor_set = NULL;
-
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = 0;
- item->y2 = 0;
-}
-
-
-static void
-e_meeting_time_selector_item_destroy (GtkObject *object)
-{
- EMeetingTimeSelectorItem *mts_item;
-
- mts_item = E_MEETING_TIME_SELECTOR_ITEM (object);
-
- gdk_cursor_destroy (mts_item->normal_cursor);
- gdk_cursor_destroy (mts_item->resize_cursor);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (*GTK_OBJECT_CLASS (parent_class)->destroy)(object);
-}
-
-
-static void
-e_meeting_time_selector_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EMeetingTimeSelectorItem *mts_item;
-
- item = GNOME_CANVAS_ITEM (o);
- mts_item = E_MEETING_TIME_SELECTOR_ITEM (o);
-
- switch (arg_id){
- case ARG_MEETING_TIME_SELECTOR:
- mts_item->mts = GTK_VALUE_POINTER (*arg);
- break;
- }
-}
-
-
-static void
-e_meeting_time_selector_item_realize (GnomeCanvasItem *item)
-{
- GnomeCanvas *canvas;
- GdkWindow *window;
- EMeetingTimeSelectorItem *mts_item;
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize)
- (*GNOME_CANVAS_ITEM_CLASS (parent_class)->realize)(item);
-
- mts_item = E_MEETING_TIME_SELECTOR_ITEM (item);
-
- canvas = item->canvas;
- window = GTK_WIDGET (canvas)->window;
-
- mts_item->main_gc = gdk_gc_new (window);
-}
-
-
-static void
-e_meeting_time_selector_item_unrealize (GnomeCanvasItem *item)
-{
- EMeetingTimeSelectorItem *mts_item;
-
- mts_item = E_MEETING_TIME_SELECTOR_ITEM (item);
-
- gdk_gc_unref (mts_item->main_gc);
- mts_item->main_gc = NULL;
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize)
- (*GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize)(item);
-}
-
-
-static void
-e_meeting_time_selector_item_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update)
- (* GNOME_CANVAS_ITEM_CLASS (parent_class)->update) (item, affine, clip_path, flags);
-
- /* The grid covers the entire canvas area. */
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = INT_MAX;
- item->y2 = INT_MAX;
-}
-
-
-/*
- * DRAWING ROUTINES - functions to paint the canvas item.
- */
-
-static void
-e_meeting_time_selector_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
-{
- EMeetingTimeSelector *mts;
- EMeetingTimeSelectorItem *mts_item;
- EMeetingTimeSelectorAttendee *attendee;
- gint day_x, meeting_start_x, meeting_end_x, bar_y, bar_height;
- gint row, row_y;
- GDate date, last_date, current_date;
- gboolean is_display_top, show_meeting_time;
- GdkGC *gc;
-
- mts_item = E_MEETING_TIME_SELECTOR_ITEM (item);
- mts = mts_item->mts;
- g_return_if_fail (mts != NULL);
- gc = mts_item->main_gc;
-
- is_display_top = (GTK_WIDGET (item->canvas) == mts->display_top)
- ? TRUE : FALSE;
-
- /* Calculate the first and last visible days and positions. */
- e_meeting_time_selector_calculate_day_and_position (mts, x,
- &date, &day_x);
- e_meeting_time_selector_calculate_day_and_position (mts, x + width,
- &last_date, NULL);
-
- /* For the top display draw the 'All Attendees' row background. */
- if (is_display_top) {
- gdk_gc_set_foreground (gc, &mts->all_attendees_bg_color);
- gdk_draw_rectangle (drawable, gc, TRUE,
- 0, mts->row_height * 2 - y,
- width, mts->row_height);
- } else {
- gdk_gc_set_foreground (gc, &mts->bg_color);
- gdk_draw_rectangle (drawable, gc, TRUE, 0, 0, width, height);
- }
-
- /* Calculate the x coordinates of the meeting time. */
- show_meeting_time = e_meeting_time_selector_get_meeting_time_positions (mts, &meeting_start_x, &meeting_end_x);
-
- /* Draw the meeting time background. */
- if (show_meeting_time
- && (meeting_end_x - 1 >= x) && (meeting_start_x + 1 < x + width)
- && (meeting_end_x - meeting_start_x > 2)) {
- gdk_gc_set_foreground (gc, &mts->meeting_time_bg_color);
- if (is_display_top)
- gdk_draw_rectangle (drawable, gc, TRUE,
- meeting_start_x + 1 - x, mts->row_height * 2 - y,
- meeting_end_x - meeting_start_x - 2, height);
- else
- gdk_draw_rectangle (drawable, gc, TRUE,
- meeting_start_x + 1 - x, 0,
- meeting_end_x - meeting_start_x - 2, height);
- }
-
- /* For the main display draw the stipple background for attendee's
- that have no calendar information. */
- if (!is_display_top) {
- gdk_gc_set_foreground (gc, &mts->grid_color);
- gdk_gc_set_background (gc, &mts->stipple_bg_color);
- gdk_gc_set_stipple (gc, mts->stipple);
- gnome_canvas_set_stipple_origin (item->canvas, gc);
- gdk_gc_set_fill (gc, GDK_OPAQUE_STIPPLED);
- row = y / mts->row_height;
- row_y = row * mts->row_height - y;
- while (row < mts->attendees->len && row_y < height) {
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
- if (!attendee->has_calendar_info) {
- gdk_draw_rectangle (drawable, gc, TRUE,
- 0, row_y,
- width, mts->row_height);
- }
- row++;
- row_y += mts->row_height;
- }
- gdk_gc_set_fill (gc, GDK_SOLID);
- }
-
- /* Now paint the visible days one by one. */
- current_date = date;
- for (;;) {
- /* Currently we use the same GnomeCanvasItem class for the
- top display and the main display. We may use separate
- classes in future if necessary. */
- if (is_display_top)
- e_meeting_time_selector_item_paint_day_top (mts_item, drawable, &current_date, day_x, y, width, height);
- else
- e_meeting_time_selector_item_paint_day (mts_item, drawable, &current_date, day_x, y, width, height);
-
- day_x += mts_item->mts->day_width;
- if (g_date_compare (&current_date, &last_date) == 0)
- break;
- g_date_add_days (&current_date, 1);
- }
-
- /* Draw the busy periods. */
- if (is_display_top)
- e_meeting_time_selector_item_paint_all_attendees_busy_periods (mts_item, drawable, &date, x, y, width, height);
- else
- e_meeting_time_selector_item_paint_busy_periods (mts_item, drawable, &date, x, y, width, height);
-
-
- /* Draw the currently-selected meeting time vertical bars. */
- if (show_meeting_time) {
- if (is_display_top) {
- bar_y = mts->row_height * 2 - y;
- bar_height = mts->row_height;
- } else {
- bar_y = 0;
- bar_height = height;
- }
-
- gdk_gc_set_foreground (gc, &mts->grid_color);
-
- if ((meeting_start_x + 2 >= x)
- && (meeting_start_x - 2 < x + width)) {
- gdk_draw_rectangle (drawable, gc, TRUE,
- meeting_start_x - 2 - x, bar_y,
- 5, bar_height);
- }
-
- if ((meeting_end_x + 2 >= x)
- && (meeting_end_x - 2 < x + width)) {
- gdk_draw_rectangle (drawable, gc, TRUE,
- meeting_end_x - 2 - x, bar_y,
- 5, bar_height);
- }
- }
-}
-
-
-static void
-e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item,
- GdkDrawable *drawable, GDate *date,
- int x, int scroll_y,
- int width, int height)
-{
- EMeetingTimeSelector *mts;
- GdkGC *gc;
- GdkFont *font;
- gint y, grid_x;
- gchar buffer[128];
- gint hour, hour_x, hour_y;
- GdkRectangle clip_rect;
-
- mts = mts_item->mts;
- gc = mts_item->main_gc;
-
- gdk_gc_set_foreground (gc, &mts->grid_color);
-
- /* Draw the horizontal lines. */
- y = mts->row_height - 1 - scroll_y;
- gdk_draw_line (drawable, gc, x, y, x + mts->day_width - 1, y);
- gdk_gc_set_foreground (gc, &mts->grid_shadow_color);
- gdk_draw_line (drawable, gc, x, y + 1, x + mts->day_width - 1, y + 1);
- gdk_gc_set_foreground (gc, &mts->grid_color);
- y += mts->row_height;
- gdk_draw_line (drawable, gc, x, y, x + mts->day_width - 1, y);
- y += mts->row_height;
- gdk_draw_line (drawable, gc, x, y, x + mts->day_width - 1, y);
-
-
- /* Draw the vertical grid lines. */
- for (grid_x = mts->col_width - 1;
- grid_x < mts->day_width - mts->col_width;
- grid_x += mts->col_width) {
- gdk_draw_line (drawable, gc,
- x + grid_x, mts->row_height * 2 - 4,
- x + grid_x, height);
- }
- grid_x = mts->day_width - 2;
- gdk_draw_line (drawable, gc, x + grid_x, 0, x + grid_x, height);
- grid_x++;
- gdk_draw_line (drawable, gc, x + grid_x, 0, x + grid_x, height);
-
- /* Draw the date. Set a clipping rectangle so we don't draw over the
- next day. */
- font = GTK_WIDGET (mts)->style->font;
- if (mts->date_format == E_MEETING_TIME_SELECTOR_DATE_FULL)
- g_date_strftime (buffer, 128, "%A, %B %d, %Y", date);
- else if (mts->date_format == E_MEETING_TIME_SELECTOR_DATE_ABBREVIATED_DAY)
- g_date_strftime (buffer, 128, "%a %x", date);
- else
- g_date_strftime (buffer, 128, "%x", date);
- clip_rect.x = x;
- clip_rect.y = -scroll_y;
- clip_rect.width = mts->day_width - 2;
- clip_rect.height = mts->row_height - 2;
- gdk_gc_set_clip_rectangle (gc, &clip_rect);
- gdk_draw_string (drawable, font, gc,
- x + 4, 4 + font->ascent - scroll_y, buffer);
- gdk_gc_set_clip_rectangle (gc, NULL);
-
- /* Draw the hours. */
- hour = mts->first_hour_shown + (mts->zoomed_out ? 3 : 1);
- hour_x = x + mts->col_width;
- hour_y = mts->row_height + 4 + font->ascent - scroll_y;
- while (hour < mts->last_hour_shown) {
- gdk_draw_string (drawable, font, gc,
- hour_x - (mts->hour_widths[hour] / 2),
- hour_y, EMeetingTimeSelectorHours[hour]);
-
- hour += mts->zoomed_out ? 3 : 1;
- hour_x += mts->col_width;
- }
-}
-
-
-/* This paints the colored bars representing busy periods for the combined
- list of attendees. For now we just paint the bars for each attendee of
- each other. If we want to speed it up we could optimise it later. */
-static void
-e_meeting_time_selector_item_paint_all_attendees_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, GDate *date, int x, int scroll_y, int width, int height)
-{
- EMeetingTimeSelector *mts;
- EMeetingTimeSelectorBusyType busy_type;
- gint row, y;
- GdkGC *gc;
- gint *first_periods;
-
- mts = mts_item->mts;
- gc = mts_item->main_gc;
-
- /* Calculate the y coordinate to paint the row at in the drawable. */
- y = 2 * mts->row_height - scroll_y - 1;
-
- /* Get the first visible busy periods for all the attendees. */
- first_periods = g_new (gint, mts->attendees->len);
- for (row = 0; row < mts->attendees->len; row++) {
- first_periods[row] = e_meeting_time_selector_item_find_first_busy_period (mts_item, date, row);
- }
-
- for (busy_type = 0;
- busy_type < E_MEETING_TIME_SELECTOR_BUSY_LAST;
- busy_type++) {
- gdk_gc_set_foreground (gc, &mts->busy_colors[busy_type]);
- for (row = 0; row < mts->attendees->len; row++) {
- if (first_periods[row] == -1)
- continue;
- e_meeting_time_selector_item_paint_attendee_busy_periods (mts_item, drawable, x, y, width, row, first_periods[row], busy_type);
- }
- }
-
- g_free (first_periods);
-}
-
-
-static void
-e_meeting_time_selector_item_paint_day (EMeetingTimeSelectorItem *mts_item,
- GdkDrawable *drawable, GDate *date,
- int x, int scroll_y,
- int width, int height)
-{
- EMeetingTimeSelector *mts;
- GdkGC *gc;
- gint grid_x, grid_y, attendee_index, unused_y;
-
- mts = mts_item->mts;
- gc = mts_item->main_gc;
-
- /* Draw the grid lines. The grid lines around unused rows are drawn in
- a different color. */
-
- /* Draw the horizontal grid lines. */
- attendee_index = scroll_y / mts->row_height;
-#if E_MEETING_TIME_SELECTOR_DRAW_GRID_LINES_AT_BOTTOM
- for (grid_y = mts->row_height - 1 - (scroll_y % mts->row_height);
-#else
- for (grid_y = - (scroll_y % mts->row_height);
-#endif
- grid_y < height;
- grid_y += mts->row_height)
- {
- if (attendee_index < mts->attendees->len) {
- gdk_gc_set_foreground (gc, &mts->grid_color);
- gdk_draw_line (drawable, gc, 0, grid_y,
- width, grid_y);
- } else {
- gdk_gc_set_foreground (gc, &mts->grid_unused_color);
- gdk_draw_line (drawable, gc, 0, grid_y,
- width, grid_y);
- }
- attendee_index++;
- }
-
- /* Draw the vertical grid lines. */
- unused_y = (mts->attendees->len * mts->row_height) - scroll_y;
- if (unused_y >= 0) {
- gdk_gc_set_foreground (gc, &mts->grid_color);
- for (grid_x = mts->col_width - 1;
- grid_x < mts->day_width - mts->col_width;
- grid_x += mts->col_width)
- {
- gdk_draw_line (drawable, gc,
- x + grid_x, 0,
- x + grid_x, unused_y - 1);
- }
- gdk_draw_rectangle (drawable, gc, TRUE,
- x + mts->day_width - 2, 0,
- 2, unused_y);
- }
-
- if (unused_y < height) {
- gdk_gc_set_foreground (gc, &mts->grid_unused_color);
- for (grid_x = mts->col_width - 1;
- grid_x < mts->day_width - mts->col_width;
- grid_x += mts->col_width)
- {
- gdk_draw_line (drawable, gc,
- x + grid_x, unused_y,
- x + grid_x, height);
- }
- gdk_draw_rectangle (drawable, gc, TRUE,
- x + mts->day_width - 2, unused_y,
- 2, height - unused_y);
- }
-
-
-}
-
-
-/* This paints the colored bars representing busy periods for the individual
- attendees. */
-static void
-e_meeting_time_selector_item_paint_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, GDate *date, int x, int scroll_y, int width, int height)
-{
- EMeetingTimeSelector *mts;
- EMeetingTimeSelectorBusyType busy_type;
- gint row, y, first_period;
- GdkGC *gc;
-
- mts = mts_item->mts;
- gc = mts_item->main_gc;
-
- /* Calculate the first visible attendee row. */
- row = scroll_y / mts->row_height;
-
- /* Calculate the y coordinate to paint the row at in the drawable. */
- y = row * mts->row_height - scroll_y;
-
- /* Step through the attendees painting the busy periods. */
- while (y < height && row < mts->attendees->len) {
-
- /* Find the first visible busy period. */
- first_period = e_meeting_time_selector_item_find_first_busy_period (mts_item, date, row);
- if (first_period != -1) {
- /* Paint the different types of busy periods, in
- reverse order of precedence, so the highest
- precedences are displayed. */
- for (busy_type = 0;
- busy_type < E_MEETING_TIME_SELECTOR_BUSY_LAST;
- busy_type++) {
- gdk_gc_set_foreground (gc, &mts->busy_colors[busy_type]);
- e_meeting_time_selector_item_paint_attendee_busy_periods (mts_item, drawable, x, y, width, row, first_period, busy_type);
- }
- }
- y += mts->row_height;
- row++;
- }
-}
-
-
-/* This subtracts the attendees longest_period_in_days from the given date,
- and does a binary search of the attendee's busy periods array to find the
- first one which could possible end on the given day or later.
- If none are found it returns -1. */
-static gint
-e_meeting_time_selector_item_find_first_busy_period (EMeetingTimeSelectorItem *mts_item, GDate *date, gint row)
-{
- EMeetingTimeSelector *mts;
- EMeetingTimeSelectorAttendee *attendee;
- EMeetingTimeSelectorPeriod *period;
- gint period_num;
-
- mts = mts_item->mts;
-
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
-
- period_num = e_meeting_time_selector_find_first_busy_period (mts, attendee, date);
- if (period_num == -1)
- return -1;
-
- /* Check if the period starts after the end of the current canvas
- scroll area. */
- period = &g_array_index (attendee->busy_periods,
- EMeetingTimeSelectorPeriod, period_num);
- if (g_date_compare (&mts->last_date_shown, &period->start.date) < 0)
- return -1;
-
- return period_num;
-}
-
-
-/* This paints the visible busy periods for one attendee which are of a certain
- busy type, e.g out of office. It is passed the index of the first visible
- busy period of the attendee and continues until it runs off the screen. */
-static void
-e_meeting_time_selector_item_paint_attendee_busy_periods (EMeetingTimeSelectorItem *mts_item, GdkDrawable *drawable, int x, int y, int width, int row, int first_period, EMeetingTimeSelectorBusyType busy_type)
-{
- EMeetingTimeSelector *mts;
- EMeetingTimeSelectorAttendee *attendee;
- EMeetingTimeSelectorPeriod *period;
- GdkGC *gc;
- gint period_num, x1, x2, x2_within_day, x2_within_col;
-
- mts = mts_item->mts;
- gc = mts_item->main_gc;
-
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
-
- for (period_num = first_period;
- period_num < attendee->busy_periods->len;
- period_num++) {
- period = &g_array_index (attendee->busy_periods,
- EMeetingTimeSelectorPeriod, period_num);
-
- if (period->busy_type != busy_type)
- continue;
-
- /* Convert the period start and end times to x coordinates. */
- x1 = e_meeting_time_selector_calculate_time_position (mts, &period->start);
- /* If the period is off the right of the area being drawn, we
- are finished. */
- if (x1 >= x + width)
- return;
-
- x2 = e_meeting_time_selector_calculate_time_position (mts, &period->end);
- /* If the period is off the left edge of the area skip it. */
- if (x2 <= x)
- continue;
-
- /* We paint from x1 to x2 - 1, so that for example a time
- from 5:00-6:00 is distinct from 6:00-7:00.
- We never finish on a grid line separating days, and we only
- ever paint on a normal vertical grid line if the period is
- only 1 pixel wide. */
- x2_within_day = x2 % mts->day_width;
- if (x2_within_day == 0) {
- x2 -= 2;
- } else if (x2_within_day == mts->day_width - 1) {
- x2 -= 1;
- } else {
- x2_within_col = x2_within_day % mts->col_width;
- if (x2_within_col == 0 && x2 > x1 + 1)
- x2 -= 1;
- }
-
- /* Paint the rectangle. We leave a gap of 2 pixels at the
- top and bottom, remembering that the grid is painted along
- the top/bottom line of each row. */
- if (x2 - x1 > 0) {
-#if E_MEETING_TIME_SELECTOR_DRAW_GRID_LINES_AT_BOTTOM
- gdk_draw_rectangle (drawable, gc, TRUE,
- x1 - x, y + 2,
- x2 - x1, mts->row_height - 5);
-#else
- gdk_draw_rectangle (drawable, gc, TRUE,
- x1 - x, y + 3,
- x2 - x1, mts->row_height - 5);
-#endif
- }
- }
-}
-
-
-/*
- * CANVAS ITEM ROUTINES - functions to be a GnomeCanvasItem.
- */
-
-/* This is supposed to return the nearest item the the point and the distance.
- Since we are the only item we just return ourself and 0 for the distance.
- This is needed so that we get button/motion events. */
-static double
-e_meeting_time_selector_item_point (GnomeCanvasItem *item, double x, double y,
- int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = item;
- return 0.0;
-}
-
-
-static gint
-e_meeting_time_selector_item_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EMeetingTimeSelectorItem *mts_item;
-
- mts_item = E_MEETING_TIME_SELECTOR_ITEM (item);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- return e_meeting_time_selector_item_button_press (mts_item,
- event);
- case GDK_BUTTON_RELEASE:
- return e_meeting_time_selector_item_button_release (mts_item,
- event);
- case GDK_MOTION_NOTIFY:
- return e_meeting_time_selector_item_motion_notify (mts_item,
- event);
- default:
- break;
- }
-
- return FALSE;
-}
-
-
-/* This handles all button press events for the item. If the cursor is over
- one of the meeting time vertical bars we start a drag. If not we set the
- meeting time to the nearest half-hour interval.
- Note that GnomeCanvas converts the event coords to world coords,
- i.e. relative to the entire canvas scroll area. */
-static gint
-e_meeting_time_selector_item_button_press (EMeetingTimeSelectorItem *mts_item,
- GdkEvent *event)
-{
- EMeetingTimeSelector *mts;
- EMeetingTimeSelectorTime start_time, end_time;
- EMeetingTimeSelectorPosition position;
- GDate *start_date, *end_date;
- gint x, y;
-
- mts = mts_item->mts;
- x = (gint) event->button.x;
- y = (gint) event->button.y;
-
- /* Check if we are starting a drag of the vertical meeting time bars.*/
- position = e_meeting_time_selector_item_get_drag_position (mts_item,
- x, y);
- if (position != E_MEETING_TIME_SELECTOR_POS_NONE) {
- if (gnome_canvas_item_grab (GNOME_CANVAS_ITEM (mts_item),
- GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- mts_item->resize_cursor,
- event->button.time) == 0 /*Success*/) {
- mts->dragging_position = position;
- return TRUE;
- }
- }
-
- /* Convert the x coordinate into a EMeetingTimeSelectorTime. */
- e_meeting_time_selector_calculate_time (mts, x, &start_time);
- start_date = &start_time.date;
- end_date = &end_time.date;
-
- /* Find the nearest half-hour or hour interval, depending on whether
- zoomed_out is set. */
- if (mts->zoomed_out) {
- start_time.minute = 0;
- end_time = start_time;
- end_time.hour += 1;
- } else {
- start_time.minute -= start_time.minute % 30;
- end_time = start_time;
- end_time.minute += 30;
- }
-
- /* Fix any overflows. */
- e_meeting_time_selector_fix_time_overflows (&end_time);
-
- /* Set the new meeting time. */
- e_meeting_time_selector_set_meeting_time (mts_item->mts,
- g_date_year (start_date),
- g_date_month (start_date),
- g_date_day (start_date),
- start_time.hour,
- start_time.minute,
- g_date_year (end_date),
- g_date_month (end_date),
- g_date_day (end_date),
- end_time.hour,
- end_time.minute);
-
-
- return FALSE;
-}
-
-
-/* This handles all button release events for the item. If we were dragging,
- we finish the drag. */
-static gint
-e_meeting_time_selector_item_button_release (EMeetingTimeSelectorItem *mts_item,
- GdkEvent *event)
-{
- EMeetingTimeSelector *mts;
-
- mts = mts_item->mts;
-
- /* Reset any drag. */
- if (mts->dragging_position != E_MEETING_TIME_SELECTOR_POS_NONE) {
- mts->dragging_position = E_MEETING_TIME_SELECTOR_POS_NONE;
- e_meeting_time_selector_remove_timeout (mts);
- gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM (mts_item),
- event->button.time);
- }
-
- return FALSE;
-}
-
-
-/* This handles all motion notify events for the item. If button1 is pressed
- we check if a drag is in progress. If not, we set the cursor if we are over
- the meeting time vertical bars. Note that GnomeCanvas doesn't use motion
- hints, which may affect performance. */
-static gint
-e_meeting_time_selector_item_motion_notify (EMeetingTimeSelectorItem *mts_item,
- GdkEvent *event)
-{
- EMeetingTimeSelector *mts;
- EMeetingTimeSelectorPosition position;
- GdkCursor *cursor;
- gint x, y;
-
- mts = mts_item->mts;
- x = (gint) event->motion.x;
- y = (gint) event->motion.y;
-
- if (mts->dragging_position != E_MEETING_TIME_SELECTOR_POS_NONE) {
- e_meeting_time_selector_drag_meeting_time (mts, x);
- return TRUE;
- }
-
- position = e_meeting_time_selector_item_get_drag_position (mts_item,
- x, y);
-
- /* Determine which cursor should be used. */
- if (position == E_MEETING_TIME_SELECTOR_POS_NONE)
- cursor = mts_item->normal_cursor;
- else
- cursor = mts_item->resize_cursor;
-
- /* Only set the cursor if it is different to the last one we set. */
- if (mts_item->last_cursor_set != cursor) {
- mts_item->last_cursor_set = cursor;
- gdk_window_set_cursor (GTK_WIDGET (GNOME_CANVAS_ITEM (mts_item)->canvas)->window, cursor);
- }
-
- return FALSE;
-}
-
-
-static EMeetingTimeSelectorPosition
-e_meeting_time_selector_item_get_drag_position (EMeetingTimeSelectorItem *mts_item,
- gint x, gint y)
-{
- EMeetingTimeSelector *mts;
- gboolean is_display_top;
- gint meeting_start_x, meeting_end_x;
-
- mts = mts_item->mts;
-
- is_display_top = (GTK_WIDGET (GNOME_CANVAS_ITEM (mts_item)->canvas) == mts->display_top) ? TRUE : FALSE;
-
- if (is_display_top && y < mts->row_height * 2)
- return E_MEETING_TIME_SELECTOR_POS_NONE;
-
- if (!e_meeting_time_selector_get_meeting_time_positions (mts, &meeting_start_x, &meeting_end_x))
- return E_MEETING_TIME_SELECTOR_POS_NONE;
-
- if (x >= meeting_end_x - 2 && x <= meeting_end_x + 2)
- return E_MEETING_TIME_SELECTOR_POS_END;
-
- if (x >= meeting_start_x - 2 && x <= meeting_start_x + 2)
- return E_MEETING_TIME_SELECTOR_POS_START;
-
- return E_MEETING_TIME_SELECTOR_POS_NONE;
-}
-
diff --git a/widgets/meeting-time-sel/e-meeting-time-sel-item.h b/widgets/meeting-time-sel/e-meeting-time-sel-item.h
deleted file mode 100644
index c2bd2872ce..0000000000
--- a/widgets/meeting-time-sel/e-meeting-time-sel-item.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * MeetingTimeSelectorItem - A GnomeCanvasItem which is used for both the main
- * display canvas and the top display (with the dates, times & All Attendees).
- * I didn't make these separate GnomeCanvasItems since they share a lot of
- * code.
- */
-
-#ifndef _E_MEETING_TIME_SELECTOR_ITEM_H_
-#define _E_MEETING_TIME_SELECTOR_ITEM_H_
-
-#include "e-meeting-time-sel.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define E_MEETING_TIME_SELECTOR_ITEM(obj) (GTK_CHECK_CAST((obj), e_meeting_time_selector_item_get_type (), EMeetingTimeSelectorItem))
-#define E_MEETING_TIME_SELECTOR_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), e_meeting_time_selector_item_get_type (), EMeetingTimeSelectorItemClass))
-#define IS_E_MEETING_TIME_SELECTOR_ITEM(o) (GTK_CHECK_TYPE((o), e_meeting_time_selector_item_get_type ()))
-
-
-typedef struct _EMeetingTimeSelectorItem EMeetingTimeSelectorItem;
-typedef struct _EMeetingTimeSelectorItemClass EMeetingTimeSelectorItemClass;
-
-struct _EMeetingTimeSelectorItem
-{
- GnomeCanvasItem canvas_item;
-
- /* The parent EMeetingTimeSelector widget. */
- EMeetingTimeSelector *mts;
-
- /* This GC is used for most of the drawing. The fg/bg colors are
- changed for each bit. */
- GdkGC *main_gc;
-
- /* The normal & resize cursors. */
- GdkCursor *normal_cursor;
- GdkCursor *resize_cursor;
-
- /* This remembers the last cursor set on the window. */
- GdkCursor *last_cursor_set;
-};
-
-
-struct _EMeetingTimeSelectorItemClass
-{
- GnomeCanvasItemClass parent_class;
-};
-
-GtkType e_meeting_time_selector_item_get_type (void);
-
-
-#endif /* _E_MEETING_TIME_SELECTOR_ITEM_H_ */
diff --git a/widgets/meeting-time-sel/e-meeting-time-sel-list-item.c b/widgets/meeting-time-sel/e-meeting-time-sel-list-item.c
deleted file mode 100644
index ac4b7b9009..0000000000
--- a/widgets/meeting-time-sel/e-meeting-time-sel-list-item.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * EMeetingTimeSelectorListItem - A GnomeCanvasItem covering the entire attendee
- * list. It just draws the grid lines between the rows and after the icon
- * column. It probably won't be needed when we switch to Miguel's new editable
- * GtkList-like widget.
- */
-
-#include <config.h>
-#include <time.h>
-#include "e-meeting-time-sel-list-item.h"
-#include "e-meeting-time-sel.h"
-
-/* This is the size of our icons. */
-#define E_MEETING_TIME_SELECTOR_ICON_WIDTH 19
-#define E_MEETING_TIME_SELECTOR_ICON_HEIGHT 16
-
-#include "e-meeting-time-sel-mail.xpm"
-#include "e-meeting-time-sel-no-mail.xpm"
-
-static void e_meeting_time_selector_list_item_class_init (EMeetingTimeSelectorListItemClass *mtsl_item_class);
-static void e_meeting_time_selector_list_item_init (EMeetingTimeSelectorListItem *mtsl_item);
-static void e_meeting_time_selector_list_item_destroy (GtkObject *object);
-
-static void e_meeting_time_selector_list_item_set_arg (GtkObject *o, GtkArg *arg,
- guint arg_id);
-static void e_meeting_time_selector_list_item_realize (GnomeCanvasItem *item);
-static void e_meeting_time_selector_list_item_unrealize (GnomeCanvasItem *item);
-static void e_meeting_time_selector_list_item_update (GnomeCanvasItem *item,
- double *affine,
- ArtSVP *clip_path, int flags);
-static void e_meeting_time_selector_list_item_draw (GnomeCanvasItem *item,
- GdkDrawable *drawable,
- int x, int y,
- int width, int height);
-static double e_meeting_time_selector_list_item_point (GnomeCanvasItem *item,
- double x, double y,
- int cx, int cy,
- GnomeCanvasItem **actual_item);
-
-
-static GnomeCanvasItemClass *e_meeting_time_selector_list_item_parent_class;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_MEETING_TIME_SELECTOR
-};
-
-
-GtkType
-e_meeting_time_selector_list_item_get_type (void)
-{
- static GtkType e_meeting_time_selector_list_item_type = 0;
-
- if (!e_meeting_time_selector_list_item_type) {
- GtkTypeInfo e_meeting_time_selector_list_item_info = {
- "EMeetingTimeSelectorListItem",
- sizeof (EMeetingTimeSelectorListItem),
- sizeof (EMeetingTimeSelectorListItemClass),
- (GtkClassInitFunc) e_meeting_time_selector_list_item_class_init,
- (GtkObjectInitFunc) e_meeting_time_selector_list_item_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- e_meeting_time_selector_list_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &e_meeting_time_selector_list_item_info);
- }
-
- return e_meeting_time_selector_list_item_type;
-}
-
-
-static void
-e_meeting_time_selector_list_item_class_init (EMeetingTimeSelectorListItemClass *mtsl_item_class)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- e_meeting_time_selector_list_item_parent_class = gtk_type_class (gnome_canvas_item_get_type());
-
- object_class = (GtkObjectClass *) mtsl_item_class;
- item_class = (GnomeCanvasItemClass *) mtsl_item_class;
-
- gtk_object_add_arg_type ("EMeetingTimeSelectorListItem::meeting_time_selector",
- GTK_TYPE_POINTER, GTK_ARG_WRITABLE,
- ARG_MEETING_TIME_SELECTOR);
-
- object_class->destroy = e_meeting_time_selector_list_item_destroy;
- object_class->set_arg = e_meeting_time_selector_list_item_set_arg;
-
- /* GnomeCanvasItem method overrides */
- item_class->realize = e_meeting_time_selector_list_item_realize;
- item_class->unrealize = e_meeting_time_selector_list_item_unrealize;
- item_class->update = e_meeting_time_selector_list_item_update;
- item_class->draw = e_meeting_time_selector_list_item_draw;
- item_class->point = e_meeting_time_selector_list_item_point;
-#if 0
- item_class->event = e_meeting_time_selector_list_item_event;
-#endif
-}
-
-
-static void
-e_meeting_time_selector_list_item_init (EMeetingTimeSelectorListItem *mtsl_item)
-{
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (mtsl_item);
- GdkColormap *colormap;
-
- mtsl_item->mts = NULL;
-
- colormap = gtk_widget_get_default_colormap ();
- mtsl_item->mail_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mtsl_item->mail_icon_mask, NULL, e_meeting_time_sel_mail_xpm);
- mtsl_item->no_mail_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mtsl_item->no_mail_icon_mask, NULL, e_meeting_time_sel_no_mail_xpm);
-
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = 0;
- item->y2 = 0;
-}
-
-
-static void
-e_meeting_time_selector_list_item_destroy (GtkObject *object)
-{
- EMeetingTimeSelectorListItem *mtsl_item;
-
- mtsl_item = E_MEETING_TIME_SELECTOR_LIST_ITEM (object);
-
- gdk_pixmap_unref (mtsl_item->mail_icon);
- gdk_pixmap_unref (mtsl_item->no_mail_icon);
- gdk_bitmap_unref (mtsl_item->mail_icon_mask);
- gdk_bitmap_unref (mtsl_item->mail_icon_mask);
-
- if (GTK_OBJECT_CLASS (e_meeting_time_selector_list_item_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (e_meeting_time_selector_list_item_parent_class)->destroy)(object);
-}
-
-
-static void
-e_meeting_time_selector_list_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EMeetingTimeSelectorListItem *mtsl_item;
-
- item = GNOME_CANVAS_ITEM (o);
- mtsl_item = E_MEETING_TIME_SELECTOR_LIST_ITEM (o);
-
- switch (arg_id){
- case ARG_MEETING_TIME_SELECTOR:
- mtsl_item->mts = GTK_VALUE_POINTER (*arg);
- break;
- }
-}
-
-
-static void
-e_meeting_time_selector_list_item_realize (GnomeCanvasItem *item)
-{
- GnomeCanvas *canvas;
- GdkWindow *window;
- EMeetingTimeSelectorListItem *mtsl_item;
-
- if (GNOME_CANVAS_ITEM_CLASS (e_meeting_time_selector_list_item_parent_class)->realize)
- (*GNOME_CANVAS_ITEM_CLASS (e_meeting_time_selector_list_item_parent_class)->realize)(item);
-
- mtsl_item = E_MEETING_TIME_SELECTOR_LIST_ITEM (item);
-
- canvas = item->canvas;
- window = GTK_WIDGET (canvas)->window;
-
- mtsl_item->main_gc = gdk_gc_new (window);
-}
-
-
-static void
-e_meeting_time_selector_list_item_unrealize (GnomeCanvasItem *item)
-{
- EMeetingTimeSelectorListItem *mtsl_item;
-
- mtsl_item = E_MEETING_TIME_SELECTOR_LIST_ITEM (item);
-
- gdk_gc_unref (mtsl_item->main_gc);
- mtsl_item->main_gc = NULL;
-
- if (GNOME_CANVAS_ITEM_CLASS (e_meeting_time_selector_list_item_parent_class)->unrealize)
- (*GNOME_CANVAS_ITEM_CLASS (e_meeting_time_selector_list_item_parent_class)->unrealize)(item);
-}
-
-
-static void
-e_meeting_time_selector_list_item_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- if (GNOME_CANVAS_ITEM_CLASS (e_meeting_time_selector_list_item_parent_class)->update)
- (* GNOME_CANVAS_ITEM_CLASS (e_meeting_time_selector_list_item_parent_class)->update) (item, affine, clip_path, flags);
-
- /* The item covers the entire canvas area. */
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = INT_MAX;
- item->y2 = INT_MAX;
-}
-
-
-/*
- * DRAWING ROUTINES - functions to paint the canvas item.
- */
-
-static void
-e_meeting_time_selector_list_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
-{
- EMeetingTimeSelectorListItem *mtsl_item;
- EMeetingTimeSelector *mts;
- EMeetingTimeSelectorAttendee *attendee;
- GdkGC *gc;
- gint row, row_y, icon_x, icon_y;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
-
- mtsl_item = E_MEETING_TIME_SELECTOR_LIST_ITEM (item);
- mts = mtsl_item->mts;
- gc = mtsl_item->main_gc;
-
- gdk_gc_set_foreground (gc, &mts->attendee_list_bg_color);
- gdk_draw_rectangle (drawable, gc, TRUE, 0, 0, width, height);
-
- gdk_gc_set_foreground (gc, &mts->grid_unused_color);
- gdk_draw_line (drawable, gc, 24 - x, 0, 24 - x, height);
-
- /* Draw the grid line across the top of the row. */
- row = y / mts->row_height;
- row_y = row * mts->row_height - y;
- while (row_y < height) {
- gdk_draw_line (drawable, gc, 0, row_y, width, row_y);
- row_y += mts->row_height;
- }
-
- row = y / mts->row_height;
- row_y = row * mts->row_height - y;
- icon_x = (E_MEETING_TIME_SELECTOR_ICON_COLUMN_WIDTH - E_MEETING_TIME_SELECTOR_ICON_WIDTH + 1) / 2 - x;
- icon_y = row_y + (mts->row_height - E_MEETING_TIME_SELECTOR_ICON_HEIGHT + 1) / 2;
- while (row < mts->attendees->len && row_y < height) {
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
-
- gdk_gc_set_clip_origin (gc, icon_x, icon_y);
-
- if (attendee->send_meeting_to) {
- pixmap = mtsl_item->mail_icon;
- mask = mtsl_item->mail_icon_mask;
- } else {
- pixmap = mtsl_item->no_mail_icon;
- mask = mtsl_item->no_mail_icon_mask;
- }
-
- gdk_gc_set_clip_mask (gc, mask);
- gdk_draw_pixmap (drawable, gc, pixmap, 0, 0,
- icon_x, icon_y, 24, 24);
-
- row++;
- row_y += mts->row_height;
- icon_y += mts->row_height;
- }
- gdk_gc_set_clip_mask (gc, NULL);
-}
-
-
-/* This is supposed to return the nearest item the the point and the distance.
- Since we cover the entire canvas we just return ourself and 0 for the
- distance. This is needed so that we get button/motion events. */
-static double
-e_meeting_time_selector_list_item_point (GnomeCanvasItem *item,
- double x, double y,
- int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = item;
- return 0.0;
-}
diff --git a/widgets/meeting-time-sel/e-meeting-time-sel-list-item.h b/widgets/meeting-time-sel/e-meeting-time-sel-list-item.h
deleted file mode 100644
index 9ef295ebb2..0000000000
--- a/widgets/meeting-time-sel/e-meeting-time-sel-list-item.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * MeetingTimeSelectorListItem - A GnomeCanvasItem covering the entire attendee
- * list. It just draws the grid lines between the rows and after the icon
- * column. It probably won't be needed when we switch to Miguel's new editable
- * GtkList-like widget.
- */
-
-#ifndef _E_MEETING_TIME_SELECTOR_LIST_ITEM_H_
-#define _E_MEETING_TIME_SELECTOR_LIST_ITEM_H_
-
-#include "e-meeting-time-sel.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define E_MEETING_TIME_SELECTOR_LIST_ITEM(obj) (GTK_CHECK_CAST((obj), e_meeting_time_selector_list_item_get_type (), EMeetingTimeSelectorListItem))
-#define E_MEETING_TIME_SELECTOR_LIST_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), e_meeting_time_selector_list_item_get_type (), EMeetingTimeSelectorListItemClass))
-#define IS_E_MEETING_TIME_SELECTOR_LIST_ITEM(o) (GTK_CHECK_TYPE((o), e_meeting_time_selector_list_item_get_type ()))
-
-
-typedef struct _EMeetingTimeSelectorListItem EMeetingTimeSelectorListItem;
-typedef struct _EMeetingTimeSelectorListItemClass EMeetingTimeSelectorListItemClass;
-
-struct _EMeetingTimeSelectorListItem
-{
- GnomeCanvasItem canvas_item;
-
- /* The parent EMeetingTimeSelector widget. */
- EMeetingTimeSelector *mts;
-
- /* This GC is used for most of the drawing. The fg/bg colors are
- changed for each bit. */
- GdkGC *main_gc;
-
- GdkPixmap *mail_icon, *no_mail_icon;
- GdkBitmap *mail_icon_mask, *no_mail_icon_mask;
-};
-
-
-struct _EMeetingTimeSelectorListItemClass
-{
- GnomeCanvasItemClass parent_class;
-};
-
-GtkType e_meeting_time_selector_list_item_get_type (void);
-
-
-#endif /* _E_MEETING_TIME_SELECTOR_LIST_ITEM_H_ */
diff --git a/widgets/meeting-time-sel/e-meeting-time-sel-mail.xpm b/widgets/meeting-time-sel/e-meeting-time-sel-mail.xpm
deleted file mode 100644
index 5a03c7ea8a..0000000000
--- a/widgets/meeting-time-sel/e-meeting-time-sel-mail.xpm
+++ /dev/null
@@ -1,135 +0,0 @@
-/* XPM */
-static char * e_meeting_time_sel_mail_xpm[] = {
-"19 16 116 2",
-" c None",
-". c #000000",
-"+ c #7B7B78",
-"@ c #C7C7C3",
-"# c #F1F0EB",
-"$ c #BFBFBC",
-"% c #5F5E5E",
-"& c #E3E3DF",
-"* c #F3F3EF",
-"= c #F2F2EE",
-"- c #F1F1EC",
-"; c #F0EFEB",
-"> c #D2D2CD",
-", c #969592",
-"' c #616060",
-") c #B5B5B4",
-"! c #F8F8F6",
-"~ c #F7F7F5",
-"{ c #F6F6F3",
-"] c #F5F5F2",
-"^ c #F4F4F0",
-"/ c #F2F1ED",
-"( c #F1F0EC",
-"_ c #F0EFEA",
-": c #EFEEE9",
-"< c #4F4F4D",
-"[ c #BDBCB8",
-"} c #A7A6A3",
-"| c #C6C6C4",
-"1 c #7C7C7B",
-"2 c #525251",
-"3 c #DBDBD9",
-"4 c #F5F4F1",
-"5 c #F4F3F0",
-"6 c #F3F2EE",
-"7 c #999894",
-"8 c #62625F",
-"9 c #BCBCB6",
-"0 c #EBE9E3",
-"a c #838381",
-"b c #D7D6D4",
-"c c #A8A8A6",
-"d c #515150",
-"e c #7E7D7C",
-"f c #DAD9D5",
-"g c #EFEEE8",
-"h c #EEEDE7",
-"i c #4F4E4C",
-"j c #BCBBB6",
-"k c #EBE9E2",
-"l c #EAE8E1",
-"m c #F6F5F2",
-"n c #F4F3EF",
-"o c #B5B4B1",
-"p c #9B9A97",
-"q c #646361",
-"r c #92918E",
-"s c #EEEDE8",
-"t c #EDECE6",
-"u c #4E4E4C",
-"v c #797976",
-"w c #797874",
-"x c #E9E8E1",
-"y c #E8E7DF",
-"z c #B4B3AF",
-"A c #D0D0CD",
-"B c #F2F2ED",
-"C c #BFBEBA",
-"D c #BEBDB9",
-"E c #7A7A77",
-"F c #979691",
-"G c #EAE9E2",
-"H c #959590",
-"I c #787773",
-"J c #B8B7B0",
-"K c #E6E4DC",
-"L c #A9A9A6",
-"M c #626260",
-"N c #ECEBE4",
-"O c #EBEAE3",
-"P c #E9E7E0",
-"Q c #E8E6DF",
-"R c #E7E5DD",
-"S c #777671",
-"T c #93918C",
-"U c #BEBDB8",
-"V c #989793",
-"W c #ECEAE4",
-"X c #E8E6DE",
-"Y c #E6E4DB",
-"Z c #E4E3DA",
-"` c #75746F",
-" . c #91908A",
-".. c #EEECE7",
-"+. c #62615F",
-"@. c #EBEAE4",
-"#. c #E7E6DE",
-"$. c #E6E5DC",
-"%. c #E5E4DB",
-"&. c #E4E2DA",
-"*. c #CCCBC4",
-"=. c #A3A29D",
-"-. c #B6B5B2",
-";. c #BCBCB7",
-">. c #CDCCC6",
-",. c #959490",
-"'. c #ECEBE5",
-"). c #61615E",
-"!. c #E9E8E0",
-"~. c #CECDC7",
-"{. c #797875",
-"]. c #969590",
-"^. c #CFCEC8",
-"/. c #AEADA8",
-"(. c #585754",
-"_. c #7B7A76",
-" . . . . ",
-" . . . . . + @ # $ . ",
-" . . . . . % $ & * = - ; > , . ",
-". ' ) ! ~ { ] ^ * / ( _ : < [ } . ",
-". | 1 2 3 4 5 6 / # _ : 7 8 9 0 . ",
-". a b c d e f / # _ g h i j k l . ",
-" . m 4 n o p q r s t u v w x y z . ",
-" . A * B ( ; C D E u F G H I J K . ",
-" . L / ( _ : M t N O l P Q R S T . ",
-" . # _ g U V W 0 l P X R Y Z ` .. ",
-" . ; g ..+.@.G x y #.$.%.&.*.=.. . ",
-" . -.t ;.F G x y #.K >.,.. . . ",
-" . '.).G !.Q ~.H . . . ",
-" . {.].^./.. . . ",
-" . (._.. . ",
-" . . "};
diff --git a/widgets/meeting-time-sel/e-meeting-time-sel-no-mail.xpm b/widgets/meeting-time-sel/e-meeting-time-sel-no-mail.xpm
deleted file mode 100644
index 747202b3e2..0000000000
--- a/widgets/meeting-time-sel/e-meeting-time-sel-no-mail.xpm
+++ /dev/null
@@ -1,123 +0,0 @@
-/* XPM */
-static char * e_meeting_time_sel_no_mail_xpm[] = {
-"19 16 104 2",
-" c None",
-". c #000000",
-"+ c #7B7B78",
-"@ c #C7C7C3",
-"# c #F1F0EB",
-"$ c #BFBFBC",
-"% c #5F5E5E",
-"& c #E3E3DF",
-"* c #F3F3EF",
-"= c #F2F2EE",
-"- c #F1F1EC",
-"; c #F0EFEB",
-"> c #D2D2CD",
-", c #969592",
-"' c #616060",
-") c #B5B5B4",
-"! c #F8F8F6",
-"~ c #F7F7F5",
-"{ c #F6F6F3",
-"] c #F5F5F2",
-"^ c #F4F4F0",
-"/ c #F2F1ED",
-"( c #F1F0EC",
-"_ c #F0EFEA",
-": c #EFEEE9",
-"< c #4F4F4D",
-"[ c #BDBCB8",
-"} c #A7A6A3",
-"| c #C6C6C4",
-"1 c #7C7C7B",
-"2 c #525251",
-"3 c #DBDBD9",
-"4 c #F5F4F1",
-"5 c #F4F3F0",
-"6 c #F3F2EE",
-"7 c #999894",
-"8 c #62625F",
-"9 c #BCBCB6",
-"0 c #EBE9E3",
-"a c #838381",
-"b c #D7D6D4",
-"c c #A8A8A6",
-"d c #515150",
-"e c #7E7D7C",
-"f c #DAD9D5",
-"g c #D16069",
-"h c #EEEDE7",
-"i c #4F4E4C",
-"j c #BCBBB6",
-"k c #F6F5F2",
-"l c #F4F3EF",
-"m c #B5B4B1",
-"n c #9B9A97",
-"o c #646361",
-"p c #92918E",
-"q c #9F3C44",
-"r c #797976",
-"s c #B5444E",
-"t c #B4B3AF",
-"u c #D0D0CD",
-"v c #F2F2ED",
-"w c #BFBEBA",
-"x c #BEBDB9",
-"y c #BB565F",
-"z c #812F36",
-"A c #E6E4DC",
-"B c #A9A9A6",
-"C c #626260",
-"D c #EDECE6",
-"E c #ECEBE4",
-"F c #BB555D",
-"G c #90353D",
-"H c #777671",
-"I c #93918C",
-"J c #EFEEE8",
-"K c #BEBDB8",
-"L c #989793",
-"M c #ECEAE4",
-"N c #E6E4DB",
-"O c #E4E3DA",
-"P c #75746F",
-"Q c #91908A",
-"R c #EEECE7",
-"S c #62615F",
-"T c #EBEAE4",
-"U c #EAE9E2",
-"V c #BD5A62",
-"W c #E4E2DA",
-"X c #CCCBC4",
-"Y c #A3A29D",
-"Z c #B6B5B2",
-"` c #BCBCB7",
-" . c #979691",
-".. c #BC5760",
-"+. c #A13C45",
-"@. c #ECEBE5",
-"#. c #61615E",
-"$. c #C0636B",
-"%. c #A83F48",
-"&. c #797875",
-"*. c #969590",
-"=. c #CFCEC8",
-"-. c #585754",
-";. c #7B7A76",
-" . . . . ",
-" . . . . . + @ # $ . ",
-" . . . . . % $ & * = - ; > , . ",
-". ' ) ! ~ { ] ^ * / ( _ : < [ } . ",
-". | 1 2 3 4 5 6 / # _ : 7 8 9 0 . ",
-". a b c d e f / # g g h i j g g . ",
-" . k 4 l m n o p g q g r g s g t . ",
-" . u * v ( ; w x g s g g y z g A . ",
-" . B / ( _ : C D E g s F G g H I . ",
-" . # _ J K L M 0 g s s g N O P Q . ",
-" . ; J R S T U g V s s g W X Y . . ",
-" . Z D ` .U g ..G g g +.g . . ",
-" . @.#.U g $.G g . g %.g ",
-" . &.*.=.g g g . g g ",
-" . -.;.. . ",
-" . . "};
diff --git a/widgets/meeting-time-sel/e-meeting-time-sel.c b/widgets/meeting-time-sel/e-meeting-time-sel.c
deleted file mode 100644
index 86f81cc80e..0000000000
--- a/widgets/meeting-time-sel/e-meeting-time-sel.c
+++ /dev/null
@@ -1,3065 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkarrow.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkdrawingarea.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkhscrollbar.h>
-#include <gtk/gtkhseparator.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkradiomenuitem.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkvscrollbar.h>
-#include <libgnomeui/gnome-dateedit.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-canvas-widget.h>
-
-#include "e-meeting-time-sel.h"
-#include "e-meeting-time-sel-item.h"
-#include "e-meeting-time-sel-list-item.h"
-
-/* An array of hour strings, "0:00" .. "23:00". */
-const gchar *EMeetingTimeSelectorHours[24] = {
- "0:00", "1:00", "2:00", "3:00", "4:00", "5:00", "6:00", "7:00",
- "8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00",
- "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"
-};
-
-/* The number of days shown in the entire canvas. */
-#define E_MEETING_TIME_SELECTOR_DAYS_SHOWN 365
-
-#define E_MEETING_TIME_SELECTOR_ENTRY_INNER_BORDER 2
-
-/* This is the number of pixels between the mouse has to move before the
- scroll speed is incremented. */
-#define E_MEETING_TIME_SELECTOR_SCROLL_INCREMENT_WIDTH 10
-
-/* This is the maximum scrolling speed. */
-#define E_MEETING_TIME_SELECTOR_MAX_SCROLL_SPEED 4
-
-
-static void e_meeting_time_selector_class_init (EMeetingTimeSelectorClass * klass);
-static void e_meeting_time_selector_init (EMeetingTimeSelector * mts);
-static void e_meeting_time_selector_destroy (GtkObject *object);
-static void e_meeting_time_selector_alloc_named_color (EMeetingTimeSelector * mts,
- const char *name, GdkColor *c);
-static void e_meeting_time_selector_add_key_color (EMeetingTimeSelector * mts,
- GtkWidget *hbox,
- gchar *label_text,
- GdkColor *color);
-static gint e_meeting_time_selector_expose_key_color (GtkWidget *darea,
- GdkEventExpose *event,
- GdkColor *color);
-static gint e_meeting_time_selector_expose_title_bar (GtkWidget *darea,
- GdkEventExpose *event,
- gpointer data);
-static void e_meeting_time_selector_options_menu_detacher (GtkWidget *widget,
- GtkMenu *menu);
-static void e_meeting_time_selector_autopick_menu_detacher (GtkWidget *widget,
- GtkMenu *menu);
-static void e_meeting_time_selector_realize (GtkWidget *widget);
-static void e_meeting_time_selector_unrealize (GtkWidget *widget);
-static void e_meeting_time_selector_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-static gint e_meeting_time_selector_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
-static void e_meeting_time_selector_hadjustment_changed (GtkAdjustment *adjustment,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_vadjustment_changed (GtkAdjustment *adjustment,
- EMeetingTimeSelector *mts);
-
-static void e_meeting_time_selector_on_canvas_realized (GtkWidget *widget,
- EMeetingTimeSelector *mts);
-
-static gint e_meeting_time_selector_compare_period_starts (const void *arg1,
- const void *arg2);
-#if 0
-static gint e_meeting_time_selector_compare_periods (const void *arg1,
- const void *arg2);
-#endif
-static gint e_meeting_time_selector_compare_times (EMeetingTimeSelectorTime *time1,
- EMeetingTimeSelectorTime *time2);
-static void e_meeting_time_selector_on_options_button_clicked (GtkWidget *button,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_options_menu_position_callback (GtkMenu *menu,
- gint *x,
- gint *y,
- gpointer user_data);
-static void e_meeting_time_selector_on_zoomed_out_toggled (GtkWidget *button,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_on_working_hours_toggled (GtkWidget *button,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_on_invite_others_button_clicked (GtkWidget *button,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_on_update_free_busy (GtkWidget *button,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_on_autopick_button_clicked (GtkWidget *button,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_autopick_menu_position_callback (GtkMenu *menu,
- gint *x,
- gint *y,
- gpointer user_data);
-static void e_meeting_time_selector_on_autopick_option_toggled (GtkWidget *button,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_on_prev_button_clicked (GtkWidget *button,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_on_next_button_clicked (GtkWidget *button,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_autopick (EMeetingTimeSelector *mts,
- gboolean forward);
-static void e_meeting_time_selector_calculate_time_difference (EMeetingTimeSelectorTime *start,
- EMeetingTimeSelectorTime *end,
- gint *days,
- gint *hours,
- gint *minutes);
-static void e_meeting_time_selector_find_nearest_interval (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorTime *start_time,
- EMeetingTimeSelectorTime *end_time,
- gint days, gint hours, gint mins);
-static void e_meeting_time_selector_find_nearest_interval_backward (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorTime *start_time,
- EMeetingTimeSelectorTime *end_time,
- gint days, gint hours, gint mins);
-static void e_meeting_time_selector_adjust_time (EMeetingTimeSelectorTime *mtstime,
- gint days, gint hours, gint minutes);
-static EMeetingTimeSelectorPeriod* e_meeting_time_selector_find_time_clash (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorAttendee *attendee,
- EMeetingTimeSelectorTime *start_time,
- EMeetingTimeSelectorTime *end_time);
-
-
-static void e_meeting_time_selector_recalc_grid (EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_save_position (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorTime *mtstime);
-static void e_meeting_time_selector_restore_position (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorTime *mtstime);
-static void e_meeting_time_selector_on_start_time_changed (GtkWidget *widget,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_on_end_time_changed (GtkWidget *widget,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_update_date_popup_menus (EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_on_attendees_list_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_on_canvas_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation,
- EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_update_main_canvas_scroll_region (EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_update_attendees_list_scroll_region (EMeetingTimeSelector *mts);
-static gboolean e_meeting_time_selector_timeout_handler (gpointer data);
-static void e_meeting_time_selector_update_start_date_edit (EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_update_end_date_edit (EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_ensure_meeting_time_shown (EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_update_dates_shown (EMeetingTimeSelector *mts);
-
-static void e_meeting_time_selector_update_attendees_list_positions (EMeetingTimeSelector *mts);
-
-static GtkTableClass *e_meeting_time_selector_parent_class;
-
-
-GtkType
-e_meeting_time_selector_get_type (void)
-{
- static guint e_meeting_time_selector_type = 0;
-
- if (!e_meeting_time_selector_type) {
- GtkTypeInfo e_meeting_time_selector_info =
- {
- "EMeetingTimeSelector",
- sizeof (EMeetingTimeSelector),
- sizeof (EMeetingTimeSelectorClass),
- (GtkClassInitFunc) e_meeting_time_selector_class_init,
- (GtkObjectInitFunc) e_meeting_time_selector_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- e_meeting_time_selector_type = gtk_type_unique (GTK_TYPE_TABLE,
- &e_meeting_time_selector_info);
- }
- return e_meeting_time_selector_type;
-}
-
-
-static void
-e_meeting_time_selector_class_init (EMeetingTimeSelectorClass * klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- e_meeting_time_selector_parent_class = gtk_type_class (gtk_table_get_type());
-
- object_class = (GtkObjectClass *) klass;
- widget_class = (GtkWidgetClass *) klass;
-
- object_class->destroy = e_meeting_time_selector_destroy;
-
- widget_class->realize = e_meeting_time_selector_realize;
- widget_class->unrealize = e_meeting_time_selector_unrealize;
- widget_class->style_set = e_meeting_time_selector_style_set;
- widget_class->expose_event = e_meeting_time_selector_expose_event;
-}
-
-
-static void
-e_meeting_time_selector_init (EMeetingTimeSelector * mts)
-{
- GtkWidget *hbox, *separator, *button, *label, *table;
- GtkWidget *alignment, *child_hbox, *arrow, *menuitem;
- GSList *group;
- GdkVisual *visual;
- GdkColormap *colormap;
- guint accel_key;
- GtkAccelGroup *menu_accel_group;
- time_t meeting_start_time;
- struct tm *meeting_start_tm;
- guchar stipple_bits[] = {
- 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
- };
-
- mts->accel_group = gtk_accel_group_new ();
-
- mts->attendees = g_array_new (FALSE, FALSE,
- sizeof (EMeetingTimeSelectorAttendee));
-
- mts->working_hours_only = TRUE;
- mts->day_start_hour = 9;
- mts->day_start_minute = 0;
- mts->day_end_hour = 18;
- mts->day_end_minute = 0;
- mts->zoomed_out = FALSE;
- mts->dragging_position = E_MEETING_TIME_SELECTOR_POS_NONE;
-
- /* The default meeting time is the nearest half-hour interval in the
- future, in working hours. */
- meeting_start_time = time (NULL);
- g_date_clear (&mts->meeting_start_time.date, 1);
- g_date_set_time (&mts->meeting_start_time.date, meeting_start_time);
- meeting_start_tm = localtime (&meeting_start_time);
- mts->meeting_start_time.hour = meeting_start_tm->tm_hour;
- mts->meeting_start_time.minute = meeting_start_tm->tm_min;
-
- e_meeting_time_selector_find_nearest_interval (mts, &mts->meeting_start_time,
- &mts->meeting_end_time,
- 0, 0, 30);
-
- e_meeting_time_selector_update_dates_shown (mts);
-
- mts->meeting_positions_valid = FALSE;
-
- mts->row_height = 30;
- mts->col_width = 50;
- mts->day_width = 50 * 24 + 1;
-
- mts->auto_scroll_timeout_id = 0;
-
-
- mts->attendees_title_bar_vbox = gtk_vbox_new (FALSE, 2);
- /* Add some horizontal padding for the shadow around the display. */
- gtk_table_attach (GTK_TABLE (mts),
- mts->attendees_title_bar_vbox,
- 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 2, 0);
- gtk_widget_show (mts->attendees_title_bar_vbox);
-
- mts->attendees_title_bar = gtk_drawing_area_new ();
- gtk_box_pack_end (GTK_BOX (mts->attendees_title_bar_vbox),
- mts->attendees_title_bar, FALSE, FALSE, 0);
- gtk_widget_show (mts->attendees_title_bar);
- gtk_signal_connect (GTK_OBJECT (mts->attendees_title_bar),
- "expose_event",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_expose_title_bar), mts);
-
- mts->attendees_list = gnome_canvas_new ();
- /* Add some horizontal padding for the shadow around the display. */
- gtk_table_attach (GTK_TABLE (mts), mts->attendees_list,
- 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 0);
- gtk_widget_show (mts->attendees_list);
- gtk_signal_connect (GTK_OBJECT (mts->attendees_list), "realize",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_canvas_realized), mts);
- gtk_signal_connect (GTK_OBJECT (mts->attendees_list), "size_allocate",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_attendees_list_size_allocate), mts);
-
- /* Create the item in the list canvas. */
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (mts->attendees_list)->root),
- e_meeting_time_selector_list_item_get_type (),
- "EMeetingTimeSelectorListItem::meeting_time_selector", mts,
- NULL);
-
- mts->display_top = gnome_canvas_new ();
- gnome_canvas_set_scroll_region (GNOME_CANVAS (mts->display_top),
- 0, 0,
- mts->day_width * E_MEETING_TIME_SELECTOR_DAYS_SHOWN,
- mts->row_height * 3);
- /* Add some horizontal padding for the shadow around the display. */
- gtk_table_attach (GTK_TABLE (mts), mts->display_top,
- 1, 4, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 0);
- gtk_widget_show (mts->display_top);
- gtk_signal_connect (GTK_OBJECT (mts->display_top), "realize",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_canvas_realized), mts);
-
- mts->display_main = gnome_canvas_new ();
- e_meeting_time_selector_update_main_canvas_scroll_region (mts);
- /* Add some horizontal padding for the shadow around the display. */
- gtk_table_attach (GTK_TABLE (mts), mts->display_main,
- 1, 4, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 2, 0);
- gtk_widget_show (mts->display_main);
- gtk_signal_connect (GTK_OBJECT (mts->display_main), "realize",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_canvas_realized), mts);
- gtk_signal_connect (GTK_OBJECT (mts->display_main), "size_allocate",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_canvas_size_allocate), mts);
-
- mts->hscrollbar = gtk_hscrollbar_new (GTK_LAYOUT (mts->display_main)->hadjustment);
- gtk_table_attach (GTK_TABLE (mts), mts->hscrollbar,
- 1, 4, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_widget_show (mts->hscrollbar);
-
- mts->vscrollbar = gtk_vscrollbar_new (GTK_LAYOUT (mts->display_main)->vadjustment);
- gtk_table_attach (GTK_TABLE (mts), mts->vscrollbar,
- 4, 5, 1, 2, 0, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (mts->vscrollbar);
-
- /* Create the item in the top canvas. */
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (mts->display_top)->root),
- e_meeting_time_selector_item_get_type (),
- "EMeetingTimeSelectorItem::meeting_time_selector", mts,
- NULL);
-
- /* Create the item in the main canvas. */
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (mts->display_main)->root),
- e_meeting_time_selector_item_get_type (),
- "EMeetingTimeSelectorItem::meeting_time_selector", mts,
- NULL);
-
- /* Create the hbox containing the color key. */
- hbox = gtk_hbox_new (FALSE, 2);
- gtk_table_attach (GTK_TABLE (mts), hbox,
- 1, 4, 3, 4, GTK_FILL, 0, 0, 8);
- gtk_widget_show (hbox);
-
- e_meeting_time_selector_add_key_color (mts, hbox, _("Tentative"), &mts->busy_colors[E_MEETING_TIME_SELECTOR_BUSY_TENTATIVE]);
- e_meeting_time_selector_add_key_color (mts, hbox, _("Busy"), &mts->busy_colors[E_MEETING_TIME_SELECTOR_BUSY_BUSY]);
- e_meeting_time_selector_add_key_color (mts, hbox, _("Out of Office"), &mts->busy_colors[E_MEETING_TIME_SELECTOR_BUSY_OUT_OF_OFFICE]);
- e_meeting_time_selector_add_key_color (mts, hbox, _("No Information"),
- NULL);
-
- separator = gtk_hseparator_new ();
- gtk_table_attach (GTK_TABLE (mts), separator,
- 0, 5, 4, 5, GTK_FILL, 0, 0, 0);
- gtk_widget_show (separator);
-
- /* Create the Invite Others & Options buttons on the left. */
- hbox = gtk_hbox_new (FALSE, 4);
- gtk_table_attach (GTK_TABLE (mts), hbox,
- 0, 1, 3, 4, GTK_FILL, 0, 0, 0);
- gtk_widget_show (hbox);
-
- button = gtk_button_new_with_label ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (button)->child),
- _("_Invite Others..."));
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
- gtk_widget_add_accelerator (button, "clicked", mts->accel_group,
- accel_key, GDK_MOD1_MASK, 0);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_invite_others_button_clicked), mts);
-
- mts->options_button = gtk_button_new ();
- gtk_box_pack_start (GTK_BOX (hbox), mts->options_button, TRUE, TRUE, 0);
- gtk_widget_show (mts->options_button);
-
- gtk_signal_connect (GTK_OBJECT (mts->options_button), "clicked",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_options_button_clicked), mts);
-
- child_hbox = gtk_hbox_new (FALSE, 2);
- gtk_container_add (GTK_CONTAINER (mts->options_button), child_hbox);
- gtk_widget_show (child_hbox);
-
- label = gtk_label_new ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (label), _("_Options"));
- gtk_box_pack_start (GTK_BOX (child_hbox), label, TRUE, TRUE, 0);
- gtk_widget_show (label);
- gtk_widget_add_accelerator (mts->options_button, "clicked", mts->accel_group,
- accel_key, GDK_MOD1_MASK, 0);
-
- arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
- gtk_box_pack_start (GTK_BOX (child_hbox), arrow, FALSE, FALSE, 2);
- gtk_widget_show (arrow);
-
- /* Create the Options menu. */
- mts->options_menu = gtk_menu_new ();
- gtk_menu_attach_to_widget (GTK_MENU (mts->options_menu), mts->options_button,
- e_meeting_time_selector_options_menu_detacher);
- menu_accel_group = gtk_menu_ensure_uline_accel_group (GTK_MENU (mts->options_menu));
-
- menuitem = gtk_check_menu_item_new_with_label ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menuitem)->child), _("Show _Only Working Hours"));
- gtk_menu_append (GTK_MENU (mts->options_menu), menuitem);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
- mts->working_hours_only);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, 0, 0);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, GDK_MOD1_MASK, 0);
- gtk_signal_connect (GTK_OBJECT (menuitem), "toggled",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_working_hours_toggled), mts);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_check_menu_item_new_with_label ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menuitem)->child), _("Show _Zoomed Out"));
- gtk_menu_append (GTK_MENU (mts->options_menu), menuitem);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
- mts->zoomed_out);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, 0, 0);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, GDK_MOD1_MASK, 0);
- gtk_signal_connect (GTK_OBJECT (menuitem), "toggled",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_zoomed_out_toggled), mts);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_menu_item_new ();
- gtk_menu_append (GTK_MENU (mts->options_menu), menuitem);
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menuitem)->child), _("_Update Free/Busy"));
- gtk_menu_append (GTK_MENU (mts->options_menu), menuitem);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, 0, 0);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, GDK_MOD1_MASK, 0);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_update_free_busy), mts);
- gtk_widget_show (menuitem);
-
- /* Create the 3 AutoPick buttons on the left. */
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_table_attach (GTK_TABLE (mts), hbox,
- 0, 1, 5, 6, GTK_FILL, 0, 0, 0);
- gtk_widget_show (hbox);
-
- button = gtk_button_new_with_label ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (button)->child),
- _("_<<"));
- gtk_widget_add_accelerator (button, "clicked", mts->accel_group,
- accel_key, GDK_MOD1_MASK | GDK_SHIFT_MASK, 0);
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_prev_button_clicked), mts);
-
- mts->autopick_button = gtk_button_new ();
- gtk_box_pack_start (GTK_BOX (hbox), mts->autopick_button, TRUE, TRUE, 0);
- gtk_widget_show (mts->autopick_button);
-
- child_hbox = gtk_hbox_new (FALSE, 2);
- gtk_container_add (GTK_CONTAINER (mts->autopick_button), child_hbox);
- gtk_widget_show (child_hbox);
-
- label = gtk_label_new ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (label), _("_Autopick"));
- gtk_box_pack_start (GTK_BOX (child_hbox), label, TRUE, TRUE, 0);
- gtk_widget_show (label);
- gtk_widget_add_accelerator (mts->autopick_button, "clicked", mts->accel_group,
- accel_key, GDK_MOD1_MASK, 0);
- gtk_signal_connect (GTK_OBJECT (mts->autopick_button), "clicked",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_autopick_button_clicked), mts);
-
- arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
- gtk_box_pack_start (GTK_BOX (child_hbox), arrow, FALSE, FALSE, 2);
- gtk_widget_show (arrow);
-
- button = gtk_button_new_with_label ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (button)->child),
- _(">_>"));
- gtk_widget_add_accelerator (button, "clicked", mts->accel_group,
- accel_key, GDK_MOD1_MASK | GDK_SHIFT_MASK, 0);
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_next_button_clicked), mts);
-
- /* Create the Autopick menu. */
- mts->autopick_menu = gtk_menu_new ();
- gtk_menu_attach_to_widget (GTK_MENU (mts->autopick_menu), mts->autopick_button,
- e_meeting_time_selector_autopick_menu_detacher);
- menu_accel_group = gtk_menu_ensure_uline_accel_group (GTK_MENU (mts->autopick_menu));
-
- menuitem = gtk_radio_menu_item_new_with_label (NULL, "");
- mts->autopick_all_item = menuitem;
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- accel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menuitem)->child), _("_All People and Resources"));
- gtk_menu_append (GTK_MENU (mts->autopick_menu), menuitem);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, 0, 0);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, GDK_MOD1_MASK, 0);
- gtk_signal_connect (GTK_OBJECT (menuitem), "toggled",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_autopick_option_toggled), mts);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_radio_menu_item_new_with_label (group, "");
- mts->autopick_all_people_one_resource_item = menuitem;
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- accel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menuitem)->child), _("All _People and One Resource"));
- gtk_menu_append (GTK_MENU (mts->autopick_menu), menuitem);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, 0, 0);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, GDK_MOD1_MASK, 0);
- gtk_signal_connect (GTK_OBJECT (menuitem), "toggled",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_autopick_option_toggled), mts);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_radio_menu_item_new_with_label (group, "");
- mts->autopick_required_people_item = menuitem;
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- accel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menuitem)->child), _("_Required People"));
- gtk_menu_append (GTK_MENU (mts->autopick_menu), menuitem);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, 0, 0);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, GDK_MOD1_MASK, 0);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_autopick_option_toggled), mts);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_radio_menu_item_new_with_label (group, "");
- mts->autopick_required_people_one_resource_item = menuitem;
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- accel_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (menuitem)->child), _("Required People and _One Resource"));
- gtk_menu_append (GTK_MENU (mts->autopick_menu), menuitem);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, 0, 0);
- gtk_widget_add_accelerator (menuitem, "activate", menu_accel_group,
- accel_key, GDK_MOD1_MASK, 0);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_autopick_option_toggled), mts);
- gtk_widget_show (menuitem);
-
- /* Create the date entry fields on the right. */
- alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
- gtk_table_attach (GTK_TABLE (mts), alignment,
- 1, 4, 5, 6, GTK_FILL, 0, 0, 0);
- gtk_widget_show (alignment);
-
- table = gtk_table_new (2, 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 4);
- gtk_container_add (GTK_CONTAINER (alignment), table);
- gtk_widget_show (table);
-
- label = gtk_label_new ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (label),
- _("Meeting _start time:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1, 0, 1, GTK_FILL, 0, 4, 0);
- gtk_widget_show (label);
-
- mts->start_date_edit = gnome_date_edit_new (0, TRUE, TRUE);
- /* I don't like the 'Calendar' label. */
- gtk_widget_hide (GNOME_DATE_EDIT (mts->start_date_edit)->cal_label);
- gtk_table_attach (GTK_TABLE (table), mts->start_date_edit,
- 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
- gtk_widget_show (mts->start_date_edit);
- gtk_signal_connect (GTK_OBJECT (mts->start_date_edit), "date_changed",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_start_time_changed), mts);
- gtk_signal_connect (GTK_OBJECT (mts->start_date_edit), "time_changed",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_start_time_changed), mts);
- gtk_signal_connect (GTK_OBJECT (GNOME_DATE_EDIT (mts->start_date_edit)->date_entry), "activate", GTK_SIGNAL_FUNC (e_meeting_time_selector_on_start_time_changed), mts);
- gtk_signal_connect (GTK_OBJECT (GNOME_DATE_EDIT (mts->start_date_edit)->time_entry), "activate", GTK_SIGNAL_FUNC (e_meeting_time_selector_on_start_time_changed), mts);
- gtk_widget_add_accelerator (GNOME_DATE_EDIT (mts->start_date_edit)->date_entry,
- "grab_focus", mts->accel_group,
- accel_key, GDK_MOD1_MASK, 0);
-
- label = gtk_label_new ("");
- accel_key = gtk_label_parse_uline (GTK_LABEL (label),
- _("Meeting _end time:"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label,
- 0, 1, 1, 2, GTK_FILL, 0, 4, 0);
- gtk_widget_show (label);
-
- mts->end_date_edit = gnome_date_edit_new (0, TRUE, TRUE);
- gtk_widget_hide (GNOME_DATE_EDIT (mts->end_date_edit)->cal_label);
- gtk_table_attach (GTK_TABLE (table), mts->end_date_edit,
- 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
- gtk_widget_show (mts->end_date_edit);
- gtk_signal_connect (GTK_OBJECT (mts->end_date_edit), "date_changed",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_end_time_changed), mts);
- gtk_signal_connect (GTK_OBJECT (mts->end_date_edit), "time_changed",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_on_end_time_changed), mts);
- gtk_signal_connect (GTK_OBJECT (GNOME_DATE_EDIT (mts->end_date_edit)->date_entry), "activate", GTK_SIGNAL_FUNC (e_meeting_time_selector_on_end_time_changed), mts);
- gtk_signal_connect (GTK_OBJECT (GNOME_DATE_EDIT (mts->end_date_edit)->time_entry), "activate", GTK_SIGNAL_FUNC (e_meeting_time_selector_on_end_time_changed), mts);
- gtk_widget_add_accelerator (GNOME_DATE_EDIT (mts->end_date_edit)->date_entry,
- "grab_focus", mts->accel_group,
- accel_key, GDK_MOD1_MASK, 0);
-
- gtk_table_set_col_spacing (GTK_TABLE (mts), 0, 4);
- gtk_table_set_row_spacing (GTK_TABLE (mts), 4, 12);
-
- /* Allocate the colors. */
- visual = gtk_widget_get_visual (GTK_WIDGET (mts));
- colormap = gtk_widget_get_colormap (GTK_WIDGET (mts));
- mts->color_context = gdk_color_context_new (visual, colormap);
- e_meeting_time_selector_alloc_named_color (mts, "gray75", &mts->bg_color);
- e_meeting_time_selector_alloc_named_color (mts, "gray50", &mts->all_attendees_bg_color);
- gdk_color_black (colormap, &mts->grid_color);
- gdk_color_white (colormap, &mts->grid_shadow_color);
- e_meeting_time_selector_alloc_named_color (mts, "gray50", &mts->grid_unused_color);
- gdk_color_white (colormap, &mts->meeting_time_bg_color);
- gdk_color_white (colormap, &mts->stipple_bg_color);
- gdk_color_white (colormap, &mts->attendee_list_bg_color);
-
- e_meeting_time_selector_alloc_named_color (mts, "LightSkyBlue2", &mts->busy_colors[E_MEETING_TIME_SELECTOR_BUSY_TENTATIVE]);
- e_meeting_time_selector_alloc_named_color (mts, "blue", &mts->busy_colors[E_MEETING_TIME_SELECTOR_BUSY_BUSY]);
- e_meeting_time_selector_alloc_named_color (mts, "HotPink3", &mts->busy_colors[E_MEETING_TIME_SELECTOR_BUSY_OUT_OF_OFFICE]);
-
- /* Create the stipple, for attendees with no data. */
- mts->stipple = gdk_bitmap_create_from_data (NULL, (gchar*)stipple_bits,
- 8, 8);
-
- /* Connect handlers to the adjustments in the main canvas, so we can
- scroll the other 2 canvases. */
- gtk_signal_connect (GTK_OBJECT (GTK_LAYOUT (mts->display_main)->hadjustment), "value_changed", GTK_SIGNAL_FUNC (e_meeting_time_selector_hadjustment_changed), mts);
- gtk_signal_connect (GTK_OBJECT (GTK_LAYOUT (mts->display_main)->vadjustment), "value_changed", GTK_SIGNAL_FUNC (e_meeting_time_selector_vadjustment_changed), mts);
-
- e_meeting_time_selector_recalc_grid (mts);
- e_meeting_time_selector_ensure_meeting_time_shown (mts);
- e_meeting_time_selector_update_start_date_edit (mts);
- e_meeting_time_selector_update_end_date_edit (mts);
- e_meeting_time_selector_update_date_popup_menus (mts);
-}
-
-
-/* This adds a color to the color key beneath the main display. If color is
- NULL, it displays the No Info stipple instead. */
-static void
-e_meeting_time_selector_add_key_color (EMeetingTimeSelector * mts,
- GtkWidget *hbox,
- gchar *label_text, GdkColor *color)
-{
- GtkWidget *child_hbox, *darea, *label;
-
- child_hbox = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (hbox), child_hbox, TRUE, TRUE, 0);
- gtk_widget_show (child_hbox);
-
- darea = gtk_drawing_area_new ();
- gtk_box_pack_start (GTK_BOX (child_hbox), darea, FALSE, FALSE, 0);
- gtk_object_set_user_data (GTK_OBJECT (darea), mts);
- gtk_widget_set_usize (darea, 14, 14);
- gtk_widget_show (darea);
-
- label = gtk_label_new (label_text);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (child_hbox), label, TRUE, TRUE, 0);
- gtk_widget_show (label);
-
- gtk_signal_connect (GTK_OBJECT (darea), "expose_event",
- GTK_SIGNAL_FUNC (e_meeting_time_selector_expose_key_color),
- color);
-}
-
-
-static gint
-e_meeting_time_selector_expose_title_bar (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data)
-{
- EMeetingTimeSelector * mts;
- GdkFont *font;
-
- mts = E_MEETING_TIME_SELECTOR (data);
-
- gtk_draw_shadow (widget->style, widget->window, GTK_STATE_NORMAL,
- GTK_SHADOW_OUT, 0, 0,
- E_MEETING_TIME_SELECTOR_ICON_COLUMN_WIDTH + 1,
- widget->allocation.height);
- gtk_draw_shadow (widget->style, widget->window, GTK_STATE_NORMAL,
- GTK_SHADOW_OUT,
- E_MEETING_TIME_SELECTOR_ICON_COLUMN_WIDTH + 1, 0,
- widget->allocation.width - E_MEETING_TIME_SELECTOR_ICON_COLUMN_WIDTH - 1,
- widget->allocation.height);
-
- font = widget->style->font;
- gdk_draw_string (widget->window, font,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- E_MEETING_TIME_SELECTOR_ICON_COLUMN_WIDTH + 4,
- 4 + font->ascent, _("All Attendees"));
-
- return FALSE;
-}
-
-
-static gint
-e_meeting_time_selector_expose_key_color (GtkWidget *darea,
- GdkEventExpose *event,
- GdkColor *color)
-{
- EMeetingTimeSelector * mts;
- GdkGC *gc;
- gint width, height;
-
- mts = gtk_object_get_user_data (GTK_OBJECT (darea));
- gc = mts->color_key_gc;
- width = darea->allocation.width;
- height = darea->allocation.height;
-
- gtk_draw_shadow (darea->style, darea->window, GTK_STATE_NORMAL,
- GTK_SHADOW_IN, 0, 0, width, height);
-
- if (color) {
- gdk_gc_set_foreground (gc, color);
- gdk_draw_rectangle (darea->window, gc, TRUE, 1, 1,
- width - 2, height - 2);
- } else {
- gdk_gc_set_foreground (gc, &mts->grid_color);
- gdk_gc_set_background (gc, &mts->stipple_bg_color);
- gdk_gc_set_stipple (gc, mts->stipple);
- gdk_gc_set_fill (gc, GDK_OPAQUE_STIPPLED);
- gdk_draw_rectangle (darea->window, gc, TRUE, 1, 1,
- width - 2, height - 2);
- gdk_gc_set_fill (gc, GDK_SOLID);
- }
-
- return TRUE;
-}
-
-
-static void
-e_meeting_time_selector_alloc_named_color (EMeetingTimeSelector * mts,
- const char *name, GdkColor *c)
-{
- int failed;
-
- g_return_if_fail (name != NULL);
- g_return_if_fail (c != NULL);
-
- gdk_color_parse (name, c);
- c->pixel = 0;
- c->pixel = gdk_color_context_get_pixel (mts->color_context,
- c->red, c->green, c->blue,
- &failed);
- if (failed)
- g_warning ("Failed to allocate color: %s\n", name);
-}
-
-
-static void
-e_meeting_time_selector_options_menu_detacher (GtkWidget *widget,
- GtkMenu *menu)
-{
- EMeetingTimeSelector *mts;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (widget));
-
- mts = E_MEETING_TIME_SELECTOR (widget);
- g_return_if_fail (mts->options_menu == (GtkWidget*) menu);
-
- mts->options_menu = NULL;
-}
-
-
-static void
-e_meeting_time_selector_autopick_menu_detacher (GtkWidget *widget,
- GtkMenu *menu)
-{
- EMeetingTimeSelector *mts;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (widget));
-
- mts = E_MEETING_TIME_SELECTOR (widget);
- g_return_if_fail (mts->autopick_menu == (GtkWidget*) menu);
-
- mts->autopick_menu = NULL;
-}
-
-
-GtkWidget *
-e_meeting_time_selector_new (void)
-{
- GtkWidget *mts;
-
- mts = GTK_WIDGET (gtk_type_new (e_meeting_time_selector_get_type ()));
-
- return mts;
-}
-
-
-static void
-e_meeting_time_selector_destroy (GtkObject *object)
-{
- EMeetingTimeSelector *mts;
- EMeetingTimeSelectorAttendee *attendee;
- gint row;
-
- mts = E_MEETING_TIME_SELECTOR (object);
-
- e_meeting_time_selector_remove_timeout (mts);
-
- gdk_color_context_free (mts->color_context);
- gdk_bitmap_unref (mts->stipple);
-
- for (row = 0; row < mts->attendees->len; row++) {
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
- g_free (attendee->name);
- g_array_free (attendee->busy_periods, TRUE);
- }
-
- g_array_free (mts->attendees, TRUE);
-
- if (GTK_OBJECT_CLASS (e_meeting_time_selector_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (e_meeting_time_selector_parent_class)->destroy)(object);
-}
-
-
-static void
-e_meeting_time_selector_realize (GtkWidget *widget)
-{
- EMeetingTimeSelector *mts;
-
- if (GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->realize)
- (*GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->realize)(widget);
-
- mts = E_MEETING_TIME_SELECTOR (widget);
-
- mts->color_key_gc = gdk_gc_new (widget->window);
-}
-
-
-static void
-e_meeting_time_selector_unrealize (GtkWidget *widget)
-{
- EMeetingTimeSelector *mts;
-
- mts = E_MEETING_TIME_SELECTOR (widget);
-
- gdk_gc_unref (mts->color_key_gc);
- mts->color_key_gc = NULL;
-
- if (GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->unrealize)
- (*GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->unrealize)(widget);
-}
-
-
-static void
-e_meeting_time_selector_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
- EMeetingTimeSelector *mts;
- EMeetingTimeSelectorTime saved_time;
- GdkFont *font;
- gint hour, max_hour_width;
-
- if (GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->style_set)
- (*GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->style_set)(widget, previous_style);
-
- mts = E_MEETING_TIME_SELECTOR (widget);
- font = widget->style->font;
-
- /* Calculate the widths of the hour strings in the style's font. */
- max_hour_width = 0;
- for (hour = 0; hour < 24; hour++) {
- mts->hour_widths[hour] = gdk_string_width (font, EMeetingTimeSelectorHours[hour]);
- max_hour_width = MAX (max_hour_width, mts->hour_widths[hour]);
- }
-
- /* The row height really depends on the requested height of the
- GtkEntry widgets in the list on the left, so we really need to
- call size_request on them, AFTER their style has been set. */
- /* FIXME: This uses the default style ythickness of 2, though it won't
- be needed when we switch to Miguel's new editable GtkCList widget
- so I won't worry about it. */
- mts->row_height = font->ascent + font->descent
- + E_MEETING_TIME_SELECTOR_ENTRY_INNER_BORDER * 2
- + 2 * 2;
- mts->col_width = max_hour_width + 4;
-
- e_meeting_time_selector_save_position (mts, &saved_time);
- e_meeting_time_selector_recalc_grid (mts);
- e_meeting_time_selector_restore_position (mts, &saved_time);
-
- gtk_widget_set_usize (mts->display_top, -1, mts->row_height * 3);
- gtk_widget_set_usize (mts->attendees_title_bar, -1, mts->row_height);
-
- GTK_LAYOUT (mts->display_main)->hadjustment->step_increment = mts->col_width;
- GTK_LAYOUT (mts->display_main)->vadjustment->step_increment = mts->row_height;
-}
-
-
-/* This draws a shadow around the top display and main display. */
-static gint
-e_meeting_time_selector_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- EMeetingTimeSelector *mts;
- gint x, y, w, h;
-
- mts = E_MEETING_TIME_SELECTOR (widget);
-
- /* Draw the shadow around the attendees title bar and list. */
- x = mts->attendees_title_bar->allocation.x - 2;
- y = mts->attendees_title_bar->allocation.y - 2;
- w = mts->attendees_title_bar->allocation.width + 4;
- h = mts->attendees_title_bar->allocation.height + mts->attendees_list->allocation.height + 4;
-
- gtk_draw_shadow (widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, x, y, w, h);
-
- /* Draw the shadow around the graphical displays. */
- x = mts->display_top->allocation.x - 2;
- y = mts->display_top->allocation.y - 2;
- w = mts->display_top->allocation.width + 4;
- h = mts->display_top->allocation.height + mts->display_main->allocation.height + 4;
-
- gtk_draw_shadow (widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, x, y, w, h);
-
- if (GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->expose_event)
- (*GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->expose_event)(widget, event);
-
- return FALSE;
-}
-
-
-/* When the main canvas scrolls, we scroll the other canvases. */
-static void
-e_meeting_time_selector_hadjustment_changed (GtkAdjustment *adjustment,
- EMeetingTimeSelector *mts)
-{
- GtkAdjustment *adj;
-
- adj = GTK_LAYOUT (mts->display_top)->hadjustment;
- if (adj->value != adjustment->value) {
- adj->value = adjustment->value;
- gtk_signal_emit_by_name (GTK_OBJECT (adj), "value_changed");
- }
-}
-
-
-static void
-e_meeting_time_selector_vadjustment_changed (GtkAdjustment *adjustment,
- EMeetingTimeSelector *mts)
-{
- GtkAdjustment *adj;
-
- adj = GTK_LAYOUT (mts->attendees_list)->vadjustment;
- if (adj->value != adjustment->value) {
- adj->value = adjustment->value;
- gtk_signal_emit_by_name (GTK_OBJECT (adj), "value_changed");
- }
-}
-
-
-void
-e_meeting_time_selector_get_meeting_time (EMeetingTimeSelector *mts,
- gint *start_year,
- gint *start_month,
- gint *start_day,
- gint *start_hour,
- gint *start_minute,
- gint *end_year,
- gint *end_month,
- gint *end_day,
- gint *end_hour,
- gint *end_minute)
-{
- *start_year = g_date_year (&mts->meeting_start_time.date);
- *start_month = g_date_month (&mts->meeting_start_time.date);
- *start_day = g_date_day (&mts->meeting_start_time.date);
- *start_hour = mts->meeting_start_time.hour;
- *start_minute = mts->meeting_start_time.minute;
-
- *end_year = g_date_year (&mts->meeting_end_time.date);
- *end_month = g_date_month (&mts->meeting_end_time.date);
- *end_day = g_date_day (&mts->meeting_end_time.date);
- *end_hour = mts->meeting_end_time.hour;
- *end_minute = mts->meeting_end_time.minute;
-}
-
-
-gboolean
-e_meeting_time_selector_set_meeting_time (EMeetingTimeSelector *mts,
- gint start_year,
- gint start_month,
- gint start_day,
- gint start_hour,
- gint start_minute,
- gint end_year,
- gint end_month,
- gint end_day,
- gint end_hour,
- gint end_minute)
-{
- g_return_val_if_fail (IS_E_MEETING_TIME_SELECTOR (mts), FALSE);
-
- /* Check the dates are valid. */
- if (!g_date_valid_dmy (start_day, start_month, start_year)
- || !g_date_valid_dmy (end_day, end_month, end_year)
- || start_hour < 0 || start_hour > 23
- || end_hour < 0 || end_hour > 23
- || start_minute < 0 || start_minute > 59
- || end_minute < 0 || end_minute > 59)
- return FALSE;
-
- g_date_set_dmy (&mts->meeting_start_time.date, start_day, start_month,
- start_year);
- mts->meeting_start_time.hour = start_hour;
- mts->meeting_start_time.minute = start_minute;
- g_date_set_dmy (&mts->meeting_end_time.date, end_day, end_month,
- end_year);
- mts->meeting_end_time.hour = end_hour;
- mts->meeting_end_time.minute = end_minute;
-
- mts->meeting_positions_valid = FALSE;
-
- gtk_widget_queue_draw (mts->display_top);
- gtk_widget_queue_draw (mts->display_main);
-
- /* Set the times in the GnomeDateEdit widgets. */
- e_meeting_time_selector_update_start_date_edit (mts);
- e_meeting_time_selector_update_end_date_edit (mts);
-
- return TRUE;
-}
-
-
-void
-e_meeting_time_selector_set_working_hours_only (EMeetingTimeSelector *mts,
- gboolean working_hours_only)
-{
- EMeetingTimeSelectorTime saved_time;
-
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
-
- if (mts->working_hours_only == working_hours_only)
- return;
-
- mts->working_hours_only = working_hours_only;
-
- e_meeting_time_selector_save_position (mts, &saved_time);
- e_meeting_time_selector_recalc_grid (mts);
- e_meeting_time_selector_restore_position (mts, &saved_time);
-
- gtk_widget_queue_draw (mts->display_top);
- gtk_widget_queue_draw (mts->display_main);
- e_meeting_time_selector_update_date_popup_menus (mts);
-}
-
-
-void
-e_meeting_time_selector_set_working_hours (EMeetingTimeSelector *mts,
- gint day_start_hour,
- gint day_start_minute,
- gint day_end_hour,
- gint day_end_minute)
-{
- EMeetingTimeSelectorTime saved_time;
-
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
-
- if (mts->day_start_hour == day_start_hour
- && mts->day_start_minute == day_start_minute
- && mts->day_end_hour == day_end_hour
- && mts->day_end_minute == day_end_minute)
- return;
-
- mts->day_start_hour = day_start_hour;
- mts->day_start_minute = day_start_minute;
- mts->day_end_hour = day_end_hour;
- mts->day_end_minute = day_end_minute;
-
- e_meeting_time_selector_save_position (mts, &saved_time);
- e_meeting_time_selector_recalc_grid (mts);
- e_meeting_time_selector_restore_position (mts, &saved_time);
-
- gtk_widget_queue_draw (mts->display_top);
- gtk_widget_queue_draw (mts->display_main);
- e_meeting_time_selector_update_date_popup_menus (mts);
-}
-
-
-void
-e_meeting_time_selector_set_zoomed_out (EMeetingTimeSelector *mts,
- gboolean zoomed_out)
-{
- EMeetingTimeSelectorTime saved_time;
-
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
-
- if (mts->zoomed_out == zoomed_out)
- return;
-
- mts->zoomed_out = zoomed_out;
-
- e_meeting_time_selector_save_position (mts, &saved_time);
- e_meeting_time_selector_recalc_grid (mts);
- e_meeting_time_selector_restore_position (mts, &saved_time);
-
- gtk_widget_queue_draw (mts->display_top);
- gtk_widget_queue_draw (mts->display_main);
-}
-
-
-EMeetingTimeSelectorAutopickOption
-e_meeting_time_selector_get_autopick_option (EMeetingTimeSelector *mts)
-{
- if (GTK_CHECK_MENU_ITEM (mts->autopick_all_item)->active)
- return E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_RESOURCES;
- if (GTK_CHECK_MENU_ITEM (mts->autopick_all_people_one_resource_item)->active)
- return E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_ONE_RESOURCE;
- if (GTK_CHECK_MENU_ITEM (mts->autopick_required_people_item)->active)
- return E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE;
- return E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE_AND_ONE_RESOURCE;
-}
-
-
-void
-e_meeting_time_selector_set_autopick_option (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorAutopickOption autopick_option)
-{
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
-
- switch (autopick_option) {
- case E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_RESOURCES:
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mts->autopick_all_item), TRUE);
- break;
- case E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_ONE_RESOURCE:
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mts->autopick_all_people_one_resource_item), TRUE);
- break;
- case E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE:
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mts->autopick_required_people_item), TRUE);
- break;
- case E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE_AND_ONE_RESOURCE:
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mts->autopick_required_people_one_resource_item), TRUE);
- break;
- }
-}
-
-
-/* Adds an attendee to the list, returning the row. The data is meant for
- something like an address book id, though if the user edits the name this
- will become invalid. We'll probably have to handle address book lookup
- ourself. */
-gint
-e_meeting_time_selector_attendee_add (EMeetingTimeSelector *mts,
- gchar *attendee_name,
- gpointer data)
-{
- EMeetingTimeSelectorAttendee attendee;
- GtkWidget *entry;
- gint list_width, item_width;
-
- g_return_val_if_fail (IS_E_MEETING_TIME_SELECTOR (mts), -1);
- g_return_val_if_fail (attendee_name != NULL, -1);
-
- attendee.name = g_strdup (attendee_name);
- attendee.type = E_MEETING_TIME_SELECTOR_REQUIRED_PERSON;
- attendee.has_calendar_info = FALSE;
- attendee.send_meeting_to = TRUE;
- attendee.busy_periods = g_array_new (FALSE, FALSE,
- sizeof (EMeetingTimeSelectorPeriod));
- attendee.busy_periods_sorted = TRUE;
- attendee.longest_period_in_days = 0;
- attendee.data = data;
-
- /* Add to the list on the left. */
- entry = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (entry), attendee_name);
- gtk_widget_show (entry);
- list_width = GTK_WIDGET (mts->attendees_list)->allocation.width;
- item_width = MAX (1, list_width - E_MEETING_TIME_SELECTOR_ICON_COLUMN_WIDTH);
- attendee.text_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (mts->attendees_list)->root),
- gnome_canvas_widget_get_type (),
- "GnomeCanvasWidget::widget", entry,
- "GnomeCanvasWidget::size_pixels", TRUE,
- "GnomeCanvasWidget::x", (gdouble) E_MEETING_TIME_SELECTOR_ICON_COLUMN_WIDTH,
- "GnomeCanvasWidget::y", (gdouble) (mts->attendees->len * mts->row_height),
- "GnomeCanvasWidget::width", (gdouble) item_width,
- "GnomeCanvasWidget::height", (gdouble) mts->row_height,
- NULL);
- gnome_canvas_item_hide (attendee.text_item);
-
- g_array_append_val (mts->attendees, attendee);
-
- /* Update the scroll region. */
- e_meeting_time_selector_update_attendees_list_scroll_region (mts);
- e_meeting_time_selector_update_main_canvas_scroll_region (mts);
-
- /* Redraw the canvases. */
- gtk_widget_queue_draw (mts->display_top);
- gtk_widget_queue_draw (mts->display_main);
-
-
- return mts->attendees->len - 1;
-}
-
-
-gint
-e_meeting_time_selector_attendee_find_by_name (EMeetingTimeSelector *mts,
- gchar *attendee_name,
- gint start_row)
-{
- EMeetingTimeSelectorAttendee *attendee;
- gint row;
-
- g_return_val_if_fail (IS_E_MEETING_TIME_SELECTOR (mts), -1);
- g_return_val_if_fail (start_row >= 0, -1);
- g_return_val_if_fail (start_row < mts->attendees->len, -1);
-
- for (row = start_row; row < mts->attendees->len; row++) {
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
- if (!strcmp (attendee->name, attendee_name))
- return row;
- }
-
- return -1;
-}
-
-
-gint
-e_meeting_time_selector_attendee_find_by_data (EMeetingTimeSelector *mts,
- gpointer data,
- gint start_row)
-{
- EMeetingTimeSelectorAttendee *attendee;
- gint row;
-
- g_return_val_if_fail (IS_E_MEETING_TIME_SELECTOR (mts), -1);
- g_return_val_if_fail (start_row >= 0, -1);
- g_return_val_if_fail (start_row < mts->attendees->len, -1);
-
- for (row = start_row; row < mts->attendees->len; row++) {
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
- if (attendee->data == data)
- return row;
- }
-
- return -1;
-}
-
-
-void
-e_meeting_time_selector_attendee_remove (EMeetingTimeSelector *mts,
- gint row)
-{
- EMeetingTimeSelectorAttendee *attendee;
-
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
- g_return_if_fail (row >= 0);
- g_return_if_fail (row < mts->attendees->len);
-
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
-
- g_free (attendee->name);
- g_array_free (attendee->busy_periods, TRUE);
-
- /* Destroy the GtkEntry in the list. */
- gtk_object_destroy (GTK_OBJECT (attendee->text_item));
-
- g_array_remove_index (mts->attendees, row);
-
- /* Update the positions of all the other GtkEntry widgets. */
- e_meeting_time_selector_update_attendees_list_positions (mts);
-
- e_meeting_time_selector_update_attendees_list_scroll_region (mts);
- e_meeting_time_selector_update_main_canvas_scroll_region (mts);
- gtk_widget_queue_draw (mts->display_top);
- gtk_widget_queue_draw (mts->display_main);
-}
-
-
-void
-e_meeting_time_selector_attendee_set_type (EMeetingTimeSelector *mts,
- gint row,
- EMeetingTimeSelectorAttendeeType type)
-{
- EMeetingTimeSelectorAttendee *attendee;
-
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
- g_return_if_fail (row >= 0);
- g_return_if_fail (row < mts->attendees->len);
-
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
- attendee->type = type;
-}
-
-
-void
-e_meeting_time_selector_attendee_set_has_calendar_info (EMeetingTimeSelector *mts,
- gint row,
- gboolean has_calendar_info)
-{
- EMeetingTimeSelectorAttendee *attendee;
-
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
- g_return_if_fail (row >= 0);
- g_return_if_fail (row < mts->attendees->len);
-
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
- attendee->has_calendar_info = has_calendar_info;
-}
-
-
-void
-e_meeting_time_selector_attendee_set_send_meeting_to (EMeetingTimeSelector *mts,
- gint row,
- gboolean send_meeting_to)
-{
- EMeetingTimeSelectorAttendee *attendee;
-
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
- g_return_if_fail (row >= 0);
- g_return_if_fail (row < mts->attendees->len);
-
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
- attendee->send_meeting_to = send_meeting_to;
-}
-
-
-/* Clears all busy times for the given attendee. */
-void
-e_meeting_time_selector_attendee_clear_busy_periods (EMeetingTimeSelector *mts,
- gint row)
-{
- EMeetingTimeSelectorAttendee *attendee;
-
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
- g_return_if_fail (row >= 0);
- g_return_if_fail (row < mts->attendees->len);
-
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
-
- g_array_set_size (attendee->busy_periods, 0);
- attendee->busy_periods_sorted = TRUE;
- attendee->longest_period_in_days = 0;
-}
-
-
-/* Adds one busy time for the given attendee. It returns FALSE if the date
- or time is invalid. Months and days count from 1. */
-gboolean
-e_meeting_time_selector_attendee_add_busy_period (EMeetingTimeSelector *mts,
- gint row,
- gint start_year,
- gint start_month,
- gint start_day,
- gint start_hour,
- gint start_minute,
- gint end_year,
- gint end_month,
- gint end_day,
- gint end_hour,
- gint end_minute,
- EMeetingTimeSelectorBusyType busy_type)
-{
- EMeetingTimeSelectorAttendee *attendee;
- EMeetingTimeSelectorPeriod period;
- gint period_in_days;
-
- g_return_val_if_fail (IS_E_MEETING_TIME_SELECTOR (mts), FALSE);
- g_return_val_if_fail (row >= 0, FALSE);
- g_return_val_if_fail (row < mts->attendees->len, FALSE);
- g_return_val_if_fail (busy_type >= 0, FALSE);
- g_return_val_if_fail (busy_type < E_MEETING_TIME_SELECTOR_BUSY_LAST, FALSE);
-
- /* Check the dates are valid. */
- if (!g_date_valid_dmy (start_day, start_month, start_year))
- return FALSE;
- if (!g_date_valid_dmy (end_day, end_month, end_year))
- return FALSE;
- if (start_hour < 0 || start_hour > 23)
- return FALSE;
- if (end_hour < 0 || end_hour > 23)
- return FALSE;
- if (start_minute < 0 || start_minute > 59)
- return FALSE;
- if (end_minute < 0 || end_minute > 59)
- return FALSE;
-
- g_date_clear (&period.start.date, 1);
- g_date_clear (&period.end.date, 1);
- g_date_set_dmy (&period.start.date, start_day, start_month, start_year);
- g_date_set_dmy (&period.end.date, end_day, end_month, end_year);
- period.start.hour = start_hour;
- period.start.minute = start_minute;
- period.end.hour = end_hour;
- period.end.minute = end_minute;
- period.busy_type = busy_type;
-
- /* Check that the start time is before or equal to the end time. */
- if (e_meeting_time_selector_compare_times (&period.start, &period.end) > 0)
- return FALSE;
-
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
- g_array_append_val (attendee->busy_periods, period);
- attendee->has_calendar_info = TRUE;
- attendee->busy_periods_sorted = FALSE;
-
- period_in_days = g_date_julian (&period.end.date) - g_date_julian (&period.start.date) + 1;
- attendee->longest_period_in_days = MAX (attendee->longest_period_in_days, period_in_days);
-
- return TRUE;
-}
-
-
-void
-e_meeting_time_selector_attendee_ensure_periods_sorted (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorAttendee *attendee)
-{
- if (attendee->busy_periods_sorted)
- return;
-
- qsort (attendee->busy_periods->data, attendee->busy_periods->len,
- sizeof (EMeetingTimeSelectorPeriod),
- e_meeting_time_selector_compare_period_starts);
- attendee->busy_periods_sorted = TRUE;
-}
-
-
-/* This compares two time periods, using their end times. */
-static gint
-e_meeting_time_selector_compare_period_starts (const void *arg1,
- const void *arg2)
-{
- EMeetingTimeSelectorPeriod *period1, *period2;
-
- period1 = (EMeetingTimeSelectorPeriod *) arg1;
- period2 = (EMeetingTimeSelectorPeriod *) arg2;
-
- return e_meeting_time_selector_compare_times (&period1->start,
- &period2->start);
-}
-
-
-/* This compares two time periods, using start and end times, mainly to see if
- they overlap at all. If they overlap it returns 0. Or -1 if arg1 < arg2.
- Or 1 if arg1 > arg2. */
-/* Currently unused. */
-#if 0
-static gint
-e_meeting_time_selector_compare_periods (const void *arg1,
- const void *arg2)
-{
- EMeetingTimeSelectorPeriod *period1, *period2;
-
- period1 = (EMeetingTimeSelectorPeriod *) arg1;
- period2 = (EMeetingTimeSelectorPeriod *) arg2;
-
- /* If period 2 starts after period 1 ends, return 1. */
- if (e_meeting_time_selector_compare_times (&period2->start, &period1->end) >= 0)
- return 1;
-
- /* If period 1 starts after period 2 ends, return -1. */
- if (e_meeting_time_selector_compare_times (&period1->start, &period2->end) >= 0)
- return -1;
-
- /* They must overlap so return 0. */
- return 0;
-}
-#endif
-
-
-static gint
-e_meeting_time_selector_compare_times (EMeetingTimeSelectorTime *time1,
- EMeetingTimeSelectorTime *time2)
-{
- gint day_comparison;
-
- day_comparison = g_date_compare (&time1->date,
- &time2->date);
- if (day_comparison != 0)
- return day_comparison;
-
- if (time1->hour < time2->hour)
- return -1;
- if (time1->hour > time2->hour)
- return 1;
-
- if (time1->minute < time2->minute)
- return -1;
- if (time1->minute > time2->minute)
- return 1;
-
- /* The start times are exactly the same. */
- return 0;
-}
-
-
-/*
- * DEBUGGING ROUTINES - functions to output various bits of data.
- */
-
-#ifdef E_MEETING_TIME_SELECTOR_DEBUG
-
-/* Debugging function to dump information on all attendees. */
-void
-e_meeting_time_selector_dump (EMeetingTimeSelector *mts)
-{
- EMeetingTimeSelectorAttendee *attendee;
- EMeetingTimeSelectorPeriod *period;
- gint row, period_num;
- gchar buffer[128];
-
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
-
- g_print ("\n\nAttendee Information:\n");
-
- for (row = 0; row < mts->attendees->len; row++) {
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
- g_print ("Attendee: %s\n", attendee->name);
- g_print (" Longest Busy Period: %i days\n",
- attendee->longest_period_in_days);
-
- e_meeting_time_selector_attendee_ensure_periods_sorted (mts, attendee);
-#if 1
- for (period_num = 0;
- period_num < attendee->busy_periods->len;
- period_num++) {
- period = &g_array_index (attendee->busy_periods,
- EMeetingTimeSelectorPeriod,
- period_num);
-
- g_date_strftime (buffer, 128, "%A, %B %d, %Y",
- &period->start.date);
- g_print (" Start: %s %i:%02i\n", buffer,
- period->start.hour, period->start.minute);
-
- g_date_strftime (buffer, 128, "%A, %B %d, %Y",
- &period->end.date);
- g_print (" End : %s %i:%02i\n", buffer,
- period->end.hour, period->end.minute);
- }
-#endif
- }
-
-}
-
-
-/* This formats a EMeetingTimeSelectorTime in a string and returns it.
- Note that it uses a static buffer. */
-gchar*
-e_meeting_time_selector_dump_time (EMeetingTimeSelectorTime *mtstime)
-{
- static gchar buffer[128];
-
- gchar buffer2[128];
-
- g_date_strftime (buffer, 128, "%A, %B %d, %Y", &mtstime->date);
- sprintf (buffer2, " at %i:%02i", (gint) mtstime->hour,
- (gint) mtstime->minute);
- strcat (buffer, buffer2);
-
- return buffer;
-}
-
-
-/* This formats a GDate in a string and returns it.
- Note that it uses a static buffer. */
-gchar*
-e_meeting_time_selector_dump_date (GDate *date)
-{
- static gchar buffer[128];
-
- g_date_strftime (buffer, 128, "%A, %B %d, %Y", date);
- return buffer;
-}
-
-#endif /* E_MEETING_TIME_SELECTOR_DEBUG */
-
-
-static void
-e_meeting_time_selector_on_invite_others_button_clicked (GtkWidget *button,
- EMeetingTimeSelector *mts)
-{
-
-
-}
-
-
-static void
-e_meeting_time_selector_on_options_button_clicked (GtkWidget *button,
- EMeetingTimeSelector *mts)
-{
- gtk_menu_popup (GTK_MENU (mts->options_menu), NULL, NULL,
- e_meeting_time_selector_options_menu_position_callback,
- mts, 1, GDK_CURRENT_TIME);
-}
-
-
-static void
-e_meeting_time_selector_options_menu_position_callback (GtkMenu *menu,
- gint *x,
- gint *y,
- gpointer user_data)
-{
- EMeetingTimeSelector *mts;
- GtkRequisition menu_requisition;
- gint max_x, max_y;
-
- mts = E_MEETING_TIME_SELECTOR (user_data);
-
- /* Calculate our preferred position. */
- gdk_window_get_origin (mts->options_button->window, x, y);
- *y += mts->options_button->allocation.height;
-
- /* Now make sure we are on the screen. */
- gtk_widget_size_request (mts->options_menu, &menu_requisition);
- max_x = MAX (0, gdk_screen_width () - menu_requisition.width);
- max_y = MAX (0, gdk_screen_height () - menu_requisition.height);
- *x = CLAMP (*x, 0, max_x);
- *y = CLAMP (*y, 0, max_y);
-}
-
-
-static void
-e_meeting_time_selector_on_update_free_busy (GtkWidget *button,
- EMeetingTimeSelector *mts)
-{
-
- /* Make sure the menu pops down, which doesn't happen by default if
- keyboard accelerators are used. */
- if (GTK_WIDGET_VISIBLE (mts->options_menu))
- gtk_menu_popdown (GTK_MENU (mts->options_menu));
-}
-
-
-static void
-e_meeting_time_selector_on_autopick_button_clicked (GtkWidget *button,
- EMeetingTimeSelector *mts)
-{
- gtk_menu_popup (GTK_MENU (mts->autopick_menu), NULL, NULL,
- e_meeting_time_selector_autopick_menu_position_callback,
- mts, 1, GDK_CURRENT_TIME);
-}
-
-
-static void
-e_meeting_time_selector_autopick_menu_position_callback (GtkMenu *menu,
- gint *x,
- gint *y,
- gpointer user_data)
-{
- EMeetingTimeSelector *mts;
- GtkRequisition menu_requisition;
- gint max_x, max_y;
-
- mts = E_MEETING_TIME_SELECTOR (user_data);
-
- /* Calculate our preferred position. */
- gdk_window_get_origin (mts->autopick_button->window, x, y);
- *y += mts->autopick_button->allocation.height;
-
- /* Now make sure we are on the screen. */
- gtk_widget_size_request (mts->autopick_menu, &menu_requisition);
- max_x = MAX (0, gdk_screen_width () - menu_requisition.width);
- max_y = MAX (0, gdk_screen_height () - menu_requisition.height);
- *x = CLAMP (*x, 0, max_x);
- *y = CLAMP (*y, 0, max_y);
-}
-
-
-static void
-e_meeting_time_selector_on_autopick_option_toggled (GtkWidget *button,
- EMeetingTimeSelector *mts)
-{
- /* Make sure the menu pops down, which doesn't happen by default if
- keyboard accelerators are used. */
- if (GTK_WIDGET_VISIBLE (mts->autopick_menu))
- gtk_menu_popdown (GTK_MENU (mts->autopick_menu));
-}
-
-
-static void
-e_meeting_time_selector_on_prev_button_clicked (GtkWidget *button,
- EMeetingTimeSelector *mts)
-{
- e_meeting_time_selector_autopick (mts, FALSE);
-}
-
-
-static void
-e_meeting_time_selector_on_next_button_clicked (GtkWidget *button,
- EMeetingTimeSelector *mts)
-{
- e_meeting_time_selector_autopick (mts, TRUE);
-}
-
-
-/* This tries to find the previous or next meeting time for which all
- attendees will be available. */
-static void
-e_meeting_time_selector_autopick (EMeetingTimeSelector *mts,
- gboolean forward)
-{
- EMeetingTimeSelectorTime start_time, end_time, *resource_free;
- EMeetingTimeSelectorAttendee *attendee;
- EMeetingTimeSelectorPeriod *period;
- EMeetingTimeSelectorAutopickOption autopick_option;
- gint duration_days, duration_hours, duration_minutes, row;
- gboolean meeting_time_ok, skip_optional = FALSE;
- gboolean need_one_resource = FALSE, found_resource;
-
- /* Get the current meeting duration in days + hours + minutes. */
- e_meeting_time_selector_calculate_time_difference (&mts->meeting_start_time, &mts->meeting_end_time, &duration_days, &duration_hours, &duration_minutes);
-
- /* Find the first appropriate start time. */
- start_time = mts->meeting_start_time;
- if (forward)
- e_meeting_time_selector_find_nearest_interval (mts, &start_time, &end_time, duration_days, duration_hours, duration_minutes);
- else
- e_meeting_time_selector_find_nearest_interval_backward (mts, &start_time, &end_time, duration_days, duration_hours, duration_minutes);
-
- /* Determine if we can skip optional people and if we only need one
- resource based on the autopick option. */
- autopick_option = e_meeting_time_selector_get_autopick_option (mts);
- if (autopick_option == E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE
- || autopick_option == E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE_AND_ONE_RESOURCE)
- skip_optional = TRUE;
- if (autopick_option == E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_ONE_RESOURCE
- || autopick_option == E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE_AND_ONE_RESOURCE)
- need_one_resource = TRUE;
-
- /* Keep moving forward or backward until we find a possible meeting
- time. */
- for (;;) {
- meeting_time_ok = TRUE;
- found_resource = FALSE;
- resource_free = NULL;
-
- /* Step through each attendee, checking if the meeting time
- intersects one of the attendees busy periods. */
- for (row = 0; row < mts->attendees->len; row++) {
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee,
- row);
-
- /* Skip optional people if they don't matter. */
- if (skip_optional && attendee->type == E_MEETING_TIME_SELECTOR_OPTIONAL_PERSON)
- continue;
-
- period = e_meeting_time_selector_find_time_clash (mts, attendee, &start_time, &end_time);
-
- if (need_one_resource && attendee->type == E_MEETING_TIME_SELECTOR_RESOURCE) {
- if (period) {
- /* We want to remember the closest
- prev/next time that one resource is
- available, in case we don't find any
- free resources. */
- if (forward) {
- if (!resource_free || e_meeting_time_selector_compare_times (resource_free, &period->end) > 0)
- resource_free = &period->end;
- } else {
- if (!resource_free || e_meeting_time_selector_compare_times (resource_free, &period->start) < 0)
- resource_free = &period->start;
- }
-
- } else {
- found_resource = TRUE;
- }
- } else if (period) {
- /* Skip the period which clashed. */
- if (forward) {
- start_time = period->end;
- } else {
- start_time = period->start;
- e_meeting_time_selector_adjust_time (&start_time, -duration_days, -duration_hours, -duration_minutes);
- }
- meeting_time_ok = FALSE;
- break;
- }
- }
-
- /* Check that we found one resource if necessary. If not, skip
- to the closest time that a resource is free. Note that if
- there are no resources, resource_free will never get set,
- so we assume the meeting time is OK. */
- if (meeting_time_ok && need_one_resource && !found_resource
- && resource_free) {
- if (forward) {
- start_time = *resource_free;
- } else {
- start_time = *resource_free;
- e_meeting_time_selector_adjust_time (&start_time, -duration_days, -duration_hours, -duration_minutes);
- }
- meeting_time_ok = FALSE;
- }
-
- if (meeting_time_ok) {
- mts->meeting_start_time = start_time;
- mts->meeting_end_time = end_time;
- mts->meeting_positions_valid = FALSE;
- gtk_widget_queue_draw (mts->display_top);
- gtk_widget_queue_draw (mts->display_main);
-
- /* Make sure the time is shown. */
- e_meeting_time_selector_ensure_meeting_time_shown (mts);
-
- /* Set the times in the GnomeDateEdit widgets. */
- e_meeting_time_selector_update_start_date_edit (mts);
- e_meeting_time_selector_update_end_date_edit (mts);
- return;
- }
-
- /* Move forward to the next possible interval. */
- if (forward)
- e_meeting_time_selector_find_nearest_interval (mts, &start_time, &end_time, duration_days, duration_hours, duration_minutes);
- else
- e_meeting_time_selector_find_nearest_interval_backward (mts, &start_time, &end_time, duration_days, duration_hours, duration_minutes);
- }
-}
-
-
-static void
-e_meeting_time_selector_calculate_time_difference (EMeetingTimeSelectorTime *start,
- EMeetingTimeSelectorTime *end,
- gint *days,
- gint *hours,
- gint *minutes)
-{
- *days = g_date_julian (&end->date) - g_date_julian (&start->date);
- *hours = end->hour - start->hour;
- *minutes = end->minute - start->minute;
- if (*minutes < 0) {
- *minutes += 60;
- *hours = *hours - 1;
- }
- if (*hours < 0) {
- *hours += 24;
- *days = *days - 1;
- }
-}
-
-
-/* This moves the given time forward to the next suitable start of a meeting.
- If zoomed_out is set, this means every hour. If not every half-hour. */
-static void
-e_meeting_time_selector_find_nearest_interval (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorTime *start_time,
- EMeetingTimeSelectorTime *end_time,
- gint days, gint hours, gint mins)
-{
- gint minutes_shown;
- gboolean set_to_start_of_working_day = FALSE;
-
- if (mts->zoomed_out) {
- start_time->hour++;
- start_time->minute = 0;
- } else {
- start_time->minute += 30;
- start_time->minute -= start_time->minute % 30;
- }
- e_meeting_time_selector_fix_time_overflows (start_time);
-
- *end_time = *start_time;
- e_meeting_time_selector_adjust_time (end_time, days, hours, mins);
-
- /* Check if the interval is less than a day as seen in the display.
- If it isn't we don't worry about the working day. */
- if (!mts->working_hours_only || days > 0)
- return;
- minutes_shown = (mts->day_end_hour - mts->day_start_hour) * 60;
- minutes_shown += mts->day_end_minute - mts->day_start_minute;
- if (hours * 60 + mins > minutes_shown)
- return;
-
- /* If the meeting time finishes past the end of the working day, move
- onto the start of the next working day. If the meeting time starts
- before the working day, move it on as well. */
- if (start_time->hour > mts->day_end_hour
- || (start_time->hour == mts->day_end_hour
- && start_time->minute > mts->day_end_minute)
- || end_time->hour > mts->day_end_hour
- || (end_time->hour == mts->day_end_hour
- && end_time->minute > mts->day_end_minute)) {
- g_date_add_days (&start_time->date, 1);
- set_to_start_of_working_day = TRUE;
- } else if (start_time->hour < mts->day_start_hour
- || (start_time->hour == mts->day_start_hour
- && start_time->minute < mts->day_start_minute)) {
- set_to_start_of_working_day = TRUE;
- }
-
- if (set_to_start_of_working_day) {
- start_time->hour = mts->day_start_hour;
- start_time->minute = mts->day_start_minute;
-
- if (mts->zoomed_out) {
- if (start_time->minute > 0) {
- start_time->hour++;
- start_time->minute = 0;
- }
- } else {
- start_time->minute += 29;
- start_time->minute -= start_time->minute % 30;
- }
- e_meeting_time_selector_fix_time_overflows (start_time);
-
- *end_time = *start_time;
- e_meeting_time_selector_adjust_time (end_time, days, hours, mins);
- }
-}
-
-
-/* This moves the given time backward to the next suitable start of a meeting.
- If zoomed_out is set, this means every hour. If not every half-hour. */
-static void
-e_meeting_time_selector_find_nearest_interval_backward (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorTime *start_time,
- EMeetingTimeSelectorTime *end_time,
- gint days, gint hours, gint mins)
-{
- gint new_hour, minutes_shown;
- gboolean set_to_end_of_working_day = FALSE;
-
- new_hour = start_time->hour;
- if (mts->zoomed_out) {
- if (start_time->minute == 0)
- new_hour--;
- start_time->minute = 0;
- } else {
- if (start_time->minute == 0) {
- start_time->minute = 30;
- new_hour--;
- } else if (start_time->minute <= 30)
- start_time->minute = 0;
- else
- start_time->minute = 30;
- }
- if (new_hour < 0) {
- new_hour += 24;
- g_date_subtract_days (&start_time->date, 1);
- }
- start_time->hour = new_hour;
-
- *end_time = *start_time;
- e_meeting_time_selector_adjust_time (end_time, days, hours, mins);
-
- /* Check if the interval is less than a day as seen in the display.
- If it isn't we don't worry about the working day. */
- if (!mts->working_hours_only || days > 0)
- return;
- minutes_shown = (mts->day_end_hour - mts->day_start_hour) * 60;
- minutes_shown += mts->day_end_minute - mts->day_start_minute;
- if (hours * 60 + mins > minutes_shown)
- return;
-
- /* If the meeting time finishes past the end of the working day, move
- back to the end of the working day. If the meeting time starts
- before the working day, move it back to the end of the previous
- working day. */
- if (start_time->hour > mts->day_end_hour
- || (start_time->hour == mts->day_end_hour
- && start_time->minute > mts->day_end_minute)
- || end_time->hour > mts->day_end_hour
- || (end_time->hour == mts->day_end_hour
- && end_time->minute > mts->day_end_minute)) {
- set_to_end_of_working_day = TRUE;
- } else if (start_time->hour < mts->day_start_hour
- || (start_time->hour == mts->day_start_hour
- && start_time->minute < mts->day_start_minute)) {
- g_date_subtract_days (&end_time->date, 1);
- set_to_end_of_working_day = TRUE;
- }
-
- if (set_to_end_of_working_day) {
- end_time->hour = mts->day_end_hour;
- end_time->minute = mts->day_end_minute;
- *start_time = *end_time;
- e_meeting_time_selector_adjust_time (start_time, -days, -hours, -mins);
-
- if (mts->zoomed_out) {
- start_time->minute = 0;
- } else {
- start_time->minute -= start_time->minute % 30;
- }
-
- *end_time = *start_time;
- e_meeting_time_selector_adjust_time (end_time, days, hours, mins);
- }
-}
-
-
-/* This adds on the given days, hours & minutes to a EMeetingTimeSelectorTime.
- It is used to calculate the end of a period given a start & duration.
- Days, hours & minutes can be negative, to move backwards, but they should
- be within normal ranges, e.g. hours should be between -23 and 23. */
-static void
-e_meeting_time_selector_adjust_time (EMeetingTimeSelectorTime *mtstime,
- gint days, gint hours, gint minutes)
-{
- gint new_hours, new_minutes;
-
- /* We have to handle negative values for hous and minutes here, since
- EMeetingTimeSelectorTime uses guint8s to store them. */
- new_minutes = mtstime->minute + minutes;
- if (new_minutes < 0) {
- new_minutes += 60;
- hours -= 1;
- }
-
- new_hours = mtstime->hour + hours;
- if (new_hours < 0) {
- new_hours += 24;
- days -= 1;
- }
-
- g_date_add_days (&mtstime->date, days);
- mtstime->hour = new_hours;
- mtstime->minute = new_minutes;
-
- e_meeting_time_selector_fix_time_overflows (mtstime);
-}
-
-
-/* This looks for any busy period of the given attendee which clashes with
- the start and end time. It uses a binary search. */
-static EMeetingTimeSelectorPeriod*
-e_meeting_time_selector_find_time_clash (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorAttendee *attendee,
- EMeetingTimeSelectorTime *start_time,
- EMeetingTimeSelectorTime *end_time)
-{
- EMeetingTimeSelectorPeriod *period;
- gint period_num;
-
- period_num = e_meeting_time_selector_find_first_busy_period (mts, attendee, &start_time->date);
-
- if (period_num == -1)
- return NULL;
-
- /* Step forward through the busy periods until we find a clash or we
- go past the end_time. */
- while (period_num < attendee->busy_periods->len) {
- period = &g_array_index (attendee->busy_periods,
- EMeetingTimeSelectorPeriod,
- period_num);
-
- /* If the period starts at or after the end time, there is no
- clash and we are finished. The busy periods are sorted by
- their start times, so all the rest will be later. */
- if (e_meeting_time_selector_compare_times (&period->start,
- end_time) >= 0)
- return NULL;
-
- /* If the period ends after the start time, we have found a
- clash. From the above test we already know the busy period
- isn't completely after the meeting time. */
- if (e_meeting_time_selector_compare_times (&period->end,
- start_time) > 0) {
- return period;
- }
-
- period_num++;
- }
-
- return NULL;
-}
-
-
-/* This subtracts the attendees longest_period_in_days from the given date,
- and does a binary search of the attendee's busy periods array to find the
- first one which could possible end on the given day or later.
- If none are found it returns -1. */
-gint
-e_meeting_time_selector_find_first_busy_period (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorAttendee *attendee,
- GDate *date)
-{
- EMeetingTimeSelectorPeriod *period;
- gint lower, upper, middle, cmp = 0;
- GDate tmp_date;
-
- /* Make sure the busy periods have been sorted. */
- e_meeting_time_selector_attendee_ensure_periods_sorted (mts, attendee);
-
- /* Calculate the first day which could have a busy period which
- continues onto our given date. */
- tmp_date = *date;
- g_date_subtract_days (&tmp_date, attendee->longest_period_in_days);
-
- /* We want the first busy period which starts on tmp_date. */
- lower = 0;
- upper = attendee->busy_periods->len;
-
- if (upper == 0)
- return -1;
-
- while (lower < upper) {
- middle = (lower + upper) >> 1;
-
- period = &g_array_index (attendee->busy_periods,
- EMeetingTimeSelectorPeriod, middle);
-
- cmp = g_date_compare (&tmp_date, &period->start.date);
-
- if (cmp == 0)
- break;
- else if (cmp < 0)
- upper = middle;
- else
- lower = middle + 1;
- }
-
- /* There may be several busy periods on the same day so we step
- backwards to the first one. */
- if (cmp == 0) {
- while (middle > 0) {
- period = &g_array_index (attendee->busy_periods,
- EMeetingTimeSelectorPeriod, middle - 1);
- if (g_date_compare (&tmp_date, &period->start.date) != 0)
- break;
- middle--;
- }
- } else if (cmp > 0) {
- /* This means we couldn't find a period on the given day, and
- the last one we looked at was before it, so if there are
- any more periods after this one we return it. */
- middle++;
- if (attendee->busy_periods->len <= middle)
- return -1;
- }
-
- return middle;
-}
-
-
-static void
-e_meeting_time_selector_on_zoomed_out_toggled (GtkWidget *menuitem,
- EMeetingTimeSelector *mts)
-{
- /* Make sure the menu pops down, which doesn't happen by default if
- keyboard accelerators are used. */
- if (GTK_WIDGET_VISIBLE (mts->options_menu))
- gtk_menu_popdown (GTK_MENU (mts->options_menu));
-
- e_meeting_time_selector_set_zoomed_out (mts, GTK_CHECK_MENU_ITEM (menuitem)->active);
-}
-
-
-static void
-e_meeting_time_selector_on_working_hours_toggled (GtkWidget *menuitem,
- EMeetingTimeSelector *mts)
-{
- /* Make sure the menu pops down, which doesn't happen by default if
- keyboard accelerators are used. */
- if (GTK_WIDGET_VISIBLE (mts->options_menu))
- gtk_menu_popdown (GTK_MENU (mts->options_menu));
-
- e_meeting_time_selector_set_working_hours_only (mts, GTK_CHECK_MENU_ITEM (menuitem)->active);
-}
-
-
-/* This recalculates day_width, first_hour_shown and last_hour_shown. */
-static void
-e_meeting_time_selector_recalc_grid (EMeetingTimeSelector *mts)
-{
- if (mts->working_hours_only) {
- mts->first_hour_shown = mts->day_start_hour;
- mts->last_hour_shown = mts->day_end_hour;
- if (mts->day_end_minute != 0)
- mts->last_hour_shown += 1;
- } else {
- mts->first_hour_shown = 0;
- mts->last_hour_shown = 24;
- }
-
- /* In the brief view we use the nearest hours divisible by 3. */
- if (mts->zoomed_out) {
- mts->first_hour_shown -= mts->first_hour_shown % 3;
- mts->last_hour_shown += 2;
- mts->last_hour_shown -= mts->last_hour_shown % 3;
- }
-
- mts->day_width = mts->col_width * (mts->last_hour_shown - mts->first_hour_shown);
- if (mts->zoomed_out)
- mts->day_width /= 3;
-
- /* Add one pixel for the extra vertical grid line. */
- mts->day_width++;
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (mts->display_top),
- 0, 0,
- mts->day_width * E_MEETING_TIME_SELECTOR_DAYS_SHOWN,
- mts->row_height * 3);
- e_meeting_time_selector_update_main_canvas_scroll_region (mts);
-
- e_meeting_time_selector_recalc_date_format (mts);
- mts->meeting_positions_valid = FALSE;
-}
-
-
-/* This saves the first visible time in the given EMeetingTimeSelectorTime. */
-static void
-e_meeting_time_selector_save_position (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorTime *mtstime)
-{
- gint scroll_x, scroll_y;
-
- gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main),
- &scroll_x, &scroll_y);
- e_meeting_time_selector_calculate_time (mts, scroll_x, mtstime);
-}
-
-
-/* This restores a saved position. */
-static void
-e_meeting_time_selector_restore_position (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorTime *mtstime)
-{
- gint scroll_x, scroll_y, new_scroll_x;
-
- new_scroll_x = e_meeting_time_selector_calculate_time_position (mts,
- mtstime);
- gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main),
- &scroll_x, &scroll_y);
- gnome_canvas_scroll_to (GNOME_CANVAS (mts->display_main),
- new_scroll_x, scroll_y);
-}
-
-
-/* This returns the x pixel coords of the meeting time in the entire scroll
- region. It recalculates them if they have been marked as invalid.
- If it returns FALSE then no meeting time is set or the meeting time is
- not visible in the current scroll area. */
-gboolean
-e_meeting_time_selector_get_meeting_time_positions (EMeetingTimeSelector *mts,
- gint *start_x,
- gint *end_x)
-{
- if (mts->meeting_positions_valid) {
- if (mts->meeting_positions_in_scroll_area) {
- *start_x = mts->meeting_start_x;
- *end_x = mts->meeting_end_x;
- return TRUE;
- } else {
- return FALSE;
- }
- }
-
- mts->meeting_positions_valid = TRUE;
-
- /* Check if the days aren't in our current range. */
- if (g_date_compare (&mts->meeting_start_time.date, &mts->last_date_shown) > 0
- || g_date_compare (&mts->meeting_end_time.date, &mts->first_date_shown) < 0) {
- mts->meeting_positions_in_scroll_area = FALSE;
- return FALSE;
- }
-
- mts->meeting_positions_in_scroll_area = TRUE;
- *start_x = mts->meeting_start_x = e_meeting_time_selector_calculate_time_position (mts, &mts->meeting_start_time);
- *end_x = mts->meeting_end_x = e_meeting_time_selector_calculate_time_position (mts, &mts->meeting_end_time);
-
- return TRUE;
-}
-
-
-/* This recalculates the date format to used, by computing the width of the
- longest date strings in the widget's font and seeing if they fit. */
-static void
-e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts)
-{
- GDate date;
- gint max_date_width, base_width, max_weekday_width, max_month_width;
- gint weekday, month;
- gchar buffer[128];
- GdkFont *font;
-
- font = GTK_WIDGET (mts)->style->font;
-
- /* Check if we will be able to display the full date strings. */
- mts->date_format = E_MEETING_TIME_SELECTOR_DATE_SHORT;
- g_date_clear (&date, 1);
- g_date_set_dmy (&date, 20, 1, 2000);
-
- /* Calculate the maximum date width we can fit into the display. */
- max_date_width = mts->day_width - 2;
-
- /* First compute the width of the date string without the day or
- month names. */
- g_date_strftime (buffer, 128, ", %d, %Y", &date);
- base_width = gdk_string_width (font, buffer);
-
- /* If that doesn't fit just return. We have to use the short format.
- If that doesn't fit it will just be clipped. */
- if (gdk_string_width (font, buffer) > max_date_width)
- return;
-
- /* Now find the biggest weekday name. We start on any day and just
- go through seven days. */
- max_weekday_width = 0;
- for (weekday = 1; weekday <= 7; weekday++) {
- g_date_strftime (buffer, 128, "%A", &date);
- max_weekday_width = MAX (max_weekday_width,
- gdk_string_width (font, buffer));
- g_date_add_days (&date, 1);
- }
-
- /* Now find the biggest month name. */
- max_month_width = 0;
- for (month = 1; month <= 12; month++) {
- g_date_set_month (&date, month);
- g_date_strftime (buffer, 128, "%B", &date);
- max_month_width = MAX (max_month_width,
- gdk_string_width (font, buffer));
- }
-
- /* See if we can use the full date. */
- if (base_width + max_month_width + max_weekday_width <= max_date_width) {
- mts->date_format = E_MEETING_TIME_SELECTOR_DATE_FULL;
- return;
- }
-
- /* Now try it with abbreviated weekday names. */
- g_date_strftime (buffer, 128, " %x", &date);
- base_width = gdk_string_width (font, buffer);
-
- max_weekday_width = 0;
- for (weekday = 1; weekday <= 7; weekday++) {
- g_date_strftime (buffer, 128, "%a", &date);
- max_weekday_width = MAX (max_weekday_width,
- gdk_string_width (font, buffer));
- g_date_add_days (&date, 1);
- }
-
- if (base_width + max_weekday_width <= max_date_width)
- mts->date_format = E_MEETING_TIME_SELECTOR_DATE_ABBREVIATED_DAY;
-}
-
-
-/* Turn off the background of the canvas windows. This reduces flicker
- considerably when scrolling. (Why isn't it in GnomeCanvas?). */
-static void
-e_meeting_time_selector_on_canvas_realized (GtkWidget *widget,
- EMeetingTimeSelector *mts)
-{
- gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window,
- NULL, FALSE);
-}
-
-
-/* This is called when the meeting start time GnomeDateEdit is changed,
- either via the "date_changed". "time_changed" or "activate" signals on one
- of the GtkEntry widgets. So don't use the widget parameter since it may be
- one of the child GtkEntry widgets. */
-static void
-e_meeting_time_selector_on_start_time_changed (GtkWidget *widget,
- EMeetingTimeSelector *mts)
-{
- gint duration_days, duration_hours, duration_minutes;
- EMeetingTimeSelectorTime mtstime;
- time_t newtime;
- struct tm *newtime_tm;
-
- newtime = gnome_date_edit_get_date (GNOME_DATE_EDIT (mts->start_date_edit));
- newtime_tm = localtime (&newtime);
- g_date_clear (&mtstime.date, 1);
- g_date_set_time (&mtstime.date, newtime);
- mtstime.hour = newtime_tm->tm_hour;
- mtstime.minute = newtime_tm->tm_min;
-
- /* If the time hasn't changed, just return. */
- if (e_meeting_time_selector_compare_times (&mtstime, &mts->meeting_start_time) == 0)
- return;
-
- /* Calculate the current meeting duration. */
- e_meeting_time_selector_calculate_time_difference (&mts->meeting_start_time, &mts->meeting_end_time, &duration_days, &duration_hours, &duration_minutes);
-
- /* Set the new start time. */
- mts->meeting_start_time = mtstime;
-
- /* Update the end time so the meeting duration stays the same. */
- mts->meeting_end_time = mts->meeting_start_time;
- e_meeting_time_selector_adjust_time (&mts->meeting_end_time, duration_days, duration_hours, duration_minutes);
- e_meeting_time_selector_update_end_date_edit (mts);
-
- mts->meeting_positions_valid = FALSE;
- e_meeting_time_selector_ensure_meeting_time_shown (mts);
- gtk_widget_queue_draw (mts->display_top);
- gtk_widget_queue_draw (mts->display_main);
-}
-
-
-/* This is called when the meeting end time GnomeDateEdit is changed,
- either via the "date_changed", "time_changed" or "activate" signals on one
- of the GtkEntry widgets. So don't use the widget parameter since it may be
- one of the child GtkEntry widgets. */
-static void
-e_meeting_time_selector_on_end_time_changed (GtkWidget *widget,
- EMeetingTimeSelector *mts)
-{
- EMeetingTimeSelectorTime mtstime;
- time_t newtime;
- struct tm *newtime_tm;
-
- newtime = gnome_date_edit_get_date (GNOME_DATE_EDIT (mts->end_date_edit));
- newtime_tm = localtime (&newtime);
- g_date_clear (&mtstime.date, 1);
- g_date_set_time (&mtstime.date, newtime);
- mtstime.hour = newtime_tm->tm_hour;
- mtstime.minute = newtime_tm->tm_min;
-
- /* If the time hasn't changed, just return. */
- if (e_meeting_time_selector_compare_times (&mtstime, &mts->meeting_end_time) == 0)
- return;
-
- /* Set the new end time. */
- mts->meeting_end_time = mtstime;
-
- /* If the start time is after the end time, set it to the same time. */
- if (e_meeting_time_selector_compare_times (&mtstime, &mts->meeting_start_time) < 0) {
- /* We set it first, before updating the widget, so the signal
- handler will just return. */
- mts->meeting_start_time = mtstime;
- e_meeting_time_selector_update_start_date_edit (mts);
- }
-
- mts->meeting_positions_valid = FALSE;
- e_meeting_time_selector_ensure_meeting_time_shown (mts);
- gtk_widget_queue_draw (mts->display_top);
- gtk_widget_queue_draw (mts->display_main);
-}
-
-
-/* This updates the ranges shown in the GnomeDateEdit popup menus, according
- to working_hours_only etc. */
-static void
-e_meeting_time_selector_update_date_popup_menus (EMeetingTimeSelector *mts)
-{
- GnomeDateEdit *start_edit, *end_edit;
- gint low_hour, high_hour;
-
- start_edit = GNOME_DATE_EDIT (mts->start_date_edit);
- end_edit = GNOME_DATE_EDIT (mts->end_date_edit);
-
- if (mts->working_hours_only) {
- low_hour = mts->day_start_hour;
- high_hour = mts->day_end_hour;
- } else {
- low_hour = 0;
- high_hour = 23;
- }
-
- gnome_date_edit_set_popup_range (start_edit, low_hour, high_hour);
- gnome_date_edit_set_popup_range (end_edit, low_hour, high_hour);
-}
-
-
-static void
-e_meeting_time_selector_on_canvas_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation,
- EMeetingTimeSelector *mts)
-{
- e_meeting_time_selector_update_main_canvas_scroll_region (mts);
-
- e_meeting_time_selector_ensure_meeting_time_shown (mts);
-}
-
-
-static void
-e_meeting_time_selector_on_attendees_list_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation,
- EMeetingTimeSelector *mts)
-{
- e_meeting_time_selector_update_attendees_list_scroll_region (mts);
- e_meeting_time_selector_update_attendees_list_positions (mts);
-}
-
-
-/* This updates the list canvas scroll region according to the number of
- attendees. If the total height needed is less than the height of the canvas,
- we must use the height of the canvas, or it causes problems. */
-static void
-e_meeting_time_selector_update_attendees_list_scroll_region (EMeetingTimeSelector *mts)
-{
- gint height, canvas_width, canvas_height;
-
- height = mts->row_height * mts->attendees->len;
- canvas_width = GTK_WIDGET (mts->attendees_list)->allocation.width;
- canvas_height = GTK_WIDGET (mts->attendees_list)->allocation.height;
-
- height = MAX (height, canvas_height);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (mts->attendees_list),
- 0, 0,
- canvas_width,
- height);
-}
-
-
-/* This updates the canvas scroll regions according to the number of attendees.
- If the total height needed is less than the height of the canvas, we must
- use the height of the canvas, or it causes problems. */
-static void
-e_meeting_time_selector_update_main_canvas_scroll_region (EMeetingTimeSelector *mts)
-{
- gint height, canvas_height, list_width;
-
- height = mts->row_height * mts->attendees->len;
- canvas_height = GTK_WIDGET (mts->display_main)->allocation.height;
- list_width = GTK_WIDGET (mts->attendees_list)->allocation.width;
-
- height = MAX (height, canvas_height);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (mts->attendees_list),
- 0, 0,
- list_width,
- height);
- gnome_canvas_set_scroll_region (GNOME_CANVAS (mts->display_main),
- 0, 0,
- mts->day_width * E_MEETING_TIME_SELECTOR_DAYS_SHOWN,
- height);
-}
-
-
-/* This changes the meeting time based on the given x coordinate and whether
- we are dragging the start or end bar. It returns the new position, which
- will be swapped if the start bar is dragged past the end bar or vice versa.
- It make sure the meeting time is never dragged outside the visible canvas
- area. */
-void
-e_meeting_time_selector_drag_meeting_time (EMeetingTimeSelector *mts,
- gint x)
-{
- EMeetingTimeSelectorTime first_time, last_time, drag_time, *time_to_set;
- gint scroll_x, scroll_y, canvas_width;
- gboolean set_both_times = FALSE;
-
- /* Get the x coords of visible part of the canvas. */
- gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main),
- &scroll_x, &scroll_y);
- canvas_width = mts->display_main->allocation.width;
-
- /* Save the x coordinate for the timeout handler. */
- mts->last_drag_x = (x < scroll_x) ? x - scroll_x
- : x - scroll_x - canvas_width + 1;
-
- /* Check if the mouse is off the edge of the canvas. */
- if (x < scroll_x || x > scroll_x + canvas_width) {
- /* If we haven't added a timeout function, add one. */
- if (mts->auto_scroll_timeout_id == 0) {
- mts->auto_scroll_timeout_id = g_timeout_add (60, e_meeting_time_selector_timeout_handler, mts);
- mts->scroll_count = 0;
-
- /* Call the handler to start scrolling now. */
- e_meeting_time_selector_timeout_handler (mts);
- return;
- }
- } else {
- e_meeting_time_selector_remove_timeout (mts);
- }
-
- /* Calculate the minimum & maximum times we can use, based on the
- scroll offsets and whether zoomed_out is set. */
- e_meeting_time_selector_calculate_time (mts, scroll_x, &first_time);
- e_meeting_time_selector_calculate_time (mts, scroll_x + canvas_width - 1,
- &last_time);
- if (mts->zoomed_out) {
- if (first_time.minute > 30)
- first_time.hour++;
- first_time.minute = 0;
- last_time.minute = 0;
- } else {
- first_time.minute += 15;
- first_time.minute -= first_time.minute % 30;
- last_time.minute -= last_time.minute % 30;
- }
- e_meeting_time_selector_fix_time_overflows (&first_time);
- e_meeting_time_selector_fix_time_overflows (&last_time);
-
- /* Calculate the time from x coordinate. */
- e_meeting_time_selector_calculate_time (mts, x, &drag_time);
-
- /* Calculate the nearest half-hour or hour, depending on whether
- zoomed_out is set. */
- if (mts->zoomed_out) {
- if (drag_time.minute > 30)
- drag_time.hour++;
- drag_time.minute = 0;
- } else {
- drag_time.minute += 15;
- drag_time.minute -= drag_time.minute % 30;
- }
- e_meeting_time_selector_fix_time_overflows (&drag_time);
-
- /* Now make sure we are between first_time & last_time. */
- if (e_meeting_time_selector_compare_times (&drag_time, &first_time) < 0)
- drag_time = first_time;
- if (e_meeting_time_selector_compare_times (&drag_time, &last_time) > 0)
- drag_time = last_time;
-
- /* Set the meeting start or end time to drag_time. */
- if (mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_START)
- time_to_set = &mts->meeting_start_time;
- else
- time_to_set = &mts->meeting_end_time;
-
- /* If the time is unchanged, just return. */
- if (e_meeting_time_selector_compare_times (time_to_set, &drag_time) == 0)
- return;
-
- *time_to_set = drag_time;
-
- /* Check if the start time and end time need to be switched. */
- if (e_meeting_time_selector_compare_times (&mts->meeting_start_time,
- &mts->meeting_end_time) > 0) {
- drag_time = mts->meeting_start_time;
- mts->meeting_start_time = mts->meeting_end_time;
- mts->meeting_end_time = drag_time;
-
- if (mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_START)
- mts->dragging_position = E_MEETING_TIME_SELECTOR_POS_END;
- else
- mts->dragging_position = E_MEETING_TIME_SELECTOR_POS_START;
-
- set_both_times = TRUE;
- }
-
- /* Mark the calculated positions as invalid. */
- mts->meeting_positions_valid = FALSE;
-
- /* Redraw the canvases. */
- gtk_widget_queue_draw (mts->display_top);
- gtk_widget_queue_draw (mts->display_main);
-
- /* Set the times in the GnomeDateEdit widgets. */
- if (set_both_times
- || mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_START)
- e_meeting_time_selector_update_start_date_edit (mts);
-
- if (set_both_times
- || mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_END)
- e_meeting_time_selector_update_end_date_edit (mts);
-}
-
-
-/* This is the timeout function which handles auto-scrolling when the user is
- dragging one of the meeting time vertical bars outside the left or right
- edge of the canvas. */
-static gboolean
-e_meeting_time_selector_timeout_handler (gpointer data)
-{
- EMeetingTimeSelector *mts;
- EMeetingTimeSelectorTime drag_time, *time_to_set;
- gint scroll_x, max_scroll_x, scroll_y, canvas_width;
- gint scroll_speed, scroll_offset;
- gboolean set_both_times = FALSE;
-
- mts = E_MEETING_TIME_SELECTOR (data);
-
- GDK_THREADS_ENTER ();
-
- /* Return if we don't need to scroll yet. */
- if (mts->scroll_count-- > 0) {
- GDK_THREADS_LEAVE ();
- return TRUE;
- }
-
- /* Get the x coords of visible part of the canvas. */
- gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main),
- &scroll_x, &scroll_y);
- canvas_width = mts->display_main->allocation.width;
-
- /* Calculate the scroll delay, between 0 and MAX_SCROLL_SPEED. */
- scroll_speed = abs (mts->last_drag_x / E_MEETING_TIME_SELECTOR_SCROLL_INCREMENT_WIDTH);
- scroll_speed = MIN (scroll_speed,
- E_MEETING_TIME_SELECTOR_MAX_SCROLL_SPEED);
-
- /* Reset the scroll count. */
- mts->scroll_count = E_MEETING_TIME_SELECTOR_MAX_SCROLL_SPEED - scroll_speed;
-
- /* Calculate how much we need to scroll. */
- if (mts->last_drag_x >= 0)
- scroll_offset = mts->col_width;
- else
- scroll_offset = -mts->col_width;
-
- scroll_x += scroll_offset;
- max_scroll_x = (mts->day_width * E_MEETING_TIME_SELECTOR_DAYS_SHOWN)
- - canvas_width;
- scroll_x = CLAMP (scroll_x, 0, max_scroll_x);
-
- /* Calculate the minimum or maximum visible time in the canvas, which
- we will now set the dragged time to. */
- if (scroll_offset > 0) {
- e_meeting_time_selector_calculate_time (mts,
- scroll_x + canvas_width - 1,
- &drag_time);
- if (mts->zoomed_out) {
- drag_time.minute = 0;
- } else {
- drag_time.minute -= drag_time.minute % 30;
- }
- } else {
- e_meeting_time_selector_calculate_time (mts, scroll_x,
- &drag_time);
- if (mts->zoomed_out) {
- if (drag_time.minute > 30)
- drag_time.hour++;
- drag_time.minute = 0;
- } else {
- drag_time.minute += 15;
- drag_time.minute -= drag_time.minute % 30;
- }
- }
- e_meeting_time_selector_fix_time_overflows (&drag_time);
-
- /* Set the meeting start or end time to drag_time. */
- if (mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_START)
- time_to_set = &mts->meeting_start_time;
- else
- time_to_set = &mts->meeting_end_time;
-
- /* If the time is unchanged, just return. */
- if (e_meeting_time_selector_compare_times (time_to_set, &drag_time) == 0) {
- GDK_THREADS_LEAVE ();
- return TRUE;
- }
-
- *time_to_set = drag_time;
-
- /* Check if the start time and end time need to be switched. */
- if (e_meeting_time_selector_compare_times (&mts->meeting_start_time, &mts->meeting_end_time) > 0) {
- drag_time = mts->meeting_start_time;
- mts->meeting_start_time = mts->meeting_end_time;
- mts->meeting_end_time = drag_time;
-
- if (mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_START)
- mts->dragging_position = E_MEETING_TIME_SELECTOR_POS_END;
- else
- mts->dragging_position = E_MEETING_TIME_SELECTOR_POS_START;
-
- set_both_times = TRUE;
- }
-
- /* Mark the calculated positions as invalid. */
- mts->meeting_positions_valid = FALSE;
-
- /* Set the times in the GnomeDateEdit widgets. */
- if (set_both_times
- || mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_START)
- e_meeting_time_selector_update_start_date_edit (mts);
-
- if (set_both_times
- || mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_END)
- e_meeting_time_selector_update_end_date_edit (mts);
-
- /* Redraw the canvases. We freeze and thaw the layouts so that they
- get redrawn completely. Otherwise the pixels get scrolled left or
- right which is not good for us (since our vertical bars have been
- moved) and causes flicker. */
- gtk_layout_freeze (GTK_LAYOUT (mts->display_main));
- gtk_layout_freeze (GTK_LAYOUT (mts->display_top));
- gnome_canvas_scroll_to (GNOME_CANVAS (mts->display_main),
- scroll_x, scroll_y);
- gnome_canvas_scroll_to (GNOME_CANVAS (mts->display_top),
- scroll_x, scroll_y);
- gtk_layout_thaw (GTK_LAYOUT (mts->display_main));
- gtk_layout_thaw (GTK_LAYOUT (mts->display_top));
-
- GDK_THREADS_LEAVE ();
- return TRUE;
-}
-
-
-/* This removes our auto-scroll timeout function, if we have one installed. */
-void
-e_meeting_time_selector_remove_timeout (EMeetingTimeSelector *mts)
-{
- if (mts->auto_scroll_timeout_id) {
- g_source_remove (mts->auto_scroll_timeout_id);
- mts->auto_scroll_timeout_id = 0;
- }
-}
-
-
-/* This updates the GnomeDateEdit widget displaying the meeting start time. */
-static void
-e_meeting_time_selector_update_start_date_edit (EMeetingTimeSelector *mts)
-{
- struct tm start_tm;
- time_t start_time_t;
-
- g_date_to_struct_tm (&mts->meeting_start_time.date, &start_tm);
- start_tm.tm_hour = mts->meeting_start_time.hour;
- start_tm.tm_min = mts->meeting_start_time.minute;
- start_time_t = mktime (&start_tm);
- gnome_date_edit_set_time (GNOME_DATE_EDIT (mts->start_date_edit),
- start_time_t);
-}
-
-
-/* This updates the GnomeDateEdit widget displaying the meeting end time. */
-static void
-e_meeting_time_selector_update_end_date_edit (EMeetingTimeSelector *mts)
-{
- struct tm end_tm;
- time_t end_time_t;
-
- g_date_to_struct_tm (&mts->meeting_end_time.date, &end_tm);
- end_tm.tm_hour = mts->meeting_end_time.hour;
- end_tm.tm_min = mts->meeting_end_time.minute;
- end_time_t = mktime (&end_tm);
- gnome_date_edit_set_time (GNOME_DATE_EDIT (mts->end_date_edit),
- end_time_t);
-}
-
-
-/* This ensures that the meeting time is shown on screen, by scrolling the
- canvas and possibly by changing the range of dates shown in the canvas. */
-static void
-e_meeting_time_selector_ensure_meeting_time_shown (EMeetingTimeSelector *mts)
-{
- gint start_x, end_x, scroll_x, scroll_y, canvas_width;
- gint new_scroll_x;
- gboolean fits_in_canvas;
-
- /* Check if we need to change the range of dates shown. */
- if (g_date_compare (&mts->meeting_start_time.date,
- &mts->first_date_shown) < 0
- || g_date_compare (&mts->meeting_end_time.date,
- &mts->last_date_shown) > 0) {
- e_meeting_time_selector_update_dates_shown (mts);
- gtk_widget_queue_draw (mts->display_top);
- gtk_widget_queue_draw (mts->display_main);
- }
-
- /* If all of the meeting time is visible, just return. */
- e_meeting_time_selector_get_meeting_time_positions (mts, &start_x,
- &end_x);
- gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main),
- &scroll_x, &scroll_y);
- canvas_width = mts->display_main->allocation.width;
- if (start_x > scroll_x && end_x <= scroll_x + canvas_width)
- return;
-
- fits_in_canvas = end_x - start_x < canvas_width ? TRUE : FALSE;
-
- /* If the meeting is not entirely visible, either center it if it is
- smaller than the canvas, or show the start of it if it is big. */
- if (fits_in_canvas) {
- new_scroll_x = (start_x + end_x - canvas_width) / 2;
- } else {
- new_scroll_x = start_x;
- }
- gnome_canvas_scroll_to (GNOME_CANVAS (mts->display_main),
- new_scroll_x, scroll_y);
-}
-
-
-/* This updates the range of dates shown in the canvas, to make sure that the
- currently selected meeting time is in the range. */
-static void
-e_meeting_time_selector_update_dates_shown (EMeetingTimeSelector *mts)
-{
- mts->first_date_shown = mts->meeting_start_time.date;
- g_date_subtract_days (&mts->first_date_shown, 60);
-
- mts->last_date_shown = mts->first_date_shown;
- g_date_add_days (&mts->last_date_shown, E_MEETING_TIME_SELECTOR_DAYS_SHOWN - 1);
-}
-
-
-/* This checks if the time's hour is over 24 or its minute is over 60 and if
- so it updates the day/hour appropriately. Note that hours and minutes are
- stored in guint8's so they can't overflow by much. */
-void
-e_meeting_time_selector_fix_time_overflows (EMeetingTimeSelectorTime *mtstime)
-{
- gint hours_to_add, days_to_add;
-
- hours_to_add = mtstime->minute / 60;
- if (hours_to_add > 0) {
- mtstime->minute -= hours_to_add * 60;
- mtstime->hour += hours_to_add;
- }
-
- days_to_add = mtstime->hour / 24;
- if (days_to_add > 0) {
- mtstime->hour -= days_to_add * 24;
- g_date_add_days (&mtstime->date, days_to_add);
- }
-}
-
-
-static void
-e_meeting_time_selector_update_attendees_list_positions (EMeetingTimeSelector *mts)
-{
- EMeetingTimeSelectorAttendee *attendee;
- gint list_width, item_width;
- gint row;
-
- list_width = GTK_WIDGET (mts->attendees_list)->allocation.width;
- item_width = MAX (1, list_width - E_MEETING_TIME_SELECTOR_ICON_COLUMN_WIDTH);
- for (row = 0; row < mts->attendees->len; row++) {
- attendee = &g_array_index (mts->attendees,
- EMeetingTimeSelectorAttendee, row);
-
- gnome_canvas_item_set (attendee->text_item,
- "GnomeCanvasWidget::y", (gdouble) (row * mts->row_height),
- "GnomeCanvasWidget::width", (gdouble) item_width,
- "GnomeCanvasWidget::height", (gdouble) (mts->row_height),
- NULL);
-
- gnome_canvas_item_show (attendee->text_item);
- }
-
-}
-
-
-/*
- * CONVERSION ROUTINES - functions to convert between different coordinate
- * spaces and dates.
- */
-
-/* This takes an x pixel coordinate within the entire canvas scroll region and
- returns the date in which it falls. If day_position is not NULL it also
- returns the x coordinate within the date, relative to the visible part of
- the canvas. It is used when painting the days in the item_draw function.
- Note that it must handle negative x coordinates in case we are dragging off
- the edge of the canvas. */
-void
-e_meeting_time_selector_calculate_day_and_position (EMeetingTimeSelector *mts,
- gint x,
- GDate *date,
- gint *day_position)
-{
- gint days_from_first_shown;
-
- *date = mts->first_date_shown;
-
- if (x >= 0) {
- days_from_first_shown = x / mts->day_width;
- g_date_add_days (date, days_from_first_shown);
- if (day_position)
- *day_position = - x % mts->day_width;
- } else {
- days_from_first_shown = -x / mts->day_width + 1;
- g_date_subtract_days (date, days_from_first_shown);
- if (day_position)
- *day_position = -mts->day_width - x % mts->day_width;
- }
-}
-
-
-/* This takes an x pixel coordinate within a day, and converts it to hours
- and minutes, depending on working_hours_only and zoomed_out. */
-void
-e_meeting_time_selector_convert_day_position_to_hours_and_mins (EMeetingTimeSelector *mts, gint day_position, guint8 *hours, guint8 *minutes)
-{
- if (mts->zoomed_out)
- day_position *= 3;
-
- /* Calculate the hours & minutes from the first displayed. */
- *hours = day_position / mts->col_width;
- *minutes = (day_position % mts->col_width) * 60 / mts->col_width;
-
- /* Now add on the first hour shown. */
- *hours += mts->first_hour_shown;
-}
-
-
-/* This takes an x pixel coordinate within the entire canvas scroll region and
- returns the time in which it falls. Note that it won't be extremely
- accurate since hours may only be a few pixels wide in the display.
- With zoomed_out set each pixel may represent 5 minutes or more, depending
- on how small the font is. */
-void
-e_meeting_time_selector_calculate_time (EMeetingTimeSelector *mts,
- gint x,
- EMeetingTimeSelectorTime *time)
-{
- gint day_position;
-
- /* First get the day and the x position within the day. */
- e_meeting_time_selector_calculate_day_and_position (mts, x, &time->date,
- NULL);
-
- /* Now convert the day_position into an hour and minute. */
- if (x >= 0)
- day_position = x % mts->day_width;
- else
- day_position = mts->day_width + x % mts->day_width;
-
- e_meeting_time_selector_convert_day_position_to_hours_and_mins (mts, day_position, &time->hour, &time->minute);
-}
-
-
-/* This takes a EMeetingTimeSelectorTime and calculates the x pixel coordinate
- within the entire canvas scroll region. It is used to draw the selected
- meeting time and all the busy periods. */
-gint
-e_meeting_time_selector_calculate_time_position (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorTime *mtstime)
-{
- gint x, date_offset, day_offset;
-
- /* Calculate the number of days since the first date shown in the
- entire canvas scroll region. */
- date_offset = g_date_julian (&mtstime->date) - g_date_julian (&mts->first_date_shown);
-
- /* Calculate the x pixel coordinate of the start of the day. */
- x = date_offset * mts->day_width;
-
- /* Add on the hours and minutes, depending on whether zoomed_out and
- working_hours_only are set. */
- day_offset = (mtstime->hour - mts->first_hour_shown) * 60
- + mtstime->minute;
- /* The day width includes an extra vertical grid line so subtract 1. */
- day_offset *= (mts->day_width - 1);
- day_offset /= (mts->last_hour_shown - mts->first_hour_shown) * 60;
-
- /* Clamp the day_offset in case the time isn't actually visible. */
- x += CLAMP (day_offset, 0, mts->day_width);
-
- return x;
-}
-
-
diff --git a/widgets/meeting-time-sel/e-meeting-time-sel.h b/widgets/meeting-time-sel/e-meeting-time-sel.h
deleted file mode 100644
index 6df15fe54c..0000000000
--- a/widgets/meeting-time-sel/e-meeting-time-sel.h
+++ /dev/null
@@ -1,496 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#ifndef _E_MEETING_TIME_SELECTOR_H_
-#define _E_MEETING_TIME_SELECTOR_H_
-
-#include <gtk/gtktable.h>
-#include <libgnomeui/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * EMeetingTimeSelector displays a list of attendees for a meeting and a
- * graphical summary of the times which they are free and busy, allowing the
- * user to select an appropriate time for a meeting.
- */
-
-/* Define this to include the debugging functions. */
-#undef E_MEETING_TIME_SELECTOR_DEBUG
-
-/* This is the width of the icon column in the attendees list. */
-#define E_MEETING_TIME_SELECTOR_ICON_COLUMN_WIDTH 24
-
-
-/* These specify the type of attendee. Either a person or a resource (e.g. a
- meeting room). These are used for the Autopick options, where the user can
- ask for a time when, for example, all people and one resource are free.
- The default is E_MEETING_TIME_SELECTOR_REQUIRED_PERSON. */
-typedef enum
-{
- E_MEETING_TIME_SELECTOR_REQUIRED_PERSON,
- E_MEETING_TIME_SELECTOR_OPTIONAL_PERSON,
- E_MEETING_TIME_SELECTOR_RESOURCE
-} EMeetingTimeSelectorAttendeeType;
-
-
-/* These are used to specify whether an attendee is free or busy at a
- particular time. We'll probably replace this with a global calendar type.
- These should be ordered in increasing order of preference. Higher precedence
- busy periods will be painted over lower precedence ones. These are also
- used as for loop counters, so they should start at 0 and be ordered. */
-typedef enum
-{
- E_MEETING_TIME_SELECTOR_BUSY_TENTATIVE = 0,
- E_MEETING_TIME_SELECTOR_BUSY_OUT_OF_OFFICE = 1,
- E_MEETING_TIME_SELECTOR_BUSY_BUSY = 2,
-
- E_MEETING_TIME_SELECTOR_BUSY_LAST = 3
-} EMeetingTimeSelectorBusyType;
-
-
-/* This is used to specify the format used when displaying the dates.
- The full format is like 'Sunday, September 12, 1999'. The abbreviated format
- is like 'Sun 12/9/99'. The short format is like '12/9/99'. The actual
- format used is determined in e_meeting_time_selector_style_set(), once we
- know the font being used. */
-typedef enum
-{
- E_MEETING_TIME_SELECTOR_DATE_FULL,
- E_MEETING_TIME_SELECTOR_DATE_ABBREVIATED_DAY,
- E_MEETING_TIME_SELECTOR_DATE_SHORT
-} EMeetingTimeSelectorDateFormat;
-
-
-/* This is used to specify a position regarding the vertical bars around the
- current meeting time, so we know which one is being dragged. */
-typedef enum
-{
- E_MEETING_TIME_SELECTOR_POS_NONE,
- E_MEETING_TIME_SELECTOR_POS_START,
- E_MEETING_TIME_SELECTOR_POS_END
-} EMeetingTimeSelectorPosition;
-
-
-/* This is used to specify the autopick option, which determines how we choose
- the previous/next appropriate meeting time. */
-typedef enum
-{
- E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_RESOURCES,
- E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_ONE_RESOURCE,
- E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE,
- E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE_AND_ONE_RESOURCE
-} EMeetingTimeSelectorAutopickOption;
-
-
-/* This is our representation of a time. We use a GDate to store the day,
- and guint8s for the hours and minutes. */
-typedef struct _EMeetingTimeSelectorTime EMeetingTimeSelectorTime;
-struct _EMeetingTimeSelectorTime
-{
- GDate date;
- guint8 hour;
- guint8 minute;
-};
-
-
-/* This represents a busy period. */
-typedef struct _EMeetingTimeSelectorPeriod EMeetingTimeSelectorPeriod;
-struct _EMeetingTimeSelectorPeriod
-{
- EMeetingTimeSelectorTime start;
- EMeetingTimeSelectorTime end;
- EMeetingTimeSelectorBusyType busy_type;
-};
-
-
-/* This contains information on one attendee. */
-typedef struct _EMeetingTimeSelectorAttendee EMeetingTimeSelectorAttendee;
-struct _EMeetingTimeSelectorAttendee
-{
- gchar *name;
-
- /* The type of attendee, e.g. a person or a resource. */
- EMeetingTimeSelectorAttendeeType type;
-
- /* This is TRUE if the attendee has calendar information available.
- It is set to TRUE when a busy period is added, but can also be set
- to TRUE explicitly to indicate that the attendee has calendar
- information available, but no current busy periods. If it is FALSE
- then a diagonal stipple pattern is used to fill the entire row in
- the main graphical display. */
- gboolean has_calendar_info;
-
- /* This is TRUE if the meeting request is sent to this attendee. */
- gboolean send_meeting_to;
-
- /* This is an array of EMeetingTimeSelectorPeriod elements. When it is
- updated busy_periods_sorted is set to FALSE, and if a function
- needs them sorted, it should call this to re-sort them if needed:
- e_meeting_time_selector_attendee_ensure_periods_sorted(). Note that
- they are sorted by the start times. */
- GArray *busy_periods;
- gboolean busy_periods_sorted;
-
- /* This holds the length of the longest busy period in days, rounded
- up. It is used to determine where to start looking in the
- busy_periods array. If we didn't use this we'd have to go through
- most of the busy_periods array every time we wanted to paint part
- of the display. */
- gint longest_period_in_days;
-
- /* This is the canvas text item where the name is edited. */
- GnomeCanvasItem *text_item;
-
- /* This is supposed to be something like an address book id. */
- gpointer data;
-};
-
-/* An array of hour strings, "0:00" .. "23:00". */
-extern const gchar *EMeetingTimeSelectorHours[24];
-
-
-#define E_MEETING_TIME_SELECTOR(obj) GTK_CHECK_CAST (obj, e_meeting_time_selector_get_type (), EMeetingTimeSelector)
-#define E_MEETING_TIME_SELECTOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_meeting_time_selector_get_type (), EMeetingTimeSelectorClass)
-#define IS_E_MEETING_TIME_SELECTOR(obj) GTK_CHECK_TYPE (obj, e_meeting_time_selector_get_type ())
-
-
-typedef struct _EMeetingTimeSelector EMeetingTimeSelector;
-typedef struct _EMeetingTimeSelectorClass EMeetingTimeSelectorClass;
-
-struct _EMeetingTimeSelector
-{
- /* We subclass a GtkTable which makes it easy to add extra widgets
- if neccesary. */
- GtkTable table;
-
- /*
- * User Interface stuff - widgets, colors etc.
- */
-
- /* This contains our keyboard accelerators, which need to be added to
- the toplevel window. */
- GtkAccelGroup *accel_group;
-
- /* The vbox in the top-left corner, containing the 'All Attendees'
- title bar packed at the end. Extra widgets can be added here
- with PACK_START if necessary. */
- GtkWidget *attendees_title_bar_vbox;
-
- /* The 'All Attendees' title bar above the list of attendees. */
- GtkWidget *attendees_title_bar;
-
- /* The list of attendees. */
- GtkWidget *attendees_list;
-
- /* The canvas displaying the dates, times, and the summary
- 'All Attendees' free/busy display. */
- GtkWidget *display_top;
-
- /* The canvas containing the free/busy displays of individual
- attendees. This is separate from display_top since it also scrolls
- vertically. */
- GtkWidget *display_main;
-
- /* This is the 'Options' button & menu. */
- GtkWidget *options_button;
- GtkWidget *options_menu;
-
- /* This is the 'Autopick' button, menu & radio menu items. */
- GtkWidget *autopick_button;
- GtkWidget *autopick_menu;
- GtkWidget *autopick_all_item;
- GtkWidget *autopick_all_people_one_resource_item;
- GtkWidget *autopick_required_people_item;
- GtkWidget *autopick_required_people_one_resource_item;
-
- /* The horizontal scrollbar which scrolls display_top & display_main.*/
- GtkWidget *hscrollbar;
-
- /* The vertical scrollbar which scrolls attendees & display_main. */
- GtkWidget *vscrollbar;
-
- /* The 2 GnomeDateEdit widgets for the meeting start & end times. */
- GtkWidget *start_date_edit;
- GtkWidget *end_date_edit;
-
- /* Colors. */
- GdkColorContext *color_context;
- GdkColor bg_color;
- GdkColor all_attendees_bg_color;
- GdkColor meeting_time_bg_color;
- GdkColor stipple_bg_color;
- GdkColor attendee_list_bg_color;
- GdkColor grid_color;
- GdkColor grid_shadow_color;
- GdkColor grid_unused_color;
- GdkColor busy_colors[E_MEETING_TIME_SELECTOR_BUSY_LAST];
-
- /* The stipple used for attendees with no data. */
- GdkPixmap *stipple;
-
- /* GC for drawing the color key. */
- GdkGC *color_key_gc;
-
- /* Width of the hours strings (e.g. "1:00") in the current font. */
- gint hour_widths[24];
-
- /* Whether we are using the full, abbreviated or short date format. */
- EMeetingTimeSelectorDateFormat date_format;
-
-
- /*
- * Attendee Data.
- */
-
- /* This is an array of EMeetingTimeSelectorAttendee elements. */
- GArray *attendees;
-
-
- /*
- * Option Settings.
- */
-
- /* If this is TRUE we only show hours between day_start_hour and
- day_end_hour, defaults to TRUE (9am-6pm). */
- gboolean working_hours_only;
- gint day_start_hour;
- gint day_start_minute;
- gint day_end_hour;
- gint day_end_minute;
-
- /* If TRUE, view is compressed, with one cell for every 3 hours rather
- than every hour. Defaults to FALSE. */
- gboolean zoomed_out;
-
-
- /*
- * Internal Data.
- */
-
- /* These are the first & last dates shown in the current scroll area.
- We show E_MEETING_TIME_SELECTOR_DAYS_SHOWN days at a time. */
- GDate first_date_shown;
- GDate last_date_shown;
-
- /* This is the current selection of the meeting time. */
- EMeetingTimeSelectorTime meeting_start_time;
- EMeetingTimeSelectorTime meeting_end_time;
-
- /* These are the x pixel coordinates in the entire scroll region of
- the start and end times. Set to meeting_positions_valid to FALSE to
- invalidate. They will then be recomputed when needed. Always access
- with e_meeting_time_selector_get_meeting_time_positions(). */
- gint meeting_positions_valid;
- gint meeting_positions_in_scroll_area;
- gint meeting_start_x;
- gint meeting_end_x;
-
- /* These are the width and height of the cells, including the grid
- lines which are displayed on the right and top or bottom of cells.*/
- gint row_height;
- gint col_width;
-
- /* This is the width of a day in the display, which depends on
- col_width, working_hours_only and zoomed_out. */
- gint day_width;
-
- /* These are the first and last hour of each day we display, depending
- on working_hours_only and zoomed_out. */
- gint first_hour_shown;
- gint last_hour_shown;
-
- /* The id of the source function for auto-scroll timeouts. */
- guint auto_scroll_timeout_id;
-
- /* This specifies if we are dragging one of the vertical bars around
- the meeting time. */
- EMeetingTimeSelectorPosition dragging_position;
-
- /* The last x coordinate of the mouse, relative to either the left or
- right edge of the canvas. Used in the auto_scroll_timeout function
- to determine which way to scroll and how fast. */
- gint last_drag_x;
-
- /* This is used to determine the delay between scrolls. */
- gint scroll_count;
-};
-
-
-struct _EMeetingTimeSelectorClass
-{
- GtkTableClass parent_class;
-};
-
-
-/*
- * PUBLIC INTERFACE - note that this interface will probably change, when I
- * know where the data is coming from. This is mainly just for testing for now.
- */
-
-GtkType e_meeting_time_selector_get_type (void);
-GtkWidget* e_meeting_time_selector_new (void);
-
-/* This returns the currently selected meeting time.
- Note that months are 1-12 and days are 1-31. The start time is guaranteed to
- be before or equal to the end time. You may want to check if they are equal
- if that if it is a problem. */
-void e_meeting_time_selector_get_meeting_time (EMeetingTimeSelector *mts,
- gint *start_year,
- gint *start_month,
- gint *start_day,
- gint *start_hour,
- gint *start_minute,
- gint *end_year,
- gint *end_month,
- gint *end_day,
- gint *end_hour,
- gint *end_minute);
-
-/* This sets the meeting time, returning TRUE if it is valid. */
-gboolean e_meeting_time_selector_set_meeting_time (EMeetingTimeSelector *mts,
- gint start_year,
- gint start_month,
- gint start_day,
- gint start_hour,
- gint start_minute,
- gint end_year,
- gint end_month,
- gint end_day,
- gint end_hour,
- gint end_minute);
-
-void e_meeting_time_selector_set_working_hours_only (EMeetingTimeSelector *mts,
- gboolean working_hours_only);
-void e_meeting_time_selector_set_working_hours (EMeetingTimeSelector *mts,
- gint day_start_hour,
- gint day_start_minute,
- gint day_end_hour,
- gint day_end_minute);
-
-void e_meeting_time_selector_set_zoomed_out (EMeetingTimeSelector *mts,
- gboolean zoomed_out);
-
-EMeetingTimeSelectorAutopickOption e_meeting_time_selector_get_autopick_option (EMeetingTimeSelector *mts);
-void e_meeting_time_selector_set_autopick_option (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorAutopickOption autopick_option);
-
-/* Adds an attendee to the list, returning the row. The data is meant for
- something like an address book id, though if the user edits the name this
- will become invalid. We'll probably have to handle address book lookup
- ourself. */
-gint e_meeting_time_selector_attendee_add (EMeetingTimeSelector *mts,
- gchar *attendee_name,
- gpointer data);
-gint e_meeting_time_selector_attendee_find_by_name (EMeetingTimeSelector *mts,
- gchar *attendee_name,
- gint start_row);
-gint e_meeting_time_selector_attendee_find_by_data (EMeetingTimeSelector *mts,
- gpointer data,
- gint start_row);
-void e_meeting_time_selector_attendee_remove (EMeetingTimeSelector *mts,
- gint row);
-
-void e_meeting_time_selector_attendee_set_type (EMeetingTimeSelector *mts,
- gint row,
- EMeetingTimeSelectorAttendeeType type);
-void e_meeting_time_selector_attendee_set_has_calendar_info (EMeetingTimeSelector *mts,
- gint row,
- gboolean has_calendar_info);
-void e_meeting_time_selector_attendee_set_send_meeting_to (EMeetingTimeSelector *mts,
- gint row,
- gboolean send_meeting_to);
-
-/* Clears all busy times for the given attendee. */
-void e_meeting_time_selector_attendee_clear_busy_periods (EMeetingTimeSelector *mts,
- gint row);
-/* Adds one busy time for the given attendee. */
-gboolean e_meeting_time_selector_attendee_add_busy_period (EMeetingTimeSelector *mts,
- gint row,
- gint start_year,
- gint start_month,
- gint start_day,
- gint start_hour,
- gint start_minute,
- gint end_year,
- gint end_month,
- gint end_day,
- gint end_hour,
- gint end_minute,
- EMeetingTimeSelectorBusyType busy_type);
-
-
-
-/*
- * INTERNAL ROUTINES - functions to communicate with the canvas items within
- * the EMeetingTimeSelector.
- */
-
-/* This returns the x pixel coordinates of the meeting start and end times,
- in the entire canvas scroll area. If it returns FALSE, then the meeting
- time isn't in the current scroll area (which shouldn't really happen). */
-gboolean e_meeting_time_selector_get_meeting_time_positions (EMeetingTimeSelector *mts,
- gint *start_x,
- gint *end_x);
-
-void e_meeting_time_selector_drag_meeting_time (EMeetingTimeSelector *mts,
- gint x);
-
-void e_meeting_time_selector_remove_timeout (EMeetingTimeSelector *mts);
-
-void e_meeting_time_selector_fix_time_overflows (EMeetingTimeSelectorTime *mtstime);
-
-gint e_meeting_time_selector_find_first_busy_period (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorAttendee *attendee,
- GDate *date);
-
-/* Makes sure the busy periods are sorted, so we can do binary searches. */
-void e_meeting_time_selector_attendee_ensure_periods_sorted (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorAttendee *attendee);
-
-void e_meeting_time_selector_calculate_day_and_position (EMeetingTimeSelector *mts,
- gint x,
- GDate *date,
- gint *day_position);
-void e_meeting_time_selector_convert_day_position_to_hours_and_mins (EMeetingTimeSelector *mts, gint day_position, guint8 *hours, guint8 *minutes);
-void e_meeting_time_selector_calculate_time (EMeetingTimeSelector *mts,
- gint x,
- EMeetingTimeSelectorTime *time);
-gint e_meeting_time_selector_calculate_time_position (EMeetingTimeSelector *mts,
- EMeetingTimeSelectorTime *mtstime);
-
-/* Debugging function to dump information on all attendees. */
-#ifdef E_MEETING_TIME_SELECTOR_DEBUG
-void e_meeting_time_selector_dump (EMeetingTimeSelector *mts);
-gchar* e_meeting_time_selector_dump_time (EMeetingTimeSelectorTime *mtstime);
-gchar* e_meeting_time_selector_dump_date (GDate *date);
-#endif /* E_MEETING_TIME_SELECTOR_DEBUG */
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_MEETING_TIME_SELECTOR_H_ */
diff --git a/widgets/meeting-time-sel/test-meeting-time-sel.c b/widgets/meeting-time-sel/test-meeting-time-sel.c
deleted file mode 100644
index debe4e8f40..0000000000
--- a/widgets/meeting-time-sel/test-meeting-time-sel.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <config.h>
-#include <gnome.h>
-#include "e-meeting-time-sel.h"
-
-void add_random_attendee_test_data (EMeetingTimeSelector *mts);
-void add_simple_attendee_test_data (EMeetingTimeSelector *mts);
-gint get_random_int (gint max);
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *window, *mts;
- gint i;
-
- gnome_init ("test-meeting-time-selector", "0.1", argc, argv);
-
- gtk_widget_push_visual (gdk_imlib_get_visual ());
- gtk_widget_push_colormap (gdk_imlib_get_colormap ());
-
- window = gnome_dialog_new ("Plan a Meeting", "Make Meeting",
- GNOME_STOCK_BUTTON_CLOSE, NULL);
- gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
- gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE);
-
- mts = e_meeting_time_selector_new ();
- gtk_container_add (GTK_CONTAINER (GNOME_DIALOG (window)->vbox), mts);
- gtk_window_add_accel_group (GTK_WINDOW (window),
- E_MEETING_TIME_SELECTOR (mts)->accel_group);
- gtk_widget_show (mts);
-
- gtk_widget_pop_visual ();
- gtk_widget_pop_colormap ();
-
- i = 0;
-#if 1
- for (i = 0; i < 20; i++) {
- add_random_attendee_test_data (E_MEETING_TIME_SELECTOR (mts));
- }
-#else
- for (i = 0; i < 1; i++) {
- add_simple_attendee_test_data (E_MEETING_TIME_SELECTOR (mts));
- }
-#endif
-
-#if 0
- e_meeting_time_selector_dump (E_MEETING_TIME_SELECTOR (mts));
-#endif
-
- gnome_dialog_run (GNOME_DIALOG (window));
-
- gtk_main ();
- return 0;
-}
-
-
-/* Adds an attendee and a lot of random busy periods. The periods start 60
- days before the current date and extend over 365 days, to match the range
- that EMeetingTimeSelector currently displays. We generate a time_t and an
- interval and then convert them into a struct tm which provides everything
- we need. */
-void
-add_random_attendee_test_data (EMeetingTimeSelector *mts)
-{
- gchar buffer[128], *name;
- gint row, num_periods, busy_period, random_num, duration;
- EMeetingTimeSelectorAttendeeType type;
- EMeetingTimeSelectorBusyType busy_type;
- time_t range_start;
- time_t period_start;
- time_t period_end;
- struct tm *tmp_tm;
- struct tm tm1;
- struct tm tm2;
-
- /* Determine the type of attendee. */
- random_num = get_random_int (10);
- if (random_num < 4) {
- type = E_MEETING_TIME_SELECTOR_REQUIRED_PERSON;
- name = "Req. Attendee";
- } else if (random_num < 7) {
- type = E_MEETING_TIME_SELECTOR_OPTIONAL_PERSON;
- name = "Opt. Attendee";
- } else {
- type = E_MEETING_TIME_SELECTOR_RESOURCE;
- name = "Resource";
- }
-
- sprintf (buffer, "%s %i", name, mts->attendees->len + 1);
- row = e_meeting_time_selector_attendee_add (mts, buffer, NULL);
- e_meeting_time_selector_attendee_set_type (mts, row, type);
-
- /* Don't send the meeting request to some attendees. */
- if (get_random_int (10) <= 2)
- e_meeting_time_selector_attendee_set_send_meeting_to (mts, row,
- FALSE);
-
- /* Some attendees have no calendar information. */
- if (get_random_int (10) == 2)
- return;
-
- range_start = time (NULL) - 61 * 24 * 60 * 60;
- num_periods = get_random_int (1000);
-#if 0
- g_print ("num_periods: %i\n", num_periods);
-#endif
- for (busy_period = 0; busy_period < num_periods; busy_period++) {
-
- period_start = range_start + get_random_int (365 * 24 * 60 * 60);
-
- /* Make busy periods mainly 30 mins to a few hours, with a
- couple of week/fortnight periods as well. */
- random_num = get_random_int (10000);
- if (random_num < 2000)
- duration = 30;
- else if (random_num < 5000)
- duration = 60;
- else if (random_num < 7500)
- duration = 90;
- else if (random_num < 9995)
- duration = 120;
- else if (random_num < 9998)
- duration = 60 * 24 * 7;
- else
- duration = 60 * 24 * 14;
-#if 0
- g_print ("random_num: %i, duration: %i\n",
- random_num, duration);
-#endif
- period_end = period_start + duration * 60;
-
- tmp_tm = localtime (&period_start);
- tm1 = *tmp_tm;
- tmp_tm = localtime (&period_end);
- tm2 = *tmp_tm;
-
- /* A hack to avoid daylight-saving time problems. */
- if (tm2.tm_hour == tm1.tm_hour && tm2.tm_min < tm1.tm_min)
- tm2.tm_hour++;
-
- busy_type = get_random_int (E_MEETING_TIME_SELECTOR_BUSY_LAST);
-
- if (!e_meeting_time_selector_attendee_add_busy_period (mts, row, tm1.tm_year + 1900, tm1.tm_mon + 1, tm1.tm_mday, tm1.tm_hour, tm1.tm_min, tm2.tm_year + 1900, tm2.tm_mon + 1, tm2.tm_mday, tm2.tm_hour, tm2.tm_min, busy_type))
- {
- g_print ("Invalid busy period %i/%i/%i %i:%i to %i/%i/%i %i:%i\n", tm1.tm_year + 1900, tm1.tm_mon + 1, tm1.tm_mday, tm1.tm_hour, tm1.tm_min, tm2.tm_year + 1900, tm2.tm_mon + 1, tm2.tm_mday, tm2.tm_hour, tm2.tm_min);
- g_print ("random_num: %i, duration: %i\n",
- random_num, duration);
- }
- }
-}
-
-
-/* Returns a random integer between 0 and max - 1. */
-gint
-get_random_int (gint max)
-{
- gint random_num;
-
- random_num = (int) (max * (rand () / (RAND_MAX + 1.0)));
-#if 0
- g_print ("Random num (%i): %i\n", max, random_num);
-#endif
- return random_num;
-}
-
-
-void
-add_simple_attendee_test_data (EMeetingTimeSelector *mts)
-{
- gint row;
-
- row = e_meeting_time_selector_attendee_add (mts, "John Smith", NULL);
- if (!e_meeting_time_selector_attendee_add_busy_period (mts, row,
- 1999, 11, 7, 14, 30,
- 1999, 11, 7, 16, 30,
- E_MEETING_TIME_SELECTOR_BUSY_BUSY))
- g_warning ("Invalid busy period");
-
- e_meeting_time_selector_attendee_add_busy_period (mts, row,
- 1999, 11, 7, 10, 30,
- 1999, 11, 7, 11, 30,
- E_MEETING_TIME_SELECTOR_BUSY_OUT_OF_OFFICE);
- e_meeting_time_selector_attendee_add_busy_period (mts, row,
- 1999, 11, 4, 10, 30,
- 1999, 11, 7, 11, 30,
- E_MEETING_TIME_SELECTOR_BUSY_BUSY);
- row = e_meeting_time_selector_attendee_add (mts, "Dave Jones", NULL);
- e_meeting_time_selector_attendee_add_busy_period (mts, row,
- 1999, 11, 7, 15, 30,
- 1999, 11, 7, 18, 30,
- E_MEETING_TIME_SELECTOR_BUSY_TENTATIVE);
- e_meeting_time_selector_attendee_add_busy_period (mts, row,
- 1999, 11, 7, 11, 00,
- 1999, 11, 7, 12, 00,
- E_MEETING_TIME_SELECTOR_BUSY_BUSY);
-
- row = e_meeting_time_selector_attendee_add (mts, "Andrew Carlisle", NULL);
- e_meeting_time_selector_attendee_set_send_meeting_to (mts, row, FALSE);
-
- row = e_meeting_time_selector_attendee_add (mts, "Michael Cain", NULL);
- e_meeting_time_selector_attendee_add_busy_period (mts, row,
- 1999, 11, 7, 15, 30,
- 1999, 11, 7, 18, 30,
- E_MEETING_TIME_SELECTOR_BUSY_TENTATIVE);
- e_meeting_time_selector_attendee_add_busy_period (mts, row,
- 1999, 11, 7, 12, 30,
- 1999, 11, 7, 13, 30,
- E_MEETING_TIME_SELECTOR_BUSY_OUT_OF_OFFICE);
- e_meeting_time_selector_attendee_add_busy_period (mts, row,
- 1999, 11, 7, 11, 00,
- 1999, 11, 7, 12, 00,
- E_MEETING_TIME_SELECTOR_BUSY_TENTATIVE);
-}
diff --git a/widgets/misc/e-colors.c b/widgets/misc/e-colors.c
deleted file mode 100644
index 3f1de73784..0000000000
--- a/widgets/misc/e-colors.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * color.c: Color allocation on the Gnumeric spreadsheet
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * We keep our own color context, as the color allocation might take place
- * before any of our Canvases are realized.
- */
-#include <config.h>
-#include <gnome.h>
-#include "color.h"
-
-static int color_inited;
-static GdkColorContext *gnumeric_color_context;
-
-/* Public colors: shared by all of our items in Gnumeric */
-GdkColor gs_white, gs_black, gs_light_gray, gs_dark_gray, gs_red;
-
-int
-color_alloc (gushort red, gushort green, gushort blue)
-{
- int failed;
-
- if (!color_inited)
- color_init ();
-
- return gdk_color_context_get_pixel (gnumeric_color_context,
- red, green, blue, &failed);
-}
-
-void
-color_alloc_gdk (GdkColor *c)
-{
- int failed;
-
- g_return_if_fail (c != NULL);
-
- c->pixel = gdk_color_context_get_pixel (gnumeric_color_context, c->red, c->green, c->blue, &failed);
-}
-
-void
-color_alloc_name (const char *name, GdkColor *c)
-{
- int failed;
-
- g_return_if_fail (name != NULL);
- g_return_if_fail (c != NULL);
-
- gdk_color_parse (name, c);
- c->pixel = 0;
- c->pixel = gdk_color_context_get_pixel (gnumeric_color_context, c->red, c->green, c->blue, &failed);
-}
-
-void
-color_init (void)
-{
- GdkColormap *colormap = gtk_widget_get_default_colormap ();
-
- /* Initialize the color context */
- gnumeric_color_context = gdk_color_context_new (
- gtk_widget_get_default_visual (), colormap);
-
- /* Allocate the default colors */
- gdk_color_white (colormap, &gs_white);
- gdk_color_black (colormap, &gs_black);
-
- color_alloc_name ("gray78", &gs_light_gray);
- color_alloc_name ("gray20", &gs_dark_gray);
- color_alloc_name ("red", &gs_red);
-
- color_inited = 1;
-}
diff --git a/widgets/misc/e-colors.h b/widgets/misc/e-colors.h
deleted file mode 100644
index b2755a5c6a..0000000000
--- a/widgets/misc/e-colors.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef GNUMERIC_COLOR_H
-#define GNUMERIC_COLOR_H
-
-void color_init (void);
-
-/* Return the pixel value for the given red, green and blue */
-int color_alloc (gushort red, gushort green, gushort blue);
-void color_alloc_name (const char *name, GdkColor *color);
-void color_alloc_gdk (GdkColor *color);
-
-/* Colors used by any GnumericSheet item */
-extern GdkColor gs_white, gs_light_gray, gs_dark_gray, gs_black, gs_red;
-
-#endif /* GNUMERIC_COLOR_H */
diff --git a/widgets/misc/e-cursors.c b/widgets/misc/e-cursors.c
deleted file mode 100644
index 597c3c1787..0000000000
--- a/widgets/misc/e-cursors.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef GNUMERIC_CURSORS_H
-#define GNUMERIC_CURSORS_H
-
-typedef enum {
- GNUMERIC_CURSOR_FAT_CROSS,
- GNUMERIC_CURSOR_THIN_CROSS,
- GNUMERIC_CURSOR_ARROW,
- GNUMERIC_CURSOR_MOVE,
- GNUMERIC_CURSOR_ZOOM_IN,
- GNUMERIC_CURSOR_ZOOM_OUT,
- GNUMERIC_CURSOR_SIZE_X,
- GNUMERIC_CURSOR_SIZE_Y,
- GNUMERIC_CURSOR_SIZE_TL,
- GNUMERIC_CURSOR_SIZE_TR,
- GNUMERIC_CURSOR_PRESS,
- GNUMERIC_CURSOR_HAND_OPEN,
- GNUMERIC_CURSOR_HAND_CLOSED,
- GNUMERIC_CURSOR_NUM_CURSORS
-} CursorType;
-
-void cursors_init (void);
-void cursors_shutdown (void);
-
-#define cursor_set(win, c) \
-G_STMT_START { \
- if (win) \
- gdk_window_set_cursor (win, cursor_get (c)); \
-} G_STMT_END
-
-#define cursor_set_widget(w, c) \
-G_STMT_START { \
- if (GTK_WIDGET (w)->window) \
- gdk_window_set_cursor (GTK_WIDGET (w)->window, cursor_get (c)); \
-} G_STMT_END
-
-GdkCursor *cursor_get (CursorType type);
-
-#endif /* GNUMERIC_CURSORS_H */
diff --git a/widgets/misc/e-cursors.h b/widgets/misc/e-cursors.h
deleted file mode 100644
index 597c3c1787..0000000000
--- a/widgets/misc/e-cursors.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef GNUMERIC_CURSORS_H
-#define GNUMERIC_CURSORS_H
-
-typedef enum {
- GNUMERIC_CURSOR_FAT_CROSS,
- GNUMERIC_CURSOR_THIN_CROSS,
- GNUMERIC_CURSOR_ARROW,
- GNUMERIC_CURSOR_MOVE,
- GNUMERIC_CURSOR_ZOOM_IN,
- GNUMERIC_CURSOR_ZOOM_OUT,
- GNUMERIC_CURSOR_SIZE_X,
- GNUMERIC_CURSOR_SIZE_Y,
- GNUMERIC_CURSOR_SIZE_TL,
- GNUMERIC_CURSOR_SIZE_TR,
- GNUMERIC_CURSOR_PRESS,
- GNUMERIC_CURSOR_HAND_OPEN,
- GNUMERIC_CURSOR_HAND_CLOSED,
- GNUMERIC_CURSOR_NUM_CURSORS
-} CursorType;
-
-void cursors_init (void);
-void cursors_shutdown (void);
-
-#define cursor_set(win, c) \
-G_STMT_START { \
- if (win) \
- gdk_window_set_cursor (win, cursor_get (c)); \
-} G_STMT_END
-
-#define cursor_set_widget(w, c) \
-G_STMT_START { \
- if (GTK_WIDGET (w)->window) \
- gdk_window_set_cursor (GTK_WIDGET (w)->window, cursor_get (c)); \
-} G_STMT_END
-
-GdkCursor *cursor_get (CursorType type);
-
-#endif /* GNUMERIC_CURSORS_H */
diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c
deleted file mode 100644
index 7d9f4d49d9..0000000000
--- a/widgets/misc/e-gui-utils.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * GUI utility functions
- *
- * Author:
- * Miguel de Icaza (miguel@helixcode.com)
- *
- * (C) 1999 Miguel de Icaza
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-messagebox.h>
-#include <libgnomeui/gnome-stock.h>
-#include "e-gui-utils.h"
-
-void
-e_notice (GtkWindow *window, const char *type, const char *str)
-{
- GtkWidget *dialog;
-
- dialog = gnome_message_box_new (str, type, GNOME_STOCK_BUTTON_OK, NULL);
-
- if (window)
- gnome_dialog_set_parent (GNOME_DIALOG (dialog), window);
-
- gnome_dialog_run (GNOME_DIALOG (dialog));
-}
-
-static void
-kill_popup_menu (GtkWidget *widget, GtkMenu *menu)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- gtk_object_unref (GTK_OBJECT (menu));
-}
-
-void
-e_auto_kill_popup_menu_on_hide (GtkMenu *menu)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- gtk_signal_connect (GTK_OBJECT (menu), "hide",
- GTK_SIGNAL_FUNC (kill_popup_menu), menu);
-}
-
-void
-e_popup_menu (GtkMenu *menu, GdkEventButton *event)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- e_auto_kill_popup_menu_on_hide (menu);
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button, event->time);
-}
-
-
diff --git a/widgets/misc/e-gui-utils.h b/widgets/misc/e-gui-utils.h
deleted file mode 100644
index 95b8f0b5a1..0000000000
--- a/widgets/misc/e-gui-utils.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef E_GUI_UTILS_H
-#define E_GUI_UTILS_H
-
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkwindow.h>
-
-void e_popup_menu (GtkMenu *menu, GdkEventButton *event);
-void e_auto_kill_popup_menu_on_hide (GtkMenu *menu);
-void e_notice (GtkWindow *window, const char *type, const char *str);
-
-
-#endif /* E_GUI_UTILS_H */
diff --git a/widgets/misc/pixmaps/cursor_cross.xpm b/widgets/misc/pixmaps/cursor_cross.xpm
deleted file mode 100644
index cf9d0aca33..0000000000
--- a/widgets/misc/pixmaps/cursor_cross.xpm
+++ /dev/null
@@ -1,38 +0,0 @@
-/* XPM */
-static char * cursor_cross_xpm[] = {
-"32 32 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ....... ",
-" .+++++.. ",
-" .+++++.. ",
-" .+++++.. ",
-" .+++++.. ",
-" ......+++++...... ",
-" .+++++++++++++++.. ",
-" .+++++++++++++++.. ",
-" .+++++++++++++++.. ",
-" .+++++++++++++++.. ",
-" .+++++++++++++++.. ",
-" ......+++++....... ",
-" .....+++++....... ",
-" .+++++.. ",
-" .+++++.. ",
-" .+++++.. ",
-" ........ ",
-" ....... ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/misc/pixmaps/cursor_hand_closed.xpm b/widgets/misc/pixmaps/cursor_hand_closed.xpm
deleted file mode 100644
index 61a6de4b88..0000000000
--- a/widgets/misc/pixmaps/cursor_hand_closed.xpm
+++ /dev/null
@@ -1,38 +0,0 @@
-/* XPM */
-static char * cursor_hand_closed_xpm[] = {
-"32 32 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" ",
-" ",
-" ",
-" .. ",
-" ..++... ",
-" .+++++++.. ",
-" .+++++++++. ",
-" ...+++++++++. ",
-" .++.+++++++++. ",
-" .++++++++++++. ",
-" .+++++++++++. ",
-" .++++++++++. ",
-" .+++++++++. ",
-" .+++++++. ",
-" .++++++. ",
-" .++++++. ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/misc/pixmaps/cursor_hand_open.xpm b/widgets/misc/pixmaps/cursor_hand_open.xpm
deleted file mode 100644
index 048acc8054..0000000000
--- a/widgets/misc/pixmaps/cursor_hand_open.xpm
+++ /dev/null
@@ -1,38 +0,0 @@
-/* XPM */
-static char * cursor_hand_open_xpm[] = {
-"32 32 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" .. ",
-" .. .++... ",
-" .++..++.++. ",
-" .++..++.++. . ",
-" .++.++.++..+. ",
-" .++.++.++.++. ",
-" .. .+++++++.++. ",
-" .++..++++++++++. ",
-" .+++.+++++++++. ",
-" .++++++++++++. ",
-" .+++++++++++. ",
-" .++++++++++. ",
-" .+++++++++. ",
-" .+++++++. ",
-" .++++++. ",
-" .++++++. ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/misc/pixmaps/cursor_zoom_in.xpm b/widgets/misc/pixmaps/cursor_zoom_in.xpm
deleted file mode 100644
index 1caf9e3e2a..0000000000
--- a/widgets/misc/pixmaps/cursor_zoom_in.xpm
+++ /dev/null
@@ -1,37 +0,0 @@
-/* XPM */
-static char * cursor_zoom_in_xpm[] = {
-"32 32 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ...... ",
-" .. .. ",
-" .. .. ",
-" . . ",
-" . ... . ",
-" . ... . ",
-" . ....... . ",
-" . ....... . ",
-" . ... . ",
-" . ... .. ",
-" .. . . ",
-" .. . . . ",
-" ........ . . ",
-" ..... . . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" . . ",
-" . . ",
-" .. ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/misc/pixmaps/cursor_zoom_out.xpm b/widgets/misc/pixmaps/cursor_zoom_out.xpm
deleted file mode 100644
index af1b698521..0000000000
--- a/widgets/misc/pixmaps/cursor_zoom_out.xpm
+++ /dev/null
@@ -1,37 +0,0 @@
-/* XPM */
-static char * cursor_zoom_out_xpm[] = {
-"32 32 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ...... ",
-" .. .. ",
-" .. .. ",
-" . . ",
-" . . ",
-" . . ",
-" . ....... . ",
-" . ....... . ",
-" . . ",
-" . .. ",
-" .. . . ",
-" .. . . . ",
-" ........ . . ",
-" ..... . . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" . . . ",
-" . . ",
-" . . ",
-" .. ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/shortcut-bar/.cvsignore b/widgets/shortcut-bar/.cvsignore
deleted file mode 100644
index 41439d256d..0000000000
--- a/widgets/shortcut-bar/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-*.o
-libshortcut-bar.a
-Makefile
-Makefile.in
-.deps
-.libs
-test-shortcut-bar
diff --git a/widgets/shortcut-bar/LICENSE b/widgets/shortcut-bar/LICENSE
deleted file mode 100644
index f58649ad9b..0000000000
--- a/widgets/shortcut-bar/LICENSE
+++ /dev/null
@@ -1 +0,0 @@
-This code is licensed under the terms of the GNU GPL \ No newline at end of file
diff --git a/widgets/shortcut-bar/Makefile.am b/widgets/shortcut-bar/Makefile.am
deleted file mode 100644
index c60c57e872..0000000000
--- a/widgets/shortcut-bar/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-
-noinst_LIBRARIES = libshortcut-bar.a
-noinst_PROGRAMS = test-shortcut-bar
-
-INCLUDES = \
- -DEVOLUTION_VERSION=\""$(VERSION)"\" \
- $(EXTRA_GNOME_CFLAGS)
-
-libshortcut_bar_a_SOURCES = \
- e-clipped-label.c \
- e-clipped-label.h \
- e-group-bar.c \
- e-group-bar.h \
- e-icon-bar-bg-item.c \
- e-icon-bar-bg-item.h \
- e-icon-bar-text-item.c \
- e-icon-bar-text-item.h \
- e-icon-bar.c \
- e-icon-bar.h \
- e-shortcut-bar.c \
- e-shortcut-bar.h \
- e-vscrolled-bar.c \
- e-vscrolled-bar.h
-
-test_shortcut_bar_SOURCES = \
- test-shortcut-bar.c
-
-test_shortcut_bar_LDADD = \
- ./libshortcut-bar.a \
- $(EXTRA_GNOME_LIBS) \
diff --git a/widgets/shortcut-bar/e-clipped-label.c b/widgets/shortcut-bar/e-clipped-label.c
deleted file mode 100644
index 0b595f6063..0000000000
--- a/widgets/shortcut-bar/e-clipped-label.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * This is similar to GtkLabel but clips itself and displays '...' if it
- * can't fit inside its allocated area. The intended use is for inside buttons
- * that are a fixed size. The GtkLabel would normally display only the middle
- * part of the text, which doesn't look very good. This only supports one line
- * of text (so no wrapping/justification), without underlined characters.
- */
-
-#include <math.h>
-
-#include <gdk/gdki18n.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-
-#include "e-clipped-label.h"
-
-
-static void e_clipped_label_class_init (EClippedLabelClass *class);
-static void e_clipped_label_init (EClippedLabel *label);
-static void e_clipped_label_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void e_clipped_label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint e_clipped_label_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void e_clipped_label_recalc_chars_displayed (EClippedLabel *label);
-
-
-static GtkMiscClass *parent_class;
-
-/* This is the string to draw when the label is clipped, e.g. '...'. */
-static gchar *e_clipped_label_ellipsis;
-
-/* Flags used in chars_displayed field. Must be negative. */
-#define E_CLIPPED_LABEL_NEED_RECALC -1
-#define E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL -2
-
-
-GtkType
-e_clipped_label_get_type (void)
-{
- static GtkType e_clipped_label_type = 0;
-
- if (!e_clipped_label_type){
- GtkTypeInfo e_clipped_label_info = {
- "EClippedLabel",
- sizeof (EClippedLabel),
- sizeof (EClippedLabelClass),
- (GtkClassInitFunc) e_clipped_label_class_init,
- (GtkObjectInitFunc) e_clipped_label_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- parent_class = gtk_type_class (GTK_TYPE_MISC);
- e_clipped_label_type = gtk_type_unique (GTK_TYPE_MISC,
- &e_clipped_label_info);
- }
-
- return e_clipped_label_type;
-}
-
-
-static void
-e_clipped_label_class_init (EClippedLabelClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- /* Method override */
- widget_class->size_request = e_clipped_label_size_request;
- widget_class->size_allocate = e_clipped_label_size_allocate;
- widget_class->expose_event = e_clipped_label_expose;
-
- e_clipped_label_ellipsis = _("...");
-}
-
-
-static void
-e_clipped_label_init (EClippedLabel *label)
-{
- GTK_WIDGET_SET_FLAGS (label, GTK_NO_WINDOW);
-
- label->label = NULL;
- label->label_wc = NULL;
- label->chars_displayed = E_CLIPPED_LABEL_NEED_RECALC;
-}
-
-
-/**
- * e_clipped_label_new:
- *
- * @text: The label text.
- * @Returns: A new #EClippedLabel.
- *
- * Creates a new #EClippedLabel with the given text.
- **/
-GtkWidget *
-e_clipped_label_new (const gchar *text)
-{
- GtkWidget *label;
-
- label = GTK_WIDGET (gtk_type_new (e_clipped_label_get_type ()));
-
- if (text && *text)
- e_clipped_label_set_text (E_CLIPPED_LABEL (label), text);
-
- return label;
-}
-
-
-static void
-e_clipped_label_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- EClippedLabel *label;
- GdkFont *font;
-
- g_return_if_fail (E_IS_CLIPPED_LABEL (widget));
- g_return_if_fail (requisition != NULL);
-
- label = E_CLIPPED_LABEL (widget);
- font = widget->style->font;
-
- requisition->width = 0;
- requisition->height = font->ascent + font->descent
- + 2 * GTK_MISC (widget)->ypad;
-}
-
-
-static void
-e_clipped_label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- EClippedLabel *label;
-
- label = E_CLIPPED_LABEL (widget);
-
- widget->allocation = *allocation;
-
- /* Flag that we need to recalculate how many characters to display. */
- label->chars_displayed = E_CLIPPED_LABEL_NEED_RECALC;
-}
-
-
-static gint
-e_clipped_label_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- EClippedLabel *label;
- GtkMisc *misc;
- gint x, y;
- GdkFont *font;
- gchar *tmp_str, tmp_ch;
-
- g_return_val_if_fail (E_IS_CLIPPED_LABEL (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- label = E_CLIPPED_LABEL (widget);
- misc = GTK_MISC (widget);
- font = widget->style->font;
-
- /* If the label isn't visible or has no text, just return. */
- if (!GTK_WIDGET_VISIBLE (widget) || !GTK_WIDGET_MAPPED (widget)
- || !label->label || (*label->label == '\0'))
- return TRUE;
-
- /* Recalculate the number of characters displayed, if necessary. */
- if (label->chars_displayed == E_CLIPPED_LABEL_NEED_RECALC)
- e_clipped_label_recalc_chars_displayed (label);
-
- /*
- * GC Clipping
- */
- gdk_gc_set_clip_rectangle (widget->style->white_gc,
- &event->area);
- gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state],
- &event->area);
-
- y = floor (widget->allocation.y + (gint)misc->ypad
- + (((gint)widget->allocation.height - 2 * (gint)misc->ypad
- - (gint)font->ascent - font->descent)
- * misc->yalign) + 0.5) + font->ascent;
-
- if (label->chars_displayed == E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL) {
- x = floor (widget->allocation.x + (gint)misc->xpad
- + (((gint)widget->allocation.width -
- (gint)label->label_width - 2 * (gint)misc->xpad)
- * misc->xalign) + 0.5);
-
- gtk_paint_string (widget->style, widget->window, widget->state,
- &event->area, widget, "label",
- x, y, label->label);
- } else {
- x = widget->allocation.x + (gint)misc->xpad;
-
- tmp_ch = label->label_wc[label->chars_displayed];
- label->label_wc[label->chars_displayed] = '\0';
- tmp_str = gdk_wcstombs (label->label_wc);
- if (tmp_str) {
- gtk_paint_string (widget->style, widget->window,
- widget->state, &event->area,
- widget, "label",
- x, y, tmp_str);
- g_free (tmp_str);
- }
- label->label_wc[label->chars_displayed] = tmp_ch;
-
- x = widget->allocation.x + (gint)misc->xpad
- + label->ellipsis_x;
- gtk_paint_string (widget->style, widget->window, widget->state,
- &event->area, widget, "label",
- x, y, e_clipped_label_ellipsis);
- }
-
- gdk_gc_set_clip_mask (widget->style->white_gc, NULL);
- gdk_gc_set_clip_mask (widget->style->fg_gc[widget->state], NULL);
-
- return TRUE;
-}
-
-
-/**
- * e_clipped_label_get_text:
- *
- * @label: An #EClippedLabel.
- * @Return: The label text.
- *
- * Returns the label text, or NULL.
- **/
-gchar*
-e_clipped_label_get_text (EClippedLabel *label)
-{
- g_return_val_if_fail (E_IS_CLIPPED_LABEL (label), NULL);
-
- return label->label;
-}
-
-
-/**
- * e_clipped_label_set_text:
- *
- * @label: An #EClippedLabel.
- * @text: The new label text.
- *
- * Sets the label text.
- **/
-void
-e_clipped_label_set_text (EClippedLabel *label,
- const gchar *text)
-{
- gint len;
-
- g_return_if_fail (E_IS_CLIPPED_LABEL (label));
-
- if (label->label != text || !label->label || !text
- || strcmp (label->label, text)) {
- g_free (label->label);
- g_free (label->label_wc);
- label->label = NULL;
- label->label_wc = NULL;
-
- if (text) {
- label->label = g_strdup (text);
- len = strlen (text);
- label->label_wc = g_new (GdkWChar, len + 1);
- label->wc_len = gdk_mbstowcs (label->label_wc,
- label->label, len + 1);
- label->label_wc[label->wc_len] = '\0';
- }
-
- /* Reset the number of characters displayed, so it is
- recalculated when needed. */
- label->chars_displayed = E_CLIPPED_LABEL_NEED_RECALC;
-
- /* We don't queue a resize, since the label should not affect
- the widget size, but we queue a draw. */
- gtk_widget_queue_draw (GTK_WIDGET (label));
- }
-}
-
-
-static void
-e_clipped_label_recalc_chars_displayed (EClippedLabel *label)
-{
- GdkFont *font;
- gint max_width, width, ch, last_width;
-
- font = GTK_WIDGET (label)->style->font;
-
- max_width = GTK_WIDGET (label)->allocation.width
- - 2 * GTK_MISC (label)->xpad;
-
- if (!label->label) {
- label->chars_displayed = 0;
- return;
- }
-
- /* See if the entire label fits in the allocated width. */
- label->label_width = gdk_string_width (font, label->label);
- if (label->label_width <= max_width) {
- label->chars_displayed = E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL;
- return;
- }
-
- /* Calculate the width of the ellipsis string. */
- max_width -= gdk_string_measure (font, e_clipped_label_ellipsis);
-
- if (max_width <= 0) {
- label->chars_displayed = 0;
- label->ellipsis_x = 0;
- return;
- }
-
- /* Step through the wide-char label, adding on the widths of the
- characters, until we can't fit any more in. */
- width = last_width = 0;
- for (ch = 0; ch < label->wc_len; ch++) {
- width += gdk_char_width_wc (font, label->label_wc[ch]);
-
- if (width > max_width) {
- label->chars_displayed = ch;
- label->ellipsis_x = last_width;
- return;
- }
-
- last_width = width;
- }
-
- g_warning ("Clipped label width not exceeded as expected");
- label->chars_displayed = E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL;
-}
-
diff --git a/widgets/shortcut-bar/e-clipped-label.h b/widgets/shortcut-bar/e-clipped-label.h
deleted file mode 100644
index b94d261c11..0000000000
--- a/widgets/shortcut-bar/e-clipped-label.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * This is similar to GtkLabel but clips itself and displays '...' if it
- * can't fit inside its allocated area. The intended use is for inside buttons
- * that are a fixed size. The GtkLabel would normally display only the middle
- * part of the text, which doesn't look very good. This only supports one line
- * of text (so no wrapping/justification), without underlined characters.
- */
-#ifndef _E_CLIPPED_LABEL_H_
-#define _E_CLIPPED_LABEL_H_
-
-#include <gtk/gtkmisc.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_CLIPPED_LABEL(obj) GTK_CHECK_CAST (obj, e_clipped_label_get_type (), EClippedLabel)
-#define E_CLIPPED_LABEL_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_clipped_label_get_type (), EClippedLabelClass)
-#define E_IS_CLIPPED_LABEL(obj) GTK_CHECK_TYPE (obj, e_clipped_label_get_type ())
-
-
-typedef struct _EClippedLabel EClippedLabel;
-typedef struct _EClippedLabelClass EClippedLabelClass;
-
-struct _EClippedLabel
-{
- GtkMisc misc;
-
- gchar *label;
- GdkWChar *label_wc;
-
- /* This is the number of wide characters in the label. */
- gint wc_len;
-
- /* This is the width of the entire label string, in pixels. */
- gint label_width;
-
- /* This is the number of characters we can fit in, or
- E_CLIPPED_LABEL_NEED_RECALC if it needs to be recalculated, or
- E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL to show the entire label. */
- gint chars_displayed;
-
- /* This is the x position to display the ellipsis string, e.g. '...',
- relative to the start of the label. */
- gint ellipsis_x;
-};
-
-struct _EClippedLabelClass
-{
- GtkMiscClass parent_class;
-};
-
-
-GtkType e_clipped_label_get_type (void);
-GtkWidget* e_clipped_label_new (const gchar *text);
-
-gchar* e_clipped_label_get_text (EClippedLabel *label);
-void e_clipped_label_set_text (EClippedLabel *label,
- const gchar *text);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_CLIPPED_LABEL_H_ */
diff --git a/widgets/shortcut-bar/e-group-bar.c b/widgets/shortcut-bar/e-group-bar.c
deleted file mode 100644
index 603aa6f78f..0000000000
--- a/widgets/shortcut-bar/e-group-bar.c
+++ /dev/null
@@ -1,1498 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * ShortcutBar displays a vertical bar with a number of Groups, each of which
- * contains any number of icons. It is used on the left of the main application
- * window so users can easily access items such as folders and files.
- */
-
-#include <math.h>
-
-#include <gnome.h>
-
-#include "e-group-bar.h"
-
-#define E_GROUP_BAR_SCROLL_TIMEOUT 10
-#define E_GROUP_BAR_MIN_STEP_SIZE 4
-
-#define E_GROUP_BAR_AUTO_SHOW_TIMEOUT 300
-
-
-static void e_group_bar_class_init (EGroupBarClass *class);
-static void e_group_bar_init (EGroupBar *group_bar);
-static void e_group_bar_destroy (GtkObject *object);
-static void e_group_bar_realize (GtkWidget *widget);
-static void e_group_bar_unrealize (GtkWidget *widget);
-static void e_group_bar_map (GtkWidget *widget);
-static void e_group_bar_unmap (GtkWidget *widget);
-static void e_group_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void e_group_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint e_group_bar_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void e_group_bar_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void e_group_bar_add (GtkContainer *container,
- GtkWidget *widget);
-static void e_group_bar_remove (GtkContainer *container,
- GtkWidget *widget);
-static void e_group_bar_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
-
-static void e_group_bar_create_group_button_window (EGroupBar *group_bar,
- gint group_num);
-static void e_group_bar_create_group_child_window (EGroupBar *group_bar,
- gint group_num);
-static gint e_group_bar_get_group_button_position (EGroupBar *group_bar,
- gint group_num);
-static gint e_group_bar_sum_button_heights (EGroupBar *group_bar,
- gint first,
- gint last);
-static gint e_group_bar_get_child_height (EGroupBar *group_bar);
-static gint e_group_bar_get_group_child_position (EGroupBar *group_bar,
- gint group_num);
-
-static void e_group_bar_on_button_clicked (GtkWidget *group_button,
- EGroupBar *group_bar);
-static gint e_group_bar_find_button (EGroupBar *group_bar,
- GtkWidget *group_button);
-static void e_group_bar_start_animation (EGroupBar *group_bar,
- gint group_num);
-static gboolean e_group_bar_timeout_handler (gpointer data);
-static gint e_group_bar_get_increment (EGroupBar *group_bar,
- gint window_y,
- gint window_target_y);
-static gboolean e_group_bar_on_button_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- EGroupBar *group_bar);
-static void e_group_bar_on_button_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint time,
- EGroupBar *group_bar);
-static gboolean e_group_bar_auto_show (gpointer data);
-static void e_group_bar_stop_all_animation (EGroupBar *group_bar);
-
-
-static GtkContainerClass *parent_class;
-
-
-GtkType
-e_group_bar_get_type (void)
-{
- static GtkType e_group_bar_type = 0;
-
- if (!e_group_bar_type){
- GtkTypeInfo e_group_bar_info = {
- "EGroupBar",
- sizeof (EGroupBar),
- sizeof (EGroupBarClass),
- (GtkClassInitFunc) e_group_bar_class_init,
- (GtkObjectInitFunc) e_group_bar_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
- e_group_bar_type = gtk_type_unique (GTK_TYPE_CONTAINER,
- &e_group_bar_info);
- }
-
- return e_group_bar_type;
-}
-
-
-static void
-e_group_bar_class_init (EGroupBarClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- /* Method override */
- object_class->destroy = e_group_bar_destroy;
-
- widget_class->realize = e_group_bar_realize;
- widget_class->unrealize = e_group_bar_unrealize;
- widget_class->map = e_group_bar_map;
- widget_class->unmap = e_group_bar_unmap;
- widget_class->size_request = e_group_bar_size_request;
- widget_class->size_allocate = e_group_bar_size_allocate;
- widget_class->expose_event = e_group_bar_expose;
- widget_class->draw = e_group_bar_draw;
-
- container_class->add = e_group_bar_add;
- container_class->remove = e_group_bar_remove;
- container_class->forall = e_group_bar_forall;
-}
-
-
-static void
-e_group_bar_init (EGroupBar *group_bar)
-{
-
- GTK_WIDGET_UNSET_FLAGS (group_bar, GTK_NO_WINDOW);
-
- /* We don't want child resizes to propagate up to the parent. */
- gtk_container_set_resize_mode (GTK_CONTAINER (group_bar),
- GTK_RESIZE_QUEUE);
-
- group_bar->children = g_array_new (FALSE, FALSE,
- sizeof (EGroupBarChild));
-
- group_bar->current_group_num = -1;
- group_bar->buttons_homogeneous = TRUE;
- group_bar->max_button_height = 0;
- group_bar->animation_timeout_id = 0;
-}
-
-
-/**
- * e_group_bar_new:
- * @Returns: a new #EGroupBar.
- *
- * Creates a new #EGroupBar.
- **/
-GtkWidget *
-e_group_bar_new (void)
-{
- GtkWidget *group_bar;
-
- group_bar = GTK_WIDGET (gtk_type_new (e_group_bar_get_type ()));
-
- return group_bar;
-}
-
-
-static void
-e_group_bar_destroy (GtkObject *object)
-{
- EGroupBar *group_bar;
-
- group_bar = E_GROUP_BAR (object);
-
- e_group_bar_stop_all_animation (group_bar);
-
- /* The parent GtkContainer class will automatically destroy all the
- child widgets, but it calls gtk_container_foreach() so we must not
- destroy our children array until after. */
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-
- g_array_free (group_bar->children, TRUE);
-}
-
-
-static void
-e_group_bar_realize (GtkWidget *widget)
-{
- EGroupBar *group_bar;
- EGroupBarChild *group;
- GdkWindowAttr attributes;
- gint attributes_mask;
- gint border_width, group_num;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_GROUP_BAR (widget));
-
- group_bar = E_GROUP_BAR (widget);
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- border_width = GTK_CONTAINER (group_bar)->border_width;
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x + border_width;
- attributes.y = widget->allocation.y + border_width;
- attributes.width = widget->allocation.width - 2 * border_width;
- attributes.height = widget->allocation.height - 2 * border_width;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y
- | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window,
- GTK_STATE_NORMAL);
-
- gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
-
- /* Create windows for all the buttons & group canvases. */
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
- e_group_bar_create_group_button_window (group_bar, group_num);
- e_group_bar_create_group_child_window (group_bar, group_num);
- }
-}
-
-
-static void
-e_group_bar_unrealize (GtkWidget *widget)
-{
- EGroupBar *group_bar;
- EGroupBarChild *group;
- gint group_num;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_GROUP_BAR (widget));
-
- group_bar = E_GROUP_BAR (widget);
-
- /* Destroy the windows for all the buttons & group canvases. */
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- if (group->button_window) {
- gdk_window_set_user_data (group->button_window, NULL);
- gdk_window_destroy (group->button_window);
- group->button_window = NULL;
- }
- if (group->child_window) {
- gdk_window_set_user_data (group->child_window, NULL);
- gdk_window_destroy (group->child_window);
- group->child_window = NULL;
- }
- }
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-
-static void
-e_group_bar_map (GtkWidget *widget)
-{
- EGroupBar *group_bar;
- EGroupBarChild *group;
- gint group_num;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_GROUP_BAR (widget));
-
- group_bar = E_GROUP_BAR (widget);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
-
- /* We do this in reverse order, and lower all the child windows, so
- the stacking order ends up correct. */
- for (group_num = group_bar->children->len - 1;
- group_num >= 0;
- group_num--) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- if (group->button_window) {
- gdk_window_show (group->button_window);
- }
-
- if (group->button
- && GTK_WIDGET_VISIBLE (group->button)
- && !GTK_WIDGET_MAPPED (group->button)) {
- gtk_widget_map (group->button);
- }
-
- if (group->child_window) {
- gdk_window_show (group->child_window);
- gdk_window_lower (group->child_window);
- }
-
- if (group->child
- && GTK_WIDGET_VISIBLE (group->child)
- && !GTK_WIDGET_MAPPED (group->child))
- gtk_widget_map (group->child);
- }
-
- gdk_window_show (widget->window);
-}
-
-
-static void
-e_group_bar_unmap (GtkWidget *widget)
-{
- EGroupBar *group_bar;
- EGroupBarChild *group;
- gint group_num;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_GROUP_BAR (widget));
-
- group_bar = E_GROUP_BAR (widget);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- if (group->button_window) {
- gdk_window_hide (group->button_window);
- }
-
- if (group->button
- && GTK_WIDGET_MAPPED (group->button))
- gtk_widget_unmap (group->button);
-
- if (group->child_window) {
- gdk_window_hide (group->child_window);
- }
-
- if (group->child
- && GTK_WIDGET_MAPPED (group->child))
- gtk_widget_unmap (group->child);
- }
-
- gdk_window_hide (widget->window);
-}
-
-
-static void
-e_group_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- EGroupBar *group_bar;
- EGroupBarChild *group;
- gint group_num, max_child_height;
- GtkRequisition child_requisition;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_GROUP_BAR (widget));
- g_return_if_fail (requisition != NULL);
-
- group_bar = E_GROUP_BAR (widget);
-
- /* We set the requisition width to the largest requested width of the
- child widgets. The requisition height is set to the sum of all the
- button heights plus the height of the largest child. */
- requisition->width = 0;
- requisition->height = 0;
-
- /* We have to call size_request on all children, even though we don't
- use the results, since some widgets like GtkLabel depend on it. */
- group_bar->max_button_height = 0;
- max_child_height = 0;
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- if (group->button) {
- gtk_widget_size_request (group->button,
- &child_requisition);
- group->button_height = child_requisition.height;
- } else {
- group->button_height = 0;
- }
-
- group_bar->max_button_height = MAX (group_bar->max_button_height, group->button_height);
- requisition->height += child_requisition.height;
-
- if (group->child) {
- gtk_widget_size_request (group->child,
- &child_requisition);
- max_child_height = MAX (max_child_height,
- child_requisition.height);
- requisition->width = MAX (requisition->width,
- child_requisition.width);
- }
- }
-
- requisition->height += max_child_height;
-
- /* Add on the standard container border widths. */
- requisition->width += GTK_CONTAINER (widget)->border_width * 2;
- requisition->height += GTK_CONTAINER (widget)->border_width * 2;
-}
-
-
-static void
-e_group_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- EGroupBar *group_bar;
- EGroupBarChild *group;
- gint group_num, border_width, width, height, child_height, y;
- GtkAllocation button_allocation, child_allocation;
-
- group_bar = E_GROUP_BAR (widget);
-
- /* All child & button windows and widgets use the same width as the
- group bar minus the border width. */
- border_width = GTK_CONTAINER (widget)->border_width;
- width = allocation->width - border_width * 2;
- height = allocation->height - border_width * 2;
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x + border_width,
- allocation->y + border_width,
- width, height);
-
- /* All the child widgets use the same height. */
- child_height = e_group_bar_get_child_height (group_bar);
-
- /* The buttons are always in the top-left of the button windows, and
- all have the same width. The height is calculated for each group. */
- button_allocation.x = 0;
- button_allocation.y = 0;
- button_allocation.width = width;
-
- /* The child widgets are always in the top-left of the child windows,
- and all have the same width and height. */
- child_allocation.x = 0;
- child_allocation.y = 0;
- child_allocation.width = width;
- child_allocation.height = child_height;
-
- /* Step through the groups, placing the windows as necessary, and
- allocating the areas for the child widgets. Note that if a button
- or child window is in the middle of an animation, we just resize it
- and update the target position, and let the animation continue. */
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- /* Calculate the y position of the button, which depends on
- the currently selected group and the button heights. */
- y = e_group_bar_get_group_button_position (group_bar, group_num);
- button_allocation.height = group_bar->buttons_homogeneous ? group_bar->max_button_height : group->button_height;
-
- if (GTK_WIDGET_REALIZED (group->button)) {
- if (group->button_window_in_animation) {
- gdk_window_resize (group->button_window,
- width, button_allocation.height);
- group->button_window_target_y = y;
- } else {
- gdk_window_move_resize (group->button_window,
- 0, y, width, button_allocation.height);
- }
- }
- gtk_widget_size_allocate (group->button, &button_allocation);
-
- if (GTK_WIDGET_REALIZED (group->child)) {
- if (group->child_window_in_animation) {
- gdk_window_resize (group->child_window,
- width, child_height);
- group->child_window_target_y = y + button_allocation.height;
- } else {
- gdk_window_move_resize (group->child_window,
- 0, y + button_allocation.height,
- width, child_height);
- }
- }
- gtk_widget_size_allocate (group->child, &child_allocation);
- }
-}
-
-
-static gint
-e_group_bar_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- EGroupBar *group_bar;
- EGroupBarChild *group;
- GdkEventExpose child_event;
- gint group_num;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (E_IS_GROUP_BAR (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget)) {
- group_bar = E_GROUP_BAR (widget);
-
- child_event = *event;
-
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- if (event->window == group->button_window
- && GTK_WIDGET_DRAWABLE (group->button)
- && GTK_WIDGET_NO_WINDOW (group->button)
- && gtk_widget_intersect (group->button, &event->area, &child_event.area))
- gtk_widget_event (group->button, (GdkEvent*) &child_event);
-
- if (event->window == group->child_window
- && GTK_WIDGET_DRAWABLE (group->child)
- && GTK_WIDGET_NO_WINDOW (group->child)
- && gtk_widget_intersect (group->child, &event->area, &child_event.area))
- gtk_widget_event (group->child, (GdkEvent*) &child_event);
- }
- }
-
- return FALSE;
-}
-
-
-static void
-e_group_bar_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- EGroupBar *group_bar;
- EGroupBarChild *group;
- gint group_num;
-#if 0
- GdkRectangle child_area;
-#endif
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_GROUP_BAR (widget));
-
- g_print ("In e_group_bar_draw %i,%i %ix%i\n", area->x, area->y,
- area->width, area->height);
-
- if (GTK_WIDGET_DRAWABLE (widget)) {
- group_bar = E_GROUP_BAR (widget);
-
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
- /* FIXME */
-#if 0
- if (GTK_WIDGET_DRAWABLE (child->widget) &&
- gtk_widget_intersect (child->widget, area, &child_area))
- gtk_widget_draw (child->widget, &child_area);
-#endif
- }
- }
-}
-
-
-static void
-e_group_bar_add (GtkContainer *container,
- GtkWidget *widget)
-{
- EGroupBar *group_bar;
- GtkWidget *button;
- gchar buffer[32];
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (E_IS_GROUP_BAR (container));
- g_return_if_fail (widget != NULL);
-
- g_snprintf (buffer, sizeof (buffer), _("Group %i"),
- group_bar->children->len + 1);
- button = gtk_button_new_with_label (buffer);
- gtk_widget_show (button);
-
- e_group_bar_add_group (group_bar, widget, button, -1);
-}
-
-
-static void
-e_group_bar_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- EGroupBar *group_bar;
- gint group_num;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (E_IS_GROUP_BAR (container));
- g_return_if_fail (widget != NULL);
-
- group_bar = E_GROUP_BAR (container);
-
- group_num = e_group_bar_get_group_num (group_bar, widget);
- e_group_bar_remove_group (group_bar, group_num);
-}
-
-
-static void
-e_group_bar_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
-{
- EGroupBar *group_bar;
- EGroupBarChild *group;
- gint group_num;
- GList *tmp_list;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (E_IS_GROUP_BAR (container));
- g_return_if_fail (callback != NULL);
-
- group_bar = E_GROUP_BAR (container);
-
- /* Note that drag-and-drop does not check the Z-order of widgets, so
- we have to iterate through them from top to bottom, or it will
- not work properly. We also have to use temporary lists so widgets
- can be safely destroyed while iterating. */
-
- if (include_internals) {
- tmp_list = NULL;
- for (group_num = group_bar->children->len - 1;
- group_num >= 0;
- group_num--) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- if (group->button)
- tmp_list = g_list_prepend (tmp_list,
- group->button);
- }
-
- g_list_foreach (tmp_list, (GFunc) callback, callback_data);
- g_list_free (tmp_list);
- }
-
- tmp_list = NULL;
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- if (group->child)
- tmp_list = g_list_prepend (tmp_list, group->child);
- }
- g_list_foreach (tmp_list, (GFunc) callback, callback_data);
- g_list_free (tmp_list);
-}
-
-
-static void
-e_group_bar_create_group_button_window (EGroupBar *group_bar,
- gint group_num)
-{
- EGroupBarChild *group;
- GtkWidget *widget;
- GdkWindowAttr attributes;
- gint attributes_mask;
- gint y, height, border_width;
-
- widget = GTK_WIDGET (group_bar);
-
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
- y = e_group_bar_get_group_button_position (group_bar, group_num);
- height = group_bar->buttons_homogeneous ? group_bar->max_button_height
- : group->button_height;
- border_width = GTK_CONTAINER (group_bar)->border_width;
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = 0;
- attributes.y = y;
- attributes.width = widget->allocation.width - 2 * border_width;
- attributes.height = height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y
- | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- group->button_window = gdk_window_new (widget->window, &attributes,
- attributes_mask);
- gdk_window_set_user_data (group->button_window, widget);
-
- gtk_widget_set_parent_window (group->button,
- group->button_window);
- gdk_window_set_back_pixmap (group->button_window, NULL, TRUE);
-}
-
-
-static void
-e_group_bar_create_group_child_window (EGroupBar *group_bar,
- gint group_num)
-{
- EGroupBarChild *group;
- GtkWidget *widget;
- GdkWindowAttr attributes;
- gint attributes_mask;
- gint y, height, border_width;
-
- widget = GTK_WIDGET (group_bar);
-
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
- y = e_group_bar_get_group_button_position (group_bar, group_num);
- y += group_bar->buttons_homogeneous ? group_bar->max_button_height
- : group->button_height;
- height = e_group_bar_get_child_height (group_bar);
- border_width = GTK_CONTAINER (group_bar)->border_width;
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = 0;
- attributes.y = y;
- attributes.width = widget->allocation.width - 2 * border_width;
- attributes.height = height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y
- | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- group->child_window = gdk_window_new (widget->window, &attributes,
- attributes_mask);
- gdk_window_set_user_data (group->child_window, widget);
-
- gtk_widget_set_parent_window (GTK_WIDGET (group->child),
- group->child_window);
- gdk_window_set_back_pixmap (group->child_window, NULL, TRUE);
-}
-
-
-/* This returns the y position of a group's button within the EGroupBar window.
- */
-static gint
-e_group_bar_get_group_button_position (EGroupBar *group_bar,
- gint group_num)
-{
- gint border_width, window_height, y;
-
- border_width = GTK_CONTAINER (group_bar)->border_width;
- window_height = GTK_WIDGET (group_bar)->allocation.height - 2 * border_width;
-
- if (group_num <= group_bar->current_group_num)
- y = e_group_bar_sum_button_heights (group_bar, 0, group_num - 1);
- else
- y = window_height - e_group_bar_sum_button_heights (group_bar, group_num, group_bar->children->len - 1);
-
- return y;
-}
-
-
-/* This returns the sum of all the buttons from first to last inclusive. */
-static gint
-e_group_bar_sum_button_heights (EGroupBar *group_bar, gint first, gint last)
-{
- EGroupBarChild *group;
- gint height, group_num;
-
- height = 0;
-
- if (group_bar->buttons_homogeneous)
- return (last - first + 1) * group_bar->max_button_height;
-
- for (group_num = first; group_num <= last; group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
- height += group->button_height;
- }
-
- return height;
-}
-
-
-static gint
-e_group_bar_get_group_child_position (EGroupBar *group_bar,
- gint group_num)
-{
- EGroupBarChild *group;
- gint y;
-
- y = e_group_bar_get_group_button_position (group_bar, group_num);
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
- y += group_bar->buttons_homogeneous ? group_bar->max_button_height
- : group->button_height;
-
- return y;
-}
-
-
-static gint
-e_group_bar_get_child_height (EGroupBar *group_bar)
-{
- EGroupBarChild *group;
- gint group_num;
-
- /* Start with the allocated height of the EGroupBar, less the border.*/
- group_bar->child_height = GTK_WIDGET (group_bar)->allocation.height;
- group_bar->child_height -= 2 * GTK_CONTAINER (group_bar)->border_width;
-
- /* Now subtract the heights of all the buttons. */
- if (group_bar->buttons_homogeneous) {
- group_bar->child_height -= group_bar->children->len * group_bar->max_button_height;
- } else {
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
- group_bar->child_height -= group->button_height;
- }
- }
-
- return group_bar->child_height;
-}
-
-
-/*
- * Insertion, reordering and deletion of items.
- */
-
-/**
- * e_group_bar_add_group:
- * @group_bar: an #EGroupBar.
- * @child: the child widget to add.
- * @button: the button used to show the child widget.
- * @position: the new group's position, or -1 to place it last.
- * @Returns: the position of the new group.
- *
- * Adds a new group to a #EGroupBar at the given position.
- **/
-gint
-e_group_bar_add_group (EGroupBar *group_bar,
- GtkWidget *child,
- GtkWidget *button,
- gint position)
-{
- EGroupBarChild *group, empty_group, *tmp_group;
- gint group_num, tmp_group_num;
-
- g_return_val_if_fail (group_bar != NULL, -1);
- g_return_val_if_fail (E_IS_GROUP_BAR (group_bar), -1);
- g_return_val_if_fail (child != NULL, -1);
- g_return_val_if_fail (button != NULL, -1);
- g_return_val_if_fail (GTK_IS_BUTTON (button), -1);
-
- /* Append an empty group to the children array and get a pointer to
- it, so we can use it like a normal group. */
- group_num = group_bar->children->len;
- g_array_append_val (group_bar->children, empty_group);
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- /* Initialize the group. */
- group->button = button;
- group->button_window = NULL;
- group->child = child;
- group->child_window = NULL;
- group->button_window_in_animation = FALSE;
- group->child_window_in_animation = FALSE;
- group->button_window_target_y = 0;
- group->child_window_target_y = 0;
-
- /* If we don't have a current group, set it to the first one. */
- if (group_bar->current_group_num == -1)
- group_bar->current_group_num = 0;
-
- /* If the EGroupBar widget is realize, we need to create the child
- windows to put the button & child in. */
- if (GTK_WIDGET_REALIZED (group_bar)) {
- e_group_bar_create_group_button_window (group_bar, group_num);
- e_group_bar_create_group_child_window (group_bar, group_num);
-
- /* We need to lower all the child windows of the previous
- groups, in reverse order, to keep the stacking order
- correct. */
- for (tmp_group_num = group_num - 1;
- tmp_group_num >= 0;
- tmp_group_num--) {
- tmp_group = &g_array_index (group_bar->children,
- EGroupBarChild,
- tmp_group_num);
- gdk_window_lower (group->child_window);
- }
- }
-
- gtk_widget_set_parent (group->button, GTK_WIDGET (group_bar));
- gtk_widget_set_parent (group->child, GTK_WIDGET (group_bar));
-
- if (GTK_WIDGET_REALIZED (group_bar)) {
- gtk_widget_realize (group->button);
- gtk_widget_realize (group->child);
- }
-
- if (GTK_WIDGET_VISIBLE (group_bar)
- && GTK_WIDGET_MAPPED (group_bar)) {
- if (group->button
- && GTK_WIDGET_VISIBLE (group->button)
- && !GTK_WIDGET_MAPPED (group->button)) {
- gtk_widget_map (group->button);
- gtk_widget_queue_resize (group->button);
- }
- if (group->child
- && GTK_WIDGET_VISIBLE (group->child)
- && !GTK_WIDGET_MAPPED (group->child)) {
- gtk_widget_map (group->child);
- gtk_widget_queue_resize (group->child);
- }
- }
-
- gtk_signal_connect (GTK_OBJECT (group->button), "clicked",
- GTK_SIGNAL_FUNC (e_group_bar_on_button_clicked),
- group_bar);
-
- gtk_signal_connect (GTK_OBJECT (group->button), "drag_motion",
- GTK_SIGNAL_FUNC (e_group_bar_on_button_drag_motion),
- group_bar);
- gtk_signal_connect (GTK_OBJECT (group->button), "drag_leave",
- GTK_SIGNAL_FUNC (e_group_bar_on_button_drag_leave),
- group_bar);
-
- return group_num;
-}
-
-
-/**
- * e_group_bar_reorder_group:
- * @group_bar: an #EGroupBar.
- * @group_num: the index of the group to move.
- * @new_position: the new position of the group.
- *
- * Moves a group to a new position within the #EGroupBar.
- **/
-void
-e_group_bar_reorder_group (EGroupBar *group_bar,
- gint group_num,
- gint new_position)
-{
- g_return_if_fail (E_IS_GROUP_BAR (group_bar));
-
-}
-
-
-/**
- * e_group_bar_remove_group:
- * @group_bar: an #EGroupBar.
- * @group_num: the index of the group to remove.
- *
- * Removes a group from an #EGroupBar.
- **/
-void
-e_group_bar_remove_group (EGroupBar *group_bar,
- gint group_num)
-{
- EGroupBarChild *group;
-
- g_return_if_fail (E_IS_GROUP_BAR (group_bar));
- g_return_if_fail (group_num >= 0);
- g_return_if_fail (group_num < group_bar->children->len);
-
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- /* Stop any animation. */
- e_group_bar_stop_all_animation (group_bar);
-
- gtk_widget_unparent (group->child);
- if (group->button)
- gtk_widget_unparent (group->button);
-
- if (group->button_window) {
- gdk_window_set_user_data (group->button_window, NULL);
- gdk_window_destroy (group->button_window);
- }
- if (group->child_window) {
- gdk_window_set_user_data (group->child_window, NULL);
- gdk_window_destroy (group->child_window);
- }
-
- g_array_remove_index (group_bar->children, group_num);
-
- /* Make sure the current group is valid. */
- if (group_bar->current_group_num >= group_bar->children->len)
- group_bar->current_group_num = group_bar->children->len - 1;
-
- gtk_widget_queue_resize (GTK_WIDGET (group_bar));
-}
-
-
-/*
- * Getting & setting the current group.
- */
-
-/**
- * e_group_bar_get_current_group_num:
- * @group_bar: an #EGroupBar.
- * @Returns: the index of the group currently displayed.
- *
- * Returns the index of the group currently displayed.
- **/
-gint
-e_group_bar_get_current_group_num (EGroupBar *group_bar)
-{
- g_return_val_if_fail (E_IS_GROUP_BAR (group_bar), -1);
-
- return group_bar->current_group_num;
-}
-
-
-/**
- * e_group_bar_set_current_group_num:
- * @group_bar: an #EGroupBar.
- * @Returns: the index of the group to display.
- *
- * Sets the group to display.
- **/
-/* FIXME: animate option? May want to set group without animation. */
-void
-e_group_bar_set_current_group_num (EGroupBar *group_bar,
- gint group_num)
-{
- g_return_if_fail (E_IS_GROUP_BAR (group_bar));
-
- /* If that already is the current group, just return. */
- if (group_bar->current_group_num == group_num)
- return;
-
- /* FIXME: Set the target positions of the old current group and the
- new current group, map the new group's child window, and create the
- animation timeout, if we haven't already got one. */
-
- group_bar->current_group_num = group_num;
-
-}
-
-
-/*
- * Getting groups and group numbers.
- */
-
-/**
- * e_group_bar_get_nth_group:
- * @group_bar: an #EGroupBar.
- * @group_num: the index of the group to get.
- * @Returns: the child widget at the given index.
- *
- * Returns the child widget at the given index.
- **/
-GtkWidget*
-e_group_bar_get_nth_group (EGroupBar *group_bar,
- gint group_num)
-{
- EGroupBarChild *group;
-
- g_return_val_if_fail (E_IS_GROUP_BAR (group_bar), NULL);
- g_return_val_if_fail (group_num >= 0, NULL);
- g_return_val_if_fail (group_num < group_bar->children->len, NULL);
-
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
- return group->child;
-}
-
-
-/**
- * e_group_bar_get_group_num:
- * @group_bar: an #EGroupBar.
- * @child: the child widget to find.
- * @Returns: the index of the group containing the given widget.
- *
- * Returns the index of the group containing the given child widget.
- **/
-gint
-e_group_bar_get_group_num (EGroupBar *group_bar,
- GtkWidget *child)
-{
- EGroupBarChild *group;
- gint group_num;
-
- g_return_val_if_fail (E_IS_GROUP_BAR (group_bar), -1);
- g_return_val_if_fail (child != NULL, -1);
-
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- if (group->child == child)
- return group_num;
- }
-
- return -1;
-}
-
-
-/**
- * e_group_bar_set_group_button_label:
- * @group_bar: an #EGroupBar.
- * @group_num: the index of the group.
- * @label: the label widget to place in the group's button.
- *
- * Sets the label widget for the given group's button, replacing any existing
- * widget in the button.
- **/
-void
-e_group_bar_set_group_button_label (EGroupBar *group_bar,
- gint group_num,
- GtkWidget *label)
-{
- EGroupBarChild *group;
- GtkWidget *button_child;
-
- g_return_if_fail (E_IS_GROUP_BAR (group_bar));
- g_return_if_fail (group_num >= 0);
- g_return_if_fail (group_num < group_bar->children->len);
-
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- button_child = GTK_BIN (group->button)->child;
- if (button_child) {
- gtk_container_remove (GTK_CONTAINER (group->button),
- button_child);
- }
-
- if (label)
- gtk_container_add (GTK_CONTAINER (group->button), label);
-}
-
-
-/*
- * Getting & setting the EGroupBar options.
- */
-
-/**
- * e_group_bar_get_buttons_homogeneous:
- * @group_bar: an #EGroupBar.
- * @Returns: TRUE if the buttons are homoegeneous.
- *
- * Returns TRUE if the buttons are homogeneous (i.e. all have the same height).
- **/
-gboolean
-e_group_bar_get_buttons_homogeneous (EGroupBar *group_bar)
-{
- g_return_val_if_fail (E_IS_GROUP_BAR (group_bar), TRUE);
-
- return group_bar->buttons_homogeneous;
-}
-
-
-/**
- * e_group_bar_set_buttons_homogeneous:
- * @group_bar: an #EGroupBar.
- * @homogeneous: TRUE if the buttons should be homoegeneous.
- *
- * Specifies whether the buttons should be homogeneous. When set to TRUE all
- * the group buttons will be set to the same height (equal to the largest
- * requested height). When set to FALSE the buttons will use their own
- * individual requested heights.
- **/
-void
-e_group_bar_set_buttons_homogeneous (EGroupBar *group_bar,
- gboolean homogeneous)
-{
- g_return_if_fail (E_IS_GROUP_BAR (group_bar));
-
- /* Just return if the setting hasn't changed. */
- if (group_bar->buttons_homogeneous == homogeneous)
- return;
-
- group_bar->buttons_homogeneous = homogeneous;
-
- /* Update the position & sizes of the buttons. */
- gtk_widget_queue_resize (GTK_WIDGET (group_bar));
-}
-
-
-static void
-e_group_bar_on_button_clicked (GtkWidget *group_button,
- EGroupBar *group_bar)
-{
- gint group_num;
-
- /* Determine which group button was clicked. */
- group_num = e_group_bar_find_button (group_bar, group_button);
-
- if (group_num != -1)
- e_group_bar_start_animation (group_bar, group_num);
-}
-
-
-/* This returns the group containing the given button, or -1 if not found. */
-static gint
-e_group_bar_find_button (EGroupBar *group_bar,
- GtkWidget *group_button)
-{
- EGroupBarChild *group;
- gint group_num;
-
- /* Determine which group button was clicked. */
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
- if (group->button == group_button)
- return group_num;
- }
-
- return -1;
-}
-
-
-static void
-e_group_bar_start_animation (EGroupBar *group_bar,
- gint group_num)
-{
- EGroupBarChild *group, *old_group;
- gint old_group_num, step;
-
- old_group_num = group_bar->current_group_num;
-
- /* Return if it is already the current group. */
- if (old_group_num == group_num)
- return;
-
- group_bar->current_group_num = group_num;
-
- /* Calculate the target y position of the new current group button
- and child, and map the child. */
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
- group->button_window_target_y = e_group_bar_get_group_button_position (group_bar, group_num);
- group->button_window_in_animation = TRUE;
-
- group->child_window_target_y = e_group_bar_get_group_child_position (group_bar, group_num);
- group->child_window_in_animation = TRUE;
-
- /* Calculate the target y position of the current group button and
- child. */
- old_group = &g_array_index (group_bar->children,
- EGroupBarChild, old_group_num);
- old_group->button_window_target_y = e_group_bar_get_group_button_position (group_bar, old_group_num);
- old_group->button_window_in_animation = TRUE;
-
- old_group->child_window_target_y = e_group_bar_get_group_child_position (group_bar, old_group_num);
- old_group->child_window_in_animation = TRUE;
-
- /* We also need to animate the buttons in between the old group and the
- new group. */
- step = (old_group_num < group_num) ? 1 : -1;
- old_group_num += step;
- while (old_group_num != group_num) {
- old_group = &g_array_index (group_bar->children,
- EGroupBarChild, old_group_num);
- old_group->button_window_target_y = e_group_bar_get_group_button_position (group_bar, old_group_num);
- old_group->button_window_in_animation = TRUE;
-
- old_group->child_window_target_y = e_group_bar_get_group_child_position (group_bar, old_group_num);
- old_group->child_window_in_animation = TRUE;
-
- old_group_num += step;
- }
-
- /* Add a timeout handler if we haven't already got one. */
- if (group_bar->animation_timeout_id == 0) {
- group_bar->animation_timeout_id = g_timeout_add (E_GROUP_BAR_SCROLL_TIMEOUT, e_group_bar_timeout_handler, group_bar);
- }
-}
-
-
-static gboolean
-e_group_bar_timeout_handler (gpointer data)
-{
- EGroupBar *group_bar;
- EGroupBarChild *group;
- gint group_num, button_window_y, child_window_y;
- gboolean finished = TRUE;
-
- g_return_val_if_fail (E_IS_GROUP_BAR (data), FALSE);
-
- group_bar = E_GROUP_BAR (data);
-
- GDK_THREADS_ENTER ();
-
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
-
- if (group->button_window_in_animation) {
- gdk_window_get_position (group->button_window, NULL,
- &button_window_y);
- button_window_y += e_group_bar_get_increment (group_bar, button_window_y, group->button_window_target_y);
- if (button_window_y == group->button_window_target_y)
- group->button_window_in_animation = FALSE;
- else
- finished = FALSE;
- gdk_window_move (group->button_window,
- 0, button_window_y);
- }
- if (group->child_window_in_animation) {
- gdk_window_get_position (group->child_window, NULL,
- &child_window_y);
- child_window_y += e_group_bar_get_increment (group_bar, child_window_y, group->child_window_target_y);
- if (child_window_y == group->child_window_target_y)
- group->child_window_in_animation = FALSE;
- else
- finished = FALSE;
- gdk_window_move (group->child_window,
- 0, child_window_y);
- }
-
- }
-
- if (finished)
- group_bar->animation_timeout_id = 0;
-
- GDK_THREADS_LEAVE ();
-
- return !finished;
-}
-
-
-static gint
-e_group_bar_get_increment (EGroupBar *group_bar,
- gint window_y,
- gint window_target_y)
-{
- gdouble percentage;
- gint distance, total_distance, step;
-
- total_distance = group_bar->child_height;
- distance = MIN (abs (window_target_y - window_y), total_distance);
-
- /* Convert the distance into an angle between -PI/2 and PI/2, so we can
- then do a cosine of it. */
- percentage = cos (M_PI * ((gdouble)distance / (gdouble)total_distance) - M_PI / 2);
-
- /* Now multiply by our maximum step size to get the step size. */
- step = percentage * total_distance / 6;
-
- /* Add it to the minimum step size, but don't go too far. */
- step = step + E_GROUP_BAR_MIN_STEP_SIZE;
- step = MIN (step, distance);
-
- if (window_target_y > window_y)
- return step;
- else
- return -step;
-}
-
-
-static gboolean
-e_group_bar_on_button_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- EGroupBar *group_bar)
-{
- gint group_num;
-
- if (!group_bar->auto_show_timeout_id) {
- group_num = e_group_bar_find_button (group_bar, widget);
- if (group_num != -1) {
- group_bar->auto_show_timeout_id = gtk_timeout_add (E_GROUP_BAR_AUTO_SHOW_TIMEOUT, e_group_bar_auto_show, group_bar);
- group_bar->auto_show_group_num = group_num;
- }
- }
- return TRUE;
-}
-
-
-static void
-e_group_bar_on_button_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint time,
- EGroupBar *group_bar)
-{
- if (group_bar->auto_show_timeout_id) {
- gtk_timeout_remove (group_bar->auto_show_timeout_id);
- group_bar->auto_show_timeout_id = 0;
- }
-}
-
-
-static gboolean
-e_group_bar_auto_show (gpointer data)
-{
- EGroupBar *group_bar;
-
- g_return_val_if_fail (E_IS_GROUP_BAR (data), FALSE);
-
- group_bar = E_GROUP_BAR (data);
-
- GDK_THREADS_ENTER ();
-
- e_group_bar_start_animation (group_bar,
- group_bar->auto_show_group_num);
-
- group_bar->auto_show_timeout_id = 0;
-
- GDK_THREADS_LEAVE ();
-
- return FALSE;
-}
-
-
-/* This removes all timeouts and sets all 'in_animation' flags to FALSE. */
-static void
-e_group_bar_stop_all_animation (EGroupBar *group_bar)
-{
- EGroupBarChild *group;
- gint group_num;
-
- if (group_bar->animation_timeout_id) {
- g_source_remove (group_bar->animation_timeout_id);
- group_bar->animation_timeout_id = 0;
- }
- if (group_bar->auto_show_timeout_id) {
- g_source_remove (group_bar->auto_show_timeout_id);
- group_bar->auto_show_timeout_id = 0;
- }
-
- for (group_num = 0;
- group_num < group_bar->children->len;
- group_num++) {
- group = &g_array_index (group_bar->children,
- EGroupBarChild, group_num);
- group->button_window_in_animation = FALSE;
- group->child_window_in_animation = FALSE;
- }
-}
-
diff --git a/widgets/shortcut-bar/e-group-bar.h b/widgets/shortcut-bar/e-group-bar.h
deleted file mode 100644
index 9a6f83b461..0000000000
--- a/widgets/shortcut-bar/e-group-bar.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#ifndef _E_GROUP_BAR_H_
-#define _E_GROUP_BAR_H_
-
-#include <gtk/gtkcontainer.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * EGroupBar displays a vertical bar with a number of Groups, which are viewed
- * one at a time by selecting the Group's button. When a different Group is
- * selected, it slides into view, and the old Group slides out.
- * It is typically used on the left of the main application window so users
- * can easily access particular features.
- *
- * It is implemented like GtkNotebook, i.e. the main widgets are the children
- * of the EGroupBar and the button widgets are treated specially like the
- * GtkNotebook tab labels.
- */
-
-/* This contains information on one item. */
-typedef struct _EGroupBarChild EGroupBarChild;
-struct _EGroupBarChild
-{
- /* This is the button used to select the group, and the window we use
- to move it around easily. */
- GtkWidget *button;
- GdkWindow *button_window;
- gint button_height;
-
- /* This is the child widget, which can be any widget added by the
- application, and the window we use to move it around easily. */
- GtkWidget *child;
- GdkWindow *child_window;
-
- /* These are TRUE if we are currently animating the windows. */
- gboolean button_window_in_animation;
- gboolean child_window_in_animation;
-
- /* These are the target y positions that the windows should eventually
- move to, used for animation. If we get a size_allocate we just
- update these and the animation can continue as normal.
- When a child window reaches its target position, it is unmapped if
- if it is not the current group (i.e. it has slid off screen). */
- gint button_window_target_y;
- gint child_window_target_y;
-};
-
-
-#define E_GROUP_BAR(obj) GTK_CHECK_CAST (obj, e_group_bar_get_type (), EGroupBar)
-#define E_GROUP_BAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_group_bar_get_type (), EGroupBarClass)
-#define E_IS_GROUP_BAR(obj) GTK_CHECK_TYPE (obj, e_group_bar_get_type ())
-
-
-typedef struct _EGroupBar EGroupBar;
-typedef struct _EGroupBarClass EGroupBarClass;
-
-struct _EGroupBar
-{
- GtkContainer container;
-
- /* This is an array of EGroupBarChild elements. */
- GArray *children;
-
- /* This is the group currently shown. */
- gint current_group_num;
-
- /* This is TRUE if all the buttons are allocated the same height. */
- gboolean buttons_homogeneous;
-
- /* This is the biggest requested height of all the buttons, which we
- use for all buttons when buttons_homogeneous is set. */
- gint max_button_height;
-
- /* This is the height of all the child windows & widgets. */
- gint child_height;
-
- /* The id of the source function for animation timeouts. If this is
- not 0 then we are in the middle of an animation. */
- guint animation_timeout_id;
-
- /* The id of the source function for automatically showing groups when
- the user drags over the group button, and the group to show. */
- guint auto_show_timeout_id;
- gint auto_show_group_num;
-};
-
-struct _EGroupBarClass
-{
- GtkContainerClass parent_class;
-};
-
-
-GtkType e_group_bar_get_type (void);
-GtkWidget* e_group_bar_new (void);
-
-/*
- * Insertion, reordering and deletion of items.
- */
-
-/* Adds a new group at the given position. If position is -1 it adds it as
- the last group. It returns the group number. */
-gint e_group_bar_add_group (EGroupBar *group_bar,
- GtkWidget *child,
- GtkWidget *button,
- gint position);
-void e_group_bar_reorder_group (EGroupBar *group_bar,
- gint group_num,
- gint new_position);
-void e_group_bar_remove_group (EGroupBar *group_bar,
- gint group_num);
-
-/*
- * Getting & setting the current group.
- */
-gint e_group_bar_get_current_group_num (EGroupBar *group_bar);
-void e_group_bar_set_current_group_num (EGroupBar *group_bar,
- gint group_num);
-
-/*
- * Getting groups and group numbers.
- */
-GtkWidget* e_group_bar_get_nth_group (EGroupBar *group_bar,
- gint group_num);
-gint e_group_bar_get_group_num (EGroupBar *group_bar,
- GtkWidget *child);
-
-/*
- * Setting the group button label.
- */
-void e_group_bar_set_group_button_label (EGroupBar *group_bar,
- gint group_num,
- GtkWidget *label);
-
-/*
- * Getting & setting the EGroupBar options.
- */
-gboolean e_group_bar_get_buttons_homogeneous (EGroupBar *group_bar);
-void e_group_bar_set_buttons_homogeneous (EGroupBar *group_bar,
- gboolean homogeneous);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_GROUP_BAR_H_ */
diff --git a/widgets/shortcut-bar/e-icon-bar-bg-item.c b/widgets/shortcut-bar/e-icon-bar-bg-item.c
deleted file mode 100644
index 1bdb7a308d..0000000000
--- a/widgets/shortcut-bar/e-icon-bar-bg-item.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * EIconBarBgItem - A GnomeCanvasItem which covers the entire EIconBar.
- * It paints the rectangles around items when the mouse moves over them, and
- * the lines between items when dragging.
- */
-
-#include "e-icon-bar-bg-item.h"
-#include "e-icon-bar.h"
-
-/* This is the size of the border around the icons, for the shadow. */
-#define E_ICON_BAR_LARGE_ICON_SHADOW_BORDER 2
-#define E_ICON_BAR_SMALL_ICON_SHADOW_BORDER 2
-
-/* These are for the horzontal bar when dragging. */
-#define E_ICON_BAR_BG_ITEM_BAR_HEIGHT 1
-#define E_ICON_BAR_BG_ITEM_BAR_OFFSET 2
-#define E_ICON_BAR_BG_ITEM_LARGE_ARROW_HEIGHT 8
-#define E_ICON_BAR_BG_ITEM_SMALL_ARROW_HEIGHT 4
-
-static void e_icon_bar_bg_item_class_init (EIconBarBgItemClass *class);
-static void e_icon_bar_bg_item_init (EIconBarBgItem *ibitem);
-
-static void e_icon_bar_bg_item_set_arg (GtkObject *o, GtkArg *arg,
- guint arg_id);
-static void e_icon_bar_bg_item_update (GnomeCanvasItem *item,
- double *affine,
- ArtSVP *clip_path, int flags);
-static void e_icon_bar_bg_item_draw (GnomeCanvasItem *item,
- GdkDrawable *drawable,
- int x, int y,
- int width, int height);
-static double e_icon_bar_bg_item_point (GnomeCanvasItem *item,
- double x, double y,
- int cx, int cy,
- GnomeCanvasItem **actual_item);
-static gint e_icon_bar_bg_item_event (GnomeCanvasItem *item,
- GdkEvent *event);
-static gint e_icon_bar_bg_item_button_press (EIconBarBgItem *ibitem,
- GdkEvent *event);
-static gint e_icon_bar_bg_item_button_release (EIconBarBgItem *ibitem,
- GdkEvent *event);
-static gint e_icon_bar_bg_item_motion_notify (EIconBarBgItem *ibitem,
- GdkEvent *event);
-
-static GnomeCanvasItemClass *parent_class;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_ICON_BAR
-};
-
-
-GtkType
-e_icon_bar_bg_item_get_type (void)
-{
- static GtkType e_icon_bar_bg_item_type = 0;
-
- if (!e_icon_bar_bg_item_type) {
- GtkTypeInfo e_icon_bar_bg_item_info = {
- "EIconBarBgItem",
- sizeof (EIconBarBgItem),
- sizeof (EIconBarBgItemClass),
- (GtkClassInitFunc) e_icon_bar_bg_item_class_init,
- (GtkObjectInitFunc) e_icon_bar_bg_item_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- e_icon_bar_bg_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &e_icon_bar_bg_item_info);
- }
-
- return e_icon_bar_bg_item_type;
-}
-
-
-static void
-e_icon_bar_bg_item_class_init (EIconBarBgItemClass *class)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- parent_class = gtk_type_class (gnome_canvas_item_get_type());
-
- object_class = (GtkObjectClass *) class;
- item_class = (GnomeCanvasItemClass *) class;
-
- gtk_object_add_arg_type ("EIconBarBgItem::icon_bar",
- GTK_TYPE_POINTER, GTK_ARG_WRITABLE,
- ARG_ICON_BAR);
-
- object_class->set_arg = e_icon_bar_bg_item_set_arg;
-
- /* GnomeCanvasItem method overrides */
- item_class->update = e_icon_bar_bg_item_update;
- item_class->draw = e_icon_bar_bg_item_draw;
- item_class->point = e_icon_bar_bg_item_point;
- item_class->event = e_icon_bar_bg_item_event;
-}
-
-
-static void
-e_icon_bar_bg_item_init (EIconBarBgItem *ibitem)
-{
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (ibitem);
-
- ibitem->icon_bar = NULL;
-
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = 0;
- item->y2 = 0;
-}
-
-
-static void
-e_icon_bar_bg_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EIconBarBgItem *ibitem;
-
- item = GNOME_CANVAS_ITEM (o);
- ibitem = E_ICON_BAR_BG_ITEM (o);
-
- switch (arg_id){
- case ARG_ICON_BAR:
- ibitem->icon_bar = GTK_VALUE_POINTER (*arg);
- break;
- }
-}
-
-
-static void
-e_icon_bar_bg_item_update (GnomeCanvasItem *item,
- double *affine,
- ArtSVP *clip_path,
- int flags)
-{
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update)
- (* GNOME_CANVAS_ITEM_CLASS (parent_class)->update) (item, affine, clip_path, flags);
-
- /* The grid covers the entire canvas area. */
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = INT_MAX;
- item->y2 = INT_MAX;
-}
-
-
-/*
- * DRAWING ROUTINES - functions to paint the canvas item.
- */
-
-static void
-e_icon_bar_bg_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable,
- int x, int y, int width, int height)
-{
- EIconBar *icon_bar;
- EIconBarItem *item;
- EIconBarBgItem *ibitem;
- GtkStyle *style;
- GdkGC *gc;
- GtkShadowType shadow;
- gint item_num, border, bar_x, bar_y, bar_w, i, arrow_height;
-
- ibitem = E_ICON_BAR_BG_ITEM (canvas_item);
- icon_bar = ibitem->icon_bar;
- g_return_if_fail (icon_bar != NULL);
- style = GTK_WIDGET (icon_bar)->style;
-
- /* Draw the highlight around the current highlight item. */
- item_num = -1;
- if (icon_bar->editing_item_num == -1) {
- if (icon_bar->pressed_item_num != -1) {
- item_num = icon_bar->pressed_item_num;
- if (icon_bar->pressed_item_num == icon_bar->mouse_over_item_num)
- shadow = GTK_SHADOW_IN;
- else
- shadow = GTK_SHADOW_OUT;
- } else if (icon_bar->mouse_over_item_num != -1) {
- item_num = icon_bar->mouse_over_item_num;
- shadow = GTK_SHADOW_OUT;
- }
- }
-
- if (item_num != -1) {
- item = &g_array_index (icon_bar->items, EIconBarItem,
- item_num);
-
- if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS)
- border = E_ICON_BAR_LARGE_ICON_SHADOW_BORDER;
- else
- border = E_ICON_BAR_SMALL_ICON_SHADOW_BORDER;
-
- gtk_draw_shadow (style, drawable, GTK_STATE_NORMAL, shadow,
- icon_bar->icon_x - border - x,
- item->icon_y - border - y,
- icon_bar->icon_w + border * 2 - 1,
- icon_bar->icon_h + border * 2 - 1);
- }
-
- /* Draw the bar between items when dragging, if needed. */
- if (icon_bar->in_drag && icon_bar->dragging_before_item_num != -1) {
- if (icon_bar->dragging_before_item_num < icon_bar->items->len) {
- item = &g_array_index (icon_bar->items, EIconBarItem,
- icon_bar->dragging_before_item_num);
- bar_y = 0;
- } else {
- /* We need to draw the bar after the last item. */
- item = &g_array_index (icon_bar->items, EIconBarItem,
- icon_bar->items->len - 1);
- bar_y = item->item_height + icon_bar->spacing;
- }
-
- if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) {
- bar_y += item->icon_y;
- } else {
- bar_y += MIN (item->icon_y, item->text_y);
- }
- bar_y -= y + icon_bar->spacing / 2;
-
- bar_x = E_ICON_BAR_BG_ITEM_BAR_OFFSET - x;
- bar_w = GTK_WIDGET (icon_bar)->allocation.width - 2 * E_ICON_BAR_BG_ITEM_BAR_OFFSET - 1;
-
- gc = GTK_WIDGET (icon_bar)->style->fg_gc[GTK_STATE_NORMAL];
-
- /* Draw the horizontal bar. */
- gdk_draw_rectangle (drawable, gc, TRUE,
- bar_x, bar_y,
- bar_w, E_ICON_BAR_BG_ITEM_BAR_HEIGHT);
-
- if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS)
- arrow_height = E_ICON_BAR_BG_ITEM_LARGE_ARROW_HEIGHT / 2;
- else
- arrow_height = E_ICON_BAR_BG_ITEM_SMALL_ARROW_HEIGHT / 2;
-
- /* Draw the arrows at the end of the lines. We use
- gdk_draw_line() to draw a series of vertical lines, since
- gdk_draw_polygon() produces odd results. */
- i = 0;
- while (arrow_height > 0) {
- gdk_draw_line (drawable, gc,
- bar_x + i,
- bar_y - arrow_height,
- bar_x + i,
- bar_y + arrow_height);
- gdk_draw_line (drawable, gc,
- bar_x + bar_w - i - 1,
- bar_y - arrow_height,
- bar_x + bar_w - i - 1,
- bar_y + arrow_height);
- arrow_height--;
- i++;
- }
- }
-}
-
-
-/* This is supposed to return the nearest item the the point and the distance.
- Since we are the only item we just return ourself and 0 for the distance.
- This is needed so that we get button/motion events. */
-static double
-e_icon_bar_bg_item_point (GnomeCanvasItem *item, double x, double y,
- int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = item;
- return 0.0;
-}
-
-
-static gint
-e_icon_bar_bg_item_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EIconBarBgItem *ibitem;
-
- ibitem = E_ICON_BAR_BG_ITEM (item);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- return e_icon_bar_bg_item_button_press (ibitem, event);
- case GDK_BUTTON_RELEASE:
- return e_icon_bar_bg_item_button_release (ibitem, event);
- case GDK_MOTION_NOTIFY:
- return e_icon_bar_bg_item_motion_notify (ibitem, event);
- default:
- break;
- }
-
- return FALSE;
-}
-
-
-static gint
-e_icon_bar_bg_item_button_press (EIconBarBgItem *ibitem,
- GdkEvent *event)
-{
- gint item_num;
-
- item_num = e_icon_bar_find_item_at_position (ibitem->icon_bar,
- event->button.x,
- event->button.y,
- NULL);
- e_icon_bar_item_pressed (ibitem->icon_bar, item_num, event);
- return TRUE;
-}
-
-
-static gint
-e_icon_bar_bg_item_button_release (EIconBarBgItem *ibitem,
- GdkEvent *event)
-{
- gint item_num;
-
- item_num = e_icon_bar_find_item_at_position (ibitem->icon_bar,
- event->button.x,
- event->button.y,
- NULL);
- e_icon_bar_item_released (ibitem->icon_bar, item_num, event);
- return TRUE;
-}
-
-
-static gint
-e_icon_bar_bg_item_motion_notify (EIconBarBgItem *ibitem,
- GdkEvent *event)
-{
- gint item_num;
-
- item_num = e_icon_bar_find_item_at_position (ibitem->icon_bar,
- event->motion.x,
- event->motion.y,
- NULL);
- e_icon_bar_item_motion (ibitem->icon_bar, item_num, event);
- return TRUE;
-}
diff --git a/widgets/shortcut-bar/e-icon-bar-bg-item.h b/widgets/shortcut-bar/e-icon-bar-bg-item.h
deleted file mode 100644
index ae25e987d7..0000000000
--- a/widgets/shortcut-bar/e-icon-bar-bg-item.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * EIconBarBgItem - A GnomeCanvasItem which covers the entire EIconBar.
- * It paints the rectangles around items when the mouse moves over them, and
- * the lines between items when dragging.
- */
-
-#ifndef _E_ICON_BAR_BG_ITEM_H_
-#define _E_ICON_BAR_BG_ITEM_H_
-
-#include <libgnomeui/gnome-canvas.h>
-
-#include "e-icon-bar.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define E_ICON_BAR_BG_ITEM(obj) (GTK_CHECK_CAST((obj), e_icon_bar_bg_item_get_type (), EIconBarBgItem))
-#define E_ICON_BAR_BG_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), e_icon_bar_bg_item_get_type (), EIconBarBgItemClass))
-#define E_IS_ICON_BAR_BG_ITEM(o) (GTK_CHECK_TYPE((o), e_icon_bar_bg_item_get_type ()))
-
-
-typedef struct _EIconBarBgItem EIconBarBgItem;
-typedef struct _EIconBarBgItemClass EIconBarBgItemClass;
-
-struct _EIconBarBgItem
-{
- GnomeCanvasItem canvas_item;
-
- /* The parent EIconBar widget. */
- EIconBar *icon_bar;
-};
-
-
-struct _EIconBarBgItemClass
-{
- GnomeCanvasItemClass parent_class;
-};
-
-GtkType e_icon_bar_bg_item_get_type (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_ICON_BAR_BG_ITEM_H_ */
diff --git a/widgets/shortcut-bar/e-icon-bar-text-item.c b/widgets/shortcut-bar/e-icon-bar-text-item.c
deleted file mode 100644
index 5548c630b3..0000000000
--- a/widgets/shortcut-bar/e-icon-bar-text-item.c
+++ /dev/null
@@ -1,1696 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * Based on gnome-icon-text-item: an editable text block with word wrapping
- * for the GNOME canvas.
- *
- * Copyright (C) 1998, 1999 The Free Software Foundation
- *
- * Authors: Miguel de Icaza <miguel@gnu.org>
- * Federico Mena <federico@gimp.org>
- */
-
-/*
- * EIconBarTextItem - An editable canvas text item for the EIconBar.
- */
-
-#include <math.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkwindow.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-
-#include "e-icon-bar-text-item.h"
-
-
-/* Margins used to display the information */
-#define MARGIN_X 2
-#define MARGIN_Y 2
-
-/* Default fontset to be used if the user specified fontset is not found */
-#define DEFAULT_FONT_NAME "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*," \
- "-*-*-medium-r-normal--10-*-*-*-*-*-*-*,*"
-
-/* Separators for text layout */
-#define DEFAULT_SEPARATORS " \t-.[]#"
-
-/* This is the string to draw when the text is clipped, e.g. '...'. */
-static gchar *e_icon_bar_text_item_ellipsis;
-
-/* Aliases to minimize screen use in my laptop */
-#define ITI(x) E_ICON_BAR_TEXT_ITEM (x)
-#define ITI_CLASS(x) E_ICON_BAR_TEXT_ITEM_CLASS (x)
-#define IS_ITI(x) E_IS_ICON_BAR_TEXT_ITEM (x)
-
-
-typedef EIconBarTextItem Iti;
-
-/* Private part of the EIconBarTextItem structure */
-typedef struct {
- /* Font */
- GdkFont *font;
-
- /* Hack: create an offscreen window and place an entry inside it */
- GtkEntry *entry;
- GtkWidget *entry_top;
-
- /* Whether the user pressed the mouse while the item was unselected */
- guint unselected_click : 1;
-
- /* Whether we need to update the position */
- guint need_pos_update : 1;
-
- /* Whether we need to update the font */
- guint need_font_update : 1;
-
- /* Whether we need to update the text */
- guint need_text_update : 1;
-
- /* Whether we need to update because the editing/selected state changed */
- guint need_state_update : 1;
-} ItiPrivate;
-
-typedef struct _EIconBarTextItemInfoRow EIconBarTextItemInfoRow;
-
-struct _EIconBarTextItemInfoRow {
- gchar *text;
- gint width;
- GdkWChar *text_wc; /* text in wide characters */
- gint text_length; /* number of characters */
-};
-
-struct _EIconBarTextItemInfo {
- GList *rows;
- GdkFont *font;
- gint width;
- gint height;
- gint baseline_skip;
-};
-
-static GnomeCanvasItemClass *parent_class;
-
-enum {
- ARG_0,
- ARG_XALIGN,
- ARG_JUSTIFY,
- ARG_MAX_LINES,
- ARG_SHOW_ELLIPSIS
-};
-
-enum {
- TEXT_CHANGED,
- HEIGHT_CHANGED,
- WIDTH_CHANGED,
- EDITING_STARTED,
- EDITING_STOPPED,
- SELECTION_STARTED,
- SELECTION_STOPPED,
- LAST_SIGNAL
-};
-
-static guint iti_signals [LAST_SIGNAL] = { 0 };
-
-static GdkFont *default_font;
-
-static void e_icon_bar_text_item_free_info (EIconBarTextItemInfo *ti);
-static EIconBarTextItemInfo *e_icon_bar_text_item_layout_text (EIconBarTextItem *iti, GdkFont *font, const gchar *text, const gchar *separators, gint max_width, gboolean confine);
-static void e_icon_bar_text_item_paint_text (EIconBarTextItem *iti,
- EIconBarTextItemInfo *ti,
- GdkDrawable *drawable,
- GdkGC *gc,
- gint x,
- gint y,
- GtkJustification just);
-
-
-/* Stops the editing state of an icon text item */
-static void
-iti_stop_editing (Iti *iti)
-{
- ItiPrivate *priv;
-
- priv = iti->priv;
-
- iti->editing = FALSE;
-
- gtk_widget_destroy (priv->entry_top);
- priv->entry = NULL;
- priv->entry_top = NULL;
-
- priv->need_state_update = TRUE;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti));
-
- gtk_signal_emit (GTK_OBJECT (iti), iti_signals[EDITING_STOPPED]);
-}
-
-/* Lays out the text in an icon item */
-static void
-layout_text (Iti *iti)
-{
- ItiPrivate *priv;
- char *text;
- int old_width, old_height;
- int width, height;
-
- priv = iti->priv;
-
- /* Save old size */
-
- if (iti->ti) {
- old_width = iti->ti->width + 2 * MARGIN_X;
- old_height = iti->ti->height + 2 * MARGIN_Y;
-
- e_icon_bar_text_item_free_info (iti->ti);
- } else {
- old_width = 2 * MARGIN_X;
- old_height = 2 * MARGIN_Y;
- }
-
- /* Change the text layout */
-
- if (iti->editing)
- text = gtk_entry_get_text (priv->entry);
- else
- text = iti->text;
-
- iti->ti = e_icon_bar_text_item_layout_text (iti, priv->font,
- text,
- DEFAULT_SEPARATORS,
- iti->width - 2 * MARGIN_X,
- TRUE);
-
- /* Check the sizes and see if we need to emit any signals */
-
- width = iti->ti->width + 2 * MARGIN_X;
- height = iti->ti->height + 2 * MARGIN_Y;
-
- if (width != old_width)
- gtk_signal_emit (GTK_OBJECT (iti), iti_signals[WIDTH_CHANGED]);
-
- if (height != old_height)
- gtk_signal_emit (GTK_OBJECT (iti), iti_signals[HEIGHT_CHANGED]);
-}
-
-/* Accepts the text in the off-screen entry of an icon text item */
-static void
-iti_edition_accept (Iti *iti)
-{
- ItiPrivate *priv;
- gboolean accept;
-
- priv = iti->priv;
- accept = TRUE;
-
- gtk_signal_emit (GTK_OBJECT (iti), iti_signals [TEXT_CHANGED], &accept);
-
- if (iti->editing){
- if (accept) {
- if (iti->is_text_allocated)
- g_free (iti->text);
-
- iti->text = g_strdup (gtk_entry_get_text (priv->entry));
- iti->is_text_allocated = 1;
- }
-
- iti_stop_editing (iti);
- }
-
- priv->need_text_update = TRUE;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti));
-}
-
-/* Callback used when the off-screen entry of an icon text item is activated.
- * When this happens, we have to accept edition.
- */
-static void
-iti_entry_activate (GtkWidget *entry, Iti *iti)
-{
- iti_edition_accept (iti);
-}
-
-/* Starts the editing state of an icon text item */
-static void
-iti_start_editing (Iti *iti)
-{
- ItiPrivate *priv;
-
- priv = iti->priv;
-
- if (iti->editing)
- return;
-
- /* Trick: The actual edition of the entry takes place in a GtkEntry
- * which is placed offscreen. That way we get all of the advantages
- * from GtkEntry without duplicating code. Yes, this is a hack.
- */
- priv->entry = (GtkEntry *) gtk_entry_new ();
- gtk_entry_set_text (priv->entry, iti->text);
- gtk_signal_connect (GTK_OBJECT (priv->entry), "activate",
- GTK_SIGNAL_FUNC (iti_entry_activate), iti);
-
- priv->entry_top = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_container_add (GTK_CONTAINER (priv->entry_top), GTK_WIDGET (priv->entry));
- gtk_widget_set_uposition (priv->entry_top, 20000, 20000);
- gtk_widget_show_all (priv->entry_top);
-
- gtk_editable_select_region (GTK_EDITABLE (priv->entry), 0, -1);
-
- iti->editing = TRUE;
-
- priv->need_text_update = TRUE;
- priv->need_state_update = TRUE;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti));
-
- gtk_signal_emit (GTK_OBJECT (iti), iti_signals[EDITING_STARTED]);
-}
-
-/* Destroy method handler for the icon text item */
-static void
-iti_destroy (GtkObject *object)
-{
- Iti *iti;
- ItiPrivate *priv;
- GnomeCanvasItem *item;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_ITI (object));
-
- iti = ITI (object);
- priv = iti->priv;
- item = GNOME_CANVAS_ITEM (object);
-
- /* FIXME: stop selection and editing */
-
- /* Queue redraw of bounding box */
-
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
-
- /* Free everything */
-
- if (iti->fontname)
- g_free (iti->fontname);
-
- if (iti->text && iti->is_text_allocated)
- g_free (iti->text);
-
- if (iti->ti)
- e_icon_bar_text_item_free_info (iti->ti);
-
- if (priv->font)
- gdk_font_unref (priv->font);
-
- if (priv->entry_top)
- gtk_widget_destroy (priv->entry_top);
-
- g_free (priv);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-/* set_arg handler for the icon text item */
-static void
-iti_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- Iti *iti;
- GnomeCanvasItem *item;
- ItiPrivate *priv;
- gfloat xalign;
- gint max_lines;
- gboolean show_ellipsis;
- GtkJustification justification;
-
- iti = ITI (object);
- item = GNOME_CANVAS_ITEM (object);
- priv = iti->priv;
-
- switch (arg_id) {
- case ARG_XALIGN:
- xalign = GTK_VALUE_FLOAT (*arg);
- if (iti->xalign != xalign) {
- iti->xalign = xalign;
- priv->need_pos_update = TRUE;
- gnome_canvas_item_request_update (item);
- }
- break;
- case ARG_JUSTIFY:
- justification = GTK_VALUE_ENUM (*arg);
- if (iti->justification != justification) {
- iti->justification = justification;
- priv->need_text_update = TRUE;
- gnome_canvas_item_request_update (item);
- }
- break;
- case ARG_MAX_LINES:
- max_lines = GTK_VALUE_INT (*arg);
- if (iti->max_lines != max_lines) {
- iti->max_lines = max_lines;
- priv->need_text_update = TRUE;
- gnome_canvas_item_request_update (item);
- }
- break;
- case ARG_SHOW_ELLIPSIS:
- show_ellipsis = GTK_VALUE_BOOL (*arg);
- if (iti->show_ellipsis != show_ellipsis) {
- iti->show_ellipsis = show_ellipsis;
- priv->need_text_update = TRUE;
- gnome_canvas_item_request_update (item);
- }
- break;
- default:
- break;
- }
-}
-
-static void
-iti_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- Iti *iti;
- ItiPrivate *priv;
-
- iti = ITI (object);
- priv = iti->priv;
-
- switch (arg_id) {
- case ARG_XALIGN:
- GTK_VALUE_FLOAT (*arg) = iti->xalign;
- break;
- case ARG_JUSTIFY:
- GTK_VALUE_ENUM (*arg) = iti->justification;
- break;
- case ARG_MAX_LINES:
- GTK_VALUE_INT (*arg) = iti->max_lines;
- break;
- case ARG_SHOW_ELLIPSIS:
- GTK_VALUE_BOOL (*arg) = iti->show_ellipsis;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-/* Loads the default font for icon text items if necessary */
-static GdkFont *
-get_default_font (void)
-{
- if (!default_font) {
- /* FIXME: this is never unref-ed */
- default_font = gdk_fontset_load (DEFAULT_FONT_NAME);
- g_assert (default_font != NULL);
- }
-
- return gdk_font_ref (default_font);
-}
-
-/* Recomputes the bounding box of an icon text item */
-static void
-recompute_bounding_box (Iti *iti)
-{
- GnomeCanvasItem *item;
- double affine[6];
- ArtPoint p, q;
- int x1, y1, x2, y2;
- int width, height;
-
- item = GNOME_CANVAS_ITEM (iti);
-
- /* Compute width, height, position */
-
- width = iti->ti->width + 2 * MARGIN_X;
- height = iti->ti->height + 2 * MARGIN_Y;
-
- x1 = iti->x + (iti->width - width) * iti->xalign;
- y1 = iti->y;
- x2 = x1 + width;
- y2 = y1 + height;
-
- /* Translate to world coordinates */
-
- gnome_canvas_item_i2w_affine (item, affine);
-
- p.x = x1;
- p.y = y1;
- art_affine_point (&q, &p, affine);
- item->x1 = q.x;
- item->y1 = q.y;
-
- p.x = x2;
- p.y = y2;
- art_affine_point (&q, &p, affine);
- item->x2 = q.x;
- item->y2 = q.y;
-}
-
-/* Update method for the icon text item */
-static void
-iti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- Iti *iti;
- ItiPrivate *priv;
-
- iti = ITI (item);
- priv = iti->priv;
-
- if (parent_class->update)
- (* parent_class->update) (item, affine, clip_path, flags);
-
- /* If necessary, queue a redraw of the old bounding box */
-
- if ((flags & GNOME_CANVAS_UPDATE_VISIBILITY)
- || (flags & GNOME_CANVAS_UPDATE_AFFINE)
- || priv->need_pos_update
- || priv->need_font_update
- || priv->need_text_update)
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
-
- if (priv->need_text_update)
- layout_text (iti);
-
- /* Compute new bounds */
-
- if (priv->need_pos_update
- || priv->need_font_update
- || priv->need_text_update)
- recompute_bounding_box (iti);
-
- /* Queue redraw */
-
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
-
- priv->need_pos_update = FALSE;
- priv->need_font_update = FALSE;
- priv->need_text_update = FALSE;
- priv->need_state_update = FALSE;
-}
-
-/* Draw the icon text item's text when it is being edited */
-static void
-iti_paint_text (Iti *iti, GdkDrawable *drawable, int x, int y)
-{
- ItiPrivate *priv;
- EIconBarTextItemInfoRow *row;
- EIconBarTextItemInfo *ti;
- GtkStyle *style;
- GdkGC *fg_gc, *bg_gc;
- GdkGC *gc, *bgc, *sgc, *bsgc;
- GList *item;
- int xpos, len;
-
- priv = iti->priv;
- style = GTK_WIDGET (GNOME_CANVAS_ITEM (iti)->canvas)->style;
-
- ti = iti->ti;
- len = 0;
- y += ti->font->ascent;
-
- /*
- * Pointers to all of the GCs we use
- */
- gc = style->black_gc;
- bgc = style->white_gc;
- sgc = style->fg_gc [GTK_STATE_SELECTED];
- bsgc = style->bg_gc [GTK_STATE_SELECTED];
-
- for (item = ti->rows; item; item = item->next, len += (row ? row->text_length : 0)) {
- GdkWChar *text_wc;
- int text_length;
- int cursor, offset, i;
- int sel_start, sel_end;
-
- row = item->data;
-
- if (!row) {
- y += ti->baseline_skip;
- continue;
- }
-
- text_wc = row->text_wc;
- text_length = row->text_length;
-
- switch (iti->justification) {
- case GTK_JUSTIFY_LEFT:
- xpos = 0;
- break;
-
- case GTK_JUSTIFY_RIGHT:
- xpos = ti->width - row->width;
- break;
-
- case GTK_JUSTIFY_CENTER:
- xpos = (ti->width - row->width) / 2;
- break;
-
- default:
- /* Anyone care to implement GTK_JUSTIFY_FILL? */
- g_warning ("Justification type %d not supported. Using left-justification.",
- (int) iti->justification);
- xpos = 0;
- }
-
- sel_start = GTK_EDITABLE (priv->entry)->selection_start_pos - len;
- sel_end = GTK_EDITABLE (priv->entry)->selection_end_pos - len;
- offset = 0;
- cursor = GTK_EDITABLE (priv->entry)->current_pos - len;
-
- for (i = 0; *text_wc; text_wc++, i++) {
- int size, px;
-
- size = gdk_text_width_wc (ti->font, text_wc, 1);
-
- if (i >= sel_start && i < sel_end) {
- fg_gc = sgc;
- bg_gc = bsgc;
- } else {
- fg_gc = gc;
- bg_gc = bgc;
- }
-
- px = x + xpos + offset;
- gdk_draw_rectangle (drawable,
- bg_gc,
- TRUE,
- px,
- y - ti->font->ascent,
- size, ti->baseline_skip);
-
- gdk_draw_text_wc (drawable,
- ti->font,
- fg_gc,
- px, y,
- text_wc, 1);
-
- if (cursor == i)
- gdk_draw_line (drawable,
- gc,
- px - 1,
- y - ti->font->ascent,
- px - 1,
- y + ti->font->descent - 1);
-
- offset += size;
- }
-
- if (cursor == i) {
- int px = x + xpos + offset;
-
- gdk_draw_line (drawable,
- gc,
- px - 1,
- y - ti->font->ascent,
- px - 1,
- y + ti->font->descent - 1);
- }
-
- y += ti->baseline_skip;
- }
-}
-
-/* Draw method handler for the icon text item */
-static void
-iti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
-{
- Iti *iti;
- GtkStyle *style;
- int w, h;
- int xofs, yofs;
-
- iti = ITI (item);
-
- if (iti->ti) {
- w = iti->ti->width + 2 * MARGIN_X;
- h = iti->ti->height + 2 * MARGIN_Y;
- } else {
- w = 2 * MARGIN_X;
- h = 2 * MARGIN_Y;
- }
-
- xofs = item->x1 - x;
- yofs = item->y1 - y;
-
- style = GTK_WIDGET (item->canvas)->style;
-
- if (iti->selected && !iti->editing)
- gdk_draw_rectangle (drawable,
- style->bg_gc[GTK_STATE_SELECTED],
- TRUE,
- xofs, yofs,
- w, h);
-
- if (iti->editing) {
- gdk_draw_rectangle (drawable,
- style->white_gc,
- TRUE,
- xofs + 1, yofs + 1,
- w - 2, h - 2);
- gdk_draw_rectangle (drawable,
- style->black_gc,
- FALSE,
- xofs, yofs,
- w - 1, h - 1);
-
- iti_paint_text (iti, drawable, xofs + MARGIN_X, yofs + MARGIN_Y);
- } else
- e_icon_bar_text_item_paint_text (iti, iti->ti,
- drawable,
- style->fg_gc[(iti->selected
- ? GTK_STATE_SELECTED
- : GTK_STATE_NORMAL)],
- xofs + MARGIN_X,
- yofs + MARGIN_Y,
- iti->justification);
-}
-
-/* Point method handler for the icon text item */
-static double
-iti_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item)
-{
- double dx, dy;
-
- *actual_item = item;
-
- if (cx < item->x1)
- dx = item->x1 - cx;
- else if (cx > item->x2)
- dx = cx - item->x2;
- else
- dx = 0.0;
-
- if (cy < item->y1)
- dy = item->y1 - cy;
- else if (cy > item->y2)
- dy = cy - item->y2;
- else
- dy = 0.0;
-
- return sqrt (dx * dx + dy * dy);
-}
-
-/* Given X, Y, a mouse position, return a valid index inside the edited text */
-static int
-iti_idx_from_x_y (Iti *iti, int x, int y)
-{
- ItiPrivate *priv;
- EIconBarTextItemInfoRow *row;
- int lines;
- int line, col, i, idx;
- GList *l;
-
- priv = iti->priv;
-
- if (iti->ti->rows == NULL)
- return 0;
-
- lines = g_list_length (iti->ti->rows);
- line = y / iti->ti->baseline_skip;
-
- if (line < 0)
- line = 0;
- else if (lines < line + 1)
- line = lines - 1;
-
- /* Compute the base index for this line */
- for (l = iti->ti->rows, idx = i = 0; i < line; l = l->next, i++) {
- row = l->data;
- idx += row->text_length;
- }
-
- row = g_list_nth (iti->ti->rows, line)->data;
- col = 0;
- if (row != NULL) {
- int first_char;
- int last_char;
-
- first_char = (iti->ti->width - row->width) / 2;
- last_char = first_char + row->width;
-
- if (x < first_char) {
- /* nothing */
- } else if (x > last_char) {
- col = row->text_length;
- } else {
- GdkWChar *s = row->text_wc;
- int pos = first_char;
-
- while (pos < last_char) {
- pos += gdk_text_width_wc (iti->ti->font, s, 1);
- if (pos > x)
- break;
- col++;
- s++;
- }
- }
- }
-
- idx += col;
-
- g_assert (idx <= priv->entry->text_size);
-
- return idx;
-}
-
-/* Starts the selection state in the icon text item */
-static void
-iti_start_selecting (Iti *iti, int idx, guint32 event_time)
-{
- ItiPrivate *priv;
- GtkEditable *e;
- GdkCursor *ibeam;
-
- priv = iti->priv;
- e = GTK_EDITABLE (priv->entry);
-
- gtk_editable_select_region (e, idx, idx);
- gtk_editable_set_position (e, idx);
- ibeam = gdk_cursor_new (GDK_XTERM);
- gnome_canvas_item_grab (GNOME_CANVAS_ITEM (iti),
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK,
- ibeam, event_time);
- gdk_cursor_destroy (ibeam);
-
- gtk_editable_select_region (e, idx, idx);
- e->current_pos = e->selection_start_pos;
- e->has_selection = TRUE;
- iti->selecting = TRUE;
-
- priv->need_state_update = TRUE;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti));
-
- gtk_signal_emit (GTK_OBJECT (iti), iti_signals[SELECTION_STARTED]);
-}
-
-/* Stops the selection state in the icon text item */
-static void
-iti_stop_selecting (Iti *iti, guint32 event_time)
-{
- ItiPrivate *priv;
- GnomeCanvasItem *item;
- GtkEditable *e;
-
- priv = iti->priv;
- item = GNOME_CANVAS_ITEM (iti);
- e = GTK_EDITABLE (priv->entry);
-
- gnome_canvas_item_ungrab (item, event_time);
- e->has_selection = FALSE;
- iti->selecting = FALSE;
-
- priv->need_state_update = TRUE;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti));
- gtk_signal_emit (GTK_OBJECT (iti), iti_signals[SELECTION_STOPPED]);
-}
-
-/* Handles selection range changes on the icon text item */
-static void
-iti_selection_motion (Iti *iti, int idx)
-{
- ItiPrivate *priv;
- GtkEditable *e;
-
- priv = iti->priv;
- e = GTK_EDITABLE (priv->entry);
-
- if (idx < e->current_pos) {
- e->selection_start_pos = idx;
- e->selection_end_pos = e->current_pos;
- } else {
- e->selection_start_pos = e->current_pos;
- e->selection_end_pos = idx;
- }
-
- priv->need_state_update = TRUE;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti));
-}
-
-/* Event handler for icon text items */
-static gint
-iti_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- Iti *iti;
- ItiPrivate *priv;
- int idx;
- double x, y;
-
- iti = ITI (item);
- priv = iti->priv;
-
- switch (event->type) {
- case GDK_KEY_PRESS:
- if (!iti->editing)
- break;
-
- if (event->key.keyval == GDK_Escape)
- iti_stop_editing (iti);
- else
- gtk_widget_event (GTK_WIDGET (priv->entry), event);
-
- priv->need_text_update = TRUE;
- gnome_canvas_item_request_update (item);
- return TRUE;
-
- case GDK_BUTTON_PRESS:
- if (!iti->editing)
- break;
-
- if (iti->editing && event->button.button == 1) {
- x = event->button.x - (item->x1 + MARGIN_X);
- y = event->button.y - (item->y1 + MARGIN_Y);
- idx = iti_idx_from_x_y (iti, x, y);
-
- iti_start_selecting (iti, idx, event->button.time);
- }
-
- return TRUE;
-
- case GDK_MOTION_NOTIFY:
- if (!iti->selecting)
- break;
-
- x = event->motion.x - (item->x1 + MARGIN_X);
- y = event->motion.y - (item->y1 + MARGIN_Y);
- idx = iti_idx_from_x_y (iti, x, y);
- iti_selection_motion (iti, idx);
- return TRUE;
-
- case GDK_BUTTON_RELEASE:
- if (iti->selecting && event->button.button == 1)
- iti_stop_selecting (iti, event->button.time);
- else
- break;
-
- return TRUE;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Bounds method handler for the icon text item */
-static void
-iti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
-{
- Iti *iti;
- ItiPrivate *priv;
- int width, height;
-
- iti = ITI (item);
- priv = iti->priv;
-
- if (priv->need_text_update) {
- layout_text (iti);
- priv->need_text_update = FALSE;
- }
-
- if (iti->ti) {
- width = iti->ti->width + 2 * MARGIN_X;
- height = iti->ti->height + 2 * MARGIN_Y;
- } else {
- width = 2 * MARGIN_X;
- height = 2 * MARGIN_Y;
- }
-
- *x1 = iti->x + (iti->width - width) * iti->xalign;
- *y1 = iti->y;
- *x2 = *x1 + width;
- *y2 = *y1 + height;
-}
-
-/* Class initialization function for the icon text item */
-static void
-iti_class_init (EIconBarTextItemClass *text_item_class)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GtkObjectClass *) text_item_class;
- item_class = (GnomeCanvasItemClass *) text_item_class;
-
- parent_class = gtk_type_class (gnome_canvas_item_get_type ());
-
- gtk_object_add_arg_type ("EIconBarTextItem::xalign", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_XALIGN);
- gtk_object_add_arg_type ("EIconBarTextItem::justify", GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFY);
- gtk_object_add_arg_type ("EIconBarTextItem::max_lines", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_MAX_LINES);
- gtk_object_add_arg_type ("EIconBarTextItem::show_ellipsis", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SHOW_ELLIPSIS);
-
- iti_signals [TEXT_CHANGED] =
- gtk_signal_new (
- "text_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconBarTextItemClass, text_changed),
- gtk_marshal_BOOL__NONE,
- GTK_TYPE_BOOL, 0);
-
- iti_signals [HEIGHT_CHANGED] =
- gtk_signal_new (
- "height_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconBarTextItemClass, height_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- iti_signals [WIDTH_CHANGED] =
- gtk_signal_new (
- "width_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconBarTextItemClass, width_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- iti_signals[EDITING_STARTED] =
- gtk_signal_new (
- "editing_started",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconBarTextItemClass, editing_started),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- iti_signals[EDITING_STOPPED] =
- gtk_signal_new (
- "editing_stopped",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconBarTextItemClass, editing_stopped),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- iti_signals[SELECTION_STARTED] =
- gtk_signal_new (
- "selection_started",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconBarTextItemClass, selection_started),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- iti_signals[SELECTION_STOPPED] =
- gtk_signal_new (
- "selection_stopped",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconBarTextItemClass, selection_stopped),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, iti_signals, LAST_SIGNAL);
-
- object_class->destroy = iti_destroy;
- object_class->get_arg = iti_get_arg;
- object_class->set_arg = iti_set_arg;
-
- item_class->update = iti_update;
- item_class->draw = iti_draw;
- item_class->point = iti_point;
- item_class->bounds = iti_bounds;
- item_class->event = iti_event;
-
- e_icon_bar_text_item_ellipsis = _("...");
-}
-
-/* Object initialization function for the icon text item */
-static void
-iti_init (EIconBarTextItem *iti)
-{
- ItiPrivate *priv;
-
- priv = g_new0 (ItiPrivate, 1);
- iti->priv = priv;
-
- iti->xalign = 0.5;
- iti->justification = GTK_JUSTIFY_CENTER;
- iti->max_lines = -1;
- iti->show_ellipsis = TRUE;
-}
-
-/**
- * e_icon_bar_text_item_configure:
- * @iti: An #EIconBarTextItem.
- * @x: X position in which to place the item.
- * @y: Y position in which to place the item.
- * @width: Maximum width allowed for this item, to be used for word wrapping.
- * @fontname: Name of the fontset that should be used to display the text.
- * @text: Text that is going to be displayed.
- * @is_static: Whether @text points to a static string or not.
- *
- * This routine is used to configure an #EIconBarTextItem.
- *
- * @x and @y specify the coordinates where the item is placed in the canvas.
- * The @x coordinate should be the leftmost position that the item can
- * assume at any one time, that is, the left margin of the column in which the
- * icon is to be placed. The @y coordinate specifies the top of the item.
- *
- * @width is the maximum width allowed for this icon text item. The coordinates
- * define the upper-left corner of an item with maximum width; this may
- * actually be outside the bounding box of the item if the text is narrower
- * than the maximum width.
- *
- * If @is_static is true, it means that there is no need for the item to
- * allocate memory for the string (it is a guarantee that the text is allocated
- * by the caller and it will not be deallocated during the lifetime of this
- * item). This is an optimization to reduce memory usage for large icon sets.
- */
-void
-e_icon_bar_text_item_configure (EIconBarTextItem *iti, int x, int y,
- int width, const char *fontname,
- const char *text,
- gboolean is_static)
-{
- ItiPrivate *priv;
-
- g_return_if_fail (iti != NULL);
- g_return_if_fail (IS_ITI (iti));
- g_return_if_fail (width > 2 * MARGIN_X);
- g_return_if_fail (text != NULL);
-
- priv = iti->priv;
-
- iti->x = x;
- iti->y = y;
- iti->width = width;
-
- if (iti->text && iti->is_text_allocated)
- g_free (iti->text);
-
- iti->is_text_allocated = !is_static;
-
- /* This cast is to shut up the compiler */
- if (is_static)
- iti->text = (char *) text;
- else
- iti->text = g_strdup (text);
-
- if (iti->fontname)
- g_free (iti->fontname);
-
- iti->fontname = g_strdup (fontname ? fontname : DEFAULT_FONT_NAME);
-
- if (priv->font)
- gdk_font_unref (priv->font);
-
- priv->font = NULL;
- if (fontname)
- priv->font = gdk_fontset_load (iti->fontname);
- if (!priv->font)
- priv->font = get_default_font ();
-
- /* Request update */
-
- priv->need_pos_update = TRUE;
- priv->need_font_update = TRUE;
- priv->need_text_update = TRUE;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti));
-}
-
-/**
- * e_icon_bar_text_item_set_width:
- * @iti: An #EIconBarTextItem.
- * @width: Maximum width allowed for this item, to be used for word wrapping.
- *
- * This routine is used to set the maximum width of an #EIconBarTextItem.
- */
-void
-e_icon_bar_text_item_set_width (EIconBarTextItem *iti, int width)
-{
- ItiPrivate *priv;
-
- g_return_if_fail (iti != NULL);
- g_return_if_fail (IS_ITI (iti));
- g_return_if_fail (width > 2 * MARGIN_X);
-
- priv = iti->priv;
-
- if (iti->width == width)
- return;
-
- iti->width = width;
-
- /* Request update */
- priv->need_text_update = TRUE;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti));
-}
-
-/**
- * e_icon_bar_text_item_setxy:
- * @iti: An #EIconBarTextItem.
- * @x: X position.
- * @y: Y position.
- *
- * Sets the coordinates at which the #EIconBarTextItem should be placed.
- *
- * See also: e_icon_bar_text_item_configure().
- */
-void
-e_icon_bar_text_item_setxy (EIconBarTextItem *iti, int x, int y)
-{
- ItiPrivate *priv;
-
- g_return_if_fail (iti != NULL);
- g_return_if_fail (IS_ITI (iti));
-
- priv = iti->priv;
-
- iti->x = x;
- iti->y = y;
-
- priv->need_pos_update = TRUE;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti));
-}
-
-/**
- * e_icon_bar_text_item_select:
- * @iti: An #EIconBarTextItem.
- * @sel: Whether the item should be displayed as selected.
- *
- * This function is used to control whether an icon text item is displayed as
- * selected or not. Mouse events are ignored by the item when it is unselected;
- * when the user clicks on a selected icon text item, it will start the text
- * editing process.
- */
-void
-e_icon_bar_text_item_select (EIconBarTextItem *iti, int sel)
-{
- ItiPrivate *priv;
-
- g_return_if_fail (iti != NULL);
- g_return_if_fail (IS_ITI (iti));
-
- priv = iti->priv;
-
- if (!iti->selected == !sel)
- return;
-
- iti->selected = sel ? TRUE : FALSE;
-
- if (!iti->selected && iti->editing)
- iti_edition_accept (iti);
-
- priv->need_state_update = TRUE;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti));
-}
-
-/**
- * e_icon_bar_text_item_get_text:
- * @iti: An #EIconBarTextItem.
- *
- * Returns the current text. The client should not free this string, as it is
- * internal to the #EIconBarTextItem.
- */
-char *
-e_icon_bar_text_item_get_text (EIconBarTextItem *iti)
-{
- ItiPrivate *priv;
-
- g_return_val_if_fail (iti != NULL, NULL);
- g_return_val_if_fail (IS_ITI (iti), NULL);
-
- priv = iti->priv;
-
- if (iti->editing)
- return gtk_entry_get_text (priv->entry);
- else
- return iti->text;
-}
-
-
-/**
- * e_icon_bar_text_item_set_text:
- * @iti: An #EIconBarTextItem.
- * @text: Text that is going to be displayed.
- * @is_static: Whether @text points to a static string or not.
- *
- * If @is_static is true, it means that there is no need for the item to
- * allocate memory for the string (it is a guarantee that the text is allocated
- * by the caller and it will not be deallocated during the lifetime of this
- * item). This is an optimization to reduce memory usage for large icon sets.
- */
-void
-e_icon_bar_text_item_set_text (EIconBarTextItem *iti, const char *text,
- gboolean is_static)
-{
- ItiPrivate *priv;
-
- g_return_if_fail (iti != NULL);
- g_return_if_fail (IS_ITI (iti));
- g_return_if_fail (text != NULL);
-
- priv = iti->priv;
-
- if (iti->text && iti->is_text_allocated)
- g_free (iti->text);
-
- iti->is_text_allocated = !is_static;
-
- /* This cast is to shut up the compiler */
- if (is_static)
- iti->text = (char *) text;
- else
- iti->text = g_strdup (text);
-
- /* Request update */
-
- priv->need_text_update = TRUE;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti));
-}
-
-
-/**
- * e_icon_bar_text_item_start_editing:
- * @iti: An #EIconBarTextItem.
- *
- * Starts the editing state of an #EIconBarTextItem.
- **/
-void
-e_icon_bar_text_item_start_editing (EIconBarTextItem *iti)
-{
- g_return_if_fail (iti != NULL);
- g_return_if_fail (IS_ITI (iti));
-
- if (iti->editing)
- return;
-
- iti->selected = TRUE; /* Ensure that we are selected */
- gnome_canvas_item_grab_focus (GNOME_CANVAS_ITEM (iti));
- iti_start_editing (iti);
-}
-
-/**
- * e_icon_bar_text_item_stop_editing:
- * @iti: An #EIconBarTextItem.
- * @accept: Whether to accept the current text or to discard it.
- *
- * Terminates the editing state of an icon text item. The @accept argument
- * controls whether the item's current text should be accepted or discarded.
- * If it is discarded, then the icon's original text will be restored.
- **/
-void
-e_icon_bar_text_item_stop_editing (EIconBarTextItem *iti,
- gboolean accept)
-{
- g_return_if_fail (iti != NULL);
- g_return_if_fail (IS_ITI (iti));
-
- if (!iti->editing)
- return;
-
- if (accept)
- iti_edition_accept (iti);
- else
- iti_stop_editing (iti);
-}
-
-
-/**
- * e_icon_bar_text_item_get_type:
- *
- * Registers the &EIconBarTextItem class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: the type ID of the #EIconBarTextItem class.
- **/
-GtkType
-e_icon_bar_text_item_get_type (void)
-{
- static GtkType iti_type = 0;
-
- if (!iti_type) {
- static const GtkTypeInfo iti_info = {
- "EIconBarTextItem",
- sizeof (EIconBarTextItem),
- sizeof (EIconBarTextItemClass),
- (GtkClassInitFunc) iti_class_init,
- (GtkObjectInitFunc) iti_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- iti_type = gtk_type_unique (gnome_canvas_item_get_type (), &iti_info);
- }
-
- return iti_type;
-}
-
-
-static void
-free_row (gpointer data, gpointer user_data)
-{
- EIconBarTextItemInfoRow *row;
-
- if (data) {
- row = data;
- g_free (row->text);
- g_free (row->text_wc);
- g_free (row);
- }
-}
-
-/*
- * e_icon_bar_text_item_free_info:
- * @ti: An icon text info structure.
- *
- * Frees a &EIconBarTextItemInfo structure. You should call this instead of
- * freeing the structure yourself.
- */
-static void
-e_icon_bar_text_item_free_info (EIconBarTextItemInfo *ti)
-{
- g_list_foreach (ti->rows, free_row, NULL);
- g_list_free (ti->rows);
- g_free (ti);
-}
-
-/*
- * e_icon_bar_text_item_layout_text:
- * @font: Name of the font that will be used to render the text.
- * @text: Text to be formatted.
- * @separators: Separators used for word wrapping, can be NULL.
- * @max_width: Width in pixels to be used for word wrapping.
- * @confine: Whether it is mandatory to wrap at @max_width.
- *
- * Creates a new &EIconBarTextItemInfo structure by wrapping the specified
- * text. If non-NULL, the @separators argument defines a set of characters
- * to be used as word delimiters for performing word wrapping. If it is
- * NULL, then only spaces will be used as word delimiters.
- *
- * The @max_width argument is used to specify the width at which word
- * wrapping will be performed. If there is a very long word that does not
- * fit in a single line, the @confine argument can be used to specify
- * whether the word should be unconditionally split to fit or whether
- * the maximum width should be increased as necessary.
- *
- * Return value: A newly-created &EIconBarTextItemInfo structure.
- */
-static EIconBarTextItemInfo *
-e_icon_bar_text_item_layout_text (EIconBarTextItem *iti, GdkFont *font,
- const gchar *text, const gchar *separators,
- gint max_width, gboolean confine)
-{
- EIconBarTextItemInfo *ti;
- EIconBarTextItemInfoRow *row;
- GdkWChar *row_end;
- GdkWChar *s, *word_start, *word_end, *old_word_end;
- GdkWChar *sub_text;
- int i, w_len, w;
- GdkWChar *text_wc, *text_iter, *separators_wc;
- int text_len_wc, separators_len_wc;
- gboolean restrict_lines;
- int lines;
-
- g_return_val_if_fail (font != NULL, NULL);
- g_return_val_if_fail (text != NULL, NULL);
-
- if (!separators)
- separators = " ";
-
- text_wc = g_new (GdkWChar, strlen (text) + 1);
- text_len_wc = gdk_mbstowcs (text_wc, text, strlen (text));
- if (text_len_wc < 0) text_len_wc = 0;
- text_wc[text_len_wc] = 0;
-
- separators_wc = g_new (GdkWChar, strlen (separators) + 1);
- separators_len_wc = gdk_mbstowcs (separators_wc, separators, strlen (separators));
- if (separators_len_wc < 0) separators_len_wc = 0;
- separators_wc[separators_len_wc] = 0;
-
- ti = g_new (EIconBarTextItemInfo, 1);
-
- ti->rows = NULL;
- ti->font = font;
- ti->width = 0;
- ti->height = 0;
- ti->baseline_skip = font->ascent + font->descent;
-
- word_end = NULL;
-
- if (!iti->editing && iti->max_lines != -1)
- restrict_lines = TRUE;
- else
- restrict_lines = FALSE;
-
- text_iter = text_wc;
- lines = 0;
- while (*text_iter) {
- /* If we are restricting the height, and this is the last line,
- and we are displaying the ellipsis, then subtract the width
- of the ellipsis from our max_width. */
- if (restrict_lines && lines == iti->max_lines - 1
- && iti->show_ellipsis) {
- max_width -= gdk_string_measure (font, e_icon_bar_text_item_ellipsis);
- }
-
- for (row_end = text_iter; *row_end != 0 && *row_end != '\n'; row_end++);
-
- /* Accumulate words from this row until they don't fit in the max_width */
-
- s = text_iter;
-
- while (s < row_end) {
- word_start = s;
- old_word_end = word_end;
- for (word_end = word_start; *word_end; word_end++) {
- GdkWChar *p;
- for (p = separators_wc; *p; p++) {
- if (*word_end == *p)
- goto found;
- }
- }
- found:
- if (word_end < row_end)
- word_end++;
-
- if (gdk_text_width_wc (font, text_iter, word_end - text_iter) > max_width) {
- if (word_start == text_iter
- || (restrict_lines
- && lines == iti->max_lines - 1)) {
- if (confine) {
- /* We must force-split the word. Look for a proper
- * place to do it.
- */
-
- w_len = word_end - text_iter;
-
- for (i = 1; i < w_len; i++) {
- w = gdk_text_width_wc (font, text_iter, i);
- if (w > max_width) {
- if (i == 1)
- /* Shit, not even a single character fits */
- max_width = w;
- else
- break;
- }
- }
-
- /* Create sub-row with the chars that fit */
-
- sub_text = g_new (GdkWChar, i);
- memcpy (sub_text, text_iter, (i - 1) * sizeof (GdkWChar));
- sub_text[i - 1] = 0;
-
- row = g_new (EIconBarTextItemInfoRow, 1);
- row->text_wc = sub_text;
- row->text_length = i - 1;
- row->width = gdk_text_width_wc (font, sub_text, i - 1);
- row->text = gdk_wcstombs(sub_text);
- if (row->text == NULL)
- row->text = g_strdup("");
-
- ti->rows = g_list_append (ti->rows, row);
-
- if (row->width > ti->width)
- ti->width = row->width;
-
- ti->height += ti->baseline_skip;
-
- /* Bump the text pointer */
-
- text_iter += i - 1;
- s = text_iter;
-
- lines++;
- if (restrict_lines
- && lines >= iti->max_lines)
- break;
-
- continue;
- } else
- max_width = gdk_text_width_wc (font, word_start, word_end - word_start);
-
- continue; /* Retry split */
- } else {
- word_end = old_word_end; /* Restore to region that does fit */
- break; /* Stop the loop because we found something that doesn't fit */
- }
- }
-
- s = word_end;
- }
-
- if (restrict_lines && lines >= iti->max_lines)
- break;
-
- /* Append row */
-
- if (text_iter == row_end) {
- /* We are on a newline, so append an empty row */
-
- ti->rows = g_list_append (ti->rows, NULL);
- ti->height += ti->baseline_skip;
-
- /* Next! */
-
- text_iter = row_end + 1;
-
- lines++;
- if (restrict_lines && lines >= iti->max_lines)
- break;
-
- } else {
- /* Create subrow and append it to the list */
-
- int sub_len;
- sub_len = word_end - text_iter;
-
- sub_text = g_new (GdkWChar, sub_len + 1);
- memcpy (sub_text, text_iter, sub_len * sizeof (GdkWChar));
- sub_text[sub_len] = 0;
-
- row = g_new (EIconBarTextItemInfoRow, 1);
- row->text_wc = sub_text;
- row->text_length = sub_len;
- row->width = gdk_text_width_wc (font, sub_text, sub_len);
- row->text = gdk_wcstombs(sub_text);
- if (row->text == NULL)
- row->text = g_strdup("");
-
- ti->rows = g_list_append (ti->rows, row);
-
- if (row->width > ti->width)
- ti->width = row->width;
-
- ti->height += ti->baseline_skip;
-
- /* Next! */
-
- text_iter = word_end;
-
- lines++;
- if (restrict_lines && lines >= iti->max_lines)
- break;
- }
- }
-
- /* Check if we've had to clip the text. */
- iti->is_clipped = *text_iter ? TRUE : FALSE;
-
- g_free (text_wc);
- g_free (separators_wc);
- return ti;
-}
-
-/*
- * e_icon_bar_text_item_paint_text:
- * @ti: An icon text info structure.
- * @drawable: Target drawable.
- * @gc: GC used to render the string.
- * @x: Left coordinate for text.
- * @y: Upper coordinate for text.
- * @just: Justification for text.
- *
- * Paints the formatted text in the icon text info structure onto a drawable.
- * This is just a sample implementation; applications can choose to use other
- * rendering functions.
- */
-static void
-e_icon_bar_text_item_paint_text (EIconBarTextItem *iti,
- EIconBarTextItemInfo *ti,
- GdkDrawable *drawable, GdkGC *gc,
- gint x, gint y, GtkJustification just)
-{
- GList *item;
- EIconBarTextItemInfoRow *row;
- int xpos, line, width;
- gboolean show_ellipsis;
-
- g_return_if_fail (ti != NULL);
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
-
- y += ti->font->ascent;
-
- for (item = ti->rows, line = 1; item; item = item->next, line++) {
-
- if (item->data) {
- row = item->data;
- width = row->width;
- }
-
- /* If this is the last line, and the text has been clipped,
- and show_ellipsis is TRUE, display '...' */
- if (line == iti->max_lines && iti->is_clipped) {
- show_ellipsis = TRUE;
- width += gdk_string_measure (ti->font, e_icon_bar_text_item_ellipsis);
- } else {
- show_ellipsis = FALSE;
- }
-
- switch (just) {
- case GTK_JUSTIFY_LEFT:
- xpos = 0;
- break;
-
- case GTK_JUSTIFY_RIGHT:
- xpos = ti->width - width;
- break;
-
- case GTK_JUSTIFY_CENTER:
- xpos = (ti->width - width) / 2;
- break;
-
- default:
- /* Anyone care to implement GTK_JUSTIFY_FILL? */
- g_warning ("Justification type %d not supported. Using left-justification.",
- (int) just);
- xpos = 0;
- }
-
- if (item->data)
- gdk_draw_text_wc (drawable, ti->font, gc, x + xpos, y, row->text_wc, row->text_length);
-
- if (show_ellipsis)
- gdk_draw_string (drawable, ti->font, gc,
- x + xpos + row->width, y,
- e_icon_bar_text_item_ellipsis);
-
- y += ti->baseline_skip;
- }
-}
diff --git a/widgets/shortcut-bar/e-icon-bar-text-item.h b/widgets/shortcut-bar/e-icon-bar-text-item.h
deleted file mode 100644
index 7c0380c87b..0000000000
--- a/widgets/shortcut-bar/e-icon-bar-text-item.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * Based on gnome-icon-text-item: an editable text block with word wrapping
- * for the GNOME canvas.
- *
- * Copyright (C) 1998, 1999 The Free Software Foundation
- *
- * Authors: Miguel de Icaza <miguel@gnu.org>
- * Federico Mena <federico@gimp.org>
- */
-
-/*
- * EIconBarTextItem - An editable canvas text item for the EIconBar.
- */
-
-#ifndef _E_ICON_BAR_TEXT_ITEM_H_
-#define _E_ICON_BAR_TEXT_ITEM_H_
-
-#include <gtk/gtkentry.h>
-#include <libgnomeui/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define E_ICON_BAR_TEXT_ITEM(obj) (GTK_CHECK_CAST((obj), \
- e_icon_bar_text_item_get_type (), EIconBarTextItem))
-#define E_ICON_BAR_TEXT_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k),\
- e_icon_bar_text_item_get_type ()))
-#define E_IS_ICON_BAR_TEXT_ITEM(o) (GTK_CHECK_TYPE((o), \
- e_icon_bar_text_item_get_type ()))
-
-typedef struct _EIconBarTextItemInfo EIconBarTextItemInfo;
-
-typedef struct {
- GnomeCanvasItem canvas_item;
-
- /* Size and maximum allowed width */
- int x, y;
- int width;
-
- /* Font name */
- char *fontname;
-
- /* Private data */
- gpointer priv; /* was GtkEntry *entry */
-
- /* Actual text */
- char *text;
-
- /* Text layout information */
- EIconBarTextItemInfo *ti;
-
- /* Whether the text is being edited */
- unsigned int editing : 1;
-
- /* Whether the text item is selected */
- unsigned int selected : 1;
-
- /* Whether the user is select-dragging a block of text */
- unsigned int selecting : 1;
-
- /* Whether the text is editable */
- unsigned int is_editable : 1;
-
- /* Whether the text is allocated by us (FALSE if allocated by the client) */
- unsigned int is_text_allocated : 1;
-
-
- /* The horizontal alignment of the text (default 0.5). */
- gfloat xalign;
-
- /* The justification of the text (default is centered). */
- GtkJustification justification;
-
- /* The max number of lines of text shown, or -1 for all (default). */
- gint max_lines;
-
- /* If '...' is displayed if the text doesn't all fit (default TRUE). */
- gboolean show_ellipsis;
-
- /* This is TRUE if we couldn't fit all the text in. */
- gboolean is_clipped;
-} EIconBarTextItem;
-
-typedef struct {
- GnomeCanvasItemClass parent_class;
-
- /* Signals we emit */
- int (* text_changed) (EIconBarTextItem *iti);
- void (* height_changed) (EIconBarTextItem *iti);
- void (* width_changed) (EIconBarTextItem *iti);
- void (* editing_started) (EIconBarTextItem *iti);
- void (* editing_stopped) (EIconBarTextItem *iti);
- void (* selection_started) (EIconBarTextItem *iti);
- void (* selection_stopped) (EIconBarTextItem *iti);
-} EIconBarTextItemClass;
-
-GtkType e_icon_bar_text_item_get_type (void);
-
-void e_icon_bar_text_item_configure (EIconBarTextItem *iti,
- int x,
- int y,
- int width,
- const char *fontname,
- const char *text,
- gboolean is_static);
-
-void e_icon_bar_text_item_set_width (EIconBarTextItem *iti,
- int width);
-
-void e_icon_bar_text_item_setxy (EIconBarTextItem *iti,
- int x,
- int y);
-
-void e_icon_bar_text_item_select (EIconBarTextItem *iti,
- int sel);
-
-char* e_icon_bar_text_item_get_text (EIconBarTextItem *iti);
-void e_icon_bar_text_item_set_text (EIconBarTextItem *iti,
- const char *text,
- gboolean is_static);
-
-void e_icon_bar_text_item_start_editing (EIconBarTextItem *iti);
-void e_icon_bar_text_item_stop_editing (EIconBarTextItem *iti,
- gboolean accept);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_ICON_BAR_TEXT_ITEM_H_ */
-
diff --git a/widgets/shortcut-bar/e-icon-bar.c b/widgets/shortcut-bar/e-icon-bar.c
deleted file mode 100644
index 6bb32ed2a2..0000000000
--- a/widgets/shortcut-bar/e-icon-bar.c
+++ /dev/null
@@ -1,1450 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * EIconBar is a subclass of GnomeCanvas for displaying a vertical column of
- * icons and descriptions. It provides 2 views - large icons and small icons.
- */
-
-#include <gtk/gtkmain.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-canvas-image.h>
-
-#include "e-icon-bar.h"
-#include "e-icon-bar-bg-item.h"
-#include "e-icon-bar-text-item.h"
-
-/* These are the offsets of the icons & text in both views. Note that the
- shadow around icons is drawn in the space between items (as is the
- horizontal bar when dragging). */
-#define E_ICON_BAR_LARGE_ICON_SPACING 8 /* Spacing between items. */
-#define E_ICON_BAR_LARGE_ICON_WIDTH 48
-#define E_ICON_BAR_LARGE_ICON_HEIGHT 48
-#define E_ICON_BAR_LARGE_ICON_TEXT_X 4
-#define E_ICON_BAR_LARGE_ICON_TEXT_Y (E_ICON_BAR_LARGE_ICON_HEIGHT + 4)
-
-#define E_ICON_BAR_SMALL_ICON_SPACING 4 /* Spacing between items. */
-#define E_ICON_BAR_SMALL_ICON_WIDTH 24
-#define E_ICON_BAR_SMALL_ICON_HEIGHT 24
-#define E_ICON_BAR_SMALL_ICON_X 4
-#define E_ICON_BAR_SMALL_ICON_TEXT_X (E_ICON_BAR_SMALL_ICON_WIDTH + 4)
-
-/* The space we leave at the top or bottom of the bar when position an item
- while it is being edited. This is used since the EIconBar may be in a
- EScrolledBar which may show buttons at the top or bottom. */
-#define E_ICON_BAR_V_SPACE 22
-
-/* The number of pixels the mouse has to be moved with the button down before
- we start a drag. */
-#define E_ICON_BAR_DRAG_START_OFFSET 4
-
-/* This is the area at the top & bottom of the bar where we auto-scroll if the
- mouse goes into during a drag-and-drop operation. */
-#define E_ICON_BAR_DRAG_AUTO_SCROLL_OFFSET 16
-
-/* This is the time between each auto-scroll, when dragging. */
-#define E_ICON_BAR_SCROLL_TIMEOUT 30
-
-/* This is the number of timeouts we skip before we start scrolling. */
-#define E_ICON_BAR_SCROLL_DELAY 12
-
-
-static void e_icon_bar_class_init (EIconBarClass *class);
-static void e_icon_bar_init (EIconBar *icon_bar);
-static void e_icon_bar_destroy (GtkObject *object);
-static void e_icon_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint e_icon_bar_leave_notify_event (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint e_icon_bar_focus_in (GtkWidget *widget,
- GdkEventFocus *event);
-static gint e_icon_bar_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
-static gint e_icon_bar_key_event (GtkWidget *widget, GdkEventKey *event);
-
-static gint e_icon_bar_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time);
-static void e_icon_bar_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint time);
-static void e_icon_bar_set_dragging_before_item (EIconBar *icon_bar,
- gint before_item);
-static gboolean e_icon_bar_timeout_handler (gpointer data);
-
-static void e_icon_bar_recalc_common_positions (EIconBar *icon_bar);
-static gint e_icon_bar_recalc_item_positions (EIconBar *icon_bar);
-static void e_icon_bar_on_text_height_changed (GnomeCanvasItem *text_item,
- EIconBar *icon_bar);
-static gint e_icon_bar_find_item (EIconBar *icon_bar,
- GnomeCanvasItem *text_item);
-static gboolean e_icon_bar_on_item_event (GnomeCanvasItem *item,
- GdkEvent *event,
- EIconBar *icon_bar);
-
-static gboolean e_icon_bar_large_icons_intersects (EIconBar *icon_bar,
- EIconBarItem *item,
- gint x,
- gint y);
-static gboolean e_icon_bar_large_icons_is_before (EIconBar *icon_bar,
- EIconBarItem *item,
- gint x,
- gint y);
-static gboolean e_icon_bar_small_icons_intersects (EIconBar *icon_bar,
- EIconBarItem *item,
- gint x,
- gint y);
-static gboolean e_icon_bar_small_icons_is_before (EIconBar *icon_bar,
- EIconBarItem *item,
- gint x,
- gint y);
-static void e_icon_bar_on_text_item_editing_started (EIconBarTextItem *text_item,
- EIconBar *icon_bar);
-static void e_icon_bar_on_text_item_editing_stopped (EIconBarTextItem *text_item,
- EIconBar *icon_bar);
-static void e_icon_bar_ensure_edited_item_visible (EIconBar *icon_bar);
-static void e_icon_bar_update_highlight (EIconBar *icon_bar);
-
-enum
-{
- ITEM_SELECTED,
- ITEM_DRAGGED,
- LAST_SIGNAL
-};
-
-static guint e_icon_bar_signals[LAST_SIGNAL] = {0};
-
-static GnomeCanvasClass *parent_class;
-
-
-GtkType
-e_icon_bar_get_type (void)
-{
- static GtkType e_icon_bar_type = 0;
-
- if (!e_icon_bar_type){
- GtkTypeInfo e_icon_bar_info = {
- "EIconBar",
- sizeof (EIconBar),
- sizeof (EIconBarClass),
- (GtkClassInitFunc) e_icon_bar_class_init,
- (GtkObjectInitFunc) e_icon_bar_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- parent_class = gtk_type_class (gnome_canvas_get_type ());
- e_icon_bar_type = gtk_type_unique (gnome_canvas_get_type (),
- &e_icon_bar_info);
- }
-
- return e_icon_bar_type;
-}
-
-
-static void
-e_icon_bar_class_init (EIconBarClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- e_icon_bar_signals[ITEM_SELECTED] =
- gtk_signal_new ("item_selected",
- GTK_RUN_LAST | GTK_RUN_ACTION,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconBarClass,
- selected_item),
- gtk_marshal_NONE__POINTER_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_GDK_EVENT,
- GTK_TYPE_INT);
- e_icon_bar_signals[ITEM_DRAGGED] =
- gtk_signal_new ("item_dragged",
- GTK_RUN_LAST | GTK_RUN_ACTION,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconBarClass,
- dragged_item),
- gtk_marshal_NONE__POINTER_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_GDK_EVENT,
- GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, e_icon_bar_signals,
- LAST_SIGNAL);
-
- /* Method override */
- object_class->destroy = e_icon_bar_destroy;
-
- widget_class->size_allocate = e_icon_bar_size_allocate;
- widget_class->leave_notify_event = e_icon_bar_leave_notify_event;
- widget_class->focus_in_event = e_icon_bar_focus_in;
- widget_class->focus_out_event = e_icon_bar_focus_out;
- widget_class->key_press_event = e_icon_bar_key_event;
- widget_class->key_release_event = e_icon_bar_key_event;
- widget_class->drag_motion = e_icon_bar_drag_motion;
- widget_class->drag_leave = e_icon_bar_drag_leave;
-
- class->selected_item = NULL;
-}
-
-
-static void
-e_icon_bar_init (EIconBar *icon_bar)
-{
- icon_bar->view_type = E_ICON_BAR_LARGE_ICONS;
- icon_bar->items = g_array_new (FALSE, FALSE, sizeof (EIconBarItem));
- icon_bar->pressed_item_num = -1;
- icon_bar->mouse_over_item_num = -1;
- icon_bar->editing_item_num = -1;
- icon_bar->in_drag = FALSE;
- icon_bar->dragging_before_item_num = -1;
- icon_bar->icon_x = 0;
- icon_bar->icon_w = 0;
- icon_bar->icon_h = 0;
- icon_bar->text_x = 0;
- icon_bar->text_w = 5;
- icon_bar->auto_scroll_timeout_id = 0;
-
- /* Create the background item in the canvas, which handles selections
- and drag-and-drop. */
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (icon_bar)->root),
- e_icon_bar_bg_item_get_type (),
- "EIconBarBgItem::icon_bar", icon_bar,
- NULL);
-}
-
-
-/**
- * e_icon_bar_new:
- * @Returns: A new #EIconBar.
- *
- * Creates a new #EIconBar.
- **/
-GtkWidget *
-e_icon_bar_new (void)
-{
- GtkWidget *icon_bar;
-
- icon_bar = GTK_WIDGET (gtk_type_new (e_icon_bar_get_type ()));
-
- return icon_bar;
-}
-
-
-static void
-e_icon_bar_destroy (GtkObject *object)
-{
- EIconBar *icon_bar;
-
- icon_bar = E_ICON_BAR (object);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-
- g_array_free (icon_bar->items, TRUE);
-
- if (icon_bar->auto_scroll_timeout_id != 0) {
- gtk_timeout_remove (icon_bar->auto_scroll_timeout_id);
- icon_bar->auto_scroll_timeout_id = 0;
- }
-}
-
-
-static void
-e_icon_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- EIconBar *icon_bar;
- gint canvas_width, canvas_height, height;
-
- icon_bar = E_ICON_BAR (widget);
-
- GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
-
- canvas_width = GTK_WIDGET (icon_bar)->allocation.width;
- canvas_height = GTK_WIDGET (icon_bar)->allocation.height;
-
- /* Reset the y position and widths of all the items to the width of
- the canvas, and reset the button labels, so they fit. */
- e_icon_bar_recalc_common_positions (icon_bar);
- height = e_icon_bar_recalc_item_positions (icon_bar);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (widget),
- 0, 0, canvas_width,
- MAX (height, canvas_height - 1));
-
- /* If we are editing an item, make sure it is visible. */
- e_icon_bar_ensure_edited_item_visible (icon_bar);
-
- GTK_LAYOUT (widget)->vadjustment->step_increment = 16;
-
- e_icon_bar_update_highlight (icon_bar);
-}
-
-
-/* This sets all the item positions which are the same for all items in the
- group. */
-static void
-e_icon_bar_recalc_common_positions (EIconBar *icon_bar)
-{
- gint canvas_width;
-
- canvas_width = GTK_WIDGET (icon_bar)->allocation.width;
-
- if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) {
- icon_bar->icon_x = (canvas_width - E_ICON_BAR_LARGE_ICON_WIDTH) / 2;
- icon_bar->icon_w = E_ICON_BAR_LARGE_ICON_WIDTH;
- icon_bar->icon_h = E_ICON_BAR_LARGE_ICON_HEIGHT;
-
- icon_bar->text_x = E_ICON_BAR_LARGE_ICON_TEXT_X;
- icon_bar->text_w = MAX (canvas_width - (E_ICON_BAR_LARGE_ICON_TEXT_X * 2), 5);
-
- icon_bar->spacing = E_ICON_BAR_LARGE_ICON_SPACING;
- } else {
- icon_bar->icon_x = E_ICON_BAR_SMALL_ICON_X;
- icon_bar->icon_w = E_ICON_BAR_SMALL_ICON_WIDTH;
- icon_bar->icon_h = E_ICON_BAR_SMALL_ICON_HEIGHT;
-
- icon_bar->text_x = E_ICON_BAR_SMALL_ICON_TEXT_X;
- icon_bar->text_w = MAX (canvas_width - E_ICON_BAR_SMALL_ICON_TEXT_X, 5);
-
- icon_bar->spacing = E_ICON_BAR_SMALL_ICON_SPACING;
- }
-}
-
-
-/* This recalculates the positions of all the items, according to the current
- view type and the height of the text items. */
-static gint
-e_icon_bar_recalc_item_positions (EIconBar *icon_bar)
-{
- EIconBarItem *item;
- gint y, item_num;
- gdouble x1, y1, x2, y2, xalign;
- GtkJustification justify;
- gint max_lines;
-
- if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) {
- xalign = 0.5;
- justify = GTK_JUSTIFY_CENTER;
- max_lines = 2;
- } else {
- xalign = 0.0;
- justify = GTK_JUSTIFY_LEFT;
- max_lines = 1;
- }
-
- /* Now step through the items, setting the y positions. */
- y = icon_bar->spacing;
- for (item_num = 0; item_num < icon_bar->items->len; item_num++) {
- item = &g_array_index (icon_bar->items,
- EIconBarItem, item_num);
-
- e_icon_bar_text_item_set_width (E_ICON_BAR_TEXT_ITEM (item->text),
- icon_bar->text_w);
-
- /* Get the text item's height. */
- gnome_canvas_item_get_bounds (item->text, &x1, &y1, &x2, &y2);
- item->text_width = x2 - x1;
- item->text_height = y2 - y1;
-
- if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) {
- item->icon_y = y;
- item->text_y = y + E_ICON_BAR_LARGE_ICON_TEXT_Y;
-
- item->item_height = E_ICON_BAR_LARGE_ICON_TEXT_Y
- + item->text_height;
- } else {
- item->item_height = MAX (item->text_height, E_ICON_BAR_SMALL_ICON_HEIGHT);
- item->icon_y = y + (item->item_height - E_ICON_BAR_SMALL_ICON_HEIGHT) / 2;
- item->text_y = y + (item->item_height - item->text_height) / 2;
- }
-
- e_icon_bar_text_item_setxy (E_ICON_BAR_TEXT_ITEM (item->text),
- icon_bar->text_x, item->text_y);
-
- /* We need to get the bounds again, in case it has moved. */
- gnome_canvas_item_get_bounds (item->text, &x1, &y1, &x2, &y2);
- item->text_x = x1;
-
- gnome_canvas_item_set (item->text,
- "EIconBarTextItem::xalign", xalign,
- "EIconBarTextItem::justify", justify,
- "EIconBarTextItem::max_lines", max_lines,
- NULL);
-
- gnome_canvas_item_set (item->image,
- "GnomeCanvasImage::x", (gdouble)icon_bar->icon_x,
- "GnomeCanvasImage::y", (gdouble)item->icon_y,
- "GnomeCanvasImage::width", (gdouble)icon_bar->icon_w,
- "GnomeCanvasImage::height", (gdouble)icon_bar->icon_h,
- NULL);
-
- y += item->item_height + icon_bar->spacing;
- }
-
- return y;
-}
-
-
-static gint
-e_icon_bar_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event)
-{
- EIconBar *icon_bar;
-
- icon_bar = E_ICON_BAR (widget);
-
- GTK_WIDGET_CLASS (parent_class)->leave_notify_event (widget, event);
-
- /* Make sure no items are highlighted. */
- e_icon_bar_item_motion (icon_bar, -1, NULL);
-
- return FALSE;
-}
-
-
-static gint
-e_icon_bar_focus_in (GtkWidget *widget,
- GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (E_IS_ICON_BAR (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_CLASS (parent_class)->focus_in_event (widget, event);
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
- return FALSE;
-}
-
-
-static gint
-e_icon_bar_focus_out (GtkWidget *widget,
- GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (E_IS_ICON_BAR (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_CLASS (parent_class)->focus_out_event (widget, event);
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
- return FALSE;
-}
-
-
-/* Key event handler for the canvas.
- FIXME: GnomeCanvas bug workaround - I needed to override this to stop the
- canvas ignoring key events from other windows. */
-static gint
-e_icon_bar_key_event (GtkWidget *widget, GdkEventKey *event)
-{
- GnomeCanvas *canvas;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (E_IS_ICON_BAR (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- canvas = GNOME_CANVAS (widget);
-
- if (event->window != canvas->layout.bin_window) {
- /* We change the window in the event struct so the canvas
- doesn't ignore the event. Note that windows are ref-counted
- in the event struct. */
- if (event->window)
- gdk_window_unref (event->window);
- event->window = canvas->layout.bin_window;
- gdk_window_ref (event->window);
- }
-
- /* These both call the same function at present, but we'll do it
- properly just in case that changes. */
- if (event->type == GDK_KEY_PRESS)
- return (*GTK_WIDGET_CLASS (parent_class)->key_press_event)(widget, event);
- else
- return (*GTK_WIDGET_CLASS (parent_class)->key_release_event)(widget, event);
-}
-
-
-/**
- * e_icon_bar_set_view_type:
- * @icon_bar: An #EIconBar.
- * @view_type: The new view type, %E_ICON_BAR_LARGE_ICONS or
- * %E_ICON_BAR_SMALL_ICONS.
- *
- * Sets the view type of the #EIconBar.
- **/
-void
-e_icon_bar_set_view_type (EIconBar *icon_bar,
- EIconBarViewType view_type)
-{
- g_return_if_fail (E_IS_ICON_BAR (icon_bar));
-
- if (icon_bar->view_type == view_type)
- return;
-
- icon_bar->view_type = view_type;
-
- /* Queue a resize of the canvas, so everything is put in the right
- positions based on the new view type. */
- gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
-}
-
-
-/**
- * e_icon_bar_add_item:
- * @icon_bar: An #EIconBar.
- * @image: the new item's icon.
- * @text: the new item's text.
- * @position: the position to place the new item, or -1 to place it last.
- *
- * Adds an item to the #EIconBar at the given position.
- **/
-gint
-e_icon_bar_add_item (EIconBar *icon_bar,
- GdkImlibImage *image,
- gchar *text,
- gint position)
-{
- EIconBarItem item;
- gfloat xalign;
- GtkJustification justify;
- gint max_lines, retval;
-
- g_return_val_if_fail (E_IS_ICON_BAR (icon_bar), -1);
- g_return_val_if_fail (text != NULL, -1);
- g_return_val_if_fail (position >= -1, -1);
- g_return_val_if_fail (position <= (gint)icon_bar->items->len, -1);
-
- if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) {
- xalign = 0.5;
- justify = GTK_JUSTIFY_CENTER;
- max_lines = 2;
- } else {
- xalign = 0.0;
- justify = GTK_JUSTIFY_LEFT;
- max_lines = 1;
- }
-
- item.text = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (icon_bar)->root),
- e_icon_bar_text_item_get_type (),
- "EIconBarTextItem::xalign", xalign,
- "EIconBarTextItem::justify", justify,
- "EIconBarTextItem::max_lines", max_lines,
- NULL);
- e_icon_bar_text_item_configure (E_ICON_BAR_TEXT_ITEM (item.text),
- icon_bar->text_x, 0,
- icon_bar->text_w, NULL,
- text, FALSE);
- gtk_signal_connect (GTK_OBJECT (item.text), "height_changed",
- GTK_SIGNAL_FUNC (e_icon_bar_on_text_height_changed), icon_bar);
- gtk_signal_connect (GTK_OBJECT (item.text), "event",
- GTK_SIGNAL_FUNC (e_icon_bar_on_item_event),
- icon_bar);
- gtk_signal_connect (GTK_OBJECT (item.text), "editing_started",
- GTK_SIGNAL_FUNC (e_icon_bar_on_text_item_editing_started),
- icon_bar);
- gtk_signal_connect (GTK_OBJECT (item.text), "editing_stopped",
- GTK_SIGNAL_FUNC (e_icon_bar_on_text_item_editing_stopped),
- icon_bar);
-
- item.image = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (icon_bar)->root),
- gnome_canvas_image_get_type (),
- "GnomeCanvasImage::image", image,
- "GnomeCanvasImage::anchor", GTK_ANCHOR_NORTH_WEST,
- "GnomeCanvasImage::width", (gdouble) icon_bar->icon_w,
- "GnomeCanvasImage::height", (gdouble) icon_bar->icon_h,
- NULL);
- gtk_signal_connect (GTK_OBJECT (item.image), "event",
- GTK_SIGNAL_FUNC (e_icon_bar_on_item_event),
- icon_bar);
-
- item.data = NULL;
- item.destroy = NULL;
-
- if (position == -1) {
- g_array_append_val (icon_bar->items, item);
- retval = icon_bar->items->len - 1;
- } else {
- g_array_insert_val (icon_bar->items, position, item);
- retval = position;
-
- /* FIXME: Should possibly update other indices. */
- if (icon_bar->dragged_item_num >= position)
- icon_bar->dragged_item_num++;
- }
-
- gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
-
- return retval;
-}
-
-
-/**
- * e_icon_bar_reorder_item:
- * @icon_bar: An #EIconBar.
- * @item_num: The index of the item to move.
- * @new_position: The new position of the item, which is used after the item
- * has been removed from its current position. If @new_position is -1, the item
- * is placed last.
- *
- * Moves an item to a new position within the #EIconBar.
- **/
-void
-e_icon_bar_reorder_item (EIconBar *icon_bar,
- gint item_num,
- gint new_position)
-{
- EIconBarItem tmp_item;
-
- g_return_if_fail (E_IS_ICON_BAR (icon_bar));
- g_return_if_fail (item_num >= 0);
- g_return_if_fail (item_num < icon_bar->items->len);
- g_return_if_fail (new_position >= -1);
- g_return_if_fail (new_position < icon_bar->items->len);
-
- tmp_item = g_array_index (icon_bar->items, EIconBarItem, item_num);
- g_array_remove_index (icon_bar->items, item_num);
-
- if (new_position == -1)
- g_array_append_val (icon_bar->items, tmp_item);
- else
- g_array_insert_val (icon_bar->items, new_position, tmp_item);
-
- gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
-}
-
-
-/**
- * e_icon_bar_remove_item:
- * @icon_bar: An #EIconBar.
- * @item_num: The index of the item to remove.
- *
- * Removes an item from the #EIconBar.
- **/
-void
-e_icon_bar_remove_item (EIconBar *icon_bar,
- gint item_num)
-{
- EIconBarItem *item;
-
- g_return_if_fail (E_IS_ICON_BAR (icon_bar));
- g_return_if_fail (item_num >= 0);
- g_return_if_fail (item_num < icon_bar->items->len);
-
- item = &g_array_index (icon_bar->items, EIconBarItem, item_num);
-
- if (item->destroy)
- item->destroy (item->data);
-
- gtk_object_destroy (GTK_OBJECT (item->text));
- gtk_object_destroy (GTK_OBJECT (item->image));
-
- g_array_remove_index (icon_bar->items, item_num);
-
- gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
-}
-
-
-/**
- * e_icon_bar_get_item_image:
- * @icon_bar: An #EIconBar.
- * @item_num: The index of the item.
- * @Returns: The icon of the given item.
- *
- * Returns the icon used for the given item.
- **/
-GdkImlibImage*
-e_icon_bar_get_item_image (EIconBar *icon_bar,
- gint item_num)
-{
- EIconBarItem *item;
- GdkImlibImage *image;
-
- g_return_val_if_fail (E_IS_ICON_BAR (icon_bar), NULL);
- g_return_val_if_fail (item_num >= 0, NULL);
- g_return_val_if_fail (item_num < icon_bar->items->len, NULL);
-
- item = &g_array_index (icon_bar->items, EIconBarItem, item_num);
- gtk_object_get (GTK_OBJECT (item->image),
- "GnomeCanvasImage::image", image,
- NULL);
- return image;
-}
-
-
-/**
- * e_icon_bar_set_item_image:
- * @icon_bar: An #EIconBar.
- * @item_num: The index of the item.
- * @image: The new icon to use for the given item.
- *
- * Sets the icon to use for the given item.
- **/
-void
-e_icon_bar_set_item_image (EIconBar *icon_bar,
- gint item_num,
- GdkImlibImage *image)
-{
- EIconBarItem *item;
-
- g_return_if_fail (E_IS_ICON_BAR (icon_bar));
- g_return_if_fail (item_num >= 0);
- g_return_if_fail (item_num < icon_bar->items->len);
-
- item = &g_array_index (icon_bar->items, EIconBarItem, item_num);
- gnome_canvas_item_set (item->image,
- "GnomeCanvasImage::image", image,
- NULL);
-}
-
-
-/**
- * e_icon_bar_get_item_text:
- * @icon_bar: An #EIconBar.
- * @item_num: The index of the item.
- * @Returns: The text of the given item.
- *
- * Returns the text of the given item.
- **/
-gchar*
-e_icon_bar_get_item_text (EIconBar *icon_bar,
- gint item_num)
-{
- EIconBarItem *item;
-
- g_return_val_if_fail (E_IS_ICON_BAR (icon_bar), NULL);
- g_return_val_if_fail (item_num >= 0, NULL);
- g_return_val_if_fail (item_num < icon_bar->items->len, NULL);
-
- item = &g_array_index (icon_bar->items, EIconBarItem, item_num);
- return e_icon_bar_text_item_get_text (E_ICON_BAR_TEXT_ITEM (item->text));
-}
-
-
-/**
- * e_icon_bar_set_item_text:
- * @icon_bar: An #EIconBar.
- * @item_num: The index of the item.
- * @text: The new text for the given item.
- *
- * Sets the text of the given item.
- **/
-void
-e_icon_bar_set_item_text (EIconBar *icon_bar,
- gint item_num,
- gchar *text)
-{
- EIconBarItem *item;
-
- g_return_if_fail (E_IS_ICON_BAR (icon_bar));
- g_return_if_fail (item_num >= 0);
- g_return_if_fail (item_num < icon_bar->items->len);
-
- item = &g_array_index (icon_bar->items, EIconBarItem, item_num);
- e_icon_bar_text_item_set_text (E_ICON_BAR_TEXT_ITEM (item->text),
- text, FALSE);
-}
-
-
-/**
- * e_icon_bar_get_item_data:
- * @icon_bar: An #EIconBar.
- * @item_num: The index of the item.
- * @Returns: The user data associated with the given item.
- *
- * Returns the user data associated with the given item.
- **/
-gpointer
-e_icon_bar_get_item_data (EIconBar *icon_bar,
- gint item_num)
-{
- EIconBarItem *item;
-
- g_return_val_if_fail (E_IS_ICON_BAR (icon_bar), NULL);
- g_return_val_if_fail (item_num >= 0, NULL);
- g_return_val_if_fail (item_num < icon_bar->items->len, NULL);
-
- item = &g_array_index (icon_bar->items, EIconBarItem, item_num);
- return item->data;
-}
-
-
-/**
- * e_icon_bar_set_item_data:
- * @icon_bar: An #EIconBar.
- * @item_num: The index of the item.
- * @data: The user data to set for the given item.
- *
- * Sets the user data of the given item.
- **/
-void
-e_icon_bar_set_item_data (EIconBar *icon_bar,
- gint item_num,
- gpointer data)
-{
- e_icon_bar_set_item_data_full (icon_bar, item_num, data, NULL);
-}
-
-
-/**
- * e_icon_bar_set_item_data_full:
- * @icon_bar: An #EIconBar.
- * @item_num: The index of the item.
- * @data: The user data to set for the given item.
- * @destroy: The function to free @data when the item is destroyed.
- *
- * Sets the user data of the given item, and the function to free the data
- * when the item is destroyed.
- **/
-void
-e_icon_bar_set_item_data_full (EIconBar *icon_bar,
- gint item_num,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- EIconBarItem *item;
-
- g_return_if_fail (E_IS_ICON_BAR (icon_bar));
- g_return_if_fail (item_num >= 0);
- g_return_if_fail (item_num < icon_bar->items->len);
-
- item = &g_array_index (icon_bar->items, EIconBarItem, item_num);
-
- if (item->destroy)
- item->destroy (item->data);
-
- item->data = data;
- item->destroy = destroy;
-}
-
-
-static void
-e_icon_bar_on_text_height_changed (GnomeCanvasItem *text_item,
- EIconBar *icon_bar)
-{
- gtk_widget_queue_resize (GTK_WIDGET (icon_bar));
-}
-
-
-/* This returns the index of the given item, or -1 if it isn't found. */
-static gint
-e_icon_bar_find_item (EIconBar *icon_bar,
- GnomeCanvasItem *canvas_item)
-{
- EIconBarItem *item;
- gint item_num;
-
- for (item_num = 0; item_num < icon_bar->items->len; item_num++) {
- item = &g_array_index (icon_bar->items,
- EIconBarItem, item_num);
-
- if (item->text == canvas_item || item->image == canvas_item) {
- return item_num;
- }
- }
-
- return -1;
-}
-
-
-/* When an item has a grab, it will get all events, so we need to use the
- position to find the real item. */
-static gboolean
-e_icon_bar_on_item_event (GnomeCanvasItem *item,
- GdkEvent *event,
- EIconBar *icon_bar)
-{
- gint item_num;
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- item_num = e_icon_bar_find_item_at_position (icon_bar,
- event->button.x,
- event->button.y,
- NULL);
- e_icon_bar_item_pressed (icon_bar, item_num, event);
- return TRUE;
- case GDK_BUTTON_RELEASE:
- item_num = e_icon_bar_find_item_at_position (icon_bar,
- event->button.x,
- event->button.y,
- NULL);
- e_icon_bar_item_released (icon_bar, item_num, event);
- return TRUE;
- case GDK_MOTION_NOTIFY:
- item_num = e_icon_bar_find_item_at_position (icon_bar,
- event->motion.x,
- event->motion.y,
- NULL);
- e_icon_bar_item_motion (icon_bar, item_num, event);
- return TRUE;
- default:
- break;
- }
-
- return FALSE;
-}
-
-
-void
-e_icon_bar_item_pressed (EIconBar *icon_bar,
- gint item_num,
- GdkEvent *event)
-{
- EIconBarItem *item;
- gint button;
-
- /* If we are editing an item, and a different item (or anywhere outside
- an item) is clicked, stop the edit. If the item being edited is
- clicked we just return, since the user may be selecting text. */
- if (icon_bar->editing_item_num != -1) {
- if (icon_bar->editing_item_num == item_num) {
- item = &g_array_index (icon_bar->items, EIconBarItem,
- icon_bar->editing_item_num);
- if (!GTK_WIDGET_HAS_FOCUS (item->text->canvas)
- || item->text->canvas->focused_item != item->text)
- gnome_canvas_item_grab_focus (item->text);
- } else {
- e_icon_bar_stop_editing_item (icon_bar, TRUE);
- }
-
- return;
- }
-
- button = event->button.button;
-
- if (button == 1 && item_num != -1) {
- icon_bar->pressed_item_num = item_num;
- icon_bar->pressed_x = event->button.x;
- icon_bar->pressed_y = event->button.y;
- gtk_widget_queue_draw (GTK_WIDGET (icon_bar));
- } else if (button == 3) {
- gtk_signal_emit (GTK_OBJECT (icon_bar),
- e_icon_bar_signals[ITEM_SELECTED],
- event, item_num);
- }
-}
-
-
-void
-e_icon_bar_item_released (EIconBar *icon_bar,
- gint item_num,
- GdkEvent *event)
-{
- gint button;
-
- /* If we are editing an item, just return. */
- if (icon_bar->editing_item_num != -1)
- return;
-
- button = event->button.button;
-
- if (button == 1) {
- if (icon_bar->pressed_item_num == icon_bar->mouse_over_item_num) {
- gtk_signal_emit (GTK_OBJECT (icon_bar),
- e_icon_bar_signals[ITEM_SELECTED],
- event, item_num);
- }
-
- icon_bar->pressed_item_num = -1;
- gtk_widget_queue_draw (GTK_WIDGET (icon_bar));
- }
-}
-
-
-void
-e_icon_bar_item_motion (EIconBar *icon_bar,
- gint item_num,
- GdkEvent *event)
-{
- gboolean need_redraw = TRUE;
-
- if (event && event->motion.state & GDK_BUTTON1_MASK
- && icon_bar->pressed_item_num != -1) {
- if (abs (event->motion.x - icon_bar->pressed_x) > E_ICON_BAR_DRAG_START_OFFSET
- || abs (event->motion.y - icon_bar->pressed_y) > E_ICON_BAR_DRAG_START_OFFSET) {
- icon_bar->dragged_item_num = icon_bar->pressed_item_num;
- gtk_signal_emit (GTK_OBJECT (icon_bar),
- e_icon_bar_signals[ITEM_DRAGGED],
- event, icon_bar->dragged_item_num);
-
- /* Don't show the button as pressed while dragging. */
- icon_bar->pressed_item_num = -1;
- gtk_widget_queue_draw (GTK_WIDGET (icon_bar));
- }
-
- return;
- }
-
- if (icon_bar->mouse_over_item_num == item_num)
- return;
-
- /* If we are editing an item, items aren't highlighted so we don't
- need a redraw. Also if an item is pressed, we only need a redraw if
- item_num or the old mouse_over_item_num is the pressed item. */
- if (icon_bar->editing_item_num != -1) {
- need_redraw = FALSE;
- } else if (icon_bar->pressed_item_num != -1) {
- if (icon_bar->pressed_item_num != item_num
- && icon_bar->pressed_item_num != icon_bar->mouse_over_item_num)
- need_redraw = FALSE;
- }
-
- icon_bar->mouse_over_item_num = item_num;
-
- if (need_redraw)
- gtk_widget_queue_draw (GTK_WIDGET (icon_bar));
-}
-
-
-/* This returns the index of the item at the given position on the EIconBar,
- or -1 if no item is found. If before_item is not NULL, it returns the
- item which the mouse is before, or -1 (for dragging). */
-gint
-e_icon_bar_find_item_at_position (EIconBar *icon_bar,
- gint x,
- gint y,
- gint *before_item)
-{
- EIconBarItem *item;
- gint item_num;
-
- if (before_item)
- *before_item = -1;
-
- for (item_num = 0; item_num < icon_bar->items->len; item_num++) {
- item = &g_array_index (icon_bar->items,
- EIconBarItem, item_num);
-
- if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) {
- if (e_icon_bar_large_icons_intersects (icon_bar, item,
- x, y))
- return item_num;
-
- if (before_item
- && e_icon_bar_large_icons_is_before (icon_bar,
- item, x, y)) {
- *before_item = item_num;
- return -1;
- }
- } else {
- if (e_icon_bar_small_icons_intersects (icon_bar, item,
- x, y))
- return item_num;
-
- if (before_item
- && e_icon_bar_small_icons_is_before (icon_bar,
- item, x, y)) {
- *before_item = item_num;
- return -1;
- }
-
- }
-
- }
-
- /* If the mouse is below all the items, but inside the items' width,
- and before_item is not NULL, we set it to the number of items, so
- the dropped item would be added at the end. Note that this assumes
- that the item variable points to the last item in the EIconBar. */
- if (before_item) {
- if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) {
- if (x < icon_bar->text_x
- || x >= icon_bar->text_x + icon_bar->text_w)
- return -1;
-
- if (item == NULL
- || y > item->icon_y + item->item_height)
- *before_item = icon_bar->items->len;
- } else {
- if (x < icon_bar->icon_x
- || x >= icon_bar->text_x + icon_bar->text_w)
- return -1;
-
- if (item == NULL) {
- *before_item = icon_bar->items->len;
- } else {
- gint max_y;
- max_y = MAX (item->icon_y + icon_bar->icon_h,
- item->text_y + item->text_height);
- if (y > max_y)
- *before_item = icon_bar->items->len;
- }
- }
- }
-
- return -1;
-}
-
-
-static gboolean
-e_icon_bar_large_icons_intersects (EIconBar *icon_bar,
- EIconBarItem *item,
- gint x,
- gint y)
-{
- if (y < item->icon_y || y >= item->text_y + item->text_height)
- return FALSE;
-
- if (y < item->icon_y + icon_bar->icon_h) {
- if (x < icon_bar->icon_x
- || x >= icon_bar->icon_x + icon_bar->icon_w)
- return FALSE;
- } else {
- if (x < item->text_x
- || x >= item->text_x + item->text_width)
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-static gboolean
-e_icon_bar_large_icons_is_before (EIconBar *icon_bar,
- EIconBarItem *item,
- gint x,
- gint y)
-{
- if (y < item->icon_y - icon_bar->spacing
- || y >= item->icon_y)
- return FALSE;
-
- if (x < icon_bar->text_x || x >= icon_bar->text_x + icon_bar->text_w)
- return FALSE;
-
- return TRUE;
-}
-
-
-static gboolean
-e_icon_bar_small_icons_intersects (EIconBar *icon_bar,
- EIconBarItem *item,
- gint x,
- gint y)
-{
- gint min_y, max_y;
-
- min_y = MIN (item->icon_y, item->text_y);
- max_y = MAX (item->icon_y + icon_bar->icon_h,
- item->text_y + item->text_height);
-
- if (y < min_y || y >= max_y)
- return FALSE;
-
- if (x < icon_bar->icon_x || x >= item->text_x + item->text_width)
- return FALSE;
-
- return TRUE;
-}
-
-
-static gboolean
-e_icon_bar_small_icons_is_before (EIconBar *icon_bar,
- EIconBarItem *item,
- gint x,
- gint y)
-{
- gint min_y, max_y;
-
- max_y = MIN (item->icon_y, item->text_y);
- min_y = max_y - icon_bar->spacing;
-
- if (y < min_y || y >= max_y)
- return FALSE;
-
- if (x < icon_bar->icon_x || x >= icon_bar->text_x + icon_bar->text_w)
- return FALSE;
-
- return TRUE;
-}
-
-
-/**
- * e_icon_bar_start_editing_item:
- * @icon_bar: An #EIconBar.
- * @item_num: The index of the item.
- *
- * Turns the item into an editable text field so the user can rename it.
- * Editing is stopped automatically when the user hits 'Return' or clicks
- * outside the item. It can also be stopped explicitly by calling
- * e_icon_bar_stop_editing_item().
- **/
-void
-e_icon_bar_start_editing_item (EIconBar *icon_bar,
- gint item_num)
-{
- EIconBarItem *item;
-
- g_return_if_fail (E_IS_ICON_BAR (icon_bar));
- g_return_if_fail (item_num >= 0);
- g_return_if_fail (item_num < icon_bar->items->len);
-
- item = &g_array_index (icon_bar->items,
- EIconBarItem, item_num);
-
- e_icon_bar_text_item_start_editing (E_ICON_BAR_TEXT_ITEM (item->text));
-}
-
-
-/**
- * e_icon_bar_stop_editing_item:
- * @icon_bar: An #EIconBar.
- * @accept: TRUE if the changes should be accepted, FALSE if the text should be
- * changed back to its state before the editing started.
- *
- * Stops the editing of the items, if any were being edited.
- **/
-void
-e_icon_bar_stop_editing_item (EIconBar *icon_bar,
- gboolean accept)
-{
- EIconBarItem *item;
-
- g_return_if_fail (E_IS_ICON_BAR (icon_bar));
-
- if (icon_bar->editing_item_num != -1) {
- item = &g_array_index (icon_bar->items, EIconBarItem,
- icon_bar->editing_item_num);
- e_icon_bar_text_item_stop_editing (E_ICON_BAR_TEXT_ITEM (item->text), accept);
- }
-}
-
-
-static void
-e_icon_bar_on_text_item_editing_started (EIconBarTextItem *text_item,
- EIconBar *icon_bar)
-{
- gint item_num;
-
- item_num = e_icon_bar_find_item (icon_bar,
- GNOME_CANVAS_ITEM (text_item));
- g_return_if_fail (item_num != -1);
-
- /* Turn off any highlighted item. */
- e_icon_bar_item_motion (icon_bar, -1, NULL);
-
- icon_bar->editing_item_num = item_num;
-
- e_icon_bar_ensure_edited_item_visible (icon_bar);
-}
-
-
-static void
-e_icon_bar_on_text_item_editing_stopped (EIconBarTextItem *text_item,
- EIconBar *icon_bar)
-{
- gint item_num;
-
- item_num = e_icon_bar_find_item (icon_bar,
- GNOME_CANVAS_ITEM (text_item));
- g_return_if_fail (item_num != -1);
-
- e_icon_bar_text_item_select (text_item, FALSE);
-
- icon_bar->editing_item_num = -1;
-
- e_icon_bar_update_highlight (icon_bar);
-}
-
-
-static void
-e_icon_bar_ensure_edited_item_visible (EIconBar *icon_bar)
-{
- EIconBarItem *item;
- gint scroll_x, scroll_y, min_scroll_y, max_scroll_y, new_scroll_y;
-
- if (icon_bar->editing_item_num == -1)
- return;
-
- item = &g_array_index (icon_bar->items,
- EIconBarItem, icon_bar->editing_item_num);
- gnome_canvas_get_scroll_offsets (GNOME_CANVAS (icon_bar),
- &scroll_x, &scroll_y);
-
- /* The minimum scroll y position is with the text right on the bottom
- of the display. */
- min_scroll_y = item->text_y + item->text_height + E_ICON_BAR_V_SPACE
- - GTK_WIDGET (icon_bar)->allocation.height;
- /* The maximum scroll y position is with the text at the top. */
- max_scroll_y = item->text_y - E_ICON_BAR_V_SPACE;
-
- new_scroll_y = MAX (scroll_y, min_scroll_y);
- new_scroll_y = MIN (new_scroll_y, max_scroll_y);
-
- if (new_scroll_y != scroll_y)
- gnome_canvas_scroll_to (GNOME_CANVAS (icon_bar),
- scroll_x, new_scroll_y);
-}
-
-
-/* This gets the mouse position and updates the highlight if necessary.
- It is called after items are added/deleted/scrolled/edited. */
-static void
-e_icon_bar_update_highlight (EIconBar *icon_bar)
-{
- GtkWidget *widget;
- gint x, y, item_num;
-
- widget = GTK_WIDGET (icon_bar);
-
- if (!widget->window)
- return;
-
- gdk_window_get_pointer (widget->window, &x, &y, NULL);
-
- if (x < 0 || y < 0
- || x > widget->allocation.width || y > widget->allocation.height)
- return;
-
- item_num = e_icon_bar_find_item_at_position (icon_bar, x, y, NULL);
- e_icon_bar_item_motion (icon_bar, item_num, NULL);
-}
-
-
-static gint
-e_icon_bar_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time)
-{
- EIconBar *icon_bar;
- gint item_num, before_item, scroll_x, scroll_y;
-
- g_return_val_if_fail (E_IS_ICON_BAR (widget), FALSE);
-
- icon_bar = E_ICON_BAR (widget);
-
- icon_bar->in_drag = TRUE;
-
- /* Check if the mouse is over or between items, and if so highlight. */
- gnome_canvas_get_scroll_offsets (GNOME_CANVAS (icon_bar),
- &scroll_x, &scroll_y);
- item_num = e_icon_bar_find_item_at_position (icon_bar,
- x + scroll_x,
- y + scroll_y,
- &before_item);
- e_icon_bar_item_motion (icon_bar, item_num, NULL);
- e_icon_bar_set_dragging_before_item (icon_bar, before_item);
-
- /* Check if the mouse is at the top or bottom of the bar, and if it is
- scroll up/down. */
- if (y < E_ICON_BAR_DRAG_AUTO_SCROLL_OFFSET)
- icon_bar->scrolling_up = TRUE;
- else if (y >= widget->allocation.height - E_ICON_BAR_DRAG_AUTO_SCROLL_OFFSET)
- icon_bar->scrolling_up = FALSE;
- else {
- if (icon_bar->auto_scroll_timeout_id != 0) {
- gtk_timeout_remove (icon_bar->auto_scroll_timeout_id);
- icon_bar->auto_scroll_timeout_id = 0;
- }
- return FALSE;
- }
-
- if (icon_bar->auto_scroll_timeout_id == 0) {
- icon_bar->auto_scroll_timeout_id = g_timeout_add (E_ICON_BAR_SCROLL_TIMEOUT, e_icon_bar_timeout_handler, icon_bar);
- icon_bar->auto_scroll_delay = E_ICON_BAR_SCROLL_DELAY;
- }
-
- return FALSE;
-}
-
-
-static void
-e_icon_bar_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint time)
-{
- EIconBar *icon_bar;
-
- g_return_if_fail (E_IS_ICON_BAR (widget));
-
- icon_bar = E_ICON_BAR (widget);
-
- icon_bar->in_drag = FALSE;
-
- if (icon_bar->auto_scroll_timeout_id != 0) {
- gtk_timeout_remove (icon_bar->auto_scroll_timeout_id);
- icon_bar->auto_scroll_timeout_id = 0;
- }
-
- if (icon_bar->mouse_over_item_num != -1) {
- icon_bar->mouse_over_item_num = -1;
- gtk_widget_queue_draw (GTK_WIDGET (icon_bar));
- }
-}
-
-
-static void
-e_icon_bar_set_dragging_before_item (EIconBar *icon_bar,
- gint before_item)
-{
- if (icon_bar->dragging_before_item_num == before_item)
- return;
-
- icon_bar->dragging_before_item_num = before_item;
-
- gtk_widget_queue_draw (GTK_WIDGET (icon_bar));
-}
-
-
-static gboolean
-e_icon_bar_timeout_handler (gpointer data)
-{
- EIconBar *icon_bar;
- gint scroll_x, scroll_y, new_scroll_y;
- GtkAdjustment *adj;
-
- g_return_val_if_fail (E_IS_ICON_BAR (data), FALSE);
-
- icon_bar = E_ICON_BAR (data);
-
- GDK_THREADS_ENTER ();
-
- if (icon_bar->auto_scroll_delay > 0) {
- icon_bar->auto_scroll_delay--;
- GDK_THREADS_LEAVE ();
- return TRUE;
- }
-
- gnome_canvas_get_scroll_offsets (GNOME_CANVAS (icon_bar),
- &scroll_x, &scroll_y);
-
- adj = GTK_LAYOUT (icon_bar)->vadjustment;
-
- if (icon_bar->scrolling_up)
- new_scroll_y = MAX (scroll_y - adj->step_increment, 0);
- else
- new_scroll_y = MIN (scroll_y + adj->step_increment,
- adj->upper - adj->page_size);
-
- if (new_scroll_y != scroll_y)
- gnome_canvas_scroll_to (GNOME_CANVAS (icon_bar),
- scroll_x, new_scroll_y);
-
- GDK_THREADS_LEAVE ();
- return TRUE;
-}
diff --git a/widgets/shortcut-bar/e-icon-bar.h b/widgets/shortcut-bar/e-icon-bar.h
deleted file mode 100644
index 74b7507384..0000000000
--- a/widgets/shortcut-bar/e-icon-bar.h
+++ /dev/null
@@ -1,221 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#ifndef _E_ICON_BAR_H_
-#define _E_ICON_BAR_H_
-
-#include <gdk_imlib.h>
-#include <libgnomeui/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * EIconBar is a subclass of GnomeCanvas for displaying a vertical column of
- * icons and descriptions. It provides 2 views - large icons and small icons.
- */
-
-
-/* This contains information on one item. */
-typedef struct _EIconBarItem EIconBarItem;
-struct _EIconBarItem
-{
- GnomeCanvasItem *text;
- GnomeCanvasItem *image;
-
- /* This is user data attached to the item, e.g. a URL. */
- gpointer data;
- GtkDestroyNotify destroy;
-
- /* This is the height of the item. */
- gint item_height;
-
- /* This is the actual x, width and height of the text, rather than
- the maximum allowed area. */
- gint text_x;
- gint text_width;
- gint text_height;
-
- gint icon_y, text_y;
-};
-
-
-/* These are the view types. Defaults to LARGE_ICONS. */
-typedef enum
-{
- E_ICON_BAR_LARGE_ICONS,
- E_ICON_BAR_SMALL_ICONS
-} EIconBarViewType;
-
-
-#define E_ICON_BAR(obj) GTK_CHECK_CAST (obj, e_icon_bar_get_type (), EIconBar)
-#define E_ICON_BAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_icon_bar_get_type (), EIconBarClass)
-#define E_IS_ICON_BAR(obj) GTK_CHECK_TYPE (obj, e_icon_bar_get_type ())
-
-
-typedef struct _EIconBar EIconBar;
-typedef struct _EIconBarClass EIconBarClass;
-
-struct _EIconBar
-{
- GnomeCanvas canvas;
-
- /* This specifies if we are using large icons or small icons. */
- EIconBarViewType view_type;
-
- /* This is an array of EIconBarItem elements. */
- GArray *items;
-
- /* This is the index of the item which has been pressed, or -1.
- It will be shown as pressed in while the mouse is over it. */
- gint pressed_item_num;
-
- /* This is the coordinates of where the button was pressed. If the
- mouse moves a certain distance with the button still pressed, we
- start a drag. */
- gint pressed_x;
- gint pressed_y;
-
- /* This is the index of the item the mouse is currently over, or -1.
- It will be highlighted unless one of the items is pressed. */
- gint mouse_over_item_num;
-
- /* This is the item that we are currently editing, or -1. */
- gint editing_item_num;
-
- /* This is the index of the item which is being dragged, or -1.
- If the drag results in a move it will be deleted. */
- gint dragged_item_num;
-
- /* This is TRUE if we are dragging over this EIconBar. */
- gboolean in_drag;
-
- /* This is used in drag-and-drop to indicate the item which the mouse
- is currently before, e.g. if it is 1 then a dropped item would be
- inserted between items 0 and 1. It ranges from 0 to the number of
- items, or is -1 when the mouse is not dragging between items. */
- gint dragging_before_item_num;
-
- /* These are the common positions of all the items in the EIconBar. */
- gint icon_x, icon_w, icon_h, text_x, text_w, spacing;
-
- /* This is the source id of our auto-scroll timeout handler, used when
- in the middle of drag-and-drop operations. */
- gint auto_scroll_timeout_id;
- gint auto_scroll_delay;
- gboolean scrolling_up;
-};
-
-struct _EIconBarClass
-{
- GnomeCanvasClass parent_class;
-
- void (*selected_item) (EIconBar *icon_bar,
- GdkEvent *event,
- gint item_num);
- void (*dragged_item) (EIconBar *icon_bar,
- GdkEvent *event,
- gint item_num);
-};
-
-
-GtkType e_icon_bar_get_type (void);
-GtkWidget* e_icon_bar_new (void);
-
-/* Sets the view type. */
-void e_icon_bar_set_view_type (EIconBar *icon_bar,
- EIconBarViewType view_type);
-
-/* Adds a new item to a group at the given position. If position is -1 it is
- added at the end. It returns the index of the item. */
-gint e_icon_bar_add_item (EIconBar *icon_bar,
- GdkImlibImage *image,
- gchar *text,
- gint position);
-
-/* Reorders an item. Note that position refers to the new position to add the
- item after removing it from its current position. If position is -1 it is
- moved to the end of the bar. */
-void e_icon_bar_reorder_item (EIconBar *icon_bar,
- gint item_num,
- gint new_position);
-void e_icon_bar_remove_item (EIconBar *icon_bar,
- gint item_num);
-
-GdkImlibImage* e_icon_bar_get_item_image (EIconBar *icon_bar,
- gint item_num);
-void e_icon_bar_set_item_image (EIconBar *icon_bar,
- gint item_num,
- GdkImlibImage *image);
-
-gchar* e_icon_bar_get_item_text (EIconBar *icon_bar,
- gint item_num);
-void e_icon_bar_set_item_text (EIconBar *icon_bar,
- gint item_num,
- gchar *text);
-
-gpointer e_icon_bar_get_item_data (EIconBar *icon_bar,
- gint item_num);
-void e_icon_bar_set_item_data (EIconBar *icon_bar,
- gint item_num,
- gpointer data);
-void e_icon_bar_set_item_data_full (EIconBar *icon_bar,
- gint item_num,
- gpointer data,
- GtkDestroyNotify destroy);
-
-void e_icon_bar_start_editing_item (EIconBar *icon_bar,
- gint item_num);
-void e_icon_bar_stop_editing_item (EIconBar *icon_bar,
- gboolean accept);
-
-
-
-/*
- * INTERNAL FUNCTIONS - for use by EIconBarBgItem.
- */
-
-/* This returns the index of the item at the given position on the EIconBar,
- or -1 if no item is found. If before_item is not NULL, it returns the
- item which the mouse is before, or -1 (this is used for dragging). */
-gint e_icon_bar_find_item_at_position (EIconBar *icon_bar,
- gint x,
- gint y,
- gint *before_item);
-
-void e_icon_bar_item_pressed (EIconBar *icon_bar,
- gint item_num,
- GdkEvent *event);
-void e_icon_bar_item_released (EIconBar *icon_bar,
- gint item_num,
- GdkEvent *event);
-void e_icon_bar_item_motion (EIconBar *icon_bar,
- gint item_num,
- GdkEvent *event);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_ICON_BAR_H_ */
diff --git a/widgets/shortcut-bar/e-shortcut-bar.c b/widgets/shortcut-bar/e-shortcut-bar.c
deleted file mode 100644
index 7ad00feb78..0000000000
--- a/widgets/shortcut-bar/e-shortcut-bar.c
+++ /dev/null
@@ -1,563 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * ShortcutBar displays a vertical bar with a number of Groups, each of which
- * contains any number of icons. It is used on the left of the main application
- * window so users can easily access items such as folders and files.
- */
-
-#include <string.h>
-#include <gnome.h>
-
-#include "e-shortcut-bar.h"
-#include "e-clipped-label.h"
-#include "e-vscrolled-bar.h"
-
-/* Drag and Drop stuff. */
-enum {
- TARGET_SHORTCUT
-};
-static GtkTargetEntry target_table[] = {
- { "E-SHORTCUT", 0, TARGET_SHORTCUT }
-};
-static guint n_targets = sizeof(target_table) / sizeof(target_table[0]);
-
-typedef struct _EShortcutBarBuiltinType EShortcutBarBuiltinType;
-struct _EShortcutBarBuiltinType {
- gchar *name;
- gchar *filename;
- GdkImlibImage *image;
-};
-
-EShortcutBarBuiltinType e_shortcut_bar_builtin_types[] = {
- { "folder:", "gnome-word.png", NULL },
- { "calendar:", "gnome-calendar.png", NULL },
- { "todo:", "gnome-cromagnon.png", NULL },
- { "contacts:", "gnome-ccthemes.png", NULL }
-};
-static gint e_shortcut_bar_num_builtin_types = sizeof (e_shortcut_bar_builtin_types) / sizeof (EShortcutBarBuiltinType);
-
-gboolean e_shortcut_bar_default_type_image_loaded = FALSE;
-GdkImlibImage *e_shortcut_bar_default_type_image = NULL;
-gchar *e_shortcut_bar_default_type_filename = "gnome-balsa2.png";
-
-static void e_shortcut_bar_class_init (EShortcutBarClass *class);
-static void e_shortcut_bar_init (EShortcutBar *shortcut_bar);
-static void e_shortcut_bar_destroy (GtkObject *object);
-static void e_shortcut_bar_set_canvas_style (EShortcutBar *shortcut_bar,
- GtkWidget *canvas);
-static void e_shortcut_bar_item_selected (EIconBar *icon_bar,
- GdkEvent *event,
- gint item_num,
- EShortcutBar *shortcut_bar);
-static void e_shortcut_bar_item_dragged (EIconBar *icon_bar,
- GdkEvent *event,
- gint item_num,
- EShortcutBar *shortcut_bar);
-static void e_shortcut_bar_on_drag_data_get (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- EShortcutBar *shortcut_bar);
-static void e_shortcut_bar_on_drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *data,
- guint info,
- guint time,
- EShortcutBar *shortcut_bar);
-static void e_shortcut_bar_on_drag_data_delete (GtkWidget *widget,
- GdkDragContext *context,
- EShortcutBar *shortcut_bar);
-static void e_shortcut_bar_stop_editing (GtkWidget *button,
- EShortcutBar *shortcut_bar);
-static GdkImlibImage* e_shortcut_bar_get_image_from_url (EShortcutBar *shortcut_bar,
- gchar *item_url);
-static GdkImlibImage* e_shortcut_bar_load_image (gchar *filename);
-
-
-enum
-{
- ITEM_SELECTED,
- LAST_SIGNAL
-};
-
-static guint e_shortcut_bar_signals[LAST_SIGNAL] = {0};
-
-static EGroupBarClass *parent_class;
-
-
-GtkType
-e_shortcut_bar_get_type (void)
-{
- static GtkType e_shortcut_bar_type = 0;
-
- if (!e_shortcut_bar_type){
- GtkTypeInfo e_shortcut_bar_info = {
- "EShortcutBar",
- sizeof (EShortcutBar),
- sizeof (EShortcutBarClass),
- (GtkClassInitFunc) e_shortcut_bar_class_init,
- (GtkObjectInitFunc) e_shortcut_bar_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- parent_class = gtk_type_class (e_group_bar_get_type ());
- e_shortcut_bar_type = gtk_type_unique (e_group_bar_get_type (),
- &e_shortcut_bar_info);
- }
-
- return e_shortcut_bar_type;
-}
-
-
-static void
-e_shortcut_bar_class_init (EShortcutBarClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- e_shortcut_bar_signals[ITEM_SELECTED] =
- gtk_signal_new ("item_selected",
- GTK_RUN_LAST | GTK_RUN_ACTION,
- object_class->type,
- GTK_SIGNAL_OFFSET (EShortcutBarClass,
- selected_item),
- gtk_marshal_NONE__POINTER_INT_INT,
- GTK_TYPE_NONE, 3, GTK_TYPE_GDK_EVENT,
- GTK_TYPE_INT, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, e_shortcut_bar_signals,
- LAST_SIGNAL);
-
- /* Method override */
- object_class->destroy = e_shortcut_bar_destroy;
-}
-
-
-static void
-e_shortcut_bar_init (EShortcutBar *shortcut_bar)
-{
- shortcut_bar->groups = g_array_new (FALSE, FALSE,
- sizeof (EShortcutBarGroup));
-}
-
-
-GtkWidget *
-e_shortcut_bar_new (void)
-{
- GtkWidget *shortcut_bar;
-
- shortcut_bar = GTK_WIDGET (gtk_type_new (e_shortcut_bar_get_type ()));
-
- return shortcut_bar;
-}
-
-
-static void
-e_shortcut_bar_destroy (GtkObject *object)
-{
- EShortcutBar *shortcut_bar;
-
- shortcut_bar = E_SHORTCUT_BAR (object);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-
- g_array_free (shortcut_bar->groups, TRUE);
-}
-
-
-gint
-e_shortcut_bar_add_group (EShortcutBar *shortcut_bar, gchar *group_name)
-{
- EShortcutBarGroup *group, tmp_group;
- gint group_num;
- GtkWidget *button, *label;
-
- g_return_val_if_fail (E_IS_SHORTCUT_BAR (shortcut_bar), -1);
- g_return_val_if_fail (group_name != NULL, -1);
-
- group_num = shortcut_bar->groups->len;
- g_array_append_val (shortcut_bar->groups, tmp_group);
-
- group = &g_array_index (shortcut_bar->groups,
- EShortcutBarGroup, group_num);
-
- group->vscrolled_bar = e_vscrolled_bar_new (NULL);
- gtk_widget_show (group->vscrolled_bar);
- gtk_signal_connect (GTK_OBJECT (E_VSCROLLED_BAR (group->vscrolled_bar)->up_button), "pressed", GTK_SIGNAL_FUNC (e_shortcut_bar_stop_editing), shortcut_bar);
- gtk_signal_connect (GTK_OBJECT (E_VSCROLLED_BAR (group->vscrolled_bar)->down_button), "pressed", GTK_SIGNAL_FUNC (e_shortcut_bar_stop_editing), shortcut_bar);
-
- group->icon_bar = e_icon_bar_new ();
- gtk_widget_show (group->icon_bar);
- gtk_container_add (GTK_CONTAINER (group->vscrolled_bar),
- group->icon_bar);
- gtk_signal_connect (GTK_OBJECT (group->icon_bar), "item_selected",
- GTK_SIGNAL_FUNC (e_shortcut_bar_item_selected),
- shortcut_bar);
- gtk_signal_connect (GTK_OBJECT (group->icon_bar), "item_dragged",
- GTK_SIGNAL_FUNC (e_shortcut_bar_item_dragged),
- shortcut_bar);
- gtk_signal_connect (GTK_OBJECT (group->icon_bar), "drag_data_get",
- GTK_SIGNAL_FUNC (e_shortcut_bar_on_drag_data_get),
- shortcut_bar);
- gtk_signal_connect (GTK_OBJECT (group->icon_bar), "drag_data_received",
- GTK_SIGNAL_FUNC (e_shortcut_bar_on_drag_data_received),
- shortcut_bar);
- gtk_signal_connect (GTK_OBJECT (group->icon_bar), "drag_data_delete",
- GTK_SIGNAL_FUNC (e_shortcut_bar_on_drag_data_delete),
- shortcut_bar);
-
- e_shortcut_bar_set_canvas_style (shortcut_bar, group->icon_bar);
-
- button = gtk_button_new ();
- label = e_clipped_label_new (group_name);
- gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
- gtk_widget_show (label);
- gtk_container_add (GTK_CONTAINER (button), label);
- gtk_widget_show (button);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (e_shortcut_bar_stop_editing),
- shortcut_bar);
-
- gtk_drag_dest_set (GTK_WIDGET (group->icon_bar),
- GTK_DEST_DEFAULT_ALL,
- target_table, n_targets,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
- gtk_drag_dest_set (GTK_WIDGET (button),
- GTK_DEST_DEFAULT_ALL,
- target_table, n_targets,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
- e_group_bar_add_group (E_GROUP_BAR (shortcut_bar),
- group->vscrolled_bar, button, -1);
-
-
- return group_num;
-}
-
-
-void
-e_shortcut_bar_remove_group (EShortcutBar *shortcut_bar,
- gint group_num)
-{
- e_group_bar_remove_group (E_GROUP_BAR (shortcut_bar), group_num);
- g_array_remove_index (shortcut_bar->groups, group_num);
-}
-
-
-gint
-e_shortcut_bar_add_item (EShortcutBar *shortcut_bar, gint group_num,
- gchar *item_url, gchar *item_name)
-{
- EShortcutBarGroup *group;
- GdkImlibImage *image;
- gint item_num;
-
- g_return_val_if_fail (E_IS_SHORTCUT_BAR (shortcut_bar), -1);
- g_return_val_if_fail (group_num >= 0, -1);
- g_return_val_if_fail (group_num < shortcut_bar->groups->len, -1);
- g_return_val_if_fail (item_url != NULL, -1);
- g_return_val_if_fail (item_name != NULL, -1);
-
- image = e_shortcut_bar_get_image_from_url (shortcut_bar, item_url);
-
- group = &g_array_index (shortcut_bar->groups,
- EShortcutBarGroup, group_num);
-
- item_num = e_icon_bar_add_item (E_ICON_BAR (group->icon_bar),
- image, item_name, -1);
- e_icon_bar_set_item_data_full (E_ICON_BAR (group->icon_bar), item_num,
- g_strdup (item_url), g_free);
- return item_num;
-}
-
-
-void
-e_shortcut_bar_remove_item (EShortcutBar *shortcut_bar,
- gint group_num,
- gint item_num)
-{
- EShortcutBarGroup *group;
-
- g_return_if_fail (E_IS_SHORTCUT_BAR (shortcut_bar));
- g_return_if_fail (group_num >= 0);
- g_return_if_fail (group_num < shortcut_bar->groups->len);
-
- group = &g_array_index (shortcut_bar->groups,
- EShortcutBarGroup, group_num);
-
- e_icon_bar_remove_item (E_ICON_BAR (group->icon_bar), item_num);
-}
-
-
-static void
-e_shortcut_bar_set_canvas_style (EShortcutBar *shortcut_bar,
- GtkWidget *canvas)
-{
- GtkRcStyle *rc_style;
-
- rc_style = gtk_rc_style_new ();
-
- rc_style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG | GTK_RC_BG;
- rc_style->fg[GTK_STATE_NORMAL].red = 65535;
- rc_style->fg[GTK_STATE_NORMAL].green = 65535;
- rc_style->fg[GTK_STATE_NORMAL].blue = 65535;
-
- rc_style->bg[GTK_STATE_NORMAL].red = 32512;
- rc_style->bg[GTK_STATE_NORMAL].green = 32512;
- rc_style->bg[GTK_STATE_NORMAL].blue = 32512;
-
- gtk_widget_modify_style (GTK_WIDGET (canvas), rc_style);
- gtk_rc_style_unref (rc_style);
-}
-
-
-void
-e_shortcut_bar_set_view_type (EShortcutBar *shortcut_bar,
- gint group_num,
- EIconBarViewType view_type)
-{
- EShortcutBarGroup *group;
-
- g_return_if_fail (E_IS_SHORTCUT_BAR (shortcut_bar));
- g_return_if_fail (group_num >= 0);
- g_return_if_fail (group_num < shortcut_bar->groups->len);
-
- group = &g_array_index (shortcut_bar->groups,
- EShortcutBarGroup, group_num);
-
- e_icon_bar_set_view_type (E_ICON_BAR (group->icon_bar), view_type);
-}
-
-
-static void
-e_shortcut_bar_item_selected (EIconBar *icon_bar,
- GdkEvent *event,
- gint item_num,
- EShortcutBar *shortcut_bar)
-{
- gint group_num;
-
- group_num = e_group_bar_get_group_num (E_GROUP_BAR (shortcut_bar),
- GTK_WIDGET (icon_bar)->parent);
-
- gtk_signal_emit (GTK_OBJECT (shortcut_bar),
- e_shortcut_bar_signals[ITEM_SELECTED],
- event, group_num, item_num);
-}
-
-
-static void
-e_shortcut_bar_item_dragged (EIconBar *icon_bar,
- GdkEvent *event,
- gint item_num,
- EShortcutBar *shortcut_bar)
-{
- GtkTargetList *target_list;
- gint group_num;
-
- group_num = e_group_bar_get_group_num (E_GROUP_BAR (shortcut_bar),
- GTK_WIDGET (icon_bar)->parent);
-
- /* FIXME: free somewhere - drag_end? */
- shortcut_bar->dragged_url = g_strdup (e_icon_bar_get_item_data (icon_bar, item_num));
- shortcut_bar->dragged_name = g_strdup (e_icon_bar_get_item_text (icon_bar, item_num));
-
- target_list = gtk_target_list_new (target_table, n_targets);
- gtk_drag_begin (GTK_WIDGET (icon_bar), target_list,
- GDK_ACTION_COPY | GDK_ACTION_MOVE,
- 1, event);
- gtk_target_list_unref (target_list);
-}
-
-
-static void
-e_shortcut_bar_on_drag_data_get (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- EShortcutBar *shortcut_bar)
-{
- gchar *data;
-
- if (info == TARGET_SHORTCUT) {
- data = g_strdup_printf ("%s%c%s", shortcut_bar->dragged_name,
- '\0', shortcut_bar->dragged_url);
- gtk_selection_data_set (selection_data, selection_data->target,
- 8, data,
- strlen (shortcut_bar->dragged_name)
- + strlen (shortcut_bar->dragged_url)
- + 2);
- g_free (data);
- }
-}
-
-
-static void
-e_shortcut_bar_on_drag_data_received (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *data,
- guint info,
- guint time,
- EShortcutBar *shortcut_bar)
-{
- EShortcutBarGroup *group;
- gchar *item_name, *item_url;
- EIconBar *icon_bar;
- GdkImlibImage *image;
- gint group_num, item_num;
-
- icon_bar = E_ICON_BAR (widget);
-
- if ((data->length >= 0) && (data->format == 8)
- && icon_bar->dragging_before_item_num != -1) {
- item_name = data->data;
- item_url = item_name + strlen (item_name) + 1;
-
- image = e_shortcut_bar_get_image_from_url (shortcut_bar,
- item_url);
-
- group_num = e_group_bar_get_group_num (E_GROUP_BAR (shortcut_bar),
- GTK_WIDGET (icon_bar)->parent);
- group = &g_array_index (shortcut_bar->groups,
- EShortcutBarGroup, group_num);
-
- item_num = e_icon_bar_add_item (E_ICON_BAR (group->icon_bar), image, item_name, icon_bar->dragging_before_item_num);
- e_icon_bar_set_item_data_full (E_ICON_BAR (group->icon_bar),
- item_num, g_strdup (item_url),
- g_free);
-
- gtk_drag_finish (context, TRUE, TRUE, time);
- return;
- }
-
- gtk_drag_finish (context, FALSE, FALSE, time);
-}
-
-
-static void
-e_shortcut_bar_on_drag_data_delete (GtkWidget *widget,
- GdkDragContext *context,
- EShortcutBar *shortcut_bar)
-{
- EIconBar *icon_bar;
-
- icon_bar = E_ICON_BAR (widget);
-
- e_icon_bar_remove_item (icon_bar, icon_bar->dragged_item_num);
-}
-
-
-void
-e_shortcut_bar_start_editing_item (EShortcutBar *shortcut_bar,
- gint group_num,
- gint item_num)
-{
- EShortcutBarGroup *group;
-
- g_return_if_fail (E_IS_SHORTCUT_BAR (shortcut_bar));
- g_return_if_fail (group_num >= 0);
- g_return_if_fail (group_num < shortcut_bar->groups->len);
-
- group = &g_array_index (shortcut_bar->groups,
- EShortcutBarGroup, group_num);
-
- e_icon_bar_start_editing_item (E_ICON_BAR (group->icon_bar), item_num);
-}
-
-
-/* We stop editing any item when a scroll button is pressed. */
-static void
-e_shortcut_bar_stop_editing (GtkWidget *button,
- EShortcutBar *shortcut_bar)
-{
- EShortcutBarGroup *group;
- gint group_num;
-
- for (group_num = 0;
- group_num < shortcut_bar->groups->len;
- group_num++) {
- group = &g_array_index (shortcut_bar->groups,
- EShortcutBarGroup, group_num);
- e_icon_bar_stop_editing_item (E_ICON_BAR (group->icon_bar),
- TRUE);
- }
-}
-
-
-static GdkImlibImage*
-e_shortcut_bar_get_image_from_url (EShortcutBar *shortcut_bar,
- gchar *item_url)
-{
- gchar *method_terminator;
- gint method_len, i;
-
- method_terminator = strchr (item_url, ':');
- if (method_terminator) {
- method_len = method_terminator - item_url + 1;
-
- /* Check if it is a builtin type. */
- for (i = 0; i < e_shortcut_bar_num_builtin_types; i++) {
- if (!strncmp (item_url, e_shortcut_bar_builtin_types[i].name, method_len)) {
- if (!e_shortcut_bar_builtin_types[i].image)
- e_shortcut_bar_builtin_types[i].image = e_shortcut_bar_load_image (e_shortcut_bar_builtin_types[i].filename);
- return e_shortcut_bar_builtin_types[i].image;
- }
- }
- }
-
- if (!e_shortcut_bar_default_type_image_loaded) {
- e_shortcut_bar_default_type_image_loaded = TRUE;
- e_shortcut_bar_default_type_image = e_shortcut_bar_load_image (e_shortcut_bar_default_type_filename);
- }
- return e_shortcut_bar_default_type_image;
-}
-
-
-static GdkImlibImage*
-e_shortcut_bar_load_image (gchar *filename)
-{
- gchar *pathname;
- GdkImlibImage *image = NULL;
-
- pathname = gnome_pixmap_file (filename);
- if (pathname)
- image = gdk_imlib_load_image (pathname);
- else
- g_warning ("Couldn't find pixmap: %s", filename);
-
- return image;
-}
diff --git a/widgets/shortcut-bar/e-shortcut-bar.h b/widgets/shortcut-bar/e-shortcut-bar.h
deleted file mode 100644
index 1bbdfb6754..0000000000
--- a/widgets/shortcut-bar/e-shortcut-bar.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#ifndef _E_SHORTCUT_BAR_H_
-#define _E_SHORTCUT_BAR_H_
-
-#include "e-group-bar.h"
-#include "e-icon-bar.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * EShortcutBar displays a vertical bar with a number of Groups, each of which
- * contains any number of icons. It is used on the left of the main application
- * window so users can easily access items such as folders and files.
- */
-
-
-/* This contains information on one group. */
-typedef struct _EShortcutBarGroup EShortcutBarGroup;
-struct _EShortcutBarGroup
-{
- /* This is the EVScrolledBar which scrolls the group. */
- GtkWidget *vscrolled_bar;
-
- /* This is the icon bar containing the child items. */
- GtkWidget *icon_bar;
-};
-
-
-#define E_SHORTCUT_BAR(obj) GTK_CHECK_CAST (obj, e_shortcut_bar_get_type (), EShortcutBar)
-#define E_SHORTCUT_BAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_shortcut_bar_get_type (), EShortcutBarClass)
-#define E_IS_SHORTCUT_BAR(obj) GTK_CHECK_TYPE (obj, e_shortcut_bar_get_type ())
-
-
-typedef struct _EShortcutBar EShortcutBar;
-typedef struct _EShortcutBarClass EShortcutBarClass;
-
-struct _EShortcutBar
-{
- EGroupBar group_bar;
-
- /* This is an array of EShortcutBarGroup elements. */
- GArray *groups;
-
- gchar *dragged_url;
- gchar *dragged_name;
-};
-
-struct _EShortcutBarClass
-{
- EGroupBarClass parent_class;
-
- void (*selected_item) (EShortcutBar *shortcut_bar,
- GdkEvent *event,
- gint group_num,
- gint item_num);
-};
-
-
-GtkType e_shortcut_bar_get_type (void);
-GtkWidget* e_shortcut_bar_new (void);
-
-/* Adds a new group, returning the index. */
-gint e_shortcut_bar_add_group (EShortcutBar *shortcut_bar,
- gchar *group_name);
-void e_shortcut_bar_remove_group (EShortcutBar *shortcut_bar,
- gint group_num);
-
-/* Sets the view type for the group. */
-void e_shortcut_bar_set_view_type (EShortcutBar *shortcut_bar,
- gint group_num,
- EIconBarViewType view_type);
-
-/* Adds a new item to a group, returning the index within the group. */
-gint e_shortcut_bar_add_item (EShortcutBar *shortcut_bar,
- gint group_num,
- gchar *item_url,
- gchar *item_name);
-
-void e_shortcut_bar_start_editing_item (EShortcutBar *shortcut_bar,
- gint group_num,
- gint item_num);
-void e_shortcut_bar_remove_item (EShortcutBar *shortcut_bar,
- gint group_num,
- gint item_num);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_SHORTCUT_BAR_H_ */
diff --git a/widgets/shortcut-bar/e-vscrolled-bar.c b/widgets/shortcut-bar/e-vscrolled-bar.c
deleted file mode 100644
index 5d5f0ab2e2..0000000000
--- a/widgets/shortcut-bar/e-vscrolled-bar.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * EVScrolledBar is like GtkScrolledWindow but only scrolls the child widget
- * vertically. It is intended for scrolling narrow vertical bars.
- */
-
-#include <gtk/gtkarrow.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtksignal.h>
-
-#include "e-vscrolled-bar.h"
-
-/* These are the offsets of the up & down buttons from the right and top/bottom
- of the widget. */
-#define E_VSCROLLED_BAR_BUTTON_X_OFFSET 2
-#define E_VSCROLLED_BAR_BUTTON_Y_OFFSET 2
-
-/* This is the time between scrolls. */
-#define E_VSCROLLED_BAR_SCROLL_TIMEOUT 20
-
-static void e_vscrolled_bar_class_init (EVScrolledBarClass *class);
-static void e_vscrolled_bar_init (EVScrolledBar *vscrolled_bar);
-static void e_vscrolled_bar_destroy (GtkObject *object);
-static void e_vscrolled_bar_finalize (GtkObject *object);
-static void e_vscrolled_bar_map (GtkWidget *widget);
-static void e_vscrolled_bar_unmap (GtkWidget *widget);
-static void e_vscrolled_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void e_vscrolled_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void e_vscrolled_bar_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void e_vscrolled_bar_add (GtkContainer *container,
- GtkWidget *child);
-static void e_vscrolled_bar_remove (GtkContainer *container,
- GtkWidget *child);
-static void e_vscrolled_bar_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
-static void e_vscrolled_bar_adjustment_changed (GtkAdjustment *adjustment,
- gpointer data);
-static void e_vscrolled_bar_button_pressed (GtkWidget *button,
- EVScrolledBar *vscrolled_bar);
-static void e_vscrolled_bar_button_released (GtkWidget *button,
- EVScrolledBar *vscrolled_bar);
-static void e_vscrolled_bar_button_clicked (GtkWidget *button,
- EVScrolledBar *vscrolled_bar);
-static gboolean e_vscrolled_bar_timeout_handler (gpointer data);
-
-
-static GtkBinClass *parent_class;
-
-
-GtkType
-e_vscrolled_bar_get_type (void)
-{
- static GtkType e_vscrolled_bar_type = 0;
-
- if (!e_vscrolled_bar_type) {
- GtkTypeInfo e_vscrolled_bar_info = {
- "EVScrolledBar",
- sizeof (EVScrolledBar),
- sizeof (EVScrolledBarClass),
- (GtkClassInitFunc) e_vscrolled_bar_class_init,
- (GtkObjectInitFunc) e_vscrolled_bar_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- parent_class = gtk_type_class (GTK_TYPE_BIN);
- e_vscrolled_bar_type = gtk_type_unique (GTK_TYPE_BIN,
- &e_vscrolled_bar_info);
- }
-
- return e_vscrolled_bar_type;
-}
-
-
-static void
-e_vscrolled_bar_class_init (EVScrolledBarClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- /* Method override */
- object_class->destroy = e_vscrolled_bar_destroy;
- object_class->finalize = e_vscrolled_bar_finalize;
-
- widget_class->map = e_vscrolled_bar_map;
- widget_class->unmap = e_vscrolled_bar_unmap;
- widget_class->size_request = e_vscrolled_bar_size_request;
- widget_class->size_allocate = e_vscrolled_bar_size_allocate;
- widget_class->draw = e_vscrolled_bar_draw;
-
- container_class->add = e_vscrolled_bar_add;
- container_class->remove = e_vscrolled_bar_remove;
- container_class->forall = e_vscrolled_bar_forall;
-}
-
-
-static void
-e_vscrolled_bar_init (EVScrolledBar *vscrolled_bar)
-{
- GtkWidget *arrow;
-
- GTK_WIDGET_SET_FLAGS (vscrolled_bar, GTK_NO_WINDOW);
-
- gtk_container_set_resize_mode (GTK_CONTAINER (vscrolled_bar),
- GTK_RESIZE_QUEUE);
-
- gtk_widget_push_composite_child ();
-
- vscrolled_bar->up_button = gtk_button_new ();
- gtk_widget_set_composite_name (vscrolled_bar->up_button,
- "up_button");
- gtk_widget_set_parent (vscrolled_bar->up_button,
- GTK_WIDGET (vscrolled_bar));
- arrow = gtk_arrow_new (GTK_ARROW_UP, GTK_SHADOW_OUT);
- gtk_misc_set_padding (GTK_MISC (arrow), 1, 1);
- gtk_widget_show (arrow);
- gtk_container_add (GTK_CONTAINER (vscrolled_bar->up_button), arrow);
- gtk_signal_connect_after (GTK_OBJECT (vscrolled_bar->up_button), "pressed", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_pressed), vscrolled_bar);
- gtk_signal_connect_after (GTK_OBJECT (vscrolled_bar->up_button), "released", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_released), vscrolled_bar);
- gtk_signal_connect (GTK_OBJECT (vscrolled_bar->up_button), "clicked", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_clicked), vscrolled_bar);
-
- vscrolled_bar->down_button = gtk_button_new ();
- gtk_widget_set_composite_name (vscrolled_bar->up_button,
- "down_button");
- gtk_widget_set_parent (vscrolled_bar->down_button,
- GTK_WIDGET (vscrolled_bar));
- arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
- gtk_misc_set_padding (GTK_MISC (arrow), 1, 1);
- gtk_widget_show (arrow);
- gtk_container_add (GTK_CONTAINER (vscrolled_bar->down_button), arrow);
- gtk_signal_connect_after (GTK_OBJECT (vscrolled_bar->down_button), "pressed", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_pressed), vscrolled_bar);
- gtk_signal_connect_after (GTK_OBJECT (vscrolled_bar->down_button), "released", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_released), vscrolled_bar);
- gtk_signal_connect (GTK_OBJECT (vscrolled_bar->down_button), "clicked", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_clicked), vscrolled_bar);
-
- gtk_widget_pop_composite_child ();
-
- vscrolled_bar->adjustment = NULL;
- vscrolled_bar->timeout_id = 0;
- vscrolled_bar->scrolling_up = FALSE;
- vscrolled_bar->min_distance = -1.0;
- vscrolled_bar->button_pressed = FALSE;
-}
-
-
-/**
- * e_vscrolled_bar_new:
- *
- * @adjustment: The #GtkAdjustment to use for scrolling, or NULL.
- * @Return: A new #EVScrolledBar.
- *
- * Creates a new #EVScrolledBar with the given adjustment.
- **/
-GtkWidget *
-e_vscrolled_bar_new (GtkAdjustment *adjustment)
-{
- GtkWidget *vscrolled_bar;
-
- vscrolled_bar = GTK_WIDGET (gtk_type_new (e_vscrolled_bar_get_type ()));
- e_vscrolled_bar_set_adjustment (E_VSCROLLED_BAR (vscrolled_bar),
- adjustment);
-
- return vscrolled_bar;
-}
-
-
-static void
-e_vscrolled_bar_destroy (GtkObject *object)
-{
- EVScrolledBar *vscrolled_bar;
-
- vscrolled_bar = E_VSCROLLED_BAR (object);
-
- if (vscrolled_bar->timeout_id) {
- g_source_remove (vscrolled_bar->timeout_id);
- vscrolled_bar->timeout_id = 0;
- }
-
- gtk_widget_unparent (vscrolled_bar->up_button);
- gtk_widget_unparent (vscrolled_bar->down_button);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-
-static void
-e_vscrolled_bar_finalize (GtkObject *object)
-{
- EVScrolledBar *vscrolled_bar;
-
- vscrolled_bar = E_VSCROLLED_BAR (object);
-
- gtk_object_unref (GTK_OBJECT (vscrolled_bar->adjustment));
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-static void
-e_vscrolled_bar_map (GtkWidget *widget)
-{
- EVScrolledBar *vscrolled_bar;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_VSCROLLED_BAR (widget));
-
- vscrolled_bar = E_VSCROLLED_BAR (widget);
-
- /* chain parent class handler to map self and child */
- GTK_WIDGET_CLASS (parent_class)->map (widget);
-
- if (GTK_WIDGET_VISIBLE (vscrolled_bar->up_button) &&
- !GTK_WIDGET_MAPPED (vscrolled_bar->up_button))
- gtk_widget_map (vscrolled_bar->up_button);
-
- if (GTK_WIDGET_VISIBLE (vscrolled_bar->down_button) &&
- !GTK_WIDGET_MAPPED (vscrolled_bar->down_button))
- gtk_widget_map (vscrolled_bar->down_button);
-}
-
-
-static void
-e_vscrolled_bar_unmap (GtkWidget *widget)
-{
- EVScrolledBar *vscrolled_bar;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_VSCROLLED_BAR (widget));
-
- vscrolled_bar = E_VSCROLLED_BAR (widget);
-
- /* chain parent class handler to unmap self and child */
- GTK_WIDGET_CLASS (parent_class)->unmap (widget);
-
- if (GTK_WIDGET_MAPPED (vscrolled_bar->up_button))
- gtk_widget_unmap (vscrolled_bar->up_button);
-
- if (GTK_WIDGET_MAPPED (vscrolled_bar->down_button))
- gtk_widget_unmap (vscrolled_bar->down_button);
-}
-
-
-static void
-e_vscrolled_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- EVScrolledBar *vscrolled_bar;
- GtkBin *bin;
- GtkRequisition child_requisition;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_VSCROLLED_BAR (widget));
- g_return_if_fail (requisition != NULL);
-
- vscrolled_bar = E_VSCROLLED_BAR (widget);
- bin = GTK_BIN (widget);
-
- requisition->width = 0;
- requisition->height = 0;
-
- /* We just return the requisition of the child widget, plus the
- border width. */
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
- gtk_widget_size_request (bin->child, &child_requisition);
- *requisition = child_requisition;
- }
-
- /* We remember the requested heights of the up & down buttons. */
- gtk_widget_size_request (vscrolled_bar->up_button,
- &child_requisition);
- vscrolled_bar->up_button_width = child_requisition.width;
- vscrolled_bar->up_button_height = child_requisition.height;
-
- gtk_widget_size_request (vscrolled_bar->down_button,
- &child_requisition);
- vscrolled_bar->down_button_width = child_requisition.width;
- vscrolled_bar->down_button_height = child_requisition.height;
-
- /* Add on the standard container border widths. */
- requisition->width += GTK_CONTAINER (widget)->border_width * 2;
- requisition->height += GTK_CONTAINER (widget)->border_width * 2;
-}
-
-
-static void
-e_vscrolled_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- EVScrolledBar *vscrolled_bar;
- GtkBin *bin;
- GtkAllocation button_allocation, child_allocation;
- gint border_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_VSCROLLED_BAR (widget));
- g_return_if_fail (allocation != NULL);
-
- vscrolled_bar = E_VSCROLLED_BAR (widget);
- bin = GTK_BIN (widget);
-
- widget->allocation = *allocation;
-
- border_width = GTK_CONTAINER (widget)->border_width;
-
- child_allocation.x = border_width;
- child_allocation.y = border_width;
- child_allocation.width = allocation->width - 2 * border_width;
- child_allocation.height = allocation->height - 2 * border_width;
- gtk_widget_size_allocate (bin->child, &child_allocation);
-
- button_allocation.x = allocation->width - border_width
- - vscrolled_bar->up_button_width
- - E_VSCROLLED_BAR_BUTTON_X_OFFSET;
- button_allocation.y = border_width + E_VSCROLLED_BAR_BUTTON_Y_OFFSET;
- button_allocation.width = vscrolled_bar->up_button_width;
- button_allocation.height = vscrolled_bar->up_button_height;
- gtk_widget_size_allocate (vscrolled_bar->up_button,
- &button_allocation);
-
- button_allocation.x = allocation->width - border_width
- - vscrolled_bar->down_button_width
- - E_VSCROLLED_BAR_BUTTON_X_OFFSET;
- button_allocation.y = allocation->height - border_width
- - vscrolled_bar->down_button_height
- - E_VSCROLLED_BAR_BUTTON_Y_OFFSET;
- button_allocation.width = vscrolled_bar->down_button_width;
- button_allocation.height = vscrolled_bar->down_button_height;
- gtk_widget_size_allocate (vscrolled_bar->down_button,
- &button_allocation);
-}
-
-
-static void
-e_vscrolled_bar_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- EVScrolledBar *vscrolled_bar;
- GtkBin *bin;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_VSCROLLED_BAR (widget));
- g_return_if_fail (area != NULL);
-
- vscrolled_bar = E_VSCROLLED_BAR (widget);
- bin = GTK_BIN (widget);
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child) &&
- gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
-
- if (GTK_WIDGET_VISIBLE (vscrolled_bar->up_button) &&
- gtk_widget_intersect (vscrolled_bar->up_button, area, &child_area))
- gtk_widget_draw (vscrolled_bar->up_button, &child_area);
-
- if (GTK_WIDGET_VISIBLE (vscrolled_bar->down_button) &&
- gtk_widget_intersect (vscrolled_bar->down_button, area, &child_area))
- gtk_widget_draw (vscrolled_bar->down_button, &child_area);
-}
-
-
-static void
-e_vscrolled_bar_add (GtkContainer *container,
- GtkWidget *child)
-{
- EVScrolledBar *vscrolled_bar;
- GtkBin *bin;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (E_IS_VSCROLLED_BAR (container));
-
- vscrolled_bar = E_VSCROLLED_BAR (container);
- bin = GTK_BIN (container);
-
- g_return_if_fail (bin->child == NULL);
-
- bin->child = child;
- gtk_widget_set_parent (child, GTK_WIDGET (bin));
-
- gtk_widget_set_scroll_adjustments (child, NULL,
- vscrolled_bar->adjustment);
-
- if (GTK_WIDGET_REALIZED (child->parent))
- gtk_widget_realize (child);
-
- if (GTK_WIDGET_VISIBLE (child->parent) && GTK_WIDGET_VISIBLE (child)) {
- if (GTK_WIDGET_MAPPED (child->parent))
- gtk_widget_map (child);
-
- gtk_widget_queue_resize (child);
- }
-}
-
-
-static void
-e_vscrolled_bar_remove (GtkContainer *container,
- GtkWidget *child)
-{
- g_return_if_fail (container != NULL);
- g_return_if_fail (E_IS_VSCROLLED_BAR (container));
- g_return_if_fail (child != NULL);
- g_return_if_fail (GTK_BIN (container)->child == child);
-
- gtk_widget_set_scroll_adjustments (child, NULL, NULL);
-
- /* chain parent class handler to remove child */
- GTK_CONTAINER_CLASS (parent_class)->remove (container, child);
-}
-
-
-static void
-e_vscrolled_bar_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
-{
- g_return_if_fail (container != NULL);
- g_return_if_fail (E_IS_VSCROLLED_BAR (container));
- g_return_if_fail (callback != NULL);
-
- GTK_CONTAINER_CLASS (parent_class)->forall (container,
- include_internals,
- callback,
- callback_data);
- if (include_internals) {
- EVScrolledBar *vscrolled_bar;
-
- vscrolled_bar = E_VSCROLLED_BAR (container);
-
- if (vscrolled_bar->up_button)
- callback (vscrolled_bar->up_button, callback_data);
- if (vscrolled_bar->down_button)
- callback (vscrolled_bar->down_button, callback_data);
- }
-}
-
-
-/**
- * e_vscrolled_bar_get_adjustment:
- *
- * @vscrolled_bar: An #EVScrolledBar.
- * @Return: The #GtkAdjustment used for scrolling @vscrolled_bar.
- *
- * Returns the #GtkAdjustment used for scrolling the #EVscrolledBar.
- **/
-GtkAdjustment*
-e_vscrolled_bar_get_adjustment (EVScrolledBar *vscrolled_bar)
-{
- g_return_val_if_fail (vscrolled_bar != NULL, NULL);
- g_return_val_if_fail (E_IS_VSCROLLED_BAR (vscrolled_bar), NULL);
-
- return vscrolled_bar->adjustment;
-}
-
-
-/**
- * e_vscrolled_bar_set_adjustment:
- *
- * @vscrolled_bar: An #EVScrolledBar.
- * @adjustment: The #GtkAdjustment to use for scrolling @vscrolled_bar.
- *
- * Sets the #GtkAdjustment to use for scrolling the #EVscrolledBar.
- **/
-void
-e_vscrolled_bar_set_adjustment (EVScrolledBar *vscrolled_bar,
- GtkAdjustment *adjustment)
-{
- g_return_if_fail (vscrolled_bar != NULL);
- g_return_if_fail (E_IS_VSCROLLED_BAR (vscrolled_bar));
-
- if (adjustment)
- g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
- else
- adjustment = (GtkAdjustment*) gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL);
-
- if (vscrolled_bar->adjustment == adjustment)
- return;
-
- if (vscrolled_bar->adjustment) {
- gtk_signal_disconnect_by_func (GTK_OBJECT (vscrolled_bar->adjustment),
- GTK_SIGNAL_FUNC (e_vscrolled_bar_adjustment_changed),
- vscrolled_bar);
- gtk_object_unref (GTK_OBJECT (vscrolled_bar->adjustment));
- }
-
- vscrolled_bar->adjustment = adjustment;
- gtk_object_ref (GTK_OBJECT (vscrolled_bar->adjustment));
- gtk_object_sink (GTK_OBJECT (vscrolled_bar->adjustment));
-
- /* I've used connect_after here to avoid a problem when using a
- GnomeCanvas as the child widget. When just using connect it would
- leave a blank space when one of the buttons is hidden. We want
- the GtkLayout to handle the scrolling before we hide any buttons. */
- gtk_signal_connect_after (GTK_OBJECT (adjustment), "changed",
- GTK_SIGNAL_FUNC (e_vscrolled_bar_adjustment_changed),
- vscrolled_bar);
- gtk_signal_connect_after (GTK_OBJECT (adjustment), "value_changed",
- GTK_SIGNAL_FUNC (e_vscrolled_bar_adjustment_changed),
- vscrolled_bar);
-
- e_vscrolled_bar_adjustment_changed (adjustment, vscrolled_bar);
-
- if (GTK_BIN (vscrolled_bar)->child)
- gtk_widget_set_scroll_adjustments (GTK_BIN (vscrolled_bar)->child, NULL, adjustment);
-}
-
-
-static void
-e_vscrolled_bar_adjustment_changed (GtkAdjustment *adjustment,
- gpointer data)
-{
- EVScrolledBar *vscrolled_bar;
-
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (data != NULL);
-
- vscrolled_bar = E_VSCROLLED_BAR (data);
-
- /* If the adjustment value is not 0, show the up button. */
- if (adjustment->value != 0)
- gtk_widget_show (vscrolled_bar->up_button);
- else
- gtk_widget_hide (vscrolled_bar->up_button);
-
- /* If the adjustment value is less than the maximum value, show the
- down button. */
- if (adjustment->value < adjustment->upper - adjustment->page_size)
- gtk_widget_show (vscrolled_bar->down_button);
- else
- gtk_widget_hide (vscrolled_bar->down_button);
-}
-
-
-static void
-e_vscrolled_bar_button_pressed (GtkWidget *button,
- EVScrolledBar *vscrolled_bar)
-{
- if (vscrolled_bar->timeout_id != 0)
- g_source_remove (vscrolled_bar->timeout_id);
-
- vscrolled_bar->timeout_id = g_timeout_add (E_VSCROLLED_BAR_SCROLL_TIMEOUT, e_vscrolled_bar_timeout_handler, vscrolled_bar);
- vscrolled_bar->scrolling_up = (button == vscrolled_bar->up_button) ? TRUE : FALSE;
- vscrolled_bar->min_distance = vscrolled_bar->adjustment->page_size / 4;
- vscrolled_bar->button_pressed = TRUE;
-
- e_vscrolled_bar_timeout_handler (vscrolled_bar);
-}
-
-
-static void
-e_vscrolled_bar_button_released (GtkWidget *button,
- EVScrolledBar *vscrolled_bar)
-{
- vscrolled_bar->button_pressed = FALSE;
-}
-
-
-/* This will be called when the user hits the space key to activate the button.
- It will also be called just before button_released() is called, but since
- we already handle that we simply return if the button is pressed. */
-static void
-e_vscrolled_bar_button_clicked (GtkWidget *button,
- EVScrolledBar *vscrolled_bar)
-{
- if (vscrolled_bar->button_pressed)
- return;
-
- /* We act as if the button is pressed and released immediately. */
- e_vscrolled_bar_button_pressed (button, vscrolled_bar);
- vscrolled_bar->button_pressed = FALSE;
-}
-
-
-static gboolean
-e_vscrolled_bar_timeout_handler (gpointer data)
-{
- EVScrolledBar *vscrolled_bar;
- GtkAdjustment *adjustment;
- gfloat new_value;
- gboolean retval = TRUE;
-
- vscrolled_bar = E_VSCROLLED_BAR (data);
- adjustment = vscrolled_bar->adjustment;
-
- GDK_THREADS_ENTER ();
-
- /* Check if the user has released the button and we have already
- scrolled the minimum distance. */
- if (vscrolled_bar->button_pressed == FALSE
- && vscrolled_bar->min_distance <= 0) {
- GDK_THREADS_LEAVE ();
- return FALSE;
- }
-
- vscrolled_bar->min_distance -= adjustment->step_increment;
-
- if (vscrolled_bar->scrolling_up) {
- new_value = adjustment->value - adjustment->step_increment;
- if (new_value <= adjustment->lower) {
- new_value = adjustment->lower;
- retval = FALSE;
- }
- } else {
- new_value = adjustment->value + adjustment->step_increment;
- if (new_value >= adjustment->upper - adjustment->page_size) {
- new_value = adjustment->upper - adjustment->page_size;
- retval = FALSE;
- }
- }
-
- if (adjustment->value != new_value) {
- adjustment->value = new_value;
- gtk_signal_emit_by_name (GTK_OBJECT (adjustment),
- "value_changed");
- }
-
- GDK_THREADS_LEAVE ();
- return retval;
-}
diff --git a/widgets/shortcut-bar/e-vscrolled-bar.h b/widgets/shortcut-bar/e-vscrolled-bar.h
deleted file mode 100644
index d3273e6685..0000000000
--- a/widgets/shortcut-bar/e-vscrolled-bar.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-#ifndef _E_VSCROLLED_BAR_H_
-#define _E_VSCROLLED_BAR_H_
-
-#include <gtk/gtkbin.h>
-#include <gtk/gtkadjustment.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/*
- * EVScrolledBar is like GtkScrolledWindow but only scrolls the child widget
- * vertically. It is intended for scrolling narrow vertical bars.
- */
-
-
-#define E_VSCROLLED_BAR(obj) GTK_CHECK_CAST (obj, e_vscrolled_bar_get_type (), EVScrolledBar)
-#define E_VSCROLLED_BAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_vscrolled_bar_get_type (), EVScrolledBarClass)
-#define E_IS_VSCROLLED_BAR(obj) GTK_CHECK_TYPE (obj, e_vscrolled_bar_get_type ())
-
-
-typedef struct _EVScrolledBar EVScrolledBar;
-typedef struct _EVScrolledBarClass EVScrolledBarClass;
-
-struct _EVScrolledBar
-{
- GtkBin bin;
-
- GtkWidget *up_button;
- GtkWidget *down_button;
-
- GtkAdjustment *adjustment;
-
- gint up_button_width;
- gint up_button_height;
- gint down_button_width;
- gint down_button_height;
-
- /* The GTK+ event source ID of our timeout handler. */
- gint timeout_id;
-
- /* TRUE if we are scrolling up, FALSE if scrolling down. */
- gboolean scrolling_up;
-
- /* The minimum distance left to scroll. If the user just clicks a
- button we scroll a minimum amount. This is reduced after each
- scroll. */
- gfloat min_distance;
-
- /* TRUE if the button is still pressed. When the up/down button is
- released, this gets set to FALSE, and we scroll until the minimum
- distance falls below 0. */
- gboolean button_pressed;
-};
-
-struct _EVScrolledBarClass
-{
- GtkBinClass parent_class;
-};
-
-
-GtkType e_vscrolled_bar_get_type (void);
-GtkWidget* e_vscrolled_bar_new (GtkAdjustment *adjustment);
-
-GtkAdjustment* e_vscrolled_bar_get_adjustment (EVScrolledBar *vscrolled_bar);
-void e_vscrolled_bar_set_adjustment (EVScrolledBar *vscrolled_bar,
- GtkAdjustment *adjustment);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_VSCROLLED_BAR_H_ */
diff --git a/widgets/shortcut-bar/test-shortcut-bar.c b/widgets/shortcut-bar/test-shortcut-bar.c
deleted file mode 100644
index 186bf3ed8a..0000000000
--- a/widgets/shortcut-bar/test-shortcut-bar.c
+++ /dev/null
@@ -1,445 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Author :
- * Damon Chaplin <damon@gtk.org>
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-/*
- * This tests the ShortcutBar widget.
- */
-
-#include <gnome.h>
-
-#include "e-shortcut-bar.h"
-
-#define NUM_SHORTCUT_TYPES 5
-gchar *shortcut_types[] = {
- "folder:", "file:", "calendar:", "todo:", "contacts:"
-};
-
-GtkWidget *main_label;
-
-static void quit (GtkWidget *window, GdkEvent *event, gpointer data);
-static void add_test_groups (EShortcutBar *shortcut_bar);
-static void add_test_group (EShortcutBar *shortcut_bar, gint i,
- gchar *group_name);
-static gint get_random_int (gint max);
-
-static void on_shortcut_bar_item_selected (EShortcutBar *shortcut_bar,
- GdkEvent *event,
- gint group_num,
- gint item_num);
-static void show_standard_popup (EShortcutBar *shortcut_bar,
- GdkEvent *event,
- gint group_num);
-static void show_context_popup (EShortcutBar *shortcut_bar,
- GdkEvent *event,
- gint group_num,
- gint item_num);
-
-static void set_large_icons (GtkWidget *menuitem,
- EShortcutBar *shortcut_bar);
-static void set_small_icons (GtkWidget *menuitem,
- EShortcutBar *shortcut_bar);
-static void remove_group (GtkWidget *menuitem,
- EShortcutBar *shortcut_bar);
-
-static void rename_item (GtkWidget *menuitem,
- EShortcutBar *shortcut_bar);
-static void remove_item (GtkWidget *menuitem,
- EShortcutBar *shortcut_bar);
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *window, *hpaned, *shortcut_bar;
-
- gnome_init ("test-shortcut-bar", "0.1", argc, argv);
-
- gtk_widget_push_visual (gdk_imlib_get_visual ());
- gtk_widget_push_colormap (gdk_imlib_get_colormap ());
-
- window = gnome_app_new ("TestShortcutBar", "TestShortCutBar");
- gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
- gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE);
-
- gtk_signal_connect (GTK_OBJECT (window), "delete-event",
- GTK_SIGNAL_FUNC (quit), NULL);
-
- hpaned = gtk_hpaned_new ();
- gnome_app_set_contents (GNOME_APP (window), hpaned);
- gtk_widget_show (hpaned);
-
- shortcut_bar = e_shortcut_bar_new ();
- gtk_paned_pack1 (GTK_PANED (hpaned), shortcut_bar, FALSE, TRUE);
- gtk_widget_show (shortcut_bar);
-
-#if 0
- gtk_container_set_border_width (GTK_CONTAINER (shortcut_bar), 4);
-#endif
-
- gtk_paned_set_position (GTK_PANED (hpaned), 100);
- /*gtk_paned_set_gutter_size (GTK_PANED (hpaned), 12);*/
-
- main_label = gtk_label_new ("Main Application Window Goes Here");
- gtk_paned_pack2 (GTK_PANED (hpaned), main_label, TRUE, TRUE);
- gtk_widget_show (main_label);
-
-
- gtk_widget_pop_visual ();
- gtk_widget_pop_colormap ();
-
- add_test_groups (E_SHORTCUT_BAR (shortcut_bar));
-
- gtk_signal_connect (GTK_OBJECT (shortcut_bar), "item_selected",
- GTK_SIGNAL_FUNC (on_shortcut_bar_item_selected),
- NULL);
-
- gtk_widget_show (window);
- gtk_main ();
- return 0;
-}
-
-
-static void
-quit (GtkWidget *window, GdkEvent *event, gpointer data)
-{
- gtk_widget_destroy (window);
- gtk_exit (0);
-}
-
-
-static void
-add_test_groups (EShortcutBar *shortcut_bar)
-{
- add_test_group (shortcut_bar, 1, "Shortcuts");
- add_test_group (shortcut_bar, 2, "My Shortcuts");
- add_test_group (shortcut_bar, 3, "Longer Shortcuts");
- add_test_group (shortcut_bar, 4, "Very Long Shortcuts");
- add_test_group (shortcut_bar, 5, "Incredibly Long Shortcuts");
-}
-
-
-static void
-add_test_group (EShortcutBar *shortcut_bar, gint i, gchar *group_name)
-{
- gint group_num, item_num, num_items;
- gchar buffer[128];
- gint shortcut_type, j;
-
- group_num = e_shortcut_bar_add_group (E_SHORTCUT_BAR (shortcut_bar),
- group_name);
-
- if (group_num % 2)
- e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (shortcut_bar),
- group_num,
- E_ICON_BAR_SMALL_ICONS);
-
- num_items = get_random_int (5) + 3;
- for (j = 1; j <= num_items; j++) {
- if (j == 1)
- sprintf (buffer, "A very long shortcut with proper words so I can test the wrapping and ellipsis behaviour");
- else if (j == 2)
- sprintf (buffer, "A very long shortcut with averylongworkinthemiddlesoIcantestthewrappingandellipsisbehaviour");
- else
- sprintf (buffer, "Item %i:%i\n", i, j);
-
- shortcut_type = get_random_int (NUM_SHORTCUT_TYPES);
- item_num = e_shortcut_bar_add_item (E_SHORTCUT_BAR (shortcut_bar), group_num, shortcut_types[shortcut_type], buffer);
- }
-}
-
-
-/* Returns a random integer between 0 and max - 1. */
-static gint
-get_random_int (gint max)
-{
- gint random_num;
-
- random_num = (int) (max * (rand () / (RAND_MAX + 1.0)));
-#if 0
- g_print ("Random num (%i): %i\n", max, random_num);
-#endif
- return random_num;
-}
-
-
-static void
-on_shortcut_bar_item_selected (EShortcutBar *shortcut_bar,
- GdkEvent *event, gint group_num, gint item_num)
-{
- gchar buffer[256];
-
- if (event->button.button == 1) {
- sprintf (buffer, "Item Selected - %i:%i",
- group_num + 1, item_num + 1);
- gtk_label_set_text (GTK_LABEL (main_label), buffer);
- } else if (event->button.button == 3) {
- if (item_num == -1)
- show_standard_popup (shortcut_bar, event, group_num);
- else
- show_context_popup (shortcut_bar, event, group_num,
- item_num);
- }
-}
-
-
-static void
-show_standard_popup (EShortcutBar *shortcut_bar,
- GdkEvent *event,
- gint group_num)
-{
- GtkWidget *menu, *menuitem;
-
- /* We don't have any commands if there aren't any groups yet. */
- if (group_num == -1)
- return;
-
- menu = gtk_menu_new ();
-
- menuitem = gtk_menu_item_new_with_label ("Large Icons");
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (set_large_icons), shortcut_bar);
-
- menuitem = gtk_menu_item_new_with_label ("Small Icons");
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (set_small_icons), shortcut_bar);
-
- menuitem = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("Add New Group");
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("Remove Group");
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (remove_group), shortcut_bar);
-
- menuitem = gtk_menu_item_new_with_label ("Rename Group");
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
- menuitem = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("Add Shortcut...");
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
- menuitem = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("Hide Shortcut Bar");
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
- /* Save the group num so we can get it in the callbacks. */
- gtk_object_set_data (GTK_OBJECT (menu), "group_num",
- GINT_TO_POINTER (group_num));
-
- /* FIXME: Destroy menu when finished with it somehow? */
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
- event->button.button, event->button.time);
-}
-
-
-static void
-set_large_icons (GtkWidget *menuitem,
- EShortcutBar *shortcut_bar)
-{
- GtkWidget *menu;
- gint group_num;
-
- menu = menuitem->parent;
- g_return_if_fail (GTK_IS_MENU (menu));
-
- group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
- "group_num"));
-
- e_shortcut_bar_set_view_type (shortcut_bar, group_num,
- E_ICON_BAR_LARGE_ICONS);
-}
-
-
-static void
-set_small_icons (GtkWidget *menuitem,
- EShortcutBar *shortcut_bar)
-{
- GtkWidget *menu;
- gint group_num;
-
- menu = menuitem->parent;
- g_return_if_fail (GTK_IS_MENU (menu));
-
- group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
- "group_num"));
-
- e_shortcut_bar_set_view_type (shortcut_bar, group_num,
- E_ICON_BAR_SMALL_ICONS);
-}
-
-
-static void
-remove_group (GtkWidget *menuitem,
- EShortcutBar *shortcut_bar)
-{
- GtkWidget *menu;
- gint group_num;
-
- menu = menuitem->parent;
- g_return_if_fail (GTK_IS_MENU (menu));
-
- group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
- "group_num"));
-
- e_shortcut_bar_remove_group (shortcut_bar, group_num);
-}
-
-
-static void
-show_context_popup (EShortcutBar *shortcut_bar,
- GdkEvent *event,
- gint group_num,
- gint item_num)
-{
- GtkWidget *menu, *menuitem, *label, *pixmap;
-
- menu = gtk_menu_new ();
-
- menuitem = gtk_pixmap_menu_item_new ();
- label = gtk_label_new ("Open Folder");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_widget_show (label);
- gtk_container_add (GTK_CONTAINER (menuitem), label);
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
- pixmap = gnome_stock_pixmap_widget (menu, GNOME_STOCK_MENU_OPEN);
- if (pixmap) {
- gtk_widget_show(pixmap);
- gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (menuitem), pixmap);
- }
-
- menuitem = gtk_menu_item_new_with_label ("Open in New Window");
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("Advanced Find");
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
- menuitem = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("Remove from Shortcut Bar");
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (remove_item), shortcut_bar);
-
- menuitem = gtk_menu_item_new_with_label ("Rename Shortcut");
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (rename_item), shortcut_bar);
-
- menuitem = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("Properties");
- gtk_widget_set_sensitive (menuitem, FALSE);
- gtk_widget_show (menuitem);
- gtk_menu_append (GTK_MENU (menu), menuitem);
-
-
- /* Save the group & item nums so we can get them in the callbacks. */
- gtk_object_set_data (GTK_OBJECT (menu), "group_num",
- GINT_TO_POINTER (group_num));
- gtk_object_set_data (GTK_OBJECT (menu), "item_num",
- GINT_TO_POINTER (item_num));
-
- /* FIXME: Destroy menu when finished with it somehow? */
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
- event->button.button, event->button.time);
-}
-
-
-static void
-rename_item (GtkWidget *menuitem,
- EShortcutBar *shortcut_bar)
-{
- GtkWidget *menu;
- gint group_num, item_num;
-
- menu = menuitem->parent;
- g_return_if_fail (GTK_IS_MENU (menu));
-
- group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
- "group_num"));
- item_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
- "item_num"));
-
- e_shortcut_bar_start_editing_item (shortcut_bar, group_num, item_num);
-}
-
-
-static void
-remove_item (GtkWidget *menuitem,
- EShortcutBar *shortcut_bar)
-{
- GtkWidget *menu;
- gint group_num, item_num;
-
- menu = menuitem->parent;
- g_return_if_fail (GTK_IS_MENU (menu));
-
- group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
- "group_num"));
- item_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
- "item_num"));
-
- e_shortcut_bar_remove_item (shortcut_bar, group_num, item_num);
-}
-
-
diff --git a/widgets/table/.cvsignore b/widgets/table/.cvsignore
deleted file mode 100644
index 0963d457d9..0000000000
--- a/widgets/table/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
-table-test
diff --git a/widgets/table/add-col.xpm b/widgets/table/add-col.xpm
deleted file mode 100644
index 9c5f314c8e..0000000000
--- a/widgets/table/add-col.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static char * add_col_xpm[] = {
-"16 16 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" ",
-" ",
-" .............. ",
-" .++++++++++++. ",
-" .++++++++++++. ",
-" ....+++....... ",
-" .+. ",
-" . ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/widgets/table/check-empty.xpm b/widgets/table/check-empty.xpm
deleted file mode 100644
index 2dd873e137..0000000000
--- a/widgets/table/check-empty.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static char * check_empty_xpm[] = {
-"16 16 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" ............ ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" . . ",
-" ............ ",
-" ",
-" "};
diff --git a/widgets/table/check-filled.xpm b/widgets/table/check-filled.xpm
deleted file mode 100644
index 689d7a7967..0000000000
--- a/widgets/table/check-filled.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static char * check_filled_xpm[] = {
-"16 16 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" ............ ",
-" . . ",
-" . . . ",
-" . .. . ",
-" . ... . ",
-" . . ... . ",
-" . .. ... . ",
-" . ..... . ",
-" . ... . ",
-" . . . ",
-" . . ",
-" ............ ",
-" ",
-" "};
diff --git a/widgets/table/e-cell-checkbox.c b/widgets/table/e-cell-checkbox.c
deleted file mode 100644
index 431c1663d1..0000000000
--- a/widgets/table/e-cell-checkbox.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * e-cell-checkbox.c: Checkbox cell renderer
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-canvas.h>
-#include "e-cell-checkbox.h"
-#include "e-util/e-util.h"
-#include "e-table-item.h"
-
-#include "check-empty.xpm"
-#include "check-filled.xpm"
-
-#define PARENT_TYPE e_cell_toggle_get_type()
-
-static GdkPixbuf *checks [2];
-
-static void
-e_cell_checkbox_class_init (GtkObjectClass *object_class)
-{
- checks [0] = gdk_pixbuf_new_from_xpm_data (check_empty_xpm);
- checks [1] = gdk_pixbuf_new_from_xpm_data (check_filled_xpm);
-}
-
-E_MAKE_TYPE(e_cell_checkbox, "ECellCheckbox", ECellCheckbox, e_cell_checkbox_class_init, NULL, PARENT_TYPE);
-
-ECell *
-e_cell_checkbox_new (void)
-{
- ECellCheckbox *eccb = gtk_type_new (e_cell_checkbox_get_type ());
-
- e_cell_toggle_construct (E_CELL_TOGGLE (eccb), 2, 2, checks);
-
- return (ECell *) eccb;
-}
diff --git a/widgets/table/e-cell-checkbox.h b/widgets/table/e-cell-checkbox.h
deleted file mode 100644
index 969e4a5edc..0000000000
--- a/widgets/table/e-cell-checkbox.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _E_CELL_CHECKBOX_H_
-#define _E_CELL_CHECKBOX_H_
-
-#include "e-cell-toggle.h"
-
-#define E_CELL_CHECKBOX_TYPE (e_cell_checkbox_get_type ())
-#define E_CELL_CHECKBOX(o) (GTK_CHECK_CAST ((o), E_CELL_CHECKBOX_TYPE, ECellCheckbox))
-#define E_CELL_CHECKBOX_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_CHECKBOX_TYPE, ECellCheckboxClass))
-#define E_IS_CELL_CHECKBOX(o) (GTK_CHECK_TYPE ((o), E_CELL_CHECKBOX_TYPE))
-#define E_IS_CELL_CHECKBOX_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_CHECKBOX_TYPE))
-
-typedef struct {
- ECellToggle parent;
-} ECellCheckbox;
-
-typedef struct {
- ECellToggleClass parent_class;
-} ECellCheckboxClass;
-
-GtkType e_cell_checkbox_get_type (void);
-ECell *e_cell_checkbox_new (void);
-
-#endif /* _E_CELL_CHECKBOX_H_ */
-
diff --git a/widgets/table/e-cell-string.c b/widgets/table/e-cell-string.c
deleted file mode 100644
index 992b1bd10e..0000000000
--- a/widgets/table/e-cell-string.c
+++ /dev/null
@@ -1,9 +0,0 @@
-ECell *
-e_cell_string_new (void)
-{
- ECell *ecell;
-
- ecell = gtk_type_new (ecell);
-
- return ecell;
-}
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
deleted file mode 100644
index fead3d4654..0000000000
--- a/widgets/table/e-cell-text.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * e-cell-text.c: Text cell renderer
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <stdio.h>
-#include "e-cell-text.h"
-#include "e-util/e-util.h"
-#include "e-table-item.h"
-
-#define PARENT_TYPE e_cell_get_type()
-
-#define TEXT_PAD 2
-
-typedef struct {
- char *old_text;
- GtkWidget *entry_top;
- GtkEntry *entry;
-
- /*
- * Where the editing is taking place
- */
- int model_col, view_col, row;
-} CellEdit;
-
-typedef struct {
- ECellView cell_view;
- GdkGC *gc;
- GdkFont *font;
- GnomeCanvas *canvas;
-
- /*
- * During edition.
- */
- CellEdit *edit;
-} ECellTextView;
-
-static ECellClass *parent_class;
-
-static void
-ect_queue_redraw (ECellTextView *text_view, int view_col, int view_row)
-{
- e_table_item_redraw_range (
- text_view->cell_view.e_table_item_view,
- view_col, view_row, view_col, view_row);
-}
-
-/*
- * Accept the currently edited text
- */
-static void
-ect_accept_edits (ECellTextView *text_view)
-{
- const char *text = gtk_entry_get_text (text_view->edit->entry);
- CellEdit *edit = text_view->edit;
-
- e_table_model_set_value_at (text_view->cell_view.e_table_model, edit->model_col, edit->row, text);
-}
-
-/*
- * Shuts down the editing process
- */
-static void
-ect_stop_editing (ECellTextView *text_view)
-{
- CellEdit *edit = text_view->edit;
-
- g_free (edit->old_text);
- edit->old_text = NULL;
- gtk_widget_destroy (edit->entry_top);
- edit->entry_top = NULL;
- edit->entry = NULL;
-
- g_free (edit);
-
- text_view->edit = NULL;
-
- e_table_item_leave_edit (text_view->cell_view.e_table_item_view);
-}
-
-/*
- * Cancels the edits
- */
-static void
-ect_cancel_edit (ECellTextView *text_view)
-{
- ect_queue_redraw (text_view, text_view->edit->view_col, text_view->edit->row);
- ect_stop_editing (text_view);
-}
-
-/*
- * ECell::new_view method
- */
-static ECellView *
-ect_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- ECellText *ect = E_CELL_TEXT (ecell);
- ECellTextView *text_view = g_new0 (ECellTextView, 1);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (e_table_item_view)->canvas;
-
- text_view->cell_view.ecell = ecell;
- text_view->cell_view.e_table_model = table_model;
- text_view->cell_view.e_table_item_view = e_table_item_view;
-
- if (ect->font_name){
- GdkFont *f;
-
- f = gdk_fontset_load (ect->font_name);
- text_view->font = f;
- }
- if (!text_view->font){
- text_view->font = GTK_WIDGET (canvas)->style->font;
-
- gdk_font_ref (text_view->font);
- }
-
- text_view->canvas = canvas;
-
- return (ECellView *)text_view;
-}
-
-/*
- * ECell::kill_view method
- */
-static void
-ect_kill_view (ECellView *ecv)
-{
- ECellTextView *text_view = (ECellTextView *) ecv;
-
- gdk_font_unref (text_view->font);
- text_view->font = NULL;
-
- g_free (text_view);
-}
-
-/*
- * ECell::realize method
- */
-static void
-ect_realize (ECellView *ecell_view)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
-
- text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window);
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-ect_unrealize (ECellView *ecv)
-{
- ECellTextView *text_view = (ECellTextView *) ecv;
-
- gdk_gc_unref (text_view->gc);
- text_view->gc = NULL;
-}
-
-/*
- * ECell::draw method
- */
-static void
-ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected,
- int x1, int y1, int x2, int y2)
-{
- ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- GtkWidget *w = GTK_WIDGET (text_view->canvas);
- GdkRectangle rect;
- const char *str = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
- GdkFont *font = text_view->font;
- const int height = font->ascent + font->descent;
- int xoff;
- gboolean edit_display = FALSE;
-
- /*
- * Figure if this cell is being edited
- */
- if (text_view->edit){
- CellEdit *edit = text_view->edit;
-
- if ((edit->view_col == view_col) && (edit->row == row))
- edit_display = TRUE;
- }
-
- /*
- * Be a nice citizen: clip to the region we are supposed to draw on
- */
- rect.x = x1;
- rect.y = y1;
- rect.width = x2 - x1;
- rect.height = y2 - y1;
- gdk_gc_set_clip_rectangle (text_view->gc, &rect);
-
- if (edit_display){
- CellEdit *edit = text_view->edit;
- const char *text = gtk_entry_get_text (edit->entry);
- GdkWChar *p, *text_wc = g_new (GdkWChar, strlen (text) + 1);
- int text_wc_len = gdk_mbstowcs (text_wc, text, strlen (text));
- const int cursor_pos = GTK_EDITABLE (edit->entry)->current_pos;
- const int left_len = gdk_text_width_wc (text_view->font, text_wc, cursor_pos);
-
- text_wc [text_wc_len] = 0;
- /*
- * Paint
- */
- gdk_gc_set_foreground (text_view->gc, &w->style->base [GTK_STATE_NORMAL]);
- gdk_draw_rectangle (drawable, text_view->gc, TRUE,
- rect.x, rect.y, rect.width, rect.height);
- gdk_gc_set_foreground (text_view->gc, &w->style->text [GTK_STATE_NORMAL]);
-
- {
- GdkGC *gc = text_view->gc;
- const int y = y2 - font->descent - ((y2-y1-height)/2);
- int px, i;
-
- /*
- * Border
- */
- x1 += 2;
- x2--;
-
- px = x1;
-
- /*
- * If the cursor is outside the visible range
- *
- * FIXME: we really want a better behaviour.
- */
- if ((px + left_len) > x2)
- px -= left_len - (x2-x1);
-
- /*
- * Draw
- */
- for (i = 0, p = text_wc; *p; p++, i++){
- gdk_draw_text_wc (
- drawable, font, gc, px, y, p, 1);
-
- if (i == cursor_pos){
- gdk_draw_line (
- drawable, gc,
- px, y - font->ascent,
- px, y + font->descent - 1);
- }
-
- px += gdk_text_width_wc (font, p, 1);
- }
-
- if (i == cursor_pos){
- gdk_draw_line (
- drawable, gc,
- px, y - font->ascent,
- px, y + font->descent - 1);
- }
- }
- g_free (text_wc);
- } else {
- /*
- * Regular cell
- */
- GdkColor *background, *foreground;
- int width;
-
- /*
- * Border
- */
- x1++;
- x2--;
-
- /*
- * Compute draw mode
- */
- switch (ect->justify){
- case GTK_JUSTIFY_LEFT:
- xoff = 1;
- break;
-
- case GTK_JUSTIFY_RIGHT:
- width = 1 + gdk_text_width (font, str, strlen (str));
- xoff = (x2 - x1) - width;
- break;
-
- case GTK_JUSTIFY_CENTER:
- xoff = ((x2 - x1) - gdk_text_width (font, str, strlen (str))) / 2;
- break;
- default:
- xoff = 0;
- g_warning ("Can not handle GTK_JUSTIFY_FILL");
- break;
- }
-
-
- if (selected){
- background = &w->style->bg [GTK_STATE_SELECTED];
- foreground = &w->style->text [GTK_STATE_SELECTED];
- } else {
- background = &w->style->base [GTK_STATE_NORMAL];
- foreground = &w->style->text [GTK_STATE_NORMAL];
- }
-
- gdk_gc_set_foreground (text_view->gc, background);
- gdk_draw_rectangle (drawable, text_view->gc, TRUE,
- rect.x, rect.y, rect.width, rect.height);
- gdk_gc_set_foreground (text_view->gc, foreground);
-
- gdk_draw_string (
- drawable, font, text_view->gc,
- x1 + xoff,
- y2 - font->descent - ((y2-y1-height)/2), str);
- }
-}
-
-/*
- * Selects the entire string
- */
-static void
-ect_edit_select_all (ECellTextView *text_view)
-{
- g_assert (text_view->edit);
-
- gtk_editable_select_region (GTK_EDITABLE (text_view->edit->entry), 0, -1);
-}
-
-/*
- * ECell::event method
- */
-static gint
-ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
-
- switch (event->type){
- case GDK_BUTTON_PRESS:
- /*
- * Adjust for the border we use
- */
- event->button.x++;
-
- printf ("Button pressed at %g %g\n", event->button.x, event->button.y);
- if (text_view->edit){
- printf ("FIXME: Should handle click here\n");
- } else
- e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row);
- break;
-
- case GDK_BUTTON_RELEASE:
- /*
- * Adjust for the border we use
- */
- event->button.x++;
- printf ("Button released at %g %g\n", event->button.x, event->button.y);
- return TRUE;
-
- case GDK_KEY_PRESS:
- if (event->key.keyval == GDK_Escape){
- ect_cancel_edit (text_view);
- return TRUE;
- }
-
- if (!text_view->edit){
- e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row);
- ect_edit_select_all (text_view);
- }
-
- gtk_widget_event (GTK_WIDGET (text_view->edit->entry), event);
- ect_queue_redraw (text_view, view_col, row);
- break;
-
- case GDK_KEY_RELEASE:
- break;
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-/*
- * ECell::height method
- */
-static int
-ect_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
-
- return (text_view->font->ascent + text_view->font->descent) + TEXT_PAD;
-}
-
-/*
- * Callback: invoked when the user pressed "enter" on the GtkEntry
- */
-static void
-ect_entry_activate (GtkEntry *entry, ECellTextView *text_view)
-{
- e_table_item_leave_edit (text_view->cell_view.e_table_item_view);
-}
-
-/*
- * ECellView::enter_edit method
- */
-static void *
-ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- const char *str = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
- CellEdit *edit;
-
- edit = g_new (CellEdit, 1);
- text_view->edit = edit;
-
- edit->model_col = model_col;
- edit->view_col = view_col;
- edit->row = row;
-
- edit->entry = (GtkEntry *) gtk_entry_new ();
- gtk_entry_set_text (edit->entry, str);
- edit->old_text = g_strdup (str);
- gtk_signal_connect (GTK_OBJECT (edit->entry), "activate",
- GTK_SIGNAL_FUNC (ect_entry_activate), text_view);
-
- /*
- * The hack: create this window off-screen
- */
- edit->entry_top = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_container_add (GTK_CONTAINER (edit->entry_top), GTK_WIDGET (edit->entry));
- gtk_widget_set_uposition (edit->entry_top, 20000, 20000);
- gtk_widget_show_all (edit->entry_top);
-
- ect_queue_redraw (text_view, view_col, row);
-
- return NULL;
-}
-
-/*
- * ECellView::leave_edit method
- */
-static void
-ect_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
-
- if (text_view->edit){
- ect_accept_edits (text_view);
- ect_stop_editing (text_view);
- } else {
- /*
- * We did invoke this leave edit internally
- */
- }
-}
-
-/*
- * GtkObject::destroy method
- */
-static void
-ect_destroy (GtkObject *object)
-{
- ECellText *ect = E_CELL_TEXT (object);
-
- g_free (ect->font_name);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-e_cell_text_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->destroy = ect_destroy;
-
- ecc->new_view = ect_new_view;
- ecc->kill_view = ect_kill_view;
- ecc->realize = ect_realize;
- ecc->unrealize = ect_unrealize;
- ecc->draw = ect_draw;
- ecc->event = ect_event;
- ecc->height = ect_height;
- ecc->enter_edit = ect_enter_edit;
- ecc->leave_edit = ect_leave_edit;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, NULL, PARENT_TYPE);
-
-ECell *
-e_cell_text_new (ETableModel *etm, const char *fontname, GtkJustification justify)
-{
- ECellText *ect = gtk_type_new (e_cell_text_get_type ());
-
- ect->font_name = g_strdup (fontname);
- ect->justify = justify;
-
- return (ECell *) ect;
-}
diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h
deleted file mode 100644
index de9629b97b..0000000000
--- a/widgets/table/e-cell-text.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _E_CELL_TEXT_H_
-#define _E_CELL_TEXT_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include "e-cell.h"
-
-#define E_CELL_TEXT_TYPE (e_cell_text_get_type ())
-#define E_CELL_TEXT(o) (GTK_CHECK_CAST ((o), E_CELL_TEXT_TYPE, ECellText))
-#define E_CELL_TEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TEXT_TYPE, ECellTextClass))
-#define E_IS_CELL_TEXT(o) (GTK_CHECK_TYPE ((o), E_CELL_TEXT_TYPE))
-#define E_IS_CELL_TEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TEXT_TYPE))
-
-typedef struct {
- ECell parent;
-
- GtkJustification justify;
- char *font_name;
-} ECellText;
-
-typedef struct {
- ECellClass parent_class;
-} ECellTextClass;
-
-GtkType e_cell_text_get_type (void);
-ECell *e_cell_text_new (ETableModel *model, const char *fontname, GtkJustification justify);
-
-#endif /* _E_CELL_TEXT_H_ */
-
diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c
deleted file mode 100644
index 679d04a0ca..0000000000
--- a/widgets/table/e-cell-toggle.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * e-cell-toggle.c: Multi-state image toggle cell object.
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-canvas.h>
-#include "e-cell-toggle.h"
-#include "e-util/e-util.h"
-#include "e-table-item.h"
-
-#define PARENT_TYPE e_cell_get_type()
-
-typedef struct {
- ECellView cell_view;
- GdkGC *gc;
- GnomeCanvas *canvas;
-} ECellToggleView;
-
-static ECellClass *parent_class;
-
-static void
-etog_queue_redraw (ECellToggleView *text_view, int view_col, int view_row)
-{
- e_table_item_redraw_range (
- text_view->cell_view.e_table_item_view,
- view_col, view_row, view_col, view_row);
-}
-
-/*
- * ECell::realize method
- */
-static ECellView *
-etog_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- ECellToggleView *toggle_view = g_new0 (ECellToggleView, 1);
- ETableItem *eti = E_TABLE_ITEM (e_table_item_view);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas;
-
- toggle_view->cell_view.ecell = ecell;
- toggle_view->cell_view.e_table_model = table_model;
- toggle_view->cell_view.e_table_item_view = e_table_item_view;
- toggle_view->canvas = canvas;
-
- return (ECellView *) toggle_view;
-}
-
-static void
-etog_kill_view (ECellView *ecell_view)
-{
- g_free (ecell_view);
-}
-
-static void
-etog_realize (ECellView *ecell_view)
-{
- ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
-
- toggle_view->gc = gdk_gc_new (GTK_WIDGET (toggle_view->canvas)->window);
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-etog_unrealize (ECellView *ecv)
-{
- ECellToggleView *toggle_view = (ECellToggleView *) ecv;
-
- gdk_gc_unref (toggle_view->gc);
- toggle_view->gc = NULL;
-}
-
-/*
- * ECell::draw method
- */
-static void
-etog_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected,
- int x1, int y1, int x2, int y2)
-{
- ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
- ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
- GdkPixbuf *image;
- ArtPixBuf *art;
- int x, y, width, height;
- const int value = GPOINTER_TO_INT (
- e_table_model_value_at (ecell_view->e_table_model, model_col, row));
-
- if (value >= toggle->n_states){
- g_warning ("Value from the table model is %d, the states we support are [0..%d)\n",
- value, toggle->n_states);
- return;
- }
-
- /*
- * Paint the background
- */
- gdk_draw_rectangle (drawable, GTK_WIDGET (toggle_view->canvas)->style->white_gc, TRUE, x1, y1, x2 - x1, y2 - y1);
-
- image = toggle->images [value];
- art = image->art_pixbuf;
-
- if ((x2 - x1) < art->width){
- x = x1;
- width = x2 - x1;
- } else {
- x = x1 + ((x2 - x1) - art->width) / 2;
- width = art->width;
- }
-
- if ((y2 - y1) < art->height){
- y = y1;
- height = y2 - y1;
- } else {
- y = y1 + ((y2 - y1) - art->height) / 2;
- height = art->height;
- }
-
- width = y2 - y1;
-
- if (image->art_pixbuf->has_alpha){
- GdkColor background;
- guchar *buffer;
- int alpha, ix, iy;
-
- buffer = g_malloc (art->rowstride * art->height * 3);
-
- background.red = 255;
- background.green = 255;
- background.blue = 255;
-
- for (iy = 0; iy < art->height; iy++){
- unsigned char *dest;
- unsigned char *src;
-
- dest = buffer + (iy * art->rowstride);
- src = art->pixels + (iy * art->rowstride);
-
- for (ix = 0; ix < art->width; ix++){
- alpha = src [3];
- if (alpha == 0){
- *dest++ = background.red;
- *dest++ = background.green;
- *dest++ = background.blue;
- src += 3;
- } else if (alpha == 255){
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- } else {
- *dest++ = (background.red + ((*src++ - background.red) * alpha + 0x80)) >> 8;
- *dest++ = (background.green + ((*src++ - background.green) * alpha + 0x80)) >> 8;
- *dest++ = (background.blue + ((*src++ - background.blue) * alpha + 0x80)) >> 8;
- }
- src++;
- }
- }
-
- gdk_draw_rgb_image_dithalign (
- drawable, toggle_view->gc, x, y, width, height,
- GDK_RGB_DITHER_NORMAL, buffer, art->rowstride, 0, 0);
-
- g_free (buffer);
- } else
- gdk_draw_rgb_image_dithalign (
- drawable, toggle_view->gc, x, y, width, height,
- GDK_RGB_DITHER_NORMAL, art->pixels, art->rowstride, 0, 0);
-}
-
-static void
-etog_set_value (ECellToggleView *toggle_view, int model_col, int view_col, int row, int value)
-{
- ECell *ecell = toggle_view->cell_view.ecell;
- ECellToggle *toggle = E_CELL_TOGGLE (ecell);
-
- if (value >= toggle->n_states)
- value = 0;
-
- e_table_model_set_value_at (toggle_view->cell_view.e_table_model,
- model_col, row, GINT_TO_POINTER (value));
- etog_queue_redraw (toggle_view, view_col, row);
-}
-
-/*
- * ECell::event method
- */
-static gint
-etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row)
-{
- ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
- void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
- const int value = GPOINTER_TO_INT (_value);
-
- switch (event->type){
- case GDK_BUTTON_RELEASE:
- etog_set_value (toggle_view, model_col, view_col, row, value + 1);
- return TRUE;
-
- case GDK_KEY_PRESS:
- if (event->key.keyval == GDK_space){
- etog_set_value (toggle_view, model_col, view_col, row, value + 1);
- return TRUE;
- }
- return FALSE;
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-/*
- * ECell::height method
- */
-static int
-etog_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
-
- return toggle->height;
-}
-
-static void
-etog_destroy (GtkObject *object)
-{
- ECellToggle *etog = E_CELL_TOGGLE (object);
- int i;
-
- for (i = 0; i < etog->n_states; i++)
- gdk_pixbuf_unref (etog->images [i]);
-
- g_free (etog->images);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-e_cell_toggle_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->destroy = etog_destroy;
-
- ecc->new_view = etog_new_view;
- ecc->kill_view = etog_kill_view;
- ecc->realize = etog_realize;
- ecc->unrealize = etog_unrealize;
- ecc->draw = etog_draw;
- ecc->event = etog_event;
- ecc->height = etog_height;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-E_MAKE_TYPE(e_cell_toggle, "ECellToggle", ECellToggle, e_cell_toggle_class_init, NULL, PARENT_TYPE);
-
-void
-e_cell_toggle_construct (ECellToggle *etog, int border, int n_states, GdkPixbuf **images)
-{
- int max_height = 0;
- int i;
-
- etog->border = border;
- etog->n_states = n_states;
-
- etog->images = g_new (GdkPixbuf *, n_states);
-
- for (i = 0; i < n_states; i++){
- etog->images [i] = images [i];
- gdk_pixbuf_ref (images [i]);
-
- if (images [i]->art_pixbuf->height > max_height)
- max_height = images [i]->art_pixbuf->height;
- }
-
- etog->height = max_height;
-}
-
-ECell *
-e_cell_toggle_new (int border, int n_states, GdkPixbuf **images)
-{
- ECellToggle *etog = gtk_type_new (e_cell_toggle_get_type ());
-
- e_cell_toggle_construct (etog, border, n_states, images);
-
- return (ECell *) etog;
-}
-
-
diff --git a/widgets/table/e-cell-toggle.h b/widgets/table/e-cell-toggle.h
deleted file mode 100644
index d5773b454a..0000000000
--- a/widgets/table/e-cell-toggle.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _E_CELL_TOGGLE_H_
-#define _E_CELL_TOGGLE_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "e-cell.h"
-
-#define E_CELL_TOGGLE_TYPE (e_cell_toggle_get_type ())
-#define E_CELL_TOGGLE(o) (GTK_CHECK_CAST ((o), E_CELL_TOGGLE_TYPE, ECellToggle))
-#define E_CELL_TOGGLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TOGGLE_TYPE, ECellToggleClass))
-#define E_IS_CELL_TOGGLE(o) (GTK_CHECK_TYPE ((o), E_CELL_TOGGLE_TYPE))
-#define E_IS_CELL_TOGGLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TOGGLE_TYPE))
-
-typedef struct {
- ECell parent;
-
- int border;
- int n_states;
- GdkPixbuf **images;
-
- int height;
-} ECellToggle;
-
-typedef struct {
- ECellClass parent_class;
-} ECellToggleClass;
-
-GtkType e_cell_toggle_get_type (void);
-ECell *e_cell_toggle_new (int border, int n_states, GdkPixbuf **images);
-void e_cell_toggle_construct (ECellToggle *etog, int border,
- int n_states, GdkPixbuf **images);
-
-#endif /* _E_CELL_TOGGLE_H_ */
-
-
diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c
deleted file mode 100644
index f1345e8c6b..0000000000
--- a/widgets/table/e-cell.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * e-cell.c: base class for cell renderers in e-table
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include "e-cell.h"
-#include "e-util/e-util.h"
-
-#define PARENT_TYPE gtk_object_get_type()
-
-static ECellView *
-ec_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- return NULL;
-}
-
-static void
-ec_realize (ECellView *e_cell)
-{
-}
-
-static void
-ec_kill_view (ECellView *ecell_view)
-{
-}
-
-static void
-ec_unrealize (ECellView *e_cell)
-{
-}
-
-static void
-ec_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected,
- int x1, int y1, int x2, int y2)
-{
- g_error ("e-cell-draw invoked\n");
-}
-
-static gint
-ec_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row)
-{
- g_error ("e-cell-event invoked\n");
- return 0;
-}
-
-static gint
-ec_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- g_error ("e-cell-event invoked\n");
- return 0;
-}
-
-static void
-ec_focus (ECellView *ecell_view, int model_col, int view_col, int row, int x1, int y1, int x2, int y2)
-{
- ecell_view->focus_col = view_col;
- ecell_view->focus_row = row;
- ecell_view->focus_x1 = x1;
- ecell_view->focus_y1 = y1;
- ecell_view->focus_x2 = x2;
- ecell_view->focus_y2 = y2;
-}
-
-static void
-ec_unfocus (ECellView *ecell_view)
-{
- ecell_view->focus_col = -1;
- ecell_view->focus_row = -1;
- ecell_view->focus_x1 = -1;
- ecell_view->focus_y1 = -1;
- ecell_view->focus_x2 = -1;
- ecell_view->focus_y2 = -1;
-}
-
-static void *
-ec_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- return NULL;
-}
-
-static void
-ec_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *context)
-{
-}
-
-static void
-e_cell_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- ecc->realize = ec_realize;
- ecc->unrealize = ec_unrealize;
- ecc->new_view = ec_new_view;
- ecc->kill_view = ec_kill_view;
- ecc->draw = ec_draw;
- ecc->event = ec_event;
- ecc->focus = ec_focus;
- ecc->unfocus = ec_unfocus;
- ecc->height = ec_height;
- ecc->enter_edit = ec_enter_edit;
- ecc->leave_edit = ec_leave_edit;
-}
-
-static void
-e_cell_init (GtkObject *object)
-{
-}
-
-E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE);
-
-
-void
-e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row)
-{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->event (
- ecell_view, event, model_col, view_col, row);
-}
-
-ECellView *
-e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- return E_CELL_CLASS (GTK_OBJECT (ecell)->klass)->new_view (
- ecell, table_model, e_table_item_view);
-}
-
-void
-e_cell_view_realize (ECellView *ecell_view)
-{
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->realize (ecell_view);
-}
-
-void
-e_cell_kill_view (ECellView *ecell_view)
-{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->kill_view (ecell_view);
-}
-
-void
-e_cell_unrealize (ECellView *ecell_view)
-{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->unrealize (ecell_view);
-}
-
-void
-e_cell_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, gboolean selected, int x1, int y1, int x2, int y2)
-{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->draw (
- ecell_view, drawable, model_col, view_col, row, selected, x1, y1, x2, y2);
-}
-
-int
-e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->height (
- ecell_view, model_col, view_col, row);
-}
-
-void *
-e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->enter_edit (
- ecell_view, model_col, view_col, row);
-}
-
-void
-e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
-{
- E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->leave_edit (
- ecell_view, model_col, view_col, row, edit_context);
-}
diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h
deleted file mode 100644
index 3c258689e4..0000000000
--- a/widgets/table/e-cell.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef _E_CELL_H_
-#define _E_CELL_H_
-
-#include <gdk/gdktypes.h>
-#include "e-table-model.h"
-
-#define E_CELL_TYPE (e_cell_get_type ())
-#define E_CELL(o) (GTK_CHECK_CAST ((o), E_CELL_TYPE, ECell))
-#define E_CELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass))
-#define E_IS_CELL(o) (GTK_CHECK_TYPE ((o), E_CELL_TYPE))
-#define E_IS_CELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TYPE))
-
-typedef struct _ECell ECell;
-typedef struct _ECellView ECellView;
-
-struct _ECell {
- GtkObject object;
-};
-
-struct _ECellView {
- ECell *ecell;
- ETableModel *e_table_model;
- void *e_table_item_view;
-
- gint focus_x1, focus_y1, focus_x2, focus_y2;
- gint focus_col, focus_row;
-};
-
-#define E_CELL_IS_FOCUSED(ecell_view) (ecell_view->focus_x1 != -1)
-
-typedef struct {
- GtkObjectClass parent_class;
-
- ECellView *(*new_view) (ECell *ecell, ETableModel *table_model, void *e_table_item_view);
- void (*kill_view) (ECellView *ecell_view);
-
- void (*realize) (ECellView *ecell_view);
- void (*unrealize) (ECellView *ecell_view);
-
- void (*draw) (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row,
- gboolean selected, int x1, int y1, int x2, int y2);
- gint (*event) (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row);
- void (*focus) (ECellView *ecell_view, int model_col, int view_col,
- int row, int x1, int y1, int x2, int y2);
- void (*unfocus) (ECellView *ecell_view);
- int (*height) (ECellView *ecell_view, int model_col, int view_col, int row);
-
- void *(*enter_edit)(ECellView *ecell_view, int model_col, int view_col, int row);
- void (*leave_edit)(ECellView *ecell_view, int model_col, int view_col, int row, void *context);
-} ECellClass;
-
-GtkType e_cell_get_type (void);
-ECellView *e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view);
-void e_cell_kill_view (ECellView *ecell_view);
-
-void e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row);
-
-void e_cell_realize (ECellView *ecell_view);
-void e_cell_unrealize (ECellView *ecell_view);
-
-void e_cell_draw (ECellView *ecell_view, GdkDrawable *dr,
- int model_col, int view_col, int row, gboolean selected,
- int x1, int y1, int x2, int y2);
-void e_cell_focus (ECellView *ecell_view, int model_col, int view_col, int row,
- int x1, int y1, int x2, int y2);
-void e_cell_unfocus (ECellView *ecell_view);
-int e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row);
-
-void *e_cell_enter_edit(ECellView *ecell_view, int model_col, int view_col, int row);
-void e_cell_leave_edit(ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context);
-
-#endif /* _E_CELL_H_ */
diff --git a/widgets/table/e-table-col-dnd.h b/widgets/table/e-table-col-dnd.h
deleted file mode 100644
index c1c26175c7..0000000000
--- a/widgets/table/e-table-col-dnd.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _E_TABLE_COL_DND_H_
-#define _E_TABLE_COL_DND_H_
-
-#define TARGET_ETABLE_COL_TYPE "application/x-etable-column-header"
-
-enum {
- TARGET_ETABLE_COL_HEADER
-};
-
-#endif /* _E_TABLE_COL_DND_H_ */
diff --git a/widgets/table/e-table-col.c b/widgets/table/e-table-col.c
deleted file mode 100644
index 6f475158a5..0000000000
--- a/widgets/table/e-table-col.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * E-table-col.c: ETableCol implementation
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
-#include "e-table-col.h"
-#include "e-util/e-util.h"
-
-#define PARENT_TYPE (gtk_object_get_type ())
-
-static GtkObjectClass *parent_class;
-
-static void
-etc_destroy (GtkObject *object)
-{
- ETableCol *etc = E_TABLE_COL (object);
-
- g_free (etc->text);
-
- (*parent_class->destroy)(object);
-}
-
-static void
-e_table_col_class_init (GtkObjectClass *object_class)
-{
- parent_class = gtk_type_class (PARENT_TYPE);
- object_class->destroy = etc_destroy;
-}
-
-E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, NULL, PARENT_TYPE);
-
-ETableCol *
-e_table_col_new (int col_idx, const char *text, int width, int min_width,
- ECell *ecell, GCompareFunc compare, gboolean resizable)
-{
- ETableCol *etc;
-
- g_return_val_if_fail (width >= 0, NULL);
- g_return_val_if_fail (min_width >= 0, NULL);
- g_return_val_if_fail (width >= min_width, NULL);
- g_return_val_if_fail (compare != NULL, NULL);
-
- etc = gtk_type_new (E_TABLE_COL_TYPE);
-
- etc->col_idx = col_idx;
- etc->text = g_strdup (text);
- etc->width = width;
- etc->min_width = min_width;
- etc->ecell = ecell;
- etc->compare = compare;
-
- etc->selected = 0;
- etc->resizeable = resizable;
-
- return etc;
-}
-
-
diff --git a/widgets/table/e-table-col.h b/widgets/table/e-table-col.h
deleted file mode 100644
index 54f03ae237..0000000000
--- a/widgets/table/e-table-col.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _E_TABLE_COL_H_
-#define _E_TABLE_COL_H_
-
-#include "e-cell.h"
-
-#define E_TABLE_COL_TYPE (e_table_col_get_type ())
-#define E_TABLE_COL(o) (GTK_CHECK_CAST ((o), E_TABLE_COL_TYPE, ETableCol))
-#define E_TABLE_COL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_COL_TYPE, ETableColClass))
-#define E_IS_TABLE_COL(o) (GTK_CHECK_TYPE ((o), E_TABLE_COL_TYPE))
-#define E_IS_TABLE_COL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_COL_TYPE))
-
-typedef struct _ETableCol ETableCol;
-
-/*
- * Information about a single column
- */
-struct _ETableCol {
- GtkObject base;
- char *text;
- short width;
- short min_width;
- short x;
- GCompareFunc compare;
- unsigned int selected:1;
- unsigned int resizeable:1;
- int col_idx;
-
- ECell *ecell;
-};
-
-typedef struct {
- GtkObjectClass parent_class;
-} ETableColClass;
-
-GtkType e_table_col_get_type (void);
-ETableCol *e_table_col_new (int col_idx, const char *text,
- int width, int min_width,
- ECell *ecell, GCompareFunc compare,
- gboolean resizable);
-void e_table_col_destroy (ETableCol *etc);
-
-
-#endif /* _E_TABLE_COL_H_ */
-
diff --git a/widgets/table/e-table-column-item.c b/widgets/table/e-table-column-item.c
deleted file mode 100644
index 0616327a93..0000000000
--- a/widgets/table/e-table-column-item.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * E-table-column-view.c: A canvas view of the TableColumn.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * Copyright 1999, Helix Code, Inc.
- */
-#include <config.h>
-#include "e-table-column.h"
-#include "e-table-column-view.h"
-
-#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
-
-static GnomeCanvasItemClass *etci_parent_class;
-
-enum {
- ARG_0,
- ARG_TABLE_COLUMN
-};
-
-static void
-etci_destroy (GtkObject *object)
-{
- ETableColumnItem *etcv = E_TABLE_COLUMN_VIEW (object);
-
- gtk_object_unref (GTK_OBJECT (etcv));
-
- if (GTK_OBJECT_CLASS (etcv_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (etcv_parent_class)->destroy) (object);
-}
-
-static void
-etci_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- if (GNOME_CANVAS_ITEM_CLASS(item_bar_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS(item_bar_parent_class)->update)(item, affine, clip_path, flags);
-
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = INT_MAX;
- item->y2 = INT_MAX;
- gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
-}
-
-static void
-etci_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ETableColumnItem *etci;
- int v;
-
- item = GNOME_CANVAS_ITEM (o);
- etci = E_TABLE_COLUMN_ITEM (o);
-
- switch (arg_id){
- case ARG_TABLE_COLUMN:
- etci->etci = GTK_VALUE_POINTER (*arg);
- break;
- }
- etci_update (item, NULL, NULL, 0);
-}
-
-static void
-etci_realize (GnomeCanvasItem *item)
-{
- ETableColumnItem *etci = E_TABLE_COLUMN_ITEM (item);
- GdkWindow *window;
- GdkColor c;
-
- if (GNOME_CANVAS_ITEM_CLASS (etci_parent_class)-> realize)
- (*GNOME_CANVAS_ITEM_CLASS (etci_parent_class)->realize)(item);
-
- window = GTK_WIDGET (item->canvas)->window;
-
- etci->gc = gdk_gc_new (window);
- gnome_canvas_get_color (item->canvas, "black", &c);
- gdk_gc_set_foreground (etci->gc, &c);
-
- etci->normal_cursor = gdk_cursor_new (GDK_ARROW);
-}
-
-static void
-etci_unrealize (GnomeCanvasItem *item)
-{
- ETableColumnItem *etci = E_TABLE_COLUMN_ITEM (item);
-
- gdk_gc_unref (etci->gc);
- etci->gc = NULL;
-
- gdk_cursor_destroy (etci->change_cursor);
- etci->change_cursor = NULL;
-
- gdk_cursor_destroy (etci->normal_cursor);
- etci->normal_cursor = NULL;
-
- if (GNOME_CANVAS_ITEM_CLASS (etci_parent_class)->unrealize)
- (*GNOME_CANVAS_ITEM_CLASS (etci_parent_class)->unrealize)(item);
-}
-
-static void
-etci_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x1, int y1, int width, int height)
-{
- ETableColumnItem *etci = E_TABLE_COLUMN_ITEM (item);
- GnomeCanvas *canvas = item->canvas;
- GdkGC *gc;
- const int cols = e_table_column_count (etci->etc);
- int x2 = x1 + width;
- int col, total;
-
- total = 0;
- for (col = 0; col < cols; col++){
- ETableCol *col = e_table_column_get_column (etci->etc, col);
- const int col_width = col->width;
-
- if (x1 > total + col_width)
- continue;
-
- if (x2 < total)
- return;
-
- gc = canvas->style->bg_gc [GTK_STATE_ACTIVE];
- gdk_draw_rectangle (drawble, gc, TRUE,
- gtk_draw_shadow (canvas->style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- x, y, width, height
- }
-}
-
-static double
-etci_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = *item;
- return 0.0;
-}
-
-static void
-etci_event (GnomeCanvasItem *item, GdkEvent *e)
-{
- switch (e->type){
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-etci_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- object_class->destroy = etci_destroy;
- object_class->set_arg = etci_set_arg;
-
- item_class->update = etci_update;
- item_class->realize = etci_realize;
- item_class->unrealize = etci_unrealize;
- item_class->draw = etci_draw;
- item_class->point = etci_point;
- item_class->event = etci_event;
-
- gtk_object_add_arg_type ("ETableColumnItem::ETableColumn", GTK_TYPE_POINTER,
- GTK_ARG_WRITABLE, ARG_TABLE_COLUMN);
-}
-
-static void
-etci_init (GnomeCanvasItem *item)
-{
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = 0;
- item->y2 = 0;
-}
-
-GtkType
-e_table_column_view_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableColumnItem",
- sizeof (ETableColumnItem),
- sizeof (ETableColumnItemClass),
- (GtkClassInitFunc) etci_class_init,
- (GtkObjectInitFunc) etci_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_OBJECT_TYPE, &info);
- }
-
- return type;
-}
-
-
-
diff --git a/widgets/table/e-table-column-item.h b/widgets/table/e-table-column-item.h
deleted file mode 100644
index fd38681a73..0000000000
--- a/widgets/table/e-table-column-item.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _E_TABLE_COLUMN_VIEW_H
-#defein _E_TABLE_COLUMN_VIEW_H
-
-#include "e-table-column.h"
-
-typedef struct {
- GnomeCanvasItem parent;
- ETableColumn *etc;
-
- GdkGC *gc;
- GdkCursor *change_cursor, *normal_cursor;
-} ETableColumnView;
-
-typedef struct {
- GnomeCanvasItemClass parent_class;
-} ETableColumnViewClass;
-
-GtkType e_table_column_item_get_type (void);
-
-#endif /* _E_TABLE_COLUMN_VIEW_H */
diff --git a/widgets/table/e-table-column-model.h b/widgets/table/e-table-column-model.h
deleted file mode 100644
index 043dd783ca..0000000000
--- a/widgets/table/e-table-column-model.h
+++ /dev/null
@@ -1,5 +0,0 @@
-
-class ETableColumnModel {
- virtual void add_column (ETableCol *et) = 0;
- virtual ETableCol *get_column (int column);
- virtual
diff --git a/widgets/table/e-table-column.c b/widgets/table/e-table-column.c
deleted file mode 100644
index d17a285321..0000000000
--- a/widgets/table/e-table-column.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * e-table-column.c: TableColumn implementation
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include "e-table-column.h"
-
-enum {
- STRUCTURE_CHANGE,
- DIMENSION_CHANGE,
- LAST_SIGNAL
-};
-
-static guint etc_signals [LAST_SIGNAL] = { 0, };
-
-static GtkObjectClass *e_table_column_parent_class;
-
-static void
-e_table_column_destroy (GtkObject *object)
-{
- ETableColumn *etc = E_TABLE_COLUMN (object);
- const int cols = etc->col_count;
-
- /*
- * Destroy listeners
- */
- for (l = etc->listeners; l; l = l->next)
- g_free (l->data);
- g_slist_free (etc->listeners);
- etc->listeners = NULL;
-
- /*
- * Destroy columns
- */
- for (i = 0; i < cols; i++)
- e_table_column_remove (etc, i);
-
- if (e_table_column_parent_class->destroy)
- e_table_column_parent_class->destroy (object);
-}
-
-static void
-e_table_column_class_init (GtkObjectClass *object_class)
-{
- object_class->destroy = e_table_column_destroy;
-
- e_table_column_parent_class = (gtk_type_class (gtk_object_get_type ()));
-
- etc_signals [STRUCTURE_CHANGE] =
- gtk_signal_new ("structure_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableColumn, structure_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- etc_signals [DIMENSION_CHANGE] =
- gtk_signal_new ("dimension_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableColumn, dimension_change),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, etc_signals, LAST_SIGNAL);
-}
-
-GtkType
-e_table_column_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableColumn",
- sizeof (ETableColumn),
- sizeof (ETableColumnClass),
- (GtkClassInitFunc) e_table_column_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-static void
-etc_do_insert (ETableColumn *etc, int pos, ETableCol *val)
-{
- memcpy (&etc->columns [pos+1], &etc->columns [pos],
- sizeof (ETableCol *) * (etc->col_count - pos));
- etc->columns [pos] = val;
-}
-
-void
-e_table_column_add_column (ETableColumn *etc, ETableCol *tc, int pos)
-{
- ETableCol **new_ptr;
-
- g_return_if_fail (etc != NULL);
- g_return_if_fail (E_IS_TABLE_COLUMN (etc));
- g_return_if_fail (tc != NULL);
- g_return_if_fail (pos >= 0 && pos < etc->col_count);
-
- if (pos == -1)
- pos = etc->col_count;
- etc->columns = g_realloc (etc->columns, sizeof (ETableCol *) * (etc->col_count + 1));
- etc_do_insert (etc, pos, tc);
- etc->col_count++;
-
- gtk_signal_emit (GTK_OBJECT (etc), etc_signals [STRUCTURE_CHANGE]);
-}
-
-ETableCol *
-e_table_column_get_column (ETableColumn *etc, int column)
-{
- g_return_val_if_fail (etc != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), NULL);
-
- if (column < 0)
- return NULL;
-
- if (column >= etc->col_count)
- return NULL;
-
- return etc->columns [column];
-}
-
-int
-e_table_column_count (ETableColumn *etc)
-{
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
-
- return etc->col_count;
-}
-
-int
-e_table_column_index (ETableColumn *etc, const char *identifier)
-{
- int i;
-
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
- g_return_val_if_fail (identifier != NULL, 0);
-
- for (i = 0; i < etc->col_count; i++){
- ETableCol *tc = etc->columns [i];
-
- if (strcmp (i->id, identifier) == 0)
- return i;
- }
-
- return -1;
-}
-
-int
-e_table_column_get_index_at (ETableColumn *etc, int x_offset)
-{
- int i, total;
-
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
- g_return_val_if_fail (identifier != NULL, 0);
-
- total = 0;
- for (i = 0; i < etc->col_count; i++){
- total += etc->columns [i]->width;
-
- if (x_offset < total)
- return i;
- }
-
- return -1;
-}
-
-ETableCol **
-e_table_column_get_columns (ETableColumn *etc)
-{
- ETableCol **ret;
- int i;
-
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
-
- ret = g_new (ETableCol *, etc->col_count + 1);
- memcpy (ret, etc->columns, sizeof (ETableCol *) * etc->col_count);
- ret [etc->col_count] = NULL;
-
- return ret;
-}
-
-gboolean
-e_table_column_selection_ok (ETableColumn *etc)
-{
- g_return_val_if_fail (etc != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), FALSE);
-
- return etc->selectable;
-}
-
-int
-ve_table_column_get_selected (ETableColumn *etc)
-{
- int i;
- int selected = 0;
-
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
-
- for (i = 0; i < etc->col_count; i++){
- if (etc->columns [i]->selected)
- selected++;
- }
-
- return selected;
-}
-
-int
-e_table_column_total_width (ETableColumn *etc)
-{
- int total;
-
- g_return_val_if_fail (etc != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_COLUMN (etc), 0);
-
- total = 0;
- for (i = 0; i < etc->col_count; i++)
- total += etc->columns [i].width;
-
- return total;
-}
-
-static void
-etc_do_remove (ETableColumn *etc, int idx)
-{
- memcpy (&etc->columns [idx], &etc->columns [idx+1],
- sizeof (ETableCol *) * etc->col_count - idx);
- etc->col_count--;
-}
-
-void
-e_table_column_move (ETableColumn *etc, int source_index, int target_index)
-{
- g_return_if_fail (etc != NULL);
- g_return_if_fail (E_IS_TABLE_COLUMN (etc));
- g_return_if_fail (source_index >= 0);
- g_return_if_fail (target_index >= 0);
- g_return_if_fail (source_index < etc->col_count);
- g_return_if_fail (target_index < etc->col_count);
-
- old = etc->columns [source_index];
- etc_do_remove (etc, source_index);
- etc_do_insert (etc, target_index, old);
- gtk_signal_emit (GTK_OBJECT (etc), etc_signals [STRUCTURE_CHANGE]);
-}
-
-void
-e_table_column_remove (ETableColumn *etc, int idx)
-{
- g_return_if_fail (etc != NULL);
- g_return_if_fail (E_IS_TABLE_COLUMN (etc));
- g_return_if_fail (idx >= 0);
- g_return_if_fail (idx < etc->col_count);
-
- etc_do_remove (etc, idx);
- gtk_signal_emit (GTK_OBJECT (etc), etc_signals [STRUCTURE_CHANGE]);
-}
-
-void
-e_table_column_set_selection (ETableColumn *etc, gboolean allow_selection);
-{
-}
-
-void
-e_table_column_set_size (ETableColumn *etc, int idx, int size)
-{
- g_return_if_fail (etc != NULL);
- g_return_if_fail (E_IS_TABLE_COLUMN (etc));
- g_return_if_fail (idx >= 0);
- g_return_if_fail (idx < etc->col_count);
- g_return_if_fail (size > 0);
-
- etc->columns [idx]->width = size;
- gtk_signal_emit (GTK_OBJECT (etc), etc_signals [SIZE_CHANGE], idx);
-}
diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c
deleted file mode 100644
index 8783fbaa02..0000000000
--- a/widgets/table/e-table-group.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * E-Table-Group.c: Implements the grouping objects for elements on a table
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org()
- *
- * Copyright 1999, Helix Code, Inc.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-table-group.h"
-#include "e-table-item.h"
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-util/e-util.h"
-
-#define TITLE_HEIGHT 16
-#define GROUP_INDENT 10
-
-#define PARENT_TYPE gnome_canvas_group_get_type ()
-
-static GnomeCanvasGroupClass *etg_parent_class;
-
-enum {
- HEIGHT_CHANGED,
- LAST_SIGNAL
-};
-
-static gint etg_signals [LAST_SIGNAL] = { 0, };
-
-static void
-etg_destroy (GtkObject *object)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
-
- GTK_OBJECT_CLASS (etg_parent_class)->destroy (object);
-}
-
-static void
-etg_dim (ETableGroup *etg, int *width, int *height)
-{
- GSList *l;
-
- *width = *height = 0;
-
- for (l = etg->children; l; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- *height += child->y2 - child->y1;
- *width += child->x2 - child->x1;
- }
-
- if (!etg->transparent){
- *height += TITLE_HEIGHT;
- *width += GROUP_INDENT;
- }
-}
-
-void
-e_table_group_construct (GnomeCanvasGroup *parent, ETableGroup *etg,
- ETableCol *ecol, gboolean open,
- gboolean transparent)
-{
- gnome_canvas_item_constructv (GNOME_CANVAS_ITEM (etg), parent, 0, NULL);
-
- etg->ecol = ecol;
- etg->open = open;
- etg->transparent = transparent;
-
- etg_dim (etg, &etg->width, &etg->height);
-
- if (!etg->transparent)
- etg->rect = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (etg),
- gnome_canvas_rect_get_type (),
- "fill_color", "gray",
- "outline_color", "gray20",
- "x1", 0.0,
- "y1", 0.0,
- "x2", (double) etg->width,
- "y2", (double) etg->height,
- NULL);
-
-#if 0
- /*
- * Reparent the child into our space.
- */
- gnome_canvas_item_reparent (child, GNOME_CANVAS_GROUP (etg));
-
- gnome_canvas_item_set (
- child,
- "x", (double) GROUP_INDENT,
- "y", (double) TITLE_HEIGHT,
- NULL);
-
- /*
- * Force dimension computation
- */
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->update (
- GNOME_CANVAS_ITEM (etg), NULL, NULL, GNOME_CANVAS_UPDATE_REQUESTED);
-#endif
-}
-
-GnomeCanvasItem *
-e_table_group_new (GnomeCanvasGroup *parent, ETableCol *ecol,
- gboolean open, gboolean transparent)
-{
- ETableGroup *etg;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (ecol != NULL, NULL);
-
- etg = gtk_type_new (e_table_group_get_type ());
-
- e_table_group_construct (parent, etg, ecol, open, transparent);
-
- return GNOME_CANVAS_ITEM (etg);
-}
-
-static void
-etg_relayout (GnomeCanvasItem *eti, ETableGroup *etg)
-{
- GSList *l;
- int height = etg->transparent ? 0 : GROUP_INDENT;
- gboolean move = FALSE;
-
- printf ("Relaying out\n");
-
- for (l = etg->children; l->next; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- height += child->y2 - child->y1;
-
- if (child == eti)
- move = TRUE;
-
- if (move){
- printf ("Moving item %p\n", child);
- gnome_canvas_item_set (
- child,
- "y", (double) height,
- NULL);
- }
- }
- if (height != etg->height){
- etg->height = height;
- gtk_signal_emit (GTK_OBJECT (etg), etg_signals [HEIGHT_CHANGED]);
- }
-}
-
-void
-e_table_group_add (ETableGroup *etg, GnomeCanvasItem *item)
-{
- double x1, y1, x2, y2;
-
- g_return_if_fail (etg != NULL);
- g_return_if_fail (item != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- etg->children = g_slist_append (etg->children, item);
-
- GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (etg)->klass)->bounds (etg, &x1, &y1, &x2, &y2);
-
- if (GTK_OBJECT (etg)->flags & GNOME_CANVAS_ITEM_REALIZED){
- GSList *l;
- int height = etg->transparent ? 0 : TITLE_HEIGHT;
- int x = etg->transparent ? 0 : GROUP_INDENT;
-
- for (l = etg->children; l->next; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- height += child->y2 - child->y1;
- }
-
- printf ("Positioning item %p at %d\n", item, height);
- gnome_canvas_item_set (
- item,
- "y", (double) height,
- "x", (double) x,
- NULL);
-
-
- if (E_IS_TABLE_ITEM (item)){
-
- printf ("Table item! ---------\n");
- gtk_signal_connect (GTK_OBJECT (item), "height_changed",
- GTK_SIGNAL_FUNC (etg_relayout), etg);
- }
- }
-}
-
-static void
-etg_realize (GnomeCanvasItem *item)
-{
- ETableGroup *etg = E_TABLE_GROUP (item);
- GSList *l;
- int height = 0;
-
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->realize (item);
-
- for (l = etg->children; l; l = l->next){
- GnomeCanvasItem *child = l->data;
-
- printf ("During realization for child %p -> %d\n", child, height);
- gnome_canvas_item_set (
- child,
- "y", (double) height,
- NULL);
-
- height += child->y2 - child->y1;
- }
-}
-
-static void
-etg_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableGroup *etg = E_TABLE_GROUP (item);
-
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->update (item, affine, clip_path, flags);
-
- if (!etg->transparent){
- int current_width, current_height;
-
- etg_dim (etg, &current_width, &current_height);
-
- if ((current_height != etg->height) || (current_width != etg->width)){
- etg->width = current_width;
- etg->height = current_height;
-
- gnome_canvas_item_set (
- etg->rect,
- "x1", 0.0,
- "y1", 0.0,
- "x2", (double) etg->width,
- "y2", (double) etg->height,
- NULL);
- }
- }
-}
-
-static void
-etg_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- object_class->destroy = etg_destroy;
-
- item_class->realize = etg_realize;
- item_class->update = etg_update;
-
- etg_parent_class = gtk_type_class (PARENT_TYPE);
-
- etg_signals [HEIGHT_CHANGED] =
- gtk_signal_new ("height_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableGroupClass, height_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, etg_signals, LAST_SIGNAL);
-
-}
-
-E_MAKE_TYPE (e_table_group, "ETableGroup", ETableGroup, etg_class_init, NULL, PARENT_TYPE);
-
-
-
diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h
deleted file mode 100644
index 468d5dd794..0000000000
--- a/widgets/table/e-table-group.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef _E_TABLE_TREE_H_
-#define _E_TABLE_TREE_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include "e-table-model.h"
-#include "e-table-header.h"
-
-#define E_TABLE_GROUP_TYPE (e_table_group_get_type ())
-#define E_TABLE_GROUP(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_TYPE, ETableGroup))
-#define E_TABLE_GROUP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_GROUP_TYPE, ETableGroupClass))
-#define E_IS_TABLE_GROUP(o) (GTK_CHECK_TYPE ((o), E_TABLE_GROUP_TYPE))
-#define E_IS_TABLE_GROUP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_TYPE))
-
-typedef struct {
- GnomeCanvasGroup group;
-
- /*
- * The ETableCol used to group this set
- */
- ETableCol *ecol;
-
- /*
- * The canvas rectangle that contains the children
- */
- GnomeCanvasItem *rect;
-
- /*
- * Dimensions of the ETableGroup
- */
- int width, height;
-
- /*
- * State: the ETableGroup is open or closed
- */
- guint open:1;
-
- /*
- * Whether we should add indentation and open/close markers,
- * or if we just act as containers of subtables.
- */
- guint transparent:1;
-
- /*
- * List of GnomeCanvasItems we stack
- */
- GSList *children;
-} ETableGroup;
-
-typedef struct {
- GnomeCanvasGroupClass parent_class;
- void (*height_changed) (ETableGroup *etg);
-} ETableGroupClass;
-
-GnomeCanvasItem *e_table_group_new (GnomeCanvasGroup *parent, ETableCol *ecol,
- gboolean open, gboolean transparent);
-void e_table_group_construct (GnomeCanvasGroup *parent, ETableGroup *etg,
- ETableCol *ecol, gboolean open, gboolean transparent);
-
-void e_table_group_add (ETableGroup *etg, GnomeCanvasItem *child);
-
-GtkType e_table_group_get_type (void);
-
-#endif /* _E_TABLE_TREE_H_ */
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
deleted file mode 100644
index 5f23f06fa3..0000000000
--- a/widgets/table/e-table-header-item.c
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * E-table-column-view.c: A canvas item based view of the ETableColumn.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * Copyright 1999, Helix Code, Inc.
- */
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkdnd.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <libgnomeui/gnome-canvas-util.h>
-#include <libgnomeui/gnome-canvas-polygon.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-util/e-cursors.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-col-dnd.h"
-
-#include "add-col.xpm"
-#include "remove-col.xpm"
-
-/* Padding above and below of the string in the header display */
-#define PADDING 4
-
-/* Defines the tolerance for proximity of the column division to the cursor position */
-#define TOLERANCE 2
-
-#define ETHI_RESIZING(x) ((x)->resize_col != -1)
-
-#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
-
-#define ELEMENTS(x) (sizeof (x) / sizeof (x[0]))
-
-static GnomeCanvasItemClass *ethi_parent_class;
-
-/*
- * DnD icons
- */
-static GdkColormap *dnd_colormap;
-static GdkPixmap *remove_col_pixmap, *remove_col_mask;
-static GdkPixmap *add_col_pixmap, *add_col_mask;
-
-enum {
- ARG_0,
- ARG_TABLE_HEADER,
- ARG_TABLE_X,
- ARG_TABLE_Y,
- ARG_TABLE_FONTSET
-};
-
-static GtkTargetEntry ethi_drag_types [] = {
- { TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
-};
-
-static GtkTargetEntry ethi_drop_types [] = {
- { TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
-};
-
-static void
-ethi_destroy (GtkObject *object)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (object);
-
- gtk_object_unref (GTK_OBJECT (ethi->eth));
-
- if (GTK_OBJECT_CLASS (ethi_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (ethi_parent_class)->destroy) (object);
-}
-
-static void
-ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
-
- if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)(item, affine, clip_path, flags);
-
- item->x1 = ethi->x1;
- item->y1 = ethi->y1;
- item->x2 = ethi->x1 + ethi->width;
- item->y2 = ethi->y1 + ethi->height;
-
- gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
-}
-
-static void
-ethi_font_load (ETableHeaderItem *ethi, char *font)
-{
- if (ethi->font)
- gdk_font_unref (ethi->font);
-
- ethi->font = gdk_fontset_load (font);
- if (ethi->font == NULL)
- ethi->font = gdk_font_load ("fixed");
-
- ethi->height = ethi->font->ascent + ethi->font->descent + PADDING;
-}
-
-static void
-ethi_drop_table_header (ETableHeaderItem *ethi)
-{
- GtkObject *header;
-
- if (!ethi->eth)
- return;
-
- header = GTK_OBJECT (ethi->eth);
- gtk_signal_disconnect (header, ethi->structure_change_id);
- gtk_signal_disconnect (header, ethi->dimension_change_id);
-
- gtk_object_unref (header);
- ethi->eth = NULL;
- ethi->width = 0;
-}
-
-static void
-structure_changed (ETableHeader *header, ETableHeaderItem *ethi)
-{
- ethi->width = e_table_header_total_width (header);
-
- ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
-}
-
-static void
-dimension_changed (ETableHeader *header, int col, ETableHeaderItem *ethi)
-{
- ethi->width = e_table_header_total_width (header);
-
- ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0);
-}
-
-static void
-ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header)
-{
- ethi->eth = header;
- gtk_object_ref (GTK_OBJECT (ethi->eth));
- ethi->width = e_table_header_total_width (header);
-
- ethi->structure_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "structure_change",
- GTK_SIGNAL_FUNC(structure_changed), ethi);
- ethi->dimension_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "dimension_change",
- GTK_SIGNAL_FUNC(dimension_changed), ethi);
-}
-
-static void
-ethi_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ETableHeaderItem *ethi;
-
- item = GNOME_CANVAS_ITEM (o);
- ethi = E_TABLE_HEADER_ITEM (o);
-
- switch (arg_id){
- case ARG_TABLE_HEADER:
- ethi_drop_table_header (ethi);
- ethi_add_table_header (ethi, GTK_VALUE_POINTER (*arg));
- break;
-
- case ARG_TABLE_X:
- ethi->x1 = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_TABLE_Y:
- ethi->y1 = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_TABLE_FONTSET:
- ethi_font_load (ethi, GTK_VALUE_STRING (*arg));
- break;
-
- }
- ethi_update (item, NULL, NULL, 0);
-}
-
-static int
-ethi_find_col_by_x (ETableHeaderItem *ethi, int x)
-{
- const int cols = e_table_header_count (ethi->eth);
- int x1 = ethi->x1;
- int col;
-
- if (x < x1)
- return -1;
-
- for (col = 0; col < cols; col++){
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
-
- if ((x >= x1) && (x <= x1 + ecol->width))
- return col;
-
- x1 += ecol->width;
- }
- return -1;
-}
-
-static void
-ethi_remove_drop_marker (ETableHeaderItem *ethi)
-{
- if (ethi->drag_mark == -1)
- return;
-
- ethi->drag_mark = -1;
- gtk_object_destroy (GTK_OBJECT (ethi->drag_mark_item));
- ethi->drag_mark_item = NULL;
-}
-
-static void
-ethi_add_drop_marker (ETableHeaderItem *ethi, int col)
-{
- GnomeCanvasPoints *points;
- int x;
-
- if (ethi->drag_mark == col)
- return;
-
- if (ethi->drag_mark_item)
- gtk_object_destroy (GTK_OBJECT (ethi->drag_mark_item));
-
- ethi->drag_mark = col;
-
- ethi->drag_mark_item = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (GNOME_CANVAS_ITEM (ethi)->canvas->root),
- gnome_canvas_group_get_type (),
- "x", 0,
- "y", 0,
- NULL);
-
- points = gnome_canvas_points_new (3);
-
- x = e_table_header_col_diff (ethi->eth, 0, col);
-
- points->coords [0] = ethi->x1 + x - 5;
- points->coords [1] = ethi->y1;
- points->coords [2] = points->coords [0] + 10;
- points->coords [3] = points->coords [1];
- points->coords [4] = ethi->x1 + x;
- points->coords [5] = ethi->y1 + 5;
-
- gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (ethi->drag_mark_item),
- gnome_canvas_polygon_get_type (),
- "points", points,
- "fill_color", "red",
- NULL);
-
- points->coords [0] --;
- points->coords [1] += ethi->height - 1;
- points->coords [3] = points->coords [1];
- points->coords [5] = points->coords [1] - 6;
-
- gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (ethi->drag_mark_item),
- gnome_canvas_polygon_get_type (),
- "points", points,
- "fill_color", "red",
- NULL);
-
- gnome_canvas_points_unref (points);
-}
-
-#define gray50_width 2
-#define gray50_height 2
-static char gray50_bits [] = {
- 0x02, 0x01, };
-
-static void
-ethi_add_destroy_marker (ETableHeaderItem *ethi)
-{
- double x1;
-
- if (ethi->remove_item)
- gtk_object_destroy (GTK_OBJECT (ethi->remove_item));
-
- if (!ethi->stipple)
- ethi->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height);
-
- x1 = ethi->x1 + (double) e_table_header_col_diff (ethi->eth, 0, ethi->drag_col);
- ethi->remove_item = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (GNOME_CANVAS_ITEM (ethi)->canvas->root),
- gnome_canvas_rect_get_type (),
- "x1", x1 + 1,
- "y1", (double) ethi->y1 + 1,
- "x2", (double) x1 + e_table_header_col_diff (ethi->eth, ethi->drag_col, ethi->drag_col+1) - 2,
- "y2", (double) ethi->y1 + ethi->height - 2,
- "fill_color", "red",
- "fill_stipple", ethi->stipple,
- NULL);
-}
-
-static void
-ethi_remove_destroy_marker (ETableHeaderItem *ethi)
-{
- if (!ethi->remove_item)
- return;
-
- gtk_object_destroy (GTK_OBJECT (ethi->remove_item));
- ethi->remove_item = NULL;
-}
-
-static gboolean
-ethi_drag_motion (GtkObject *canvas, GdkDragContext *context,
- gint x, gint y, guint time,
- ETableHeaderItem *ethi)
-{
-
- if ((x >= ethi->x1) && (x <= (ethi->x1 + ethi->width)) &&
- (y >= ethi->y1) && (y <= (ethi->y1 + ethi->height))){
- int col;
-
- col = ethi_find_col_by_x (ethi, x);
-
- if (col != -1){
- ethi_remove_destroy_marker (ethi);
- ethi_add_drop_marker (ethi, col);
- } else {
- ethi_remove_drop_marker (ethi);
- ethi_add_destroy_marker (ethi);
- }
- } else {
- ethi_remove_drop_marker (ethi);
- ethi_add_destroy_marker (ethi);
- }
-
- gdk_drag_status (context, context->suggested_action, time);
-
- return TRUE;
-}
-
-static void
-ethi_drag_end (GtkWidget *canvas, GdkDragContext *context, ETableHeaderItem *ethi)
-{
- ethi_remove_drop_marker (ethi);
- ethi_remove_destroy_marker (ethi);
- ethi->drag_col = -1;
-}
-
-static void
-ethi_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, ETableHeaderItem *ethi)
-{
- ethi_remove_drop_marker (ethi);
- ethi_add_destroy_marker (ethi);
-}
-
-static void
-ethi_realize (GnomeCanvasItem *item)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
- GdkWindow *window;
- GdkColor c;
-
- if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)-> realize)
- (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->realize)(item);
-
- window = GTK_WIDGET (item->canvas)->window;
-
- ethi->gc = gdk_gc_new (window);
- gnome_canvas_get_color (item->canvas, "black", &c);
- gdk_gc_set_foreground (ethi->gc, &c);
-
- ethi->normal_cursor = gdk_cursor_new (GDK_ARROW);
-
- if (!ethi->font)
- ethi_font_load (ethi, "fixed");
-
- /*
- * Now, configure DnD
- */
- gtk_drag_dest_set (GTK_WIDGET (item->canvas), GTK_DEST_DEFAULT_ALL,
- ethi_drop_types, ELEMENTS (ethi_drop_types),
- GDK_ACTION_MOVE);
-
- ethi->drag_motion_id = gtk_signal_connect (
- GTK_OBJECT (item->canvas), "drag_motion",
- GTK_SIGNAL_FUNC (ethi_drag_motion), ethi);
-
- ethi->drag_leave_id = gtk_signal_connect (
- GTK_OBJECT (item->canvas), "drag_leave",
- GTK_SIGNAL_FUNC (ethi_drag_leave), ethi);
-
- ethi->drag_end_id = gtk_signal_connect (
- GTK_OBJECT (item->canvas), "drag_end",
- GTK_SIGNAL_FUNC (ethi_drag_end), ethi);
-}
-
-static void
-ethi_unrealize (GnomeCanvasItem *item)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
-
- gdk_gc_unref (ethi->gc);
- ethi->gc = NULL;
-
- gdk_cursor_destroy (ethi->normal_cursor);
- ethi->normal_cursor = NULL;
-
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_motion_id);
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_end_id);
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_leave_id);
-
- if (ethi->stipple){
- gdk_bitmap_unref (ethi->stipple);
- ethi->stipple = NULL;
- }
-
- if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->unrealize)
- (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->unrealize)(item);
-}
-
-static void
-draw_button (ETableHeaderItem *ethi, ETableCol *col,
- GdkDrawable *drawable, GdkGC *gc, GtkStyle *style,
- int x, int y, int width, int height)
-{
- GdkRectangle clip;
- int xtra;
-
- gdk_draw_rectangle (
- drawable, gc, TRUE,
- x + 1, y + 1, width - 2, height -2);
-
- gtk_draw_shadow (
- style, drawable,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- x , y, width, height);
-
- clip.x = x + 2;
- clip.y = y + 2;
- clip.width = width - 4;
- clip.height = ethi->height;
-
- gdk_gc_set_clip_rectangle (ethi->gc, &clip);
-
- /* Center the thing */
- xtra = (clip.width - gdk_string_measure (ethi->font, col->text))/2;
-
- if (xtra < 0)
- xtra = 0;
-
- /* Skip over border */
- x += xtra + 2;
-
- gdk_draw_text (
- drawable, ethi->font,
- ethi->gc, x, y + ethi->height - PADDING,
- col->text, strlen (col->text));
-}
-
-static void
-ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
- GnomeCanvas *canvas = item->canvas;
- GdkGC *gc;
- const int cols = e_table_header_count (ethi->eth);
- int x1, x2;
- int col;
-
-#if 0
- printf ("My coords are: %g %g %g %g\n",
- item->x1, item->y1, item->x2, item->y2);
-#endif
- x1 = x2 = ethi->x1;
- for (col = 0; col < cols; col++, x1 = x2){
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
- int col_width;
-
- if (col == ethi->resize_col)
- col_width = ethi->resize_width;
- else
- col_width = ecol->width;
-
- x2 += col_width;
-
- if (x1 > (x + width))
- break;
-
- if (x2 < x)
- continue;
-
- gc = GTK_WIDGET (canvas)->style->bg_gc [GTK_STATE_ACTIVE];
-
- draw_button (ethi, ecol, drawable, gc,
- GTK_WIDGET (canvas)->style,
- x1 - x, ethi->y1 - y, col_width, ethi->height);
- }
-}
-
-static double
-ethi_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = item;
- return 0.0;
-}
-
-/*
- * is_pointer_on_division:
- *
- * Returns whether @pos is a column header division; If @the_total is not NULL,
- * then the actual position is returned here. If @return_ecol is not NULL,
- * then the ETableCol that actually contains this point is returned here
- */
-static gboolean
-is_pointer_on_division (ETableHeaderItem *ethi, int pos, int *the_total, int *return_col)
-{
- const int cols = e_table_header_count (ethi->eth);
- int col, total;
-
- total = 0;
- for (col = 0; col < cols; col++){
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
-
- total += ecol->width;
-
- if ((total - TOLERANCE < pos ) && (pos < total + TOLERANCE)){
- if (return_col)
- *return_col = col;
- if (the_total)
- *the_total = total;
-
- return TRUE;
- }
-
- if (total > pos + TOLERANCE)
- return FALSE;
- }
-
- return FALSE;
-}
-
-#define convert(c,sx,sy,x,y) gnome_canvas_w2c (c,sx,sy,x,y)
-
-static void
-set_cursor (ETableHeaderItem *ethi, int pos)
-{
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
-
- /* We might be invoked before we are realized */
- if (!canvas->window)
- return;
-
- if (is_pointer_on_division (ethi, pos, NULL, NULL))
- e_cursor_set (canvas->window, E_CURSOR_SIZE_X);
- else
- e_cursor_set (canvas->window, E_CURSOR_ARROW);
-}
-
-static void
-ethi_request_redraw (ETableHeaderItem *ethi)
-{
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (ethi)->canvas;
-
- /*
- * request a redraw
- */
- gnome_canvas_request_redraw (
- canvas, ethi->x1, ethi->y1, ethi->x1 + ethi->width, ethi->x1 + ethi->height);
-}
-
-static void
-ethi_end_resize (ETableHeaderItem *ethi, int new_size)
-{
- e_table_header_set_size (ethi->eth, ethi->resize_col, new_size);
-
- ethi->resize_col = -1;
- ethi_request_redraw (ethi);
-}
-
-static gboolean
-ethi_maybe_start_drag (ETableHeaderItem *ethi, GdkEventMotion *event)
-{
- if (!ethi->maybe_drag)
- return FALSE;
-
- if (MAX (abs (ethi->click_x - event->x),
- abs (ethi->click_y - event->y)) <= 3)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
-{
- GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
- GtkTargetList *list;
- GdkDragContext *context;
-
- ethi->drag_col = ethi_find_col_by_x (ethi, event->motion.x);
- if (ethi->drag_col == -1)
- return;
-
- list = gtk_target_list_new (ethi_drag_types, ELEMENTS (ethi_drag_types));
- context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event);
- ethi->maybe_drag = FALSE;
-}
-
-/*
- * Handles the events on the ETableHeaderItem, particularly it handles resizing
- */
-static int
-ethi_event (GnomeCanvasItem *item, GdkEvent *e)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
- GnomeCanvas *canvas = item->canvas;
- const gboolean resizing = ETHI_RESIZING (ethi);
- int x, y, start, col;
-
- switch (e->type){
- case GDK_ENTER_NOTIFY:
- convert (canvas, e->crossing.x, e->crossing.y, &x, &y);
- set_cursor (ethi, x);
- break;
-
- case GDK_LEAVE_NOTIFY:
- e_cursor_set (GTK_WIDGET (canvas)->window, E_CURSOR_ARROW);
- break;
-
- case GDK_MOTION_NOTIFY:
- convert (canvas, e->motion.x, e->motion.y, &x, &y);
- if (resizing){
- int new_width;
-
- if (ethi->resize_guide == NULL){
- /* Quick hack until I actually bind the views */
- ethi->resize_guide = GINT_TO_POINTER (1);
- gnome_canvas_item_grab (item,
- GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_RELEASE_MASK,
- e_cursor_get (E_CURSOR_SIZE_X),
- e->button.time);
- }
-
- new_width = x - ethi->resize_start_pos;
- if (new_width <= 0)
- break;
-
- if (new_width < ethi->resize_min_width)
- break;
-
- ethi_request_redraw (ethi);
-
- ethi->resize_width = new_width;
- e_table_header_set_size (ethi->eth, ethi->resize_col, ethi->resize_width);
-
- ethi_request_redraw (ethi);
- } else if (ethi_maybe_start_drag (ethi, &e->motion)){
- ethi_start_drag (ethi, e);
- } else
- set_cursor (ethi, x);
- break;
-
- case GDK_BUTTON_PRESS:
- convert (canvas, e->button.x, e->button.y, &x, &y);
-
- if (is_pointer_on_division (ethi, x, &start, &col)){
- ETableCol *ecol;
-
- /*
- * Record the important bits.
- *
- * By setting resize_pos to a non -1 value,
- * we know that we are being resized (used in the
- * other event handlers).
- */
- ecol = e_table_header_get_column (ethi->eth, col);
-
- if (!ecol->resizeable)
- break;
- ethi->resize_col = col;
- ethi->resize_width = ecol->width;
- ethi->resize_start_pos = start - ecol->width;
- ethi->resize_min_width = ecol->min_width;
- } else {
- if (e->button.button == 1){
- ethi->click_x = e->button.x;
- ethi->click_y = e->button.y;
- ethi->maybe_drag = TRUE;
- }
- }
- break;
-
- case GDK_2BUTTON_PRESS:
- if (!resizing)
- break;
-
- if (e->button.button != 1)
- break;
- break;
-
- case GDK_BUTTON_RELEASE: {
- gboolean needs_ungrab = FALSE;
-
- if (ethi->resize_col != -1){
- needs_ungrab = (ethi->resize_guide != NULL);
- ethi_end_resize (ethi, ethi->resize_width);
- }
- if (needs_ungrab)
- gnome_canvas_item_ungrab (item, e->button.time);
-
- ethi->maybe_drag = FALSE;
- break;
- }
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-ethi_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- ethi_parent_class = gtk_type_class (PARENT_OBJECT_TYPE);
-
- object_class->destroy = ethi_destroy;
- object_class->set_arg = ethi_set_arg;
-
- item_class->update = ethi_update;
- item_class->realize = ethi_realize;
- item_class->unrealize = ethi_unrealize;
- item_class->draw = ethi_draw;
- item_class->point = ethi_point;
- item_class->event = ethi_event;
-
- gtk_object_add_arg_type ("ETableHeaderItem::ETableHeader", GTK_TYPE_POINTER,
- GTK_ARG_WRITABLE, ARG_TABLE_HEADER);
- gtk_object_add_arg_type ("ETableHeaderItem::x", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_TABLE_X);
- gtk_object_add_arg_type ("ETableHeaderItem::y", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_TABLE_Y);
- gtk_object_add_arg_type ("ETableHeaderItem::fontset", GTK_TYPE_STRING,
- GTK_ARG_WRITABLE, ARG_TABLE_FONTSET);
-
- /*
- * Create our pixmaps for DnD
- */
- dnd_colormap = gtk_widget_get_default_colormap ();
- remove_col_pixmap = gdk_pixmap_colormap_create_from_xpm_d (
- NULL, dnd_colormap,
- &remove_col_mask, NULL, remove_col_xpm);
-
- add_col_pixmap = gdk_pixmap_colormap_create_from_xpm_d (
- NULL, dnd_colormap,
- &add_col_mask, NULL, add_col_xpm);
-}
-
-static void
-ethi_init (GnomeCanvasItem *item)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
-
- ethi->resize_col = -1;
-
- item->x1 = 0;
- item->y1 = 0;
- item->x2 = 0;
- item->y2 = 0;
-
- ethi->drag_col = -1;
- ethi->drag_mark = -1;
-}
-
-GtkType
-e_table_header_item_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableHeaderItem",
- sizeof (ETableHeaderItem),
- sizeof (ETableHeaderItemClass),
- (GtkClassInitFunc) ethi_class_init,
- (GtkObjectInitFunc) ethi_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_OBJECT_TYPE, &info);
- }
-
- return type;
-}
-
diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h
deleted file mode 100644
index 5522d24fae..0000000000
--- a/widgets/table/e-table-header-item.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef _E_TABLE_HEADER_ITEM_H_
-#define _E_TABLE_HEADER_ITEM_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include "e-table-header.h"
-
-#define E_TABLE_HEADER_ITEM_TYPE (e_table_header_item_get_type ())
-#define E_TABLE_HEADER_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItem))
-#define E_TABLE_HEADER_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItemClass))
-#define E_IS_TABLE_HEADER_ITEM(o) (GTK_CHECK_TYPE ((o), E_TABLE_HEADER_ITEM_TYPE))
-#define E_IS_TABLE_HEADER_ITEM_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_ITEM_TYPE))
-
-typedef struct {
- GnomeCanvasItem parent;
- ETableHeader *eth;
-
- GdkGC *gc;
- GdkCursor *change_cursor, *normal_cursor;
-
- short x1, y1, height, width;
- GdkFont *font;
-
- /*
- * Used during resizing; Could be shorts
- */
- int resize_col;
- int resize_width;
- int resize_start_pos;
- int resize_min_width;
-
- GtkObject *resize_guide;
-
- /*
- * Ids
- */
- int structure_change_id, dimension_change_id;
-
- /*
- * For dragging columns
- */
- guint maybe_drag:1;
- guint dnd_ready:1;
- int click_x, click_y;
- int drag_col, drag_mark;
- guint drag_motion_id, drag_end_id, drag_leave_id;
- GnomeCanvasItem *drag_mark_item, *remove_item;
- GdkBitmap *stipple;
-} ETableHeaderItem;
-
-typedef struct {
- GnomeCanvasItemClass parent_class;
-} ETableHeaderItemClass;
-
-GtkType e_table_header_item_get_type (void);
-
-#endif /* _E_TABLE_HEADER_ITEM_H_ */
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c
deleted file mode 100644
index 7c54bd936e..0000000000
--- a/widgets/table/e-table-header.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * E-table-col-head.c: TableColHead implementation
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc
- */
-#include <config.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
-#include "e-table-header.h"
-
-enum {
- STRUCTURE_CHANGE,
- DIMENSION_CHANGE,
- LAST_SIGNAL
-};
-
-static guint eth_signals [LAST_SIGNAL] = { 0, };
-
-static GtkObjectClass *e_table_header_parent_class;
-
-static void
-e_table_header_destroy (GtkObject *object)
-{
- ETableHeader *eth = E_TABLE_HEADER (object);
- const int cols = eth->col_count;
- int i;
-
- /*
- * Destroy columns
- */
- for (i = 0; i < cols; i++){
- e_table_header_remove (eth, i);
- }
-
- if (e_table_header_parent_class->destroy)
- e_table_header_parent_class->destroy (object);
-}
-
-static void
-e_table_header_class_init (GtkObjectClass *object_class)
-{
- object_class->destroy = e_table_header_destroy;
-
- e_table_header_parent_class = (gtk_type_class (gtk_object_get_type ()));
-
- eth_signals [STRUCTURE_CHANGE] =
- gtk_signal_new ("structure_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableHeaderClass, structure_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- eth_signals [DIMENSION_CHANGE] =
- gtk_signal_new ("dimension_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableHeaderClass, dimension_change),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, eth_signals, LAST_SIGNAL);
-}
-
-GtkType
-e_table_header_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableHeader",
- sizeof (ETableHeader),
- sizeof (ETableHeaderClass),
- (GtkClassInitFunc) e_table_header_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-ETableHeader *
-e_table_header_new (void)
-{
- ETableHeader *eth;
-
- eth = gtk_type_new (e_table_header_get_type ());
-
- return eth;
-}
-
-static void
-eth_do_insert (ETableHeader *eth, int pos, ETableCol *val)
-{
- memcpy (&eth->columns [pos+1], &eth->columns [pos],
- sizeof (ETableCol *) * (eth->col_count - pos));
- eth->columns [pos] = val;
-}
-
-static void
-eth_update_offsets (ETableHeader *eth)
-{
- int i;
- int x = 0;
-
- for (i = 0; i < eth->col_count; i++){
- ETableCol *etc = eth->columns [i];
-
- etc->x = x;
- x += etc->width;
- }
-}
-
-void
-e_table_header_add_column (ETableHeader *eth, ETableCol *tc, int pos)
-{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
- g_return_if_fail (tc != NULL);
- g_return_if_fail (E_IS_TABLE_COL (tc));
- g_return_if_fail (pos >= -1 && pos <= eth->col_count);
-
- if (pos == -1)
- pos = eth->col_count;
- eth->columns = g_realloc (eth->columns, sizeof (ETableCol *) * (eth->col_count + 1));
-
- /*
- * We are the primary owners of the column
- */
- gtk_object_ref (GTK_OBJECT (tc));
- gtk_object_sink (GTK_OBJECT (tc));
-
- eth_do_insert (eth, pos, tc);
- eth->col_count++;
- eth_update_offsets (eth);
-
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
-}
-
-ETableCol *
-e_table_header_get_column (ETableHeader *eth, int column)
-{
- g_return_val_if_fail (eth != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), NULL);
-
- if (column < 0)
- return NULL;
-
- if (column >= eth->col_count)
- return NULL;
-
- return eth->columns [column];
-}
-
-int
-e_table_header_count (ETableHeader *eth)
-{
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- return eth->col_count;
-}
-
-int
-e_table_header_index (ETableHeader *eth, int col)
-{
- g_return_val_if_fail (eth != NULL, -1);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), -1);
- g_return_val_if_fail (col < eth->col_count, -1);
-
- return eth->columns [col]->col_idx;
-}
-
-int
-e_table_header_get_index_at (ETableHeader *eth, int x_offset)
-{
- int i, total;
-
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- total = 0;
- for (i = 0; i < eth->col_count; i++){
- total += eth->columns [i]->width;
-
- if (x_offset < total)
- return i;
- }
-
- return -1;
-}
-
-ETableCol **
-e_table_header_get_columns (ETableHeader *eth)
-{
- ETableCol **ret;
-
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- ret = g_new (ETableCol *, eth->col_count + 1);
- memcpy (ret, eth->columns, sizeof (ETableCol *) * eth->col_count);
- ret [eth->col_count] = NULL;
-
- return ret;
-}
-
-gboolean
-e_table_header_selection_ok (ETableHeader *eth)
-{
- g_return_val_if_fail (eth != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), FALSE);
-
- return eth->selectable;
-}
-
-int
-e_table_header_get_selected (ETableHeader *eth)
-{
- int i;
- int selected = 0;
-
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- for (i = 0; i < eth->col_count; i++){
- if (eth->columns [i]->selected)
- selected++;
- }
-
- return selected;
-}
-
-int
-e_table_header_total_width (ETableHeader *eth)
-{
- int total, i;
-
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- total = 0;
- for (i = 0; i < eth->col_count; i++)
- total += eth->columns [i]->width;
-
- return total;
-}
-
-static void
-eth_do_remove (ETableHeader *eth, int idx, gboolean do_unref)
-{
- if (do_unref)
- gtk_object_unref (GTK_OBJECT (eth->columns [idx]));
-
- memcpy (&eth->columns [idx], &eth->columns [idx+1],
- sizeof (ETableCol *) * eth->col_count - idx);
- eth->col_count--;
-}
-
-void
-e_table_header_move (ETableHeader *eth, int source_index, int target_index)
-{
- ETableCol *old;
-
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
- g_return_if_fail (source_index >= 0);
- g_return_if_fail (target_index >= 0);
- g_return_if_fail (source_index < eth->col_count);
- g_return_if_fail (target_index < eth->col_count);
-
- old = eth->columns [source_index];
- eth_do_remove (eth, source_index, FALSE);
- eth_do_insert (eth, target_index, old);
- eth_update_offsets (eth);
-
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
-}
-
-void
-e_table_header_remove (ETableHeader *eth, int idx)
-{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
- g_return_if_fail (idx >= 0);
- g_return_if_fail (idx < eth->col_count);
-
- eth_do_remove (eth, idx, TRUE);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE]);
-}
-
-void
-e_table_header_set_selection (ETableHeader *eth, gboolean allow_selection)
-{
-}
-
-void
-e_table_header_set_size (ETableHeader *eth, int idx, int size)
-{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
- g_return_if_fail (idx >= 0);
- g_return_if_fail (idx < eth->col_count);
- g_return_if_fail (size > 0);
-
- eth->columns [idx]->width = size;
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE], idx);
-}
-
-int
-e_table_header_col_diff (ETableHeader *eth, int start_col, int end_col)
-{
- int total, col;
-
- g_return_val_if_fail (eth != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), 0);
-
- {
- const int max_col = eth->col_count;
-
- total = 0;
- for (col = start_col; col < end_col; col++){
-
- if (col == max_col)
- break;
- total += eth->columns [col]->width;
- }
- }
-
- return total;
-}
diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h
deleted file mode 100644
index 96e65fdc2f..0000000000
--- a/widgets/table/e-table-header.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef _E_TABLE_COLUMN_H_
-#define _E_TABLE_COLUMN_H_
-
-#include <gtk/gtkobject.h>
-#include <gdk/gdk.h>
-#include "e-table-col.h"
-
-typedef struct _ETableHeader ETableHeader;
-
-#define E_TABLE_HEADER_TYPE (e_table_header_get_type ())
-#define E_TABLE_HEADER(o) (GTK_CHECK_CAST ((o), E_TABLE_HEADER_TYPE, ETableHeader))
-#define E_TABLE_HEADER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_HEADER_TYPE, ETableHeaderClass))
-#define E_IS_TABLE_HEADER(o) (GTK_CHECK_TYPE ((o), E_TABLE_HEADER_TYPE))
-#define E_IS_TABLE_HEADER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_TYPE))
-
-/*
- * A Columnar header.
- */
-struct _ETableHeader {
- GtkObject base;
-
- int col_count;
- ETableCol **columns;
- gboolean selectable;
-};
-
-typedef struct {
- GtkObjectClass parent_class;
-
- void (*structure_change) (ETableHeader *eth);
- void (*dimension_change) (ETableHeader *eth, int col);
-} ETableHeaderClass;
-
-GtkType e_table_header_get_type (void);
-ETableHeader *e_table_header_new (void);
-
-void e_table_header_add_column (ETableHeader *eth,
- ETableCol *tc, int pos);
-ETableCol * e_table_header_get_column (ETableHeader *eth,
- int column);
-int e_table_header_count (ETableHeader *eth);
-int e_table_header_index (ETableHeader *eth,
- int col);
-int e_table_header_get_index_at (ETableHeader *eth,
- int x_offset);
-ETableCol **e_table_header_get_columns (ETableHeader *eth);
-gboolean e_table_header_selection_ok (ETableHeader *eth);
-int e_table_header_get_selected (ETableHeader *eth);
-int e_table_header_total_width (ETableHeader *eth);
-void e_table_header_move (ETableHeader *eth,
- int source_index,
- int target_index);
-void e_table_header_remove (ETableHeader *eth, int idx);
-void e_table_header_set_size (ETableHeader *eth, int idx, int size);
-void e_table_header_set_selection (ETableHeader *eth,
- gboolean allow_selection);
-
-int e_table_header_col_diff (ETableHeader *eth,
- int start_col, int end_col);
-
-GList *e_table_header_get_selected_indexes(ETableHeader *eth);
-
-
-#endif /* _E_TABLE_HEADER_H_ */
-
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
deleted file mode 100644
index 33f0c18616..0000000000
--- a/widgets/table/e-table-item.c
+++ /dev/null
@@ -1,1316 +0,0 @@
-/*
- * E-table-item.c: A GnomeCanvasItem that is a view of an ETableModel.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * TODO:
- * Add a border to the thing, so that focusing works properly.
- *
- */
-#include <config.h>
-#include <stdio.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <math.h>
-#include "e-table-item.h"
-#include "e-cell.h"
-
-#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
-
-#define FOCUSED_BORDER 2
-
-static GnomeCanvasItemClass *eti_parent_class;
-
-enum {
- ROW_SELECTION,
- HEIGHT_CHANGED,
- LAST_SIGNAL
-};
-
-static gint eti_signals [LAST_SIGNAL] = { 0, };
-
-enum {
- ARG_0,
- ARG_TABLE_HEADER,
- ARG_TABLE_MODEL,
- ARG_TABLE_X,
- ARG_TABLE_Y,
- ARG_TABLE_DRAW_GRID,
- ARG_TABLE_DRAW_FOCUS,
- ARG_MODE_SPREADSHEET,
- ARG_LENGHT_THRESHOLD
-};
-
-static gboolean
-eti_editing (ETableItem *eti)
-{
- if (eti->editing_col == -1)
- return FALSE;
- else
- return TRUE;
-}
-
-/*
- * During realization, we have to invoke the per-ecell realize routine
- * (On our current setup, we have one e-cell per column.
- *
- * We might want to optimize this to only realize the unique e-cells:
- * ie, a strings-only table, uses the same e-cell for every column, and
- * we might want to avoid realizing each e-cell.
- */
-static void
-eti_realize_cell_views (ETableItem *eti)
-{
- int i;
-
- for (i = 0; i < eti->n_cells; i++)
- e_cell_view_realize (eti->cell_views [i], eti);
- eti->cell_views_realized = 1;
-}
-
-static void eti_compute_height (ETableItem *eti);
-
-static void
-eti_attach_cell_views (ETableItem *eti)
-{
- int i;
-
- g_assert (eti->header);
- g_assert (eti->table_model);
-
- /*
- * Now realize the various ECells
- */
- eti->n_cells = eti->cols;
- eti->cell_views = g_new (ECellView *, eti->n_cells);
-
- for (i = 0; i < eti->n_cells; i++){
- ETableCol *col = e_table_header_get_column (eti->header, i);
-
- eti->cell_views [i] = e_cell_new_view (col->ecell, eti->table_model, eti);
- }
-
- eti_compute_height (eti);
-}
-
-/*
- * During unrealization: we invoke every e-cell (one per column in the current
- * setup) to dispose all X resources allocated
- */
-static void
-eti_unrealize_cell_views (ETableItem *eti)
-{
- int i;
-
- if (eti->cell_views_realized == 0)
- return;
-
- for (i = 0; i < eti->n_cells; i++)
- e_cell_unrealize (eti->cell_views [i]);
- eti->cell_views_realized = 0;
-}
-
-static void
-eti_detach_cell_views (ETableItem *eti)
-{
- int i;
-
- for (i = 0; i < eti->n_cells; i++){
- e_cell_kill_view (eti->cell_views [i]);
- eti->cell_views [i] = NULL;
- }
-
- g_free (eti->cell_views);
- eti->cell_views = NULL;
- eti->n_cells = 0;
-}
-
-static void
-eti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
-{
- double i2c [6];
- ArtPoint c1, c2, i1, i2;
- ETableItem *eti = E_TABLE_ITEM (item);
-
- gnome_canvas_item_i2c_affine (item, i2c);
- i1.x = eti->x1;
- i1.y = eti->y1;
- i2.x = eti->x1 + eti->width;
- i2.y = eti->y1 + eti->height;
- art_affine_point (&c1, &i1, i2c);
- art_affine_point (&c2, &i2, i2c);
-
- item->x1 = c1.x;
- item->y1 = c1.y;
- item->x2 = c2.x;
- item->y2 = c2.y;
-}
-
-
-/*
- * GnomeCanvasItem::update method
- */
-static void
-eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags);
-
- eti_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2);
- gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
-}
-
-/*
- * eti_remove_table_model:
- *
- * Invoked to release the table model associated with this ETableItem
- */
-static void
-eti_remove_table_model (ETableItem *eti)
-{
- if (!eti->table_model)
- return;
-
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
- eti->table_model_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
- eti->table_model_row_change_id);
- gtk_object_unref (GTK_OBJECT (eti->table_model));
-
- eti->table_model_change_id = 0;
- eti->table_model_row_change_id = 0;
- eti->table_model = NULL;
-}
-
-/*
- * eti_remove_header_model:
- *
- * Invoked to release the header model associated with this ETableItem
- */
-static void
-eti_remove_header_model (ETableItem *eti)
-{
- if (!eti->header)
- return;
-
- gtk_signal_disconnect (GTK_OBJECT (eti->header),
- eti->header_structure_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->header),
- eti->header_dim_change_id);
-
- if (eti->cell_views){
- eti_unrealize_cell_views (eti);
- eti_detach_cell_views (eti);
- }
- gtk_object_unref (GTK_OBJECT (eti->header));
-
-
- eti->header_structure_change_id = 0;
- eti->header_dim_change_id = 0;
- eti->header = NULL;
-}
-
-/*
- * eti_row_height:
- *
- * Returns the height used by row @row. This does not include the one-pixel
- * used as a separator between rows
- */
-static int
-eti_row_height (ETableItem *eti, int row)
-{
- const int cols = e_table_header_count (eti->header);
- int col;
- int h, max_h;
-
- g_assert (eti->cell_views);
-
- max_h = 0;
-
- for (col = 0; col < cols; col++){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
-
- h = e_cell_height (eti->cell_views [col], ecol->col_idx, col, row);
-
- if (h > max_h)
- max_h = h;
- }
- return max_h;
-}
-
-/*
- * eti_get_height:
- *
- * Returns the height of the ETableItem.
- *
- * The ETableItem might compute the whole height by asking every row its
- * size. There is a special mode (designed to work when there are too
- * many rows in the table that performing the previous step could take
- * too long) set by the ETableItem->length_threshold that would determine
- * when the height is computed by using the first row as the size for
- * every other row in the ETableItem.
- */
-static int
-eti_get_height (ETableItem *eti)
-{
- const int rows = eti->rows;
- int row;
- int height;
-
- if (rows == 0)
- return 0;
-
- if (eti->length_threshold != -1){
- if (rows > eti->length_threshold){
- height = (eti_row_height (eti, 0) + 1) * rows;
-
- /*
- * 1 pixel at the top
- */
- return height + 1;
- }
- }
-
- height = 1;
- for (row = 0; row < rows; row++)
- height += eti_row_height (eti, row) + 1;
-
- return height;
-}
-
-static void
-eti_compute_height (ETableItem *eti)
-{
- int new_height = eti_get_height (eti);
-
- if (new_height != eti->height){
- double x1, y1, x2, y2;
- printf ("Emitting!\n");
-
- eti->height = new_height;
- eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0);
-
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [HEIGHT_CHANGED]);
- }
-}
-
-/*
- * Callback routine: invoked when the ETableModel has suffered a change
- */
-static void
-eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
-{
- eti->rows = e_table_model_row_count (eti->table_model);
-
- if (eti->cell_views)
- eti_compute_height (eti);
-
- eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0);
-}
-
-static void
-eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1)
-{
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
- ArtDRect rect;
- double i2c [6];
-
- rect.x0 = x0;
- rect.y0 = y0;
- rect.x1 = x1;
- rect.y1 = y1;
-
- gnome_canvas_item_i2c_affine (item, i2c);
- art_drect_affine_transform (&rect, &rect, i2c);
-
- gnome_canvas_request_redraw (item->canvas, rect.x0, rect.y0, rect.x1, rect.y1);
-}
-
-/*
- * eti_request_redraw:
- *
- * Queues a canvas redraw for the entire ETableItem.
- */
-static void
-eti_request_redraw (ETableItem *eti)
-{
- eti_item_region_redraw (eti, eti->x1, eti->y1, eti->x1 + eti->width + 1, eti->y1 + eti->height + 1);
-}
-
-/*
- * Computes the distance between @start_row and @end_row in pixels
- */
-static int
-eti_row_diff (ETableItem *eti, int start_row, int end_row)
-{
- int row, total;
-
- total = 0;
-
- for (row = start_row; row < end_row; row++)
- total += eti_row_height (eti, row) + 1;
-
- return total;
-}
-
-/*
- * eti_request_region_redraw:
- *
- * Request a canvas redraw on the range (start_col, start_row) to (end_col, end_row).
- * This is inclusive (ie, you can use: 0,0-0,0 to redraw the first cell).
- *
- * The @border argument is a number of pixels around the region that should also be queued
- * for redraw. This is typically used by the focus routines to queue a redraw for the
- * border as well.
- */
-static void
-eti_request_region_redraw (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row, int border)
-{
- int x1, y1, width, height;
-
- x1 = e_table_header_col_diff (eti->header, 0, start_col);
- y1 = eti_row_diff (eti, 0, start_row);
- width = e_table_header_col_diff (eti->header, start_col, end_col + 1);
- height = eti_row_diff (eti, start_row, end_row + 1);
-
- eti_item_region_redraw (eti, eti->x1 + x1 - border,
- eti->y1 + y1 - border,
- eti->x1 + x1 + width + 1 + border,
- eti->y1 + y1 + height + 1 + border);
-}
-
-static void
-eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti)
-{
- if (eti->renderers_can_change_size){
- eti_table_model_changed (table_model, eti);
- return;
- }
-
- eti_request_region_redraw (eti, 0, row, eti->cols, row, 0);
-}
-
-void
-e_table_item_redraw_range (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row)
-{
- int border;
-
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if ((start_col == eti->focused_col) ||
- (end_col == eti->focused_col) ||
- (start_row == eti->focused_row) ||
- (end_row == eti->focused_row))
- border = 2;
- else
- border = 0;
-
- eti_request_region_redraw (eti, start_col, start_row, end_col, end_row, border);
-}
-
-static void
-eti_add_table_model (ETableItem *eti, ETableModel *table_model)
-{
- g_assert (eti->table_model == NULL);
-
- eti->table_model = table_model;
- gtk_object_ref (GTK_OBJECT (eti->table_model));
-
- eti->table_model_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_changed",
- GTK_SIGNAL_FUNC (eti_table_model_changed), eti);
-
- eti->table_model_row_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_row_changed",
- GTK_SIGNAL_FUNC (eti_table_model_row_changed), eti);
-
- if (eti->header){
- eti_detach_cell_views (eti);
- eti_attach_cell_views (eti);
- }
-
- eti_table_model_changed (table_model, eti);
-}
-
-static void
-eti_header_dim_changed (ETableHeader *eth, int col, ETableItem *eti)
-{
- eti_request_redraw (eti);
-
- eti->width = e_table_header_total_width (eti->header);
- eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0);
-
- eti_request_redraw (eti);
-}
-
-static void
-eti_header_structure_changed (ETableHeader *eth, ETableItem *eti)
-{
- eti_request_redraw (eti);
-
- eti->cols = e_table_header_count (eti->header);
- eti->width = e_table_header_total_width (eti->header);
-
- if (eti->cell_views){
- eti_unrealize_cell_views (eti);
- eti_detach_cell_views (eti);
- eti_attach_cell_views (eti);
- eti_realize_cell_views (eti);
- } else {
- if (eti->table_model){
- eti_detach_cell_views (eti);
- eti_attach_cell_views (eti);
- }
- }
-
- eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0);
-
- eti_request_redraw (eti);
-}
-
-static void
-eti_add_header_model (ETableItem *eti, ETableHeader *header)
-{
- g_assert (eti->header == NULL);
-
- eti->header = header;
- gtk_object_ref (GTK_OBJECT (header));
-
- eti_header_structure_changed (header, eti);
-
- eti->header_dim_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "dimension_change",
- GTK_SIGNAL_FUNC (eti_header_dim_changed), eti);
-
- eti->header_structure_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "structure_change",
- GTK_SIGNAL_FUNC (eti_header_structure_changed), eti);
-}
-
-/*
- * GtkObject::destroy method
- */
-static void
-eti_destroy (GtkObject *object)
-{
- ETableItem *eti = E_TABLE_ITEM (object);
-
- eti_remove_header_model (eti);
- eti_remove_table_model (eti);
-
- g_slist_free (eti->selection);
-
- if (GTK_OBJECT_CLASS (eti_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (eti_parent_class)->destroy) (object);
-}
-
-static void
-eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ETableItem *eti;
-
- item = GNOME_CANVAS_ITEM (o);
- eti = E_TABLE_ITEM (o);
-
- switch (arg_id){
- case ARG_TABLE_HEADER:
- eti_remove_header_model (eti);
- eti_add_header_model (eti, GTK_VALUE_POINTER (*arg));
- break;
-
- case ARG_TABLE_MODEL:
- eti_remove_table_model (eti);
- eti_add_table_model (eti, GTK_VALUE_POINTER (*arg));
- break;
-
- case ARG_TABLE_X:
- eti->x1 = GTK_VALUE_DOUBLE (*arg);
- break;
-
- case ARG_TABLE_Y:
- eti->y1 = GTK_VALUE_DOUBLE (*arg);
- break;
-
- case ARG_LENGHT_THRESHOLD:
- eti->length_threshold = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_TABLE_DRAW_GRID:
- eti->draw_grid = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_TABLE_DRAW_FOCUS:
- eti->draw_focus = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_MODE_SPREADSHEET:
- eti->mode_spreadsheet = GTK_VALUE_BOOL (*arg);
- break;
- }
- eti_update (item, NULL, NULL, 0);
-}
-
-static void
-eti_init (GnomeCanvasItem *item)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
-
- eti->focused_col = -1;
- eti->focused_row = -1;
- eti->editing_col = -1;
- eti->editing_row = -1;
- eti->height = 0;
-
- eti->length_threshold = -1;
- eti->renderers_can_change_size = 0;
-
- eti->selection_mode = GTK_SELECTION_SINGLE;
-}
-
-#define gray50_width 2
-#define gray50_height 2
-static const char gray50_bits[] = {
- 0x02, 0x01, };
-
-static void
-eti_realize (GnomeCanvasItem *item)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
- GtkWidget *canvas_widget = GTK_WIDGET (item->canvas);
- GdkWindow *window;
-
- if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)
- (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)(item);
-
- /*
- * Gdk Resource allocation
- */
- window = canvas_widget->window;
-
- eti->fill_gc = canvas_widget->style->white_gc;
- gdk_gc_ref (canvas_widget->style->white_gc);
-
- eti->grid_gc = gdk_gc_new (window);
-#if 0
- /* This sets it to gray */
-/* gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); */
-#else
- gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->black);
-#endif
- eti->focus_gc = gdk_gc_new (window);
- gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]);
- gdk_gc_set_background (eti->focus_gc, &canvas_widget->style->fg [GTK_STATE_NORMAL]);
- eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height);
- gdk_gc_set_ts_origin (eti->focus_gc, 0, 0);
- gdk_gc_set_stipple (eti->focus_gc, eti->stipple);
- gdk_gc_set_fill (eti->focus_gc, GDK_OPAQUE_STIPPLED);
-
- if (eti->cell_views == NULL)
- eti_attach_cell_views (eti);
-
- eti_realize_cell_views (eti);
-
- eti_compute_height (eti);
-
- eti_update (item, NULL, NULL, 0);
-}
-
-static void
-eti_unrealize (GnomeCanvasItem *item)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
-
- gdk_gc_unref (eti->fill_gc);
- eti->fill_gc = NULL;
- gdk_gc_unref (eti->grid_gc);
- eti->grid_gc = NULL;
- gdk_gc_unref (eti->focus_gc);
- eti->focus_gc = NULL;
- gdk_bitmap_unref (eti->stipple);
- eti->stipple = NULL;
-
- eti_unrealize_cell_views (eti);
-
- eti->height = 0;
-
- if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->unrealize)
- (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->unrealize)(item);
-}
-
-static void
-eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
- const int rows = eti->rows;
- const int cols = eti->cols;
- int row, col, y1, y2;
- int first_col, last_col, x_offset;
- int first_row, last_row, y_offset, yd;
- int x1, x2;
- int f_x1, f_x2, f_y1, f_y2;
- gboolean f_found;
- double i2c [6];
- ArtPoint eti_base, eti_base_item;
-
- /*
- * Clear the background
- */
-#if 0
- gdk_draw_rectangle (
- drawable, eti->fill_gc, TRUE,
- eti->x1 - x, eti->y1 - y, eti->width, eti->height);
-#endif
-
- /*
- * Find out our real position after grouping
- */
- gnome_canvas_item_i2c_affine (item, i2c);
- eti_base_item.x = eti->x1;
- eti_base_item.y = eti->y1;
- art_affine_point (&eti_base, &eti_base_item, i2c);
-
- /*
- * First column to draw, last column to draw
- */
- first_col = -1;
- last_col = x_offset = 0;
- x1 = x2 = floor (eti_base.x);
- for (col = 0; col < cols; col++, x1 = x2){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
-
- x2 = x1 + ecol->width;
-
- if (x1 > (x + width))
- break;
- if (x2 < x)
- continue;
- if (first_col == -1){
- x_offset = x1 - x;
- first_col = col;
- }
- }
- last_col = col;
-
- /*
- * Nothing to paint
- */
- if (first_col == -1)
- return;
-
- /*
- * Compute row span.
- */
- first_row = -1;
- y_offset = 0;
- y1 = y2 = floor (eti_base.y) + 1;
- for (row = 0; row < rows; row++, y1 = y2){
-
- y2 += eti_row_height (eti, row) + 1;
-
- if (y1 > y + height)
- break;
-
- if (y2 < y)
- continue;
-
- if (first_row == -1){
- y_offset = y1 - y;
- first_row = row;
- }
- }
- last_row = row;
-
- if (first_row == -1)
- return;
-
- /*
- * Draw cells
- */
- yd = y_offset;
- f_x1 = f_x2 = f_y1 = f_y2 = -1;
- f_found = FALSE;
-
- if (eti->draw_grid && first_row == 0){
- gdk_draw_line (
- drawable, eti->grid_gc,
- eti_base.x - x, yd, eti_base.x + eti->width - x, yd);
- }
- yd++;
-
- for (row = first_row; row < last_row; row++){
- int xd, height;
- gboolean selected;
-
- height = eti_row_height (eti, row);
-
- xd = x_offset;
-/* printf ("paint: %d %d\n", yd, yd + height); */
-
- selected = g_slist_find (eti->selection, GINT_TO_POINTER (row)) != NULL;
-
- for (col = first_col; col < last_col; col++){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
- ECellView *ecell_view = eti->cell_views [col];
-
- e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, selected,
- xd, yd, xd + ecol->width, yd + height);
-
- if (col == eti->focused_col && row == eti->focused_row){
- f_x1 = xd;
- f_x2 = xd + ecol->width;
- f_y1 = yd;
- f_y2 = yd + height;
- f_found = TRUE;
- }
-
- xd += ecol->width;
- }
- yd += height;
-
- if (eti->draw_grid)
- gdk_draw_line (
- drawable, eti->grid_gc,
- eti_base.x - x, yd, eti_base.x + eti->width - x, yd);
- yd++;
- }
-
- if (eti->draw_grid){
- int xd = x_offset;
-
- for (col = first_col; col <= last_col; col++){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
-
- gdk_draw_line (
- drawable, eti->grid_gc,
- xd, y_offset, xd, yd - 1);
-
- /*
- * This looks wierd, but it is to draw the last line
- */
- if (ecol)
- xd += ecol->width;
- }
- }
-
- /*
- * Draw focus
- */
- if (f_found && eti->draw_focus){
-
- if (!eti_editing (eti))
- gdk_draw_rectangle (
- drawable, eti->focus_gc, FALSE,
- f_x1 + 1, f_y1, f_x2 - f_x1 - 2, f_y2 - f_y1 - 1);
- }
-}
-
-static double
-eti_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = item;
-
- return 0.0;
-}
-
-static gboolean
-find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, double *x1_res, double *y1_res)
-{
- const int cols = eti->cols;
- const int rows = eti->rows;
- gdouble x1, y1, x2, y2;
- int col, row;
-
- /* FIXME: this routine is inneficient, fix later */
-
- x -= eti->x1;
- y -= eti->y1;
-
- x1 = 0;
- for (col = 0; col < cols; col++, x1 = x2){
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
-
- if (x < x1)
- return FALSE;
-
- x2 = x1 + ecol->width;
-
- if (x > x2)
- continue;
-
- *col_res = col;
- if (x1_res)
- *x1_res = x - x1;
- break;
- }
-
- y1 = y2 = 0;
- for (row = 0; row < rows; row++, y1 = y2){
- if (y < y1)
- return FALSE;
-
- y2 += eti_row_height (eti, row) + 1;
-
- if (y > y2)
- continue;
-
- *row_res = row;
- if (y1_res)
- *y1_res = y - y1;
- break;
- }
-
- return TRUE;
-}
-
-static void
-eti_cursor_move_left (ETableItem *eti)
-{
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col - 1, eti->focused_row);
-}
-
-static void
-eti_cursor_move_right (ETableItem *eti)
-{
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col + 1, eti->focused_row);
-}
-
-static void
-eti_cursor_move_up (ETableItem *eti)
-{
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col, eti->focused_row - 1);
-}
-
-static void
-eti_cursor_move_down (ETableItem *eti)
-{
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col, eti->focused_row + 1);
-}
-
-static int
-eti_event (GnomeCanvasItem *item, GdkEvent *e)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
- ECellView *ecell_view;
- ETableCol *ecol;
-
- switch (e->type){
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_2BUTTON_PRESS: {
- double x1, y1;
- int col, row;
-
- gnome_canvas_item_w2i (item, &e->button.x, &e->button.y);
-
- if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1))
- return TRUE;
-
- if (eti->focused_row == row && eti->focused_col == col){
-
- ecol = e_table_header_get_column (eti->header, col);
- ecell_view = eti->cell_views [col];
-
- /*
- * Adjust the event positions
- */
- e->button.x = x1;
- e->button.y = y1;
-
- e_cell_event (ecell_view, e, ecol->col_idx, col, row);
- } else {
- /*
- * Focus the cell, and select the row
- */
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, col, row);
- e_table_item_select_row (eti, row);
- }
- break;
- }
-
- case GDK_MOTION_NOTIFY: {
- int col, row;
- double x1, y1;
-
- gnome_canvas_item_w2i (item, &e->button.x, &e->button.y);
-
- if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1))
- return TRUE;
-
- if (eti->focused_row == row && eti->focused_col == col){
- ecol = e_table_header_get_column (eti->header, col);
- ecell_view = eti->cell_views [col];
-
- /*
- * Adjust the event positions
- */
- e->button.x -= (x1 + eti->x1);
- e->button.y -= (y1 + eti->y1);
-
- e_cell_event (ecell_view, e, ecol->col_idx, col, row);
- }
- break;
- }
-
- case GDK_KEY_PRESS:
- if (eti->focused_col == -1)
- return FALSE;
-
- switch (e->key.keyval){
- case GDK_Left:
- if (!eti->mode_spreadsheet && eti_editing (eti))
- break;
-
- if (eti->focused_col > 0)
- eti_cursor_move_left (eti);
-
- return TRUE;
-
- case GDK_Right:
- if (!eti->mode_spreadsheet && eti_editing (eti))
- break;
-
- if ((eti->focused_col + 1) < eti->cols)
- eti_cursor_move_right (eti);
- return TRUE;
-
- case GDK_Up:
- if (eti->focused_row > 0)
- eti_cursor_move_up (eti);
- return TRUE;
-
- case GDK_Down:
- if ((eti->focused_row + 1) < eti->rows)
- eti_cursor_move_down (eti);
-
- return TRUE;
-
- case GDK_Tab:
- if ((e->key.state & GDK_SHIFT_MASK) != 0){
- /* shift tab */
- if (eti->focused_col > 0)
- eti_cursor_move_left (eti);
- else if (eti->focused_row > 0){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->cols - 1, eti->focused_row - 1);
- } else {
- /* FIXME: request focus leave backward */
- }
- } else {
- if ((eti->focused_col + 1) < eti->cols)
- eti_cursor_move_right (eti);
- else if ((eti->focused_row + 1) < eti->rows){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, 0, eti->rows - 1);
- } else {
- /* FIXME: request focus leave forward */
- }
- }
- break;
-
- default:
- if (!eti_editing (eti)){
- if ((e->key.state & (GDK_MOD1_MASK | GDK_CONTROL_MASK)) != 0)
- return 0;
-
- if (!(e->key.keyval >= 0x20 && e->key.keyval <= 0xff))
- return 0;
- }
- }
-
- ecol = e_table_header_get_column (eti->header, eti->focused_col);
- ecell_view = eti->cell_views [eti->focused_col];
- e_cell_event (ecell_view, e, ecol->col_idx, eti->focused_col, eti->focused_row);
- break;
-
- case GDK_KEY_RELEASE:
- if (eti->focused_col == -1)
- return FALSE;
-
- if (eti_editing (eti)){
- ecell_view = eti->cell_views [eti->editing_col];
- ecol = e_table_header_get_column (eti->header, eti->editing_col);
- e_cell_event (ecell_view, e, ecol->col_idx, eti->editing_col, eti->editing_row);
- }
- break;
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-/*
- * ETableItem::row_selection method
- */
-static void
-eti_row_selection (ETableItem *eti, int row, gboolean selected)
-{
- eti_request_region_redraw (eti, 0, row, eti->cols - 1, row, 0);
-
- if (selected)
- eti->selection = g_slist_prepend (eti->selection, GINT_TO_POINTER (row));
- else
- eti->selection = g_slist_remove (eti->selection, GINT_TO_POINTER (row));
-
-}
-
-static void
-eti_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
- ETableItemClass *eti_class = (ETableItemClass *) object_class;
-
- eti_parent_class = gtk_type_class (PARENT_OBJECT_TYPE);
-
- object_class->destroy = eti_destroy;
- object_class->set_arg = eti_set_arg;
-
- item_class->update = eti_update;
- item_class->realize = eti_realize;
- item_class->unrealize = eti_unrealize;
- item_class->draw = eti_draw;
- item_class->point = eti_point;
- item_class->event = eti_event;
- item_class->bounds = eti_bounds;
-
- eti_class->row_selection = eti_row_selection;
-
- gtk_object_add_arg_type ("ETableItem::ETableHeader", GTK_TYPE_POINTER,
- GTK_ARG_WRITABLE, ARG_TABLE_HEADER);
- gtk_object_add_arg_type ("ETableItem::ETableModel", GTK_TYPE_POINTER,
- GTK_ARG_WRITABLE, ARG_TABLE_MODEL);
- gtk_object_add_arg_type ("ETableItem::x", GTK_TYPE_DOUBLE,
- GTK_ARG_WRITABLE, ARG_TABLE_X);
- gtk_object_add_arg_type ("ETableItem::y", GTK_TYPE_DOUBLE,
- GTK_ARG_WRITABLE, ARG_TABLE_Y);
- gtk_object_add_arg_type ("ETableItem::drawgrid", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_DRAW_GRID);
- gtk_object_add_arg_type ("ETableItem::drawfocus", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_DRAW_FOCUS);
- gtk_object_add_arg_type ("ETableItem::spreadsheet", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_MODE_SPREADSHEET);
-
- eti_signals [ROW_SELECTION] =
- gtk_signal_new ("row_selection",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableItemClass, row_selection),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- eti_signals [HEIGHT_CHANGED] =
- gtk_signal_new ("height_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableItemClass, height_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, eti_signals, LAST_SIGNAL);
-
-}
-
-GtkType
-e_table_item_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableItem",
- sizeof (ETableItem),
- sizeof (ETableItemClass),
- (GtkClassInitFunc) eti_class_init,
- (GtkObjectInitFunc) eti_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_OBJECT_TYPE, &info);
- }
-
- return type;
-}
-
-void
-e_table_item_focus (ETableItem *eti, int col, int row)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if (eti->focused_col != -1)
- e_table_item_unfocus (eti);
-
- eti->focused_col = col;
- eti->focused_row = row;
-
- eti_request_region_redraw (eti, col, row, col, row, FOCUSED_BORDER);
-
- /*
- * make sure we have the Gtk Focus
- */
- gnome_canvas_item_grab_focus (GNOME_CANVAS_ITEM (eti));
-}
-
-void
-e_table_item_unfocus (ETableItem *eti)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if (eti->focused_row == -1)
- return;
-
- {
- const int col = eti->focused_col;
- const int row = eti->focused_row;
-
- eti_request_region_redraw (eti, col, row, col, row, FOCUSED_BORDER);
- }
- eti->focused_col = -1;
- eti->focused_row = -1;
-}
-
-const GSList *
-e_table_item_get_selection (ETableItem *eti)
-{
- g_return_val_if_fail (eti != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_ITEM (eti), NULL);
-
- return eti->selection;
-}
-
-GtkSelectionMode
-e_table_item_get_selection_mode (ETableItem *eti)
-{
- g_return_val_if_fail (eti != NULL, GTK_SELECTION_SINGLE);
- g_return_val_if_fail (E_IS_TABLE_ITEM (eti), GTK_SELECTION_SINGLE);
-
- return eti->selection_mode;
-}
-
-void
-e_table_item_set_selection_mode (ETableItem *eti, GtkSelectionMode selection_mode)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if (selection_mode == GTK_SELECTION_BROWSE ||
- selection_mode == GTK_SELECTION_EXTENDED){
- g_error ("GTK_SELECTION_BROWSE and GTK_SELECTION_EXTENDED are not implemented");
- }
-
- eti->selection_mode = selection_mode;
-}
-
-gboolean
-e_table_item_is_row_selected (ETableItem *eti, int row)
-{
- g_return_val_if_fail (eti != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_ITEM (eti), FALSE);
-
- if (g_slist_find (eti->selection, GINT_TO_POINTER (row)))
- return TRUE;
- else
- return FALSE;
-}
-
-void
-e_table_item_unselect_row (ETableItem *eti, int row)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if (e_table_item_is_row_selected (eti, row)){
- gtk_signal_emit (
- GTK_OBJECT (eti), eti_signals [ROW_SELECTION],
- row, 0);
- }
-}
-
-void
-e_table_item_select_row (ETableItem *eti, int row)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- switch (eti->selection_mode){
- case GTK_SELECTION_SINGLE:
- if (eti->selection){
- gtk_signal_emit (
- GTK_OBJECT (eti), eti_signals [ROW_SELECTION],
- GPOINTER_TO_INT (eti->selection->data), 0);
- }
- g_slist_free (eti->selection);
- eti->selection = NULL;
-
- gtk_signal_emit (
- GTK_OBJECT (eti), eti_signals [ROW_SELECTION],
- GINT_TO_POINTER (row), 1);
- break;
-
- case GTK_SELECTION_MULTIPLE:
- if (g_slist_find (eti->selection, GINT_TO_POINTER (row)))
- return;
- gtk_signal_emit (
- GTK_OBJECT (eti), eti_signals [ROW_SELECTION],
- GINT_TO_POINTER (row), 1);
- break;
-
- default:
-
- }
-}
-
-void
-e_table_item_enter_edit (ETableItem *eti, int col, int row)
-{
- ETableCol *ecol;
-
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- eti->editing_col = col;
- eti->editing_row = row;
-
- ecol = e_table_header_get_column (eti->header, col);
- eti->edit_ctx = e_cell_enter_edit (eti->cell_views [col], ecol->col_idx, col, row);
-}
-
-void
-e_table_item_leave_edit (ETableItem *eti)
-{
- ETableCol *ecol;
-
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if (!eti_editing (eti))
- return;
-
- ecol = e_table_header_get_column (eti->header, eti->editing_col);
- e_cell_leave_edit (
- eti->cell_views [eti->editing_col],
- ecol->col_idx, eti->editing_col,
- eti->editing_row, eti->edit_ctx);
- eti->editing_col = -1;
- eti->editing_row = -1;
- eti->edit_ctx = NULL;
-}
-
diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h
deleted file mode 100644
index f19819f2fc..0000000000
--- a/widgets/table/e-table-item.h
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef _E_TABLE_ITEM_H_
-#define _E_TABLE_ITEM_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include "e-table-model.h"
-#include "e-table-header.h"
-
-#define E_TABLE_ITEM_TYPE (e_table_item_get_type ())
-#define E_TABLE_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_ITEM_TYPE, ETableItem))
-#define E_TABLE_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_ITEM_TYPE, ETableItemClass))
-#define E_IS_TABLE_ITEM(o) (GTK_CHECK_TYPE ((o), E_TABLE_ITEM_TYPE))
-#define E_IS_TABLE_ITEM_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_ITEM_TYPE))
-
-typedef struct {
- GnomeCanvasItem parent;
- ETableModel *table_model;
- ETableHeader *header;
-
- int x1, y1;
- int width, height;
-
- int cols, rows;
-
- /*
- * Ids for the signals we connect to
- */
- int header_dim_change_id;
- int header_structure_change_id;
- int table_model_change_id;
- int table_model_row_change_id;
-
- GdkGC *fill_gc;
- GdkGC *grid_gc;
- GdkGC *focus_gc;
- GdkBitmap *stipple;
-
- unsigned int draw_grid:1;
- unsigned int draw_focus:1;
- unsigned int mode_spreadsheet:1;
- unsigned int renderers_can_change_size:1;
- unsigned int cell_views_realized:1;
-
- int focused_col, focused_row;
-
- /*
- * Realized views, per column
- */
- ECellView **cell_views;
- int n_cells;
-
- /*
- * Lengh Threshold: above this, we stop computing correctly
- * the size
- */
- int length_threshold;
-
- GSList *selection;
- GtkSelectionMode selection_mode;
-
- /*
- * During edition
- */
- int editing_col, editing_row;
- void *edit_ctx;
-} ETableItem;
-
-typedef struct {
- GnomeCanvasItemClass parent_class;
-
- void (*row_selection) (ETableItem *eti, int row, gboolean selected);
- void (*height_changed) (ETableItem *eti);
-} ETableItemClass;
-
-GtkType e_table_item_get_type (void);
-
-/*
- * Focus
- */
-void e_table_item_focus (ETableItem *eti, int col, int row);
-void e_table_item_unfocus (ETableItem *eti);
-
-/*
- * Selection
- */
-void e_table_item_select_row (ETableItem *e_table_Item, int row);
-void e_table_item_unselect_row (ETableItem *e_table_Item, int row);
-
-/*
- * Handling the selection
- */
-const GSList*e_table_item_get_selection (ETableItem *e_table_Item);
-
-GtkSelectionMode e_table_item_get_selection_mode (ETableItem *e_table_Item);
-void e_table_item_set_selection_mode (ETableItem *e_table_Item,
- GtkSelectionMode selection_mode);
-gboolean e_table_item_is_row_selected (ETableItem *e_table_Item,
- int row);
-
-void e_table_item_leave_edit (ETableItem *eti);
-void e_table_item_enter_edit (ETableItem *eti, int col, int row);
-
-void e_table_item_redraw_range (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row);
-
-#endif /* _E_TABLE_ITEM_H_ */
diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c
deleted file mode 100644
index 9e397710ef..0000000000
--- a/widgets/table/e-table-model.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * e-table-model.c: a Table Model
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc.
- */
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-table-model.h"
-
-#define ETM_CLASS(e) ((ETableModelClass *)((GtkObject *)e)->klass)
-
-static GtkObjectClass *e_table_model_parent_class;
-
-enum {
- MODEL_CHANGED,
- MODEL_ROW_CHANGED,
- MODEL_CELL_CHANGED,
- ROW_SELECTION,
- LAST_SIGNAL
-};
-
-static guint e_table_model_signals [LAST_SIGNAL] = { 0, };
-
-int
-e_table_model_column_count (ETableModel *e_table_model)
-{
- g_return_val_if_fail (e_table_model != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), 0);
-
- return ETM_CLASS (e_table_model)->column_count (e_table_model);
-}
-
-
-int
-e_table_model_row_count (ETableModel *e_table_model)
-{
- g_return_val_if_fail (e_table_model != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), 0);
-
- return ETM_CLASS (e_table_model)->row_count (e_table_model);
-}
-
-void *
-e_table_model_value_at (ETableModel *e_table_model, int col, int row)
-{
- g_return_val_if_fail (e_table_model != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL);
-
- return ETM_CLASS (e_table_model)->value_at (e_table_model, col, row);
-}
-
-void
-e_table_model_set_value_at (ETableModel *e_table_model, int col, int row, const void *data)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- ETM_CLASS (e_table_model)->set_value_at (e_table_model, col, row, data);
-
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_ROW_CHANGED], row);
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_CELL_CHANGED], col, row);
-
- /*
- * Notice that "model_changed" is not emitted
- */
-}
-
-gboolean
-e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row)
-{
- g_return_val_if_fail (e_table_model != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE);
-
- return ETM_CLASS (e_table_model)->is_cell_editable (e_table_model, col, row);
-}
-
-static void
-e_table_model_destroy (GtkObject *object)
-{
- if (e_table_model_parent_class->destroy)
- (*e_table_model_parent_class->destroy)(object);
-}
-
-static void
-e_table_model_class_init (GtkObjectClass *object_class)
-{
- e_table_model_parent_class = gtk_type_class (gtk_object_get_type ());
-
- object_class->destroy = e_table_model_destroy;
-
- e_table_model_signals [MODEL_CHANGED] =
- gtk_signal_new ("model_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableModelClass, model_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_table_model_signals [MODEL_ROW_CHANGED] =
- gtk_signal_new ("model_row_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableModelClass, model_row_changed),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- e_table_model_signals [MODEL_CELL_CHANGED] =
- gtk_signal_new ("model_cell_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableModelClass, model_cell_changed),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, e_table_model_signals, LAST_SIGNAL);
-}
-
-GtkType
-e_table_model_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableModel",
- sizeof (ETableModel),
- sizeof (ETableModelClass),
- (GtkClassInitFunc) e_table_model_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-void
-e_table_model_changed (ETableModel *e_table_model)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_CHANGED]);
-}
-
-void
-e_table_model_row_changed (ETableModel *e_table_model, int row)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_ROW_CHANGED], row);
-}
-
-void
-e_table_model_cell_changed (ETableModel *e_table_model, int col, int row)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_CELL_CHANGED], col, row);
-}
-
-
diff --git a/widgets/table/e-table-model.h b/widgets/table/e-table-model.h
deleted file mode 100644
index 2d08f3744e..0000000000
--- a/widgets/table/e-table-model.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef _E_TABLE_MODEL_H_
-#define _E_TABLE_MODEL_H_
-
-#include <gtk/gtkobject.h>
-
-#define E_TABLE_MODEL_TYPE (e_table_model_get_type ())
-#define E_TABLE_MODEL(o) (GTK_CHECK_CAST ((o), E_TABLE_MODEL_TYPE, ETableModel))
-#define E_TABLE_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_MODEL_TYPE, ETableModelClass))
-#define E_IS_TABLE_MODEL(o) (GTK_CHECK_TYPE ((o), E_TABLE_MODEL_TYPE))
-#define E_IS_TABLE_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_MODEL_TYPE))
-
-typedef struct {
- GtkObject base;
-} ETableModel;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Virtual methods
- */
- int (*column_count) (ETableModel *etm);
- int (*row_count) (ETableModel *etm);
- void *(*value_at) (ETableModel *etm, int col, int row);
- void (*set_value_at) (ETableModel *etm, int col, int row, const void *value);
- gboolean (*is_cell_editable) (ETableModel *etm, int col, int row);
-
- /*
- * Signals
- */
-
- /*
- * Major structural changes: model_changed
- * Changes only in a row: row_changed
- * Only changes in a cell: cell_changed
- */
- void (*model_changed) (ETableModel *etm);
- void (*model_row_changed) (ETableModel *etm, int row);
- void (*model_cell_changed) (ETableModel *etm, int col, int row);
-} ETableModelClass;
-
-GtkType e_table_model_get_type (void);
-
-int e_table_model_column_count (ETableModel *e_table_model);
-const char *e_table_model_column_name (ETableModel *e_table_model, int col);
-int e_table_model_row_count (ETableModel *e_table_model);
-void *e_table_model_value_at (ETableModel *e_table_model, int col, int row);
-void e_table_model_set_value_at (ETableModel *e_table_model, int col, int row, const void *data);
-gboolean e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row);
-
-/*
- * Routines for emitting signals on the e_table
- */
-void e_table_model_changed (ETableModel *e_table_model);
-void e_table_model_row_changed (ETableModel *e_table_model, int row);
-void e_table_model_cell_changed (ETableModel *e_table_model, int col, int row);
-
-#endif /* _E_TABLE_MODEL_H_ */
diff --git a/widgets/table/e-table-render.c b/widgets/table/e-table-render.c
deleted file mode 100644
index 49d742132b..0000000000
--- a/widgets/table/e-table-render.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * E-table-render.c: Various renderers
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * Copyright 1999, Helix Code, Inc.
- */
-#include <config.h>
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-col.h"
-#include "e-table-render.h"
-
-void
-e_table_render_string (ERenderContext *ctxt)
-{
- printf ("Rendering string: %s\n", ctxt->render_data);
-}
-
diff --git a/widgets/table/e-table-render.h b/widgets/table/e-table-render.h
deleted file mode 100644
index ebc65968f0..0000000000
--- a/widgets/table/e-table-render.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef E_TABLE_RENDER_H
-#define E_TABLE_RENDER_H
-
-#include <libgnomeui/gnome-canvas.h>
-
-struct ERenderContext {
- ETableCol *etc;
- int row;
- int base_x, base_y;
- GnomeCanvasItem *gnome_canvas_item;
- GdkDrawable *drawable;
- int drawable_width;
- int drawable_height;
- void *render_data;
- void *closure;
-};
-
-void e_table_render_string (ERenderContext *ctxt);
-
-
-#endif
diff --git a/widgets/table/e-table-simple.c b/widgets/table/e-table-simple.c
deleted file mode 100644
index 943a3291e9..0000000000
--- a/widgets/table/e-table-simple.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * e-table-model.c: a simple table model implementation that uses function
- * pointers to simplify the creation of new, exotic and colorful tables in
- * no time.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc.
- */
-
-#include <config.h>
-#include "e-table-simple.h"
-
-#define PARENT_TYPE e_table_model_get_type()
-
-static int
-simple_column_count (ETableModel *etm)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- return simple->col_count (etm, simple->data);
-}
-
-static int
-simple_row_count (ETableModel *etm)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- return simple->row_count (etm, simple->data);
-}
-
-static void *
-simple_value_at (ETableModel *etm, int col, int row)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- return simple->value_at (etm, col, row, simple->data);
-}
-
-static void
-simple_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- simple->set_value_at (etm, col, row, val, simple->data);
-}
-
-static gboolean
-simple_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETableSimple *simple = (ETableSimple *)etm;
-
- return simple->is_cell_editable (etm, col, row, simple->data);
-}
-
-static void
-e_table_simple_class_init (GtkObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- model_class->column_count = simple_column_count;
- model_class->row_count = simple_row_count;
- model_class->value_at = simple_value_at;
- model_class->set_value_at = simple_set_value_at;
- model_class->is_cell_editable = simple_is_cell_editable;
-}
-
-GtkType
-e_table_simple_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableSimple",
- sizeof (ETableSimple),
- sizeof (ETableSimpleClass),
- (GtkClassInitFunc) e_table_simple_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-ETableModel *
-e_table_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleRowCountFn row_count,
- ETableSimpleValueAtFn value_at,
- ETableSimpleSetValueAtFn set_value_at,
- ETableSimpleIsCellEditableFn is_cell_editable,
- void *data)
-{
- ETableSimple *et;
-
- et = gtk_type_new (e_table_simple_get_type ());
-
- et->col_count = col_count;
- et->row_count = row_count;
- et->value_at = value_at;
- et->set_value_at = set_value_at;
- et->is_cell_editable = is_cell_editable;
-
- return (ETableModel *) et;
-}
diff --git a/widgets/table/e-table-simple.h b/widgets/table/e-table-simple.h
deleted file mode 100644
index d890245386..0000000000
--- a/widgets/table/e-table-simple.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _E_TABLE_SIMPLE_H_
-#define _E_TABLE_SIMPLE_H_
-
-#include "e-table-model.h"
-
-typedef int (*ETableSimpleColumnCountFn) (ETableModel *etm, void *data);
-typedef int (*ETableSimpleRowCountFn) (ETableModel *etm, void *data);
-typedef void *(*ETableSimpleValueAtFn) (ETableModel *etm, int col, int row, void *data);
-typedef void (*ETableSimpleSetValueAtFn) (ETableModel *etm, int col, int row, const void *val, void *data);
-typedef gboolean (*ETableSimpleIsCellEditableFn) (ETableModel *etm, int col, int row, void *data);
-
-typedef struct {
- ETableModel parent;
-
- ETableSimpleColumnCountFn col_count;
- ETableSimpleRowCountFn row_count;
- ETableSimpleValueAtFn value_at;
- ETableSimpleSetValueAtFn set_value_at;
- ETableSimpleIsCellEditableFn is_cell_editable;
- void *data;
-} ETableSimple;
-
-typedef struct {
- ETableModelClass parent_class;
-} ETableSimpleClass;
-
-GtkType e_table_simple_get_type (void);
-
-ETableModel *e_table_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleRowCountFn row_count,
- ETableSimpleValueAtFn value_at,
- ETableSimpleSetValueAtFn set_value_at,
- ETableSimpleIsCellEditableFn is_cell_editable,
- void *data);
-
-#endif /* _E_TABLE_SIMPLE_H_ */
-
diff --git a/widgets/table/e-table-sorted.c b/widgets/table/e-table-sorted.c
deleted file mode 100644
index 16644a45b1..0000000000
--- a/widgets/table/e-table-sorted.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * E-table-sorted.c: Implements a table that sorts another table
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc.
- */
-#include <config.h>
-#include <stdlib.h>
-#include "e-util/e-util.h"
-#include "e-table-sorted.h"
-
-#define PARENT_TYPE E_TABLE_SUBSET_TYPE
-
-static ETableModelClass *ets_parent_class;
-
-static void
-ets_class_init (GtkObjectClass *klass)
-{
- ets_parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-E_MAKE_TYPE(e_table_sorted, "ETableSorted", ETableSorted, ets_class_init, NULL, PARENT_TYPE);
-
-static ETableSorted *sort_ets;
-
-static int
-my_sort (const void *a, const void *b)
-{
- ETableModel *source = E_TABLE_SUBSET (sort_ets)->source;
- const int *ia = (const int *) a;
- const int *ib = (const int *) b;
- void *va, *vb;
-
- va = e_table_model_value_at (source, sort_ets->sort_col, *ia);
- vb = e_table_model_value_at (source, sort_ets->sort_col, *ib);
-
- return (*sort_ets->compare) (va, vb);
-}
-
-static void
-do_sort (ETableSorted *ets)
-{
- ETableSubset *etss = E_TABLE_SUBSET (ets);
- g_assert (sort_ets == NULL);
-
- sort_ets = ets;
- qsort (etss->map_table, etss->n_map, sizeof (unsigned int), my_sort);
- sort_ets = NULL;
-}
-
-ETableModel *
-e_table_sorted_new (ETableModel *source, int col, GCompareFunc compare)
-{
- ETableSorted *ets = gtk_type_new (E_TABLE_SORTED_TYPE);
- ETableSubset *etss = E_TABLE_SUBSET (ets);
- const int nvals = e_table_model_row_count (source);
- int i;
-
- if (e_table_subset_construct (etss, source, nvals) == NULL){
- gtk_object_destroy (GTK_OBJECT (ets));
- return NULL;
- }
-
- ets->compare = compare;
- ets->sort_col = col;
-
- /* Init */
- for (i = 0; i < nvals; i++)
- etss->map_table [i] = i;
-
- do_sort (ets);
-
- return (ETableModel *) ets;
-}
-
-void
-e_table_sorted_resort (ETableSorted *ets, int col, GCompareFunc compare)
-{
- if (col == -1 || compare == NULL)
- do_sort (ets);
- else {
- ets->sort_col = col;
- ets->compare = compare;
- do_sort (ets);
- }
-}
-
diff --git a/widgets/table/e-table-sorted.h b/widgets/table/e-table-sorted.h
deleted file mode 100644
index 2ec52df2e7..0000000000
--- a/widgets/table/e-table-sorted.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef _E_TABLE_SORTED_H_
-#define _E_TABLE_SORTED_H_
-
-#include <gtk/gtkobject.h>
-#include "e-table-model.h"
-#include "e-table-subset.h"
-
-#define E_TABLE_SORTED_TYPE (e_table_sorted_get_type ())
-#define E_TABLE_SORTED(o) (GTK_CHECK_CAST ((o), E_TABLE_SORTED_TYPE, ETableSorted))
-#define E_TABLE_SORTED_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SORTED_TYPE, ETableSortedClass))
-#define E_IS_TABLE_SORTED(o) (GTK_CHECK_TYPE ((o), E_TABLE_SORTED_TYPE))
-#define E_IS_TABLE_SORTED_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_TYPE))
-
-typedef struct {
- ETableSubset base;
-
- short sort_col;
- GCompareFunc compare;
-} ETableSorted;
-
-typedef struct {
- ETableSubset parent_class;
-} ETableSortedClass;
-
-GtkType e_table_sorted_get_type (void);
-ETableModel *e_table_sorted_new (ETableModel *etm, int col, GCompareFunc compare);
-void e_table_sorted_resort (ETableSorted *ets, int col, GCompareFunc compare);
-
-#endif /* _E_TABLE_SORTED_H_ */
diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c
deleted file mode 100644
index a9e4a5c5a4..0000000000
--- a/widgets/table/e-table-subset.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * E-table-subset.c: Implements a table that contains a subset of another table.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 1999 Helix Code, Inc.
- */
-#include <config.h>
-#include <stdlib.h>
-#include <gtk/gtksignal.h>
-#include "e-util/e-util.h"
-#include "e-table-subset.h"
-
-#define PARENT_TYPE E_TABLE_MODEL_TYPE
-
-static ETableModelClass *etss_parent_class;
-
-static void
-etss_destroy (GtkObject *object)
-{
- ETableSubset *etss = E_TABLE_SUBSET (object);
-
- if (etss->source)
- gtk_object_unref (GTK_OBJECT (etss->source));
-
- if (etss->map_table)
- free (etss->map_table);
-
- GTK_OBJECT_CLASS (etss_parent_class)->destroy (object);
-}
-
-static int
-etss_column_count (ETableModel *etm)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_column_count (etss->source);
-}
-
-static int
-etss_row_count (ETableModel *etm)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return etss->n_map;
-}
-
-static void *
-etss_value_at (ETableModel *etm, int col, int row)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_value_at (etss->source, col, etss->map_table [row]);
-}
-
-static void
-etss_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_set_value_at (etss->source, col, etss->map_table [row], val);
-}
-
-static gboolean
-etss_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_is_cell_editable (etss->source, col, etss->map_table [row]);
-}
-
-static void
-etss_class_init (GtkObjectClass *klass)
-{
- ETableModelClass *table_class = (ETableModelClass *) klass;
-
- etss_parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->destroy = etss_destroy;
-
- table_class->column_count = etss_column_count;
- table_class->row_count = etss_row_count;
- table_class->value_at = etss_value_at;
- table_class->set_value_at = etss_set_value_at;
- table_class->is_cell_editable = etss_is_cell_editable;
-}
-
-E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, NULL, PARENT_TYPE);
-
-static void
-etss_proxy_model_changed (ETableModel *etm, ETableSubset *etss)
-{
- e_table_model_changed (E_TABLE_MODEL (etss));
-}
-
-static void
-etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss)
-{
- const int n = etss->n_map;
- const int * const map_table = etss->map_table;
- int i;
-
- for (i = 0; i < n; i++){
- if (map_table [i] == row){
- e_table_model_row_changed (E_TABLE_MODEL (etss), i);
- return;
- }
- }
-}
-
-static void
-etss_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSubset *etss)
-{
- const int n = etss->n_map;
- const int * const map_table = etss->map_table;
- int i;
-
- for (i = 0; i < n; i++){
- if (map_table [i] == row){
- e_table_model_cell_changed (E_TABLE_MODEL (etss), col, i);
- return;
- }
- }
-}
-
-ETableModel *
-e_table_subset_construct (ETableSubset *etss, ETableModel *source, int nvals)
-{
- unsigned int *buffer;
- int i;
-
- buffer = (unsigned int *) malloc (sizeof (unsigned int) * nvals);
- if (buffer == NULL)
- return NULL;
- etss->map_table = buffer;
- etss->n_map = nvals;
- etss->source = source;
- gtk_object_ref (GTK_OBJECT (source));
-
- /* Init */
- for (i = 0; i < nvals; i++)
- etss->map_table [i] = i;
-
- gtk_signal_connect (GTK_OBJECT (source), "model_changed",
- GTK_SIGNAL_FUNC (etss_proxy_model_changed), etss);
- gtk_signal_connect (GTK_OBJECT (source), "model_row_changed",
- GTK_SIGNAL_FUNC (etss_proxy_model_row_changed), etss);
- gtk_signal_connect (GTK_OBJECT (source), "model_cell_changed",
- GTK_SIGNAL_FUNC (etss_proxy_model_cell_changed), etss);
-
- return E_TABLE_MODEL (etss);
-}
-
-ETableModel *
-e_table_subset_new (ETableModel *source, const int nvals)
-{
- ETableSubset *etss = gtk_type_new (E_TABLE_SUBSET_TYPE);
-
- if (e_table_subset_construct (etss, source, nvals) == NULL){
- gtk_object_destroy (GTK_OBJECT (etss));
- return NULL;
- }
-
- return (ETableModel *) etss;
-}
-
-ETableModel *
-e_table_subset_get_toplevel (ETableSubset *table)
-{
- g_return_val_if_fail (table != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_SUBSET (table), NULL);
-
- if (E_IS_TABLE_SUBSET (table->source))
- return e_table_subset_get_toplevel (E_TABLE_SUBSET (table->source));
- else
- return table->source;
-}
diff --git a/widgets/table/e-table-subset.h b/widgets/table/e-table-subset.h
deleted file mode 100644
index 314f28aea6..0000000000
--- a/widgets/table/e-table-subset.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef _E_TABLE_SUBSET_H_
-#define _E_TABLE_SUBSET_H_
-
-#include <gtk/gtkobject.h>
-#include "e-table-model.h"
-
-#define E_TABLE_SUBSET_TYPE (e_table_subset_get_type ())
-#define E_TABLE_SUBSET(o) (GTK_CHECK_CAST ((o), E_TABLE_SUBSET_TYPE, ETableSubset))
-#define E_TABLE_SUBSET_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SUBSET_TYPE, ETableSubsetClass))
-#define E_IS_TABLE_SUBSET(o) (GTK_CHECK_TYPE ((o), E_TABLE_SUBSET_TYPE))
-#define E_IS_TABLE_SUBSET_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SUBSET_TYPE))
-
-typedef struct {
- ETableModel base;
-
- ETableModel *source;
- int n_map;
- int *map_table;
-} ETableSubset;
-
-typedef struct {
- ETableModelClass parent_class;
-} ETableSubsetClass;
-
-GtkType e_table_subset_get_type (void);
-ETableModel *e_table_subset_new (ETableModel *etm, int n_vals);
-ETableModel *e_table_subset_construct (ETableSubset *ets, ETableModel *source, int nvals);
-
-ETableModel *e_table_subset_get_toplevel (ETableSubset *table_model);
-
-#endif /* _E_TABLE_SUBSET_H_ */
-
diff --git a/widgets/table/e-table-tree.h b/widgets/table/e-table-tree.h
deleted file mode 100644
index e7e125a6af..0000000000
--- a/widgets/table/e-table-tree.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _E_TABLE_TREE_H_
-#define _E_TABLE_TREE_H_
-
-typedef struct {
- char *title;
-
- union {
- ETableModel *table;
- GList *children;
- } u;
-
- guint expanded :1;
- guint is_leaf :1;
-} ETableGroup;
-
-ETableGroup *e_table_group_new (const char *title, ETableModel *table);
-ETableGroup *e_table_group_new_leaf (const char *title);
-
-#endif /* _E_TABLE_TREE_H_ */
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
deleted file mode 100644
index a42aaf111b..0000000000
--- a/widgets/table/e-table.c
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * E-table-view.c: A graphical view of a Table.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * Copyright 1999, Helix Code, Inc
- */
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <alloca.h>
-#include <stdio.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <gtk/gtksignal.h>
-#include "e-util/e-util.h"
-#include "e-table.h"
-#include "e-table-header-item.h"
-#include "e-table-subset.h"
-#include "e-table-item.h"
-#include "e-table-group.h"
-
-#define COLUMN_HEADER_HEIGHT 16
-#define TITLE_HEIGHT 16
-#define GROUP_INDENT 10
-
-#define PARENT_TYPE gtk_table_get_type ()
-
-static GtkObjectClass *e_table_parent_class;
-
-static void
-et_destroy (GtkObject *object)
-{
- ETable *et = E_TABLE (object);
-
- gtk_object_unref (GTK_OBJECT (et->model));
- gtk_object_unref (GTK_OBJECT (et->full_header));
- gtk_object_unref (GTK_OBJECT (et->header));
-
- g_free (et->group_spec);
-
- (*e_table_parent_class->destroy)(object);
-}
-
-static void
-e_table_init (GtkObject *object)
-{
- ETable *e_table = E_TABLE (object);
-
- e_table->draw_grid = 1;
- e_table->draw_focus = 1;
- e_table->spreadsheet = 1;
-}
-
-static ETableHeader *
-e_table_make_header (ETable *e_table, ETableHeader *full_header, const char *cols)
-{
- ETableHeader *nh;
- char *copy = alloca (strlen (cols) + 1);
- char *p, *state;
- const int max_cols = e_table_header_count (full_header);
-
- nh = e_table_header_new ();
- strcpy (copy, cols);
- while ((p = strtok_r (copy, ",", &state)) != NULL){
- int col = atoi (p);
-
- copy = NULL;
- if (col >= max_cols)
- continue;
-
- e_table_header_add_column (nh, e_table_header_get_column (full_header, col), -1);
- }
-
- return nh;
-}
-
-static void
-header_canvas_size_alocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table)
-{
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_table->header_canvas),
- 0, 0, alloc->width, COLUMN_HEADER_HEIGHT);
-}
-
-static void
-e_table_setup_header (ETable *e_table)
-{
- e_table->header_canvas = GNOME_CANVAS (gnome_canvas_new ());
-
- gtk_widget_show (GTK_WIDGET (e_table->header_canvas));
-
- e_table->header_item = gnome_canvas_item_new (
- gnome_canvas_root (e_table->header_canvas),
- e_table_header_item_get_type (),
- "ETableHeader", e_table->header,
- "x", 0,
- "y", 0,
- NULL);
-
- gtk_signal_connect (
- GTK_OBJECT (e_table->header_canvas), "size_allocate",
- GTK_SIGNAL_FUNC (header_canvas_size_alocate), e_table);
-
- gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -1, COLUMN_HEADER_HEIGHT);
-
- gtk_table_attach (
- GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas),
- 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0);
-
-}
-
-typedef struct {
- void *value;
- GArray *array;
-} group_key_t;
-
-static GArray *
-e_table_create_groups (ETableModel *etm, int key_col, GCompareFunc comp)
-{
- GArray *groups;
- const int rows = e_table_model_row_count (etm);
- int row, i;
-
- groups = g_array_new (FALSE, FALSE, sizeof (group_key_t));
-
- for (row = 0; row < rows; row++){
- void *val = e_table_model_value_at (etm, key_col, row);
- const int n_groups = groups->len;
-
- /*
- * Should replace this with a bsearch later
- */
- for (i = 0; i < n_groups; i++){
- group_key_t *g = &g_array_index (groups, group_key_t, i);
-
- if ((*comp) (g->value, val)){
- g_array_append_val (g->array, row);
- break;
- }
- }
- if (i != n_groups)
- continue;
-
- /*
- * We need to create a new group
- */
- {
- group_key_t gk;
-
- gk.value = val;
- gk.array = g_array_new (FALSE, FALSE, sizeof (int));
-
- g_array_append_val (gk.array, row);
- g_array_append_val (groups, gk);
- }
- }
-
- return groups;
-}
-
-static void
-e_table_destroy_groups (GArray *groups)
-{
- const int n = groups->len;
- int i;
-
- for (i = 0; i < n; i++){
- group_key_t *g = &g_array_index (groups, group_key_t, i);
-
- g_array_free (g->array, TRUE);
- }
- g_array_free (groups, TRUE);
-}
-
-static ETableModel **
-e_table_make_subtables (ETableModel *model, GArray *groups)
-{
- const int n_groups = groups->len;
- ETableModel **tables;
- int i;
-
- tables = g_new (ETableModel *, n_groups+1);
-
- for (i = 0; i < n_groups; i++){
- group_key_t *g = &g_array_index (groups, group_key_t, i);
- const int sub_size = g->array->len;
- ETableSubset *ss;
- int j;
-
- tables [i] = e_table_subset_new (model, sub_size);
- ss = E_TABLE_SUBSET (tables [i]);
-
- for (j = 0; j < sub_size; j++)
- ss->map_table [j] = g_array_index (g->array, int, j);
- }
- tables [i] = NULL;
-
- return (ETableModel **) tables;
-}
-
-typedef struct _Node Node;
-
-struct _Node {
- Node *parent;
- GnomeCanvasItem *item;
- ETableModel *table_model;
- GSList *children;
-
- guint is_leaf:1;
-};
-
-static Node *
-leaf_new (GnomeCanvasItem *table_item, ETableModel *table_model, Node *parent)
-{
- Node *node = g_new (Node, 1);
-
- g_assert (table_item != NULL);
- g_assert (table_model != NULL);
- g_assert (parent != NULL);
-
- node->item = table_item;
- node->parent = parent;
- node->table_model = table_model;
- node->is_leaf = 1;
-
- g_assert (!parent->is_leaf);
-
- parent->children = g_slist_append (parent->children, node);
-
- e_table_group_add (E_TABLE_GROUP (parent->item), table_item);
-
- return node;
-}
-
-static Node *
-node_new (GnomeCanvasItem *group_item, ETableModel *table_model, Node *parent)
-{
- Node *node = g_new (Node, 1);
-
- g_assert (table_model != NULL);
-
- node->children = NULL;
- node->item = group_item;
- node->parent = parent;
- node->table_model = table_model;
- node->is_leaf = 0;
-
- if (parent){
- parent->children = g_slist_append (parent->children, node);
-
- e_table_group_add (E_TABLE_GROUP (parent->item), group_item);
- }
-
- return node;
-}
-
-static Node *
-e_table_create_leaf (ETable *e_table, ETableModel *etm, Node *parent)
-{
- GnomeCanvasItem *table_item;
- static double last_y;
- Node *leaf;
-
- table_item = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (parent->item),
- e_table_item_get_type (),
- "ETableHeader", e_table->header,
- "ETableModel", etm,
- "drawgrid", e_table->draw_grid,
- "drawfocus", e_table->draw_focus,
- "spreadsheet", e_table->spreadsheet,
- NULL);
-
- leaf = leaf_new (table_item, etm, parent);
-
- return leaf;
-}
-
-static int
-leaf_height (Node *leaf)
-{
- const GnomeCanvasItem *item = leaf->item;
-
- return item->y2 - item->y1;
-}
-
-static int
-leaf_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- static int last_x = -1;
- static int last_y = -1;
-
- if (event->type == GDK_BUTTON_PRESS){
- last_x = event->button.x;
- last_y = event->button.y;
- } else if (event->type == GDK_BUTTON_RELEASE){
- last_x = -1;
- last_y = -1;
- } else if (event->type == GDK_MOTION_NOTIFY){
- if (last_x == -1)
- return FALSE;
-
- gnome_canvas_item_move (item, event->motion.x - last_x, event->motion.y - last_y);
- last_x = event->motion.x;
- last_y = event->motion.y;
- } else
- return FALSE;
- return TRUE;
-}
-
-static Node *
-e_table_create_nodes (ETable *e_table, ETableModel *model, ETableHeader *header,
- GnomeCanvasGroup *root, Node *parent, int *groups_list)
-{
- GArray *groups;
- ETableModel **tables;
- ETableCol *ecol;
- int key_col, i;
- GnomeCanvasItem *group_item;
- Node *group;
-
- key_col = *groups_list;
- g_assert (key_col != -1);
-
- /*
- * Create groups
- */
- ecol = e_table_header_get_column (header, key_col);
-
- g_assert (ecol != NULL);
-
- groups = e_table_create_groups (model, key_col, ecol->compare);
- tables = e_table_make_subtables (e_table->model, groups);
- e_table_destroy_groups (groups);
-
- group_item = e_table_group_new (root, ecol, TRUE, parent == NULL);
- group = node_new (group_item, model, parent);
-
- for (i = 0; tables [i] != NULL; i++){
- Node *node;
-
- /*
- * Leafs
- */
- if (groups_list [1] == -1){
- GnomeCanvasItem *item_leaf_header;
- Node *leaf_header;
-
- item_leaf_header = e_table_group_new (
- GNOME_CANVAS_GROUP (group_item), ecol, TRUE, FALSE);
- leaf_header = node_new (item_leaf_header, tables [i], group);
-
- e_table_create_leaf (e_table, tables [i], leaf_header);
- } else {
- e_table_create_nodes (
- e_table, tables [i], header, GNOME_CANVAS_GROUP (group_item),
- group, &groups_list [1]);
- }
- }
-
- return group;
-}
-
-static int *
-group_spec_to_desc (const char *group_spec)
-{
- int a_size = 10;
- int *elements;
- char *p, *copy, *follow;
- int n_elements = 0;
-
- if (group_spec == NULL)
- return NULL;
-
- elements = g_new (int, a_size);
- copy = alloca (strlen (group_spec) + 1);
- strcpy (copy, group_spec);
-
- while ((p = strtok_r (copy, ",", &follow)) != NULL){
- elements [n_elements] = atoi (p);
- ++n_elements;
- if (n_elements+1 == a_size){
- int *new_e;
-
- n_elements += 10;
- new_e = g_renew (int, elements, n_elements);
- if (new_e == NULL){
- g_free (elements);
- return NULL;
- }
- elements = new_e;
- }
- copy = NULL;
- }
-
- /* Tag end */
- elements [n_elements] = -1;
-
- return elements;
-}
-
-/*
- * The ETableCanvas object is just used to enable us to
- * hook up to the realize/unrealize phases of the canvas
- * initialization (as laying out the subtables requires us to
- * know the actual size of the subtables we are inserting
- */
-
-#define E_TABLE_CANVAS_PARENT_TYPE gnome_canvas_get_type ()
-
-typedef struct {
- GnomeCanvas base;
-
- ETable *e_table;
-} ETableCanvas;
-
-typedef struct {
- GnomeCanvasClass base_class;
-} ETableCanvasClass;
-
-static GnomeCanvasClass *e_table_canvas_parent_class;
-
-static void
-e_table_canvas_realize (GtkWidget *widget)
-{
- ETableCanvas *e_table_canvas = (ETableCanvas *) widget;
- ETable *e_table = e_table_canvas->e_table;
- int *groups;
- Node *leaf;
-
- GTK_WIDGET_CLASS (e_table_canvas_parent_class)->realize (widget);
-
- groups = group_spec_to_desc (e_table->group_spec);
-
- e_table->root = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (e_table->table_canvas->root),
- gnome_canvas_group_get_type (),
- "x", 0.0,
- "y", 0.0,
- NULL);
-
- leaf = e_table_create_nodes (
- e_table, e_table->model,
- e_table->header, GNOME_CANVAS_GROUP (e_table->root), 0, groups);
-
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_table_canvas),
- 0, 0,
- e_table_header_total_width (e_table->header) + 200,
- leaf_height (leaf));
-
- if (groups)
- g_free (groups);
-}
-
-static void
-e_table_canvas_unrealize (GtkWidget *widget)
-{
- ETableCanvas *e_table_canvas = (ETableCanvas *) widget;
- ETable *e_table = e_table_canvas->e_table;
-
- gtk_object_destroy (GTK_OBJECT (e_table->root));
- e_table->root = NULL;
-
- GTK_WIDGET_CLASS (e_table_canvas_parent_class)->unrealize (widget);
-}
-
-static void
-e_table_canvas_class_init (GtkObjectClass *object_class)
-{
- GtkWidgetClass *widget_class = (GtkWidgetClass *) object_class;
-
- widget_class->realize = e_table_canvas_realize;
- widget_class->unrealize = e_table_canvas_unrealize;
-
- e_table_canvas_parent_class = gtk_type_class (E_TABLE_CANVAS_PARENT_TYPE);
-}
-
-static void
-e_table_canvas_init (GtkObject *canvas)
-{
- GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS);
-}
-
-GtkType e_table_canvas_get_type (void);
-
-E_MAKE_TYPE (e_table_canvas, "ETableCanvas", ETableCanvas, e_table_canvas_class_init,
- e_table_canvas_init, E_TABLE_CANVAS_PARENT_TYPE);
-
-static GnomeCanvas *
-e_table_canvas_new (ETable *e_table)
-{
- ETableCanvas *e_table_canvas;
-
- e_table_canvas = gtk_type_new (e_table_canvas_get_type ());
- e_table_canvas->e_table = e_table;
-
- return GNOME_CANVAS (e_table_canvas);
-}
-
-static void
-e_table_setup_table (ETable *e_table)
-{
- e_table->table_canvas = e_table_canvas_new (e_table);
-
- gtk_widget_show (GTK_WIDGET (e_table->table_canvas));
- gtk_table_attach (
- GTK_TABLE (e_table), GTK_WIDGET (e_table->table_canvas),
- 0, 1, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
-}
-
-void
-e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
- const char *cols_spec, const char *group_spec)
-{
- GTK_TABLE (e_table)->homogeneous = FALSE;
-
- gtk_table_resize (GTK_TABLE (e_table), 1, 2);
-
- e_table->full_header = full_header;
- gtk_object_ref (GTK_OBJECT (full_header));
-
- e_table->model = etm;
- gtk_object_ref (GTK_OBJECT (etm));
-
- e_table->header = e_table_make_header (e_table, full_header, cols_spec);
-
- e_table_setup_header (e_table);
- e_table_setup_table (e_table);
-
- e_table->group_spec = g_strdup (group_spec);
-
-}
-
-GtkWidget *
-e_table_new (ETableHeader *full_header, ETableModel *etm, const char *cols_spec, const char *group_spec)
-{
- ETable *e_table;
-
- e_table = gtk_type_new (e_table_get_type ());
-
- e_table_construct (e_table, full_header, etm, cols_spec, group_spec);
-
- return (GtkWidget *) e_table;
-}
-
-static void
-e_table_class_init (GtkObjectClass *object_class)
-{
- e_table_parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = et_destroy;
-}
-
-E_MAKE_TYPE(e_table, "ETable", ETable, e_table_class_init, e_table_init, PARENT_TYPE);
-
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
deleted file mode 100644
index 63c131324f..0000000000
--- a/widgets/table/e-table.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef _E_TABLE_H_
-#define _E_TABLE_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gtk/gtktable.h>
-#include "e-table-model.h"
-#include "e-table-header.h"
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_TYPE (e_table_get_type ())
-#define E_TABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_TYPE, ETable))
-#define E_TABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_TYPE, ETableClass))
-#define E_IS_TABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_TYPE))
-#define E_IS_TABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_TYPE))
-
-typedef struct {
- GtkTable parent;
-
- ETableModel *model;
-
- ETableHeader *full_header, *header;
-
- GnomeCanvas *header_canvas, *table_canvas;
-
- GnomeCanvasItem *header_item, *root;
-
- guint draw_grid:1;
- guint draw_focus:1;
- guint spreadsheet:1;
-
- char *group_spec;
-} ETable;
-
-typedef struct {
- GtkTableClass parent_class;
-} ETableClass;
-
-GtkType e_table_get_type (void);
-void e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
- const char *cols_spec, const char *group_spec);
-GtkWidget *e_table_new (ETableHeader *full_header, ETableModel *etm,
- const char *cols_spec, const char *group_spec);
-
-
-END_GNOME_DECLS
-
- #endif /* _E_TABLE_H_ */
diff --git a/widgets/table/image1.png b/widgets/table/image1.png
deleted file mode 100644
index 8326ac241f..0000000000
--- a/widgets/table/image1.png
+++ /dev/null
Binary files differ
diff --git a/widgets/table/image2.png b/widgets/table/image2.png
deleted file mode 100644
index e6a4c75dbe..0000000000
--- a/widgets/table/image2.png
+++ /dev/null
Binary files differ
diff --git a/widgets/table/image3.png b/widgets/table/image3.png
deleted file mode 100644
index 50e16e8620..0000000000
--- a/widgets/table/image3.png
+++ /dev/null
Binary files differ
diff --git a/widgets/table/remove-col.xpm b/widgets/table/remove-col.xpm
deleted file mode 100644
index ff1024f0c9..0000000000
--- a/widgets/table/remove-col.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static char * remove_col_xpm[] = {
-"16 16 3 1",
-" c None",
-". c #000000",
-"+ c #FF0000",
-"... ...",
-".++. .++.",
-".+++. .+++.",
-" .+++. .+++. ",
-" .+++. .+++. ",
-" .+++..+++. ",
-" .++++++. ",
-" .++++. ",
-" .++++. ",
-" .++++++. ",
-" .+++..+++. ",
-" .+++. .+++. ",
-" .+++. .+++. ",
-".+++. .+++.",
-".++. .++.",
-"... ..."};
diff --git a/widgets/table/sample.table b/widgets/table/sample.table
deleted file mode 100644
index 45c8ff0691..0000000000
--- a/widgets/table/sample.table
+++ /dev/null
@@ -1,11 +0,0 @@
-Col1 Col2 Address Title Dorks
-c1.a c2.a a.a tit-1 DorkA
-c1.b c2.b a.b tit-2 DDork
-c1.c c2.c a.c tit-1 DorkB
-c1.d c2.d a.d tit-2 ADork
-c1.e c2.e a.e tit-1 DorkC
-c1.f c2.f a.f tit-2 UDork
-c1.g c2.g a.g tit-3 Dork---
-j k k tit-1 DorkA
-
-
diff --git a/widgets/table/table-test.c b/widgets/table/table-test.c
deleted file mode 100644
index e18f38c5ec..0000000000
--- a/widgets/table/table-test.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Test code for the ETable package
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <gnome.h>
-#include "e-util/e-cursors.h"
-#include "table-test.h"
-
-int
-main (int argc, char *argv [])
-{
-
- if (isatty (0)){
- int fd;
-
- close (0);
- fd = open ("sample.table", O_RDONLY);
- if (fd == -1){
- fprintf (stderr, "Could not find sample.table, try feeding a table on stdin");
- exit (1);
- }
- dup2 (fd, 0);
- }
-
- gnome_init ("TableTest", "TableTest", argc, argv);
- e_cursors_init ();
-
- table_browser_test ();
- multi_cols_test ();
- check_test ();
- e_table_test ();
-
- gtk_main ();
-
- e_cursors_shutdown ();
- return 0;
-}
diff --git a/widgets/table/table-test.h b/widgets/table/table-test.h
deleted file mode 100644
index ad8cfcc083..0000000000
--- a/widgets/table/table-test.h
+++ /dev/null
@@ -1,4 +0,0 @@
-void table_browser_test (void);
-void multi_cols_test (void);
-void check_test (void);
-void e_table_test (void);
diff --git a/widgets/table/test-check.c b/widgets/table/test-check.c
deleted file mode 100644
index 8cc5f6834e..0000000000
--- a/widgets/table/test-check.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Test code for the ETable package
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <gnome.h>
-#include "e-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-util/e-cursors.h"
-#include "e-cell-text.h"
-#include "e-cell-checkbox.h"
-
-#include "table-test.h"
-
-#define LINES 4
-
-static struct {
- int value;
- char *string;
-} my_table [LINES] = {
- { 0, "Buy food" },
- { 1, "Breathe " },
- { 0, "Cancel gdb session with shrink" },
- { 1, "Make screenshots" },
-};
-/*
- * ETableSimple callbacks
- */
-static int
-col_count (ETableModel *etc, void *data)
-{
- return 2;
-}
-
-static int
-row_count (ETableModel *etc, void *data)
-{
- return LINES;
-}
-
-static void *
-value_at (ETableModel *etc, int col, int row, void *data)
-{
- g_assert (col < 2);
- g_assert (row < LINES);
-
- if (col == 0)
- return GINT_TO_POINTER (my_table [row].value);
- else
- return my_table [row].string;
-
-}
-
-static void
-set_value_at (ETableModel *etc, int col, int row, const void *val, void *data)
-{
- g_assert (col < 2);
- g_assert (row < LINES);
-
- if (col == 0){
- my_table [row].value = GPOINTER_TO_INT (val);
- printf ("Value at %d,%d set to %d\n", col, row, GPOINTER_TO_INT (val));
- } else {
- my_table [row].string = g_strdup (val);
- printf ("Value at %d,%d set to %s\n", col, row, (char *) val);
- }
-}
-
-static gboolean
-is_cell_editable (ETableModel *etc, int col, int row, void *data)
-{
- return TRUE;
-}
-
-static void
-set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc)
-{
- gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height);
-}
-
-void
-check_test (void)
-{
- GtkWidget *canvas, *window;
- ETableModel *e_table_model;
- ETableHeader *e_table_header;
- ETableCol *col_0, *col_1;
- ECell *cell_left_just, *cell_image_check;
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- e_table_model = e_table_simple_new (
- col_count, row_count, value_at,
- set_value_at, is_cell_editable, NULL);
-
- /*
- * Header
- */
- e_table_header = e_table_header_new ();
-
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- cell_image_check = e_cell_checkbox_new ();
- col_0 = e_table_col_new (0, "", 18, 18, cell_image_check, g_int_equal, TRUE);
- e_table_header_add_column (e_table_header, col_0, 0);
-
- col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
- e_table_header_add_column (e_table_header, col_1, 1);
-
- /*
- * GUI
- */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- canvas = gnome_canvas_new ();
-
- gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate",
- GTK_SIGNAL_FUNC (set_canvas_size), NULL);
-
- gtk_container_add (GTK_CONTAINER (window), canvas);
- gtk_widget_show_all (window);
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_header_item_get_type (),
- "ETableHeader", e_table_header,
- "x", 0,
- "y", 0,
- NULL);
-
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_item_get_type (),
- "ETableHeader", e_table_header,
- "ETableModel", e_table_model,
- "x", (double) 0,
- "y", (double) 30,
- "drawgrid", TRUE,
- "drawfocus", TRUE,
- "spreadsheet", TRUE,
- NULL);
-
-}
-
-
-
-
-
diff --git a/widgets/table/test-cols.c b/widgets/table/test-cols.c
deleted file mode 100644
index 288e2bd408..0000000000
--- a/widgets/table/test-cols.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Test code for the ETable package
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <gnome.h>
-#include "e-util/e-cursors.h"
-#include "e-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-cell-text.h"
-#include "e-cell-toggle.h"
-
-#include "table-test.h"
-
-#define LINES 4
-
-static struct {
- int value;
- char *string;
-} my_table [LINES] = {
- { 0, "You are not" },
- { 1, "A beautiful and unique " },
- { 0, "Snowflake" },
- { 2, "You are not your wallet" },
-};
-/*
- * ETableSimple callbacks
- */
-static int
-col_count (ETableModel *etc, void *data)
-{
- return 2;
-}
-
-static int
-row_count (ETableModel *etc, void *data)
-{
- return LINES;
-}
-
-static void *
-value_at (ETableModel *etc, int col, int row, void *data)
-{
- g_assert (col < 2);
- g_assert (row < LINES);
-
- if (col == 0)
- return GINT_TO_POINTER (my_table [row].value);
- else
- return my_table [row].string;
-
-}
-
-static void
-set_value_at (ETableModel *etc, int col, int row, const void *val, void *data)
-{
- g_assert (col < 2);
- g_assert (row < LINES);
-
- if (col == 0){
- my_table [row].value = GPOINTER_TO_INT (val);
- printf ("Value at %d,%d set to %d\n", col, row, GPOINTER_TO_INT (val));
- } else {
- my_table [row].string = g_strdup (val);
- printf ("Value at %d,%d set to %s\n", col, row, (char *) val);
- }
-}
-
-static gboolean
-is_cell_editable (ETableModel *etc, int col, int row, void *data)
-{
- return TRUE;
-}
-
-static void
-set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc)
-{
- gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height);
-}
-
-void
-multi_cols_test (void)
-{
- GtkWidget *canvas, *window;
- ETableModel *e_table_model;
- ETableHeader *e_table_header, *e_table_header_multiple;
- ETableCol *col_0, *col_1;
- ECell *cell_left_just, *cell_image_toggle;
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- e_table_model = e_table_simple_new (
- col_count, row_count, value_at,
- set_value_at, is_cell_editable, NULL);
-
- /*
- * Header
- */
- e_table_header = e_table_header_new ();
-
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- {
- GdkPixbuf **images = g_new (GdkPixbuf *, 3);
- int i;
-
- images [0] = gdk_pixbuf_new_from_file ("image1.png");
- images [1] = gdk_pixbuf_new_from_file ("image2.png");
- images [2] = gdk_pixbuf_new_from_file ("image3.png");
-
- cell_image_toggle = e_cell_toggle_new (0, 3, images);
-
- for (i = 0; i < 3; i++)
- gdk_pixbuf_unref (images [i]);
-
- g_free (images);
- }
-
- col_1 = e_table_col_new (1, "Item Name", 180, 20, cell_left_just, g_str_equal, TRUE);
- e_table_header_add_column (e_table_header, col_1, 0);
-
- col_0 = e_table_col_new (0, "A", 48, 48, cell_image_toggle, g_int_equal, TRUE);
- e_table_header_add_column (e_table_header, col_0, 1);
-
- /*
- * Second test
- */
- e_table_header_multiple = e_table_header_new ();
- e_table_header_add_column (e_table_header_multiple, col_0, 0);
- e_table_header_add_column (e_table_header_multiple, col_1, 1);
- e_table_header_add_column (e_table_header_multiple, col_1, 2);
-
- /*
- * GUI
- */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- canvas = gnome_canvas_new ();
-
- gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate",
- GTK_SIGNAL_FUNC (set_canvas_size), NULL);
-
- gtk_container_add (GTK_CONTAINER (window), canvas);
- gtk_widget_show_all (window);
-
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_header_item_get_type (),
- "ETableHeader", e_table_header,
- "x", 0,
- "y", 0,
- NULL);
-
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_item_get_type (),
- "ETableHeader", e_table_header,
- "ETableModel", e_table_model,
- "x", (double) 0,
- "y", (double) 30,
- "drawgrid", TRUE,
- "drawfocus", TRUE,
- "spreadsheet", TRUE,
- NULL);
-
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_header_item_get_type (),
- "ETableHeader", e_table_header_multiple,
- "x", 300,
- "y", 0,
- NULL);
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_item_get_type (),
- "ETableHeader", e_table_header_multiple,
- "ETableModel", e_table_model,
- "x", (double) 300,
- "y", (double) 30,
- "drawgrid", TRUE,
- "drawfocus", TRUE,
- "spreadsheet", TRUE,
- NULL);
-
-}
-
-
-
-
-
diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c
deleted file mode 100644
index 053f81cfa6..0000000000
--- a/widgets/table/test-table.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Test code for the ETable package
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <gnome.h>
-#include "e-util/e-cursors.h"
-#include "e-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-cell-text.h"
-#include "e-table.h"
-
-#include "table-test.h"
-
-char buffer [1024];
-char **column_labels;
-char ***table_data;
-int cols = 0;
-int lines = 0;
-int lines_alloc = 0;
-
-static void
-parse_headers ()
-{
- char *p, *s;
- int in_value = 0, i;
-
- fgets (buffer, sizeof (buffer)-1, stdin);
-
- for (p = buffer; *p; p++){
- if (*p == ' ' || *p == '\t'){
- if (in_value){
- cols++;
- in_value = 0;
- }
- } else
- in_value = 1;
- }
- if (in_value)
- cols++;
-
- if (!cols){
- fprintf (stderr, "No columns in first row\n");
- exit (1);
- }
-
- column_labels = g_new0 (char *, cols);
-
- p = buffer;
- for (i = 0; (s = strtok (p, " \t")) != NULL; i++){
- column_labels [i] = g_strdup (s);
- p = NULL;
- }
-
- printf ("%d headers:\n", cols);
- for (i = 0; i < cols; i++){
- printf ("header %d: %s\n", i, column_labels [i]);
- }
-}
-
-static char **
-load_line (char *buffer, int cols)
-{
- char **line = g_new0 (char *, cols);
- char *p;
- int i;
-
- for (i = 0; i < cols; i++){
- p = strtok (buffer, " \t\n");
- if (p == NULL){
- for (; i < cols; i++)
- line [i] = g_strdup ("");
- return line;
- } else
- line [i] = g_strdup (p);
- buffer = NULL;
- }
- return line;
-}
-
-static void
-append_line (char **line)
-{
- if (lines <= lines_alloc){
- lines_alloc = lines + 50;
- table_data = g_renew (char **, table_data, lines_alloc);
- }
- table_data [lines] = line;
- lines++;
-}
-
-static void
-load_data ()
-{
- int i;
-
- {
- static int loaded;
-
- if (loaded)
- return;
-
- loaded = TRUE;
- }
-
-
- parse_headers ();
-
- while (fgets (buffer, sizeof (buffer)-1, stdin) != NULL){
- char **line;
-
- if (buffer [0] == '\n')
- continue;
- line = load_line (buffer, cols);
- append_line (line);
- }
-
- for (i = 0; i < lines; i++){
- int j;
-
- printf ("Line %d: ", i);
- for (j = 0; j < cols; j++)
- printf ("[%s] ", table_data [i][j]);
- printf ("\n");
- }
-}
-
-/*
- * ETableSimple callbacks
- */
-static int
-col_count (ETableModel *etc, void *data)
-{
- return cols;
-}
-
-static int
-row_count (ETableModel *etc, void *data)
-{
- return lines;
-}
-
-static void *
-value_at (ETableModel *etc, int col, int row, void *data)
-{
- g_assert (col < cols);
- g_assert (row < lines);
-
- return (void *) table_data [row][col];
-}
-
-static void
-set_value_at (ETableModel *etc, int col, int row, const void *val, void *data)
-{
- g_assert (col < cols);
- g_assert (row < lines);
-
- g_free (table_data [row][col]);
- table_data [row][col] = g_strdup (val);
-
- printf ("Value at %d,%d set to %s\n", col, row, (char *) val);
-}
-
-static gboolean
-is_cell_editable (ETableModel *etc, int col, int row, void *data)
-{
- return TRUE;
-}
-
-static void
-set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc)
-{
- gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height);
-}
-
-void
-table_browser_test (void)
-{
- GtkWidget *canvas, *window;
- ETableModel *e_table_model;
- ETableHeader *e_table_header;
- ECell *cell_left_just;
- GnomeCanvasItem *group;
- int i;
-
- load_data ();
-
- /*
- * Data model
- */
- e_table_model = e_table_simple_new (
- col_count, row_count, value_at,
- set_value_at, is_cell_editable, NULL);
-
- /*
- * Header
- */
- e_table_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- for (i = 0; i < cols; i++){
- ETableCol *ecol = e_table_col_new (
- i, column_labels [i],
- 80, 20, cell_left_just,
- g_str_equal, TRUE);
-
- e_table_header_add_column (e_table_header, ecol, i);
- }
-
- /*
- * Setup GUI
- */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- canvas = gnome_canvas_new ();
-
- gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate",
- GTK_SIGNAL_FUNC (set_canvas_size), NULL);
-
- gtk_container_add (GTK_CONTAINER (window), canvas);
- gtk_widget_show_all (window);
- gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_table_header_item_get_type (),
- "ETableHeader", e_table_header,
- "x", 0,
- "y", 0,
- NULL);
-
- group = gnome_canvas_item_new (
- gnome_canvas_root (GNOME_CANVAS (canvas)),
- gnome_canvas_group_get_type (),
- "x", 30.0,
- "y", 30.0,
- NULL);
-
- gnome_canvas_item_new (
- GNOME_CANVAS_GROUP (group),
- e_table_item_get_type (),
- "ETableHeader", e_table_header,
- "ETableModel", e_table_model,
- "x", (double) 0,
- "y", (double) 0,
- "drawgrid", TRUE,
- "drawfocus", TRUE,
- "spreadsheet", TRUE,
- NULL);
-}
-
-static void
-do_e_table_demo (const char *col_spec, const char *group_spec)
-{
- GtkWidget *e_table, *window;
- ETableModel *e_table_model;
- ECell *cell_left_just;
- ETableHeader *full_header;
- int i;
-
- /*
- * Data model
- */
- e_table_model = e_table_simple_new (
- col_count, row_count, value_at,
- set_value_at, is_cell_editable, NULL);
-
- full_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- for (i = 0; i < cols; i++){
- ETableCol *ecol = e_table_col_new (
- i, column_labels [i],
- 80, 20, cell_left_just,
- g_str_equal, TRUE);
-
- e_table_header_add_column (full_header, ecol, i);
- }
-
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- e_table = e_table_new (full_header, e_table_model, col_spec, group_spec);
-
- gtk_container_add (GTK_CONTAINER (window), e_table);
-
- gtk_widget_set_usize (window, 200, 200);
- gtk_widget_show (e_table);
- gtk_widget_show (window);
-}
-
-void
-e_table_test (void)
-{
- load_data ();
-
- if (getenv ("DO")){
- do_e_table_demo ("0,1,2,3,4", NULL);
- do_e_table_demo ("0,1,2,3,4", "3,4");
- }
- do_e_table_demo ("0,1,2,3,4", "3");
-}
diff --git a/widgets/table/test.c b/widgets/table/test.c
deleted file mode 100644
index 0eece34467..0000000000
--- a/widgets/table/test.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <config.h>
-#include "e-table-simple.h"
-
-struct {
- char *str;
- int val;
-} data [] = {
- { "Miguel", 10 },
- { "Nat", 20 },
- { NULL, 0 },
-};
-
-main ()
-{
-
-}
-