aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobody <nobody@localhost>1999-12-25 22:31:23 +0800
committernobody <nobody@localhost>1999-12-25 22:31:23 +0800
commit07ac3031d3e1c48c3c0f1bee774b250136b310a1 (patch)
tree7d0d3756e5b4657c67be691910240a559b06c3cc
parent9c84a9253936ded67c4ab3d8fb9a8b357a533411 (diff)
downloadgsoc2013-evolution-NEW_DEPS.tar
gsoc2013-evolution-NEW_DEPS.tar.gz
gsoc2013-evolution-NEW_DEPS.tar.bz2
gsoc2013-evolution-NEW_DEPS.tar.lz
gsoc2013-evolution-NEW_DEPS.tar.xz
gsoc2013-evolution-NEW_DEPS.tar.zst
gsoc2013-evolution-NEW_DEPS.zip
This commit was manufactured by cvs2svn to create tag 'NEW_DEPS'.NEW_DEPS
svn path=/tags/NEW_DEPS/; revision=1517
-rw-r--r--.cvsignore20
-rw-r--r--ABOUT-NLS226
-rw-r--r--AUTHORS10
-rw-r--r--COPYING340
-rw-r--r--ChangeLog1907
-rw-r--r--INSTALL182
-rw-r--r--MAINTAINERS2
-rw-r--r--Makefile.am12
-rw-r--r--NEWS8
-rw-r--r--README3
-rw-r--r--acconfig.h14
-rwxr-xr-xautogen.sh10
-rw-r--r--calendar/.cvsignore12
-rw-r--r--calendar/AUTHORS4
-rw-r--r--calendar/ChangeLog2351
-rw-r--r--calendar/GnomeCal.idl115
-rw-r--r--calendar/Makefile.am223
-rw-r--r--calendar/TODO68
-rw-r--r--calendar/alarm.c250
-rw-r--r--calendar/alarm.h12
-rw-r--r--calendar/bell.xpm83
-rw-r--r--calendar/cal-util/calobj.c1490
-rw-r--r--calendar/cal-util/calobj.h215
-rw-r--r--calendar/cal_struct.h27
-rw-r--r--calendar/calendar-conduit-control-applet.c362
-rw-r--r--calendar/calendar-conduit-control-applet.desktop7
-rw-r--r--calendar/calendar-conduit.c1433
-rw-r--r--calendar/calendar-conduit.h138
-rw-r--r--calendar/calendar-pilot-sync.c658
-rw-r--r--calendar/calendar.c644
-rw-r--r--calendar/calendar.h83
-rw-r--r--calendar/calobj.c1490
-rw-r--r--calendar/calobj.h215
-rw-r--r--calendar/conduits/calendar/calendar-conduit-control-applet.c362
-rw-r--r--calendar/conduits/calendar/calendar-conduit-control-applet.desktop7
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c1433
-rw-r--r--calendar/conduits/calendar/calendar-conduit.h138
-rw-r--r--calendar/conduits/todo/todo-conduit-control-applet.c287
-rw-r--r--calendar/conduits/todo/todo-conduit-control-applet.desktop6
-rw-r--r--calendar/conduits/todo/todo-conduit.c256
-rw-r--r--calendar/conduits/todo/todo-conduit.h59
-rw-r--r--calendar/corba-cal-factory.c130
-rw-r--r--calendar/corba-cal-factory.h11
-rw-r--r--calendar/corba-cal.c331
-rw-r--r--calendar/corba-cal.h6
-rw-r--r--calendar/doc/.cvsignore2
-rw-r--r--calendar/doc/C/.cvsignore5
-rw-r--r--calendar/doc/C/Makefile.am44
-rw-r--r--calendar/doc/C/gnomecal.sgml465
-rw-r--r--calendar/doc/C/images/cal-props.gifbin8929 -> 0 bytes
-rw-r--r--calendar/doc/C/images/calday.gifbin16264 -> 0 bytes
-rw-r--r--calendar/doc/C/images/calmonth.gifbin13299 -> 0 bytes
-rw-r--r--calendar/doc/C/images/calweek.gifbin14650 -> 0 bytes
-rw-r--r--calendar/doc/C/images/calyear.gifbin27058 -> 0 bytes
-rw-r--r--calendar/doc/C/topic.dat2
-rw-r--r--calendar/doc/Makefile.am1
-rw-r--r--calendar/eventedit.c1580
-rw-r--r--calendar/eventedit.h83
-rw-r--r--calendar/getdate.y1001
-rw-r--r--calendar/gncal-day-panel.c277
-rw-r--r--calendar/gncal-day-panel.h65
-rw-r--r--calendar/gncal-day-view.c396
-rw-r--r--calendar/gncal-day-view.h56
-rw-r--r--calendar/gncal-full-day.c2287
-rw-r--r--calendar/gncal-full-day.h74
-rw-r--r--calendar/gncal-todo.c877
-rw-r--r--calendar/gncal-todo.h55
-rw-r--r--calendar/gncal-week-view.c255
-rw-r--r--calendar/gncal-week-view.h57
-rw-r--r--calendar/gncal.desktop35
-rw-r--r--calendar/gnome-cal.c613
-rw-r--r--calendar/gnome-cal.h82
-rw-r--r--calendar/gnome-cal.html44
-rw-r--r--calendar/gnome-calendar-conduit.pngbin3000 -> 0 bytes
-rw-r--r--calendar/gnome-month-item.c1246
-rw-r--r--calendar/gnome-month-item.h165
-rw-r--r--calendar/gnomecal.gnorba11
-rw-r--r--calendar/goto.c323
-rw-r--r--calendar/gui/GnomeCal.idl115
-rw-r--r--calendar/gui/Makefile.am223
-rw-r--r--calendar/gui/alarm-notify/alarm.c250
-rw-r--r--calendar/gui/alarm-notify/alarm.h12
-rw-r--r--calendar/gui/alarm.c250
-rw-r--r--calendar/gui/alarm.h12
-rw-r--r--calendar/gui/bell.xpm83
-rw-r--r--calendar/gui/cal_struct.h27
-rw-r--r--calendar/gui/calendar-conduit-control-applet.c362
-rw-r--r--calendar/gui/calendar-conduit-control-applet.desktop7
-rw-r--r--calendar/gui/calendar-conduit.c1433
-rw-r--r--calendar/gui/calendar-conduit.h138
-rw-r--r--calendar/gui/calendar-pilot-sync.c658
-rw-r--r--calendar/gui/calendar.c644
-rw-r--r--calendar/gui/calendar.h83
-rw-r--r--calendar/gui/corba-cal-factory.c130
-rw-r--r--calendar/gui/corba-cal-factory.h11
-rw-r--r--calendar/gui/corba-cal.c331
-rw-r--r--calendar/gui/corba-cal.h6
-rw-r--r--calendar/gui/eventedit.c1580
-rw-r--r--calendar/gui/eventedit.h83
-rw-r--r--calendar/gui/getdate.y1001
-rw-r--r--calendar/gui/gncal-day-panel.c277
-rw-r--r--calendar/gui/gncal-day-panel.h65
-rw-r--r--calendar/gui/gncal-day-view.c396
-rw-r--r--calendar/gui/gncal-day-view.h56
-rw-r--r--calendar/gui/gncal-full-day.c2287
-rw-r--r--calendar/gui/gncal-full-day.h74
-rw-r--r--calendar/gui/gncal-todo.c877
-rw-r--r--calendar/gui/gncal-todo.h55
-rw-r--r--calendar/gui/gncal-week-view.c255
-rw-r--r--calendar/gui/gncal-week-view.h57
-rw-r--r--calendar/gui/gncal.desktop35
-rw-r--r--calendar/gui/gnome-cal.c613
-rw-r--r--calendar/gui/gnome-cal.h82
-rw-r--r--calendar/gui/gnome-cal.html44
-rw-r--r--calendar/gui/gnome-calendar-conduit.pngbin3000 -> 0 bytes
-rw-r--r--calendar/gui/gnome-month-item.c1246
-rw-r--r--calendar/gui/gnome-month-item.h165
-rw-r--r--calendar/gui/gnomecal.gnorba11
-rw-r--r--calendar/gui/goto.c323
-rw-r--r--calendar/gui/icalendar-types39
-rw-r--r--calendar/gui/layout.c287
-rw-r--r--calendar/gui/layout.h37
-rw-r--r--calendar/gui/main.c1059
-rw-r--r--calendar/gui/main.h101
-rw-r--r--calendar/gui/mark.c269
-rw-r--r--calendar/gui/mark.h58
-rw-r--r--calendar/gui/month-view.c798
-rw-r--r--calendar/gui/month-view.h72
-rw-r--r--calendar/gui/popup-menu.c37
-rw-r--r--calendar/gui/popup-menu.h25
-rw-r--r--calendar/gui/prop.c927
-rw-r--r--calendar/gui/quick-view.c274
-rw-r--r--calendar/gui/quick-view.h59
-rw-r--r--calendar/gui/recur.xpm83
-rw-r--r--calendar/gui/test.vcf133
-rw-r--r--calendar/gui/todo-conduit-control-applet.c287
-rw-r--r--calendar/gui/todo-conduit-control-applet.desktop6
-rw-r--r--calendar/gui/todo-conduit.c256
-rw-r--r--calendar/gui/todo-conduit.h59
-rw-r--r--calendar/gui/topic.dat2
-rw-r--r--calendar/gui/view-utils.c201
-rw-r--r--calendar/gui/view-utils.h28
-rw-r--r--calendar/gui/week-view.c100
-rw-r--r--calendar/gui/week-view.h63
-rw-r--r--calendar/gui/year-view.c741
-rw-r--r--calendar/gui/year-view.h77
-rw-r--r--calendar/html-month.c110
-rw-r--r--calendar/icalendar-types39
-rw-r--r--calendar/layout.c287
-rw-r--r--calendar/layout.h37
-rw-r--r--calendar/main.c1059
-rw-r--r--calendar/main.h101
-rw-r--r--calendar/mark.c269
-rw-r--r--calendar/mark.h58
-rw-r--r--calendar/month-view.c798
-rw-r--r--calendar/month-view.h72
-rw-r--r--calendar/pcs/calobj.c1490
-rw-r--r--calendar/pcs/calobj.h215
-rw-r--r--calendar/popup-menu.c37
-rw-r--r--calendar/popup-menu.h25
-rw-r--r--calendar/prop.c927
-rw-r--r--calendar/quick-view.c274
-rw-r--r--calendar/quick-view.h59
-rw-r--r--calendar/recur.xpm83
-rw-r--r--calendar/test.vcf133
-rw-r--r--calendar/timeutil.c501
-rw-r--r--calendar/timeutil.h81
-rw-r--r--calendar/todo-conduit-control-applet.c287
-rw-r--r--calendar/todo-conduit-control-applet.desktop6
-rw-r--r--calendar/todo-conduit.c256
-rw-r--r--calendar/todo-conduit.h59
-rw-r--r--calendar/topic.dat2
-rw-r--r--calendar/view-utils.c201
-rw-r--r--calendar/view-utils.h28
-rw-r--r--calendar/week-view.c100
-rw-r--r--calendar/week-view.h63
-rw-r--r--calendar/year-view.c741
-rw-r--r--calendar/year-view.h77
-rw-r--r--camel/.cvsignore7
-rw-r--r--camel/CODING.STYLE19
-rw-r--r--camel/Makefile.am119
-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.def15
-rw-r--r--camel/camel-exception.c198
-rw-r--r--camel/camel-exception.h77
-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/Makefile.am26
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c509
-rw-r--r--camel/providers/mbox/camel-mbox-folder.h72
-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.c256
-rw-r--r--camel/string-utils.h70
-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.am45
-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.in113
-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/e-cursors.c128
-rw-r--r--e-util/e-cursors.h33
-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--libversit/.cvsignore3
-rw-r--r--libversit/Makefile.am13
-rw-r--r--libversit/README.TXT951
-rw-r--r--libversit/port.h88
-rw-r--r--libversit/vcaltest.c118
-rw-r--r--libversit/vcaltmp.c337
-rw-r--r--libversit/vcaltmp.h128
-rw-r--r--libversit/vcc.c2142
-rw-r--r--libversit/vcc.h80
-rw-r--r--libversit/vcc.y1218
-rw-r--r--libversit/vctest.c95
-rw-r--r--libversit/vobject.c1428
-rw-r--r--libversit/vobject.h366
-rw-r--r--po/.cvsignore11
-rw-r--r--po/ChangeLog7
-rw-r--r--po/POTFILES.in0
-rw-r--r--stamp.h.in1
-rw-r--r--tests/.cvsignore11
-rw-r--r--tests/Makefile.am26
-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/ChangeLog544
-rw-r--r--widgets/Makefile.am65
-rw-r--r--widgets/ROADMAP.e-table113
-rw-r--r--widgets/TODO24
-rw-r--r--widgets/add-col.xpm22
-rw-r--r--widgets/check-empty.xpm21
-rw-r--r--widgets/check-filled.xpm21
-rw-r--r--widgets/e-cell-checkbox.c44
-rw-r--r--widgets/e-cell-checkbox.h24
-rw-r--r--widgets/e-cell-string.c9
-rw-r--r--widgets/e-cell-text.c484
-rw-r--r--widgets/e-cell-text.h28
-rw-r--r--widgets/e-cell-toggle.c284
-rw-r--r--widgets/e-cell-toggle.h35
-rw-r--r--widgets/e-cell.c152
-rw-r--r--widgets/e-cell.h63
-rw-r--r--widgets/e-cursors.c128
-rw-r--r--widgets/e-cursors.h33
-rw-r--r--widgets/e-table-col-dnd.h10
-rw-r--r--widgets/e-table-col.c64
-rw-r--r--widgets/e-table-col.h44
-rw-r--r--widgets/e-table-column-item.c199
-rw-r--r--widgets/e-table-column-item.h20
-rw-r--r--widgets/e-table-column-model.h5
-rw-r--r--widgets/e-table-column.c293
-rw-r--r--widgets/e-table-group.c139
-rw-r--r--widgets/e-table-group.h35
-rw-r--r--widgets/e-table-header-item.c793
-rw-r--r--widgets/e-table-header-item.h56
-rw-r--r--widgets/e-table-header.c342
-rw-r--r--widgets/e-table-header.h65
-rw-r--r--widgets/e-table-item.c1188
-rw-r--r--widgets/e-table-item.h104
-rw-r--r--widgets/e-table-model.c176
-rw-r--r--widgets/e-table-model.h60
-rw-r--r--widgets/e-table-render.c20
-rw-r--r--widgets/e-table-render.h21
-rw-r--r--widgets/e-table-simple.c111
-rw-r--r--widgets/e-table-simple.h37
-rw-r--r--widgets/e-table-sorted.c89
-rw-r--r--widgets/e-table-sorted.h29
-rw-r--r--widgets/e-table-subset.c178
-rw-r--r--widgets/e-table-subset.h32
-rw-r--r--widgets/e-table-tree.h19
-rw-r--r--widgets/e-table.c508
-rw-r--r--widgets/e-table.h53
-rw-r--r--widgets/e-table/.cvsignore7
-rw-r--r--widgets/e-table/ChangeLog544
-rw-r--r--widgets/e-table/Makefile.am65
-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.c484
-rw-r--r--widgets/e-table/e-cell-text.h28
-rw-r--r--widgets/e-table/e-cell-toggle.c284
-rw-r--r--widgets/e-table/e-cell-toggle.h35
-rw-r--r--widgets/e-table/e-cell.c152
-rw-r--r--widgets/e-table/e-cell.h63
-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.c139
-rw-r--r--widgets/e-table/e-table-group.h35
-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.c1188
-rw-r--r--widgets/e-table/e-table-item.h104
-rw-r--r--widgets/e-table/e-table-model.c176
-rw-r--r--widgets/e-table/e-table-model.h60
-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.c508
-rw-r--r--widgets/e-table/e-table.h53
-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.c45
-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.c300
-rw-r--r--widgets/e-table/test.c17
-rw-r--r--widgets/e-util.h24
-rw-r--r--widgets/image1.pngbin1858 -> 0 bytes
-rw-r--r--widgets/image2.pngbin1987 -> 0 bytes
-rw-r--r--widgets/image3.pngbin2051 -> 0 bytes
-rw-r--r--widgets/meeting-time-sel/.cvsignore7
-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/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/remove-col.xpm22
-rw-r--r--widgets/sample.table11
-rw-r--r--widgets/table-test.c45
-rw-r--r--widgets/table-test.h4
-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.c484
-rw-r--r--widgets/table/e-cell-text.h28
-rw-r--r--widgets/table/e-cell-toggle.c284
-rw-r--r--widgets/table/e-cell-toggle.h35
-rw-r--r--widgets/table/e-cell.c152
-rw-r--r--widgets/table/e-cell.h63
-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.c139
-rw-r--r--widgets/table/e-table-group.h35
-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.c1188
-rw-r--r--widgets/table/e-table-item.h104
-rw-r--r--widgets/table/e-table-model.c176
-rw-r--r--widgets/table/e-table-model.h60
-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.c508
-rw-r--r--widgets/table/e-table.h53
-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.c45
-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.c300
-rw-r--r--widgets/table/test.c17
-rw-r--r--widgets/test-check.c153
-rw-r--r--widgets/test-cols.c196
-rw-r--r--widgets/test-table.c300
-rw-r--r--widgets/test.c17
562 files changed, 0 insertions, 119389 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 c37775e095..0000000000
--- a/ChangeLog
+++ /dev/null
@@ -1,1907 +0,0 @@
-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 b9e2e7819d..0000000000
--- a/MAINTAINERS
+++ /dev/null
@@ -1,2 +0,0 @@
-Email: Bertrand.Guiheneuf@aful.org
-
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 280f2610c4..0000000000
--- a/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-SUBDIRS = \
- po \
- macros \
- camel \
- 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/calendar/.cvsignore b/calendar/.cvsignore
deleted file mode 100644
index 7f966ac096..0000000000
--- a/calendar/.cvsignore
+++ /dev/null
@@ -1,12 +0,0 @@
-Makefile.in
-Makefile
-.deps
-_libs
-.libs
-gncal
-gnomecal
-getdate.c
-GnomeCal-skels.c
-GnomeCal-common.c
-GnomeCal.h
-calendar-pilot-sync
diff --git a/calendar/AUTHORS b/calendar/AUTHORS
deleted file mode 100644
index 374733f0e2..0000000000
--- a/calendar/AUTHORS
+++ /dev/null
@@ -1,4 +0,0 @@
-Miguel de Icaza <miguel@kernel.org>
-Federico Mena <quartic@gimp.org>
-Arturo Esponosa <arturo@nuclecu.unam.mx>
-Russell Steinthal <rms39@columbia.edu>
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
deleted file mode 100644
index 616db438da..0000000000
--- a/calendar/ChangeLog
+++ /dev/null
@@ -1,2351 +0,0 @@
-1999-12-10 Russell Steinthal <rms39@columbia.edu>
-
- * eventedit.c (ee_create_ae): Fix sensitivity bug when used to
- create default alarm box (widgets in that box should always be
- sensitive, even if the enabled checkbutton is not set)
-
-1999-12-08 Eskil Heyn Olsen <deity@eskil.dk>
-
- * calendar-conduit-control-applet.c (setSettings): Capplets now
- sets first_sync on enable, this should make the conduit copy old
- entries from the pilot to gnomecal.
-
-1999-12-07 Eskil Heyn Olsen <deity@eskil.dk>
-
- * calendar-conduit.c (pre_sync): Check if local store is
- empty. If, force slow sync.
-
- * GnomeCal.idl (GNOME): Added get_number_of_objects.
-
- * corba-cal.c (cal_repo_get_number_of_objects): implemented the
- get_number_of_objects.
-
- * calendar-conduit-control-applet.c (setStateCfg): Fixed bug that
- caused the capplet to always set the sync action to Disable upon start.
-
-1999-12-05 Eskil Heyn Olsen <deity@eskil.dk>
-
- * Makefile.am (Conduits_second_DATA): Also install .desktop files
- for conduit capplets in the gnome/apps menu dir.
-
->>>>>>> 1.252
-1999-12-04 Eskil Heyn Olsen <deity@eskil.dk>
-
- * Makefile.am (EXTRA_DIST): Added .desktop files to EXTRA_DIST.
-
-1999-10-12 Clifford R. Conover <rusty@zootweb.com>
-
- * gncal-todo.c Todo List improvements.
-
- Cleaned up todo item highlighting, added support for highlighting
- events due today, and events not due yet. Colors are configurable
- on the Colors Tab of the properties window.
-
- Renamed Frame in Properties window to Colors rather then Month
- Colors since we are now asking for Todo item colors.
-
- Added ability to display time until todo item is due in list, it
- automatically selects the best denomination of time (up to weeks)
- and down to seconds to display. This should be made configurable
- in a future version.
-
- Changed Todo dialog to ask for time that event is due. This
- allows more accurate tracking of then the item is due, before the
- dialog was only asking for the date of the todo item.
-
-1999-12-03 Eskil Heyn Olsen <deity@eskil.dk>
-
- * calendar-conduit.c: undef DEBUG_CALCONDUT, suppresses debug output.
-
-1999-12-02 Russell Steinthal <rms39@columbia.edu>
-
- * alarm.c: Enhanced debug support: can be toggled on and off by
- SIGUSR1, reports alarms which could not be added
-
- * gnome-cal.c, main.[ch], prop.c: Add snooze capability for audio
- and display alarms. Snooze interval can be configured in the
- Properties box.
-
-1999-11-30 Eskil Heyn Olsen <deity@eskil.dk>
-
- * calendar-conduit.c (compare): Fixed compare bug. Also neated up
- some of the if's in set_status.
-
-1999-11-22 Russell Steinthal <rms39@columbia.edu>
-
- * Merged todo list coloring patch from stable
- * Added myself to AUTHORS, about box (per Miguel)
-
-1999-11-22 Eskil Heyn Olsen <deity@eskil.dk>
-
- * calendar-conduit.c (pre_sync): Writes some warning
- messages when pre_sync fails.
-
-1999-11-14 Eskil Heyn Olsen <deity@eskil.dk>
-
- * Makefile.am: Stupid misplaced endif cause gncal to depend on an
- install gnome-pilot... fixed... sorry.
-
-1999-11-12 Eskil Heyn Olsen <deity@eskil.dk>
-
- * Makefile.am (extra_pilot_bins): Fixed the if then else problem,
- using solution suggested by James Henstridge, appears to be caused
- by a (by now fixed) bug in my automake.
-
-1999-11-12 Russell Steinthal <rms39@columbia.edu>
-
- * prop.c: Config code for timeout, make Alarms property page use a
- vbox instead of an hbox so that the propbox stays a reasonable width.
-
- * gnome-cal.c, main.[ch]: Add timeout for audio alarms, code to load
- from config file
-
- * eventedit.c: Give some static functions external linkage so they
- can be used elsewhere (make_spin_button); add some prototypes to
- appease gcc.
-
-1999-11-11 Russell Steinthal <rms39@columbia.edu>
-
- * calendar.c (calendar_day_change): Add call to
- calendar_init_alarms() to schedule another day change alarm.
-
-1999-11-09 Eskil Heyn Olsen <deity@eskil.dk>
-
- * calendar-conduit.c: Enabled debug output. Sets a g_log_domain,
- now version 0.8.5. Consistent use of GSList/GList. Implemented
- compare, default uses one that compares the contents of a struct
- Appointment, but also has #ifdeffed code that does a field level
- comparison, not complete, but perhaps educational.
-
- * Makefile.am (#todo_conduit_control_applet_SOURCES): Fixed an
- unwanted conditional on libcalendar_conduit_la_LDFLAGS
-
-1999-11-05 Eskil Heyn Olsen <deity@eskil.dk>
-
- * calendar-conduit-control-applet.c (readStateCfg): Commented the
- code out, thus the capplet works again.
-
-1999-11-04 Eskil Olsen <deity@eskil.dk>
-
- * Makefile.am: Uses the PISOCK_LIBDIR, for people with odd install
- dirs for their pilot-link. Also install a pretty icon for the
- calendar-conduit.
-
- * calendar-conduit-control-applet.c: Modfied the
- try/revert/ok/cancel scheme to be more intuitive, also uses a
- GtkOptionMenu for the possible sync methods.
-
- * calendar-conduit-control-applet.desktop: use the nice icon...
-
- * calendar-conduit.c: Ack, had to define debug_alarms and
- alarm_default, otherwise they are undefined. Is gncal code messy
- or is this considered a way of configuring the cal engine ?
- Implemented delete_all syncabs methods.
-
- * calendar-pilot-sync.c: also had to declare debug_alarms and
- alarm_defaults, just as ugly.
-
-1999-11-02 Russell Steinthal <rms39@columbia.edu>
-
- * prop.c: Add new alarm page to properties box
-
- * prop.c, calobj.c, main.[ch] eventedit.c: New support for default
- alarms, configurable in the properties box.
-
- * gnome-cal.c, prop.c, main.[ch]: add option to beep on Display
- alarms
-
-1999-10-23 Russell Steinthal <rms39@columbia.edu>
-
- * calendar.c (calendar_new): Correctly initialize calendar_day_end
- and calendar_day_begin *before* installing day-change alarm.
-
-1999-10-21 Russell Steinthal <rms39@columbia.edu>
-
- * alarm.c, main.c: Added alarm debugging code
-
- * main.c (open_ok): Show an error box if the user tries to open a
- non-existent file; fixes bug #1818
-
-1999-10-19 Russell Steinthal <rms39@columbia.edu>
-
- * gnome-cal.c (calendar_notify): Fix typos which were causing
- invalid times in audio notification dialogs; fixes Bug #2561
-
-1999-10-18 Russell Steinthal <rms39@columbia.edu>
-
- * gncal-day-panel.c (gncal_day_panel_new): Placed the various
- elements of the day view in paned windows so that the user can
- adjust the relative sizes of the daily schedule, monthly calendar,
- and to-do list.
-
-1999-10-18 Martin Norbäck <norpan@bigfoot.com>
-
- * gncal.desktop: Added swedish translation
-
-1999-10-13 Eskil Olsen <deity@eskil.dk>
-
- * Makefile.am: Hopefully the fixes the much-hated
- gnome-pilot dependency.
-
-1999-10-07 Eskil Olsen <deity@eskil.dk>
-
- * calendar.c (calendar_object_changed): moved the pilot_status =
- MOD up, so even a CHANGE_SUMMARY will set the modified flag.
-
- * calendar-conduit.c: more _free calls, vamped the noise on output.
-
-1999-10-06 Eskil Olsen <deity@eskil.dk>
-
- * *conduit*[ch]: checks return values from gpilotd_init/connect.
-
- * calender.c (vcalendar_create_from_calendar): removed a set
- of cleanVObject cleanStrTbl, since the freed memory that the
- function returned.
-
-1999-09-27 Timur Bakeyev <mc@bat.ru>
-
- * timeutil.c (time_from_isodate): Use tm.gmtoff or timezone to get
- correct offset from UTC, according to HAVE_TM_GMTOFF or HAVE_TIMEZONE.
- See also 1999-07-19 Matt Martin <matt@abacusnet.net>
-
-1999-09-27 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * month-view.c (add_event): ditto
- (mark_current_day): ditto
- (month_view_set): ditto
-
- * goto.c (goto_dialog): ditto.
-
- * gnome-month-item.c (gnome_month_item_init): ditto.
-
- * gncal-day-panel.c (gncal_day_panel_new): ditto.
-
- * getdate.c (RelativeDate): ditto.
-
- * eventedit.c (set_all_day): ditto.
- (ee_rp_init_rule): ditto.
-
- * calendar.c (vcalendar_create_from_calendar): ditto.
-
- * calendar-conduit.c (update_record): ditto.
-
- * calobj.c (ical_object_generate_events): Get rid of pointers to
- values returned from localtime, as it uses a static buffer.
-
-1999-09-26 Eskil Olsen <deity@eskil.dk>
-
- * corba-cal.c: the g_free that was commented out since glib said
- was a duplicate free, was supposed to be a free.
-
- * GnomeCal.idl/corba-cal.c: added a get_object_id_list and a
- get_objects_by_id_list. Latter is not done.
-
- * calendar-conduit.c: rewrote the way the conduit iterates over
- records. It no longers fetches all entries (since that didn't work
- with more then 285 entries. It now fetches the id list, and gets
- each record. (will be using get_objects_by_id_list to get records
- in amounts of 10 or so later, to reduce amount of corba calls).
-
- * calendar-conduit.c: now sets alarm parameters when transferring
- from gnomecal to pilot.
-
-1999-09-23 Eskil Olsen <deity@eskil.dk>
-
- * calendar-conduit.c: better merge of summary/description
- when doing ical_from_remote (update_record), also handles
- import from gnomecal to pilot better, and on both ways, repeat
- events are much better now.
-
-1999-09-22 Eskil Olsen <deity@eskil.dk>
-
- * corba-cal.c: commented out a g_free that glib reported
- as being a duplicate free.
- * calendar-conduit.c: got gnomecal->pilot up and runnning.
-
-1999-02-06 Lauris Kaplinski <lauris@ariman.ee>
-
- * gncal.desktop: Added Estonian translations.
-
-1999-09-14 Federico Mena Quintero <federico@redhat.com>
-
- * gncal-full-day.c (child_popup_menu): Set the data pointers for
- all the items.
-
-1999-09-14 Kjartan Maraas <kmaraas@online.no>
-
- * doc/C/gnomecal.sgml: Merge from gnome-pim-1-0. Synced with newest
- user-guide.
-
-1999-09-01 Miguel de Icaza <miguel@gnu.org>
-
- * eventedit.c (ee_create_buttons): Make the OK button the default
- button per Russell's suggestion.
-
-1999-08-30 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * calendar.c (calendar_object_changed): Modify the
- object->last_mod field.
- (calendar_add_object): Ditto.
-
- Closes bug #676
-
- * main.c (save_calendar_cmd): Fix problem in which we warned the
- user about the calendar being modified the first time the calendar
- was used.
-
-1999-08-22 Tomas Ogren <stric@ing.umu.se>
-
- * gnomecal.gnorba: "GenericFactoy" is wrong...
-
-1999-08-15 Miguel de Icaza <miguel@gnu.org>
-
- * calobj.c (ical_gen_uid): Fix the hostname part.
-
-1999-08-07 Peter Teichman <pat4@acpub.duke.edu>
-
- * calendar-pilot-sync.c (sync_pilot): sync correctly for objects
- created on the pilot, but not dirty (because they have been synced
- with some other program in the past)
-
-1999-07-30 Miguel de Icaza <miguel@gnu.org>
-
- * month-view.c (month_view_init): Release points here.
-
-1999-08-02 Peter Teichman <pat4@acpub.duke.edu>
-
- * Makefile.am (libcalendar_conduit_la_LDFLAGS):
- libcalendar_conduit now installs
-
- * calendar-pilot-sync.c (sync_pilot): do deletion of appointments
- correctly, when they are deleted on the pilot
- (conduit_free_Appointment): protect against double-freeing parts
- of the Appointment structure
- (update_record): all-day events from the pilot are handled a bit
- more reasonably
-
-1999-08-01 Peter Teichman <pat4@acpub.duke.edu>
-
- * calendar-pilot-sync.c (sync_object_to_pilot): The multi-day
- appointment corruption bug is dead. Whoo!
-
-1999-07-31 Peter Teichman <pat4@acpub.duke.edu>
-
- * Makefile.am: fixed this up slightly with respect to pilot conduits
-
-1999-07-30 Jonathan Blandford <jrb@redhat.com>
-
- * Makefile.am (libcalendar_conduit_la_LIBADD): More autoconf-stuff
-
-1999-07-29 Jonathan Blandford <jrb@redhat.com>
-
- * gnome-cal.c (setup_widgets): Add scrolling to the yearview.
-
-1999-07-28 Miguel de Icaza <miguel@gnu.org>
-
- * calendar-pilot-sync.c: (sync_object_to_pilot): If the enddate is
- not set, set the repeatForever to 1. This fixes all of the
- birthdays problems I had.
-
- Make the code not take arguments
- (sync_cal_to_pilot): Nice event update information
-
- * calendar.c (calendar_new): Add Event UID hash table.
- (calendar_add_object): Add events to the hash table here.
- (calendar_remove_object): Remove events here.
- (calendar_object_find_event): Use the hash table here.
-
- * main.c (save_calendar_cmd): The object is already destroyed by
- gnome_dialog_run.
-
- * calendar-pilot-sync.c (sync_object_to_pilot): Do not turn
- archived bit on.
-
- * calobj.c (ical_gen_uid): Use the hostname, not the domain name.
- (ical_gen_uid): Add a serial number. Isodates can be small.
-
- * corba-cal.c (cal_repo_update_pilot_id): New method to update the
- pilot status.
- (cal_repo_get_updated_objects): New method. Returns a list of
- modified and not-sycned objects
-
- * calendar-pilot-sync.c (sync_cal_to_pilot): New function to sync
- from the GnomeCalendar to the pilot.
- (sync_object_to_pilot): Sync a single event to the pilot.
- (try_alarm): Alarm syncing code.
-
-1999-07-27 Miguel de Icaza <miguel@gnu.org>
-
- * calendar-pilot-sync.c: New file. Implements PalmPilot
- syncronization with the Gnome Calendar.
-
- * calobj.c (ical_object_new_from_string): New function. Creates
- an iCalObject from a vCalendar string that is supposed to contain
- only one vEvent.
-
- * calendar.c:
- (calendar_save): Split this routine in two.
-
- * gnome-cal.c (gnome_calendar_new): Create the corba server here.
-
- * main.c: Include gnorba.h, and corba-cal-factory.h here
- (close_cmd): Kill the calendar server on shutdown.
-
- * calobj.c (load_recur_yearly_day): Added a fixme comment. WE
- need to handle intervals in the years.
-
- * calendar.c (calendar_object_find_in_list, calendar_object_find,
- calendar_object_find_todo, calendar_object_find_event): New
- functions for looking up information.
-
- * main.c (gnome_calendar_locate): New function.
-
- * corba-cal.c (calendar_create_object): New file. Implements the
- corba server.
-
- * calendar.c (calendar_object_changed): Flag pilot-status as changed.
-
- * calobj.c (ical_object_to_vobject): Save pilot information for syncing.
- (ical_object_create_from_vobject): Load syncing information for
- pilot. Do it in a way compatible with KOrganizer.
-
-1999-07-26 Miguel de Icaza <miguel@gnu.org>
-
- * calobj.c (ical_object_create_from_vobject): Generate unique IDs
- on Vevents we load that lack it. WE need this for the old
- gnome calendar generated files (ie, before now :-).
-
- Required to sync with the Palm
-
-1999-07-26 Miguel de Icaza <miguel@gnu.org>
-
- * calobj.c (ical_object_create_from_vobject): Generate unique IDs
- on Vevents we load that lack it. WE need this for the old
- gnome calendar generated files (ie, before now :-).
-
- Required to sync with the Palm
-
-1999-07-19 Matt Martin <matt@abacusnet.net>
-
- * timeutil.c (time_from_isodate): Handle the 'Z' parameter to the
- ISO date format to convert from GMT time.
-
-1999-07-17 Nat Friedman <nat@gnome-support.com>
-
- * calendar.c (calendar_add_object): Copy the new UID into the
- iCalObject structure.
-
-1999-07-16 Miguel de Icaza <miguel@gnu.org>
-
- * gnome-month-item.c (gnome_month_item_set_arg): Merge fix from
- gnome-pim-1-0: Fixed cut&paste bug for day fontsets.
-
-1999-07-14 Miguel de Icaza <miguel@gnu.org>
-
- * calobj.c (ical_gen_uid): Returns a UID.
- (ical_object_new): Use a UID when creating an event. Should get
- syncing done easier.
-
-1999-07-14 Nicholas J Kreucher <nick@poetic.com>
-
- * calobj.c (skip_numbers): Actually skip over the numbers.
- (ical_object_to_vobject): Test the proper variable for storing the
- proper information.
-
-1999-07-14 Jean-Noel Guiheneuf <jean-noel.guiheneuf@wanadoo.fr>
-
- * timeutil.c (time_add_month): Fixed the problem with next month
- going from a 31-day to a 30-day by adjusting the date to the
- closest day at the end of the month.
-
-1999-06-07 Mike McEwan <mike@lotusland.demon.co.uk>
-
- * timeutil.c (time_add_month): Tell ktime' that we don't know
- about daylight saving time so that it does *not* make adjustments
- when we traverse a DST boundary.
- (time_year_begin): ditto.
- (time_year_end): ditto.
- (time_month_begin): ditto.
- (time_month_end): ditto.
-
-1999-06-16 Anders Carlsson <anders.carlsson@tordata.se>
-
- * main.c (new_calendar): Realize the toplevel widget when
- --hidden is passed to gnomecal. This fixes a segfault.
-
-1999-06-04 Robert Brady <rwb197@ecs.soton.ac.uk>
-
- * gnome-cal.h, gnome-cal.c: Fix abort() problem with the year view.
- (Bug #1367). Thanks to Owen Cliffe <oc197@ecs.soton.ac.uk> for
- helping track it down.
-
-1999-06-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * calobj.c (daynumberlist): One line bug fix from Sergey I Panov.
-
-1999-06-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * view-utils.c (nicetime): Use %H instead of %k, as %k is a GNU
- extension, not available in other systems.
-
-1999-06-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * calobj.c (daynumberlist): Work around broken software that
- writes a broken month-of-day as "zero". Use the dtstart date for
- this on this event.
-
-1999-05-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * Makefile.am (install-data-local): help files be gone. They are
- now installed from the Docbook stuff.
-
-1999-05-26 Russell Steinthal <steintr@condor.penguinpowered.com>
-
- * gncal-todo.c main.c main.h prop.c: Added support for priorities
- for todo items. Doesn't do much, but you can set them and sort by
- them. (Use the properties box to enable them; should they be on
- by default?)
-
-1999-05-25 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * main.c (parse_an_arg): Added missing break here. It was causing
- core dumps when invoked with --userfile.
-
- * gnome-cal.c (gnome_calendar_set_view): Add some assertions here,
- to pin point the bug reported on gnome-list.
-
- * calobj.c (load_recurrence): Make intervals always exist. a 0
- interval is wrong.
-
-1999-05-25 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * year-view.c: Removed unused macro CALENDAR_HEIGHT.
-
-1999-05-25 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * year-view.c (idle_handler): Set the canvas scroll region here,
- not in size_allocate(). Also, use the correct width and height
- based on the allocation and the precomputed minimum width/height
- values.
-
- * gnome-cal.c (setup_widgets): Set the scrollbar policy of the
- scrolled window.
-
- * main.c (setup_appbar): Use the correct type for the appbar.
-
- * gncal-day-view.c: Removed unused function switch_to_day().
-
- * gncal-day-panel.c (calendar_day_selected): Removed unused variable.
-
-1999-05-25 Nat Friedman <nat@nat.org>
-
- * doc/C/gnomecal.sgml: Fixed a typo.
-
- * gnome-cal.c (setup_widgets): Added a scrolled window widget into
- which the year view is placed.
-
- * year-view.c (CALENDAR_HEIGHT): The height of the total year view
- inside the scrolled window.
- (idle_handler): Set the height of the year view to
- CALENDAR_HEIGHT.
- (year_view_size_allocate): Set the scroll region of the year view
- canvas to allocation->width, CALENDAR_HEIGHT.
-
-1999-04-25 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * main.c (dump_todo): Add --todo flag to dump the todo contents.
-
-1999-04-19 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-todo.c (add_activated): Use same hack used in edit_activated
-
-1999-04-16 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-todo.c (edit_activated): Kill all grabs from the CList
- before running the new dialog box.
-
- This fixes the problem of button-3/Edit on the todo item blocking
- the GUI (actually, the main window responds, but not the todo
- window).
-
-1999-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-todo.c (gncal_todo_init): Make sure we can get events for
- button3. The code for the nice popup menu was there but was not
- getting invoked.
-
-1999-04-01 Steve Murphy <murf@e-tools.com>
-
- * calobj.c (weekdaynum): Added this routine so Monthly recurrences
- use the weekday field as a simple integer for a single weekday.
-
- * calobj.c (load_recur_monthly_pos): Call weekdaynum instead of
- weekdaylist. The interface only lets the user input a single value
- anyway.
-
- * calobj.c (ical_object_to_vobject): instead of code to output day
- names from a bit array, use instead the value as an int and output
- a single dayname.
-
- * calobj.c (ical_object_generate_events): first_week_day gets the
- day int instead of the first entry in the bit field. I inserted a
- fair chunk of code to avoid calling generate if the day is out of
- range for a month. It may be unneccessary, because mktime will
- turn the extra days into a valid date the next month. But not all
- mktimes are equal, I fear.
-
- * eventedit.c (ee_store_recur_rule_to_ical): For case 3,
- (Monthly), I added code to set the interval slot of the recur
- struct; without this value, selecting a monthly recursing, by
- date, would lead to an infinite loop broken only by a failure to
- alloc more memory. Also, in the "by position" case, both
- u.month_pos and u.month_day were being assigned values. This is a
- mistake, as they are both part of an union, and the same
- thing. The weekday field should get the recur_rr_month_weekday
- value.
-
- * eventedit.c (ee_rp_init_rule): set default day from the weekday
- field instead of the u.month_day field, which is really the
- month_pos value.
-
- * gnome-cal.c (gnome_calendar_tag_calendar): Month days start with
- 1, not 0; thus, setting tm.tm_mday = 0, and then calling mktime
- will generate a time corresponding to the end of the previous
- month, which may have a mday anywhere from 28 to 31. The end time
- just adds 1 to the month, so your end time may not cover the last
- few days of this month, depending on what the biggest mday of last
- month was. I changed it so tm_mday is set to 1 instead.
-
-1999-03-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-todo.c (convert_time_t_to_char): Made static. Make it use
- the full year format for strftime().
-
-1999-03-27 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
-
- * calobj.c: Include <config.h> So that strings get translated.
-
-1999-03-26 Tomas Ogren <stric@ing.umu.se>
-
- * prop.c (build_hours_menu): Made it respect 12/24h settings..
- Doesn't show until next time you open the dialog.. yet..
-
-1999-03-24 Tomas Ogren <stric@ing.umu.se>
-
- * gncal-week-view.c (gncal_week_view_set): Did some i18n work
- * eventedit.c (get_exception_string): Did some i18n work
-
-1999-03-24 Tomas Ogren <stric@ing.umu.se>
-
- * gncal-todo.c (gncal_todo_init): Made clist titles i18n:able
- * main.c (poptOption): Added which views that are possible for
- --view in the --help text (closes #367)
- * main.c (dump_events): Added (short) month to the strftime and made
- the strings i18n:able
-
-1999-03-23 Tomas Ogren <stric@ing.umu.se>
-
- * gncal/calobj.c: Added 2 paranthesis..
- "foobar = d / 60*60" is _NOT_ the same as "foobar = d / (60*60)"
- which caused heavy alarm-corruption with alarms between 2 hrs and
- 2 days.
-
-1999-03-23 Nat Friedman <nat@nat.org>
-
- * eventedit.c (ee_store_recur_rule_to_ical): Set the
- recur->interval to the value of the recur_rr_month_period spin
- button if the event is being set "by day." This closes bug #675
- as reported by bagfors@hpc2n.umu.se. Thanks for the report!
-
-1999-03-10 Clifford R. Conover <rconover@montana.edu>
-
- * gncal-todo.c (simple_todo_editor): Add support for Due Date when
- adding a TODO item here.
- (column_resized): New function
- (init_column_sorting): New function.
- (todo_click_column): New function.
- (convert_time_t_to_char, make_overdue_todo_style): New functions.
-
- * gnome-cal.c (gnome_calendar_todo_properties_changed): New
- function used to update the TODO when the properties have been
- chagned for it.
-
- * prop.c (prop_apply_todo): Apply TODO properties.
-
- * gncal-day-panel.c (todo_list_properties_changed): Update the
- TODO display here.
-
- * eventedit.c (date_edit_new): Made public
-
-1999-03-10 Craig A Soules (soules+@andrew.cmu.edu)
-
- * timeutil.c, calendar.c, calobj.c, gncal-day-panel.c: Add support
- for daylight time savings.
-
-1999-02-28 Martin Baulig <martin@home-of-linux.org>
-
- * gncal-full-day.c (recompute_motion): For DRAG_MOVE, DRAG_SIZE_TOP
- and DRAG_SIZE_BOTTOM: call child_focus_out () if the child currently
- has the focus.
-
-1999-02-27 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
-
- * quick-view.c (QUICK_VIEW_FONTSET): Added Korean font to the
- fontset string.
- * mark.h (*_FONTSET): Likewise.
-
-1999-02-23 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * calobj.c (ical_object_to_vobject): Save the owner/organizer of
- the event.
- (ical_object_create_from_vobject): Load the owner/organizer of the event.
-
- * gncal-full-day.c (delete_occurance): Assign child to data (fixes
- crash on "delete this occurrance").
-
-1999-02-22 Timur Bakeyev <mc@bat.ru>
-
- * calendar.c: According to configured values, use either tm.tm_zone
- or tzname. In last case, also declare it extern.
-
- * prop.c: langinfo.h not available everywhere. Wrapped. BTW, works
- fine without it.
-
-1999-02-20 Tomas Ogren <stric@ing.umu.se>
-
- * main.c (init_username): Made use of g_get_{user,real}_name() instead
- of our own home-brew...
-
-1999-02-17 Sergey Panov <sipan@mit.edu>
-
- * gnome-month-item.c,gnome-month-item.h,goto.c,mark.h,
- month-view.c,prop.c,quick-view.c,year-view.c: will define
- fonts via fontset. Friendlier to locales that use iso8859-[^1]
- and koi8-r encodings. Does not solve problem for Asian languiges
- --- better solution is needed (e.g. standart GNOME fontstyles
- defined in gtkrc).
-
-1999-02-16 Sergey Panov <sipan@mit.edu>
-
- * main.c: Use N_() macro for color settings labels in
- color_props structure.
-
-1999-02-15 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * goto.c (goto_dialog): Indentation fixes.
-
-1999-02-15 Tomas Ogren <stric@ing.umu.se>
-
- * goto.c: Made a private copy of what localtime() returns, to be able
- to keep the data after more calls to localtime().
-
-1999-02-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * main.c (save_default_calendar): New function. Saves the
- calendar if it is the user's default calendar
-
- * gncal-full-day.c (unrecur_appointment):
- * gncal-day-panel.c (day_view_range_activated):
- * eventedit.c (ee_ok):
- * gncal-todo.c (ok_button): Added autosave for the default
- calendar.
-
-1999-02-09 Tomas Ogren <stric@ing.umu.se>
-
- * main.c: Removed the gtk_widget_realize call.
-
-1999-02-06 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
-
- * gncal.desktop: Added Korean translations.
-
-1999-02-04 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * eventedit.c (date_edit_new): New convenience function to create
- a properly-configured date editor widget.
-
-1999-02-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-week-view.c (gncal_week_view_new): Make the calendar start
- weeks on Monday if appropriate.
- (gncal_week_view_time_format_changed): New function to notify the
- week view that the time format has changed.
-
- * gncal-day-panel.c (gncal_day_panel_new): Make the calendar start
- weeks on Monday if appropriate.
- (gncal_day_panel_time_format_changed): New function to notify the
- day panel that the time format has changed.
-
- * gnome-cal.c (gnome_calendar_time_format_changed): Tell the day
- and week views that the time format has changed.
-
-1999-02-01 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * eventedit.c (event_editor_init): Set the title of the event
- editor window.
-
-1999-01-31 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-day-view.c (gncal_day_view_expose): Do not remove the
- clipping rectangle here.
-
- * view-utils.c (view_utils_draw_events): Remove the clipping
- rectangle here, since the user of this function should not know
- about it.
-
-1999-01-30 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * view-utils.c (view_utils_draw_events): Improve this draw
- routine. Now it can split the text in lines and fit as many
- events as possible.
- (nicetime): Return strings without spaces at the beginning.
-
- * gncal-day-view.c (gncal_day_view_expose): Move clip-clear
- operation here.
-
-1999-01-29 Jason Tackaberry <tack@dok.org>
-
- * gncal-full-day.c (child_popup_menu): if the user clicks on an
- event that is an occurance, the menu will allow the user to delete
- all occurances of this event, or just the selected occurance.
- (delete_occurance): added.
-
- * eventedit.c (append_exception): force the clist to select the
- new exception. (fixes segfault)
- (delete_exception): if the last exception in the clist is deleted,
- move the selection index up. (fixes segfault)
-
-1999-01-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * main.c (parse_an_arg): Add --hidden key to hide the calendar at
- startup. Only works with GNOME window managers though :-(
-
- * calendar.c (calendar_day_change): Reschedule alarms for the new day.
-
- (calendar_init_alarms): Schedule an alarm for midnight to change
- the calendar_day_begin/calendar_day_end.
-
- * alarm.c (alarm_ready): If we reschedule, there is no need to
- activate any pending alarms.
-
-1999-01-28 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c (child_new): Insert the summary text here.
- (child_focus_in): No need to raise the window, since we have
- Spiffo(tm) layout code. Boy, this is old code.
- (gncal_full_day_focus_child): Now that GtkText works better, we
- can avoid synthesizing a click which was causing grief, anyway.
- (child_button_press): Grab the focus before popping up the menu.
-
- * layout.c (find_index): Added a sanity check.
-
- * gncal-full-day.c (child_destroy): Unmap and unrealize the child
- before unparenting/destroying it.
- (child_unrealize): Unrealize the widget. What was I thinking?
- (child_new): Save the focus_out_event signal connection id in
- Child structure (in a new field).
- (child_destroy): Disconnect from the focus_out_event signal, since
- we don't want to get such an event when the widget is destroyed.
- (gncal_full_day_destroy): Destroy the children properly; it was
- leaking memory.
-
-1999-01-27 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * main.c (save_calendar_cmd): Warn if the calendar file has
- changed.
-
- * calendar.c (calendar_load, calendar_save): Keep track of the
- modification time for the calendar file.
-
-1999-01-20 Nat Friedman <nat@nat.org>
-
- * gncal-full-day.c (gncal_full_day_key_press): Only trap printable
- characters such that hotkeys work.
- (UNSELECT_TIMEOUT): Changed to 0. Much saner behavior.
-
- * prop.c (properties): Connect gnome_help_pbox_display to the
- GnomePropertyBox help button.
-
-1999-01-19 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * quick-view.c (quick_view_do_popup): Do not grab the mouse here
- (it was being grabbed incorrectly, anyways).
- (quick_view_map_event): Grab the mouse when the window is mapped.
- This avoids the ugly "while (xGrabPointer () != Success)" hack.
- (quick_view_button_release): Handle button releases here.
-
-1999-01-19 Tomas Ogren <stric@ing.umu.se>
-
- * main.c: do gtk_widget_realize on the toplevel window..
-
-1999-01-13 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-day-panel.c (gncal_day_panel_new): Make the little
- calendar start up with the correct date.
-
- * gncal-week-view.c (gncal_week_view_set): Add the month to the
- date range display label.
-
-1999-01-08 Nat Friedman <nat@nat.org>
-
- * main.c: Converted some more stuff to use the standards.
-
-1999-01-08 Nat Friedman <nat@nat.org>
-
- * main.c (setup_appbar): New function to create the status bar.
- (setup_menu): Install menu hints.
-
- Menu items updated to match the standards. New Settings menu
- created.
-
-1998-12-30 Jeff Garzik <jgarzik@pobox.com>
-
- * gncal/calendar.c, gncal/gnome-cal.c, gncal/main.c,
- gncal/quick-view.c:
- s/g_copy_strings/g_strconcat/
-
-1998-12-16 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- Rewrote the old and broken alarm system. It never actually
- worked properly. Now it works properly, and I figured a nice way
- to get the Audio alarm do something nicer (it is now like an alarm
- clock :-).
-
- * gnome-cal.c (calendar_notify): Now we take a CalendarAlarm to
- actually distinguish which alarm was triggered.
-
- * alarm.c (alarm_ready): The code was only activating the first
- alarm. Reschedule the timer upon delivery of an alarm.
-
-1998-12-14 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * year-view.c (idle_handler): Use the allocation size instead of
- the old fields in the canvas structure.
-
- * goto.c (create_days): Use gtk_widget_set_usize() instead of
- gnome_canvas_set_size().
- * quick-view.c (setup_event_list): Likewise.
-
-1998-12-09 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-todo.c (simple_todo_editor): Use gnome_dialog_set_parent.
- * goto.c (goto_dialog): ditto
- * prop.c (properties): ditto.
-
-1998-11-23 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * eventedit.c (ee_rp_init_exceptions): Update GtkClist usage.
-
-1998-11-23 Andrew T. Veliath <andrewtv@usa.net>
-
- * gncal-day-panel.c (gncal_day_panel_new): Use
- gtk_scrolled_window_add_with_viewport instead of
- gtk_container_add (gtk changes).
-
-1998-11-23 Herbert V. Riedel <hvr@hvrlab.ml.org>
-
- * eventedit.c: use GPOINTER_TO_INT
-
- * gncal-todo.c: same.
-
-1998-11-22 Matthew Wilson <msw@redhat.com>
-
- * main.c: Fixed the popt event parsing callback to have the
- correct number of arguments. This stops it from segfaulting.
-
-1998-11-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * eventedit.c (ee_classification_widgets): Doh. Fixed stupid bug
- where the classification buttons were not being set correctly.
- (ee_store_general_values_to_ical): Take into account the fact that
- radio group lists are stored in reverse order of insertion.
-
- * gncal-todo.c (gncal_todo_init): Use a scrolled window to put the
- clist into.
-
-1998-11-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * calendar.c (calendar_save): Backup the old file before saving
- the caledar.
-
-1998-11-06 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * calobj.c: Add ctype.h
-
-1998-10-31 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gnome-cal.c (gnome_calendar_direction): Add the offset from the
- beginning of the current time unit (day/month/etc), otherwise it
- does not work right, for example, you are on the 31st day of a
- month and the next month is a 30-day one and you jump to the next
- month.
-
-1998-10-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * month-view.c: Changed a lot of stuff not to use the layout code
- -- the month view's days are too small to display layout
- usefully. Now they display a little list of the events in each
- day. We also have a popup menu for the days in the month view.
-
- * calendar.c (calendar_get_objects_in_range): Reverse the list so
- that it is returned in increasing order.
-
- * eventedit.c (event_editor_new_whole_day): New public function to
- create an event for the complete span of day_begin to day_end.
-
- * year-view.c (new_appointment): Use event_editor_new_whole_day().
-
- * year-view.c (yv_popup_menu): Mark strings for i18n.
-
-1998-10-12 Ji Lee <g@ucsd.edu>
-
- * eventedit.c (ee_store_recur_rule_to_ical): The interval was
- never being loaded from the spin button.
-
-1998-10-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * month-view.c (month_view_update): Create a list of children and
- lay them out nicely. Lots of functions added for this purpose.
- (adjust_segment): Main event segment adjustment routine.
- (adjust_children): Adjusts all the children in the month view.
- (child_create_segments): Creates the segments for a particular event.
- (layout_children): Uses the generic layout engine to organize the children.
-
-1998-10-08 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-todo.c (clist_row_selected): Set the sensitivity of the
- edit/delete buttons.
- (gncal_todo_update): Likewise. Thanks to Dirk Luetjens for the
- bug report.
-
- * layout.c: Do some cleanup; now we pass a struct with the layout
- algorithm's state instead of passing a trillion parameters around.
-
- * gncal-full-day.c (layout_children): Use the new generic layout
- engine.
- (child_compare): Sort keys are start time then end time, not just
- start time. This produces somewhat nicer results for the layout
- algorithm.
-
- The new layout code uses a partition of the time range occupied by
- the events, rather than using a fixed time granularity. This is
- better since the different parts of the program that use the
- layout module will have different semantics regarding snapping the
- event bounds to a fixed "time grid".
-
-1998-10-07 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * layout.[ch]: New files that abstract the event layout code from
- gncal-full-day.c into something useful for other parts of the
- program. Now all event layout is done here.
-
- * Makefile.am (gnomecal_SOURCES): Added layout.[ch] to the list of
- sources.
-
-1998-10-07 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de>
-
- * main.c (main): Replaced the 'gnome_client_new_default' call with
- 'gnome_master_client'.
-
-1998-10-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * timeutil.c (time_day_begin): Changed name from
- time_start_of_day() to be consistent with the other begin/end functions.
- (time_day_end): Likewise.
-
- * calobj.c (ical_object_get_first_weekday): New public function to
- get the first toggled day in a weekday mask. Since we do not
- support multiple weekdays in a monthly-by-pos rule, we just fetch
- the first toggled one.
- (ical_object_generate_events): Added a missing break statement.
-
- * timeutil.c (time_month_end): Made it consistent with the rest of
- the time begin/end functions -- now it returns the first second of
- the *next* month.
- (time_week_end): Actually implemented this function. It will be
- used when the week view is rewritten.
-
- * calobj.c (time_in_range): Fix off-by-one in the comparison of
- the time against the end time.
-
- * gncal-full-day.c (expand_space): Fixed bug where the columns not
- were being expanded due to a missing "slot + j".
-
-1998-10-01 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * month-view.c (month_view_init): Use the font #defines.
- (month_view_new): Set the colors of the month view upon creation.
- (mark_current_day): New function to mark the current day in the
- month view.
- (month_view_set): Mark the current day.
- (month_view_colors_changed): Mark the current day and colorify the
- month item appropriately.
-
- * month-view.h: Added year and month fields to the MonthView
- structure.
-
- * main.c: Renamed the Appointments color property, since it will
- be used by the month view as well.
-
- * goto.c (update): Set the current day's font and color.
-
- * year-view.c (year_view_init): Set the fonts of the month items
- when creating them.
-
- * mark.h: Added new #defines for HEADING_FONT and TITLE_FONT.
-
- * year-view.c (year_view_init): Use the new font #defines.
-
- * prop.c (prop_apply_colors): Fixed to work with the
- I-am-paranoid-and-I-need-to-size-my-ints changes to
- GnomeColorPicker.
- (color_spec_from_picker): Likewise.
-
-1998-09-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * goto.c (create_days): Colorify the month item and prepare it for
- prelighting here.
-
- * main.c (color_props): Changed the default colors to something
- not dull.
-
- * year-view.c (compute_min_size): New function to compute the
- minimum size of the year view properly.
- (year_view_size_request): Added two new fields to the year view
- structure that contain the minimum size. Return this in the
- size_request method.
- (year_view_new): Call compute_min_size to save the minimum size
- for later use.
- (idle_handler): Make it resize the items correctly.
-
- * gnome-month-item.c (gnome_month_item_set_arg): Reshape when
- necessary. This is needed becaues we now actually calculate a
- minimum size for the month item based on the font sizes and paddings.
- (check_heading_sizes): New function to calculate a minimum size
- based on the headings' dimensions.
- (check_day_sizes): New function to calculate a minimum size based
- on the day number labels' dimensions.
- (check_sizes): New function that computes a minimum size for the
- month item.
- (reshape): Now calls check_sizes() to ensure a minimum size for
- the month item.
-
- * year-view.c (mark_current_day): New function to mark the current
- day in the year view.
-
- * mark.c: Removed mark_current_day from here.
-
-1998-09-29 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * prop.c (fetch_color_spec): Changed name from fetch_prelight_spec
- and made it conform to the new prelighting mechanism.
- (fake_mark_days): Set the proper day attributes.
- (reconfigure_month): Use colorify_month_item().
- (fake_mark_days): Use mark_month_item_index().
-
- * mark.c (colorify_month_item): New public function to reset the
- colors in a month item.
- (get_attributes): New internal function that creates an array of
- attributes for the days in a month item. This is the basis of all
- the new optimizations to month item marking.
- (unmark_month_item): Now it uses the attributes array to unmark
- only the days that need unmarking.
- (mark_event_in_month): Update the day attributes array.
- (month_item_prepare_prelight): Changed the definition of the
- prelight color query function. Use the new function.
- (day_event): Do color changes based on the day attributes array.
- (mark_month_item_index): New public function to mark a single day
- by index.
- (mark_event_in_month): Use mark_month_item_index().
-
- * gnome-month-item.c (gnome_month_item_num2child): Now takes an
- int, not a GnomeMonthItemChild.
- (gnome_month_item_child2num): Now returns an int, not a
- GnomeMonthItemChild.
- (gnome_month_item_num2day): Now takes an int, not a
- GnomeMonthItemChild.
-
- * goto.c (goto_dialog): Create the days before the year spin
- button, because the year_changed callback expects the month item
- to be created. The new semantics of the spin button cause it to
- emit a value_changed signal on the adjustment upon creation -- is
- this the behavior we want from it?
- (goto_dialog): Use gtk_window_set_modal() instead of the
- deprectaed gnome_dialog_set_modal().
-
- * quick-view.c (quick_view_new): Make it look not as crappy by
- putting the title inside the frame.
- (quick_view_do_popup): Fixed the pointer grab and added a cursor.
- (create_items_for_event): Query the text width/height from the
- text item using the new object arguments, so that the size of the
- popup window can be set properly.
-
- * year-view.c (do_quick_view_popup): Calculate a nice date string
- for the popup window.
-
-1998-09-28 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * quick-view.[ch]: New file that presents a quick view of the
- events in a particular day when the mouse is clicked on the year
- view. Work in progress.
-
- * year-view.c (do_quick_view_popup): New function that creates a
- quick view for the events in a day.
-
- * Makefile.am (gnomecal_SOURCES): Added quick-view.[ch] to the
- list of sources.
-
-1998-09-27 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * main.c: Hotkey for File/Exit should be C-q, not C-x.
-
-1998-09-24 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * year-view.c (do_popup_menu): New function to execute the popup
- menu in the year view.
- (day_event): Invoke the popup menu with the context set to days.
- (new_appointment): New function to create a new appointment from
- the year view.
- (do_jump): New function to do the appropriate view/date jumping
- from the popup menu.
-
- * main.c: Fixed two icons in the File menu.
-
-1998-09-21 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * main.c: Added underlined shortcuts and accelerators to the main menu.
-
-1998-09-16 Raja R Harinath <harinath@cs.umn.edu>
-
- * gncal-week-view.c (<gtk/gtklabel.h>): Include.
- * gncal-week-view.h (<gtk/gtkvbox.h>): Include.
-
-1998-09-06 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gnome-cal.c (mail_notify): Fixed the bug reported about the mail
- notification not beint sent until the program was terminated.
-
-1998-09-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c (gncal_full_day_forall): Updated foreach ->
- forall from Gtk changes, bleah.
-
- * year-view.c (day_event): New function to handle events from
- days. Jumps to the day that is clicked.
-
- * main.c: Use a watch cursor while the previous/today/next
- functions are doing their job.
-
- * mark.c (month_item_prepare_prelight): New public utility
- function to prepare a month item for prelighting. It will store
- the proper prelight information and attach the appropriate signals.
- (mark_current_day): Make the current day bold as well (useful for
- color-blind people, I guess).
-
- * prop.c (set_current_day): Reset the date in the sample calendar
- and mark the current day.
- (fake_mark_days): Mark fake events in the sample calendar.
-
- * year-view.c (year_view_set): Use the general prelighting engine.
-
- * goto.c (day_event): Just process button presses, as prelighting
- is done behind the scenes now.
- (update): Use the general prelighting engine.
-
- * prop.c (create_colors_page): We can now configure the colors of
- the monthly calendars! Wheeeeee! There are still some nits to be
- fixed, which are listed in the TODO file.
- (build_color_spec): New function to build color specifications.
- (parse_color_spec): New function to parse color specifications.
-
- * mark.c: Modified all functions to use the configured colors.
- * goto.c: Likewise.
-
- * main.c (colors_changed): New function that notifies all
- calendars that colors have changed.
-
- * gnome-cal.c (gnome_calendar_colors_changed): New function that
- notifies all the views that the colors have changed.
-
- * month-view.c (month_view_colors_changed): New function that
- notifies the month view that colors have changed.
-
- * year-view.c (year_view_colors_changed): New function that
- notifies the year view that colors have changed.
-
- * gnome-month-item.h (struct _GnomeMonthItem): Added fields for
- outline and day box colors.
-
- * gnome-month-item.c (gnome_month_item_set_arg): Added
- outline_color, outline_color_gdk, day_box_color, and
- day_box_color_gdk arguments to month items. These are convenient
- to quickly set the colors of the month item.
- (gnome_month_item_get_arg): Likewise.
-
- * main.[ch]: Added a global array of structures for color preferences.
-
-1998-08-31 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * goto.c: Small code cleanup.
- (day_event): Upon receiving a LeaveNotify event, Reset the day's
- background to the correct color.
-
-1998-08-29 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * mark.[ch]: New files with utility functions to mark calendars
- with their events.
-
- * mark.c (mark_month_item): New public function to mark a month
- item with events.
- (unmark_month_item): New public function to unmark all the days in
- a month item to their default appearance.
-
- * year-view.c (year_view_set): Use the new unmark_month_item() and
- mark_month_item() to mark the months with events.
-
- * goto.c (update): New function that updates the calendar in the
- Go-to dialog by marking the days.
-
- * timeutil.c (time_year_begin): Modified to take a time_t value.
- (time_year_end): Likewise.
- (time_month_begin): Actually implemented this function, which was
- in the header file but not here.
- (time_days_in_month): New public function that returns the number
- of days in a month.
-
- * Makefile.am (gnomecal_SOURCES): Added mark.[ch] to the sources.
-
- * year-view.c (unmark_days): Use unmark_month_item().
-
- * gncal-full-day.c (gncal_full_day_destroy): Fixed crash when
- destroying the full day view. The full day's destroy method is
- unusual in that it destroys the list of child widgets itself, as
- it does not have a remove method, so it needs to reset the list to
- NULL.
-
-1998-08-27 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gnome-month-item.c (build_month): Now does the correct thing
- when the user wants weeks to start on Monday. Now all the Monday
- special casing, as far as day numbering is concerned, is only in
- this function.
-
- * year-view.c (mark_days): This function marks the days that have
- events in them. It also fixes a memory leak in the old
- implementation (it was leaking the whole list).
- (unmark_days): New function used to unmark all the days in the
- year view.
- (mark_event): New function that marks all the days that are
- spanned by a time range. It also fixes the bug in the old
- implementation where it could possibly mark days past the ends of
- the year (if the event crosses year boundaries, for example).
-
- * timeutil.c (time_year_begin): Take the year parameter since year
- 1, not 1900.
- (time_year_end): Likewise.
-
- * year-view.c (year_view_size_allocate): Now changing the size of
- the calendars is done in the idle loop.
- (idle_handler): This function actually does the resizing of the items.
-
- * year-view.h (struct _YearView): Added idle_id and need_resize
- fields.
-
-1998-08-26 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * year-view.c: Beginning of the new year view. Sizing and event
- marking needs to be finished.
-
- * gnome-cal.c: Updated for year-view.
- (gnome_calendar_time_format_changed): Use year_view_time_format_changed().
-
- * year-view.[ch]: Renamed the gncal-year-view.[ch] files to
- year-view.[ch].
-
- * Makefile.am (gnomecal_SOURCES): Updated year-view.[ch] in the
- list of source files.
-
-1998-08-25 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * goto.c (create_days): Set the heading color of the month item.
-
- * main.c: Use GNOME_STOCK_PIXMAP_JUMP_TO, now that it exists,
- instead of goto.xpm. Also, removed goto.xpm from cvs.
-
- * gnome-month-item.h (struct _GnomeMonthItem): Added fields for
- the heading and day number fonts. Added fields for heading and
- day number label colors.
-
- * gnome-month-item.c (gnome_month_item_class_init): ARG_DAY_NAMES
- should be write-only. Also, added arguments for heading and day
- number fonts. Added arguments for heading and day number colors.
-
-1998-08-24 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * prop.c (build_two_radio_group): Doh. Set the state of the radio
- buttons properly.
-
- * month-view.c (month_view_time_format_changed): New public
- function that notifies the month view of a time format change.
-
- * gnome-cal.c (gnome_calendar_time_format_changed): New public
- function that notifies the calendar of a time format change.
-
- * main.c (time_format_changed): Use gnome_calendar_time_format_changed().
-
- * month-view.c (month_view_update): New public function to update
- the month view when an event changes. This is still unfinished.
- (month_view_set): New public function to set the month in the
- month view.
-
- * gnome-cal.c (gnome_calendar_direction): Add case for month view.
- (gnome_calendar_set_view): Likewise.
- (gnome_calendar_update_all): Likewise.
-
- * timeutil.c (time_add_week): Implemented the time_add_week()
- function, which was on the header file.
- (time_add_month): Added public month-adding routine.
-
- * gnome-cal.c (gnome_calendar_get_current_view_name): Add case for
- month view.
- (gnome_calendar_goto): Likewise, and set the time on the month view.
-
- * month-view.c (month_view_new): Now it takes the calendar plus
- the time_t representing the month.
-
- * gnome-month-item.h: Added documentation on the object arguments
- for the month item.
-
- * month-view.c (month_view_init): Added a month/year heading to
- the month view.
-
- * TODO: Updated the TODO list a bit.
-
- * main.c (gnome_cal_file_menu): The preferences menu option should
- go in the File menu.
- (gnome_cal_edit_menu): Added stock pixmaps to the menu items.
- (gnome_cal_menu): Renamed the Calendar menu to Edit.
- (gnome_cal_help_menu): Use "About Gnomecal", not just "About".
-
- * prop.c (hour_activated): Notify the property box that it has changed.
-
- * main.c: Changed the Properties menu item to Preferences. These
- are global application preferences, not a single calendar's
- properties.
-
- * prop.c (prop_apply): Save the week_starts_on_monday flag to the
- configuration file.
- (properties): Added a check button for weeks starting on Monday.
- (properties): Beautified the Preferences dialog.
-
- * month-view.c (month_view_init):
- * goto.c (create_days): Set the month item to start weeks on
- Monday if appropriate.
-
- * main.c (init_calendar): A boolean is not an hour, so don't
- range_check_hour() on it.
- (init_calendar): Added a global week_starts_on_monday flag.
-
- * main.h: Added global week_starts_on_monday flag.
-
-1998-08-21 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * calobj.c (ical_object_create_from_vobject): If mail alarm or
- program alarm are missing the action, then set an empty default.
-
-1998-08-18 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gnome-month-item.c (gnome_month_item_day2index): New public
- function to get the displayed day index of the specified date.
-
- * gnome-cal.c (gnome_calendar_goto_today): New public function to
- jump to the current day.
-
- * goto.c (day_event): Jump to the selected day when the user
- clicks the mouse, and prelight days as appropriate.
-
- * timeutil.c (time_from_day): New public function to build a
- time_t from a year/month/day triplet.
-
- * gnome-month-item.c (gnome_month_item_num2child):
- (gnome_month_item_child2num): New public functions to convert an
- index into a child and vice-versa, respectively.
- (gnome_month_item_num2day): New public function to convert a child
- number into a displayed day number.
-
- * goto.c (goto_dialog): Doh, use gnome-dialog properly :-)
-
- * gnome-month-item.c (create_items): Use g_strdup()ed day names
- from the start.
-
-1998-08-17 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * main.c (gnome_toolbar): Made it use goto.xpm.
-
- * Makefile.am (EXTRA_DIST): Added goto.xpm to the list of files.
-
-1998-08-13 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gnome-month-item.c (gnome_month_item_set_arg): Doh. Actually
- recalculate the days using the month and year.
-
- * main.c: Added "Go to" button to quickly jump to a specific date.
-
- * goto.c: New file that defines the quick go-to date dialog.
-
- * Makefile.am (gnomecal_SOURCES): Added goto.c to the sources.
-
-1998-08-11 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
-
- * main.c (new_calendar): Made title i18n friendly. This was bug
- #215.
-
- * eventedit.c (ee_store_recur_end_to_ical): Set recur->enddate to
- recur->_enddate, not to itself, when adding recurring event and
- supplying an end date. This fixes (at least part of) bug #99.
-
-1998-08-10 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * month-view.[ch]: Start of the month view widget. This will use
- the generic month item and extend it to have the semantics desired
- for the gnomecal month view.
-
- * gnome-month-item.[ch]: New generic canvas item for the month
- view and the "small calendars". This is intended to be a
- high-level display engine for monthly calendars. This is a work
- in progress.
-
- * gnome-cal.h (GnomeCalendar): Added a month_view field.
-
- * gnome-cal.c (setup_widgets): Create the month view and insert it
- into the notebook.
-
- * Makefile.am: Added month-view.[ch] and gnome-month-item.[ch] to
- the sources.
-
-1998-08-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * main.c (about_calendar_cmd): Use an array of const strings to
- keep gcc happy.
-
- * alarm.c (alarm_compare_by_time): Use gconstpointer to keep gcc happy.
- * calendar.c (calendar_object_compare_by_start): Likewise.
- * gncal-full-day.c (child_compare_by_start): Likewise.
-
-1998-07-07 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * main.c: Add support for --view flag.
- (session_save_state): Save the view mode;
- (new_calendar): Now takes a view mode flag.
-
- * gnome-cal.c (gnome_calendar_get_current_view_name): New
- function for enhancing the session management support for
- gnomecal.
- (gnome_calendar_set_view): New function that makes a given page
- active.
-
-1998-07-01 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
-
- * gncal.desktop: Added Portuguese translation.
-
-Mon Jun 22 13:01:16 1998 Havoc Pennington <hp@pobox.com>
-
- * main.c (session_save_state): Use gnome_geometry_string to get
- the geometry string.
-
-1998-06-04 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * eventedit.c (ee_rp_init_rule): Do not subtract 1 from
- tm->tm_mday for the default_day.
-
- * gnome-cal.c (gnome_calendar_new):
- (gnome_calendar_goto): Use the start of the day -- things expect
- it to be that way.
-
-1998-05-27 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
-
- * eventedit.c (ee_store_recur_rule_to_ical): Fill in
- ical->recur->interval from value in spin_button. This ixed an
- infinnite loop.
-
-1998-05-30 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c (child_draw): Paint the decorations correctly.
- (child_draw_decor): Paint the recurrence/bell icons correctly.
-
-1998-05-25 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * eventedit.c (ee_rp_init_rule): Use the contents of
- ee->ical->dtstart for computing the predefined values of the recurrence.
-
- * gncal-full-day.c (gncal_full_day_unrealize): Fix the gc
- destruction in the unrealization code and fix the pixmap unrefing.
-
- * main.c (close_cmd): Remove a bad hack that disabled calendar
- widget destruction.
-
- * calobj.c (ical_object_generate_events): Fix for the weekly event
- generation. Was reported on the bug tracking system.
-
-1998-05-18 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-full-day.c (layout_children): Implemented ultra-cool
- layout for the events that share the same time range. Gals and
- guys you can now drop Outlook on the recycle bin.
-
- Which reminds me. We do not have a recycle bin. How could that
- happen in a project as cool as this one? Someone explain this to
- me.
-
-1998-05-18 Federico Mena <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c (paint_back): Eliminated unnecessary border repainting.
-
-Sun May 17 17:55:03 1998 Havoc Pennington <hp@pobox.com>
-
- * gncal-todo.c (simple_todo_editor): Close dialog when return is pressed.
-
-1998-05-15 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gnome-cal.c (mark_gtk_calendar_day): Bug free version of the
- range computation in place.
-
- * gncal-year-view.c (year_view_mark_day): Use the same new version
- of the range computation here.
-
- * calobj.c (ical_object_generate_events): Fix the begin/end
- condition.
-
-1998-05-14 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * timeutil.c (isodate_from_time_t): Do not add the spurious
- padding.
-
- * calobj.c (store_date_list): Bug fix: I was using the wrong
- pointer when saving the exception date list.
- (set_date_list): Bug fix: load correctly the complete exception
- date list.
- (set_date_list): Use ',' for the exception date separator as the
- versit people can not get their standard right.
-
- * gncal-full-day.c (unrecur_appointment): Support for making an
- existing recurrent event `movable' for a day.
-
- * calobj.c (ical_object_add_exdate): New routine, used to add
- exception dates.
- (ical_object_duplicate): New routine: used to do the magic
- recur->no-recur event.
-
-1998-05-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-full-day.c (new_appointment): Use gtk_calendar freeze/thaw
-
- * gncal-year-view.c (gncal_year_view_set_year): Use gtkcalendar freeze/thaw.
-
- * eventedit.c (event_editor_init): Use gnome_dialog_set_close to
- avoid the ugly warning.
-
- * main.c (display_objedit): Default to the day the user is looking
- at.
-
-1998-05-05 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-day-panel.c (full_day_size_allocated): Do not emit a value
- changed signal if the value is the same.
-
-1998-05-04 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * prop.c (prop_apply): Only run the apply code once.
-
-1998-05-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-day-panel.c (update): Draw the day at startup.
- (gncal_day_panel_set): Fix selected-day display.
- (gncal_day_panel_new): Switch day on double clicks, not on single
- clicks.
-
- * calobj.c (ical_object_compute_end): Removed debug messages.
-
-1998-04-30 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * prop.c (prop_apply): Do not call prop_cancel, ths is now using
- GnomePropertyDialog.
-
-1998-04-29 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-week-view.c (sync_week): Use gnome_calendar_tag_calendar.
-
- * gnome-cal.c (gnome_calendar_tag_calendar): New routine used to
- fill a gtk_calendar with the events on a GnomeCalendar object.
-
- * gncal-week-view.c (gncal_week_view_new): Set the week to the day
- we double clicked.
-
-1998-04-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gnome-cal.c (calendar_notify): Apply black magic to get mail
- notifications to work.
-
- * gncal-full-day.c (child_focus_out): Temporary optimization, the
- child_focus_out is constantly calling the
- gnome_calendar_object_changed when the property editor has been
- invoked. This happens every time the mouse moves crosses the main
- window.
-
- * calendar.c (calendar_object_changed): Reschedule alarms when a
- calendar object has changed its times.
-
-Sat Apr 25 22:20:45 1998 Havoc Pennington <hp@pobox.com>
-
- * eventedit.c, eventedit.h: Descend from GnomeDialog. Took vbox
- out of class structure; use GnomeDialog vbox
- instead. gnome_dialog_set_destroy instead of destroying in button
- callbacks. Don't create buttons, separator, or vbox manually.
- #include <libgnomeui/gnome-dialog.h>.
-
-1998-04-24 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * calobj.c (ical_object_create_from_vobject): Fixed alarm loading;
- Load snooze time and snooze count
-
-1998-04-23 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * calendar.c (calendar_save): Actually save the to-do entries.
-
- * gncal-todo.c (simple_todo_editor): Now you can add and edit
- to-do entries.
-
-1998-04-22 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c: Made it use popup_menu().
-
- * popup-menu.c: New file with utility functions for creating popup
- menus. Maybe such a thing would be useful in libgnomeui, a la
- gnome-app-helper?
-
- * Makefile.am (gnomecal_SOURCES): Added popup-menu.[ch] to the sources.
-
-1998-04-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * prop.c (properties): Added Calendar properties editor.
- (properties): Make the code use a propery box.
-
- * main.c: Save/load properties (fix to old commit).
-
-1998-04-21 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-todo.c: New widget for editing TODO lists. This will be
- worked on a lot.
-
- * Makefile.am (gnomecal_SOURCES): Added gncal-todo.[ch] to the sources.
-
- * gncal-day-panel.c: Make it use the new TODO widget.
-
-1998-04-21 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * timeutil.c (isodate_from_time_t): Do not save with the global
- time flag (Z at the end of the isodate). When we figure out a way
- to load times in GMT time, we will add this back
-
- * view-utils.c (popup_menu): Moved this routine here as there are
- more users of this code.
-
- * gncal-day-view.c (gncal_day_view_class_init): Add button press
- handler.
- (new_appointment): New routine for creating appointments on a day.
-
-
-
- * main.c (save_ok): Added call to gtk_window_set_wmclass.
-
- * gncal-day-panel.c (calendar_day_selected): Fix, years for mktime
- should substract 1900 and gtk_calendar stores years relative to
- year 0.
-
- * gncal-week-view.c (gncal_week_view_new): Make the week view
- descend from VBox so that we can add a label to it.
- (gncal_week_view_set): Display the ending day of the week
- correctly.
-
- Added a label that displays the week range.
-
-1998-04-21 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gnome-cal.c: Made it use GncalDayPanel.
-
- * gncal-day-panel.c: New widget for the day view in the main
- calendar toplevel. It basically takes care of everything
- gnome-cal did by hand with respect to the day view.
-
- * Makefile.am (gnomecal_SOURCES): Added gncal-day-panel.[ch] to
- the rules.
-
- * main.c: Added a separator between the About menu item and the
- help topics.
-
-1998-04-20 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * eventedit.c (ee_ok): Mark the event as non-new after accepting changes.
-
-1998-04-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c (gncal_full_day_get_day_start_yoffset): New
- public function that returns the y offset for the row
- corresponding to the "day begin" time.
-
- * gncal-full-day.c (gncal_full_day_key_press): Now any printable
- keystroke (not just Return) will activate the selected range.
-
- * gncal-full-day.c (paint_back): Made it use the new paint_row
- function instead of painting everything directly. We calculate
- areas in a smarter way so there is even less flicker than before,
- especially when selecting regions.
-
- * eventedit.c: Sensitize recurrence widgets properly.
-
- * calobj.c (duration_callback): Pass the correct pointer type to
- is_date_in_list().
-
-1998-04-20 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * calobj.c (duration_callback): Take exception dates into
- account.
-
- * gncal-full-day.c (new_appointment): Setup the event editor dates
- to those of the currently displayed day.
- (gncal_full_day_selection_range): Use sensible values in the case
- no range is selected.
- (new_appointment): Events now use the current day for event creation.
-
- * view-utils.c: Pretty up the time display.
-
- * calobj.c (ical_object_compute_end): Initialize
- ico->recur->enddate, otherwise we loop forever during final date computation.
-
- * eventedit.c: Now recurrence is toggled by a radio button in the
- recurrence page, as the checkbox is confusing.
-
- * calobj.c (is_date_in_list): Add support for the exclussion
- dates.
-
-1998-04-18 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-year-view.c (double_click): Fix this routine as well.
-
- * gncal-week-view.c (jump_to_day): Bind the gtkcalendar signals to
- the week.
-
- * gncal-year-view.c (gncal_year_view_set_year): Put things in the
- proper range. Now the year view actually matches this year.
-
- * gnome-cal.html: Added small documentation.
-
- * main.c: Add more icons to the menus; Rename some menubar
- entries; Add `new' icon to the toolbar.
- (dump_events): Added argument handling and dumping of events from
- the command line. Extremely cool.
-
- * getdate.y: Taken from the CVS source code. Used for date
- parsing in the command line.
-
- Internationalized getdate.y. Wee! It even works with spanish.
-
- * calobj.c (ical_object_to_vobject): Add Quoted printable property
- to items containing new lines.
- (duration): Use unsigned integers, to work around buggy calendar
- files generated by korganizer.
-
- * main.c (save_calendar_cmd): Do not ask for file name if we are
- saving.
- (save_as_calendar_cmd): New command.
-
-
-1998-04-17 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * alarm.c (alarm_kill, alarm_init, alarm_add): Implement the alarm
- management framework.
-
-1998-04-17 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * calobj.c (ical_new): Added mandatory status property.
- (ical_object_to_vobject): Only store "related" list if it exists.
- (store_list): Add terminating null char and free the correct data.
-
- * main.c (save_calendar_cmd): Implemented calendar saving.
- (open_calendar_cmd): Implemented calendar loading.
- (new_calendar_cmd): Implemented calendar creation.
- (new_calendar): Don't load our test calendar by default.
-
- * gncal-full-day.c (delete_appointment): Delete appointment implemented.
-
- * eventedit.c (ee_store_recur_values_to_ical): Free/create
- ical's recurrence appropriately.
- (ee_rp_init_rule): Initialize all missing parameters from ical.
- (ee_rp_init_ending_date): Initialize missing fields from ical.
-
-1998-04-17 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gnome-cal.c (gnome_calendar_remove_object): Add support for
- removing objects.
-
-1998-04-17 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * eventedit.c (ee_init_recurrence_page): New function that creates
- the recurrence page in the toplevel notebook.
- (ee_store_recur_values_to_ical): Now we can also store the recurrences.
-
-1998-04-17 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * calobj.c (ical_object_generate_events): Implement
- RECUR_MONTHLY_BY_POS implemented.
- (ical_object_create_from_vobject): Fix the alarm
- initialization code.
- (save_alarm): Save alarms.
- (ical_object_generate_events): Fixed the recurrent code to take
- into account the recur->endate field (if at all specified).
-
- (ical_object_to_vobject): Implement recurrence rule saving.
-
-1998-04-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * eventedit.c (ee_store_alarm): Use menu_shell->children, not
- menu->children. Why does GtkMenu have a children field in the
- object structure?
- (check_dates): New function that insures that start_date < end_date.
- (check_times): In addition to checking whether the event spans the
- whole day, now it insures that start_time < end_time.
-
- * gncal-full-day.c (child_set_size): Now children get bigger
- temporarily while they are focused. This allows the handles not
- to "overlap" the rows used by the child and thus allow editing of
- very thin events.
- (recompute_motion): Fix for new child coordinates.
- (gncal_full_day_expose): Make it use find_child_by_window()
- instead of looking for it by hand.
-
- * bell.xpm recur.xpm: XPM files for events with alarm and
- recurrence, respectively.
-
-1998-04-15 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c (button_1): Preserve the up/down cursor while dragging.
-
- * gncal-full-day.c (child_draw): Now children have a vertical
- handle as well. This can be used to move the child anytime, not
- only when it is focused.
- (recompute_motion): Modified for new drag behavior.
-
- * eventedit.c (ee_init_general_page): The general_owner may be
- null. Do the proper thing when creating the label.
- (ee_ok): Update the gnome calendar appropriately.
-
- * timeutil.h:
- * gncal-year-view.h: Add some missing prototypes.
-
- * gncal-full-day.c (child_popup_menu): Set the sensitivity of menu
- items according to whether the ical object is being edited or not.
-
- * eventedit.c (event_editor_new): Set the "being edited" flag on
- the ical object (stored as the ical object's user data).
- (event_editor_destroy): Release the flag.
-
- * calobj.h: The iCalObject structure now has a generic user_data pointer.
- * calobj.c (ical_object_set_user_data ical_object_get_user_data):
- Functions to set this data.
-
- * gncal-full-day.c (child_button_press): Do child popup menu correctly.
-
- * main.c (about_calendar_cmd): Fixed my address and added Arturo
- to the authors in the about box.
-
- * gncal-full-day.c (find_child_by_window): Compare child's widget
- windows by user_data (which will be the parent widget, that is,
- the text widget). We cannot assume that child->widget->window
- will be *the* window we are interested on because there may be
- child widgets with multiple windows.
-
-1998-04-15 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * calobj.c (ical_foreach): Define iterator routine.
-
-1998-04-15 Arturo Espinosa Aldama <arturo@nuclecu.unam.mx>
-
- * gncal-year-view.[hc]: Now using time_t for new and set.
- Random fixes, as well.
-
-1998-04-15 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c (button_3): New popup menus activated with
- mouse button 3.
- (create_appointment): Create a new appointment from the popup
- menus. See the FIXME.
-
-1998-04-15 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-full-day.c (layout_kill_rows): Routine to destory rows
- array properly.
-
- * gncal-year-view.c (gncal_year_view_new): Add missing year in
- call to strftime.
-
- * calobj.c (ical_object_create_from_vobject): Fixed memory leaks
- from the return values of versit's fakeCString.
-
-1998-04-14 Arturo Espinosa Aldama <arturo@nuclecu.unam.mx>
-
- * gncal-year-view.[hc]: New widget for the year view.
- * Makefile.am: added required compilation of the new files.
-
-1998-04-14 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * eventedit.c (event_editor_setup_time_frame): Fixed some table
- expansions to make the dialog look nicer when resized.
-
- * calobj.c (ignore_space): Fixed compiler warning about unused
- computed value.
- (ocurrencelist): Replace str by p confusion. Removed unused
- variables value and q.
- (daynumber): Fixed a couple of warnings about unused values.
- (load_recurrence): Removed unused variable c. Added a default
- clause to the switch(type).
-
- * eventedit.c (ee_rp_init_frequency): Removed unused variable content.
- Fixed a compiler warning by adding a missing cast.
-
- * calobj.c (ical_object_create_from_vobject): Make the
- load_recurrence() part work correctly. Eliminated use of
- syntax_error variable.
-
-1998-04-13 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c (child_key_press): Unfocus the child and focus
- the parent fullday widget when the user presses Esc.
-
- * gncal-week-view.c (gncal_week_view_update): Now takes object and
- flags parameters.
- * gncal-day-view.c (gncal_day_view_update): Likewise.
- * gncal-full-day.c (gncal_full_day_update): Likewise.
- (child_focus_in): New function. In conjunction with
- child_focus_out(), these only display the handles in the child
- when it is focused. The result is that the user can see more of
- the child's text when nothing is focused, and we can also display
- fatter and nicer drag handles.
-
- * gnome-cal.c (gnome_calendar_object_changed): Now takes an
- additional flags parameter
- (gnome_calendar_update_all): Made function static. Now takes
- changed object and flags parameters as well.
- (gnome_calendar_object_changed): Now takes additional flags
- parameter to indicate what changed in the specified object.
-
- * calobj.h (CalObjectChange): New enum with flags to describe what
- has been changed in an object.
-
- * gncal-full-day.h:
- * gncal-full-day.c (gncal_full_day_focus_child): New function to
- let the outside world decide which child to focus.
- (gncal_full_day_focus_child): Bleah. We have to synthesize a
- click because GtkText will not set the cursor when you focus it.
-
- * gnome-cal.c (day_view_range_activated): Focus the new child in
- the full day widget.
-
- * eventedit.c (event_editor_setup_time_frame): Re-aligned some
- widgets to make it look prettier.
- (ee_alarm_widgets): Likewise.
- (ee_init_general_page): Likewise.
- (ee_classification_widgets): Likewise.
- (event_editor_init_widgets): Likewise.
-
- * gnome-cal.c (day_view_range_activated): Create new object and
- add it to the calendar. You can now select a range in the
- full-day view, hit Return, and a new event will be added at the
- selected range. I still have to figure out how to focus this new child.
-
- * gncal-full-day.c (paint_back): Rewrote function to avoid
- painting an area more than once -- eliminate flicker.
- (paint_back_rows): New function that calls paint_back() only for
- the area of the specified rows.
- (gncal_full_day_button_press):
- (gncal_full_day_button_release):
- (gncal_full_day_motion): Made these functions use
- paint_back_rows() instead of paint_back(), to eliminate flicker. Wheee!
-
-1998-04-12 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gnome-cal.c (setup_day_view): We now connect to the
- range_activated signal of the fullday widget instead of catching
- key presses ourselves.
- (day_view_range_activated): New function that creates a new
- iCalObject and inserts it into the calendar, not finished yet.
-
-1998-04-11 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c (get_time_from_rows): New function, calculates
- a pair of time_t values from the specified start and number of rows.
-
- * gncal-full-day.h (GncalFullDayClass): New signal
- "range_activated". It is emitted when a range is selected and the
- user hits Return.
- (gncal_full_day_selection_range): New function, returns the
- selected range.
-
- * gncal-full-day.c (struct drag_info): Moved selection information
- to their own fields instead of sharing the child's drag fields.
- This allows us to keep the selection when a child is moved.
- (recompute_motion): Made the case when (row < di->sel_click_row)
- work correctly.
-
-1998-04-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gnome-cal.c (gnome_calendar_goto): Add support for navigating
- on the day view.
-
- * timeutil.c (time_start_of_day, time_end_of_day, time_day_hour):
- New time manipulation functions.
-
- * eventedit.c (ee_rp_init_frequency): Add the different frequency
- editors to a notebook. Make the notebook startup on the entry
- selected recurrence type;
-
-1998-04-11 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c (recompute_motion): Now we support selecting a
- range in the main window (by clicking+dragging). It flickers
- horribly and is not perfect, but it is a start.
-
-1998-04-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c: #include <string.h>
-
- * gncal-full-day.c (child_map): Show instead of just map the child
- widget (otherwise the text widget gets confused and will not focus).
-
- * calobj.c (ical_object_to_vobject): Quote chars as 'x', not "x".
-
- * calobj.h: Added prototype for ical_object_to_vobject().
-
- * gnome-cal.c (gnome_calendar_object_changed): New function. This
- should be called when a calendar object is changed.
-
- * gncal-full-day.c (update_from_drag_info): Call
- gnome_calendar_object_changed() instead of updating manually.
-
- * calendar.c (calendar_add_object):
- (calendar_remove_object): Set the modified flag to true.
-
- * gncal-full-day.c (gncal_full_day_draw): Finished implementing
- this function.
-
-1998-04-08 Raja R Harinath <harinath@cs.umn.edu>
-
- * gncal.c (update_calendar): Say `#if 0', not `#ifdef 0'.
-
-1998-04-07 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * eventedit.c: Removed unused global variable parent_class.
-
- * eventedit.h: Renamed gtk_window field to window.
- Made the parent_class field in the EventEditorClass structure be a
- GtkWindowClass, not a gnome property box class.
- Added prototype for event_editor_get_type().
-
-1998-04-06 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-week-view.c (gncal_week_view_new): Use the new
- gtk_table_set_homogeneous() instead of setting the variable directly.
-
-1998-04-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * eventedit.c (ee_create_ae): Make it return void.
- (ee_alarm_widgets): Remove some unused variables.
- (ee_store_alarm): Make it return void.
- #include <string.h>
-
- * eventedit.h: #include "gnome-cal.h"
-
- * calobj.c (list_free): Don't use g_free in the g_list_foreach.
-
- * calendar.h: Add prototype for calendar_load().
-
- * timeutil.h: Add prototypes for time_add_*().
-
- * calendar.c:
- * calobj.c:
- * eventedit.c:
- * gnome-cal.c: #include "timeutil.h"
-
- * gncal-day-view.c (gncal_day_view_size_request): Make the minimum
- width equal or larger to the title width.
-
- * main.c: #include "eventedit.h"
- (main): Add a return statement.
- (new_calendar): Show stuff *after* the calendar has been loaded.
-
- * gnome-cal.c (gnome_calendar_load): Update the day view.
- (setup_widgets): Hackish setup of a day view widget - will fix later.
- (gnome_calendar_init): Initialize all fields.
-
- * gnome-cal.h: Added day_view field. Maybe this should be changed
- when the a complete day view panel is complete.
-
- * gncal-day-view.c (gncal_day_view_update): Draw after update, not
- before.
-
-1998-04-06 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de>
-
- * versit/.cvsignore: New file.
-
-Fri Apr 3 22:31:54 1998 Tom Tromey <tromey@cygnus.com>
-
- * calendar.c: Include <config.h>.
-
-1998-04-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * timeutil.c (time_add_year, time_add_year, time_add_week):
- Routines for time manipulation.
-
- * calobj.c (ical_object_destroy): Full destruction of the object.
-
- * eventedit.c: Finished the main event editor form; It still
- lacks the details and the recurrence bits. It now adds events
- and cancels.
-
-1998-04-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * view-utils.c (view_utils_draw_events): The "better" format
- string for strftime() wasn't better, after all :-(
-
-1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-full-day.c: New full-day widget. It is still a work in
- progress. It will be similar to M$ Schedule's nifty full day view
- widget, but with Gtk's elegance :-)
-
- * Makefile.am (gnomecal_SOURCES): Added gncal-full-day.[ch] to the sources.
-
-1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * eventedit.c: Object editor widget. We dropped ObjEdit.
-
- * timeutil.c (time_from_isodate): Fix.
-
- * view-utils.c (view_utils_draw_events): Changed the display
- formats.
-
-1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * view-utils.c (view_utils_draw_events): Use better format
- specifier for strftime().
- (view_utils_draw_textured_frame): Ultra-nifty function to draw
- textured "metal" frames, like Netscape's handles.
-
-1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * gncal-day-view.c (gncal_day_view_update): Day events are now
- cached inside the widget. They get initialized at this time.
-
- * view-utils.c (view_utils_draw_events): Use the list of events.
-
-1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-day-view.c (gncal_day_view_set_shadow): New customization
- function. We can't decide on a stupid border type :-)
- (gncal_day_view_init): Made GTK_SHADOW_ETCHED_IN be the default
- shadow type. Looks good.
-
-1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * main.c: New main program that uses our new datatypes and
- objects.
-
- * calendar.c (calendar_load_from_vobject, calendar_load):
- Implement loading of vCalendar objects and vCalendar files.
-
- * calobj.c (ical_object_create_from_vobject): Implement loading of
- vCalendar event and todo objects.
-
- * timeutil.c (isodate_from_time_t): New function.
-
- * gnome-cal.c, gnome-cal.h: Implement a toplevel widget, derived
- from GnomeApp. It holds all of the day views and arbitrates the
- display.
-
-1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-week-view.[ch]: New week view composite widget. This
- provides a full week view (7 day views plus busy time display --
- the latter is currently unimplemented).
-
-1998-04-01 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal-day-view.c: New day view widget. It is intended to be a
- child widget of the week view composite widget.
-
- * calendar.c (calendar_get_objects_in_range):
- (calendar_get_events_in_range):
- (calendar_get_journal_in_range):
- (calendar_get_journal_in_range): These functions now take a
- sort_func parameter, which is of type GCompareFunc. If the
- specified value is non-NULL, it will return a sorted list.
- Otherwise, it will return an unordered list.
- (calendar_compare_by_dtstart): Provide a generic sorting routine
- for calendar objects.
-
-1998-04-01 Miguel de Icaza <miguel@kernel.org>
-
- * Start from scratch
-
-Tue Mar 31 23:46:50 1998 Tom Tromey <tromey@cygnus.com>
-
- * timeutil.c (format_simple_hour): `buf' now static.
-
-1998-03-31 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal.c: Removed #include "gtkcalendar.h", because it now comes
- from libgnomeui.
-
- * Makefile.am (gncal_SOURCES): Added new source files to the rules.
-
- * timeutil.c (format_simple_hour): New function, formats an
- hour/am_pm pair into a string of the form "3am", "12pm", "05h",
- "19h", etc. It is used by the day view widget for its labels.
-
-1998-03-31 Craig Small <csmall@small.dropbear.id.au>
-
- * Now has (non working) session maangement
- * Uses a clist for the dailylist like gtt
-
-Sat Mar 21 15:43:20 1998 Tom Tromey <tromey@cygnus.com>
-
- * gncal.c: Use gnome_message_box_*, not gnome_messagebox_*.
-
-1998-03-12 Craig Small <csmall@small.dropbear.id.au>
-
- * Now linked (in some horrible way) to the gtkcalendar widget.
-
-Sun Mar 8 16:38:10 1998 Tom Tromey <tromey@cygnus.com>
-
- * Makefile.am (INCLUDES): Added GNOME_INCLUDEDIR.
- (gncal_LDADD): Don't include libsupport.a.
-
- * gncal.c (main): Use new gnome_init.
-
-1998-02-19 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * gncal.c (main): Added app_id "gncal".
-
-1998-02-19 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de>
-
- * Makefile.am (gncal_LDADD): Added '$(INTLLIBS)'
-
-1998-02-18 Raja R Harinath <harinath@cs.umn.edu>
-
- * Makefile.am (gncal_LDADD): Include `libsupport.a'.
-
- * calcs.c (month_atoi): Replace buggy explicit loop string compare
- with strcasecmp.
- (day_atoi): Likewise.
-
-Sun Jan 25 23:38:30 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
-
- * menus.c: Replace "Quit" with "Exit".
diff --git a/calendar/GnomeCal.idl b/calendar/GnomeCal.idl
deleted file mode 100644
index 3f9a64d291..0000000000
--- a/calendar/GnomeCal.idl
+++ /dev/null
@@ -1,115 +0,0 @@
-module GNOME {
-
- module Calendar {
-
- interface Repository {
-
- exception NotFound {};
- typedef sequence<string> String_Sequence;
-
- /*
- * get_object:
- * @uid: Unique Identifier for the object
- *
- * Returns a vCalendar object for the object
- * that matches the UID @uid.
- */
- string get_object (in string uid)
- raises (NotFound);
-
- /*
- * get_objects_by_id_list:
- * @uid_list: a sequence of Unique Identifiers
- *
- * Returns a vCalendar object for the objects
- * that matches the given UID list @uid_list;
- * NotFound is raised if any of the given UIDs
- * were not found.
- */
- string get_objects_by_id_list (in String_Sequence uid)
- raises (NotFound);
-
- /*
- * get_object_by_pilot_id:
- * @pilot_id: the pilot id
- *
- * Returns the object that has the @pilot_id
- * identifier.
- */
- string get_object_by_pilot_id (in long pilot_id)
- raises (NotFound);
-
- /*
- * get_id_from_pilot_id:
- * @pilot_id: the pilot id
- *
- * Returns the object id that matches the @pilot_id
- * identifier.
- */
- string get_id_from_pilot_id (in long pilot_id)
- raises (NotFound);
-
- /*
- * delete_object:
- * @uid: Unique Identifier for the object
- */
- void delete_object (in string uid)
- raises (NotFound);
-
- /*
- * update_object:
- * @uid: uid of object to update
- * @object: vcard object to update
- */
- void update_object (in string uid, in string object);
-
- /*
- * update_pilot_id:
- * @uid: Unique identifier for the event we want to update
- * @pilot_id: new ID assigned by the pilot
- * @pilot_status: Status to flag the event with
- */
- void update_pilot_id (in string uid, in long pilot_id, in long pilot_status)
- raises (NotFound);
-
- /*
- * get_objects:
- *
- * Danger Will Robinson : This can result in a
- * huge string, namely the size of all your entries.
- * Returns a vCalendar with all the objects
- */
- string get_objects ();
-
- /*
- * get_object_id_list
- *
- * Returns a sequence of the UID's of the entries
- */
- String_Sequence get_object_id_list();
-
- /*
- * get_updated_objects:
- *
- * Returns a vCalendar with all the objects that have been
- * modified since the last Pilot Sync
- */
- string get_updated_objects ();
-
- /*
- * Returns the number of objects in the calendar
- * repository.
- */
- long get_number_of_objects();
-
- /*
- * done:
- *
- * Informs the calendar that we are done using it,
- * gets a chance to destroy windows and save information.
- */
- void done ();
- };
- };
-};
-
diff --git a/calendar/Makefile.am b/calendar/Makefile.am
deleted file mode 100644
index 914bd8c398..0000000000
--- a/calendar/Makefile.am
+++ /dev/null
@@ -1,223 +0,0 @@
-SUBDIRS = doc
-
-idldir = $(datadir)/idl
-idl_DATA = GnomeCal.idl
-
-gnorbadir = $(sysconfdir)/CORBA/servers
-gnorba_DATA = gnomecal.gnorba
-
-help_base = $(datadir)/gnome/help/cal
-
-if HAVE_GNOME_PILOT
-extra_pilot_bins = \
- calendar-conduit-control-applet \
- calendar-pilot-sync
-endif
-bin_PROGRAMS = gnomecal $(extra_pilot_bins)
-
-INCLUDES = \
- -I$(includedir) \
- $(GNOME_INCLUDEDIR) \
- $(GNOME_CONDUIT_INCLUDEDIR) \
- $(PISOCK_INCLUDEDIR) \
- -DGNOMELOCALEDIR=\""$(datadir)/locale"\"
-
-GNOMECAL_CORBA_GENERATED = \
- GnomeCal.h \
- GnomeCal.c \
- GnomeCal-common.c \
- GnomeCal-skels.c \
- GnomeCal-stubs.c
-
-$(GNOMECAL_CORBA_GENERATED): my_gnomecal_idl
-
-my_gnomecal_idl: GnomeCal.idl
- orbit-idl $(srcdir)/GnomeCal.idl
- touch my_gnomecal_idl
-
-corba-cal.c \
-corba-cal.h \
-corba-cal-factory.c \
-corba-cal-factory.h: GnomeCal.h
-
-gnomecal_SOURCES = \
- GnomeCal-common.c \
- GnomeCal-skels.c \
- GnomeCal.h \
- alarm.c \
- alarm.h \
- calendar.c \
- calendar.h \
- calendar-conduit.h \
- calobj.c \
- calobj.h \
- eventedit.c \
- eventedit.h \
- getdate.y \
- corba-cal.c \
- corba-cal.h \
- corba-cal-factory.c \
- corba-cal-factory.h \
- gncal-day-panel.c \
- gncal-day-panel.h \
- gncal-day-view.c \
- gncal-day-view.h \
- gncal-full-day.c \
- gncal-full-day.h \
- gncal-week-view.c \
- gncal-week-view.h \
- gncal-todo.c \
- gncal-todo.h \
- gnome-month-item.c \
- gnome-month-item.h \
- gnome-cal.c \
- gnome-cal.h \
- html-month.c \
- goto.c \
- layout.c \
- layout.h \
- main.c \
- main.h \
- mark.c \
- mark.h \
- month-view.c \
- month-view.h \
- popup-menu.c \
- popup-menu.h \
- prop.c \
- quick-view.c \
- quick-view.h \
- timeutil.c \
- timeutil.h \
- todo-conduit.h \
- view-utils.h \
- view-utils.c \
- year-view.c \
- year-view.h
-
-calendar_pilot_sync_SOURCES = \
- GnomeCal-common.c \
- GnomeCal-stubs.c \
- alarm.c \
- calendar-pilot-sync.c \
- calobj.c \
- calobj.h \
- calendar.c \
- calendar.h \
- timeutil.c \
- timeutil.h
-
-LINK_FLAGS = \
- $(GNOME_LIBDIR) \
- $(GNOMEGNORBA_LIBS) \
- $(INTLLIBS) \
- ../libversit/libversit.la
-
-calendar_pilot_sync_LDADD = \
- $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
- $(LINK_FLAGS)
-
-if HAVE_GNOME_PILOT
-#calendar_conduit
-calendar_conduitsdir=$(libdir)/gnome-pilot/conduits
-
-calendar_conduits_LTLIBRARIES = libcalendar_conduit.la
-endif
-
-libcalendar_conduit_la_SOURCES = \
- GnomeCal-common.c \
- GnomeCal-stubs.c \
- calendar-conduit.c \
- calobj.c \
- alarm.c \
- calendar.c \
- timeutil.c
-
-calendar-conduit.c: my_gnomecal_idl
-
-libcalendar_conduit_la_LDFLAGS = \
- -rpath $(libdir)
-
-libcalendar_conduit_la_LIBADD = \
- ../libversit/libversit.la \
- $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
- $(GNOME_LIBDIR) \
- $(GNOME_LIBS)
-
-calendar_conduit_control_applet_SOURCES = \
- calendar-conduit-control-applet.c
-
-calendar_conduit_control_applet_LDADD = \
- $(CAPPLET_LIBS) \
- $(GNOME_LIBDIR) \
- $(GNOME_CAPPLET_LIBS) \
- $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
- $(GNOMEUI_LIBS) \
- $(GNOME_PILOT_LIBS) \
- $(INTLLIBS)
-
-#todo_conduit
-#todo_conduitsdir=$(libdir)/gnome-pilot/conduits
-
-#todo_conduits_LTLIBRARIES = libtodo_conduit.la
-
-#libtodo_conduit_la_LDFLAGS = \
-# -rpath $(libdir)
-
-#libtodo_conduit_la_LIBADD = \
-# $(GNOME_LIBDIR) \
-# $(GNOME_LIBS)
-
-#libtodo_conduit_la_SOURCES = \
-# todo-conduit.c
-
-#todo-conduit.c: GnomeCal.h
-
-#todo_conduit_control_applet_SOURCES = \
-# todo-conduit-control-applet.c
-
-#todo_conduit_control_applet_LDADD = \
-# $(CAPPLET_LIBS) \
-# $(GNOME_LIBDIR) \
-# $(GNOME_CAPPLET_LIBS) \
-# $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
-# $(GNOMEUI_LIBS) \
-# $(GNOME_PILOT_LIBS) \
-# $(INTLLIBS)
-
-gnomecal_LDADD = $(LINK_FLAGS)
-
-if HAVE_GNOME_PILOT
-ccenterdir = $(datadir)/control-center
-Rootdir = $(ccenterdir)
-PalmPilotdir = $(ccenterdir)/Peripherals/PalmPilot
-Conduitsdir = $(PalmPilotdir)/Conduits
-
-Conduits_DATA = \
- calendar-conduit-control-applet.desktop \
- todo-conduit-control-applet.desktop
-
-Conduits_seconddir = $(datadir)/gnome/apps/Settings/Peripherals/PalmPilot/Conduits/
-Conduits_second_DATA = $(Conduits_DATA)
-endif
-
-EXTRA_DIST = \
- gncal.desktop \
- calendar-conduit-control-applet.desktop \
- todo-conduit-control-applet.desktop \
- bell.xpm \
- recur.xpm \
- $(idl_DATA) \
- $(gnorba_DATA) \
- gnome-calendar-conduit.png
-
-appicondir = $(datadir)/pixmaps
-appicon_DATA = gnome-calendar-conduit.png
-
-Productivitydir = $(datadir)/gnome/apps/Applications
-
-Productivity_DATA = gncal.desktop
-
-install-data-local:
- $(mkinstalldirs) $(DESTDIR)$(help_base)/C
- $(mkinstalldirs) $(Conduitsdir)
diff --git a/calendar/TODO b/calendar/TODO
deleted file mode 100644
index 2dbd29cdbb..0000000000
--- a/calendar/TODO
+++ /dev/null
@@ -1,68 +0,0 @@
-Pilot:
-
-* Better support for untimed events (we have none now).
-
-* Hash objects based on their UIDs.
-
-* Add placeholders for deleted events, so that we can kill those
- when syncing to the pilot.
-
-BUGS:
-
-- Recurrence end date is wrong. An event that repeats daily will not
- be included in the ending date of the recurrence (off-by-one
- error?).
-
-- X-fields (extensions) are stripped from a vCal file when it is
- saved. They should be preserved.
-
-Features:
-
-- Add a calendar-week so that people know which week of the year it is
-
-Year view:
-
-- See why it is so fucking slow when opening its notebook page for the
- first time.
-
-Month view:
-
-- Popup menu like in the year view.
-
-- Double click on a day takes you to the day view.
-
-- DnD of appointments to move them around.
-
-Week view:
-
-- Nice display as in the Palm Pilot.
-
-Day view:
-
-- Rewrite in terms of the canvas and make it pretty.
-
-Preferences:
-
-- BUG: 12/24 hours stuff is not consistent - I remember that on editing
- new appointment you get the time-selectors always on 12-hr format
-
-Event editor dialog:
-
-- Make it figure out whether the alarm is in
- minutes/hours/days/etc. (via a cascade of conditions) and set the
- widgets appropriately.
-
-Gnome date selection widget:
-
-- Make the displayed date be localized properly -- use strftime().
-
-General:
-
-- Write online help. Nice help. Lots of help.
-
-- If you leave the calendar running overnight, the "current day"
- marker in the GnomeMonthItems does not get updated.
-
-- Add categories support. Color-coded categories.
-
-- Untimed events
diff --git a/calendar/alarm.c b/calendar/alarm.c
deleted file mode 100644
index cf1cd8fb60..0000000000
--- a/calendar/alarm.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Alarm handling for the GNOME Calendar.
- *
- * (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-#include <config.h>
-#include <time.h>
-#include <gnome.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/time.h>
-#include "calobj.h"
-#include "alarm.h"
-
-/* The pipes used to notify about an alarm */
-int alarm_pipes [2];
-
-/* The list of pending alarms */
-static GList *alarms;
-
-static void *head_alarm;
-
-typedef struct {
- time_t activation_time;
- AlarmFunction fn;
- void *closure;
- CalendarAlarm *alarm;
-} AlarmRecord;
-
-enum DebugAction {
- ALARM_ACTIVATED,
- ALARM_ADDED,
- ALARM_NOT_ADDED
-};
-
-void debug_alarm (AlarmRecord* ar, enum DebugAction action);
-void calendar_notify (time_t time, CalendarAlarm *which, void *data);
-extern int debug_alarms;
-
-/*
- * SIGALRM handler. Notifies the callback about the alarm
- */
-static void
-alarm_activate ()
-{
- char c = 0;
-
- write (alarm_pipes [1], &c, 1);
-}
-
-/*
- * SIGUSR1 handler. Toggles debugging output
- */
-static void
-toggle_debugging ()
-{
- debug_alarms = !debug_alarms;
-}
-
-static void
-alarm_ready (void *closure, int fd, GdkInputCondition cond)
-{
- AlarmRecord *ar = head_alarm;
- time_t now = time (NULL);
- char c;
-
- if (read (alarm_pipes [0], &c, 1) != 1)
- return;
-
- if (ar == NULL){
- g_warning ("Empty events. This should not happen\n");
- return;
- }
-
- while (head_alarm){
- if (debug_alarms)
- debug_alarm (ar, ALARM_ACTIVATED);
- (*ar->fn)(ar->activation_time, ar->alarm, ar->closure);
- alarms = g_list_remove (alarms, head_alarm);
-
- /* Schedule next alarm */
- if (alarms){
- AlarmRecord *next;
-
- head_alarm = alarms->data;
- next = head_alarm;
-
- if (next->activation_time > now){
- struct itimerval itimer;
-
- itimer.it_interval.tv_sec = 0;
- itimer.it_interval.tv_usec = 0;
- itimer.it_value.tv_sec = next->activation_time - now;
- itimer.it_value.tv_usec = 0;
- setitimer (ITIMER_REAL, &itimer, NULL);
- break;
- } else {
- g_free (ar);
- ar = next;
- }
- } else
- head_alarm = NULL;
- }
- g_free (ar);
-}
-
-static int
-alarm_compare_by_time (gconstpointer a, gconstpointer b)
-{
- const AlarmRecord *ara = a;
- const AlarmRecord *arb = b;
- time_t diff;
-
- diff = ara->activation_time - arb->activation_time;
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-/**
- * alarm_add:
- *
- * Tries to schedule @alarm.
- *
- * Returns TRUE if the alarm was scheduled.
- */
-gboolean
-alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure)
-{
- time_t now = time (NULL);
- AlarmRecord *ar;
- time_t alarm_time = alarm->trigger;
-
- ar = g_new0 (AlarmRecord, 1);
- ar->activation_time = alarm_time;
- ar->fn = fn;
- ar->closure = closure;
- ar->alarm = alarm;
-
- /* If it already expired, do not add it */
- if (alarm_time < now) {
- if (debug_alarms)
- debug_alarm (ar, ALARM_NOT_ADDED);
- return FALSE;
- }
-
- alarms = g_list_insert_sorted (alarms, ar, alarm_compare_by_time);
-
- /* If first alarm is not the previous first alarm, reschedule SIGALRM */
- if (head_alarm != alarms->data){
- struct itimerval itimer;
- int v;
-
- /* Set the timer to disable upon activation */
- itimer.it_interval.tv_sec = 0;
- itimer.it_interval.tv_usec = 0;
- itimer.it_value.tv_sec = alarm_time - now;
- itimer.it_value.tv_usec = 0;
- v = setitimer (ITIMER_REAL, &itimer, NULL);
- head_alarm = alarms->data;
- }
- if (debug_alarms)
- debug_alarm (ar, ALARM_ADDED);
- return TRUE;
-}
-
-int
-alarm_kill (void *closure_key)
-{
- GList *p;
-
- for (p = alarms; p; p = p->next){
- AlarmRecord *ar = p->data;
-
- if (ar->closure == closure_key){
- alarms = g_list_remove (alarms, p->data);
- if (alarms)
- head_alarm = alarms->data;
- else
- head_alarm = NULL;
- return 1;
- }
- }
- return 0;
-}
-
-void
-alarm_init (void)
-{
- struct sigaction sa;
- struct sigaction debug_sa;
- int flags = 0;
-
- pipe (alarm_pipes);
-
- /* set non blocking mode */
- fcntl (alarm_pipes [0], F_GETFL, &flags);
- fcntl (alarm_pipes [0], F_SETFL, flags | O_NONBLOCK);
- gdk_input_add (alarm_pipes [0], GDK_INPUT_READ, alarm_ready, 0);
-
- /* Setup the signal handler */
- sa.sa_handler = alarm_activate;
- sigemptyset (&sa.sa_mask);
- sa.sa_flags = SA_RESTART;
- sigaction (SIGALRM, &sa, NULL);
-
- /* Setup a signal handler to toggle debugging */
- debug_sa.sa_handler = toggle_debugging;
- sigemptyset (&debug_sa.sa_mask);
- debug_sa.sa_flags = SA_RESTART;
- sigaction (SIGUSR1, &debug_sa, NULL);
-}
-
-void
-debug_alarm (AlarmRecord* ar, enum DebugAction action)
-{
- time_t now = time (NULL);
- iCalObject *ico = ar->closure;
- printf ("%s", ctime(&now));
- switch (action) {
- case ALARM_ADDED:
- printf ("Added alarm for %s", ctime(&ar->activation_time));
- break;
- case ALARM_NOT_ADDED:
- printf ("Alarm not added for %s", ctime(&ar->activation_time));
- break;
- case ALARM_ACTIVATED:
- printf ("Activated alarm\n");
- break;
- }
-
- if (ar->fn!=&calendar_notify) return;
- printf ("--- Summary: %s\n", ico->summary);
- switch (ar->alarm->type) {
- case ALARM_MAIL:
- printf ("--- Type: Mail\n");
- break;
- case ALARM_PROGRAM:
- printf ("--- Type: Program\n");
- break;
- case ALARM_DISPLAY:
- printf ("--- Type: Display\n");
- break;
- case ALARM_AUDIO:
- printf ("--- Type: Audio\n");
- break;
- }
-}
-
-
diff --git a/calendar/alarm.h b/calendar/alarm.h
deleted file mode 100644
index 81710bda5e..0000000000
--- a/calendar/alarm.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef ALARM_H
-#define ALARM_H
-
-#include <time.h>
-
-typedef void (*AlarmFunction)(time_t time, CalendarAlarm *which, void *closuse);
-
-void alarm_init (void);
-gboolean alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure);
-int alarm_kill (void *closure);
-
-#endif
diff --git a/calendar/bell.xpm b/calendar/bell.xpm
deleted file mode 100644
index b1ab537a17..0000000000
--- a/calendar/bell.xpm
+++ /dev/null
@@ -1,83 +0,0 @@
-/* XPM */
-static char * bell_xpm[] = {
-"16 16 64 1",
-" c None",
-". c #000000",
-"+ c #E3BB43",
-"@ c #E6C049",
-"# c #EED275",
-"$ c #F4E193",
-"% c #F4DF8C",
-"& c #EAC95C",
-"* c #EFD57A",
-"= c #FAEFBB",
-"- c #FDF6D3",
-"; c #FDF5C6",
-"> c #F4E18F",
-", c #E4BD43",
-"' c #F6E295",
-") c #FEF9D8",
-"! c #FFFFFF",
-"~ c #FFFADA",
-"{ c #FCEEAA",
-"] c #EBCA5A",
-"^ c #E9C550",
-"/ c #FAEA9C",
-"( c #FEF7CB",
-"_ c #FFF8CC",
-": c #FDF1A8",
-"< c #EED060",
-"[ c #D39D12",
-"} c #F2D55D",
-"| c #FCEC91",
-"1 c #FFF4AE",
-"2 c #FFF5B6",
-"3 c #FEEF97",
-"4 c #F3D65E",
-"5 c #D5A216",
-"6 c #FAE05C",
-"7 c #FFED7C",
-"8 c #FFEF8C",
-"9 c #FFF092",
-"0 c #FDEB7A",
-"a c #F4D750",
-"b c #D8A717",
-"c c #EAC01D",
-"d c #F6D83E",
-"e c #FAE255",
-"f c #FAE362",
-"g c #F9E161",
-"h c #F6DE5B",
-"i c #F1D145",
-"j c #E6BE28",
-"k c #D09B09",
-"l c #B67E00",
-"m c #CE9100",
-"n c #D69F04",
-"o c #E0B011",
-"p c #E6BA1D",
-"q c #E3B721",
-"r c #E0B21E",
-"s c #DCAB16",
-"t c #D7A20D",
-"u c #CC9303",
-"v c #BE8400",
-"w c #AC7500",
-"x c #A06B00",
-"y c #FFDD00",
-" ",
-" .. ",
-" .+@. ",
-" .#$%&. ",
-" .*=-;>,. ",
-" .')!~{]. ",
-" .^/(~_:<[. ",
-" .}|121345. ",
-" .678980ab. ",
-" .cdefghijkl. ",
-" .mnopqrstuvwx. ",
-" .............. ",
-" .8y. ",
-" .. ",
-" ",
-" "};
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c
deleted file mode 100644
index f3004ddb13..0000000000
--- a/calendar/cal-util/calobj.c
+++ /dev/null
@@ -1,1490 +0,0 @@
-/*
- * Calendar objects implementations.
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (quartic@gimp.org)
- */
-#include <config.h>
-#include <string.h>
-#include <glib.h>
-#include <ctype.h>
-#include <unistd.h>
-#include "calobj.h"
-#include "timeutil.h"
-#include "../libversit/vcc.h"
-
-extern CalendarAlarm alarm_defaults[4];
-
-static char *
-ical_gen_uid (void)
-{
- static char *hostname;
- time_t t = time (NULL);
- static int serial;
-
- if (!hostname){
- char buffer [128];
-
- if ((gethostname (buffer, sizeof (buffer)-1) == 0) &&
- (buffer [0] != 0))
- hostname = g_strdup (buffer);
- else
- hostname = g_strdup ("localhost");
- }
-
- return g_strdup_printf (
- "%s-%d-%d-%d-%d@%s",
- isodate_from_time_t (t),
- getpid (),
- getgid (),
- getppid (),
- serial++,
- hostname);
-}
-
-iCalObject *
-ical_object_new (void)
-{
- iCalObject *ico;
-
- ico = g_new0 (iCalObject, 1);
-
- ico->seq = -1;
- ico->dtstamp = time (NULL);
- ico->uid = ical_gen_uid ();
-
- ico->pilot_id = 0;
- ico->pilot_status = ICAL_PILOT_SYNC_MOD;
-
- return ico;
-}
-
-static void
-default_alarm (iCalObject *ical, CalendarAlarm *alarm, char *def_mail, enum AlarmType type)
-{
- alarm->type = type;
- alarm->enabled = alarm_defaults[type].enabled;
- alarm->count = alarm_defaults[type].count;
- alarm->units = alarm_defaults[type].units;
- if (alarm_defaults[type].data)
- alarm->data = g_strdup (alarm_defaults[type].data);
- else
- alarm->data = g_strdup ("");
-}
-
-iCalObject *
-ical_new (char *comment, char *organizer, char *summary)
-{
- iCalObject *ico;
-
- ico = ical_object_new ();
-
- ico->comment = g_strdup (comment);
- ico->organizer = g_strdup (organizer);
- ico->summary = g_strdup (summary);
- ico->class = g_strdup ("PUBLIC");
- ico->status = g_strdup ("NEEDS ACTION");
-
- default_alarm (ico, &ico->dalarm, organizer, ALARM_DISPLAY);
- default_alarm (ico, &ico->palarm, organizer, ALARM_PROGRAM);
- default_alarm (ico, &ico->malarm, organizer, ALARM_MAIL);
- default_alarm (ico, &ico->aalarm, organizer, ALARM_AUDIO);
-
- return ico;
-}
-
-static void
-my_free (gpointer data, gpointer user_dat_ignored)
-{
- g_free (data);
-}
-
-static void
-list_free (GList *list)
-{
- g_list_foreach (list, my_free, 0);
- g_list_free (list);
-}
-
-#define free_if_defined(x) if (x){ g_free (x); x = 0; }
-#define lfree_if_defined(x) if (x){ list_free (x); x = 0; }
-void
-ical_object_destroy (iCalObject *ico)
-{
- /* Regular strings */
- free_if_defined (ico->comment);
- free_if_defined (ico->organizer);
- free_if_defined (ico->summary);
- free_if_defined (ico->uid);
- free_if_defined (ico->status);
- free_if_defined (ico->class);
- free_if_defined (ico->url);
- free_if_defined (ico->recur);
-
- /* Lists */
- lfree_if_defined (ico->exdate);
- lfree_if_defined (ico->categories);
- lfree_if_defined (ico->resources);
- lfree_if_defined (ico->related);
- lfree_if_defined (ico->attach);
-
- /* Alarms */
- g_free (ico->dalarm.data);
- g_free (ico->palarm.data);
- g_free (ico->malarm.data);
- g_free (ico->aalarm.data);
-
- g_free (ico);
-}
-
-static GList *
-set_list (char *str)
-{
- GList *list = 0;
- char *s;
-
- for (s = strtok (str, ";"); s; s = strtok (NULL, ";"))
- list = g_list_prepend (list, g_strdup (s));
-
- return list;
-}
-
-static GList *
-set_date_list (char *str)
-{
- GList *list = 0;
- char *s;
-
- for (s = strtok (str, ";,"); s; s = strtok (NULL, ";,")){
- time_t *t = g_new (time_t, 1);
-
- while (*s && isspace (*s))
- s++;
- *t = time_from_isodate (s);
- list = g_list_prepend (list, t);
- }
- return list;
-}
-
-void
-ical_object_add_exdate (iCalObject *o, time_t t)
-{
- time_t *pt = g_new (time_t, 1);
-
- *pt = t;
- o->exdate = g_list_prepend (o->exdate, pt);
-}
-
-static void
-ignore_space(char **str)
-{
- while (**str && isspace (**str))
- (*str)++;
-}
-
-static void
-skip_numbers (char **str)
-{
- while (**str){
- ignore_space (str);
- if (!isdigit (**str))
- return;
- while (**str && isdigit (**str))
- (*str)++;
- }
-}
-
-static void
-weekdaylist (iCalObject *o, char **str)
-{
- int i;
- struct {
- char first_letter, second_letter;
- int index;
- } days [] = {
- { 'S', 'U', 0 },
- { 'M', 'O', 1 },
- { 'T', 'U', 2 },
- { 'W', 'E', 3 },
- { 'T', 'H', 4 },
- { 'F', 'R', 5 },
- { 'S', 'A', 6 }
- };
-
- ignore_space (str);
- do {
- for (i = 0; i < 7; i++){
- if (**str == days [i].first_letter && *(*str+1) == days [i].second_letter){
- o->recur->weekday |= 1 << i;
- *str += 2;
- if (**str == ' ')
- (*str)++;
- }
- }
- } while (isalpha (**str));
-
- if (o->recur->weekday == 0){
- struct tm tm = *localtime (&o->dtstart);
-
- o->recur->weekday = 1 << tm.tm_wday;
- }
-}
-
-static void
-weekdaynum (iCalObject *o, char **str)
-{
- int i;
- struct {
- char first_letter, second_letter;
- int index;
- } days [] = {
- { 'S', 'U', 0 },
- { 'M', 'O', 1 },
- { 'T', 'U', 2 },
- { 'W', 'E', 3 },
- { 'T', 'H', 4 },
- { 'F', 'R', 5 },
- { 'S', 'A', 6 }
- };
-
- ignore_space (str);
- do {
- for (i = 0; i < 7; i++){
- if (**str == days [i].first_letter && *(*str+1) == days [i].second_letter){
- o->recur->weekday = i;
- *str += 2;
- if (**str == ' ')
- (*str)++;
- }
- }
- } while (isalpha (**str));
-}
-
-static void
-ocurrencelist (iCalObject *o, char **str)
-{
- char *p;
-
- ignore_space (str);
- p = *str;
- if (!isdigit (*p))
- return;
-
- if (!(*p >= '1' && *p <= '5'))
- return;
-
- if (!(*(p+1) == '+' || *(p+1) == '-'))
- return;
-
- o->recur->u.month_pos = (*p-'0') * (*(p+1) == '+' ? 1 : -1);
- *str += 2;
-}
-
-static void
-daynumber (iCalObject *o, char **str)
-{
- int val = 0;
- char *p = *str;
-
- ignore_space (str);
- if (strcmp (p, "LD")){
- o->recur->u.month_day = DAY_LASTDAY;
- *str += 2;
- return;
- }
-
- if (!(isdigit (*p)))
- return;
-
- while (**str && isdigit (**str)){
- val = val * 10 + (**str - '0');
- (*str)++;
- }
-
- if (**str == '+')
- (*str)++;
-
- if (**str == '-')
- val *= -1;
- o->recur->u.month_day = val;
-}
-
-static void
-daynumberlist (iCalObject *o, char **str)
-{
- int first = 0;
- int val = 0;
-
- ignore_space (str);
-
- while (**str){
- if (!isdigit (**str))
- return;
- while (**str && isdigit (**str)){
- val = 10 * val + (**str - '0');
- (*str)++;
- }
- if (!first){
- /*
- * Some broken applications set this to zero
- */
- if (val == 0){
- struct tm day = *localtime (&o->dtstart);
-
- val = day.tm_mday;
- }
- o->recur->u.month_day = val;
- first = 1;
- val = 0;
- }
- }
-}
-
-static void
-load_recur_weekly (iCalObject *o, char **str)
-{
- weekdaylist (o, str);
-}
-
-static void
-load_recur_monthly_pos (iCalObject *o, char **str)
-{
- ocurrencelist (o, str);
- weekdaynum (o, str);
-}
-
-static void
-load_recur_monthly_day (iCalObject *o, char **str)
-{
- daynumberlist (o, str);
-}
-
-static void
-load_recur_yearly_month (iCalObject *o, char **str)
-{
- /* Skip as we do not support multiple months and we do expect
- * the dtstart to agree with the value on this field
- */
- skip_numbers (str);
-}
-
-static void
-load_recur_yearly_day (iCalObject *o, char **str)
-{
- /* Skip as we do not support multiple days and we do expect
- * the dtstart to agree with the value on this field
- *
- * FIXME: we should support every-n-years
- */
- skip_numbers (str);
-}
-
-static void
-duration (iCalObject *o, char **str)
-{
- unsigned int duration = 0;
-
- ignore_space (str);
- if (**str != '#')
- return;
- (*str)++;
- while (**str && isdigit (**str)){
- duration = duration * 10 + (**str - '0');
- (*str)++;
- }
- o->recur->duration = duration;
-}
-
-static void
-enddate (iCalObject *o, char **str)
-{
- ignore_space (str);
- if (isdigit (**str)){
- o->recur->_enddate = time_from_isodate (*str);
- *str += 16;
- }
-}
-
-static int
-load_recurrence (iCalObject *o, char *str)
-{
- enum RecurType type;
- int interval = 0;
-
- type = -1;
- switch (*str++){
- case 'D':
- type = RECUR_DAILY;
- break;
-
- case 'W':
- type = RECUR_WEEKLY;
- break;
-
- case 'M':
- if (*str == 'P')
- type = RECUR_MONTHLY_BY_POS;
- else if (*str == 'D')
- type = RECUR_MONTHLY_BY_DAY;
- str++;
- break;
-
- case 'Y':
- if (*str == 'M')
- type = RECUR_YEARLY_BY_MONTH;
- else if (*str == 'D')
- type = RECUR_YEARLY_BY_DAY;
- str++;
- break;
- }
- if (type == -1)
- return 0;
-
- o->recur = g_new0 (Recurrence, 1);
- o->recur->type = type;
- ignore_space (&str);
-
- /* Get the interval */
- for (;*str && isdigit (*str);str++)
- interval = interval * 10 + (*str-'0');
-
- if (interval == 0)
- interval = 1;
-
- o->recur->interval = interval;
-
- /* this is the default per the spec */
- o->recur->duration = 2;
-
- ignore_space (&str);
-
- switch (type){
- case RECUR_DAILY:
- break;
- case RECUR_WEEKLY:
- load_recur_weekly (o, &str);
- break;
- case RECUR_MONTHLY_BY_POS:
- load_recur_monthly_pos (o, &str);
- break;
- case RECUR_MONTHLY_BY_DAY:
- load_recur_monthly_day (o, &str);
- break;
- case RECUR_YEARLY_BY_MONTH:
- load_recur_yearly_month (o, &str);
- break;
- case RECUR_YEARLY_BY_DAY:
- load_recur_yearly_day (o, &str);
- break;
- default:
- g_warning ("Unimplemented recurrence type %d", (int) type);
- break;
- }
- duration (o, &str);
- enddate (o, &str);
-
- /* Compute the enddate */
- if (o->recur->_enddate == 0){
- if (o->recur->duration != 0){
- ical_object_compute_end (o);
- } else
- o->recur->enddate = 0;
- } else {
- o->recur->enddate = o->recur->_enddate;
- }
- return 1;
-}
-
-#define is_a_prop_of(obj,prop) isAPropertyOf (obj,prop)
-#define str_val(obj) the_str = fakeCString (vObjectUStringZValue (obj))
-#define has(obj,prop) (vo = isAPropertyOf (obj, prop))
-
-/*
- * FIXME: This is loosing precission. Enhanec the thresholds
- */
-#define HOURS(n) (n*(60*60))
-
-static void
-setup_alarm_at (iCalObject *ico, CalendarAlarm *alarm, char *iso_time, VObject *vo)
-{
- time_t alarm_time = time_from_isodate (iso_time);
- time_t base = ico->dtstart;
- int d = difftime (base, alarm_time);
- VObject *a;
- char *the_str;
-
- alarm->enabled = 1;
- if (d > HOURS (2)){
- if (d > HOURS (48)){
- alarm->count = d / HOURS (24);
- alarm->units = ALARM_DAYS;
- } else {
- alarm->count = d / (60*60);
- alarm->units = ALARM_HOURS;
- }
- } else {
- alarm->count = d / 60;
- alarm->units = ALARM_MINUTES;
- }
-
- if ((a = is_a_prop_of (vo, VCSnoozeTimeProp))){
- alarm->snooze_secs = isodiff_to_secs (str_val (a));
- free (the_str);
- }
-
- if ((a = is_a_prop_of (vo, VCRepeatCountProp))){
- alarm->snooze_repeat = atoi (str_val (a));
- free (the_str);
- }
-}
-
-/*
- * Duplicates an iCalObject. Implementation is a grand hack
- */
-iCalObject *
-ical_object_duplicate (iCalObject *o)
-{
- VObject *vo;
- iCalObject *new;
-
- vo = ical_object_to_vobject (o);
- switch (o->type){
- case ICAL_EVENT:
- new = ical_object_create_from_vobject (vo, VCEventProp);
- break;
- case ICAL_TODO:
- new = ical_object_create_from_vobject (vo, VCTodoProp);
- break;
- default:
- new = NULL;
- }
-
- cleanVObject (vo);
- return new;
-}
-
-/* FIXME: we need to load the recurrence properties */
-iCalObject *
-ical_object_create_from_vobject (VObject *o, const char *object_name)
-{
- time_t now = time (NULL);
- iCalObject *ical;
- VObject *vo, *a;
- VObjectIterator i;
- char *the_str;
-
- ical = g_new0 (iCalObject, 1);
-
- if (strcmp (object_name, VCEventProp) == 0)
- ical->type = ICAL_EVENT;
- else if (strcmp (object_name, VCTodoProp) == 0)
- ical->type = ICAL_TODO;
- else {
- g_free (ical);
- return 0;
- }
-
- /* uid */
- if (has (o, VCUniqueStringProp)){
- ical->uid = g_strdup (str_val (vo));
- free (the_str);
- } else {
- ical->uid = ical_gen_uid ();
- }
-
- /* seq */
- if (has (o, VCSequenceProp)){
- ical->seq = atoi (str_val (vo));
- free (the_str);
- } else
- ical->seq = 0;
-
- /* dtstart */
- if (has (o, VCDTstartProp)){
- ical->dtstart = time_from_isodate (str_val (vo));
- free (the_str);
- } else
- ical->dtstart = 0;
-
- /* dtend */
- ical->dtend = 0; /* default value */
- if (ical->type == ICAL_EVENT){
- if (has (o, VCDTendProp)){
- ical->dtend = time_from_isodate (str_val (vo));
- free (the_str);
- }
- } else if (ical->type == ICAL_TODO){
- if (has (o, VCDueProp)){
- ical->dtend = time_from_isodate (str_val (vo));
- free (the_str);
- }
- }
-
- /* dcreated */
- if (has (o, VCDCreatedProp)){
- ical->created = time_from_isodate (str_val (vo));
- free (the_str);
- }
-
- /* completed */
- if (has (o, VCCompletedProp)){
- ical->completed = time_from_isodate (str_val (vo));
- free (the_str);
- }
-
- /* last_mod */
- if (has (o, VCLastModifiedProp)){
- ical->last_mod = time_from_isodate (str_val (vo));
- free (the_str);
- } else
- ical->last_mod = now;
-
- /* exdate */
- if (has (o, VCExpDateProp)){
- ical->exdate = set_date_list (str_val (vo));
- free (the_str);
- }
-
- /* description/comment */
- if (has (o, VCDescriptionProp)){
- ical->comment = g_strdup (str_val (vo));
- free (the_str);
- }
-
- /* summary */
- if (has (o, VCSummaryProp)){
- ical->summary = g_strdup (str_val (vo));
- free (the_str);
- } else
- ical->summary = g_strdup ("");
-
- /* status */
- if (has (o, VCStatusProp)){
- ical->status = g_strdup (str_val (vo));
- free (the_str);
- } else
- ical->status = g_strdup ("NEEDS ACTION");
-
- if (has (o, VCClassProp)){
- ical->class = g_strdup (str_val (vo));
- free (the_str);
- } else
- ical->class = "PUBLIC";
-
- /* categories */
- if (has (o, VCCategoriesProp)){
- ical->categories = set_list (str_val (vo));
- free (the_str);
- }
-
- /* resources */
- if (has (o, VCResourcesProp)){
- ical->resources = set_list (str_val (vo));
- free (the_str);
- }
-
- /* priority */
- if (has (o, VCPriorityProp)){
- ical->priority = atoi (str_val (vo));
- free (the_str);
- }
-
- /* tranparency */
- if (has (o, VCTranspProp)){
- ical->transp = atoi (str_val (vo)) ? ICAL_TRANSPARENT : ICAL_OPAQUE;
- free (the_str);
- }
-
- /* Organizer */
- if (has (o, VCOrgNameProp)){
- ical->organizer = g_strdup (str_val (vo));
- free (the_str);
- }
-
- /* related */
- if (has (o, VCRelatedToProp)){
- ical->related = set_list (str_val (vo));
- free (the_str);
- }
-
- /* attach */
- initPropIterator (&i, o);
- while (moreIteration (&i)){
- vo = nextVObject (&i);
- if (strcmp (vObjectName (vo), VCAttachProp) == 0){
- ical->attach = g_list_prepend (ical->attach, g_strdup (str_val (vo)));
- free (the_str);
- }
- }
-
- /* url */
- if (has (o, VCURLProp)){
- ical->url = g_strdup (str_val (vo));
- free (the_str);
- }
-
- /* dalarm */
- ical->dalarm.type = ALARM_DISPLAY;
- ical->dalarm.enabled = 0;
- if (has (o, VCDAlarmProp)){
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->dalarm, str_val (a), vo);
- free (the_str);
- }
- }
-
- /* aalarm */
- ical->aalarm.type = ALARM_AUDIO;
- ical->aalarm.enabled = 0;
- if (has (o, VCAAlarmProp)){
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->aalarm, str_val (a), vo);
- free (the_str);
- }
- }
-
- /* palarm */
- ical->palarm.type = ALARM_PROGRAM;
- ical->palarm.enabled = 0;
- if (has (o, VCPAlarmProp)){
- ical->palarm.type = ALARM_PROGRAM;
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->palarm, str_val (a), vo);
- free (the_str);
-
- if ((a = is_a_prop_of (vo, VCProcedureNameProp))){
- ical->palarm.data = g_strdup (str_val (a));
- free (the_str);
- } else
- ical->palarm.data = g_strdup ("");
- }
- }
-
- /* malarm */
- ical->malarm.type = ALARM_MAIL;
- ical->malarm.enabled = 0;
- if (has (o, VCMAlarmProp)){
- ical->malarm.type = ALARM_MAIL;
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->malarm, str_val (a), vo);
- free (the_str);
-
- if ((a = is_a_prop_of (vo, VCEmailAddressProp))){
- ical->malarm.data = g_strdup (str_val (a));
- free (the_str);
- } else
- ical->malarm.data = g_strdup ("");
- }
- }
-
- /* rrule */
- if (has (o, VCRRuleProp)){
- if (!load_recurrence (ical, str_val (vo))) {
- ical_object_destroy (ical);
- return NULL;
- }
- free (the_str);
- }
-
- /*
- * Pilot
- */
- if (has (o, XPilotIdProp)){
- ical->pilot_id = atoi (str_val (vo));
- free (the_str);
- } else
- ical->pilot_id = 0;
-
- if (has (o, XPilotStatusProp)){
- ical->pilot_status = atoi (str_val (vo));
- free (the_str);
- } else
- ical->pilot_status = ICAL_PILOT_SYNC_MOD;
-
- return ical;
-}
-
-static char *
-to_str (int num)
-{
- static char buf [40];
-
- sprintf (buf, "%d", num);
- return buf;
-}
-
-/*
- * stores a GList in the property.
- */
-static void
-store_list (VObject *o, char *prop, GList *values)
-{
- GList *l;
- int len;
- char *result, *p;
-
- for (len = 0, l = values; l; l = l->next)
- len += strlen (l->data) + 1;
-
- result = g_malloc (len);
-
- for (p = result, l = values; l; l = l->next) {
- int len = strlen (l->data);
-
- strcpy (p, l->data);
-
- if (l->next) {
- p [len] = ';';
- p += len+1;
- } else
- p += len;
- }
-
- *p = 0;
-
- addPropValue (o, prop, result);
- g_free (result);
-}
-
-static void
-store_date_list (VObject *o, char *prop, GList *values)
-{
- GList *l;
- int size, len;
- char *s, *p;
-
- size = g_list_length (values);
- s = p = g_malloc ((size * 17 + 1) * sizeof (char));
-
- for (l = values; l; l = l->next){
- strcpy (s, isodate_from_time_t (*(time_t *)l->data));
- len = strlen (s);
- s [len] = ',';
- s += len + 1;
- }
- s--;
- *s = 0;
- addPropValue (o, prop, p);
- g_free (p);
-}
-
-static char *recur_type_name [] = { "D", "W", "MP", "MD", "YM", "YD" };
-static char *recur_day_list [] = { "SU", "MO", "TU","WE", "TH", "FR", "SA" };
-static char *alarm_names [] = { VCMAlarmProp, VCPAlarmProp, VCDAlarmProp, VCAAlarmProp };
-
-static VObject *
-save_alarm (VObject *o, CalendarAlarm *alarm, iCalObject *ical)
-{
- VObject *alarm_object;
- struct tm tm;
- time_t alarm_time;
-
- if (!alarm->enabled)
- return NULL;
- tm = *localtime (&ical->dtstart);
- switch (alarm->units){
- case ALARM_MINUTES:
- tm.tm_min -= alarm->count;
- break;
-
- case ALARM_HOURS:
- tm.tm_hour -= alarm->count;
- break;
-
- case ALARM_DAYS:
- tm.tm_mday -= alarm->count;
- break;
- }
-
- alarm_time = mktime (&tm);
- alarm_object = addProp (o, alarm_names [alarm->type]);
- addPropValue (alarm_object, VCRunTimeProp, isodate_from_time_t (alarm_time));
-
- if (alarm->snooze_secs)
- addPropValue (alarm_object, VCSnoozeTimeProp, isodiff_from_secs (alarm->snooze_secs));
- else
- addPropValue (alarm_object, VCSnoozeTimeProp, "");
-
- if (alarm->snooze_repeat){
- char buf [20];
-
- sprintf (buf, "%d", alarm->snooze_repeat);
- addPropValue (alarm_object, VCRepeatCountProp, buf);
- } else
- addPropValue (alarm_object, VCRepeatCountProp, "");
- return alarm_object;
-}
-
-VObject *
-ical_object_to_vobject (iCalObject *ical)
-{
- VObject *o, *alarm, *s;
- GList *l;
-
- if (ical->type == ICAL_EVENT)
- o = newVObject (VCEventProp);
- else
- o = newVObject (VCTodoProp);
-
- /* uid */
- if (ical->uid)
- addPropValue (o, VCUniqueStringProp, ical->uid);
-
- /* seq */
- addPropValue (o, VCSequenceProp, to_str (ical->seq));
-
- /* dtstart */
- addPropValue (o, VCDTstartProp, isodate_from_time_t (ical->dtstart));
-
- /* dtend */
- if (ical->type == ICAL_EVENT){
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
- } else if (ical->type == ICAL_TODO){
- addPropValue (o, VCDueProp, isodate_from_time_t (ical->dtend));
- }
-
- /* dcreated */
- addPropValue (o, VCDCreatedProp, isodate_from_time_t (ical->created));
-
- /* completed */
- if (ical->completed)
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->completed));
-
- /* last_mod */
- addPropValue (o, VCLastModifiedProp, isodate_from_time_t (ical->last_mod));
-
- /* exdate */
- if (ical->exdate)
- store_date_list (o, VCExpDateProp, ical->exdate);
-
- /* description/comment */
- if (ical->comment && strlen (ical->comment)){
- s = addPropValue (o, VCDescriptionProp, ical->comment);
- if (strchr (ical->comment, '\n'))
- addProp (s, VCQuotedPrintableProp);
- }
-
- /* summary */
- if (strlen (ical->summary)){
- s = addPropValue (o, VCSummaryProp, ical->summary);
- if (strchr (ical->summary, '\n'))
- addProp (s, VCQuotedPrintableProp);
- } else {
- addPropValue (o, VCSummaryProp, _("Appointment"));
- }
-
- /* status */
- addPropValue (o, VCStatusProp, ical->status);
-
- /* class */
- addPropValue (o, VCClassProp, ical->class);
-
- /* categories */
- if (ical->categories)
- store_list (o, VCCategoriesProp, ical->categories);
-
- /* resources */
- if (ical->resources)
- store_list (o, VCCategoriesProp, ical->resources);
-
- /* priority */
- addPropValue (o, VCPriorityProp, to_str (ical->priority));
-
- /* transparency */
- addPropValue (o, VCTranspProp, to_str (ical->transp));
-
- /* Owenr/organizer */
- if (ical->organizer)
- addPropValue (o, VCOrgNameProp, ical->organizer);
-
- /* related */
- if (ical->related)
- store_list (o, VCRelatedToProp, ical->related);
-
- /* attach */
- for (l = ical->attach; l; l = l->next)
- addPropValue (o, VCAttachProp, l->data);
-
- /* url */
- if (ical->url)
- addPropValue (o, VCURLProp, ical->url);
-
- if (ical->recur){
- char result [256];
- char buffer [80];
- int i;
-
- sprintf (result, "%s%d ", recur_type_name [ical->recur->type], ical->recur->interval);
- switch (ical->recur->type){
- case RECUR_DAILY:
- break;
-
- case RECUR_WEEKLY:
- for (i = 0; i < 7; i++){
- if (ical->recur->weekday & (1 << i)){
- sprintf (buffer, "%s ", recur_day_list [i]);
- strcat (result, buffer);
- }
- }
- break;
-
- case RECUR_MONTHLY_BY_POS: {
- int nega = ical->recur->u.month_pos < 0;
-
- sprintf (buffer, "%d%s ", nega ? -ical->recur->u.month_pos : ical->recur->u.month_pos,
- nega ? "-" : "+");
- strcat (result, buffer);
- /* the gui is set up for a single day, not a set here in this case */
- sprintf (buffer, "%s ", recur_day_list [ical->recur->weekday]);
- strcat (result, buffer);
- }
- break;
-
- case RECUR_MONTHLY_BY_DAY:
- sprintf (buffer, "%d ", ical->recur->u.month_pos);
- strcat (result, buffer);
- break;
-
- case RECUR_YEARLY_BY_MONTH:
- break;
-
- case RECUR_YEARLY_BY_DAY:
- break;
- }
- if (ical->recur->_enddate == 0)
- sprintf (buffer, "#%d ",ical->recur->duration);
- else
- sprintf (buffer, "%s ", isodate_from_time_t (ical->recur->_enddate));
- strcat (result, buffer);
- addPropValue (o, VCRRuleProp, result);
- }
-
- save_alarm (o, &ical->aalarm, ical);
- save_alarm (o, &ical->dalarm, ical);
-
- if ((alarm = save_alarm (o, &ical->palarm, ical)))
- addPropValue (alarm, VCProcedureNameProp, ical->palarm.data);
- if ((alarm = save_alarm (o, &ical->malarm, ical)))
- addPropValue (alarm, VCEmailAddressProp, ical->malarm.data);
-
- /* Pilot */
- {
- char buffer [20];
-
- sprintf (buffer, "%d", ical->pilot_id);
- addPropValue (o, XPilotIdProp, buffer);
- sprintf (buffer, "%d", ical->pilot_status);
- addPropValue (o, XPilotStatusProp, buffer);
- }
-
- return o;
-}
-
-void
-ical_foreach (GList *events, calendarfn fn, void *closure)
-{
- for (; events; events = events->next){
- iCalObject *ical = events->data;
-
- (*fn) (ical, ical->dtstart, ical->dtend, closure);
- }
-}
-
-static int
-is_date_in_list (GList *list, struct tm *date)
-{
- struct tm tm;
-
- for (; list; list = list->next){
- time_t *timep = list->data;
-
- tm = *localtime (timep);
- if (date->tm_mday == tm.tm_mday &&
- date->tm_mon == tm.tm_mon &&
- date->tm_year == tm.tm_year){
- return 1;
- }
- }
- return 0;
-}
-
-static int
-generate (iCalObject *ico, time_t reference, calendarfn cb, void *closure)
-{
- struct tm dt_start, dt_end, ref;
- time_t s_t, e_t;
-
- dt_start = *localtime (&ico->dtstart);
- dt_end = *localtime (&ico->dtend);
- ref = *localtime (&reference);
-
- dt_start.tm_mday = ref.tm_mday;
- dt_start.tm_mon = ref.tm_mon;
- dt_start.tm_year = ref.tm_year;
-
- dt_end.tm_mday = ref.tm_mday;
- dt_end.tm_mon = ref.tm_mon;
- dt_end.tm_year = ref.tm_year;
-
-
- if (ref.tm_isdst > dt_start.tm_isdst){
- dt_start.tm_hour--;
- dt_end.tm_hour--;
- } else if (ref.tm_isdst < dt_start.tm_isdst){
- dt_start.tm_hour++;
- dt_end.tm_hour++;
- }
-
- s_t = mktime (&dt_start);
-
- if (ico->exdate && is_date_in_list (ico->exdate, &dt_start))
- return 1;
-
- e_t = mktime (&dt_end);
-
- if ((s_t == -1) || (e_t == -1)) {
- g_warning ("Produced invalid dates!\n");
- return 0;
- }
-
- return (*cb) (ico, s_t, e_t, closure);
-}
-
-int
-ical_object_get_first_weekday (int weekday_mask)
-{
- int i;
-
- for (i = 0; i < 7; i++)
- if (weekday_mask & (1 << i))
- return i;
-
- return -1;
-}
-
-#define time_in_range(t, a, b) ((t >= a) && (b ? (t < b) : 1))
-#define recur_in_range(t, r) (r->enddate ? (t < r->enddate) : 1)
-
-/*
- * Generate every possible event. Invokes the callback routine for
- * every occurrence of the event in the [START, END] time interval.
- *
- * If END is zero, the event is generated forever.
- * The callback routine is expected to return 0 when no further event
- * generation is requested.
- */
-void
-ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure)
-{
- time_t current;
- int first_week_day;
-
- /* If there is no recurrence, just check ranges */
-
- if (!ico->recur) {
- if ((end && (ico->dtstart < end) && (ico->dtend > start))
- || ((end == 0) && (ico->dtend > start))) {
- time_t ev_s, ev_e;
-
- /* Clip range */
-
- ev_s = MAX (ico->dtstart, start);
- ev_e = MIN (ico->dtend, end);
-
- (* cb) (ico, ev_s, ev_e, closure);
- }
- return;
- }
-
- /* The event has a recurrence rule -- check that we will generate at least one instance */
-
- if (end != 0) {
- if (ico->dtstart > end)
- return;
-
- if (!IS_INFINITE (ico->recur) && (ico->recur->enddate < start))
- return;
- }
-
- /* Generate the instances */
-
- current = ico->dtstart;
-
- switch (ico->recur->type) {
- case RECUR_DAILY:
- do {
- if (time_in_range (current, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, current, cb, closure))
- return;
-
- /* Advance */
-
- current = time_add_day (current, ico->recur->interval);
-
- if (current == -1) {
- g_warning ("RECUR_DAILY: time_add_day() returned invalid time");
- return;
- }
- } while ((current < end) || (end == 0));
-
- break;
-
- case RECUR_WEEKLY:
- do {
- struct tm tm;
-
- tm = *localtime (&current);
-
- if (time_in_range (current, start, end) && recur_in_range (current, ico->recur)) {
- /* Weekdays to recur on are specified as a bitmask */
- if (ico->recur->weekday & (1 << tm.tm_wday)) {
- if (!generate (ico, current, cb, closure))
- return;
- }
- }
-
- /* Advance by day for scanning the week or by interval at week end */
-
- if (tm.tm_wday == 6)
- current = time_add_day (current, (ico->recur->interval - 1) * 7 + 1);
- else
- current = time_add_day (current, 1);
-
- if (current == -1) {
- g_warning ("RECUR_WEEKLY: time_add_day() returned invalid time\n");
- return;
- }
- } while (current < end || (end == 0));
-
- break;
-
- case RECUR_MONTHLY_BY_POS:
- /* FIXME: We only deal with positives now */
- if (ico->recur->u.month_pos < 0) {
- g_warning ("RECUR_MONTHLY_BY_POS does not support negative positions yet");
- return;
- }
-
- if (ico->recur->u.month_pos == 0)
- return;
-
- first_week_day = /* ical_object_get_first_weekday (ico->recur->weekday); */
- ico->recur->weekday; /* the i/f only lets you choose a single day of the week! */
-
- /* This should not happen, but take it into account */
- if (first_week_day == -1) {
- g_warning ("ical_object_get_first_weekday() returned -1");
- return;
- }
-
- do {
- struct tm tm;
- time_t t;
- int week_day_start;
-
- tm = *localtime (&current);
- tm.tm_mday = 1;
- t = mktime (&tm);
- tm = *localtime (&t);
- week_day_start = tm.tm_wday;
-
- tm.tm_mday = (7 * (ico->recur->u.month_pos - ((week_day_start <= first_week_day ) ? 1 : 0))
- - (week_day_start - first_week_day) + 1);
- if( tm.tm_mday > 31 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
-
- switch( tm.tm_mon )
- {
- case 3:
- case 5:
- case 8:
- case 10:
- if( tm.tm_mday > 30 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
- break;
- case 1:
- if( ((tm.tm_year+1900)%4) == 0
- && ((tm.tm_year+1900)%400) != 100
- && ((tm.tm_year+1900)%400) != 200
- && ((tm.tm_year+1900)%400) != 300 )
- {
-
- if( tm.tm_mday > 29 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
- }
- else
- {
- if( tm.tm_mday > 28 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
- }
- break;
- }
-
- t = mktime (&tm);
-
- if (time_in_range (t, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, t, cb, closure))
- return;
-
- /* Advance by the appropriate number of months */
-
- current = mktime (&tm);
-
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
-
- if (current == -1) {
- g_warning ("RECUR_MONTHLY_BY_DAY: mktime error\n");
- return;
- }
- } while ((current < end) || (end == 0));
-
- break;
-
- case RECUR_MONTHLY_BY_DAY:
- do {
- struct tm tm;
- time_t t;
- int p;
-
- tm = *localtime (&current);
-
- p = tm.tm_mday;
- tm.tm_mday = ico->recur->u.month_day;
- t = mktime (&tm);
- if (time_in_range (t, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, t, cb, closure))
- return;
-
- /* Advance by the appropriate number of months */
-
- tm.tm_mday = p;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
-
- if (current == -1) {
- g_warning ("RECUR_MONTHLY_BY_DAY: mktime error\n");
- return;
- }
- } while (current < end || (end == 0));
-
- break;
-
- case RECUR_YEARLY_BY_MONTH:
- case RECUR_YEARLY_BY_DAY:
- do {
- if (time_in_range (current, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, current, cb, closure))
- return;
-
- /* Advance */
-
- current = time_add_year (current, ico->recur->interval);
- } while (current < end || (end == 0));
-
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-static int
-duration_callback (iCalObject *ico, time_t start, time_t end, void *closure)
-{
- int *count = closure;
- struct tm tm;
-
- tm = *localtime (&start);
-
- (*count)++;
- if (ico->recur->duration == *count) {
- ico->recur->enddate = time_day_end (end);
- return 0;
- }
- return 1;
-}
-
-/* Computes ico->recur->enddate from ico->recur->duration */
-void
-ical_object_compute_end (iCalObject *ico)
-{
- int count = 0;
-
- g_return_if_fail (ico->recur != NULL);
-
- ico->recur->_enddate = 0;
- ico->recur->enddate = 0;
- ical_object_generate_events (ico, ico->dtstart, 0, duration_callback, &count);
-}
-
-int
-alarm_compute_offset (CalendarAlarm *a)
-{
- if (!a->enabled)
- return -1;
- switch (a->units){
- case ALARM_MINUTES:
- a->offset = a->count * 60;
- break;
- case ALARM_HOURS:
- a->offset = a->count * 3600;
- break;
- case ALARM_DAYS:
- a->offset = a->count * 24 * 3600;
- }
- return a->offset;
-}
-
-iCalObject *
-ical_object_new_from_string (const char *vcal_string)
-{
- iCalObject *ical = NULL;
- VObject *cal, *event;
- VObjectIterator i;
- const char *object_name;
-
- cal = Parse_MIME (vcal_string, strlen (vcal_string));
-
- initPropIterator (&i, cal);
-
- while (moreIteration (&i)){
- event = nextVObject (&i);
-
- object_name = vObjectName (event);
-
- if (strcmp (object_name, VCEventProp) == 0){
- ical = ical_object_create_from_vobject (event, object_name);
- break;
- }
- }
-
- cleanVObject (cal);
- cleanStrTbl ();
-
- return ical;
-}
-
diff --git a/calendar/cal-util/calobj.h b/calendar/cal-util/calobj.h
deleted file mode 100644
index fbc92a41c5..0000000000
--- a/calendar/cal-util/calobj.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Internal representation of a Calendar object. This is modeled after the
- * iCalendar/vCalendar specificiation
- *
- * Authors: Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (quartic@gimp.org).
- */
-#ifndef CALOBJ_H
-#define CALOBJ_H
-
-#include <libgnome/libgnome.h>
-#include "../libversit/vcc.h"
-
-BEGIN_GNOME_DECLS
-
-enum AlarmType {
- ALARM_MAIL,
- ALARM_PROGRAM,
- ALARM_DISPLAY,
- ALARM_AUDIO
-};
-
-enum AlarmUnit {
- ALARM_MINUTES,
- ALARM_HOURS,
- ALARM_DAYS
-};
-
-typedef struct {
- enum AlarmType type;
- int enabled;
- int count;
- enum AlarmUnit units;
- char *data;
-
- /* Does not get saved, internally used */
- time_t offset;
- time_t trigger;
-
- int snooze_secs;
- int snooze_repeat;
-
- /* Widgets */
- void *w_count; /* A GtkEntry */
- void *w_enabled; /* A GtkChecButton */
- void *w_timesel; /* A GtkMenu */
- void *w_entry; /* A GnomeEntryFile/GtkEntry for PROGRAM/MAIL */
- void *w_label;
-} CalendarAlarm;
-
-/* Calendar object type */
-typedef enum {
- ICAL_EVENT,
- ICAL_TODO,
- ICAL_JOURNAL,
- ICAL_FBREQUEST,
- ICAL_FBREPLY,
- ICAL_BUSYTIME,
- ICAL_TIMEZONE
-} iCalType;
-
-/* For keys that might contain binary or text/binary */
-typedef struct {
- char *data;
- int len;
-} iCalValue;
-
-typedef enum {
- ICAL_PILOT_SYNC_NONE = 0,
- ICAL_PILOT_SYNC_MOD = 1,
- ICAL_PILOT_SYNC_DEL = 3
-} iCalPilotState;
-
-typedef struct {
- int valid; /* true if the Geography was specified */
- double latitude;
- double longitude;
-} iCalGeo;
-
-typedef enum {
- ICAL_OPAQUE,
- ICAL_TRANSPARENT
-} iCalTransp;
-
-typedef char NotYet;
-
-enum RecurType {
- RECUR_DAILY,
- RECUR_WEEKLY,
- RECUR_MONTHLY_BY_POS,
- RECUR_MONTHLY_BY_DAY,
- RECUR_YEARLY_BY_MONTH,
- RECUR_YEARLY_BY_DAY,
-};
-
-#define DAY_LASTDAY 10000
-
-typedef struct {
- enum RecurType type;
-
- int interval;
-
- /* Used for recur computation */
- time_t enddate; /* If the value is zero, it is an infinite event
- * otherwise, it is either the _enddate value (if
- * this is what got specified) or it is our computed
- * ending date (computed from the duration item).
- */
-
- int weekday;
-
- union {
- int month_pos;
- int month_day;
- } u;
-
- int duration;
- time_t _enddate; /* As found on the vCalendar file */
- int __count;
-} Recurrence;
-
-#define IS_INFINITE(r) (r->duration == 0)
-
-/* Flags to indicate what has changed in an object */
-typedef enum {
- CHANGE_NEW = 1 << 0, /* new object */
- CHANGE_SUMMARY = 1 << 1, /* summary */
- CHANGE_DATES = 1 << 2, /* dtstart / dtend */
- CHANGE_ALL = CHANGE_SUMMARY | CHANGE_DATES
-} CalObjectChange;
-
-/*
- * This describes an iCalendar object, note that we never store durations, instead we
- * always compute the end time computed from the start + duration.
- */
-typedef struct {
- iCalType type;
-
- GList *attach; /* type: one or more URIs or binary data */
- GList *attendee; /* type: CAL-ADDRESS */
- GList *categories; /* type: one or more TEXT */
- char *class;
-
- char *comment; /* we collapse one or more TEXTs into one */
- time_t completed;
- time_t created;
- GList *contact; /* type: one or more TEXT */
- time_t dtstamp;
- time_t dtstart;
- time_t dtend;
- GList *exdate; /* type: one or more time_t's */
- GList *exrule; /* type: one or more RECUR */
- iCalGeo geo;
- time_t last_mod;
- char *location;
- char *organizer;
- int percent;
- int priority;
- char *rstatus; /* request status for freebusy */
- GList *related; /* type: one or more TEXT */
- GList *resources; /* type: one or more TEXT */
- GList *rdate; /* type: one or more recurrence date */
- GList *rrule; /* type: one or more recurrence rules */
- int seq;
- char *status;
- char *summary;
- iCalTransp transp;
- char *uid;
- char *url;
- time_t recurid;
-
- CalendarAlarm dalarm;
- CalendarAlarm aalarm;
- CalendarAlarm palarm;
- CalendarAlarm malarm;
-
- Recurrence *recur;
-
- int new;
- void *user_data; /* Generic data pointer */
-
- /* Pilot */
- iCalPilotState pilot_status; /* Status information */
- guint32 pilot_id; /* Pilot ID */
-} iCalObject;
-
-/* The callback for the recurrence generator */
-typedef int (*calendarfn) (iCalObject *, time_t, time_t, void *);
-
-iCalObject *ical_new (char *comment, char *organizer, char *summary);
-iCalObject *ical_object_new (void);
-iCalObject *ical_object_new_from_string (const char *vcalendar_string);
-void ical_object_destroy (iCalObject *ico);
-iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);
-VObject *ical_object_to_vobject (iCalObject *ical);
-iCalObject *ical_object_duplicate (iCalObject *o);
-void ical_foreach (GList *events, calendarfn fn, void *closure);
-void ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure);
-void ical_object_add_exdate (iCalObject *o, time_t t);
-
-/* Computes the enddate field of the recurrence based on the duration */
-void ical_object_compute_end (iCalObject *ico);
-
-/* Returns the first toggled day in a weekday mask -- we do this because we do not support multiple
- * days on a monthly-by-pos recurrence. If no days are toggled, it returns -1.
- */
-int ical_object_get_first_weekday (int weekday_mask);
-
-/* Returns the number of seconds configured to trigger the alarm in advance to an event */
-int alarm_compute_offset (CalendarAlarm *a);
-
-END_GNOME_DECLS
-
-#endif
-
diff --git a/calendar/cal_struct.h b/calendar/cal_struct.h
deleted file mode 100644
index 411036c7aa..0000000000
--- a/calendar/cal_struct.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#define MAX_SZ 30
-
-enum RepeatType {
- Single,
- Days,
- Months,
- WeekDays,
- MonthDays
-};
-
-
-struct actionitem {
- char date[MAX_SZ];
- int time; /* Minutes past midnight */
-};
-
-struct event {
- struct actionitem start;
- struct actionitem end;
-
- enum RepeatType repeat;
- int repeatcount;
- char description[MAX_SZ];
- char subtype[MAX_SZ];
- GList *properties;
-};
-
diff --git a/calendar/calendar-conduit-control-applet.c b/calendar/calendar-conduit-control-applet.c
deleted file mode 100644
index ae4bda428f..0000000000
--- a/calendar/calendar-conduit-control-applet.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/* Control applet ("capplet") for the gnome-pilot calendar conduit, */
-/* based on */
-/* gpilotd control applet ('capplet') for use with the GNOME control center */
-/* $Id$ */
-
-#include <pwd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <gnome.h>
-#include <ctype.h>
-
-#include <config.h>
-#include <capplet-widget.h>
-
-#include <gpilotd/gpilotd-conduit-mgmt.h>
-#include <gpilotd/gpilotd-app.h>
-#include <gpilotd/gpilotd-app-dummy-callbacks.h>
-
-#include "calendar-conduit.h"
-
-/* tell changes callbacks to ignore changes or not */
-static gboolean ignore_changes=FALSE;
-
-/* capplet widget */
-static GtkWidget *capplet=NULL;
-
-/* host/device/pilot configuration windows */
-GtkWidget *cfgOptionsWindow=NULL;
-GtkWidget *cfgStateWindow=NULL;
-GtkWidget *dialogWindow=NULL;
-
-GnomePilotConduitMgmt *conduit;
-
-static void doTrySettings(GtkWidget *widget, gpointer);
-static void doRevertSettings(GtkWidget *widget, gpointer);
-static void doSaveSettings(GtkWidget *widget, gpointer);
-
-static void readStateCfg(GtkWidget *w,GCalConduitCfg *cfg);
-static void setStateCfg(GtkWidget *w,GCalConduitCfg *cfg);
-void about_cb (GtkWidget *, gpointer);
-GCalConduitCfg *origState = NULL;
-GCalConduitCfg *curState = NULL;
-
-gint pilotId;
-CORBA_Environment ev;
-
-/* This array must be in the same order as enumerations
- in GnomePilotConduitSyncType as they are used as index.
- Custom type implies Disabled state.
-*/
-static gchar* sync_options[] ={ N_("Disabled"),
- N_("Synchronize"),
- N_("Copy From Pilot"),
- N_("Copy To Pilot"),
- N_("Merge From Pilot"),
- N_("Merge To Pilot")};
-#define SYNC_OPTIONS_COUNT 6
-
-static void
-setSettings(GCalConduitCfg* conduitCfg)
-{
- if(conduitCfg->sync_type!=GnomePilotConduitSyncTypeCustom)
- gpilotd_conduit_mgmt_enable_with_first_sync(conduit,pilotId,
- conduitCfg->sync_type,
- conduitCfg->sync_type,
- TRUE);
- else
- gpilotd_conduit_mgmt_disable(conduit,pilotId);
-
- gcalconduit_save_configuration(conduitCfg);
-}
-
-static void
-doTrySettings(GtkWidget *widget, gpointer whatever)
-{
- readStateCfg(cfgStateWindow,curState);
- setSettings(curState);
-}
-
-static void
-doSaveSettings(GtkWidget *widget, gpointer whatever)
-{
- doTrySettings(widget,whatever);
-}
-
-static void
-doCancelSettings(GtkWidget *widget, gpointer whatever)
-{
- setSettings(origState);
-}
-
-static void
-doRevertSettings(GtkWidget *widget, gpointer whatever)
-{
- gcalconduit_destroy_configuration(&curState);
- curState = gcalconduit_dupe_configuration(origState);
- setStateCfg(cfgStateWindow,curState);
- setSettings(curState);
-}
-
-static void
-insert_dir_callback (GtkEditable *editable, const gchar *text,
- gint len, gint *position, void *data)
-{
- gint i;
- gchar *curname;
-
- curname = gtk_entry_get_text(GTK_ENTRY(editable));
- if (*curname == '\0' && len > 0) {
- if (isspace(text[0])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert_text");
- return;
- }
- } else {
- for (i=0; i<len; i++) {
- if (isspace(text[i])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable),
- "insert_text");
- return;
- }
- }
- }
-}
-static void
-insert_dir_callback2(GtkEditable *editable, const gchar *text,
- gint length, gint *position,
- void *data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static void
-clist_changed(GtkWidget *widget, gpointer data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-void about_cb (GtkWidget *widget, gpointer data) {
- GtkWidget *about;
- const gchar *authors[] = {_("Eskil Heyn Olsen <deity@eskil.dk>"),NULL};
-
- about = gnome_about_new(_("GnomeCalendar Conduit"), VERSION,
- _("(C) 1998"),
- authors,
- _("Configuration utility for the calendar conduit.\n"),
- _("gnome-calendar-conduit.png"));
- gtk_widget_show (about);
-
- return;
-}
-
-static void toggled_cb(GtkWidget *widget, gpointer data) {
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-/* called by the sync_type GtkOptionMenu */
-static void
-sync_action_selection(GtkMenuShell *widget, gpointer unused)
-{
- if (!ignore_changes) {
- capplet_widget_state_changed(CAPPLET_WIDGET (capplet), TRUE);
- }
-}
-
-/* called by the sync_type GtkOptionMenu */
-static void
-activate_sync_type(GtkMenuItem *widget, gpointer data)
-{
- curState->sync_type = GPOINTER_TO_INT(data);
- if(!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static GtkWidget
-*createStateCfgWindow(void)
-{
- GtkWidget *vbox, *table;
- GtkWidget *label;
- GtkWidget *optionMenu,*menuItem;
- GtkMenu *menu;
- gint i;
-
- vbox = gtk_vbox_new(FALSE, GNOME_PAD);
-
- table = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD);
-
- label = gtk_label_new(_("Synchronize Action"));
- gtk_box_pack_start(GTK_BOX(table), label, FALSE, FALSE, GNOME_PAD);
-
- optionMenu=gtk_option_menu_new();
- gtk_object_set_data(GTK_OBJECT(vbox), "conduit_state", optionMenu);
- menu = GTK_MENU(gtk_menu_new());
-
- for (i=0; i<SYNC_OPTIONS_COUNT;i++) {
- sync_options[i]=_(sync_options[i]);
- menuItem = gtk_menu_item_new_with_label(sync_options[i]);
- gtk_widget_show(menuItem);
- gtk_signal_connect(GTK_OBJECT(menuItem),"activate",
- GTK_SIGNAL_FUNC(activate_sync_type),
- GINT_TO_POINTER(i));
- gtk_menu_append(menu,menuItem);
- }
-
- gtk_option_menu_set_menu(GTK_OPTION_MENU(optionMenu),GTK_WIDGET(menu));
- gtk_signal_connect(GTK_OBJECT(menu), "selection-done",
- GTK_SIGNAL_FUNC(sync_action_selection),
- NULL);
-
- gtk_box_pack_start(GTK_BOX(table), optionMenu, FALSE, FALSE, 0);
-
- return vbox;
-}
-
-static void
-setStateCfg(GtkWidget *widget,GCalConduitCfg *cfg)
-{
- GtkOptionMenu *optionMenu;
- GtkMenu *menu;
-
- optionMenu = gtk_object_get_data(GTK_OBJECT(widget), "conduit_state");
- g_assert(optionMenu!=NULL);
- menu = GTK_MENU(gtk_option_menu_get_menu(optionMenu));
-
-
- ignore_changes = TRUE;
- /* Here were are relying on the items in menu being the same
- order as in GnomePilotConduitSyncType. */
- gtk_option_menu_set_history(optionMenu,(int)cfg->sync_type);
- ignore_changes = FALSE;
-}
-
-
-static void
-readStateCfg(GtkWidget *w,GCalConduitCfg *cfg)
-{
-/*
- GtkWidget *button;
-
- button = gtk_object_get_data(GTK_OBJECT(w), "conduit_on_off");
-
- g_assert(button!=NULL);
-
- activated = GTK_TOGGLE_BUTTON(button)->active;
-*/
-}
-
-static void
-pilot_capplet_setup(void)
-{
- GtkWidget *frame, *table;
-
- capplet = capplet_widget_new();
-
- table = gtk_table_new(1, 2, FALSE);
- gtk_container_border_width(GTK_CONTAINER(table), GNOME_PAD);
- gtk_container_add(GTK_CONTAINER(capplet), table);
-
- frame = gtk_frame_new(_("Conduit state"));
- gtk_container_border_width(GTK_CONTAINER(frame), GNOME_PAD_SMALL);
- gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1);
- cfgStateWindow = createStateCfgWindow();
- gtk_container_add(GTK_CONTAINER(frame), cfgStateWindow);
-
- gtk_signal_connect(GTK_OBJECT(capplet), "try",
- GTK_SIGNAL_FUNC(doTrySettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "revert",
- GTK_SIGNAL_FUNC(doRevertSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "ok",
- GTK_SIGNAL_FUNC(doSaveSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "cancel",
- GTK_SIGNAL_FUNC(doCancelSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "help",
- GTK_SIGNAL_FUNC(about_cb), NULL);
-
-
- setStateCfg(cfgStateWindow,curState);
-
- gtk_widget_show_all(capplet);
-}
-
-static void
-run_error_dialog(gchar *mesg,...) {
- char tmp[80];
- va_list ap;
-
- va_start(ap,mesg);
- vsnprintf(tmp,79,mesg,ap);
- dialogWindow = gnome_message_box_new(mesg,GNOME_MESSAGE_BOX_ERROR,GNOME_STOCK_BUTTON_OK,NULL);
- gnome_dialog_run_and_close(GNOME_DIALOG(dialogWindow));
- va_end(ap);
-}
-
-gint get_pilot_id_from_gpilotd() {
- gint *pilots;
- int i;
-
- i=0;
- gpilotd_get_pilot_ids(&pilots);
- if(pilots) {
- while(pilots[i]!=-1) { g_message("pilot %d = \"%d\"",i,pilots[i]); i++; }
- if(i==0) {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- } else {
- if(i==1)
- return pilots[0];
- else {
- g_message("too many pilots...");
- return pilots[0];
- }
- }
- } else {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- }
-}
-
-int
-main( int argc, char *argv[] )
-{
- /* we're a capplet */
- gnome_capplet_init ("calendar conduit control applet", NULL, argc, argv,
- NULL,
- 0, NULL);
-
- /* put all code to set things up in here */
- conduit = gpilotd_conduit_mgmt_new("calendar_conduit");
-
- /* get pilot name from gpilotd */
- /* 1. initialize the gpilotd connection */
- if (gpilotd_init(&argc,argv)!=0) {
- run_error_dialog(_("Cannot initialze the GnomePilot Daemon"));
- g_error(_("Cannot initialze the GnomePilot Daemon"));
- return -1;
- }
-
- /* 2 connect to gpilotd */
- if (gpilotd_connect()!=0) {
- run_error_dialog(_("Cannot connect to the GnomePilot Daemon"));
- g_error(_("Cannot connect to the GnomePilot Daemon"));
- return -1;
- }
-
- pilotId = get_pilot_id_from_gpilotd();
- if(!pilotId) return -1;
-
- /* put all code to set things up in here */
- gcalconduit_load_configuration(&origState,pilotId);
- gpilotd_conduit_mgmt_get_sync_type(conduit,pilotId,&origState->sync_type);
-
- curState = gcalconduit_dupe_configuration(origState);
-
- pilot_capplet_setup();
-
-
- /* done setting up, now run main loop */
- capplet_gtk_main();
- return 0;
-}
diff --git a/calendar/calendar-conduit-control-applet.desktop b/calendar/calendar-conduit-control-applet.desktop
deleted file mode 100644
index 43c429ef97..0000000000
--- a/calendar/calendar-conduit-control-applet.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Name=GnomeCalendar
-Comment=Configure the GnomeCal conduit
-Exec=calendar-conduit-control-applet --cap-id=1
-Terminal=0
-Type=Application
-Icon=gnome-calendar-conduit.png
diff --git a/calendar/calendar-conduit.c b/calendar/calendar-conduit.c
deleted file mode 100644
index d7ec8083ae..0000000000
--- a/calendar/calendar-conduit.c
+++ /dev/null
@@ -1,1433 +0,0 @@
-/* $Id$ */
-
-#include <glib.h>
-#include <gnome.h>
-
-#include <pi-source.h>
-#include <pi-socket.h>
-#include <pi-file.h>
-#include <pi-dlp.h>
-#include <pi-version.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <utime.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <libgnorba/gnorba.h>
-#include <libgnorba/gnome-factory.h>
-
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-standard-abs.h>
-
-#include "GnomeCal.h"
-#include "calobj.h"
-#include "calendar.h"
-#include "timeutil.h"
-
-#include "calendar-conduit.h"
-
-int debug_alarms = 0; /* needed to satisfy some other part of gncal */
-/* Default values for alarms */ /* needed to satisfy some other part of gncal */
-CalendarAlarm alarm_defaults[4] = {
- { ALARM_MAIL, 0, 15, ALARM_MINUTES },
- { ALARM_PROGRAM, 0, 15, ALARM_MINUTES },
- { ALARM_DISPLAY, 0, 15, ALARM_MINUTES },
- { ALARM_AUDIO, 0, 15, ALARM_MINUTES }
-};
-
-GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
-void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
-void local_record_from_icalobject(GCalLocalRecord *local,iCalObject *obj);
-
-#define CONDUIT_VERSION "0.8.9"
-#ifdef G_LOG_DOMAIN
-#undef G_LOG_DOMAIN
-#endif
-#define G_LOG_DOMAIN "gcalconduit"
-
-#define DEBUG_CALCONDUIT
-#undef DEBUG_CALCONDUIT
-
-#ifdef DEBUG_CALCONDUIT
-#define show_exception(e) g_warning ("Exception: %s\n", CORBA_exception_id (e))
-#define LOG(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE, e)
-#else
-#define show_exception(e)
-#define LOG(e...)
-#endif
-
-#define WARN(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_WARNING, e)
-#define INFO(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE, e)
-
-static int
-start_calendar_server (GnomePilotConduitStandardAbs *conduit,
- GCalConduitContext *ctxt)
-{
-
- g_return_val_if_fail(conduit!=NULL,-2);
- g_return_val_if_fail(ctxt!=NULL,-2);
-
- ctxt->calendar = goad_server_activate_with_id (NULL,
- "IDL:GNOME:Calendar:Repository:1.0",
- 0, NULL);
- if (ctxt->calendar == CORBA_OBJECT_NIL) {
- g_error ("Can not communicate with GnomeCalendar server");
- return -1;
- }
-
- if (ctxt->ev._major != CORBA_NO_EXCEPTION){
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- }
- return 0;
-}
-
-
-/* Just a stub to link with */
-void
-calendar_notify (time_t time, CalendarAlarm *which, void *data)
-{
-}
-
-static GSList *
-get_calendar_objects(GnomePilotConduitStandardAbs *conduit,
- gboolean *status,
- GCalConduitContext *ctxt)
-{
- GSList *result;
- GNOME_Calendar_Repository_String_Sequence *uids;
-
- g_return_val_if_fail(conduit!=NULL,NULL);
- g_return_val_if_fail(ctxt!=NULL,NULL);
-
- result = NULL;
- uids = GNOME_Calendar_Repository_get_object_id_list (ctxt->calendar, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- if(status!=NULL) (*status) = FALSE;
- return NULL;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- if(status!=NULL) (*status) = FALSE;
- return NULL;
- }
-
- if(status!=NULL) (*status) = TRUE;
- if(uids->_length>0) {
- int i;
- for(i=0;i<uids->_length;i++) {
- result = g_slist_prepend(result,g_strdup(uids->_buffer[i]));
- }
- } else {
- INFO ("No entries found");
- }
-
- CORBA_free(uids);
-
- return result;
-}
-
-#if 0
-static GList *
-get_calendar_objects(GnomePilotConduitStandardAbs *conduit)
-{
- char *vcalendar_string;
- char *error;
- GList *retval,*l;
- Calendar *cal;
-
- g_return_val_if_fail(conduit!=NULL,NULL);
-
- vcalendar_string =
- GNOME_Calendar_Repository_get_objects (calendar, &ev);
-
- cal = calendar_new("Temporary");
-
- error = calendar_load_from_memory(cal,vcalendar_string);
-
- if (ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&ev);
- CORBA_exception_free(&ev);
- return;
- } else if(ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&ev);
- CORBA_exception_free(&ev);
- return;
- }
-
- if(error != NULL) {
- WARN ("Error while converting records");
- WARN ("Error : %s",error);
- return NULL;
- }
- retval = NULL;
- for(l=cal->events ; l ; l=l->next) {
- LOG ("duping %d [%s]",
- ((iCalObject*)l->data)->pilot_id,
- ((iCalObject*)l->data)->summary);
- retval = g_list_prepend(retval,ical_object_duplicate(l->data));
- }
-
- /* g_free(vcalendar_string); FIXME: this coredumps, but won't it leak without ? */
- calendar_destroy(cal);
-
- return retval;
-}
-#endif
-
-static void
-local_record_from_ical_uid(GCalLocalRecord *local,
- char *uid,
- GCalConduitContext *ctxt)
-{
- iCalObject *obj;
- char *vcalendar_string;
-
- g_assert(local!=NULL);
-
- vcalendar_string = GNOME_Calendar_Repository_get_object(ctxt->calendar, uid, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- }
- g_return_if_fail(vcalendar_string!=NULL);
-
- obj = ical_object_new_from_string (vcalendar_string);
-
- local_record_from_icalobject(local,obj);
-
- return;
-}
-
-
-/*
- * converts a iCalObject to a GCalLocalRecord
- */
-
-void
-local_record_from_icalobject(GCalLocalRecord *local,
- iCalObject *obj)
-{
- g_return_if_fail(local!=NULL);
- g_return_if_fail(obj!=NULL);
-
- local->ical = obj;
- local->local.ID = local->ical->pilot_id;
-
-/*
- LOG ("local->Id = %ld [%s], status = %d",
- local->local.ID,obj->summary,local->ical->pilot_status);
-*/
- switch(local->ical->pilot_status) {
- case ICAL_PILOT_SYNC_NONE:
- local->local.attr = GnomePilotRecordNothing;
- break;
- case ICAL_PILOT_SYNC_MOD:
- local->local.attr = GnomePilotRecordModified;
- break;
- case ICAL_PILOT_SYNC_DEL:
- local->local.attr = GnomePilotRecordDeleted;
- break;
- }
-
- /* Records without a pilot_id are new */
- if(local->local.ID == 0)
- local->local.attr = GnomePilotRecordNew;
-
- local->local.secret = 0;
- if(obj->class!=NULL)
- if(strcmp(obj->class,"PRIVATE")==0)
- local->local.secret = 1;
-
- local->local.archived = 0;
-}
-
-/*
- * Given a PilotRecord, find the matching record in
- * the calendar repository. If no match, return NULL
- */
-static GCalLocalRecord *
-find_record_in_repository(GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- char *vcal_string;
- GCalLocalRecord *loc;
-
- g_return_val_if_fail(conduit!=NULL,NULL);
- g_return_val_if_fail(remote!=NULL,NULL);
-
- LOG ("requesting %ld", remote->ID);
-
- vcal_string =
- GNOME_Calendar_Repository_get_object_by_pilot_id (ctxt->calendar, remote->ID, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return NULL;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return NULL;
- } else {
- LOG ("Found");
- loc = g_new0(GCalLocalRecord,1);
- /* memory allocated in new_from_string is freed in free_match */
- local_record_from_icalobject(loc,
- ical_object_new_from_string (vcal_string));
- /* g_free(vcal_string); FIXME: this coredumps, but won't it leak without ? */
- return loc;
- }
-
- return NULL;
-}
-
-/*
- * updates an given iCalObject in the repository
- */
-static void
-update_calendar_entry_in_repository(GnomePilotConduitStandardAbs *conduit,
- iCalObject *obj,
- GCalConduitContext *ctxt)
-{
- char *str;
-
- g_return_if_fail(conduit!=NULL);
- g_return_if_fail(obj!=NULL);
-
- str = calendar_string_from_object (obj);
-
- GNOME_Calendar_Repository_update_object (ctxt->calendar, obj->uid, str, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- }
-
- free (str);
-}
-
-static iCalObject *
-ical_from_remote_record(GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- iCalObject *in_obj)
-{
- iCalObject *obj;
- int i;
- struct Appointment a;
- time_t now;
-
- now = time (NULL);
-
- g_return_val_if_fail(remote!=NULL,NULL);
- memset(&a,0,sizeof(struct Appointment));
- unpack_Appointment(&a,remote->record,remote->length);
-
- if (in_obj == NULL)
- obj = ical_new (a.note ? a.note : "",
- g_get_user_name (),
- a.description ? a.description : "");
- else
- obj = in_obj;
-
- if (a.note) {
- g_free(obj->comment);
- obj->comment = g_strdup(a.note);
- }
- if (a.description) {
- g_free(obj->summary);
- obj->summary = g_strdup(a.description);
- }
-
- obj->created = now;
- obj->last_mod = now;
- obj->priority = 0;
- obj->transp = 0;
- obj->related = NULL;
- obj->pilot_id = remote->ID;
- obj->pilot_status = ICAL_PILOT_SYNC_NONE;
-
- /*
- * Begin and end
- */
-
- if (a.event)
- {
- /* turn day-long events into a full day's appointment
- FIXME: get settings from gnomecal */
- a.begin.tm_sec = 0;
- a.begin.tm_min = 0;
- a.begin.tm_hour = 0;
-
- a.end.tm_sec = 0;
- a.end.tm_min =59;
- a.end.tm_hour = 23;
- }
-
- obj->dtstart = mktime (&a.begin);
- obj->dtend = mktime (&a.end);
-
- /* Special case: daily repetitions are converted to a multi-day event */
- /* This sucketh, a pilot event scheduled for dailyRepeat, freq 1, end on
- whatever is cleary converted wrong
- if (a.repeatType == repeatDaily){
- time_t newt = time_add_day (obj->dtend, a.repeatFrequency);
-
- obj->dtend = newt;
- }
- */
-
- /*
- * Alarm
- */
- if (a.alarm){
- obj->aalarm.type = ALARM_AUDIO;
- obj->aalarm.enabled = 1;
- obj->aalarm.count = a.advance;
-
- switch (a.advanceUnits){
- case advMinutes:
- obj->aalarm.units = ALARM_MINUTES;
- break;
-
- case advHours:
- obj->aalarm.units = ALARM_HOURS;
- break;
-
- case advDays:
- obj->aalarm.units = ALARM_DAYS;
- break;
- default:
- }
- }
-
- /*
- * Recurrence
- */
- if (a.repeatFrequency){
- obj->recur = g_new0 (Recurrence, 1);
-
- switch (a.repeatType){
- case repeatDaily:
- /*
- * In the Pilot daily repetitions are actually
- * multi-day events
- */
- obj->recur->type = RECUR_DAILY;
- break;
-
- case repeatMonthlyByDate:
- obj->recur->type = RECUR_MONTHLY_BY_DAY;
- obj->recur->u.month_day = a.repeatFrequency;
- break;
-
- case repeatWeekly:
- {
- int wd;
-
- obj->recur->type = RECUR_WEEKLY;
- for (wd = 0; wd < 7; wd++)
- if (a.repeatDays [wd])
- obj->recur->weekday |= 1 << wd;
-
- if (obj->recur->weekday == 0){
- struct tm tm = *localtime (&obj->dtstart);
-
- obj->recur->weekday = 1 << tm.tm_wday;
- }
- break;
- }
-
- case repeatMonthlyByDay:
- obj->recur->type = RECUR_MONTHLY_BY_POS;
- obj->recur->u.month_pos = a.repeatFrequency;
- obj->recur->weekday = (a.repeatDay / 7);
- break;
-
- case repeatYearly:
- obj->recur->type = RECUR_YEARLY_BY_DAY;
- break;
-
- default:
- g_assert_not_reached();
- }
-
- if (a.repeatForever)
- obj->recur->duration = 0;
- else
- obj->recur->_enddate = mktime (&a.repeatEnd);
-
- obj->recur->interval = a.repeatFrequency;
- }
-
- /*
- * Load exception dates
- */
- obj->exdate = NULL;
- for (i = 0; i < a.exceptions; i++){
- time_t *t = g_new (time_t, 1);
-
- *t = mktime (&(a.exception [i]));
- obj->exdate = g_list_prepend (obj->exdate, t);
- }
-
- g_free (obj->class);
-
- if (remote->attr & dlpRecAttrSecret)
- obj->class = g_strdup ("PRIVATE");
- else
- obj->class = g_strdup ("PUBLIC");
-
-
- free_Appointment(&a);
-
- return obj;
-}
-
-/* Code blatantly stolen from
- * calendar-pilot-sync.c:
- *
- * (C) 1999 International GNOME Support
- *
- * Author:
- * Miguel de Icaza (miguel@gnome-support.com)
- *
- */
-static gint
-update_record (GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- char *vcal_string;
- iCalObject *obj;
- struct Appointment a;
-
- g_return_val_if_fail(remote!=NULL,-1);
-
- memset(&a,0,sizeof(struct Appointment));
- unpack_Appointment(&a,remote->record,remote->length);
-
- obj = ical_new (a.note ? a.note : "",
- g_get_user_name (),
- a.description ? a.description : "");
-
- LOG ("requesting %ld [%s]", remote->ID, a.description);
- vcal_string = GNOME_Calendar_Repository_get_object_by_pilot_id (ctxt->calendar, remote->ID, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- LOG ("Object did not exist, creating a new one");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- ical_from_remote_record(conduit,remote,obj);
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- ical_object_destroy (obj);
- free_Appointment(&a);
- return -1;
- } else {
- LOG ("Found");
- ical_object_destroy (obj);
- obj = ical_object_new_from_string (vcal_string);
- ical_from_remote_record(conduit,remote,obj);
- CORBA_free(vcal_string);
- }
-
- /* update record on server */
-
- update_calendar_entry_in_repository(conduit,obj,ctxt);
-
- /*
- * Shutdown
- */
- ical_object_destroy (obj);
- free_Appointment(&a);
-
- return 0;
-}
-
-static void
-check_for_slow_setting(GnomePilotConduit *c,
- GCalConduitContext *ctxt)
-{
- CORBA_long entry_number;
- entry_number =
- GNOME_Calendar_Repository_get_number_of_objects(ctxt->calendar,
- &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- } else {
- LOG (_("Calendar holds %d entries"),entry_number);
- /* If the local base is empty, do a slow sync */
- if ( entry_number <= 0) {
- gnome_pilot_conduit_standard_set_slow(c);
- }
- }
-}
-
-static gint
-pre_sync(GnomePilotConduit *c,
- GnomePilotDBInfo *dbi,
- GCalConduitContext *ctxt)
-{
- int l;
- unsigned char *buf;
-
- g_message ("GnomeCal Conduit v.%s",CONDUIT_VERSION);
-
- ctxt->calendar = CORBA_OBJECT_NIL;
-
- if (start_calendar_server(GNOME_PILOT_CONDUIT_STANDARD_ABS(c),ctxt) != 0) {
- WARN(_("Could not start gnomecal server"));
- return -1;
- }
-
- gtk_object_set_data(GTK_OBJECT(c),"dbinfo",dbi);
-
- /* load_records(c); */
-
- buf = (unsigned char*)g_malloc(0xffff);
- if((l=dlp_ReadAppBlock(dbi->pilot_socket,dbi->db_handle,0,(unsigned char *)buf,0xffff))<0) {
- WARN(_("Could not read pilot's DateBook application block"));
- return -1;
- }
- unpack_AppointmentAppInfo(&(ctxt->ai),buf,l);
- g_free(buf);
-
- check_for_slow_setting(c,ctxt);
-
- return 0;
-}
-
-/**
- * Find (if possible) the local record which matches
- * the given PilotRecord.
- * if successfull, return non-zero and set *local to
- * a non-null value (the located local record),
- * otherwise return 0 and set *local = NULL;
- */
-
-static gint
-match_record (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("in match_record");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
-
- *local = find_record_in_repository(conduit,remote,ctxt);
-
- if (*local==NULL) return -1;
- return 0;
-}
-
-/**
- * Free the data allocated by a previous match_record call.
- * If successfull, return non-zero and ser *local=NULL, otherwise
- * return 0.
- */
-static gint
-free_match (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- GCalConduitContext *ctxt)
-{
- LOG ("entering free_match");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(*local!=NULL,-1);
-
- ical_object_destroy (GCAL_LOCALRECORD(*local)->ical);
- g_free(*local);
-
- *local = NULL;
- return 0;
-}
-
-/*
- Move to archive and set status to Nothing
- */
-static gint
-archive_local (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- GCalConduitContext *ctxt)
-{
- LOG ("entering archive_local");
-
- g_return_val_if_fail(local!=NULL,-1);
-
- return -1;
-}
-
-/*
- Store in archive and set status to Nothing
- */
-static gint
-archive_remote (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering archive_remote");
-
- g_return_val_if_fail(remote!=NULL,-1);
- g_return_val_if_fail(local!=NULL,-1);
-
- return -1;
-}
-
-/*
- Store and set status to Nothing
- */
-static gint
-store_remote (GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering store_remote");
-
- g_return_val_if_fail(remote!=NULL,-1);
- remote->attr = GnomePilotRecordNothing;
-
- return update_record(conduit,remote,ctxt);
-}
-
-static gint
-clear_status_archive_local (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- GCalConduitContext *ctxt)
-{
- LOG ("entering clear_status_archive_local");
-
- g_return_val_if_fail(local!=NULL,-1);
-
- return -1;
-}
-
-static gint
-iterate (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- GCalConduitContext *ctxt)
-{
- static GSList *events,*iterator;
- static int hest;
-
- g_return_val_if_fail(local!=NULL,-1);
-
- if(*local==NULL) {
- LOG ("beginning iteration");
-
- events = get_calendar_objects(conduit,NULL,ctxt);
- hest = 0;
-
- if(events!=NULL) {
- LOG ("iterating over %d records",g_slist_length(events));
- *local = g_new0(GCalLocalRecord,1);
-
- local_record_from_ical_uid(*local,(gchar*)events->data,ctxt);
- iterator = events;
- } else {
- LOG ("no events");
- (*local) = NULL;
- }
- } else {
- /*LOG ("continuing iteration");*/
- hest++;
- if(g_slist_next(iterator)==NULL) {
- GSList *l;
-
- LOG ("ending");
- /** free stuff allocated for iteration */
- g_free((*local));
-
- LOG ("iterated over %d records",hest);
- for(l=events;l;l=l->next)
- g_free(l->data);
-
- g_slist_free(events);
-
- /* ends iteration */
- (*local) = NULL;
- return 0;
- } else {
- iterator = g_slist_next(iterator);
- local_record_from_ical_uid(*local,(gchar*)(iterator->data),ctxt);
- }
- }
- return 1;
-}
-
-static gint
-iterate_specific (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- gint flag,
- gint archived,
- GCalConduitContext *ctxt)
-{
-#ifdef DEBUG_CALCONDUIT
- {
- gchar *tmp;
- switch (flag) {
- case GnomePilotRecordNothing: tmp = g_strdup("RecordNothing"); break;
- case GnomePilotRecordModified: tmp = g_strdup("RecordModified"); break;
- case GnomePilotRecordNew: tmp = g_strdup("RecordNew"); break;
- default: tmp = g_strdup_printf("0x%x",flag); break;
- }
- LOG ("entering iterate_specific(flag = %s)",tmp);
- g_free(tmp);
- }
-#endif
- g_return_val_if_fail(local!=NULL,-1);
-
- /* iterate until a record meets the criteria */
- while(gnome_pilot_conduit_standard_abs_iterate(conduit,(LocalRecord**)local)) {
- if((*local)==NULL) break;
- if(archived && ((*local)->local.archived==archived)) break;
- if(((*local)->local.attr == flag)) break;
- }
-
- return (*local)==NULL?0:1;
-}
-
-static gint
-purge (GnomePilotConduitStandardAbs *conduit,
- GCalConduitContext *ctxt)
-{
- LOG ("entering purge");
-
-
- /* HEST, gem posterne her */
-
- return -1;
-}
-
-static gint
-set_status (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- gint status,
- GCalConduitContext *ctxt)
-{
- LOG ("entering set_status(status=%d)",status);
-
- g_return_val_if_fail(local!=NULL,-1);
-
- g_assert(local->ical!=NULL);
-
- local->local.attr = status;
- switch(status) {
- case GnomePilotRecordPending:
- case GnomePilotRecordNothing:
- local->ical->pilot_status = ICAL_PILOT_SYNC_NONE;
- break;
- case GnomePilotRecordDeleted:
- break;
- case GnomePilotRecordNew:
- case GnomePilotRecordModified:
- local->ical->pilot_status = ICAL_PILOT_SYNC_MOD;
- break;
- }
-
- if ( status == GnomePilotRecordDeleted) {
- GNOME_Calendar_Repository_delete_object(ctxt->calendar,local->ical->uid,&(ctxt->ev));
- } else {
- GNOME_Calendar_Repository_update_pilot_id(ctxt->calendar,
- local->ical->uid,
- local->local.ID,
- local->ical->pilot_status,
- &(ctxt->ev));
- }
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- LOG ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- }
- return 0;
-}
-
-static gint
-set_archived (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- gint archived,
- GCalConduitContext *ctxt)
-{
- LOG ("entering set_archived");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_assert(local->ical!=NULL);
-
- local->local.archived = archived;
- update_calendar_entry_in_repository(conduit,local->ical,ctxt);
- /* FIXME: This should move the entry into a speciel
- calendar file, eg. Archive, or (by config option), simply
- delete it */
- return 0;
-}
-
-static gint
-set_pilot_id (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- guint32 ID,
- GCalConduitContext *ctxt)
-{
- LOG ("entering set_pilot_id(id=%d)",ID);
-
- g_return_val_if_fail(local!=NULL,-1);
- g_assert(local->ical!=NULL);
-
- local->local.ID = ID;
- local->ical->pilot_id = ID;
- GNOME_Calendar_Repository_update_pilot_id(ctxt->calendar,
- local->ical->uid,
- local->local.ID,
- local->ical->pilot_status,
- &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- LOG ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- }
- return 0;
-}
-
-static gint
-transmit (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord **remote,
- GCalConduitContext *ctxt)
-{
- PilotRecord *p;
- int daycount;
-
- LOG ("entering transmit");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
- g_assert(local->ical!=NULL);
-
- p = g_new0(PilotRecord,1);
-
- p->ID = local->local.ID;
- p->attr = local->local.attr;
- p->archived = local->local.archived;
- p->secret = local->local.secret;
-
- local->a = g_new0(struct Appointment,1);
-
- local->a->event = 0; /* if no start time, leave at 1 */
- local->a->begin = *localtime(&local->ical->dtstart);
- local->a->end = *localtime(&local->ical->dtend);
-
- /* set the Audio Alarm parameters */
- if(local->ical->aalarm.enabled) {
- local->a->alarm = 1;
- local->a->advance = local->ical->aalarm.count;
- switch(local->ical->aalarm.units) {
- case ALARM_MINUTES:
- local->a->advanceUnits = advMinutes;
- break;
- case ALARM_HOURS:
- local->a->advanceUnits = advHours;
- break;
- case ALARM_DAYS:
- local->a->advanceUnits = advDays;
- break;
- }
- } else {
- local->a->alarm = 0;
- local->a->advance = 0;
- local->a->advanceUnits = advMinutes;
- }
-
- /* set the recurrence parameters */
- if (local->ical->recur != NULL) {
- switch (local->ical->recur->type) {
- case RECUR_DAILY:
- local->a->repeatType = repeatDaily;
- break;
- case RECUR_WEEKLY:
- local->a->repeatType = repeatWeekly;
- break;
- case RECUR_MONTHLY_BY_POS:
- local->a->repeatType = repeatMonthlyByDate;
- break;
- case RECUR_MONTHLY_BY_DAY:
- local->a->repeatType = repeatMonthlyByDay;
- break;
- case RECUR_YEARLY_BY_MONTH:
- local->a->repeatType = repeatYearly;
- break;
- case RECUR_YEARLY_BY_DAY:
- local->a->repeatType = repeatYearly;
- break;
- }
- if (local->ical->recur->duration == 0) {
- local->a->repeatForever = 1;
- } else {
- local->a->repeatForever = 0;
- local->a->repeatEnd = *localtime(&local->ical->recur->_enddate);
- }
- local->a->repeatFrequency = local->ical->recur->interval;
-
-
- for ( daycount=0; daycount<7; daycount++ ) {
- if (local->ical->recur->weekday & (1 << daycount))
- local->a->repeatDays[daycount] = 1;
- }
- } else {
- local->a->repeatType = repeatNone;
- local->a->repeatForever = 0;
- local->a->repeatEnd = local->a->end;
- local->a->repeatFrequency = 0;
- local->a->repeatDay = dom1stSun;
- local->a->repeatDays[0] = 0;
- local->a->repeatDays[1] = 0;
- local->a->repeatDays[2] = 0;
- local->a->repeatDays[3] = 0;
- local->a->repeatDays[4] = 0;
- local->a->repeatDays[5] = 0;
- local->a->repeatDays[6] = 0;
- local->a->repeatWeekstart = 0;
- local->a->exceptions = 0;
- local->a->exception = NULL;
- }
-
- /* STOP: don't replace these with g_strdup, since free_Appointment
- uses free to deallocte */
- local->a->note =
- local->ical->comment==NULL?NULL:strdup(local->ical->comment);
- local->a->description =
- local->ical->summary==NULL?NULL:strdup(local->ical->summary);
-
- /* Generate pilot record structure */
- p->record = g_new0(char,0xffff);
- p->length = pack_Appointment(local->a,p->record,0xffff);
-
-#if 0
- /* This is some debug code that hexdumps the calendar entry...
- You won't need this. */
- {
- int x,y;
- g_message("calconduit: new item from %s to %s",asctime(&(local->a->begin)),asctime(&(local->a->end)));
-
- g_message("local->a->note = %s",local->a->note);
- g_message("local->a->description = %s",local->a->description);
- g_message("sizeof(p->record) = %d, length is %d",sizeof(p->record),p->length);
- for(x=0;x<p->length;x+=32) {
- for(y=x;y<x+32;y++)
- if(p->record[y]<33 || p->record[y]>128)
- printf("%02X",p->record[y]);
- else
- printf(" %c",p->record[y]);
- printf("\n");
- }
- }
-#endif
-
- *remote = p;
-
- return 0;
-}
-
-static gint
-free_transmit (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord **remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering free_transmit");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
-
- free_Appointment(local->a);
- g_free((*remote)->record);
- *remote = NULL;
- return 0;
-}
-
-static gint
-compare (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- /* used by the quick compare */
- PilotRecord *remoteOfLocal;
- int err;
- int retval;
-
- /* used by the tedious compare */
- struct Appointment a;
- int daycount;
-
- g_message ("entering compare");
-
- g_return_val_if_fail (local!=NULL,-1);
- g_return_val_if_fail (remote!=NULL,-1);
-#if 1
- err = transmit(conduit,local,&remoteOfLocal,ctxt);
- if (err != 0) return err;
-
- retval = 0;
- if (remote->length == remoteOfLocal->length) {
- if (memcmp(remoteOfLocal->record,remote->record,remote->length)!=0) {
- g_message("compare failed on contents");
- retval = 1;
- }
- } else {
- g_message("compare failed on length");
- retval = 1;
- }
-
- free_transmit(conduit,local,&remoteOfLocal,ctxt);
- return retval;
-
-#else
- /** FIXME: All the { LOG("yadayada"); return 1; } bloat is for debug purposes.
- Once this is known to work, compact to return 1;'s */
-
- /* Check record attributes */
- if (local->local.ID != remote->ID) {
- LOG("failed local->local.ID == remote->ID");
- return 1;
- }
- if (local->local.attr != remote->attr) {
- LOG("failed local->local.attr == remote->attr");
- return 1;
- }
- if (local->local.archived != remote->archived) {
- LOG("failed local->local.archived == remote->archived");
- return 1;
- }
- if (local->local.secret != remote->secret) {
- LOG("failed local->local.secret == remote->secret");
- return 1;
- }
-
- unpack_Appointment(&a,remote->record,remote->length);
-
- /* Check records begin/end time */
- if (a.event==0) {
-/* FIXME
- if (a.begin != *localtime(&local->ical->dtstart)) {
- LOG("a.begin == *localtime(&local->ical->dtstart)");
- return 1;
- }
- if (a.end != *localtime(&local->ical->dtend)) {
- LOG("a.end == *localtime(&local->ical->dtend)");
- return 1;
- }
-*/
- } else {
- LOG("failed local->a.event != 0, unsupported by gnomecal");
- return 1;
- }
-
- /* Check records alarm settings */
- if(a.alarm == 1) {
- if (local->ical->aalarm.enabled == 1) {
- if (a.advance != local->ical->aalarm.count) {
- LOG("failed a.advance == local->ical->aalarm.count");
- return 1;
- }
- switch(local->ical->aalarm.units) {
- case ALARM_MINUTES:
- if (a.advanceUnits != advMinutes) {
- LOG("failed local->ical->aalarm.units == a.advanceUnits");
- return 1;
- }
- break;
- case ALARM_HOURS:
- if (a.advanceUnits != advHours) {
- LOG("failed local->ical->aalarm.units == a.advanceUnits");
- return 1;
- }
- break;
- case ALARM_DAYS:
- if (a.advanceUnits != advDays) {
- LOG("failed local->ical->aalarm.units == a.advanceUnits");
- return 1;
- }
- break;
- }
- } else {
- LOG("failed a.alarm == 1 && local->ical->aalarm.enabled == 1");
- return 1;
- }
- } else if (local->ical->aalarm.enabled == 1) {
- LOG("failed a.alarm != 1 && local->ical->aalarm.enabled != 1");
- return 1;
- }
-
- /* Check records recurrence settings */
- /* If this code is broken, a more or less safe although not efficient
- approach is (other the fixing the bug), if either has recurrence,
- return 1, thus failing the comparision */
- if (local->ical->recur != NULL) {
- if (a.repeatType == repeatNone) {
- LOG("failed: local->ical->recur != NULL && a.repeatType != repeatNone");
- return 1;
- }
- switch (local->ical->recur->type) {
- case RECUR_DAILY:
- if (a.repeatType != repeatDaily) {
- LOG("failed a.repeatType == repeatDaily");
- return 1; }
- break;
- case RECUR_WEEKLY:
- if (a.repeatType != repeatWeekly) {
- LOG("failed a.repeatType == repeatWeekly");
- return 1; }
- break;
- case RECUR_MONTHLY_BY_POS:
- if (a.repeatType != repeatMonthlyByDate) {
- LOG("failed a.repeatType == repeatMonthlyByDate");
- return 1; }
- break;
- case RECUR_MONTHLY_BY_DAY:
- if (a.repeatType != repeatMonthlyByDay) {
- LOG("failed a.repeatType == repeatMonthlyByDay");
- return 1; }
- break;
- case RECUR_YEARLY_BY_MONTH:
- if (a.repeatType != repeatYearly) {
- LOG("failed a.repeatType == repeatYearly");
- return 1; }
- break;
- case RECUR_YEARLY_BY_DAY:
- if (a.repeatType != repeatYearly) {
- LOG("failed a.repeatType == repeatYearly");
- return 1; }
- break;
- }
- if (local->ical->recur->duration == 0) {
- if(a.repeatForever != 1) {
- LOG("failed local->ical->recur->duration == 0 && a.repeatForever == 1");
- return 1;
- }
- } else {
- if(a.repeatForever != 0) {
- LOG("failed local->ical->recur->duration != 0 && ! a.repeatForever == 0");
- return 1;
- }
-/* FIXME
- if(a.repeatEnd != *localtime(&local->ical->recur->_enddate)) {
- LOG("failed a.repeatEnd == *localtime(&local->ical->recur->_enddate)");
- return 1;
- }
-*/
- }
- if (a.repeatFrequency != local->ical->recur->interval) {
- LOG("failed a.repeatFrequency == local->ical->recur->interval");
- return 1;
- }
- for (daycount = 0; daycount<7; daycount++) {
- if(local->ical->recur->weekday & (1<<daycount)) {
- if (a.repeatDays[daycount]!=1) {
- LOG("failed local->ical->recur->weekday & (1<<daycount) && a.repeatDays[daycount]==1");
- return 1;
- }
- } else {
- if (a.repeatDays[daycount]!=0) {
- LOG("failed local->ical->recur->weekday &! (1<<daycount) && a.repeatDays[daycount]==0");
- return 1;
- }
- }
- }
- } else if (a.repeatType != repeatNone ) {
- LOG("failed: local->ical->recur == NULL && a.repeatType == repeatNone");
- return 1;
- }
-
- /* check the note and description */
- if(a.note!=NULL) {
- if(local->ical->comment==NULL) {
- LOG("failed a.note != NULL && local->ical->coment != NULL");
- return 1;
- }
- if(strcmp(local->ical->comment,a.note)!=0) {
- LOG("failed strcmp(local->ical->comment,a.note)==0");
- return 1;
- }
- } if(local->ical->comment!=NULL) {
- LOG("failed a.note == NULL && local->ical->coment == NULL");
- return 1;
- }
- if(a.description!=NULL) {
- if(local->ical->summary==NULL) {
- LOG("failed a.description != NULL && local->ical->coment != NULL");
- return 1;
- }
- if(strcmp(local->ical->summary,a.description)!=0) {
- LOG("failed strcmp(local->ical->summary,a.description)==0");
- return 1;
- }
- } if(local->ical->summary!=NULL) {
- LOG("failed a.description == NULL && local->ical->coment == NULL");
- return 1;
- }
-#endif
- return 0;
-}
-
-static gint
-compare_backup (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering compare_backup");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
-
- return -1;
-}
-
-static gint
-delete_all (GnomePilotConduitStandardAbs *conduit,
- GCalConduitContext *ctxt)
-{
- GSList *events,*it;
- gboolean error;
-
- events = get_calendar_objects(conduit,&error,ctxt);
-
- if (error == FALSE) return -1;
- for (it=events;it;it = g_slist_next(it)) {
- GNOME_Calendar_Repository_delete_object(ctxt->calendar,
- it->data,
- &(ctxt->ev));
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- /* destroy loop, free data */
- for (it=events;it;it = g_slist_next(it)) g_free(it->data);
- g_slist_free(events);
- return -1;
- }
- g_free(it->data);
- }
- g_slist_free(events);
- return -1;
-}
-
-GnomePilotConduit *
-conduit_get_gpilot_conduit (guint32 pilotId)
-{
- GtkObject *retval;
- GCalConduitCfg *cfg;
- GCalConduitContext *ctxt;
-
-
- retval = gnome_pilot_conduit_standard_abs_new ("DatebookDB", 0x64617465);
- g_assert (retval != NULL);
- gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"GnomeCalConduit");
-
- gcalconduit_load_configuration(&cfg,pilotId);
- gtk_object_set_data(retval,"gcalconduit_cfg",cfg);
-
- gcalconduit_new_context(&ctxt,cfg);
- gtk_object_set_data(GTK_OBJECT(retval),"gcalconduit_context",ctxt);
-
- gtk_signal_connect (retval, "match_record", (GtkSignalFunc) match_record, ctxt);
- gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt);
- gtk_signal_connect (retval, "archive_local", (GtkSignalFunc) archive_local, ctxt);
- gtk_signal_connect (retval, "archive_remote", (GtkSignalFunc) archive_remote, ctxt);
- gtk_signal_connect (retval, "store_remote", (GtkSignalFunc) store_remote, ctxt);
- gtk_signal_connect (retval, "clear_status_archive_local", (GtkSignalFunc) clear_status_archive_local, ctxt);
- gtk_signal_connect (retval, "iterate", (GtkSignalFunc) iterate, ctxt);
- gtk_signal_connect (retval, "iterate_specific", (GtkSignalFunc) iterate_specific, ctxt);
- gtk_signal_connect (retval, "purge", (GtkSignalFunc) purge, ctxt);
- gtk_signal_connect (retval, "set_status", (GtkSignalFunc) set_status, ctxt);
- gtk_signal_connect (retval, "set_archived", (GtkSignalFunc) set_archived, ctxt);
- gtk_signal_connect (retval, "set_pilot_id", (GtkSignalFunc) set_pilot_id, ctxt);
- gtk_signal_connect (retval, "compare", (GtkSignalFunc) compare, ctxt);
- gtk_signal_connect (retval, "compare_backup", (GtkSignalFunc) compare_backup, ctxt);
- gtk_signal_connect (retval, "free_transmit", (GtkSignalFunc) free_transmit, ctxt);
- gtk_signal_connect (retval, "delete_all", (GtkSignalFunc) delete_all, ctxt);
- gtk_signal_connect (retval, "transmit", (GtkSignalFunc) transmit, ctxt);
- gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, ctxt);
-
- return GNOME_PILOT_CONDUIT (retval);
-}
-
-void
-conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit)
-{
- GCalConduitCfg *cc;
- GCalConduitContext *ctxt;
-
- cc = GET_GCALCONFIG(conduit);
- ctxt = GET_GCALCONTEXT(conduit);
-
- if(ctxt->calendar!=CORBA_OBJECT_NIL)
- GNOME_Calendar_Repository_done (ctxt->calendar, &(ctxt->ev));
-
- gcalconduit_destroy_configuration(&cc);
-
- gcalconduit_destroy_context(&ctxt);
-
- gtk_object_destroy (GTK_OBJECT (conduit));
-
-}
-
-
diff --git a/calendar/calendar-conduit.h b/calendar/calendar-conduit.h
deleted file mode 100644
index 711609e96a..0000000000
--- a/calendar/calendar-conduit.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* $Id$ */
-
-#ifndef __CALENDAR_CONDUIT_H__
-#define __CALENDAR_CONDUIT_H__
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <pi-datebook.h>
-#include <gnome.h>
-
-#include "GnomeCal.h"
-#include "calobj.h"
-#include "calendar.h"
-#include "timeutil.h"
-
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-standard-abs.h>
-
-/* This is the local record structure for the GnomeCal conduit. */
-typedef struct _GCalLocalRecord GCalLocalRecord;
-struct _GCalLocalRecord {
- /* The stuff from gnome-pilot-conduit-standard-abs.h
- Must be first in the structure, or instances of this
- structure cannot be used by gnome-pilot-conduit-standard-abs.
- */
- LocalRecord local;
- /* The corresponding iCal object, as found by GnomeCal. */
- iCalObject *ical;
- /* pilot-link appointment structure, used for implementing Transmit. */
- struct Appointment *a;
-};
-#define GCAL_LOCALRECORD(s) ((GCalLocalRecord*)(s))
-
-/* This is the configuration of the GnomeCal conduit. */
-typedef struct _GCalConduitCfg GCalConduitCfg;
-struct _GCalConduitCfg {
- gboolean open_secret;
- guint32 pilotId;
- GnomePilotConduitSyncType sync_type; /* only used by capplet */
-};
-#define GET_GCALCONFIG(c) ((GCalConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"gcalconduit_cfg"))
-
-/* This is the context for all the GnomeCal conduit methods. */
-typedef struct _GCalConduitContext GCalConduitContext;
-struct _GCalConduitContext {
- struct AppointmentAppInfo ai;
- GCalConduitCfg *cfg;
- GNOME_Calendar_Repository calendar;
- CORBA_Environment ev;
- CORBA_ORB orb;
-};
-#define GET_GCALCONTEXT(c) ((GCalConduitContext*)gtk_object_get_data(GTK_OBJECT(c),"gcalconduit_context"))
-
-/* Given a GCalConduitCfg*, allocates the structure and
- loads the configuration data for the given pilot. */
-static void
-gcalconduit_load_configuration(GCalConduitCfg **c,
- guint32 pilotId)
-{
- gchar prefix[256];
- g_snprintf(prefix,255,"/gnome-pilot.d/calendard-conduit/Pilot_%u/",pilotId);
-
- *c = g_new0(GCalConduitCfg,1);
- g_assert(*c != NULL);
- gnome_config_push_prefix(prefix);
- (*c)->open_secret = gnome_config_get_bool("open_secret=FALSE");
- (*c)->sync_type = GnomePilotConduitSyncTypeCustom; /* set in capplets main */
- gnome_config_pop_prefix();
-
- (*c)->pilotId = pilotId;
-}
-
-/* Saves the configuration data. */
-static void
-gcalconduit_save_configuration(GCalConduitCfg *c)
-{
- gchar prefix[256];
-
- g_snprintf(prefix,255,"/gnome-pilot.d/calendar-conduit/Pilot_%u/",c->pilotId);
-
- gnome_config_push_prefix(prefix);
- gnome_config_set_bool("open_secret",c->open_secret);
- gnome_config_pop_prefix();
-
- gnome_config_sync();
- gnome_config_drop_all();
-}
-
-/* Creates a duplicate of the configuration data */
-static GCalConduitCfg*
-gcalconduit_dupe_configuration(GCalConduitCfg *c) {
- GCalConduitCfg *retval;
- g_return_val_if_fail(c!=NULL,NULL);
- retval = g_new0(GCalConduitCfg,1);
- retval->sync_type = c->sync_type;
- retval->open_secret = c->open_secret;
- retval->pilotId = c->pilotId;
- return retval;
-}
-
-/* Destroys any data allocated by gcalconduit_load_configuration
- and deallocates the given configuration. */
-static void
-gcalconduit_destroy_configuration(GCalConduitCfg **c)
-{
- g_return_if_fail(c!=NULL);
- g_return_if_fail(*c!=NULL);
- g_free(*c);
- *c = NULL;
-}
-
-/* Given a GCalConduitContxt*, allocates the structure */
-static void
-gcalconduit_new_context(GCalConduitContext **ctxt,
- GCalConduitCfg *c)
-{
- *ctxt = g_new0(GCalConduitContext,1);
- g_assert(ctxt!=NULL);
- (*ctxt)->cfg = c;
- CORBA_exception_init (&((*ctxt)->ev));
-}
-
-/* Destroys any data allocated by gcalconduit_new_context
- and deallocates its data. */
-static void
-gcalconduit_destroy_context(GCalConduitContext **ctxt)
-{
- g_return_if_fail(ctxt!=NULL);
- g_return_if_fail(*ctxt!=NULL);
-/*
- if ((*ctxt)->cfg!=NULL)
- gcalconduit_destroy_configuration(&((*ctxt)->cfg));
-*/
- g_free(*ctxt);
- *ctxt = NULL;
-}
-#endif __CALENDAR_CONDUIT_H__
diff --git a/calendar/calendar-pilot-sync.c b/calendar/calendar-pilot-sync.c
deleted file mode 100644
index a98ff9b49b..0000000000
--- a/calendar/calendar-pilot-sync.c
+++ /dev/null
@@ -1,658 +0,0 @@
-/*
- * calendar-pilot-sync.c:
- *
- * (C) 1999 International GNOME Support
- *
- * Author:
- * Miguel de Icaza (miguel@gnome-support.com)
- *
- */
-#include <config.h>
-#include <gnome.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libgnorba/gnome-factory.h>
-#include <libgnorba/gnorba.h>
-#include "calobj.h"
-#include "calendar.h"
-#include "timeutil.h"
-#include "GnomeCal.h"
-#include "pi-source.h"
-#include "pi-socket.h"
-#include "pi-datebook.h"
-#include "pi-dlp.h"
-
-/* the CORBA ORB */
-CORBA_ORB orb;
-
-/* The default port to communicate with */
-char *pilot_port = "/dev/pilot";
-
-CORBA_Environment ev;
-
-/* Our pi-socket address where we connect to */
-struct pi_sockaddr addr;
-
-/* The Pilot DB identifier for DateBook */
-int db;
-
-/* If true, enable debug output for alarms */
-int debug_alarms = 0;
-
-/* True if you want to dump the flags bits from the records */
-int debug_attrs = 0;
-
-/* Default values for alarms */
-CalendarAlarm alarm_defaults[4] = {
- { ALARM_MAIL, 0, 15, ALARM_MINUTES },
- { ALARM_PROGRAM, 0, 15, ALARM_MINUTES },
- { ALARM_DISPLAY, 0, 15, ALARM_MINUTES },
- { ALARM_AUDIO, 0, 15, ALARM_MINUTES }
-};
-
-int only_desktop_to_pilot = 0;
-
-int only_pilot_to_desktop = 0;
-
-const struct poptOption calendar_sync_options [] = {
- { "pilot", 0, POPT_ARG_STRING, &pilot_port, 0,
- N_("Specifies the port on which the Pilot is"), N_("PORT") },
- { "debug-attrs", 0, POPT_ARG_NONE, &debug_attrs, 0,
- N_("If you want to debug the attributes on records"), NULL },
- { "only-desktop", 0, POPT_ARG_NONE, &only_desktop_to_pilot, 0,
- N_("Only syncs from desktop to pilot"), NULL },
- { "only-pilot", 0, POPT_ARG_INT, &only_pilot_to_desktop, 0,
- N_("Only syncs from pilot to desktop"), NULL },
- { NULL, '\0', 0, NULL, 0 }
-};
-
-static void
-conduit_free_Appointment (struct Appointment *a)
-{
- /* free_Appointment is brain-dead with respect to guarding against
- double-frees */
-
- free_Appointment (a);
- a->exception = 0;
- a->description = 0;
- a->note = 0;
-}
-
-static int
-setup_connection (void)
-{
- int socket;
- int ret, news;
-
- if (!(socket = pi_socket(PI_AF_SLP, PI_SOCK_STREAM, PI_PF_PADP)))
- g_error (_("Can not create Pilot socket\n"));
-
- addr.pi_family = PI_AF_SLP;
- strncpy ((void *) &addr.pi_device, pilot_port, sizeof (addr.pi_device));
-
- ret = pi_bind (socket, (struct sockaddr *)&addr, sizeof (addr));
- if (ret == -1)
- g_error (_("Can not bind to device %s\n"), pilot_port);
-
- if (pi_listen (socket, 1) == -1)
- g_error (_("Failed to get a connection from the Pilot device"));
-
- if ((news = pi_accept (socket, 0, 0)) == -1)
- g_error (_("pi_accept failed"));
-
- return news;
-}
-
-static GNOME_Calendar_Repository
-locate_calendar_server (void)
-{
- GNOME_Calendar_Repository repo;
-
- repo = goad_server_activate_with_id (
- NULL, "IDL:GNOME:Calendar:Repository:1.0",
- 0, NULL);
-
- if (repo == CORBA_OBJECT_NIL)
- g_error ("Can not communicate with GnomeCalendar server");
-
- if (ev._major != CORBA_NO_EXCEPTION){
- printf ("Exception: %s\n", CORBA_exception_id (&ev));
- abort ();
- }
-
- return repo;
-}
-
-static void
-delete_record (GNOME_Calendar_Repository repo, int id)
-{
- char *uid;
-
- uid = GNOME_Calendar_Repository_get_id_from_pilot_id (repo, id, &ev);
-
- /* The record was already deleted */
- if (ev._major != CORBA_NO_EXCEPTION)
- return;
-
- GNOME_Calendar_Repository_delete_object (repo, uid, &ev);
- CORBA_free (uid);
-}
-
-static void
-update_record (GNOME_Calendar_Repository repo, int id, struct Appointment *a, int attr)
-{
- char *vcal_string;
- iCalObject *obj;
- int i;
- char *str;
-
- obj = ical_new (a->note ? a->note : "",
- g_get_user_name (),
- a->description ? a->description : "");
-
- printf ("requesting %d [%s]\n", id, a->description);
- vcal_string = GNOME_Calendar_Repository_get_object_by_pilot_id (repo, id, &ev);
-
- if (ev._major == CORBA_USER_EXCEPTION){
- time_t now = time (NULL);
-
- obj->created = now;
- obj->last_mod = now;
- obj->priority = 0;
- obj->transp = 0;
- obj->related = NULL;
- obj->pilot_id = id;
- obj->pilot_status = ICAL_PILOT_SYNC_NONE;
- printf (_("\tObject did not exist, creating a new one\n"));
- } else {
- printf ("\tFound\n");
- obj = ical_object_new_from_string (vcal_string);
- }
-
- if (obj->pilot_status == ICAL_PILOT_SYNC_MOD){
- printf (_("\tObject has been modified on desktop and on the pilot, desktop takes precedence\n"));
- ical_object_destroy (obj);
- return;
- }
-
- /*
- * Begin and end
- */
-
- if (a->event)
- {
- /* turn day-long events into a full day's appointment */
- a->begin.tm_sec = 0;
- a->begin.tm_min = 0;
- a->begin.tm_hour = 6;
-
- a->end.tm_sec = 0;
- a->end.tm_min = 0;
- a->end.tm_hour = 10;
- }
-
- obj->dtstart = mktime (&a->begin);
- obj->dtend = mktime (&a->end);
-
- /* Special case: daily repetitions are converted to a multi-day event */
- if (a->repeatType == repeatDaily){
- time_t newt = time_add_day (obj->dtend, a->repeatFrequency);
-
- obj->dtend = newt;
- }
-
- /*
- * Alarm
- */
- if (a->alarm){
- obj->aalarm.type = ALARM_AUDIO;
- obj->aalarm.enabled = 1;
- obj->aalarm.count = a->advance;
-
- switch (a->advanceUnits){
- case advMinutes:
- obj->aalarm.units = ALARM_MINUTES;
- break;
-
- case advHours:
- obj->aalarm.units = ALARM_HOURS;
- break;
-
- case advDays:
- obj->aalarm.units = ALARM_DAYS;
- break;
- default:
- }
- }
-
- /*
- * Recurrence
- */
- if (a->repeatFrequency && a->repeatType != repeatDaily){
- obj->recur = g_new0 (Recurrence, 1);
-
- switch (a->repeatType){
- case repeatDaily:
- /*
- * In the Pilot daily repetitions are actually
- * multi-day events
- */
- g_warning ("Should not have got here");
- break;
-
- case repeatMonthlyByDate:
- obj->recur->type = RECUR_MONTHLY_BY_DAY;
- obj->recur->u.month_day = a->repeatFrequency;
- break;
-
- case repeatWeekly:
- {
- int wd;
-
- obj->recur->type = RECUR_WEEKLY;
- for (wd = 0; wd < 7; wd++)
- if (a->repeatDays [wd])
- obj->recur->weekday |= 1 << wd;
-
- if (obj->recur->weekday == 0){
- struct tm tm = *localtime (&obj->dtstart);
-
- obj->recur->weekday = 1 << tm.tm_wday;
- }
- break;
- }
-
- case repeatMonthlyByDay:
- obj->recur->type = RECUR_MONTHLY_BY_POS;
- obj->recur->u.month_pos = a->repeatFrequency;
- obj->recur->weekday = (a->repeatDay / 7);
- break;
-
- case repeatYearly:
- obj->recur->type = RECUR_YEARLY_BY_DAY;
- break;
-
- default:
- g_warning ("Unhandled repeate case");
- }
-
- if (a->repeatForever)
- obj->recur->duration = 0;
- else
- obj->recur->_enddate = mktime (&a->repeatEnd);
- }
-
- /*
- * Load exception dates
- */
- obj->exdate = NULL;
- for (i = 0; i < a->exceptions; i++){
- time_t *t = g_new (time_t, 1);
-
- *t = mktime (&(a->exception [i]));
- obj->exdate = g_list_prepend (obj->exdate, t);
- }
-
- g_free (obj->class);
-
- if (attr & dlpRecAttrSecret)
- obj->class = g_strdup ("PRIVATE");
- else
- obj->class = g_strdup ("PUBLIC");
-
- /*
- * Now, convert the in memory iCalObject to a full vCalendar we can send
- */
- str = calendar_string_from_object (obj);
-
- GNOME_Calendar_Repository_update_object (repo, obj->uid, str, &ev);
-
- free (str);
-
- /*
- * Shutdown
- */
- ical_object_destroy (obj);
-}
-
-/*
- * Sets the alarm for Appointment based on @alarm
- */
-static int
-try_alarm (CalendarAlarm *alarm, struct Appointment *a)
-{
- if (!alarm->enabled)
- return 0;
-
- a->advance = alarm->count;
- switch (alarm->type){
- case ALARM_DAYS:
- a->advanceUnits = advDays;
- break;
-
- case ALARM_HOURS:
- a->advanceUnits = advHours;
- break;
-
- case ALARM_MINUTES:
- a->advanceUnits = advMinutes;
- break;
-
- default:
- return 0;
- }
- a->alarm = 1;
- return 1;
-}
-
-static void
-sync_object_to_pilot (GNOME_Calendar_Repository repo, iCalObject *obj, int pilot_fd)
-{
- char buffer [65536];
- struct Appointment *a;
- int wd, i, idx, attr, cat, rec_len;
- recordid_t new_id;
- GList *l;
-
- a = g_new0 (struct Appointment, 1);
-
- attr = 0;
- cat = 0;
- idx = 0;
-
- if (obj->pilot_id){
- rec_len = dlp_ReadRecordById (pilot_fd, db, obj->pilot_id,
- buffer, &idx, &rec_len, &attr, &cat);
-
- if (rec_len > 0)
- unpack_Appointment (a, buffer, rec_len);
- } else {
- attr = 0;
- cat = 0;
- }
-
- /* a contains the appointment either cleared or with the data from the Pilot */
- a->begin = *localtime (&obj->dtstart);
- a->end = *localtime (&obj->dtend);
-
- /* FIXME: add support for timeless */
- a->event = 0;
-
- /* Alarms, try the various ones. Probably we should only do Audio?
- * Otherwise going gnomecal->pilot->gnomecal would get the gnomecal
- * with *possibly* an alarm that was not originally defined.
- */
- a->alarm = 0;
- if (try_alarm (&obj->aalarm, a) == 0)
- if (try_alarm (&obj->dalarm, a) == 0)
- try_alarm (&obj->palarm, a);
-
- /* Recurrence */
- if (obj->recur){
- a->repeatFrequency = obj->recur->interval;
-
- switch (obj->recur->type){
- case RECUR_MONTHLY_BY_POS:
- a->repeatType = repeatMonthlyByDay;
- a->repeatFrequency = obj->recur->u.month_pos;
- a->repeatDay = obj->recur->weekday * 7;
- break;
-
- case RECUR_MONTHLY_BY_DAY:
- a->repeatType = repeatMonthlyByDate;
- a->repeatFrequency = obj->recur->u.month_day;
- break;
-
- case RECUR_YEARLY_BY_DAY:
- a->repeatType = repeatYearly;
- break;
-
- case RECUR_WEEKLY:
- for (wd = 0; wd < 7; wd++)
- if (obj->recur->weekday & (1 << wd))
- a->repeatDays [wd] = 1;
- a->repeatType = repeatWeekly;
- break;
- case RECUR_DAILY:
-
- default:
- a->repeatType = repeatNone;
- break;
- }
- if (obj->recur->enddate == 0){
- a->repeatForever = 1;
- } else
- a->repeatEnd = *localtime (&obj->recur->enddate);
- }
-
- /*
- * Pilot uses a repeat-daily for a multi-day event, adjust for that case
- */
- if ((a->end.tm_mday != a->begin.tm_mday) ||
- (a->end.tm_mon != a->begin.tm_mon) ||
- (a->end.tm_year != a->begin.tm_year)){
- a->event = 1;
- a->begin.tm_sec = 0;
- a->begin.tm_min = 0;
- a->begin.tm_hour = 0;
-
- a->end.tm_sec = 0;
- a->end.tm_min = 0;
- a->end.tm_hour = 0;
-
- a->repeatEnd = a->end;
- a->repeatForever = 0;
- a->repeatFrequency = 1;
- a->repeatType = repeatDaily;
- }
-
- /*
- * Exceptions
- */
- a->exceptions = g_list_length (obj->exdate);
- a->exception = (struct tm *) malloc (sizeof (struct tm) * a->exceptions);
- for (i = 0, l = obj->exdate; l; l = l->next, i++){
- time_t *exdate = l->data;
-
- a->exception [i] = *localtime (exdate);
- }
-
- /*
- * Description and note.
- *
- * We use strdup to be correct. free_Appointment assumes we used
- * malloc.
- */
- if (obj->comment)
- a->note = strdup (obj->comment);
- else
- a->note = 0;
-
- if (obj->summary)
- a->description = strdup (obj->summary);
- else
- a->description = strdup (_("No description"));
-
- if (strcmp (obj->class, "PUBLIC") != 0)
- attr |= dlpRecAttrSecret;
- else
- attr &= ~dlpRecAttrSecret;
-
- /*
- * Send the appointment to the pilot
- */
- rec_len = pack_Appointment (a, buffer, sizeof (buffer));
- attr &= ~dlpRecAttrDirty;
-
- dlp_WriteRecord (
- pilot_fd, db, 0,
- obj->pilot_id, 0, buffer, rec_len, &new_id);
-
- GNOME_Calendar_Repository_update_pilot_id (repo, obj->uid, new_id, ICAL_PILOT_SYNC_NONE, &ev);
-
- conduit_free_Appointment (a);
- g_free (a);
-}
-
-static void
-sync_cal_to_pilot (GNOME_Calendar_Repository repo, Calendar *cal, int pilot_fd)
-{
- GList *l;
- int c = g_list_length (cal->events);
- int i;
-
- printf ("\n");
- for (i = 0, l = cal->events; l; l = l->next, i++){
- iCalObject *obj = l->data;
-
- printf ("Syncing desktop to pilot: %d/%d\r", i + 1, c);
- fflush (stdout);
- if (obj->pilot_status != ICAL_PILOT_SYNC_MOD){
- g_warning ("Strange, we were supposed to get only a dirty object");
- continue;
- }
-
- sync_object_to_pilot (repo, obj, pilot_fd);
- }
- printf ("\n");
-}
-
-static void
-dump_attr (int flags)
-{
- if (flags & dlpRecAttrDeleted)
- fprintf(stderr, " Deleted");
- if (flags & dlpRecAttrDirty)
- fprintf(stderr, " Dirty");
- if (flags & dlpRecAttrBusy)
- fprintf(stderr, " Busy");
- if (flags & dlpRecAttrSecret)
- fprintf(stderr, " Secret");
- if (flags & dlpRecAttrArchived)
- fprintf(stderr, " Archive");
- fprintf (stderr, "\n");
-}
-
-static void
-sync_pilot (GNOME_Calendar_Repository repo, int pilot_fd)
-{
- struct PilotUser user_info;
- int record;
- unsigned char buffer [65536];
- Calendar *dirty_cal;
- char *vcalendar_string;
- char *error;
-
- printf (_("Syncing with the pilot..."));
- dlp_ReadUserInfo (pilot_fd, &user_info);
-
- /* This informs the user of the progress on the Pilot */
- dlp_OpenConduit (pilot_fd);
-
- if (dlp_OpenDB (pilot_fd, 0, 0x80 | 0x40, "DatebookDB", &db) < 0){
- g_warning (_("Could not open DatebookDB on the Pilot"));
- dlp_AddSyncLogEntry (pilot_fd, _("Unable to open DatebookDB"));
- pi_close (pilot_fd);
- exit (1);
- }
-
- /*
- * 1. Pull all the records from the Pilot, and make any updates
- * required on the desktop side
- */
- if (!only_desktop_to_pilot){
- for (record = 0;; record++){
- struct Appointment a;
- int rec_len, attr, size;
- recordid_t id;
-
- rec_len = dlp_ReadRecordByIndex (
- pilot_fd, db,
- record, buffer, &id, &size, &attr, 0);
-
- if (rec_len < 0)
- break;
-
- printf ("processing record %d\n", record);
- unpack_Appointment (&a, buffer, rec_len);
-
- if (debug_attrs)
- dump_attr (attr);
-
- /* If the object was deleted, remove it from the database */
- if (attr & dlpRecAttrDeleted){
- printf ("Deleting id %ld\n", id);
- delete_record (repo, id);
- conduit_free_Appointment (&a);
- dlp_DeleteRecord (pilot_fd, db, 0, id);
- continue;
- }
-
- if (attr & dlpRecAttrArchived)
- continue;
-
- printf ("updating record\n");
- update_record (repo, id, &a, attr);
-
- conduit_free_Appointment (&a);
- }
- }
-
- /*
- * 2. Pull all the records from the Calendar, and move any new items
- * to the pilot
- */
- if (!only_pilot_to_desktop){
- vcalendar_string = GNOME_Calendar_Repository_get_updated_objects (repo, &ev);
- dirty_cal = calendar_new ("Temporal");
- error = calendar_load_from_memory (dirty_cal, vcalendar_string);
- if (!error)
- sync_cal_to_pilot (repo, dirty_cal, pilot_fd);
- calendar_destroy (dirty_cal);
- }
-
-
- dlp_CloseDB (pilot_fd, db);
- dlp_AddSyncLogEntry (pilot_fd, _("Synced DateBook from Pilot to GnomeCal"));
- pi_close (pilot_fd);
-}
-
-int
-main (int argc, char *argv [])
-{
- int link;
- GNOME_Calendar_Repository repository;
-
- CORBA_exception_init (&ev);
- orb = gnome_CORBA_init_with_popt_table (
- "calendar-pilot-sync", VERSION, &argc, argv,
- calendar_sync_options, 0, NULL, 0, &ev);
-
- printf ("Please, press HotSync button on the palm...");
- fflush (stdout);
- link = setup_connection ();
- printf ("Connected\n");
-
- printf ("Launching GnomeCal...");
- fflush (stdout);
- repository = locate_calendar_server ();
- printf ("Done\n");
-
- printf ("<Syncing>\n");
- sync_pilot (repository, link);
- printf ("</Syncing>\n");
-
- GNOME_Calendar_Repository_done (repository, &ev);
-
- CORBA_exception_free (&ev);
-
- return 0;
-}
-
-/* Just a stub to link with */
-void
-calendar_notify (time_t time, CalendarAlarm *which, void *data)
-{
-}
-
diff --git a/calendar/calendar.c b/calendar/calendar.c
deleted file mode 100644
index 0fbecaf6f6..0000000000
--- a/calendar/calendar.c
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * Calendar manager object
- *
- * This keeps track of a given calendar. Eventually this will abtract everything
- * related to getting calendars/saving calendars locally or to a remote Calendar Service
- *
- * Copyright (C) 1998, 1999 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (quartic@gimp.org)
- *
- */
-
-#include <gnome.h>
-#include <stdio.h>
-#include <config.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include "calendar.h"
-#include "alarm.h"
-#include "timeutil.h"
-#include "../libversit/vcc.h"
-
-#ifdef HAVE_TZNAME
-extern char *tzname[2];
-#endif
-
-/* Our day range */
-time_t calendar_day_begin, calendar_day_end;
-
-static void calendar_init_alarms (Calendar *cal);
-static void calendar_set_day (void);
-
-Calendar *
-calendar_new (char *title)
-{
- Calendar *cal;
-
- cal = g_new0 (Calendar, 1);
-
- cal->title = g_strdup (title);
-
- if ((calendar_day_begin == 0) || (calendar_day_end == 0))
- calendar_set_day ();
-
- cal->event_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- calendar_init_alarms (cal);
-
- return cal;
-}
-
-static void
-try_add (iCalObject *ico, CalendarAlarm *alarm, time_t start, time_t end)
-{
- alarm->trigger = start-alarm->offset;
-
- if (alarm->trigger < calendar_day_begin)
- return;
- if (alarm->trigger > calendar_day_end)
- return;
- alarm_add (alarm, &calendar_notify, ico);
-}
-
-static int
-add_object_alarms (iCalObject *obj, time_t start, time_t end, void *closure)
-{
- if (obj->aalarm.enabled)
- try_add (obj, &obj->aalarm, start, end);
- if (obj->dalarm.enabled)
- try_add (obj, &obj->dalarm, start, end);
- if (obj->palarm.enabled)
- try_add (obj,&obj->palarm, start, end);
- if (obj->malarm.enabled)
- try_add (obj, &obj->malarm, start, end);
-
- return TRUE;
-}
-
-#define max(a,b) ((a > b) ? a : b)
-
-static void
-ical_object_try_alarms (iCalObject *obj)
-{
- int ao, po, od, mo;
- int max_o;
-
- ao = alarm_compute_offset (&obj->aalarm);
- po = alarm_compute_offset (&obj->palarm);
- od = alarm_compute_offset (&obj->dalarm);
- mo = alarm_compute_offset (&obj->malarm);
-
- max_o = max (ao, max (po, max (od, mo)));
- if (max_o == -1)
- return;
-
- ical_object_generate_events (obj, calendar_day_begin, calendar_day_end + max_o, add_object_alarms, obj);
-}
-
-void
-calendar_add_object (Calendar *cal, iCalObject *obj)
-{
- g_return_if_fail (cal != NULL);
- g_return_if_fail (obj != NULL);
- g_return_if_fail (obj->uid != NULL);
-
- obj->new = 0;
- switch (obj->type){
- case ICAL_EVENT:
- g_hash_table_insert (cal->event_hash, obj->uid, obj);
- cal->events = g_list_prepend (cal->events, obj);
- ical_object_try_alarms (obj);
-#ifdef DEBUGGING_MAIL_ALARM
- obj->malarm.trigger = 0;
- calendar_notify (0, obj);
-#endif
- break;
-
- case ICAL_TODO:
- cal->todo = g_list_prepend (cal->todo, obj);
- break;
-
- case ICAL_JOURNAL:
- cal->journal = g_list_prepend (cal->journal, obj);
- break;
- default:
- g_assert_not_reached ();
- }
-
- if (!obj->uid){
- char buffer [80];
-
- snprintf (buffer, sizeof (buffer), "GnomeCalendar-%ld\n", time (NULL));
- obj->uid = g_strdup (buffer);
- }
-
- cal->modified = TRUE;
-
- obj->last_mod = time (NULL);
-}
-
-void
-calendar_remove_object (Calendar *cal, iCalObject *obj)
-{
- switch (obj->type){
- case ICAL_EVENT:
- cal->events = g_list_remove (cal->events, obj);
- g_hash_table_remove (cal->event_hash, obj->uid);
- break;
-
- case ICAL_TODO:
- cal->todo = g_list_remove (cal->todo, obj);
- break;
-
- case ICAL_JOURNAL:
- cal->journal = g_list_remove (cal->journal, obj);
- break;
- default:
- g_assert_not_reached ();
- }
-
- cal->modified = TRUE;
-}
-
-void
-calendar_destroy (Calendar *cal)
-{
- g_list_foreach (cal->events, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->events);
-
- g_list_foreach (cal->todo, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->todo);
-
- g_list_foreach (cal->journal, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->journal);
-
- g_hash_table_destroy (cal->event_hash);
-
- if (cal->title)
- g_free (cal->title);
- if (cal->filename)
- g_free (cal->filename);
-
- g_free (cal);
-}
-
-void
-calendar_iterate_on_objects (GList *objects, time_t start, time_t end, calendarfn cb, void *closure)
-{
- for (; objects; objects = objects->next){
- iCalObject *object = objects->data;
-
- ical_object_generate_events (object, start, end, cb, closure);
- }
-}
-
-void
-calendar_iterate (Calendar *cal, time_t start, time_t end, calendarfn cb, void *closure)
-{
- calendar_iterate_on_objects (cal->events, start, end, cb, closure);
-}
-
-GList *
-calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func)
-{
- GList *new_events = 0;
-
- for (; objects; objects = objects->next){
- iCalObject *object = objects->data;
-
- if ((start <= object->dtstart) && (object->dtend <= end)){
- if (sort_func)
- new_events = g_list_insert_sorted (new_events, object, sort_func);
- else
- new_events = g_list_prepend (new_events, object);
- }
- }
-
- /* Put the list in increasing order if no sort function was specified */
-
- if (!sort_func)
- new_events = g_list_reverse (new_events);
-
- return new_events;
-}
-
-GList *
-calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- return calendar_get_objects_in_range (cal->todo, start, end, sort_func);
-}
-
-GList *
-calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- return calendar_get_objects_in_range (cal->journal, start, end, sort_func);
-}
-
-gint
-calendar_compare_by_dtstart (gpointer a, gpointer b)
-{
- iCalObject *obj1, *obj2;
- time_t diff;
-
- obj1 = a;
- obj2 = b;
-
- diff = obj1->dtstart - obj2->dtstart;
-
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-#define str_val(obj) (char *) vObjectUStringZValue (obj)
-
-/* Loads our calendar contents from a vObject */
-void
-calendar_load_from_vobject (Calendar *cal, VObject *vcal)
-{
- VObjectIterator i;
-
- initPropIterator (&i, vcal);
-
- while (moreIteration (&i)){
- VObject *this = nextVObject (&i);
- iCalObject *ical;
- const char *object_name = vObjectName (this);
-
- if (strcmp (object_name, VCDCreatedProp) == 0){
- cal->created = time_from_isodate (str_val (this));
- continue;
- }
-
- if (strcmp (object_name, VCLocationProp) == 0)
- continue; /* FIXME: imlement */
-
- if (strcmp (object_name, VCProdIdProp) == 0)
- continue; /* FIXME: implement */
-
- if (strcmp (object_name, VCVersionProp) == 0)
- continue; /* FIXME: implement */
-
- if (strcmp (object_name, VCTimeZoneProp) == 0)
- continue; /* FIXME: implement */
-
- ical = ical_object_create_from_vobject (this, object_name);
-
- if (ical)
- calendar_add_object (cal, ical);
- }
-}
-
-static void
-calendar_set_day (void)
-{
- time_t calendar_today;
-
- calendar_today = time (NULL);
- calendar_day_begin = time_day_begin (calendar_today);
- calendar_day_end = time_day_end (calendar_today);
-}
-
-/* Loads a calendar from a file */
-char *
-calendar_load (Calendar *cal, char *fname)
-{
- VObject *vcal;
- struct stat s;
-
- if (cal->filename){
- g_warning ("Calendar load called again\n");
- return "Internal error";
- }
-
- cal->filename = g_strdup (fname);
- vcal = Parse_MIME_FromFileName (fname);
- if (!vcal)
- return "Could not load the calendar";
-
- stat (fname, &s);
- cal->file_time = s.st_mtime;
-
- calendar_set_day ();
-
- calendar_load_from_vobject (cal, vcal);
- cleanVObject (vcal);
- cleanStrTbl ();
- return NULL;
-}
-
-/*
- * calendar_load_from_memory:
- * @cal: calendar on which we load the information
- * @buffer: A buffer that contains a vCalendar file
- *
- * Loads the information from the vCalendar information in @buffer
- * into the Calendar
- */
-char *
-calendar_load_from_memory (Calendar *cal, const char *buffer)
-{
- VObject *vcal;
-
- g_return_val_if_fail (buffer != NULL, NULL);
-
- cal->filename = g_strdup ("memory-based-calendar");
- vcal = Parse_MIME (buffer, strlen (buffer));
- if (!vcal)
- return "Could not load the calendar";
-
- cal->file_time = time (NULL);
- calendar_load_from_vobject (cal, vcal);
- cleanVObject (vcal);
- cleanStrTbl ();
-
- return NULL;
-}
-
-static VObject *
-vcalendar_create_from_calendar (Calendar *cal)
-{
- VObject *vcal;
- GList *l;
- time_t now = time (NULL);
- struct tm tm;
-
- /* WE call localtime for the side effect of setting tzname */
- tm = *localtime (&now);
-
- vcal = newVObject (VCCalProp);
- addPropValue (vcal, VCProdIdProp, "-//GNOME//NONSGML GnomeCalendar//EN");
-#if defined(HAVE_TM_ZONE)
- addPropValue (vcal, VCTimeZoneProp, tm.tm_zone);
-#elif defined(HAVE_TZNAME)
- addPropValue (vcal, VCTimeZoneProp, tzname[0]);
-#endif
- addPropValue (vcal, VCVersionProp, VERSION);
- cal->temp = vcal;
-
- /* Events */
-
- for (l = cal->events; l; l = l->next) {
- VObject *obj;
-
- obj = ical_object_to_vobject ((iCalObject *) l->data);
- addVObjectProp (vcal, obj);
- }
-
- /* To-do entries */
-
- for (l = cal->todo; l; l = l->next) {
- VObject *obj;
-
- obj = ical_object_to_vobject ((iCalObject *) l->data);
- addVObjectProp (vcal, obj);
- }
-
- return vcal;
-}
-
-void
-calendar_save (Calendar *cal, char *fname)
-{
- VObject *vcal;
- FILE *fp;
- GtkWidget *dlg;
- struct stat s;
- int status;
-
- if (fname == NULL)
- fname = cal->filename;
-
- vcal = vcalendar_create_from_calendar (cal);
- if (g_file_exists (fname)){
- char *backup_name = g_strconcat (fname, "~", NULL);
-
- if (g_file_exists (backup_name)){
- unlink (backup_name);
- }
- rename (fname, backup_name);
- g_free (backup_name);
- }
-
- fp = fopen(fname,"w");
- if (fp) {
- writeVObject(fp, vcal);
- fclose(fp);
- if (strcmp(cal->filename, fname)) {
- if (cal->filename)
- g_free (cal->filename);
- cal->filename = g_strdup (fname);
- }
- status = stat (fname, &s);
- cal->file_time = s.st_mtime;
- } else {
- dlg = gnome_message_box_new(_("Failed to save calendar!"),
- GNOME_MESSAGE_BOX_ERROR, "Ok", NULL);
- gtk_widget_show(dlg);
- }
-
- cleanVObject (vcal);
- cleanStrTbl ();
-}
-
-char *
-calendar_get_as_vcal_string (Calendar *cal)
-{
- VObject *vcal;
- char *result;
-
- g_return_val_if_fail (cal != NULL, NULL);
-
- vcal = vcalendar_create_from_calendar (cal);
- result = writeMemVObject (NULL, 0, vcal);
-
- cleanVObject (vcal);
- cleanStrTbl ();
-
- return result;
-}
-
-static gint
-calendar_object_compare_by_start (gconstpointer a, gconstpointer b)
-{
- const CalendarObject *ca = a;
- const CalendarObject *cb = b;
- time_t diff;
-
- diff = ca->ev_start - cb->ev_start;
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-static int
-assemble_event_list (iCalObject *obj, time_t start, time_t end, void *c)
-{
- CalendarObject *co;
- GList **l = c;
-
- co = g_new (CalendarObject, 1);
-
- co->ev_start = start;
- co->ev_end = end;
- co->ico = obj;
- *l = g_list_insert_sorted (*l, co, calendar_object_compare_by_start);
-
- return 1;
-}
-
-void
-calendar_destroy_event_list (GList *l)
-{
- GList *p;
-
- for (p = l; p; p = p->next)
- g_free (p->data);
- g_list_free (l);
-}
-
-GList *
-calendar_get_events_in_range (Calendar *cal, time_t start, time_t end)
-{
- GList *l = 0;
-
- calendar_iterate (cal, start, end, assemble_event_list, &l);
- return l;
-}
-
-void
-calendar_object_changed (Calendar *cal, iCalObject *obj, int flags)
-{
- obj->last_mod = time (NULL);
- obj->pilot_status = ICAL_PILOT_SYNC_MOD;
-
- if (!(flags & CHANGE_DATES))
- return;
-
- /* Remove any alarms on the alarm list for this object */
- while (alarm_kill (obj))
- ;
-
- ical_object_try_alarms (obj);
-}
-
-static void
-calendar_day_change (time_t time, CalendarAlarm *which, void *closure)
-{
- GList *events;
- Calendar *cal = closure;
-
- calendar_set_day ();
- calendar_init_alarms (cal);
-
- for (events = cal->events; events; events = events->next){
- iCalObject *obj = events->data;
-
- ical_object_try_alarms (obj);
- }
-}
-
-static void
-calendar_init_alarms (Calendar *cal)
-{
- CalendarAlarm day_change_alarm;
-
- day_change_alarm.trigger = calendar_day_end;
- alarm_add (&day_change_alarm, calendar_day_change, cal);
-}
-
-static iCalObject *
-calendar_object_find_in_list (Calendar *cal, GList *list, const char *uid)
-{
- GList *l;
-
- for (l = list; l; l = l->next){
- iCalObject *obj = l->data;
-
- if (strcmp (obj->uid, uid) == 0)
- return obj;
- }
-
- return NULL;
-}
-
-iCalObject *
-calendar_object_find_event (Calendar *cal, const char *uid)
-{
- g_return_val_if_fail (cal != NULL, NULL);
- g_return_val_if_fail (uid != NULL, NULL);
-
- return g_hash_table_lookup (cal->event_hash, uid);
-}
-
-iCalObject *
-calendar_object_find_todo (Calendar *cal, const char *uid)
-{
- g_return_val_if_fail (cal != NULL, NULL);
- g_return_val_if_fail (uid != NULL, NULL);
-
- return calendar_object_find_in_list (cal, cal->todo, uid);
-}
-
-iCalObject *
-calendar_object_find (Calendar *cal, const char *uid)
-{
- iCalObject *obj;
-
- g_return_val_if_fail (cal != NULL, NULL);
- g_return_val_if_fail (uid != NULL, NULL);
-
- obj = calendar_object_find_in_list (cal, cal->todo, uid);
-
- if (obj == NULL)
- obj = calendar_object_find_in_list (cal, cal->events, uid);
-
- return obj;
-}
-
-iCalObject *
-calendar_object_find_by_pilot (Calendar *cal, int pilot_id)
-{
- GList *l;
-
- g_return_val_if_fail (cal != NULL, NULL);
-
- for (l = cal->events; l; l = l->next){
- iCalObject *obj = l->data;
-
- if (obj->pilot_id == pilot_id)
- return obj;
- }
-
- for (l = cal->todo; l; l = l->next){
- iCalObject *obj = l->data;
-
- if (obj->pilot_id == pilot_id)
- return obj;
- }
-
- return NULL;
-}
-
-/*
- * calendar_string_from_object:
- *
- * Returns the iCalObject @object armored around a vCalendar
- * object as a string.
- */
-char *
-calendar_string_from_object (iCalObject *object)
-{
- Calendar *cal;
- char *str;
-
- g_return_val_if_fail (object != NULL, NULL);
-
- cal = calendar_new ("Temporal");
- calendar_add_object (cal, object);
- str = calendar_get_as_vcal_string (cal);
- calendar_remove_object (cal, object);
-
- calendar_destroy (cal);
-
- return str;
-}
diff --git a/calendar/calendar.h b/calendar/calendar.h
deleted file mode 100644
index 4a9d4bcff2..0000000000
--- a/calendar/calendar.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef CALENDAR_H
-#define CALENDAR_H
-
-#include "calobj.h"
-
-BEGIN_GNOME_DECLS
-
-typedef struct {
- /* This calendar's title */
- char *title;
-
- /* backing store for this calendar object */
- char *filename;
-
- /* The list of events; todo's and journal entries */
- GList *events;
- GList *todo;
- GList *journal;
-
- GHashTable *event_hash;
-
- /* Time at which the calendar was created */
- time_t created;
-
- /* Timestamp in the filename */
- time_t file_time;
-
- /* If the calendar was last modified */
- int modified;
- void *temp;
-
- void *corba_server;
-} Calendar;
-
-/* This is only used by the calendar_get_events_in_range routine to get
- * a list of objects that recur on a specific date
- */
-typedef struct {
- time_t ev_start;
- time_t ev_end;
- iCalObject *ico;
-} CalendarObject;
-
-Calendar *calendar_new (char *title);
-char *calendar_get_as_vcal_string (Calendar *cal);
-char *calendar_string_from_object (iCalObject *object);
-
-char *calendar_load (Calendar *cal, char *fname);
-char *calendar_load_from_memory (Calendar *cal, const char *buffer);
-void calendar_load_from_vobject (Calendar *cal, VObject *vcal);
-void calendar_save (Calendar *cal, char *fname);
-void calendar_add_object (Calendar *cal, iCalObject *obj);
-void calendar_remove_object (Calendar *cal, iCalObject *obj);
-void calendar_destroy (Calendar *cal);
-GList *calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func);
-GList *calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
-GList *calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
-gint calendar_compare_by_dtstart (gpointer a, gpointer b);
-
-void calendar_iterate_on_objects (GList *objects, time_t start, time_t end, calendarfn cb, void *closure);
-void calendar_iterate (Calendar *cal, time_t start, time_t end, calendarfn cb, void *closure);
-
-/* Returns a list of CalendarObject structures. These represent the events in the calendar that are
- * in the specified range.
- */
-GList *calendar_get_events_in_range (Calendar *cal, time_t start, time_t end);
-
-/* Destroy list returned by calendar_get_events_in_range() with this function */
-void calendar_destroy_event_list (GList *l);
-
-/* Informs the calendar that obj information has changed */
-void calendar_object_changed (Calendar *cal, iCalObject *obj, int flags);
-
-void calendar_notify (time_t time, CalendarAlarm *which, void *data);
-
-iCalObject *calendar_object_find_event (Calendar *cal, const char *uid);
-iCalObject *calendar_object_find_todo (Calendar *cal, const char *uid);
-iCalObject *calendar_object_find (Calendar *cal, const char *uid);
-iCalObject *calendar_object_find_by_pilot (Calendar *cal, int pilot_id);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/calobj.c b/calendar/calobj.c
deleted file mode 100644
index f3004ddb13..0000000000
--- a/calendar/calobj.c
+++ /dev/null
@@ -1,1490 +0,0 @@
-/*
- * Calendar objects implementations.
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (quartic@gimp.org)
- */
-#include <config.h>
-#include <string.h>
-#include <glib.h>
-#include <ctype.h>
-#include <unistd.h>
-#include "calobj.h"
-#include "timeutil.h"
-#include "../libversit/vcc.h"
-
-extern CalendarAlarm alarm_defaults[4];
-
-static char *
-ical_gen_uid (void)
-{
- static char *hostname;
- time_t t = time (NULL);
- static int serial;
-
- if (!hostname){
- char buffer [128];
-
- if ((gethostname (buffer, sizeof (buffer)-1) == 0) &&
- (buffer [0] != 0))
- hostname = g_strdup (buffer);
- else
- hostname = g_strdup ("localhost");
- }
-
- return g_strdup_printf (
- "%s-%d-%d-%d-%d@%s",
- isodate_from_time_t (t),
- getpid (),
- getgid (),
- getppid (),
- serial++,
- hostname);
-}
-
-iCalObject *
-ical_object_new (void)
-{
- iCalObject *ico;
-
- ico = g_new0 (iCalObject, 1);
-
- ico->seq = -1;
- ico->dtstamp = time (NULL);
- ico->uid = ical_gen_uid ();
-
- ico->pilot_id = 0;
- ico->pilot_status = ICAL_PILOT_SYNC_MOD;
-
- return ico;
-}
-
-static void
-default_alarm (iCalObject *ical, CalendarAlarm *alarm, char *def_mail, enum AlarmType type)
-{
- alarm->type = type;
- alarm->enabled = alarm_defaults[type].enabled;
- alarm->count = alarm_defaults[type].count;
- alarm->units = alarm_defaults[type].units;
- if (alarm_defaults[type].data)
- alarm->data = g_strdup (alarm_defaults[type].data);
- else
- alarm->data = g_strdup ("");
-}
-
-iCalObject *
-ical_new (char *comment, char *organizer, char *summary)
-{
- iCalObject *ico;
-
- ico = ical_object_new ();
-
- ico->comment = g_strdup (comment);
- ico->organizer = g_strdup (organizer);
- ico->summary = g_strdup (summary);
- ico->class = g_strdup ("PUBLIC");
- ico->status = g_strdup ("NEEDS ACTION");
-
- default_alarm (ico, &ico->dalarm, organizer, ALARM_DISPLAY);
- default_alarm (ico, &ico->palarm, organizer, ALARM_PROGRAM);
- default_alarm (ico, &ico->malarm, organizer, ALARM_MAIL);
- default_alarm (ico, &ico->aalarm, organizer, ALARM_AUDIO);
-
- return ico;
-}
-
-static void
-my_free (gpointer data, gpointer user_dat_ignored)
-{
- g_free (data);
-}
-
-static void
-list_free (GList *list)
-{
- g_list_foreach (list, my_free, 0);
- g_list_free (list);
-}
-
-#define free_if_defined(x) if (x){ g_free (x); x = 0; }
-#define lfree_if_defined(x) if (x){ list_free (x); x = 0; }
-void
-ical_object_destroy (iCalObject *ico)
-{
- /* Regular strings */
- free_if_defined (ico->comment);
- free_if_defined (ico->organizer);
- free_if_defined (ico->summary);
- free_if_defined (ico->uid);
- free_if_defined (ico->status);
- free_if_defined (ico->class);
- free_if_defined (ico->url);
- free_if_defined (ico->recur);
-
- /* Lists */
- lfree_if_defined (ico->exdate);
- lfree_if_defined (ico->categories);
- lfree_if_defined (ico->resources);
- lfree_if_defined (ico->related);
- lfree_if_defined (ico->attach);
-
- /* Alarms */
- g_free (ico->dalarm.data);
- g_free (ico->palarm.data);
- g_free (ico->malarm.data);
- g_free (ico->aalarm.data);
-
- g_free (ico);
-}
-
-static GList *
-set_list (char *str)
-{
- GList *list = 0;
- char *s;
-
- for (s = strtok (str, ";"); s; s = strtok (NULL, ";"))
- list = g_list_prepend (list, g_strdup (s));
-
- return list;
-}
-
-static GList *
-set_date_list (char *str)
-{
- GList *list = 0;
- char *s;
-
- for (s = strtok (str, ";,"); s; s = strtok (NULL, ";,")){
- time_t *t = g_new (time_t, 1);
-
- while (*s && isspace (*s))
- s++;
- *t = time_from_isodate (s);
- list = g_list_prepend (list, t);
- }
- return list;
-}
-
-void
-ical_object_add_exdate (iCalObject *o, time_t t)
-{
- time_t *pt = g_new (time_t, 1);
-
- *pt = t;
- o->exdate = g_list_prepend (o->exdate, pt);
-}
-
-static void
-ignore_space(char **str)
-{
- while (**str && isspace (**str))
- (*str)++;
-}
-
-static void
-skip_numbers (char **str)
-{
- while (**str){
- ignore_space (str);
- if (!isdigit (**str))
- return;
- while (**str && isdigit (**str))
- (*str)++;
- }
-}
-
-static void
-weekdaylist (iCalObject *o, char **str)
-{
- int i;
- struct {
- char first_letter, second_letter;
- int index;
- } days [] = {
- { 'S', 'U', 0 },
- { 'M', 'O', 1 },
- { 'T', 'U', 2 },
- { 'W', 'E', 3 },
- { 'T', 'H', 4 },
- { 'F', 'R', 5 },
- { 'S', 'A', 6 }
- };
-
- ignore_space (str);
- do {
- for (i = 0; i < 7; i++){
- if (**str == days [i].first_letter && *(*str+1) == days [i].second_letter){
- o->recur->weekday |= 1 << i;
- *str += 2;
- if (**str == ' ')
- (*str)++;
- }
- }
- } while (isalpha (**str));
-
- if (o->recur->weekday == 0){
- struct tm tm = *localtime (&o->dtstart);
-
- o->recur->weekday = 1 << tm.tm_wday;
- }
-}
-
-static void
-weekdaynum (iCalObject *o, char **str)
-{
- int i;
- struct {
- char first_letter, second_letter;
- int index;
- } days [] = {
- { 'S', 'U', 0 },
- { 'M', 'O', 1 },
- { 'T', 'U', 2 },
- { 'W', 'E', 3 },
- { 'T', 'H', 4 },
- { 'F', 'R', 5 },
- { 'S', 'A', 6 }
- };
-
- ignore_space (str);
- do {
- for (i = 0; i < 7; i++){
- if (**str == days [i].first_letter && *(*str+1) == days [i].second_letter){
- o->recur->weekday = i;
- *str += 2;
- if (**str == ' ')
- (*str)++;
- }
- }
- } while (isalpha (**str));
-}
-
-static void
-ocurrencelist (iCalObject *o, char **str)
-{
- char *p;
-
- ignore_space (str);
- p = *str;
- if (!isdigit (*p))
- return;
-
- if (!(*p >= '1' && *p <= '5'))
- return;
-
- if (!(*(p+1) == '+' || *(p+1) == '-'))
- return;
-
- o->recur->u.month_pos = (*p-'0') * (*(p+1) == '+' ? 1 : -1);
- *str += 2;
-}
-
-static void
-daynumber (iCalObject *o, char **str)
-{
- int val = 0;
- char *p = *str;
-
- ignore_space (str);
- if (strcmp (p, "LD")){
- o->recur->u.month_day = DAY_LASTDAY;
- *str += 2;
- return;
- }
-
- if (!(isdigit (*p)))
- return;
-
- while (**str && isdigit (**str)){
- val = val * 10 + (**str - '0');
- (*str)++;
- }
-
- if (**str == '+')
- (*str)++;
-
- if (**str == '-')
- val *= -1;
- o->recur->u.month_day = val;
-}
-
-static void
-daynumberlist (iCalObject *o, char **str)
-{
- int first = 0;
- int val = 0;
-
- ignore_space (str);
-
- while (**str){
- if (!isdigit (**str))
- return;
- while (**str && isdigit (**str)){
- val = 10 * val + (**str - '0');
- (*str)++;
- }
- if (!first){
- /*
- * Some broken applications set this to zero
- */
- if (val == 0){
- struct tm day = *localtime (&o->dtstart);
-
- val = day.tm_mday;
- }
- o->recur->u.month_day = val;
- first = 1;
- val = 0;
- }
- }
-}
-
-static void
-load_recur_weekly (iCalObject *o, char **str)
-{
- weekdaylist (o, str);
-}
-
-static void
-load_recur_monthly_pos (iCalObject *o, char **str)
-{
- ocurrencelist (o, str);
- weekdaynum (o, str);
-}
-
-static void
-load_recur_monthly_day (iCalObject *o, char **str)
-{
- daynumberlist (o, str);
-}
-
-static void
-load_recur_yearly_month (iCalObject *o, char **str)
-{
- /* Skip as we do not support multiple months and we do expect
- * the dtstart to agree with the value on this field
- */
- skip_numbers (str);
-}
-
-static void
-load_recur_yearly_day (iCalObject *o, char **str)
-{
- /* Skip as we do not support multiple days and we do expect
- * the dtstart to agree with the value on this field
- *
- * FIXME: we should support every-n-years
- */
- skip_numbers (str);
-}
-
-static void
-duration (iCalObject *o, char **str)
-{
- unsigned int duration = 0;
-
- ignore_space (str);
- if (**str != '#')
- return;
- (*str)++;
- while (**str && isdigit (**str)){
- duration = duration * 10 + (**str - '0');
- (*str)++;
- }
- o->recur->duration = duration;
-}
-
-static void
-enddate (iCalObject *o, char **str)
-{
- ignore_space (str);
- if (isdigit (**str)){
- o->recur->_enddate = time_from_isodate (*str);
- *str += 16;
- }
-}
-
-static int
-load_recurrence (iCalObject *o, char *str)
-{
- enum RecurType type;
- int interval = 0;
-
- type = -1;
- switch (*str++){
- case 'D':
- type = RECUR_DAILY;
- break;
-
- case 'W':
- type = RECUR_WEEKLY;
- break;
-
- case 'M':
- if (*str == 'P')
- type = RECUR_MONTHLY_BY_POS;
- else if (*str == 'D')
- type = RECUR_MONTHLY_BY_DAY;
- str++;
- break;
-
- case 'Y':
- if (*str == 'M')
- type = RECUR_YEARLY_BY_MONTH;
- else if (*str == 'D')
- type = RECUR_YEARLY_BY_DAY;
- str++;
- break;
- }
- if (type == -1)
- return 0;
-
- o->recur = g_new0 (Recurrence, 1);
- o->recur->type = type;
- ignore_space (&str);
-
- /* Get the interval */
- for (;*str && isdigit (*str);str++)
- interval = interval * 10 + (*str-'0');
-
- if (interval == 0)
- interval = 1;
-
- o->recur->interval = interval;
-
- /* this is the default per the spec */
- o->recur->duration = 2;
-
- ignore_space (&str);
-
- switch (type){
- case RECUR_DAILY:
- break;
- case RECUR_WEEKLY:
- load_recur_weekly (o, &str);
- break;
- case RECUR_MONTHLY_BY_POS:
- load_recur_monthly_pos (o, &str);
- break;
- case RECUR_MONTHLY_BY_DAY:
- load_recur_monthly_day (o, &str);
- break;
- case RECUR_YEARLY_BY_MONTH:
- load_recur_yearly_month (o, &str);
- break;
- case RECUR_YEARLY_BY_DAY:
- load_recur_yearly_day (o, &str);
- break;
- default:
- g_warning ("Unimplemented recurrence type %d", (int) type);
- break;
- }
- duration (o, &str);
- enddate (o, &str);
-
- /* Compute the enddate */
- if (o->recur->_enddate == 0){
- if (o->recur->duration != 0){
- ical_object_compute_end (o);
- } else
- o->recur->enddate = 0;
- } else {
- o->recur->enddate = o->recur->_enddate;
- }
- return 1;
-}
-
-#define is_a_prop_of(obj,prop) isAPropertyOf (obj,prop)
-#define str_val(obj) the_str = fakeCString (vObjectUStringZValue (obj))
-#define has(obj,prop) (vo = isAPropertyOf (obj, prop))
-
-/*
- * FIXME: This is loosing precission. Enhanec the thresholds
- */
-#define HOURS(n) (n*(60*60))
-
-static void
-setup_alarm_at (iCalObject *ico, CalendarAlarm *alarm, char *iso_time, VObject *vo)
-{
- time_t alarm_time = time_from_isodate (iso_time);
- time_t base = ico->dtstart;
- int d = difftime (base, alarm_time);
- VObject *a;
- char *the_str;
-
- alarm->enabled = 1;
- if (d > HOURS (2)){
- if (d > HOURS (48)){
- alarm->count = d / HOURS (24);
- alarm->units = ALARM_DAYS;
- } else {
- alarm->count = d / (60*60);
- alarm->units = ALARM_HOURS;
- }
- } else {
- alarm->count = d / 60;
- alarm->units = ALARM_MINUTES;
- }
-
- if ((a = is_a_prop_of (vo, VCSnoozeTimeProp))){
- alarm->snooze_secs = isodiff_to_secs (str_val (a));
- free (the_str);
- }
-
- if ((a = is_a_prop_of (vo, VCRepeatCountProp))){
- alarm->snooze_repeat = atoi (str_val (a));
- free (the_str);
- }
-}
-
-/*
- * Duplicates an iCalObject. Implementation is a grand hack
- */
-iCalObject *
-ical_object_duplicate (iCalObject *o)
-{
- VObject *vo;
- iCalObject *new;
-
- vo = ical_object_to_vobject (o);
- switch (o->type){
- case ICAL_EVENT:
- new = ical_object_create_from_vobject (vo, VCEventProp);
- break;
- case ICAL_TODO:
- new = ical_object_create_from_vobject (vo, VCTodoProp);
- break;
- default:
- new = NULL;
- }
-
- cleanVObject (vo);
- return new;
-}
-
-/* FIXME: we need to load the recurrence properties */
-iCalObject *
-ical_object_create_from_vobject (VObject *o, const char *object_name)
-{
- time_t now = time (NULL);
- iCalObject *ical;
- VObject *vo, *a;
- VObjectIterator i;
- char *the_str;
-
- ical = g_new0 (iCalObject, 1);
-
- if (strcmp (object_name, VCEventProp) == 0)
- ical->type = ICAL_EVENT;
- else if (strcmp (object_name, VCTodoProp) == 0)
- ical->type = ICAL_TODO;
- else {
- g_free (ical);
- return 0;
- }
-
- /* uid */
- if (has (o, VCUniqueStringProp)){
- ical->uid = g_strdup (str_val (vo));
- free (the_str);
- } else {
- ical->uid = ical_gen_uid ();
- }
-
- /* seq */
- if (has (o, VCSequenceProp)){
- ical->seq = atoi (str_val (vo));
- free (the_str);
- } else
- ical->seq = 0;
-
- /* dtstart */
- if (has (o, VCDTstartProp)){
- ical->dtstart = time_from_isodate (str_val (vo));
- free (the_str);
- } else
- ical->dtstart = 0;
-
- /* dtend */
- ical->dtend = 0; /* default value */
- if (ical->type == ICAL_EVENT){
- if (has (o, VCDTendProp)){
- ical->dtend = time_from_isodate (str_val (vo));
- free (the_str);
- }
- } else if (ical->type == ICAL_TODO){
- if (has (o, VCDueProp)){
- ical->dtend = time_from_isodate (str_val (vo));
- free (the_str);
- }
- }
-
- /* dcreated */
- if (has (o, VCDCreatedProp)){
- ical->created = time_from_isodate (str_val (vo));
- free (the_str);
- }
-
- /* completed */
- if (has (o, VCCompletedProp)){
- ical->completed = time_from_isodate (str_val (vo));
- free (the_str);
- }
-
- /* last_mod */
- if (has (o, VCLastModifiedProp)){
- ical->last_mod = time_from_isodate (str_val (vo));
- free (the_str);
- } else
- ical->last_mod = now;
-
- /* exdate */
- if (has (o, VCExpDateProp)){
- ical->exdate = set_date_list (str_val (vo));
- free (the_str);
- }
-
- /* description/comment */
- if (has (o, VCDescriptionProp)){
- ical->comment = g_strdup (str_val (vo));
- free (the_str);
- }
-
- /* summary */
- if (has (o, VCSummaryProp)){
- ical->summary = g_strdup (str_val (vo));
- free (the_str);
- } else
- ical->summary = g_strdup ("");
-
- /* status */
- if (has (o, VCStatusProp)){
- ical->status = g_strdup (str_val (vo));
- free (the_str);
- } else
- ical->status = g_strdup ("NEEDS ACTION");
-
- if (has (o, VCClassProp)){
- ical->class = g_strdup (str_val (vo));
- free (the_str);
- } else
- ical->class = "PUBLIC";
-
- /* categories */
- if (has (o, VCCategoriesProp)){
- ical->categories = set_list (str_val (vo));
- free (the_str);
- }
-
- /* resources */
- if (has (o, VCResourcesProp)){
- ical->resources = set_list (str_val (vo));
- free (the_str);
- }
-
- /* priority */
- if (has (o, VCPriorityProp)){
- ical->priority = atoi (str_val (vo));
- free (the_str);
- }
-
- /* tranparency */
- if (has (o, VCTranspProp)){
- ical->transp = atoi (str_val (vo)) ? ICAL_TRANSPARENT : ICAL_OPAQUE;
- free (the_str);
- }
-
- /* Organizer */
- if (has (o, VCOrgNameProp)){
- ical->organizer = g_strdup (str_val (vo));
- free (the_str);
- }
-
- /* related */
- if (has (o, VCRelatedToProp)){
- ical->related = set_list (str_val (vo));
- free (the_str);
- }
-
- /* attach */
- initPropIterator (&i, o);
- while (moreIteration (&i)){
- vo = nextVObject (&i);
- if (strcmp (vObjectName (vo), VCAttachProp) == 0){
- ical->attach = g_list_prepend (ical->attach, g_strdup (str_val (vo)));
- free (the_str);
- }
- }
-
- /* url */
- if (has (o, VCURLProp)){
- ical->url = g_strdup (str_val (vo));
- free (the_str);
- }
-
- /* dalarm */
- ical->dalarm.type = ALARM_DISPLAY;
- ical->dalarm.enabled = 0;
- if (has (o, VCDAlarmProp)){
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->dalarm, str_val (a), vo);
- free (the_str);
- }
- }
-
- /* aalarm */
- ical->aalarm.type = ALARM_AUDIO;
- ical->aalarm.enabled = 0;
- if (has (o, VCAAlarmProp)){
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->aalarm, str_val (a), vo);
- free (the_str);
- }
- }
-
- /* palarm */
- ical->palarm.type = ALARM_PROGRAM;
- ical->palarm.enabled = 0;
- if (has (o, VCPAlarmProp)){
- ical->palarm.type = ALARM_PROGRAM;
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->palarm, str_val (a), vo);
- free (the_str);
-
- if ((a = is_a_prop_of (vo, VCProcedureNameProp))){
- ical->palarm.data = g_strdup (str_val (a));
- free (the_str);
- } else
- ical->palarm.data = g_strdup ("");
- }
- }
-
- /* malarm */
- ical->malarm.type = ALARM_MAIL;
- ical->malarm.enabled = 0;
- if (has (o, VCMAlarmProp)){
- ical->malarm.type = ALARM_MAIL;
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->malarm, str_val (a), vo);
- free (the_str);
-
- if ((a = is_a_prop_of (vo, VCEmailAddressProp))){
- ical->malarm.data = g_strdup (str_val (a));
- free (the_str);
- } else
- ical->malarm.data = g_strdup ("");
- }
- }
-
- /* rrule */
- if (has (o, VCRRuleProp)){
- if (!load_recurrence (ical, str_val (vo))) {
- ical_object_destroy (ical);
- return NULL;
- }
- free (the_str);
- }
-
- /*
- * Pilot
- */
- if (has (o, XPilotIdProp)){
- ical->pilot_id = atoi (str_val (vo));
- free (the_str);
- } else
- ical->pilot_id = 0;
-
- if (has (o, XPilotStatusProp)){
- ical->pilot_status = atoi (str_val (vo));
- free (the_str);
- } else
- ical->pilot_status = ICAL_PILOT_SYNC_MOD;
-
- return ical;
-}
-
-static char *
-to_str (int num)
-{
- static char buf [40];
-
- sprintf (buf, "%d", num);
- return buf;
-}
-
-/*
- * stores a GList in the property.
- */
-static void
-store_list (VObject *o, char *prop, GList *values)
-{
- GList *l;
- int len;
- char *result, *p;
-
- for (len = 0, l = values; l; l = l->next)
- len += strlen (l->data) + 1;
-
- result = g_malloc (len);
-
- for (p = result, l = values; l; l = l->next) {
- int len = strlen (l->data);
-
- strcpy (p, l->data);
-
- if (l->next) {
- p [len] = ';';
- p += len+1;
- } else
- p += len;
- }
-
- *p = 0;
-
- addPropValue (o, prop, result);
- g_free (result);
-}
-
-static void
-store_date_list (VObject *o, char *prop, GList *values)
-{
- GList *l;
- int size, len;
- char *s, *p;
-
- size = g_list_length (values);
- s = p = g_malloc ((size * 17 + 1) * sizeof (char));
-
- for (l = values; l; l = l->next){
- strcpy (s, isodate_from_time_t (*(time_t *)l->data));
- len = strlen (s);
- s [len] = ',';
- s += len + 1;
- }
- s--;
- *s = 0;
- addPropValue (o, prop, p);
- g_free (p);
-}
-
-static char *recur_type_name [] = { "D", "W", "MP", "MD", "YM", "YD" };
-static char *recur_day_list [] = { "SU", "MO", "TU","WE", "TH", "FR", "SA" };
-static char *alarm_names [] = { VCMAlarmProp, VCPAlarmProp, VCDAlarmProp, VCAAlarmProp };
-
-static VObject *
-save_alarm (VObject *o, CalendarAlarm *alarm, iCalObject *ical)
-{
- VObject *alarm_object;
- struct tm tm;
- time_t alarm_time;
-
- if (!alarm->enabled)
- return NULL;
- tm = *localtime (&ical->dtstart);
- switch (alarm->units){
- case ALARM_MINUTES:
- tm.tm_min -= alarm->count;
- break;
-
- case ALARM_HOURS:
- tm.tm_hour -= alarm->count;
- break;
-
- case ALARM_DAYS:
- tm.tm_mday -= alarm->count;
- break;
- }
-
- alarm_time = mktime (&tm);
- alarm_object = addProp (o, alarm_names [alarm->type]);
- addPropValue (alarm_object, VCRunTimeProp, isodate_from_time_t (alarm_time));
-
- if (alarm->snooze_secs)
- addPropValue (alarm_object, VCSnoozeTimeProp, isodiff_from_secs (alarm->snooze_secs));
- else
- addPropValue (alarm_object, VCSnoozeTimeProp, "");
-
- if (alarm->snooze_repeat){
- char buf [20];
-
- sprintf (buf, "%d", alarm->snooze_repeat);
- addPropValue (alarm_object, VCRepeatCountProp, buf);
- } else
- addPropValue (alarm_object, VCRepeatCountProp, "");
- return alarm_object;
-}
-
-VObject *
-ical_object_to_vobject (iCalObject *ical)
-{
- VObject *o, *alarm, *s;
- GList *l;
-
- if (ical->type == ICAL_EVENT)
- o = newVObject (VCEventProp);
- else
- o = newVObject (VCTodoProp);
-
- /* uid */
- if (ical->uid)
- addPropValue (o, VCUniqueStringProp, ical->uid);
-
- /* seq */
- addPropValue (o, VCSequenceProp, to_str (ical->seq));
-
- /* dtstart */
- addPropValue (o, VCDTstartProp, isodate_from_time_t (ical->dtstart));
-
- /* dtend */
- if (ical->type == ICAL_EVENT){
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
- } else if (ical->type == ICAL_TODO){
- addPropValue (o, VCDueProp, isodate_from_time_t (ical->dtend));
- }
-
- /* dcreated */
- addPropValue (o, VCDCreatedProp, isodate_from_time_t (ical->created));
-
- /* completed */
- if (ical->completed)
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->completed));
-
- /* last_mod */
- addPropValue (o, VCLastModifiedProp, isodate_from_time_t (ical->last_mod));
-
- /* exdate */
- if (ical->exdate)
- store_date_list (o, VCExpDateProp, ical->exdate);
-
- /* description/comment */
- if (ical->comment && strlen (ical->comment)){
- s = addPropValue (o, VCDescriptionProp, ical->comment);
- if (strchr (ical->comment, '\n'))
- addProp (s, VCQuotedPrintableProp);
- }
-
- /* summary */
- if (strlen (ical->summary)){
- s = addPropValue (o, VCSummaryProp, ical->summary);
- if (strchr (ical->summary, '\n'))
- addProp (s, VCQuotedPrintableProp);
- } else {
- addPropValue (o, VCSummaryProp, _("Appointment"));
- }
-
- /* status */
- addPropValue (o, VCStatusProp, ical->status);
-
- /* class */
- addPropValue (o, VCClassProp, ical->class);
-
- /* categories */
- if (ical->categories)
- store_list (o, VCCategoriesProp, ical->categories);
-
- /* resources */
- if (ical->resources)
- store_list (o, VCCategoriesProp, ical->resources);
-
- /* priority */
- addPropValue (o, VCPriorityProp, to_str (ical->priority));
-
- /* transparency */
- addPropValue (o, VCTranspProp, to_str (ical->transp));
-
- /* Owenr/organizer */
- if (ical->organizer)
- addPropValue (o, VCOrgNameProp, ical->organizer);
-
- /* related */
- if (ical->related)
- store_list (o, VCRelatedToProp, ical->related);
-
- /* attach */
- for (l = ical->attach; l; l = l->next)
- addPropValue (o, VCAttachProp, l->data);
-
- /* url */
- if (ical->url)
- addPropValue (o, VCURLProp, ical->url);
-
- if (ical->recur){
- char result [256];
- char buffer [80];
- int i;
-
- sprintf (result, "%s%d ", recur_type_name [ical->recur->type], ical->recur->interval);
- switch (ical->recur->type){
- case RECUR_DAILY:
- break;
-
- case RECUR_WEEKLY:
- for (i = 0; i < 7; i++){
- if (ical->recur->weekday & (1 << i)){
- sprintf (buffer, "%s ", recur_day_list [i]);
- strcat (result, buffer);
- }
- }
- break;
-
- case RECUR_MONTHLY_BY_POS: {
- int nega = ical->recur->u.month_pos < 0;
-
- sprintf (buffer, "%d%s ", nega ? -ical->recur->u.month_pos : ical->recur->u.month_pos,
- nega ? "-" : "+");
- strcat (result, buffer);
- /* the gui is set up for a single day, not a set here in this case */
- sprintf (buffer, "%s ", recur_day_list [ical->recur->weekday]);
- strcat (result, buffer);
- }
- break;
-
- case RECUR_MONTHLY_BY_DAY:
- sprintf (buffer, "%d ", ical->recur->u.month_pos);
- strcat (result, buffer);
- break;
-
- case RECUR_YEARLY_BY_MONTH:
- break;
-
- case RECUR_YEARLY_BY_DAY:
- break;
- }
- if (ical->recur->_enddate == 0)
- sprintf (buffer, "#%d ",ical->recur->duration);
- else
- sprintf (buffer, "%s ", isodate_from_time_t (ical->recur->_enddate));
- strcat (result, buffer);
- addPropValue (o, VCRRuleProp, result);
- }
-
- save_alarm (o, &ical->aalarm, ical);
- save_alarm (o, &ical->dalarm, ical);
-
- if ((alarm = save_alarm (o, &ical->palarm, ical)))
- addPropValue (alarm, VCProcedureNameProp, ical->palarm.data);
- if ((alarm = save_alarm (o, &ical->malarm, ical)))
- addPropValue (alarm, VCEmailAddressProp, ical->malarm.data);
-
- /* Pilot */
- {
- char buffer [20];
-
- sprintf (buffer, "%d", ical->pilot_id);
- addPropValue (o, XPilotIdProp, buffer);
- sprintf (buffer, "%d", ical->pilot_status);
- addPropValue (o, XPilotStatusProp, buffer);
- }
-
- return o;
-}
-
-void
-ical_foreach (GList *events, calendarfn fn, void *closure)
-{
- for (; events; events = events->next){
- iCalObject *ical = events->data;
-
- (*fn) (ical, ical->dtstart, ical->dtend, closure);
- }
-}
-
-static int
-is_date_in_list (GList *list, struct tm *date)
-{
- struct tm tm;
-
- for (; list; list = list->next){
- time_t *timep = list->data;
-
- tm = *localtime (timep);
- if (date->tm_mday == tm.tm_mday &&
- date->tm_mon == tm.tm_mon &&
- date->tm_year == tm.tm_year){
- return 1;
- }
- }
- return 0;
-}
-
-static int
-generate (iCalObject *ico, time_t reference, calendarfn cb, void *closure)
-{
- struct tm dt_start, dt_end, ref;
- time_t s_t, e_t;
-
- dt_start = *localtime (&ico->dtstart);
- dt_end = *localtime (&ico->dtend);
- ref = *localtime (&reference);
-
- dt_start.tm_mday = ref.tm_mday;
- dt_start.tm_mon = ref.tm_mon;
- dt_start.tm_year = ref.tm_year;
-
- dt_end.tm_mday = ref.tm_mday;
- dt_end.tm_mon = ref.tm_mon;
- dt_end.tm_year = ref.tm_year;
-
-
- if (ref.tm_isdst > dt_start.tm_isdst){
- dt_start.tm_hour--;
- dt_end.tm_hour--;
- } else if (ref.tm_isdst < dt_start.tm_isdst){
- dt_start.tm_hour++;
- dt_end.tm_hour++;
- }
-
- s_t = mktime (&dt_start);
-
- if (ico->exdate && is_date_in_list (ico->exdate, &dt_start))
- return 1;
-
- e_t = mktime (&dt_end);
-
- if ((s_t == -1) || (e_t == -1)) {
- g_warning ("Produced invalid dates!\n");
- return 0;
- }
-
- return (*cb) (ico, s_t, e_t, closure);
-}
-
-int
-ical_object_get_first_weekday (int weekday_mask)
-{
- int i;
-
- for (i = 0; i < 7; i++)
- if (weekday_mask & (1 << i))
- return i;
-
- return -1;
-}
-
-#define time_in_range(t, a, b) ((t >= a) && (b ? (t < b) : 1))
-#define recur_in_range(t, r) (r->enddate ? (t < r->enddate) : 1)
-
-/*
- * Generate every possible event. Invokes the callback routine for
- * every occurrence of the event in the [START, END] time interval.
- *
- * If END is zero, the event is generated forever.
- * The callback routine is expected to return 0 when no further event
- * generation is requested.
- */
-void
-ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure)
-{
- time_t current;
- int first_week_day;
-
- /* If there is no recurrence, just check ranges */
-
- if (!ico->recur) {
- if ((end && (ico->dtstart < end) && (ico->dtend > start))
- || ((end == 0) && (ico->dtend > start))) {
- time_t ev_s, ev_e;
-
- /* Clip range */
-
- ev_s = MAX (ico->dtstart, start);
- ev_e = MIN (ico->dtend, end);
-
- (* cb) (ico, ev_s, ev_e, closure);
- }
- return;
- }
-
- /* The event has a recurrence rule -- check that we will generate at least one instance */
-
- if (end != 0) {
- if (ico->dtstart > end)
- return;
-
- if (!IS_INFINITE (ico->recur) && (ico->recur->enddate < start))
- return;
- }
-
- /* Generate the instances */
-
- current = ico->dtstart;
-
- switch (ico->recur->type) {
- case RECUR_DAILY:
- do {
- if (time_in_range (current, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, current, cb, closure))
- return;
-
- /* Advance */
-
- current = time_add_day (current, ico->recur->interval);
-
- if (current == -1) {
- g_warning ("RECUR_DAILY: time_add_day() returned invalid time");
- return;
- }
- } while ((current < end) || (end == 0));
-
- break;
-
- case RECUR_WEEKLY:
- do {
- struct tm tm;
-
- tm = *localtime (&current);
-
- if (time_in_range (current, start, end) && recur_in_range (current, ico->recur)) {
- /* Weekdays to recur on are specified as a bitmask */
- if (ico->recur->weekday & (1 << tm.tm_wday)) {
- if (!generate (ico, current, cb, closure))
- return;
- }
- }
-
- /* Advance by day for scanning the week or by interval at week end */
-
- if (tm.tm_wday == 6)
- current = time_add_day (current, (ico->recur->interval - 1) * 7 + 1);
- else
- current = time_add_day (current, 1);
-
- if (current == -1) {
- g_warning ("RECUR_WEEKLY: time_add_day() returned invalid time\n");
- return;
- }
- } while (current < end || (end == 0));
-
- break;
-
- case RECUR_MONTHLY_BY_POS:
- /* FIXME: We only deal with positives now */
- if (ico->recur->u.month_pos < 0) {
- g_warning ("RECUR_MONTHLY_BY_POS does not support negative positions yet");
- return;
- }
-
- if (ico->recur->u.month_pos == 0)
- return;
-
- first_week_day = /* ical_object_get_first_weekday (ico->recur->weekday); */
- ico->recur->weekday; /* the i/f only lets you choose a single day of the week! */
-
- /* This should not happen, but take it into account */
- if (first_week_day == -1) {
- g_warning ("ical_object_get_first_weekday() returned -1");
- return;
- }
-
- do {
- struct tm tm;
- time_t t;
- int week_day_start;
-
- tm = *localtime (&current);
- tm.tm_mday = 1;
- t = mktime (&tm);
- tm = *localtime (&t);
- week_day_start = tm.tm_wday;
-
- tm.tm_mday = (7 * (ico->recur->u.month_pos - ((week_day_start <= first_week_day ) ? 1 : 0))
- - (week_day_start - first_week_day) + 1);
- if( tm.tm_mday > 31 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
-
- switch( tm.tm_mon )
- {
- case 3:
- case 5:
- case 8:
- case 10:
- if( tm.tm_mday > 30 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
- break;
- case 1:
- if( ((tm.tm_year+1900)%4) == 0
- && ((tm.tm_year+1900)%400) != 100
- && ((tm.tm_year+1900)%400) != 200
- && ((tm.tm_year+1900)%400) != 300 )
- {
-
- if( tm.tm_mday > 29 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
- }
- else
- {
- if( tm.tm_mday > 28 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
- }
- break;
- }
-
- t = mktime (&tm);
-
- if (time_in_range (t, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, t, cb, closure))
- return;
-
- /* Advance by the appropriate number of months */
-
- current = mktime (&tm);
-
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
-
- if (current == -1) {
- g_warning ("RECUR_MONTHLY_BY_DAY: mktime error\n");
- return;
- }
- } while ((current < end) || (end == 0));
-
- break;
-
- case RECUR_MONTHLY_BY_DAY:
- do {
- struct tm tm;
- time_t t;
- int p;
-
- tm = *localtime (&current);
-
- p = tm.tm_mday;
- tm.tm_mday = ico->recur->u.month_day;
- t = mktime (&tm);
- if (time_in_range (t, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, t, cb, closure))
- return;
-
- /* Advance by the appropriate number of months */
-
- tm.tm_mday = p;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
-
- if (current == -1) {
- g_warning ("RECUR_MONTHLY_BY_DAY: mktime error\n");
- return;
- }
- } while (current < end || (end == 0));
-
- break;
-
- case RECUR_YEARLY_BY_MONTH:
- case RECUR_YEARLY_BY_DAY:
- do {
- if (time_in_range (current, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, current, cb, closure))
- return;
-
- /* Advance */
-
- current = time_add_year (current, ico->recur->interval);
- } while (current < end || (end == 0));
-
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-static int
-duration_callback (iCalObject *ico, time_t start, time_t end, void *closure)
-{
- int *count = closure;
- struct tm tm;
-
- tm = *localtime (&start);
-
- (*count)++;
- if (ico->recur->duration == *count) {
- ico->recur->enddate = time_day_end (end);
- return 0;
- }
- return 1;
-}
-
-/* Computes ico->recur->enddate from ico->recur->duration */
-void
-ical_object_compute_end (iCalObject *ico)
-{
- int count = 0;
-
- g_return_if_fail (ico->recur != NULL);
-
- ico->recur->_enddate = 0;
- ico->recur->enddate = 0;
- ical_object_generate_events (ico, ico->dtstart, 0, duration_callback, &count);
-}
-
-int
-alarm_compute_offset (CalendarAlarm *a)
-{
- if (!a->enabled)
- return -1;
- switch (a->units){
- case ALARM_MINUTES:
- a->offset = a->count * 60;
- break;
- case ALARM_HOURS:
- a->offset = a->count * 3600;
- break;
- case ALARM_DAYS:
- a->offset = a->count * 24 * 3600;
- }
- return a->offset;
-}
-
-iCalObject *
-ical_object_new_from_string (const char *vcal_string)
-{
- iCalObject *ical = NULL;
- VObject *cal, *event;
- VObjectIterator i;
- const char *object_name;
-
- cal = Parse_MIME (vcal_string, strlen (vcal_string));
-
- initPropIterator (&i, cal);
-
- while (moreIteration (&i)){
- event = nextVObject (&i);
-
- object_name = vObjectName (event);
-
- if (strcmp (object_name, VCEventProp) == 0){
- ical = ical_object_create_from_vobject (event, object_name);
- break;
- }
- }
-
- cleanVObject (cal);
- cleanStrTbl ();
-
- return ical;
-}
-
diff --git a/calendar/calobj.h b/calendar/calobj.h
deleted file mode 100644
index fbc92a41c5..0000000000
--- a/calendar/calobj.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Internal representation of a Calendar object. This is modeled after the
- * iCalendar/vCalendar specificiation
- *
- * Authors: Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (quartic@gimp.org).
- */
-#ifndef CALOBJ_H
-#define CALOBJ_H
-
-#include <libgnome/libgnome.h>
-#include "../libversit/vcc.h"
-
-BEGIN_GNOME_DECLS
-
-enum AlarmType {
- ALARM_MAIL,
- ALARM_PROGRAM,
- ALARM_DISPLAY,
- ALARM_AUDIO
-};
-
-enum AlarmUnit {
- ALARM_MINUTES,
- ALARM_HOURS,
- ALARM_DAYS
-};
-
-typedef struct {
- enum AlarmType type;
- int enabled;
- int count;
- enum AlarmUnit units;
- char *data;
-
- /* Does not get saved, internally used */
- time_t offset;
- time_t trigger;
-
- int snooze_secs;
- int snooze_repeat;
-
- /* Widgets */
- void *w_count; /* A GtkEntry */
- void *w_enabled; /* A GtkChecButton */
- void *w_timesel; /* A GtkMenu */
- void *w_entry; /* A GnomeEntryFile/GtkEntry for PROGRAM/MAIL */
- void *w_label;
-} CalendarAlarm;
-
-/* Calendar object type */
-typedef enum {
- ICAL_EVENT,
- ICAL_TODO,
- ICAL_JOURNAL,
- ICAL_FBREQUEST,
- ICAL_FBREPLY,
- ICAL_BUSYTIME,
- ICAL_TIMEZONE
-} iCalType;
-
-/* For keys that might contain binary or text/binary */
-typedef struct {
- char *data;
- int len;
-} iCalValue;
-
-typedef enum {
- ICAL_PILOT_SYNC_NONE = 0,
- ICAL_PILOT_SYNC_MOD = 1,
- ICAL_PILOT_SYNC_DEL = 3
-} iCalPilotState;
-
-typedef struct {
- int valid; /* true if the Geography was specified */
- double latitude;
- double longitude;
-} iCalGeo;
-
-typedef enum {
- ICAL_OPAQUE,
- ICAL_TRANSPARENT
-} iCalTransp;
-
-typedef char NotYet;
-
-enum RecurType {
- RECUR_DAILY,
- RECUR_WEEKLY,
- RECUR_MONTHLY_BY_POS,
- RECUR_MONTHLY_BY_DAY,
- RECUR_YEARLY_BY_MONTH,
- RECUR_YEARLY_BY_DAY,
-};
-
-#define DAY_LASTDAY 10000
-
-typedef struct {
- enum RecurType type;
-
- int interval;
-
- /* Used for recur computation */
- time_t enddate; /* If the value is zero, it is an infinite event
- * otherwise, it is either the _enddate value (if
- * this is what got specified) or it is our computed
- * ending date (computed from the duration item).
- */
-
- int weekday;
-
- union {
- int month_pos;
- int month_day;
- } u;
-
- int duration;
- time_t _enddate; /* As found on the vCalendar file */
- int __count;
-} Recurrence;
-
-#define IS_INFINITE(r) (r->duration == 0)
-
-/* Flags to indicate what has changed in an object */
-typedef enum {
- CHANGE_NEW = 1 << 0, /* new object */
- CHANGE_SUMMARY = 1 << 1, /* summary */
- CHANGE_DATES = 1 << 2, /* dtstart / dtend */
- CHANGE_ALL = CHANGE_SUMMARY | CHANGE_DATES
-} CalObjectChange;
-
-/*
- * This describes an iCalendar object, note that we never store durations, instead we
- * always compute the end time computed from the start + duration.
- */
-typedef struct {
- iCalType type;
-
- GList *attach; /* type: one or more URIs or binary data */
- GList *attendee; /* type: CAL-ADDRESS */
- GList *categories; /* type: one or more TEXT */
- char *class;
-
- char *comment; /* we collapse one or more TEXTs into one */
- time_t completed;
- time_t created;
- GList *contact; /* type: one or more TEXT */
- time_t dtstamp;
- time_t dtstart;
- time_t dtend;
- GList *exdate; /* type: one or more time_t's */
- GList *exrule; /* type: one or more RECUR */
- iCalGeo geo;
- time_t last_mod;
- char *location;
- char *organizer;
- int percent;
- int priority;
- char *rstatus; /* request status for freebusy */
- GList *related; /* type: one or more TEXT */
- GList *resources; /* type: one or more TEXT */
- GList *rdate; /* type: one or more recurrence date */
- GList *rrule; /* type: one or more recurrence rules */
- int seq;
- char *status;
- char *summary;
- iCalTransp transp;
- char *uid;
- char *url;
- time_t recurid;
-
- CalendarAlarm dalarm;
- CalendarAlarm aalarm;
- CalendarAlarm palarm;
- CalendarAlarm malarm;
-
- Recurrence *recur;
-
- int new;
- void *user_data; /* Generic data pointer */
-
- /* Pilot */
- iCalPilotState pilot_status; /* Status information */
- guint32 pilot_id; /* Pilot ID */
-} iCalObject;
-
-/* The callback for the recurrence generator */
-typedef int (*calendarfn) (iCalObject *, time_t, time_t, void *);
-
-iCalObject *ical_new (char *comment, char *organizer, char *summary);
-iCalObject *ical_object_new (void);
-iCalObject *ical_object_new_from_string (const char *vcalendar_string);
-void ical_object_destroy (iCalObject *ico);
-iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);
-VObject *ical_object_to_vobject (iCalObject *ical);
-iCalObject *ical_object_duplicate (iCalObject *o);
-void ical_foreach (GList *events, calendarfn fn, void *closure);
-void ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure);
-void ical_object_add_exdate (iCalObject *o, time_t t);
-
-/* Computes the enddate field of the recurrence based on the duration */
-void ical_object_compute_end (iCalObject *ico);
-
-/* Returns the first toggled day in a weekday mask -- we do this because we do not support multiple
- * days on a monthly-by-pos recurrence. If no days are toggled, it returns -1.
- */
-int ical_object_get_first_weekday (int weekday_mask);
-
-/* Returns the number of seconds configured to trigger the alarm in advance to an event */
-int alarm_compute_offset (CalendarAlarm *a);
-
-END_GNOME_DECLS
-
-#endif
-
diff --git a/calendar/conduits/calendar/calendar-conduit-control-applet.c b/calendar/conduits/calendar/calendar-conduit-control-applet.c
deleted file mode 100644
index ae4bda428f..0000000000
--- a/calendar/conduits/calendar/calendar-conduit-control-applet.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/* Control applet ("capplet") for the gnome-pilot calendar conduit, */
-/* based on */
-/* gpilotd control applet ('capplet') for use with the GNOME control center */
-/* $Id$ */
-
-#include <pwd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <gnome.h>
-#include <ctype.h>
-
-#include <config.h>
-#include <capplet-widget.h>
-
-#include <gpilotd/gpilotd-conduit-mgmt.h>
-#include <gpilotd/gpilotd-app.h>
-#include <gpilotd/gpilotd-app-dummy-callbacks.h>
-
-#include "calendar-conduit.h"
-
-/* tell changes callbacks to ignore changes or not */
-static gboolean ignore_changes=FALSE;
-
-/* capplet widget */
-static GtkWidget *capplet=NULL;
-
-/* host/device/pilot configuration windows */
-GtkWidget *cfgOptionsWindow=NULL;
-GtkWidget *cfgStateWindow=NULL;
-GtkWidget *dialogWindow=NULL;
-
-GnomePilotConduitMgmt *conduit;
-
-static void doTrySettings(GtkWidget *widget, gpointer);
-static void doRevertSettings(GtkWidget *widget, gpointer);
-static void doSaveSettings(GtkWidget *widget, gpointer);
-
-static void readStateCfg(GtkWidget *w,GCalConduitCfg *cfg);
-static void setStateCfg(GtkWidget *w,GCalConduitCfg *cfg);
-void about_cb (GtkWidget *, gpointer);
-GCalConduitCfg *origState = NULL;
-GCalConduitCfg *curState = NULL;
-
-gint pilotId;
-CORBA_Environment ev;
-
-/* This array must be in the same order as enumerations
- in GnomePilotConduitSyncType as they are used as index.
- Custom type implies Disabled state.
-*/
-static gchar* sync_options[] ={ N_("Disabled"),
- N_("Synchronize"),
- N_("Copy From Pilot"),
- N_("Copy To Pilot"),
- N_("Merge From Pilot"),
- N_("Merge To Pilot")};
-#define SYNC_OPTIONS_COUNT 6
-
-static void
-setSettings(GCalConduitCfg* conduitCfg)
-{
- if(conduitCfg->sync_type!=GnomePilotConduitSyncTypeCustom)
- gpilotd_conduit_mgmt_enable_with_first_sync(conduit,pilotId,
- conduitCfg->sync_type,
- conduitCfg->sync_type,
- TRUE);
- else
- gpilotd_conduit_mgmt_disable(conduit,pilotId);
-
- gcalconduit_save_configuration(conduitCfg);
-}
-
-static void
-doTrySettings(GtkWidget *widget, gpointer whatever)
-{
- readStateCfg(cfgStateWindow,curState);
- setSettings(curState);
-}
-
-static void
-doSaveSettings(GtkWidget *widget, gpointer whatever)
-{
- doTrySettings(widget,whatever);
-}
-
-static void
-doCancelSettings(GtkWidget *widget, gpointer whatever)
-{
- setSettings(origState);
-}
-
-static void
-doRevertSettings(GtkWidget *widget, gpointer whatever)
-{
- gcalconduit_destroy_configuration(&curState);
- curState = gcalconduit_dupe_configuration(origState);
- setStateCfg(cfgStateWindow,curState);
- setSettings(curState);
-}
-
-static void
-insert_dir_callback (GtkEditable *editable, const gchar *text,
- gint len, gint *position, void *data)
-{
- gint i;
- gchar *curname;
-
- curname = gtk_entry_get_text(GTK_ENTRY(editable));
- if (*curname == '\0' && len > 0) {
- if (isspace(text[0])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert_text");
- return;
- }
- } else {
- for (i=0; i<len; i++) {
- if (isspace(text[i])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable),
- "insert_text");
- return;
- }
- }
- }
-}
-static void
-insert_dir_callback2(GtkEditable *editable, const gchar *text,
- gint length, gint *position,
- void *data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static void
-clist_changed(GtkWidget *widget, gpointer data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-void about_cb (GtkWidget *widget, gpointer data) {
- GtkWidget *about;
- const gchar *authors[] = {_("Eskil Heyn Olsen <deity@eskil.dk>"),NULL};
-
- about = gnome_about_new(_("GnomeCalendar Conduit"), VERSION,
- _("(C) 1998"),
- authors,
- _("Configuration utility for the calendar conduit.\n"),
- _("gnome-calendar-conduit.png"));
- gtk_widget_show (about);
-
- return;
-}
-
-static void toggled_cb(GtkWidget *widget, gpointer data) {
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-/* called by the sync_type GtkOptionMenu */
-static void
-sync_action_selection(GtkMenuShell *widget, gpointer unused)
-{
- if (!ignore_changes) {
- capplet_widget_state_changed(CAPPLET_WIDGET (capplet), TRUE);
- }
-}
-
-/* called by the sync_type GtkOptionMenu */
-static void
-activate_sync_type(GtkMenuItem *widget, gpointer data)
-{
- curState->sync_type = GPOINTER_TO_INT(data);
- if(!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static GtkWidget
-*createStateCfgWindow(void)
-{
- GtkWidget *vbox, *table;
- GtkWidget *label;
- GtkWidget *optionMenu,*menuItem;
- GtkMenu *menu;
- gint i;
-
- vbox = gtk_vbox_new(FALSE, GNOME_PAD);
-
- table = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD);
-
- label = gtk_label_new(_("Synchronize Action"));
- gtk_box_pack_start(GTK_BOX(table), label, FALSE, FALSE, GNOME_PAD);
-
- optionMenu=gtk_option_menu_new();
- gtk_object_set_data(GTK_OBJECT(vbox), "conduit_state", optionMenu);
- menu = GTK_MENU(gtk_menu_new());
-
- for (i=0; i<SYNC_OPTIONS_COUNT;i++) {
- sync_options[i]=_(sync_options[i]);
- menuItem = gtk_menu_item_new_with_label(sync_options[i]);
- gtk_widget_show(menuItem);
- gtk_signal_connect(GTK_OBJECT(menuItem),"activate",
- GTK_SIGNAL_FUNC(activate_sync_type),
- GINT_TO_POINTER(i));
- gtk_menu_append(menu,menuItem);
- }
-
- gtk_option_menu_set_menu(GTK_OPTION_MENU(optionMenu),GTK_WIDGET(menu));
- gtk_signal_connect(GTK_OBJECT(menu), "selection-done",
- GTK_SIGNAL_FUNC(sync_action_selection),
- NULL);
-
- gtk_box_pack_start(GTK_BOX(table), optionMenu, FALSE, FALSE, 0);
-
- return vbox;
-}
-
-static void
-setStateCfg(GtkWidget *widget,GCalConduitCfg *cfg)
-{
- GtkOptionMenu *optionMenu;
- GtkMenu *menu;
-
- optionMenu = gtk_object_get_data(GTK_OBJECT(widget), "conduit_state");
- g_assert(optionMenu!=NULL);
- menu = GTK_MENU(gtk_option_menu_get_menu(optionMenu));
-
-
- ignore_changes = TRUE;
- /* Here were are relying on the items in menu being the same
- order as in GnomePilotConduitSyncType. */
- gtk_option_menu_set_history(optionMenu,(int)cfg->sync_type);
- ignore_changes = FALSE;
-}
-
-
-static void
-readStateCfg(GtkWidget *w,GCalConduitCfg *cfg)
-{
-/*
- GtkWidget *button;
-
- button = gtk_object_get_data(GTK_OBJECT(w), "conduit_on_off");
-
- g_assert(button!=NULL);
-
- activated = GTK_TOGGLE_BUTTON(button)->active;
-*/
-}
-
-static void
-pilot_capplet_setup(void)
-{
- GtkWidget *frame, *table;
-
- capplet = capplet_widget_new();
-
- table = gtk_table_new(1, 2, FALSE);
- gtk_container_border_width(GTK_CONTAINER(table), GNOME_PAD);
- gtk_container_add(GTK_CONTAINER(capplet), table);
-
- frame = gtk_frame_new(_("Conduit state"));
- gtk_container_border_width(GTK_CONTAINER(frame), GNOME_PAD_SMALL);
- gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1);
- cfgStateWindow = createStateCfgWindow();
- gtk_container_add(GTK_CONTAINER(frame), cfgStateWindow);
-
- gtk_signal_connect(GTK_OBJECT(capplet), "try",
- GTK_SIGNAL_FUNC(doTrySettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "revert",
- GTK_SIGNAL_FUNC(doRevertSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "ok",
- GTK_SIGNAL_FUNC(doSaveSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "cancel",
- GTK_SIGNAL_FUNC(doCancelSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "help",
- GTK_SIGNAL_FUNC(about_cb), NULL);
-
-
- setStateCfg(cfgStateWindow,curState);
-
- gtk_widget_show_all(capplet);
-}
-
-static void
-run_error_dialog(gchar *mesg,...) {
- char tmp[80];
- va_list ap;
-
- va_start(ap,mesg);
- vsnprintf(tmp,79,mesg,ap);
- dialogWindow = gnome_message_box_new(mesg,GNOME_MESSAGE_BOX_ERROR,GNOME_STOCK_BUTTON_OK,NULL);
- gnome_dialog_run_and_close(GNOME_DIALOG(dialogWindow));
- va_end(ap);
-}
-
-gint get_pilot_id_from_gpilotd() {
- gint *pilots;
- int i;
-
- i=0;
- gpilotd_get_pilot_ids(&pilots);
- if(pilots) {
- while(pilots[i]!=-1) { g_message("pilot %d = \"%d\"",i,pilots[i]); i++; }
- if(i==0) {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- } else {
- if(i==1)
- return pilots[0];
- else {
- g_message("too many pilots...");
- return pilots[0];
- }
- }
- } else {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- }
-}
-
-int
-main( int argc, char *argv[] )
-{
- /* we're a capplet */
- gnome_capplet_init ("calendar conduit control applet", NULL, argc, argv,
- NULL,
- 0, NULL);
-
- /* put all code to set things up in here */
- conduit = gpilotd_conduit_mgmt_new("calendar_conduit");
-
- /* get pilot name from gpilotd */
- /* 1. initialize the gpilotd connection */
- if (gpilotd_init(&argc,argv)!=0) {
- run_error_dialog(_("Cannot initialze the GnomePilot Daemon"));
- g_error(_("Cannot initialze the GnomePilot Daemon"));
- return -1;
- }
-
- /* 2 connect to gpilotd */
- if (gpilotd_connect()!=0) {
- run_error_dialog(_("Cannot connect to the GnomePilot Daemon"));
- g_error(_("Cannot connect to the GnomePilot Daemon"));
- return -1;
- }
-
- pilotId = get_pilot_id_from_gpilotd();
- if(!pilotId) return -1;
-
- /* put all code to set things up in here */
- gcalconduit_load_configuration(&origState,pilotId);
- gpilotd_conduit_mgmt_get_sync_type(conduit,pilotId,&origState->sync_type);
-
- curState = gcalconduit_dupe_configuration(origState);
-
- pilot_capplet_setup();
-
-
- /* done setting up, now run main loop */
- capplet_gtk_main();
- return 0;
-}
diff --git a/calendar/conduits/calendar/calendar-conduit-control-applet.desktop b/calendar/conduits/calendar/calendar-conduit-control-applet.desktop
deleted file mode 100644
index 43c429ef97..0000000000
--- a/calendar/conduits/calendar/calendar-conduit-control-applet.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Name=GnomeCalendar
-Comment=Configure the GnomeCal conduit
-Exec=calendar-conduit-control-applet --cap-id=1
-Terminal=0
-Type=Application
-Icon=gnome-calendar-conduit.png
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
deleted file mode 100644
index d7ec8083ae..0000000000
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ /dev/null
@@ -1,1433 +0,0 @@
-/* $Id$ */
-
-#include <glib.h>
-#include <gnome.h>
-
-#include <pi-source.h>
-#include <pi-socket.h>
-#include <pi-file.h>
-#include <pi-dlp.h>
-#include <pi-version.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <utime.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <libgnorba/gnorba.h>
-#include <libgnorba/gnome-factory.h>
-
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-standard-abs.h>
-
-#include "GnomeCal.h"
-#include "calobj.h"
-#include "calendar.h"
-#include "timeutil.h"
-
-#include "calendar-conduit.h"
-
-int debug_alarms = 0; /* needed to satisfy some other part of gncal */
-/* Default values for alarms */ /* needed to satisfy some other part of gncal */
-CalendarAlarm alarm_defaults[4] = {
- { ALARM_MAIL, 0, 15, ALARM_MINUTES },
- { ALARM_PROGRAM, 0, 15, ALARM_MINUTES },
- { ALARM_DISPLAY, 0, 15, ALARM_MINUTES },
- { ALARM_AUDIO, 0, 15, ALARM_MINUTES }
-};
-
-GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
-void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
-void local_record_from_icalobject(GCalLocalRecord *local,iCalObject *obj);
-
-#define CONDUIT_VERSION "0.8.9"
-#ifdef G_LOG_DOMAIN
-#undef G_LOG_DOMAIN
-#endif
-#define G_LOG_DOMAIN "gcalconduit"
-
-#define DEBUG_CALCONDUIT
-#undef DEBUG_CALCONDUIT
-
-#ifdef DEBUG_CALCONDUIT
-#define show_exception(e) g_warning ("Exception: %s\n", CORBA_exception_id (e))
-#define LOG(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE, e)
-#else
-#define show_exception(e)
-#define LOG(e...)
-#endif
-
-#define WARN(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_WARNING, e)
-#define INFO(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE, e)
-
-static int
-start_calendar_server (GnomePilotConduitStandardAbs *conduit,
- GCalConduitContext *ctxt)
-{
-
- g_return_val_if_fail(conduit!=NULL,-2);
- g_return_val_if_fail(ctxt!=NULL,-2);
-
- ctxt->calendar = goad_server_activate_with_id (NULL,
- "IDL:GNOME:Calendar:Repository:1.0",
- 0, NULL);
- if (ctxt->calendar == CORBA_OBJECT_NIL) {
- g_error ("Can not communicate with GnomeCalendar server");
- return -1;
- }
-
- if (ctxt->ev._major != CORBA_NO_EXCEPTION){
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- }
- return 0;
-}
-
-
-/* Just a stub to link with */
-void
-calendar_notify (time_t time, CalendarAlarm *which, void *data)
-{
-}
-
-static GSList *
-get_calendar_objects(GnomePilotConduitStandardAbs *conduit,
- gboolean *status,
- GCalConduitContext *ctxt)
-{
- GSList *result;
- GNOME_Calendar_Repository_String_Sequence *uids;
-
- g_return_val_if_fail(conduit!=NULL,NULL);
- g_return_val_if_fail(ctxt!=NULL,NULL);
-
- result = NULL;
- uids = GNOME_Calendar_Repository_get_object_id_list (ctxt->calendar, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- if(status!=NULL) (*status) = FALSE;
- return NULL;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- if(status!=NULL) (*status) = FALSE;
- return NULL;
- }
-
- if(status!=NULL) (*status) = TRUE;
- if(uids->_length>0) {
- int i;
- for(i=0;i<uids->_length;i++) {
- result = g_slist_prepend(result,g_strdup(uids->_buffer[i]));
- }
- } else {
- INFO ("No entries found");
- }
-
- CORBA_free(uids);
-
- return result;
-}
-
-#if 0
-static GList *
-get_calendar_objects(GnomePilotConduitStandardAbs *conduit)
-{
- char *vcalendar_string;
- char *error;
- GList *retval,*l;
- Calendar *cal;
-
- g_return_val_if_fail(conduit!=NULL,NULL);
-
- vcalendar_string =
- GNOME_Calendar_Repository_get_objects (calendar, &ev);
-
- cal = calendar_new("Temporary");
-
- error = calendar_load_from_memory(cal,vcalendar_string);
-
- if (ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&ev);
- CORBA_exception_free(&ev);
- return;
- } else if(ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&ev);
- CORBA_exception_free(&ev);
- return;
- }
-
- if(error != NULL) {
- WARN ("Error while converting records");
- WARN ("Error : %s",error);
- return NULL;
- }
- retval = NULL;
- for(l=cal->events ; l ; l=l->next) {
- LOG ("duping %d [%s]",
- ((iCalObject*)l->data)->pilot_id,
- ((iCalObject*)l->data)->summary);
- retval = g_list_prepend(retval,ical_object_duplicate(l->data));
- }
-
- /* g_free(vcalendar_string); FIXME: this coredumps, but won't it leak without ? */
- calendar_destroy(cal);
-
- return retval;
-}
-#endif
-
-static void
-local_record_from_ical_uid(GCalLocalRecord *local,
- char *uid,
- GCalConduitContext *ctxt)
-{
- iCalObject *obj;
- char *vcalendar_string;
-
- g_assert(local!=NULL);
-
- vcalendar_string = GNOME_Calendar_Repository_get_object(ctxt->calendar, uid, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- }
- g_return_if_fail(vcalendar_string!=NULL);
-
- obj = ical_object_new_from_string (vcalendar_string);
-
- local_record_from_icalobject(local,obj);
-
- return;
-}
-
-
-/*
- * converts a iCalObject to a GCalLocalRecord
- */
-
-void
-local_record_from_icalobject(GCalLocalRecord *local,
- iCalObject *obj)
-{
- g_return_if_fail(local!=NULL);
- g_return_if_fail(obj!=NULL);
-
- local->ical = obj;
- local->local.ID = local->ical->pilot_id;
-
-/*
- LOG ("local->Id = %ld [%s], status = %d",
- local->local.ID,obj->summary,local->ical->pilot_status);
-*/
- switch(local->ical->pilot_status) {
- case ICAL_PILOT_SYNC_NONE:
- local->local.attr = GnomePilotRecordNothing;
- break;
- case ICAL_PILOT_SYNC_MOD:
- local->local.attr = GnomePilotRecordModified;
- break;
- case ICAL_PILOT_SYNC_DEL:
- local->local.attr = GnomePilotRecordDeleted;
- break;
- }
-
- /* Records without a pilot_id are new */
- if(local->local.ID == 0)
- local->local.attr = GnomePilotRecordNew;
-
- local->local.secret = 0;
- if(obj->class!=NULL)
- if(strcmp(obj->class,"PRIVATE")==0)
- local->local.secret = 1;
-
- local->local.archived = 0;
-}
-
-/*
- * Given a PilotRecord, find the matching record in
- * the calendar repository. If no match, return NULL
- */
-static GCalLocalRecord *
-find_record_in_repository(GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- char *vcal_string;
- GCalLocalRecord *loc;
-
- g_return_val_if_fail(conduit!=NULL,NULL);
- g_return_val_if_fail(remote!=NULL,NULL);
-
- LOG ("requesting %ld", remote->ID);
-
- vcal_string =
- GNOME_Calendar_Repository_get_object_by_pilot_id (ctxt->calendar, remote->ID, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return NULL;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return NULL;
- } else {
- LOG ("Found");
- loc = g_new0(GCalLocalRecord,1);
- /* memory allocated in new_from_string is freed in free_match */
- local_record_from_icalobject(loc,
- ical_object_new_from_string (vcal_string));
- /* g_free(vcal_string); FIXME: this coredumps, but won't it leak without ? */
- return loc;
- }
-
- return NULL;
-}
-
-/*
- * updates an given iCalObject in the repository
- */
-static void
-update_calendar_entry_in_repository(GnomePilotConduitStandardAbs *conduit,
- iCalObject *obj,
- GCalConduitContext *ctxt)
-{
- char *str;
-
- g_return_if_fail(conduit!=NULL);
- g_return_if_fail(obj!=NULL);
-
- str = calendar_string_from_object (obj);
-
- GNOME_Calendar_Repository_update_object (ctxt->calendar, obj->uid, str, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- }
-
- free (str);
-}
-
-static iCalObject *
-ical_from_remote_record(GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- iCalObject *in_obj)
-{
- iCalObject *obj;
- int i;
- struct Appointment a;
- time_t now;
-
- now = time (NULL);
-
- g_return_val_if_fail(remote!=NULL,NULL);
- memset(&a,0,sizeof(struct Appointment));
- unpack_Appointment(&a,remote->record,remote->length);
-
- if (in_obj == NULL)
- obj = ical_new (a.note ? a.note : "",
- g_get_user_name (),
- a.description ? a.description : "");
- else
- obj = in_obj;
-
- if (a.note) {
- g_free(obj->comment);
- obj->comment = g_strdup(a.note);
- }
- if (a.description) {
- g_free(obj->summary);
- obj->summary = g_strdup(a.description);
- }
-
- obj->created = now;
- obj->last_mod = now;
- obj->priority = 0;
- obj->transp = 0;
- obj->related = NULL;
- obj->pilot_id = remote->ID;
- obj->pilot_status = ICAL_PILOT_SYNC_NONE;
-
- /*
- * Begin and end
- */
-
- if (a.event)
- {
- /* turn day-long events into a full day's appointment
- FIXME: get settings from gnomecal */
- a.begin.tm_sec = 0;
- a.begin.tm_min = 0;
- a.begin.tm_hour = 0;
-
- a.end.tm_sec = 0;
- a.end.tm_min =59;
- a.end.tm_hour = 23;
- }
-
- obj->dtstart = mktime (&a.begin);
- obj->dtend = mktime (&a.end);
-
- /* Special case: daily repetitions are converted to a multi-day event */
- /* This sucketh, a pilot event scheduled for dailyRepeat, freq 1, end on
- whatever is cleary converted wrong
- if (a.repeatType == repeatDaily){
- time_t newt = time_add_day (obj->dtend, a.repeatFrequency);
-
- obj->dtend = newt;
- }
- */
-
- /*
- * Alarm
- */
- if (a.alarm){
- obj->aalarm.type = ALARM_AUDIO;
- obj->aalarm.enabled = 1;
- obj->aalarm.count = a.advance;
-
- switch (a.advanceUnits){
- case advMinutes:
- obj->aalarm.units = ALARM_MINUTES;
- break;
-
- case advHours:
- obj->aalarm.units = ALARM_HOURS;
- break;
-
- case advDays:
- obj->aalarm.units = ALARM_DAYS;
- break;
- default:
- }
- }
-
- /*
- * Recurrence
- */
- if (a.repeatFrequency){
- obj->recur = g_new0 (Recurrence, 1);
-
- switch (a.repeatType){
- case repeatDaily:
- /*
- * In the Pilot daily repetitions are actually
- * multi-day events
- */
- obj->recur->type = RECUR_DAILY;
- break;
-
- case repeatMonthlyByDate:
- obj->recur->type = RECUR_MONTHLY_BY_DAY;
- obj->recur->u.month_day = a.repeatFrequency;
- break;
-
- case repeatWeekly:
- {
- int wd;
-
- obj->recur->type = RECUR_WEEKLY;
- for (wd = 0; wd < 7; wd++)
- if (a.repeatDays [wd])
- obj->recur->weekday |= 1 << wd;
-
- if (obj->recur->weekday == 0){
- struct tm tm = *localtime (&obj->dtstart);
-
- obj->recur->weekday = 1 << tm.tm_wday;
- }
- break;
- }
-
- case repeatMonthlyByDay:
- obj->recur->type = RECUR_MONTHLY_BY_POS;
- obj->recur->u.month_pos = a.repeatFrequency;
- obj->recur->weekday = (a.repeatDay / 7);
- break;
-
- case repeatYearly:
- obj->recur->type = RECUR_YEARLY_BY_DAY;
- break;
-
- default:
- g_assert_not_reached();
- }
-
- if (a.repeatForever)
- obj->recur->duration = 0;
- else
- obj->recur->_enddate = mktime (&a.repeatEnd);
-
- obj->recur->interval = a.repeatFrequency;
- }
-
- /*
- * Load exception dates
- */
- obj->exdate = NULL;
- for (i = 0; i < a.exceptions; i++){
- time_t *t = g_new (time_t, 1);
-
- *t = mktime (&(a.exception [i]));
- obj->exdate = g_list_prepend (obj->exdate, t);
- }
-
- g_free (obj->class);
-
- if (remote->attr & dlpRecAttrSecret)
- obj->class = g_strdup ("PRIVATE");
- else
- obj->class = g_strdup ("PUBLIC");
-
-
- free_Appointment(&a);
-
- return obj;
-}
-
-/* Code blatantly stolen from
- * calendar-pilot-sync.c:
- *
- * (C) 1999 International GNOME Support
- *
- * Author:
- * Miguel de Icaza (miguel@gnome-support.com)
- *
- */
-static gint
-update_record (GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- char *vcal_string;
- iCalObject *obj;
- struct Appointment a;
-
- g_return_val_if_fail(remote!=NULL,-1);
-
- memset(&a,0,sizeof(struct Appointment));
- unpack_Appointment(&a,remote->record,remote->length);
-
- obj = ical_new (a.note ? a.note : "",
- g_get_user_name (),
- a.description ? a.description : "");
-
- LOG ("requesting %ld [%s]", remote->ID, a.description);
- vcal_string = GNOME_Calendar_Repository_get_object_by_pilot_id (ctxt->calendar, remote->ID, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- LOG ("Object did not exist, creating a new one");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- ical_from_remote_record(conduit,remote,obj);
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- ical_object_destroy (obj);
- free_Appointment(&a);
- return -1;
- } else {
- LOG ("Found");
- ical_object_destroy (obj);
- obj = ical_object_new_from_string (vcal_string);
- ical_from_remote_record(conduit,remote,obj);
- CORBA_free(vcal_string);
- }
-
- /* update record on server */
-
- update_calendar_entry_in_repository(conduit,obj,ctxt);
-
- /*
- * Shutdown
- */
- ical_object_destroy (obj);
- free_Appointment(&a);
-
- return 0;
-}
-
-static void
-check_for_slow_setting(GnomePilotConduit *c,
- GCalConduitContext *ctxt)
-{
- CORBA_long entry_number;
- entry_number =
- GNOME_Calendar_Repository_get_number_of_objects(ctxt->calendar,
- &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- } else {
- LOG (_("Calendar holds %d entries"),entry_number);
- /* If the local base is empty, do a slow sync */
- if ( entry_number <= 0) {
- gnome_pilot_conduit_standard_set_slow(c);
- }
- }
-}
-
-static gint
-pre_sync(GnomePilotConduit *c,
- GnomePilotDBInfo *dbi,
- GCalConduitContext *ctxt)
-{
- int l;
- unsigned char *buf;
-
- g_message ("GnomeCal Conduit v.%s",CONDUIT_VERSION);
-
- ctxt->calendar = CORBA_OBJECT_NIL;
-
- if (start_calendar_server(GNOME_PILOT_CONDUIT_STANDARD_ABS(c),ctxt) != 0) {
- WARN(_("Could not start gnomecal server"));
- return -1;
- }
-
- gtk_object_set_data(GTK_OBJECT(c),"dbinfo",dbi);
-
- /* load_records(c); */
-
- buf = (unsigned char*)g_malloc(0xffff);
- if((l=dlp_ReadAppBlock(dbi->pilot_socket,dbi->db_handle,0,(unsigned char *)buf,0xffff))<0) {
- WARN(_("Could not read pilot's DateBook application block"));
- return -1;
- }
- unpack_AppointmentAppInfo(&(ctxt->ai),buf,l);
- g_free(buf);
-
- check_for_slow_setting(c,ctxt);
-
- return 0;
-}
-
-/**
- * Find (if possible) the local record which matches
- * the given PilotRecord.
- * if successfull, return non-zero and set *local to
- * a non-null value (the located local record),
- * otherwise return 0 and set *local = NULL;
- */
-
-static gint
-match_record (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("in match_record");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
-
- *local = find_record_in_repository(conduit,remote,ctxt);
-
- if (*local==NULL) return -1;
- return 0;
-}
-
-/**
- * Free the data allocated by a previous match_record call.
- * If successfull, return non-zero and ser *local=NULL, otherwise
- * return 0.
- */
-static gint
-free_match (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- GCalConduitContext *ctxt)
-{
- LOG ("entering free_match");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(*local!=NULL,-1);
-
- ical_object_destroy (GCAL_LOCALRECORD(*local)->ical);
- g_free(*local);
-
- *local = NULL;
- return 0;
-}
-
-/*
- Move to archive and set status to Nothing
- */
-static gint
-archive_local (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- GCalConduitContext *ctxt)
-{
- LOG ("entering archive_local");
-
- g_return_val_if_fail(local!=NULL,-1);
-
- return -1;
-}
-
-/*
- Store in archive and set status to Nothing
- */
-static gint
-archive_remote (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering archive_remote");
-
- g_return_val_if_fail(remote!=NULL,-1);
- g_return_val_if_fail(local!=NULL,-1);
-
- return -1;
-}
-
-/*
- Store and set status to Nothing
- */
-static gint
-store_remote (GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering store_remote");
-
- g_return_val_if_fail(remote!=NULL,-1);
- remote->attr = GnomePilotRecordNothing;
-
- return update_record(conduit,remote,ctxt);
-}
-
-static gint
-clear_status_archive_local (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- GCalConduitContext *ctxt)
-{
- LOG ("entering clear_status_archive_local");
-
- g_return_val_if_fail(local!=NULL,-1);
-
- return -1;
-}
-
-static gint
-iterate (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- GCalConduitContext *ctxt)
-{
- static GSList *events,*iterator;
- static int hest;
-
- g_return_val_if_fail(local!=NULL,-1);
-
- if(*local==NULL) {
- LOG ("beginning iteration");
-
- events = get_calendar_objects(conduit,NULL,ctxt);
- hest = 0;
-
- if(events!=NULL) {
- LOG ("iterating over %d records",g_slist_length(events));
- *local = g_new0(GCalLocalRecord,1);
-
- local_record_from_ical_uid(*local,(gchar*)events->data,ctxt);
- iterator = events;
- } else {
- LOG ("no events");
- (*local) = NULL;
- }
- } else {
- /*LOG ("continuing iteration");*/
- hest++;
- if(g_slist_next(iterator)==NULL) {
- GSList *l;
-
- LOG ("ending");
- /** free stuff allocated for iteration */
- g_free((*local));
-
- LOG ("iterated over %d records",hest);
- for(l=events;l;l=l->next)
- g_free(l->data);
-
- g_slist_free(events);
-
- /* ends iteration */
- (*local) = NULL;
- return 0;
- } else {
- iterator = g_slist_next(iterator);
- local_record_from_ical_uid(*local,(gchar*)(iterator->data),ctxt);
- }
- }
- return 1;
-}
-
-static gint
-iterate_specific (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- gint flag,
- gint archived,
- GCalConduitContext *ctxt)
-{
-#ifdef DEBUG_CALCONDUIT
- {
- gchar *tmp;
- switch (flag) {
- case GnomePilotRecordNothing: tmp = g_strdup("RecordNothing"); break;
- case GnomePilotRecordModified: tmp = g_strdup("RecordModified"); break;
- case GnomePilotRecordNew: tmp = g_strdup("RecordNew"); break;
- default: tmp = g_strdup_printf("0x%x",flag); break;
- }
- LOG ("entering iterate_specific(flag = %s)",tmp);
- g_free(tmp);
- }
-#endif
- g_return_val_if_fail(local!=NULL,-1);
-
- /* iterate until a record meets the criteria */
- while(gnome_pilot_conduit_standard_abs_iterate(conduit,(LocalRecord**)local)) {
- if((*local)==NULL) break;
- if(archived && ((*local)->local.archived==archived)) break;
- if(((*local)->local.attr == flag)) break;
- }
-
- return (*local)==NULL?0:1;
-}
-
-static gint
-purge (GnomePilotConduitStandardAbs *conduit,
- GCalConduitContext *ctxt)
-{
- LOG ("entering purge");
-
-
- /* HEST, gem posterne her */
-
- return -1;
-}
-
-static gint
-set_status (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- gint status,
- GCalConduitContext *ctxt)
-{
- LOG ("entering set_status(status=%d)",status);
-
- g_return_val_if_fail(local!=NULL,-1);
-
- g_assert(local->ical!=NULL);
-
- local->local.attr = status;
- switch(status) {
- case GnomePilotRecordPending:
- case GnomePilotRecordNothing:
- local->ical->pilot_status = ICAL_PILOT_SYNC_NONE;
- break;
- case GnomePilotRecordDeleted:
- break;
- case GnomePilotRecordNew:
- case GnomePilotRecordModified:
- local->ical->pilot_status = ICAL_PILOT_SYNC_MOD;
- break;
- }
-
- if ( status == GnomePilotRecordDeleted) {
- GNOME_Calendar_Repository_delete_object(ctxt->calendar,local->ical->uid,&(ctxt->ev));
- } else {
- GNOME_Calendar_Repository_update_pilot_id(ctxt->calendar,
- local->ical->uid,
- local->local.ID,
- local->ical->pilot_status,
- &(ctxt->ev));
- }
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- LOG ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- }
- return 0;
-}
-
-static gint
-set_archived (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- gint archived,
- GCalConduitContext *ctxt)
-{
- LOG ("entering set_archived");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_assert(local->ical!=NULL);
-
- local->local.archived = archived;
- update_calendar_entry_in_repository(conduit,local->ical,ctxt);
- /* FIXME: This should move the entry into a speciel
- calendar file, eg. Archive, or (by config option), simply
- delete it */
- return 0;
-}
-
-static gint
-set_pilot_id (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- guint32 ID,
- GCalConduitContext *ctxt)
-{
- LOG ("entering set_pilot_id(id=%d)",ID);
-
- g_return_val_if_fail(local!=NULL,-1);
- g_assert(local->ical!=NULL);
-
- local->local.ID = ID;
- local->ical->pilot_id = ID;
- GNOME_Calendar_Repository_update_pilot_id(ctxt->calendar,
- local->ical->uid,
- local->local.ID,
- local->ical->pilot_status,
- &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- LOG ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- }
- return 0;
-}
-
-static gint
-transmit (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord **remote,
- GCalConduitContext *ctxt)
-{
- PilotRecord *p;
- int daycount;
-
- LOG ("entering transmit");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
- g_assert(local->ical!=NULL);
-
- p = g_new0(PilotRecord,1);
-
- p->ID = local->local.ID;
- p->attr = local->local.attr;
- p->archived = local->local.archived;
- p->secret = local->local.secret;
-
- local->a = g_new0(struct Appointment,1);
-
- local->a->event = 0; /* if no start time, leave at 1 */
- local->a->begin = *localtime(&local->ical->dtstart);
- local->a->end = *localtime(&local->ical->dtend);
-
- /* set the Audio Alarm parameters */
- if(local->ical->aalarm.enabled) {
- local->a->alarm = 1;
- local->a->advance = local->ical->aalarm.count;
- switch(local->ical->aalarm.units) {
- case ALARM_MINUTES:
- local->a->advanceUnits = advMinutes;
- break;
- case ALARM_HOURS:
- local->a->advanceUnits = advHours;
- break;
- case ALARM_DAYS:
- local->a->advanceUnits = advDays;
- break;
- }
- } else {
- local->a->alarm = 0;
- local->a->advance = 0;
- local->a->advanceUnits = advMinutes;
- }
-
- /* set the recurrence parameters */
- if (local->ical->recur != NULL) {
- switch (local->ical->recur->type) {
- case RECUR_DAILY:
- local->a->repeatType = repeatDaily;
- break;
- case RECUR_WEEKLY:
- local->a->repeatType = repeatWeekly;
- break;
- case RECUR_MONTHLY_BY_POS:
- local->a->repeatType = repeatMonthlyByDate;
- break;
- case RECUR_MONTHLY_BY_DAY:
- local->a->repeatType = repeatMonthlyByDay;
- break;
- case RECUR_YEARLY_BY_MONTH:
- local->a->repeatType = repeatYearly;
- break;
- case RECUR_YEARLY_BY_DAY:
- local->a->repeatType = repeatYearly;
- break;
- }
- if (local->ical->recur->duration == 0) {
- local->a->repeatForever = 1;
- } else {
- local->a->repeatForever = 0;
- local->a->repeatEnd = *localtime(&local->ical->recur->_enddate);
- }
- local->a->repeatFrequency = local->ical->recur->interval;
-
-
- for ( daycount=0; daycount<7; daycount++ ) {
- if (local->ical->recur->weekday & (1 << daycount))
- local->a->repeatDays[daycount] = 1;
- }
- } else {
- local->a->repeatType = repeatNone;
- local->a->repeatForever = 0;
- local->a->repeatEnd = local->a->end;
- local->a->repeatFrequency = 0;
- local->a->repeatDay = dom1stSun;
- local->a->repeatDays[0] = 0;
- local->a->repeatDays[1] = 0;
- local->a->repeatDays[2] = 0;
- local->a->repeatDays[3] = 0;
- local->a->repeatDays[4] = 0;
- local->a->repeatDays[5] = 0;
- local->a->repeatDays[6] = 0;
- local->a->repeatWeekstart = 0;
- local->a->exceptions = 0;
- local->a->exception = NULL;
- }
-
- /* STOP: don't replace these with g_strdup, since free_Appointment
- uses free to deallocte */
- local->a->note =
- local->ical->comment==NULL?NULL:strdup(local->ical->comment);
- local->a->description =
- local->ical->summary==NULL?NULL:strdup(local->ical->summary);
-
- /* Generate pilot record structure */
- p->record = g_new0(char,0xffff);
- p->length = pack_Appointment(local->a,p->record,0xffff);
-
-#if 0
- /* This is some debug code that hexdumps the calendar entry...
- You won't need this. */
- {
- int x,y;
- g_message("calconduit: new item from %s to %s",asctime(&(local->a->begin)),asctime(&(local->a->end)));
-
- g_message("local->a->note = %s",local->a->note);
- g_message("local->a->description = %s",local->a->description);
- g_message("sizeof(p->record) = %d, length is %d",sizeof(p->record),p->length);
- for(x=0;x<p->length;x+=32) {
- for(y=x;y<x+32;y++)
- if(p->record[y]<33 || p->record[y]>128)
- printf("%02X",p->record[y]);
- else
- printf(" %c",p->record[y]);
- printf("\n");
- }
- }
-#endif
-
- *remote = p;
-
- return 0;
-}
-
-static gint
-free_transmit (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord **remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering free_transmit");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
-
- free_Appointment(local->a);
- g_free((*remote)->record);
- *remote = NULL;
- return 0;
-}
-
-static gint
-compare (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- /* used by the quick compare */
- PilotRecord *remoteOfLocal;
- int err;
- int retval;
-
- /* used by the tedious compare */
- struct Appointment a;
- int daycount;
-
- g_message ("entering compare");
-
- g_return_val_if_fail (local!=NULL,-1);
- g_return_val_if_fail (remote!=NULL,-1);
-#if 1
- err = transmit(conduit,local,&remoteOfLocal,ctxt);
- if (err != 0) return err;
-
- retval = 0;
- if (remote->length == remoteOfLocal->length) {
- if (memcmp(remoteOfLocal->record,remote->record,remote->length)!=0) {
- g_message("compare failed on contents");
- retval = 1;
- }
- } else {
- g_message("compare failed on length");
- retval = 1;
- }
-
- free_transmit(conduit,local,&remoteOfLocal,ctxt);
- return retval;
-
-#else
- /** FIXME: All the { LOG("yadayada"); return 1; } bloat is for debug purposes.
- Once this is known to work, compact to return 1;'s */
-
- /* Check record attributes */
- if (local->local.ID != remote->ID) {
- LOG("failed local->local.ID == remote->ID");
- return 1;
- }
- if (local->local.attr != remote->attr) {
- LOG("failed local->local.attr == remote->attr");
- return 1;
- }
- if (local->local.archived != remote->archived) {
- LOG("failed local->local.archived == remote->archived");
- return 1;
- }
- if (local->local.secret != remote->secret) {
- LOG("failed local->local.secret == remote->secret");
- return 1;
- }
-
- unpack_Appointment(&a,remote->record,remote->length);
-
- /* Check records begin/end time */
- if (a.event==0) {
-/* FIXME
- if (a.begin != *localtime(&local->ical->dtstart)) {
- LOG("a.begin == *localtime(&local->ical->dtstart)");
- return 1;
- }
- if (a.end != *localtime(&local->ical->dtend)) {
- LOG("a.end == *localtime(&local->ical->dtend)");
- return 1;
- }
-*/
- } else {
- LOG("failed local->a.event != 0, unsupported by gnomecal");
- return 1;
- }
-
- /* Check records alarm settings */
- if(a.alarm == 1) {
- if (local->ical->aalarm.enabled == 1) {
- if (a.advance != local->ical->aalarm.count) {
- LOG("failed a.advance == local->ical->aalarm.count");
- return 1;
- }
- switch(local->ical->aalarm.units) {
- case ALARM_MINUTES:
- if (a.advanceUnits != advMinutes) {
- LOG("failed local->ical->aalarm.units == a.advanceUnits");
- return 1;
- }
- break;
- case ALARM_HOURS:
- if (a.advanceUnits != advHours) {
- LOG("failed local->ical->aalarm.units == a.advanceUnits");
- return 1;
- }
- break;
- case ALARM_DAYS:
- if (a.advanceUnits != advDays) {
- LOG("failed local->ical->aalarm.units == a.advanceUnits");
- return 1;
- }
- break;
- }
- } else {
- LOG("failed a.alarm == 1 && local->ical->aalarm.enabled == 1");
- return 1;
- }
- } else if (local->ical->aalarm.enabled == 1) {
- LOG("failed a.alarm != 1 && local->ical->aalarm.enabled != 1");
- return 1;
- }
-
- /* Check records recurrence settings */
- /* If this code is broken, a more or less safe although not efficient
- approach is (other the fixing the bug), if either has recurrence,
- return 1, thus failing the comparision */
- if (local->ical->recur != NULL) {
- if (a.repeatType == repeatNone) {
- LOG("failed: local->ical->recur != NULL && a.repeatType != repeatNone");
- return 1;
- }
- switch (local->ical->recur->type) {
- case RECUR_DAILY:
- if (a.repeatType != repeatDaily) {
- LOG("failed a.repeatType == repeatDaily");
- return 1; }
- break;
- case RECUR_WEEKLY:
- if (a.repeatType != repeatWeekly) {
- LOG("failed a.repeatType == repeatWeekly");
- return 1; }
- break;
- case RECUR_MONTHLY_BY_POS:
- if (a.repeatType != repeatMonthlyByDate) {
- LOG("failed a.repeatType == repeatMonthlyByDate");
- return 1; }
- break;
- case RECUR_MONTHLY_BY_DAY:
- if (a.repeatType != repeatMonthlyByDay) {
- LOG("failed a.repeatType == repeatMonthlyByDay");
- return 1; }
- break;
- case RECUR_YEARLY_BY_MONTH:
- if (a.repeatType != repeatYearly) {
- LOG("failed a.repeatType == repeatYearly");
- return 1; }
- break;
- case RECUR_YEARLY_BY_DAY:
- if (a.repeatType != repeatYearly) {
- LOG("failed a.repeatType == repeatYearly");
- return 1; }
- break;
- }
- if (local->ical->recur->duration == 0) {
- if(a.repeatForever != 1) {
- LOG("failed local->ical->recur->duration == 0 && a.repeatForever == 1");
- return 1;
- }
- } else {
- if(a.repeatForever != 0) {
- LOG("failed local->ical->recur->duration != 0 && ! a.repeatForever == 0");
- return 1;
- }
-/* FIXME
- if(a.repeatEnd != *localtime(&local->ical->recur->_enddate)) {
- LOG("failed a.repeatEnd == *localtime(&local->ical->recur->_enddate)");
- return 1;
- }
-*/
- }
- if (a.repeatFrequency != local->ical->recur->interval) {
- LOG("failed a.repeatFrequency == local->ical->recur->interval");
- return 1;
- }
- for (daycount = 0; daycount<7; daycount++) {
- if(local->ical->recur->weekday & (1<<daycount)) {
- if (a.repeatDays[daycount]!=1) {
- LOG("failed local->ical->recur->weekday & (1<<daycount) && a.repeatDays[daycount]==1");
- return 1;
- }
- } else {
- if (a.repeatDays[daycount]!=0) {
- LOG("failed local->ical->recur->weekday &! (1<<daycount) && a.repeatDays[daycount]==0");
- return 1;
- }
- }
- }
- } else if (a.repeatType != repeatNone ) {
- LOG("failed: local->ical->recur == NULL && a.repeatType == repeatNone");
- return 1;
- }
-
- /* check the note and description */
- if(a.note!=NULL) {
- if(local->ical->comment==NULL) {
- LOG("failed a.note != NULL && local->ical->coment != NULL");
- return 1;
- }
- if(strcmp(local->ical->comment,a.note)!=0) {
- LOG("failed strcmp(local->ical->comment,a.note)==0");
- return 1;
- }
- } if(local->ical->comment!=NULL) {
- LOG("failed a.note == NULL && local->ical->coment == NULL");
- return 1;
- }
- if(a.description!=NULL) {
- if(local->ical->summary==NULL) {
- LOG("failed a.description != NULL && local->ical->coment != NULL");
- return 1;
- }
- if(strcmp(local->ical->summary,a.description)!=0) {
- LOG("failed strcmp(local->ical->summary,a.description)==0");
- return 1;
- }
- } if(local->ical->summary!=NULL) {
- LOG("failed a.description == NULL && local->ical->coment == NULL");
- return 1;
- }
-#endif
- return 0;
-}
-
-static gint
-compare_backup (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering compare_backup");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
-
- return -1;
-}
-
-static gint
-delete_all (GnomePilotConduitStandardAbs *conduit,
- GCalConduitContext *ctxt)
-{
- GSList *events,*it;
- gboolean error;
-
- events = get_calendar_objects(conduit,&error,ctxt);
-
- if (error == FALSE) return -1;
- for (it=events;it;it = g_slist_next(it)) {
- GNOME_Calendar_Repository_delete_object(ctxt->calendar,
- it->data,
- &(ctxt->ev));
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- /* destroy loop, free data */
- for (it=events;it;it = g_slist_next(it)) g_free(it->data);
- g_slist_free(events);
- return -1;
- }
- g_free(it->data);
- }
- g_slist_free(events);
- return -1;
-}
-
-GnomePilotConduit *
-conduit_get_gpilot_conduit (guint32 pilotId)
-{
- GtkObject *retval;
- GCalConduitCfg *cfg;
- GCalConduitContext *ctxt;
-
-
- retval = gnome_pilot_conduit_standard_abs_new ("DatebookDB", 0x64617465);
- g_assert (retval != NULL);
- gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"GnomeCalConduit");
-
- gcalconduit_load_configuration(&cfg,pilotId);
- gtk_object_set_data(retval,"gcalconduit_cfg",cfg);
-
- gcalconduit_new_context(&ctxt,cfg);
- gtk_object_set_data(GTK_OBJECT(retval),"gcalconduit_context",ctxt);
-
- gtk_signal_connect (retval, "match_record", (GtkSignalFunc) match_record, ctxt);
- gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt);
- gtk_signal_connect (retval, "archive_local", (GtkSignalFunc) archive_local, ctxt);
- gtk_signal_connect (retval, "archive_remote", (GtkSignalFunc) archive_remote, ctxt);
- gtk_signal_connect (retval, "store_remote", (GtkSignalFunc) store_remote, ctxt);
- gtk_signal_connect (retval, "clear_status_archive_local", (GtkSignalFunc) clear_status_archive_local, ctxt);
- gtk_signal_connect (retval, "iterate", (GtkSignalFunc) iterate, ctxt);
- gtk_signal_connect (retval, "iterate_specific", (GtkSignalFunc) iterate_specific, ctxt);
- gtk_signal_connect (retval, "purge", (GtkSignalFunc) purge, ctxt);
- gtk_signal_connect (retval, "set_status", (GtkSignalFunc) set_status, ctxt);
- gtk_signal_connect (retval, "set_archived", (GtkSignalFunc) set_archived, ctxt);
- gtk_signal_connect (retval, "set_pilot_id", (GtkSignalFunc) set_pilot_id, ctxt);
- gtk_signal_connect (retval, "compare", (GtkSignalFunc) compare, ctxt);
- gtk_signal_connect (retval, "compare_backup", (GtkSignalFunc) compare_backup, ctxt);
- gtk_signal_connect (retval, "free_transmit", (GtkSignalFunc) free_transmit, ctxt);
- gtk_signal_connect (retval, "delete_all", (GtkSignalFunc) delete_all, ctxt);
- gtk_signal_connect (retval, "transmit", (GtkSignalFunc) transmit, ctxt);
- gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, ctxt);
-
- return GNOME_PILOT_CONDUIT (retval);
-}
-
-void
-conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit)
-{
- GCalConduitCfg *cc;
- GCalConduitContext *ctxt;
-
- cc = GET_GCALCONFIG(conduit);
- ctxt = GET_GCALCONTEXT(conduit);
-
- if(ctxt->calendar!=CORBA_OBJECT_NIL)
- GNOME_Calendar_Repository_done (ctxt->calendar, &(ctxt->ev));
-
- gcalconduit_destroy_configuration(&cc);
-
- gcalconduit_destroy_context(&ctxt);
-
- gtk_object_destroy (GTK_OBJECT (conduit));
-
-}
-
-
diff --git a/calendar/conduits/calendar/calendar-conduit.h b/calendar/conduits/calendar/calendar-conduit.h
deleted file mode 100644
index 711609e96a..0000000000
--- a/calendar/conduits/calendar/calendar-conduit.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* $Id$ */
-
-#ifndef __CALENDAR_CONDUIT_H__
-#define __CALENDAR_CONDUIT_H__
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <pi-datebook.h>
-#include <gnome.h>
-
-#include "GnomeCal.h"
-#include "calobj.h"
-#include "calendar.h"
-#include "timeutil.h"
-
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-standard-abs.h>
-
-/* This is the local record structure for the GnomeCal conduit. */
-typedef struct _GCalLocalRecord GCalLocalRecord;
-struct _GCalLocalRecord {
- /* The stuff from gnome-pilot-conduit-standard-abs.h
- Must be first in the structure, or instances of this
- structure cannot be used by gnome-pilot-conduit-standard-abs.
- */
- LocalRecord local;
- /* The corresponding iCal object, as found by GnomeCal. */
- iCalObject *ical;
- /* pilot-link appointment structure, used for implementing Transmit. */
- struct Appointment *a;
-};
-#define GCAL_LOCALRECORD(s) ((GCalLocalRecord*)(s))
-
-/* This is the configuration of the GnomeCal conduit. */
-typedef struct _GCalConduitCfg GCalConduitCfg;
-struct _GCalConduitCfg {
- gboolean open_secret;
- guint32 pilotId;
- GnomePilotConduitSyncType sync_type; /* only used by capplet */
-};
-#define GET_GCALCONFIG(c) ((GCalConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"gcalconduit_cfg"))
-
-/* This is the context for all the GnomeCal conduit methods. */
-typedef struct _GCalConduitContext GCalConduitContext;
-struct _GCalConduitContext {
- struct AppointmentAppInfo ai;
- GCalConduitCfg *cfg;
- GNOME_Calendar_Repository calendar;
- CORBA_Environment ev;
- CORBA_ORB orb;
-};
-#define GET_GCALCONTEXT(c) ((GCalConduitContext*)gtk_object_get_data(GTK_OBJECT(c),"gcalconduit_context"))
-
-/* Given a GCalConduitCfg*, allocates the structure and
- loads the configuration data for the given pilot. */
-static void
-gcalconduit_load_configuration(GCalConduitCfg **c,
- guint32 pilotId)
-{
- gchar prefix[256];
- g_snprintf(prefix,255,"/gnome-pilot.d/calendard-conduit/Pilot_%u/",pilotId);
-
- *c = g_new0(GCalConduitCfg,1);
- g_assert(*c != NULL);
- gnome_config_push_prefix(prefix);
- (*c)->open_secret = gnome_config_get_bool("open_secret=FALSE");
- (*c)->sync_type = GnomePilotConduitSyncTypeCustom; /* set in capplets main */
- gnome_config_pop_prefix();
-
- (*c)->pilotId = pilotId;
-}
-
-/* Saves the configuration data. */
-static void
-gcalconduit_save_configuration(GCalConduitCfg *c)
-{
- gchar prefix[256];
-
- g_snprintf(prefix,255,"/gnome-pilot.d/calendar-conduit/Pilot_%u/",c->pilotId);
-
- gnome_config_push_prefix(prefix);
- gnome_config_set_bool("open_secret",c->open_secret);
- gnome_config_pop_prefix();
-
- gnome_config_sync();
- gnome_config_drop_all();
-}
-
-/* Creates a duplicate of the configuration data */
-static GCalConduitCfg*
-gcalconduit_dupe_configuration(GCalConduitCfg *c) {
- GCalConduitCfg *retval;
- g_return_val_if_fail(c!=NULL,NULL);
- retval = g_new0(GCalConduitCfg,1);
- retval->sync_type = c->sync_type;
- retval->open_secret = c->open_secret;
- retval->pilotId = c->pilotId;
- return retval;
-}
-
-/* Destroys any data allocated by gcalconduit_load_configuration
- and deallocates the given configuration. */
-static void
-gcalconduit_destroy_configuration(GCalConduitCfg **c)
-{
- g_return_if_fail(c!=NULL);
- g_return_if_fail(*c!=NULL);
- g_free(*c);
- *c = NULL;
-}
-
-/* Given a GCalConduitContxt*, allocates the structure */
-static void
-gcalconduit_new_context(GCalConduitContext **ctxt,
- GCalConduitCfg *c)
-{
- *ctxt = g_new0(GCalConduitContext,1);
- g_assert(ctxt!=NULL);
- (*ctxt)->cfg = c;
- CORBA_exception_init (&((*ctxt)->ev));
-}
-
-/* Destroys any data allocated by gcalconduit_new_context
- and deallocates its data. */
-static void
-gcalconduit_destroy_context(GCalConduitContext **ctxt)
-{
- g_return_if_fail(ctxt!=NULL);
- g_return_if_fail(*ctxt!=NULL);
-/*
- if ((*ctxt)->cfg!=NULL)
- gcalconduit_destroy_configuration(&((*ctxt)->cfg));
-*/
- g_free(*ctxt);
- *ctxt = NULL;
-}
-#endif __CALENDAR_CONDUIT_H__
diff --git a/calendar/conduits/todo/todo-conduit-control-applet.c b/calendar/conduits/todo/todo-conduit-control-applet.c
deleted file mode 100644
index 54a26715ef..0000000000
--- a/calendar/conduits/todo/todo-conduit-control-applet.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* Control applet ("capplet") for the gnome-pilot todo conduit, */
-/* based on */
-/* gpilotd control applet ('capplet') for use with the GNOME control center */
-/* $Id$ */
-
-#include <pwd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <gnome.h>
-
-#include <config.h>
-#include <capplet-widget.h>
-
-#include <gpilotd/gpilotd-conduit-mgmt.h>
-#include <gpilotd/gpilotd-app.h>
-#include <gpilotd/gpilotd-app-dummy-callbacks.h>
-
-#include "todo-conduit.h"
-
-/* tell changes callbacks to ignore changes or not */
-static gboolean ignore_changes=FALSE;
-
-/* capplet widget */
-static GtkWidget *capplet=NULL;
-
-/* host/device/pilot configuration windows */
-GtkWidget *cfgOptionsWindow=NULL;
-GtkWidget *cfgStateWindow=NULL;
-GtkWidget *dialogWindow=NULL;
-
-gboolean activated,org_activation_state;
-GnomePilotConduitMgmt *conduit;
-
-static void doTrySettings(GtkWidget *widget, ConduitCfg *conduitCfg);
-static void doRevertSettings(GtkWidget *widget, ConduitCfg *conduitCfg);
-static void doSaveSettings(GtkWidget *widget, ConduitCfg *conduitCfg);
-
-static void readStateCfg(GtkWidget *w);
-static void setStateCfg(GtkWidget *w);
-
-gint pilotId;
-CORBA_Environment ev;
-
-static void
-doTrySettings(GtkWidget *widget, ConduitCfg *conduitCfg)
-{
- readStateCfg(cfgStateWindow);
- if(activated)
- gpilotd_conduit_mgmt_enable(conduit,pilotId,GnomePilotConduitSyncTypeSynchronize);
- else
- gpilotd_conduit_mgmt_disable(conduit,pilotId);
-}
-
-static void
-doSaveSettings(GtkWidget *widget, ConduitCfg *conduitCfg)
-{
- doTrySettings(widget, conduitCfg);
- save_configuration(NULL);
-}
-
-
-static void
-doRevertSettings(GtkWidget *widget, ConduitCfg *conduitCfg)
-{
- activated = org_activation_state;
- setStateCfg(cfgStateWindow);
-}
-
-static void
-insert_dir_callback (GtkEditable *editable, const gchar *text,
- gint len, gint *position, void *data)
-{
- gint i;
- gchar *curname;
-
- curname = gtk_entry_get_text(GTK_ENTRY(editable));
- if (*curname == '\0' && len > 0) {
- if (isspace(text[0])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert_text");
- return;
- }
- } else {
- for (i=0; i<len; i++) {
- if (isspace(text[i])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable),
- "insert_text");
- return;
- }
- }
- }
-}
-static void
-insert_dir_callback2(GtkEditable *editable, const gchar *text,
- gint length, gint *position,
- void *data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static void
-clist_changed(GtkWidget *widget, gpointer data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-void about_cb (GtkWidget *widget, gpointer data) {
- GtkWidget *about;
- const gchar *authors[] = {_("Eskil Heyn Olsen <deity@eskil.dk>"),NULL};
-
- about = gnome_about_new(_("Gpilotd todo conduit"), VERSION,
- _("(C) 1998 the Free Software Foundation"),
- authors,
- _("Configuration utility for the todo conduit.\n"),
- _("gnome-unknown.xpm"));
- gtk_widget_show (about);
-
- return;
-}
-
-static void toggled_cb(GtkWidget *widget, gpointer data) {
- gtk_widget_set_sensitive(cfgOptionsWindow,GTK_TOGGLE_BUTTON(widget)->active);
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static GtkWidget
-*createStateCfgWindow(void)
-{
- GtkWidget *vbox, *table;
- GtkWidget *entry, *label;
- GtkWidget *button;
-
- vbox = gtk_vbox_new(FALSE, GNOME_PAD);
-
- table = gtk_table_new(2, 2, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE(table), 4);
- gtk_table_set_col_spacings(GTK_TABLE(table), 10);
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD);
-
- label = gtk_label_new(_("Enabled"));
- gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1,2);
-
- button = gtk_check_button_new();
- gtk_object_set_data(GTK_OBJECT(vbox), "conduit_on_off", button);
- gtk_signal_connect(GTK_OBJECT(button), "toggled",
- GTK_SIGNAL_FUNC(toggled_cb),
- NULL);
- gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 1,2);
-
- return vbox;
-}
-
-static void
-setStateCfg(GtkWidget *cfg)
-{
- GtkWidget *button;
- gchar num[40];
-
- button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
-
- g_assert(button!=NULL);
-
- ignore_changes = TRUE;
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),activated);
- gtk_widget_set_sensitive(cfgOptionsWindow,GTK_TOGGLE_BUTTON(button)->active);
- ignore_changes = FALSE;
-}
-
-
-static void
-readStateCfg(GtkWidget *cfg)
-{
- GtkWidget *button;
-
- button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
-
- g_assert(button!=NULL);
-
- activated = GTK_TOGGLE_BUTTON(button)->active;
-}
-
-static void
-pilot_capplet_setup(void)
-{
- GtkWidget *frame, *table;
-
- capplet = capplet_widget_new();
-
- table = gtk_table_new(1, 2, FALSE);
- gtk_container_border_width(GTK_CONTAINER(table), GNOME_PAD);
- gtk_container_add(GTK_CONTAINER(capplet), table);
-
- frame = gtk_frame_new(_("Conduit state"));
- gtk_container_border_width(GTK_CONTAINER(frame), GNOME_PAD_SMALL);
- gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1);
- cfgStateWindow = createStateCfgWindow();
- gtk_container_add(GTK_CONTAINER(frame), cfgStateWindow);
-
- gtk_signal_connect(GTK_OBJECT(capplet), "try",
- GTK_SIGNAL_FUNC(doTrySettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "revert",
- GTK_SIGNAL_FUNC(doRevertSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "ok",
- GTK_SIGNAL_FUNC(doSaveSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "help",
- GTK_SIGNAL_FUNC(about_cb), NULL);
-
-
- setStateCfg(cfgStateWindow);
-
- gtk_widget_show_all(capplet);
-}
-
-void run_error_dialog(gchar *mesg,...) {
- char tmp[80];
- va_list ap;
-
- va_start(ap,mesg);
- vsnprintf(tmp,79,mesg,ap);
- dialogWindow = gnome_message_box_new(mesg,GNOME_MESSAGE_BOX_ERROR,GNOME_STOCK_BUTTON_OK,NULL);
- gnome_dialog_run_and_close(GNOME_DIALOG(dialogWindow));
- va_end(ap);
-}
-
-gint get_pilot_id_from_gpilotd() {
- gint *pilots;
- int i;
-
- i=0;
- gpilotd_get_pilot_ids(&pilots);
- if(pilots) {
- while(pilots[i]!=-1) { g_message("pilot %d = \"%d\"",i,pilots[i]); i++; }
- if(i==0) {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- } else {
- if(i==1)
- return pilots[0];
- else {
- g_message("too many pilots...");
- return pilots[0];
- }
- }
- } else {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- }
-}
-
-int
-main( int argc, char *argv[] )
-{
- /* we're a capplet */
- gnome_capplet_init ("todo conduit control applet", NULL, argc, argv,
- NULL,
- 0, NULL);
-
- /* put all code to set things up in here */
- conduit = gpilotd_conduit_mgmt_new("todo_conduit");
-
- /* get pilot name from gpilotd */
- /* 1. initialize the gpilotd connection */
- if (gpilotd_init(&argc,argv)!=0) {
- run_error_dialog(_("Cannot initialze the GnomePilot Daemon"));
- g_error(_("Cannot initialze the GnomePilot Daemon"));
- return -1;
- }
-
- /* 2 connect to gpilotd */
- if (gpilotd_connect()!=0) {
- run_error_dialog(_("Cannot connect to the GnomePilot Daemon"));
- g_error(_("Cannot connect to the GnomePilot Daemon"));
- return -1;
- }
-
- pilotId = get_pilot_id_from_gpilotd();
- if(!pilotId) return -1;
- org_activation_state = activated = gpilotd_conduit_mgmt_is_enabled(conduit,pilotId);
-
- pilot_capplet_setup();
-
-
- /* done setting up, now run main loop */
- capplet_gtk_main();
- return 0;
-}
diff --git a/calendar/conduits/todo/todo-conduit-control-applet.desktop b/calendar/conduits/todo/todo-conduit-control-applet.desktop
deleted file mode 100644
index 87788bde08..0000000000
--- a/calendar/conduits/todo/todo-conduit-control-applet.desktop
+++ /dev/null
@@ -1,6 +0,0 @@
-[Desktop Entry]
-Name=Todo conduit
-Comment=Configure the todo conduit
-Exec=todo-conduit-control-applet --cap-id=1
-Terminal=0
-Type=Application
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
deleted file mode 100644
index 3a543816af..0000000000
--- a/calendar/conduits/todo/todo-conduit.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* $Id$ */
-
-#include <glib.h>
-#include <gnome.h>
-
-#include <pi-source.h>
-#include <pi-socket.h>
-#include <pi-file.h>
-#include <pi-dlp.h>
-#include <pi-version.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <utime.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <signal.h>
-#include <errno.h>
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-standard-abs.h>
-
-#include "todo-conduit.h"
-
-static gint
-load_records(GnomePilotConduit *c)
-{
- return 0;
-}
-
-static gint
-pre_sync(GnomePilotConduit *c, GnomePilotDBInfo *dbi) {
- int l;
- unsigned char *buf;
-
- gtk_object_set_data(GTK_OBJECT(c),"dbinfo",dbi);
-
- load_records(c);
-
- buf = (unsigned char*)g_malloc(0xffff);
- if((l=dlp_ReadAppBlock(dbi->pilot_socket,dbi->db_handle,0,(unsigned char *)buf,0xffff))<0) {
- return -1;
- }
- unpack_ToDoAppInfo(&(GET_DATA(c)->ai),buf,l);
- g_free(buf);
-
- return 0;
-}
-
-static gint
-post_sync(GnomePilotConduit *c) {
- return 0;
-}
-
-static gint
-match_record (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("in match_record\n");
- return 0;
-}
-static gint
-free_match (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- gpointer data)
-{
- g_print ("entering free_match\n");
- *local = NULL;
-
- return 0;
-}
-static gint
-archive_local (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gpointer data)
-{
- g_print ("entering archive_local\n");
- return 1;
-
-}
-static gint
-archive_remote (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering archive_remote\n");
- return 1;
-}
-static gint
-store_remote (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering store_remote\n");
- g_print ("Rec:%s:\nLength:%d\n", remote->record, remote->length);
- return 1;
-}
-static gint
-clear_status_archive_local (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gpointer data)
-{
- g_print ("entering clear_status_archive_local\n");
- return 1;
-}
-static gint
-iterate (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- gpointer data)
-{
- g_print ("entering iterate\n");
- return 1;
-}
-static gint
-iterate_specific (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- gint flag,
- gint archived,
- gpointer data)
-{
- g_print ("entering iterate_specific\n");
- return 1;
-}
-static gint
-purge (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- gpointer data)
-{
- g_print ("entering purge\n");
- return 1;
-}
-static gint
-set_status (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gint status,
- gpointer data)
-{
- g_print ("entering set_status\n");
- return 1;
-}
-static gint
-set_archived (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gint archived,
- gpointer data)
-{
- g_print ("entering set_archived\n");
- return 1;
-}
-static gint
-set_pilot_id (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- guint32 ID,
- gpointer data)
-{
- g_print ("entering set_pilot_id\n");
- return 1;
-}
-static gint
-compare (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering compare\n");
- return 1;
-}
-static gint
-compare_backup (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering compare_backup\n");
- return 1;
-}
-static gint
-free_transmit (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering free_transmit\n");
- return 1;
-}
-static gint
-delete_all (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- gpointer data)
-{
- g_print ("entering delete_all\n");
- return 1;
-}
-static PilotRecord *
-transmit (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gpointer data)
-{
- g_print ("entering transmit\n");
- return NULL;
-}
-
-static GnomePilotConduit *
-conduit_get_gpilot_conduit (guint32 pilotId)
-{
- GtkObject *retval;
- ConduitCfg *cfg;
- ConduitData *cdata;
-
- g_print ("creating our new conduit\n");
- retval = gnome_pilot_conduit_standard_abs_new ("TodoDB", 0x0);
- g_assert (retval != NULL);
- gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"todo");
-
- cfg = g_new0(ConduitCfg,1);
- g_assert(cfg != NULL);
- gtk_object_set_data(retval,"conduit_cfg",cfg);
-
- cdata = g_new0(ConduitData,1);
- g_assert(cdata != NULL);
- gtk_object_set_data(retval,"conduit_data",cdata);
-
- gtk_signal_connect (retval, "match_record", (GtkSignalFunc) match_record, NULL);
- gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, NULL);
- gtk_signal_connect (retval, "archive_local", (GtkSignalFunc) archive_local, NULL);
- gtk_signal_connect (retval, "archive_remote", (GtkSignalFunc) archive_remote, NULL);
- gtk_signal_connect (retval, "store_remote", (GtkSignalFunc) store_remote, NULL);
- gtk_signal_connect (retval, "clear_status_archive_local", (GtkSignalFunc) clear_status_archive_local, NULL);
- gtk_signal_connect (retval, "iterate", (GtkSignalFunc) iterate, NULL);
- gtk_signal_connect (retval, "iterate_specific", (GtkSignalFunc) iterate_specific, NULL);
- gtk_signal_connect (retval, "purge", (GtkSignalFunc) purge, NULL);
- gtk_signal_connect (retval, "set_status", (GtkSignalFunc) set_status, NULL);
- gtk_signal_connect (retval, "set_archived", (GtkSignalFunc) set_archived, NULL);
- gtk_signal_connect (retval, "set_pilot_id", (GtkSignalFunc) set_pilot_id, NULL);
- gtk_signal_connect (retval, "compare", (GtkSignalFunc) compare, NULL);
- gtk_signal_connect (retval, "compare_backup", (GtkSignalFunc) compare_backup, NULL);
- gtk_signal_connect (retval, "free_transmit", (GtkSignalFunc) free_transmit, NULL);
- gtk_signal_connect (retval, "delete_all", (GtkSignalFunc) delete_all, NULL);
- gtk_signal_connect (retval, "transmit", (GtkSignalFunc) transmit, NULL);
- gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, NULL);
- gtk_signal_connect (retval, "post_sync", (GtkSignalFunc) post_sync, NULL);
-
- load_configuration(&cfg,pilotId);
-
- return GNOME_PILOT_CONDUIT (retval);
-}
-static void
-conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit)
-{
- ConduitCfg *cc;
- cc = GET_CONFIG(conduit);
- destroy_configuration(&cc);
- gtk_object_destroy (GTK_OBJECT (conduit));
-}
-
-
diff --git a/calendar/conduits/todo/todo-conduit.h b/calendar/conduits/todo/todo-conduit.h
deleted file mode 100644
index c224b2b1f3..0000000000
--- a/calendar/conduits/todo/todo-conduit.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $Id$ */
-
-#ifndef __TODO_CONDUIT_H__
-#define __TODO_CONDUIT_H__
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <pi-todo.h>
-#include <gnome.h>
-
-typedef struct _ConduitCfg ConduitCfg;
-
-struct _ConduitCfg {
- gboolean open_secret;
- guint32 pilotId;
-};
-
-#define GET_CONFIG(c) ((ConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"conduit_cfg"))
-
-typedef struct _ConduitData ConduitData;
-
-struct _ConduitData {
- struct ToDoAppInfo ai;
-};
-
-#define GET_DATA(c) ((ConduitData*)gtk_object_get_data(GTK_OBJECT(c),"conduit_data"))
-
-static void load_configuration(ConduitCfg **c,guint32 pilotId) {
- gchar prefix[256];
- g_snprintf(prefix,255,"/gnome-pilot.d/todod-conduit/Pilot_%u/",pilotId);
-
- *c = g_new0(ConduitCfg,1);
- gnome_config_push_prefix(prefix);
- (*c)->open_secret = gnome_config_get_bool("open secret=FALSE");
- gnome_config_pop_prefix();
-
- (*c)->pilotId = pilotId;
-}
-
-static void save_configuration(ConduitCfg *c) {
- gchar prefix[256];
-
- g_snprintf(prefix,255,"/gnome-pilot.d/todo-conduit/Pilot_%u/",c->pilotId);
-
- gnome_config_push_prefix(prefix);
- gnome_config_set_bool("open secret",c->open_secret);
- gnome_config_pop_prefix();
-
- gnome_config_sync();
- gnome_config_drop_all();
-}
-
-static void destroy_configuration(ConduitCfg **c) {
- g_free(*c);
- *c = NULL;
-}
-
-#endif __TODO_CONDUIT_H__
diff --git a/calendar/corba-cal-factory.c b/calendar/corba-cal-factory.c
deleted file mode 100644
index c10929376b..0000000000
--- a/calendar/corba-cal-factory.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * corba-cal-factory.c: Service that provides access to the calendar repositories.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include "gnome-cal.h"
-#include "main.h"
-#include "alarm.h"
-#include "timeutil.h"
-#include "../libversit/vcc.h"
-#include <libgnorba/gnome-factory.h>
-#include <libgnorba/gnorba.h>
-#include "GnomeCal.h"
-#include "corba-cal-factory.h"
-#include "corba-cal.h"
-
-CORBA_ORB orb;
-PortableServer_POA poa;
-PortableServer_POAManager poa_manager;
-
-static POA_GNOME_GenericFactory__epv calendar_epv;
-static POA_GNOME_GenericFactory__vepv calendar_vepv;
-
-/*
- * Servant and Object Factory
- */
-static POA_GNOME_GenericFactory calendar_servant;
-static GNOME_GenericFactory calendar_factory;
-
-static CORBA_boolean
-calendar_supports (PortableServer_Servant servant,
- CORBA_char * obj_goad_id,
- CORBA_Environment * ev)
-{
- if (strcmp (obj_goad_id, "IDL:GNOME:Calendar:Repository:1.0") == 0)
- return CORBA_TRUE;
- else
- return CORBA_FALSE;
-}
-
-static CORBA_Object
-calendar_create_object (PortableServer_Servant servant,
- CORBA_char *goad_id,
- const GNOME_stringlist *params,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal;
- struct stat s;
- char *name;
-
- if (params->_length == 1)
- name = params->_buffer [0];
- else
- name = NULL;
-
- if (strcmp (goad_id, "IDL:GNOME:Calendar:Repository:1.0") != 0){
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_GenericFactory_CannotActivate,
- NULL);
- return CORBA_OBJECT_NIL;
- }
-
- gcal = gnome_calendar_locate (name);
- if (gcal != NULL)
- return CORBA_Object_duplicate (gcal->cal->corba_server, ev);
-
- if (stat (name, &s) != 0){
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_GenericFactory_CannotActivate,
- NULL);
- return CORBA_OBJECT_NIL;
- }
-
- gcal = new_calendar ("", name, NULL, NULL, FALSE);
-
- return CORBA_Object_duplicate (gcal->cal->corba_server, ev);
-}
-
-void
-init_corba_server (void)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- poa_manager = PortableServer_POA__get_the_POAManager (poa, &ev);
- if (ev._major != CORBA_NO_EXCEPTION){
- g_warning ("Can not get the POA manager");
- CORBA_exception_free (&ev);
- return;
- }
-
- PortableServer_POAManager_activate (poa_manager, &ev);
-
- /* First create the locator for the repositories as a factory object */
- calendar_vepv.GNOME_GenericFactory_epv = &calendar_epv;
- calendar_epv.supports = calendar_supports;
- calendar_epv.create_object = calendar_create_object;
-
- calendar_servant.vepv = &calendar_vepv;
- POA_GNOME_GenericFactory__init ((PortableServer_Servant) &calendar_servant, &ev);
- CORBA_free (PortableServer_POA_activate_object (
- poa, (PortableServer_Servant)&calendar_servant, &ev));
-
- calendar_factory = PortableServer_POA_servant_to_reference (
- poa, (PortableServer_Servant) &calendar_servant, &ev);
-
- goad_server_register (
- CORBA_OBJECT_NIL, calendar_factory,
- "IDL:GNOME:Calendar:RepositoryLocator:1.0", "object", &ev);
- CORBA_exception_free (&ev);
-}
-
-void
-unregister_calendar_services (void)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- goad_server_unregister (
- CORBA_OBJECT_NIL,
- "IDL:GNOME:Calendar:RepositoryLocator:1.0", "object", &ev);
- CORBA_exception_free (&ev);
-}
diff --git a/calendar/corba-cal-factory.h b/calendar/corba-cal-factory.h
deleted file mode 100644
index 5d3bcb3140..0000000000
--- a/calendar/corba-cal-factory.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _CORBA_CAL_FACTORY_H_
-#define _CORBA_CAL_FACTORY_H_
-
-/* The CORBA globals */
-CORBA_ORB orb;
-PortableServer_POA poa;
-
-void corba_server_init (void);
-void unregister_calendar_services (void);
-
-#endif /* _CORBA_CAL_FACTORY_H_ */
diff --git a/calendar/corba-cal.c b/calendar/corba-cal.c
deleted file mode 100644
index 472d83008e..0000000000
--- a/calendar/corba-cal.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * corba-cal.c: Service that provides access to the calendar repository
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-#include "alarm.h"
-#include "timeutil.h"
-#include "../libversit/vcc.h"
-#include <libgnorba/gnome-factory.h>
-#include "GnomeCal.h"
-#include "corba-cal-factory.h"
-#include "corba-cal.h"
-
-typedef struct {
- POA_GNOME_Calendar_Repository servant;
- GnomeCalendar *calendar;
-} CalendarServant;
-
-/*
- * Vectors
- */
-static POA_GNOME_Calendar_Repository__epv calendar_repository_epv;
-static POA_GNOME_Calendar_Repository__vepv calendar_repository_vepv;
-
-/*
- * Servant and Object Factory
- */
-static POA_GNOME_Calendar_Repository calendar_repository_servant;
-
-static inline GnomeCalendar *
-gnomecal_from_servant (PortableServer_Servant servant)
-{
- CalendarServant *cs = (CalendarServant *) servant;
-
- return cs->calendar;
-}
-
-static CORBA_char *
-cal_repo_get_object (PortableServer_Servant servant,
- const CORBA_char *uid,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
- char *buffer;
- CORBA_char *ret;
-
- obj = calendar_object_find_event (gcal->cal, uid);
- if (obj == NULL){
- GNOME_Calendar_Repository_NotFound *exn;
-
- exn = GNOME_Calendar_Repository_NotFound__alloc();
- CORBA_exception_set (
- ev,
- CORBA_USER_EXCEPTION,
- ex_GNOME_Calendar_Repository_NotFound,
- exn);
- return NULL;
- }
-
- buffer = calendar_string_from_object (obj);
- ret = CORBA_string_dup (buffer);
- free (buffer);
-
- return ret;
-}
-
-static CORBA_char *
-cal_repo_get_object_by_pilot_id (PortableServer_Servant servant,
- CORBA_long pilot_id,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
- char *buffer;
- CORBA_char *ret;
-
- obj = calendar_object_find_by_pilot (gcal->cal, pilot_id);
- if (obj == NULL){
- GNOME_Calendar_Repository_NotFound *exn;
-
- exn = GNOME_Calendar_Repository_NotFound__alloc();
- CORBA_exception_set (ev,
- CORBA_USER_EXCEPTION,
- ex_GNOME_Calendar_Repository_NotFound, exn);
- return NULL;
- }
-
- buffer = calendar_string_from_object (obj);
- ret = CORBA_string_dup (buffer);
- free (buffer);
-
- return ret;
-
-}
-
-static CORBA_char *
-cal_repo_get_id_from_pilot_id (PortableServer_Servant servant,
- CORBA_long pilot_id,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
-
- obj = calendar_object_find_by_pilot (gcal->cal, pilot_id);
- if (obj == NULL){
- GNOME_Calendar_Repository_NotFound *exn;
-
- exn = GNOME_Calendar_Repository_NotFound__alloc();
- CORBA_exception_set (ev,
- CORBA_USER_EXCEPTION,
- ex_GNOME_Calendar_Repository_NotFound, exn);
- return NULL;
- }
-
- return CORBA_string_dup (obj->uid);
-}
-
-static void
-cal_repo_delete_object (PortableServer_Servant servant,
- const CORBA_char *uid,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
-
- obj = calendar_object_find_event (gcal->cal, uid);
- if (obj == NULL){
- GNOME_Calendar_Repository_NotFound *exn;
-
- exn = GNOME_Calendar_Repository_NotFound__alloc();
- CORBA_exception_set (ev,
- CORBA_USER_EXCEPTION,
- ex_GNOME_Calendar_Repository_NotFound, exn);
- return;
- }
-
- gnome_calendar_remove_object (gcal, obj);
-}
-
-static void
-cal_repo_update_object (PortableServer_Servant servant,
- const CORBA_char *uid,
- const CORBA_char *vcalendar_object,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
- iCalObject *new_object;
-
- new_object = ical_object_new_from_string (vcalendar_object);
-
- obj = calendar_object_find_event (gcal->cal, uid);
- if (obj != NULL){
- calendar_remove_object (gcal->cal, obj);
- }
-
- calendar_add_object (gcal->cal, new_object);
-}
-
-static void
-cal_repo_update_pilot_id (PortableServer_Servant servant,
- const CORBA_char *uid,
- const CORBA_long pilot_id,
- const CORBA_long pilot_status,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
-
- obj = calendar_object_find_event (gcal->cal, uid);
- if (obj == NULL){
- GNOME_Calendar_Repository_NotFound *exn;
-
- exn = GNOME_Calendar_Repository_NotFound__alloc();
- CORBA_exception_set (
- ev,
- CORBA_USER_EXCEPTION,
- ex_GNOME_Calendar_Repository_NotFound,
- exn);
- return;
- }
-
- obj->pilot_id = pilot_id;
- obj->pilot_status = pilot_status;
-}
-
-static CORBA_char *
-cal_repo_get_objects (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- char *str;
- CORBA_char *res;
-
- str = calendar_get_as_vcal_string (gcal->cal);
- g_message("length of result is %d",strlen(str));
- res = CORBA_string_dup (str);
- free(str); /* ...get_as_vcal calls writeMemVObject, which uses realloc to
- allocate this string */
-
- return res;
-}
-
-static CORBA_long
-cal_repo_get_number_of_objects (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- return g_list_length(gcal->cal->events);
-}
-
-static GNOME_Calendar_Repository_String_Sequence*
-cal_repo_get_object_id_list(PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- GList *l;
- GNOME_Calendar_Repository_String_Sequence *result;
- int counter;
-
- result = GNOME_Calendar_Repository_String_Sequence__alloc();
- result->_length = g_list_length(gcal->cal->events);
- result->_buffer = CORBA_sequence_CORBA_string_allocbuf(result->_length);
-
- counter = 0;
- for (l = gcal->cal->events ; l; l = l->next){
- iCalObject *obj = l->data;
- result->_buffer[counter] = CORBA_string_dup(obj->uid);
- counter++;
- }
-
- return result;
-}
-
-static CORBA_char *
-cal_repo_get_updated_objects (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- Calendar *dirty_cal;
- GList *l;
- CORBA_char *res;
- char *str;
-
- dirty_cal = calendar_new ("Temporal");
-
- for (l = gcal->cal->events; l; l = l->next){
- iCalObject *obj = l->data;
-
- if (obj->pilot_status != ICAL_PILOT_SYNC_MOD)
- continue;
-
- obj = ical_object_duplicate (l->data);
-
- calendar_add_object (dirty_cal, obj);
- }
- str = calendar_get_as_vcal_string (dirty_cal);
- res = CORBA_string_dup (str);
- g_free (str);
- calendar_destroy (dirty_cal);
-
- return res;
-}
-
-static void
-cal_repo_done (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
-
- calendar_save (gcal->cal, NULL);
-}
-
-static void
-init_calendar_repo_class (void)
-{
- calendar_repository_epv.get_object = cal_repo_get_object;
- calendar_repository_epv.get_object_by_pilot_id = cal_repo_get_object_by_pilot_id;
- calendar_repository_epv.get_id_from_pilot_id = cal_repo_get_id_from_pilot_id;
- calendar_repository_epv.delete_object = cal_repo_delete_object;
- calendar_repository_epv.update_object = cal_repo_update_object;
- calendar_repository_epv.get_objects = cal_repo_get_objects;
- calendar_repository_epv.get_number_of_objects = cal_repo_get_number_of_objects;
- calendar_repository_epv.get_updated_objects = cal_repo_get_updated_objects;
- calendar_repository_epv.update_pilot_id = cal_repo_update_pilot_id;
- calendar_repository_epv.get_object_id_list = cal_repo_get_object_id_list;
-
- calendar_repository_epv.done = cal_repo_done;
-
- calendar_repository_vepv.GNOME_Calendar_Repository_epv =
- &calendar_repository_epv;
-
- calendar_repository_servant.vepv = &calendar_repository_vepv;
-}
-
-/*
- * Initializes the CORBA parts of the @calendar object
- */
-void
-gnome_calendar_create_corba_server (GnomeCalendar *calendar)
-{
- static gboolean class_inited = FALSE;
- CalendarServant *calendar_servant;
- CORBA_Environment ev;
-
- if (!class_inited){
- init_calendar_repo_class ();
- class_inited = TRUE;
- }
-
- calendar_servant = g_new0 (CalendarServant, 1);
- calendar_servant->servant.vepv = &calendar_repository_vepv;
- calendar_servant->calendar = calendar;
-
- CORBA_exception_init (&ev);
- POA_GNOME_Calendar_Repository__init ((PortableServer_Servant) calendar_servant, &ev);
- CORBA_free (
- PortableServer_POA_activate_object (poa, calendar_servant, &ev));
- calendar->cal->corba_server = PortableServer_POA_servant_to_reference (
- poa, calendar_servant, &ev);
- CORBA_exception_free (&ev);
-}
diff --git a/calendar/corba-cal.h b/calendar/corba-cal.h
deleted file mode 100644
index 47caacba70..0000000000
--- a/calendar/corba-cal.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _CORBA_CAL_H_
-#define _CORBA_CAL_H_
-
-void gnome_calendar_create_corba_server (GnomeCalendar *calendar);
-
-#endif /* _CORBA_CAL_H_ */
diff --git a/calendar/doc/.cvsignore b/calendar/doc/.cvsignore
deleted file mode 100644
index 282522db03..0000000000
--- a/calendar/doc/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-Makefile.in
diff --git a/calendar/doc/C/.cvsignore b/calendar/doc/C/.cvsignore
deleted file mode 100644
index 93942d6aa5..0000000000
--- a/calendar/doc/C/.cvsignore
+++ /dev/null
@@ -1,5 +0,0 @@
-Makefile
-Makefile.in
-gnomecal
-gnomecal.html
-gnomecal.junk
diff --git a/calendar/doc/C/Makefile.am b/calendar/doc/C/Makefile.am
deleted file mode 100644
index fbd3b63acf..0000000000
--- a/calendar/doc/C/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-gnomecal_helpdir = $(datadir)/gnome/help/gnomecal/C
-
-gnomecal_help_DATA = \
- gnomecal.html \
- topic.dat
-
-SGML_FILES = \
- gnomecal.sgml
-
-EXTRA_DIST = \
- topic.dat \
- $(SGML_FILES)
-
-all:
-
-gnomecal.html: gnomecal/gnomecal.html
- -cp gnomecal/gnomecal.html .
-
-gnomecal/gnomecal.html: $(SGML_FILES)
- -db2html gnomecal.sgml
-
-dist-hook:
- mkdir $(distdir)/gnomecal
- -cp gnomecal/*.html gnomecal/*.css $(distdir)/gnomecal
- -cp gnomecal.html $(distdir)
- mkdir $(distdir)/images
- -cp images/*.gif images/*.jpg $(distdir)/images
-
-install-data-local: gnomecal.html
- $(mkinstalldirs) $(DESTDIR)$(gnomecal_helpdir)/images
- -for file in $(srcdir)/gnomecal/*.html $(srcdir)/gnomecal/*.css; do \
- basefile=`basename $$file`; \
- $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$(gnomecal_helpdir)/$$basefile; \
- done
- -for file in $(srcdir)/images/*.jpg $(srcdir)/images/*.gif; do \
- $(INSTALL_DATA) $(srcdir)/$$file $(DESTDIR)$(gnomecal_helpdir)/images;\
- done
-
-gnomecal.ps: gnomecal.sgml
- -db2ps $<
-
-gnomecal.rtf: gnomecal.sgml
- -db2rtf $<
-
diff --git a/calendar/doc/C/gnomecal.sgml b/calendar/doc/C/gnomecal.sgml
deleted file mode 100644
index 00c9c8bb72..0000000000
--- a/calendar/doc/C/gnomecal.sgml
+++ /dev/null
@@ -1,465 +0,0 @@
-<!DOCTYPE book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
-]>
-
-<book id="gnomecal">
- <bookinfo>
- <title>GNOME calendar user's manual</title>
- <authorgroup>
- <author>
- <firstname>Dave</firstname> <surname>Mason</surname>
- <affiliation>
- <address>
- <email>dcm@redhat.com</email>
- </address>
- </affiliation>
- </author>
- <author>
- <firstname>Miguel</firstname> <surname>de Icaza
- Amozurrutia</surname>
- <affiliation>
- <address>
- <email>miguel@gnu.org</email>
- </address>
- </affiliation>
- </author>
- </authorgroup>
- <copyright>
- <year>1998, 1999</year> <holder>Miguel de Icaza, Dave Mason</holder>
- </copyright>
- <legalnotice>
- <para>This documentation 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.</para>
-
- <para>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.</para>
-
- <para>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</para>
-
- <para>For more details see the file COPYING in the source
- distribution of GNOME.</para>
- </legalnotice>
- </bookinfo>
-
- <toc></toc>
-
- <chapter id="cmdline">
- <title>Command line options</title>
-
- <para>
- The following command line options are recognized by the
- <filename>gnomecal</filename> program. You can use these
- options to alter the behaviour of the program or to quickly
- query the program for appointments, and to do items from the
- command line without requiring an X display. These are useful
- for example to include in scripts.
- </para>
-
- <para>
- <itemizedlist>
-
- <listitem>
- <para>
- <emphasis>--events</emphasis>. Displays the events for the
- date specified (or today, if no date is specified).
- </para>
- </listitem>
-
- <listitem>
- <para>
- <emphasis>--from DATE</emphasis>. Define the beginning of
- the range for the event display, or the startup day on the
- calenday views. By default, the event will span the whole
- day specified in DATE.
- </para>
- </listitem>
-
- <listitem>
- <para>
- <emphasis>--to DATE</emphasis>. Define the range end for
- the event display. If this is not specified, it will
- default to the end of the day specified by the
- <emphasis>--from</emphasis> option.
- </para>
- </listitem>
-
- <listitem>
- <para>
- <emphasis>--file FILE</emphasis>. Set the calendar to the
- <emphasis>FILE</emphasis> specified on the command line.
- </para>
- </listitem>
-
- <listitem>
- <para>
- <emphasis>--todo</emphasis>. Dumps the to-do values to
- standard output.
- </para>
- </listitem>
-
- <listitem>
- <para>
- <emphasis>--userfile</emphasis>. Use this if you want to
- force the file to be loaded to be the default user's
- calendar (this is the default, only used to override the
- --file if you have some sort of macro.
- </para>
- </listitem>
-
- <listitem>
- <para>
- <emphasis>--geometry</emphasis>. Used to specity the
- startup geometry of the application (location and size).
- </para>
- </listitem>
-
- <listitem>
- <para>
- <emphasis>--view VIEWMODE</emphasis>. Use this to specify
- the startup view that should be used.
- <emphasis>VIEWMODE</emphasis> is one of: dayview,
- weekview, monthview, yearview.
- </para>
- </listitem>
-
- </itemizedlist>
- </para>
-
- <para>
- <emphasis>DATE</emphasis> is interpreted as being in the local
- time-zone, unless a specific timezone is specified. Examples
- of valid date specifications include: "1 month ago", "2 hours
- ago", "400000 seconds ago", "last year", "last Monday",
- "yesterday", "a fortnight ago", "3/31/92 10:00:07 PST", "January
- 23, 1987 10:05pm", "22:00 GMT".
- </para>
- </chapter>
-
- <chapter id="tech.html">
- <title>Technical information about the GNOME calendar</title>
-
- <para>
- Currently, the GNOME calendar uses the vCal file format standard
- for storing and loading its appointment and todo database. This
- standard is widely used in various other calendar applications,
- so it provides a good mechanism for exchanging appointments.
- </para>
- <para>
- In the future the GNOME calendar will support the upcoming
- iCalendar specification as well.
- </para>
- <para>
- If you want to know more about the vCal specification, you can
- check the <ulink url="http://www.imc.org" type=http>Internet
- Mail Consortium (http://www.imc.org)</ulink> for the details.
- </para>
- </chapter>
-
- <chapter id="gcal">
- <title>The GNOME Calendar</title>
- <sect1>
- <title>Introduction</title>
- <para>
- <indexterm>
- <primary>
- GNOME Calendar
- </primary>
- </indexterm>
- <indexterm>
- <primary>
- Calendar
- </primary>
- </indexterm>
- The GNOME Calendar is a simple calendar applications which can be quite
- useful in your daily work. The Calendar, like much of GNOME, is in its
- infancy and while it is a very useful application, there is some very
- impressive functionality still to come like network shared calendar usage,
- and syncing capability with Palm Pilots and other hand held PDAs. The
- Calendar can be launched from the <guimenu>Applications</guimenu> submenu of
- the Main Menu.
- </para>
- <para>
- The Calendar is broken up into four main tabs: Day, Week, Month,
- and Year. Each view allows you to view the respective time period
- but will also allow you to schedule appointments from any one of
- the tabs.
- </para>
- <figure>
- <title>The GNOME Calendar</title>
- <screenshot>
- <screeninfo>The GNOME Calendar</screeninfo>
- <Graphic Format="gif" Fileref="images/calday" srccredit="dcm">
- </graphic>
- </screenshot>
- </figure>
- </sect1>
- <sect1 id="calsetup" <title>Setting Up the GNOME Calendar</title>
- <para>
- The GNOME Calendar can be used in the state which it is shipped but there
- are tools available to make sure it is setup the way you would like it to
- be. The first place you should go is the GNOME Calendar Preferences. You
- can find the Preferences dialog by selecting the
- <guimenuitem>Preferences</guimenuitem> menu item from the <guimenu>
- Settings</guimenu> menu.
- <figure>
- <title>The GNOME Calendar Preferences</title>
- <screenshot>
- <screeninfo>The GNOME Calendar Preferences.</screeninfo>
- <Graphic Format="gif" Fileref="images/cal-props" srccredit="dcm">
- </graphic>
- </screenshot>
- </figure>
- </para>
- <para>
- The Calendar Preferences dialog is broken up into three tabs, Time display,
- Colors, and Todo list.
- </para>
- <para>
- Time - This tab is broken up into three main sections: Time format, Weeks
- start on, and Day range.
- </para>
- <para>
- Time format - This allows you to choose between a 12 or 24 hour format
- clock.
- </para>
- <para>
- Weeks start on - This allows you to define what day your week will start
- on, Sunday or Monday. This will affect how the calendar is laid out in the
- Day and Week views.
- </para>
- <para>
- Day range - This section lets you choose what time your days will start
- and end. Any hours outside the range selected will be shaded on your Day
- view.
- </para>
- <para>
- Colors - This tab allows you to change the default colors used in the
- Calendar. There are seven color choices you can customize: Outline,
- Headings, Empty days, Appointments, Highlighted day, Day numbers, and
- Current day's number. Each choice has a small color selector box next to
- it. When you press this box you will be given a color selector dialog in
- which you can choose the color you want. Once you have selected a color the
- small sample calendar on the right side of the tab will preview your choice.
- </para>
- <para>
- Todo List - This tab allows you to define which columns will be shown in the
- Todo List in the Day View. You can set the Summary, Due Date, and Priority
- columns.
- </para>
- <para>
- Once you have made the changes to the Calendar Preferences you may press the
- <guibutton>Apply</guibutton> button to apply them.
- </para>
- </sect1>
- <sect1 id="caluse">
- <title>Using the GNOME Calendar</title>
- <para>
- Using the GNOME Calendar is quite simple and most tasks can be performed
- from any of the major views, Day, Week, Month or Year. Probably one of the
- most important features to remember is that at any time you may right mouse
- click on a particular day and add a new appointment. There are many other
- features which will be described below in each of the major views.
- </para>
- <sect2 id="calday">
- <title>The Day View</title>
- <para>
- The Day tab is probably the most useful view in the GNOME Calendar as it
- acts just as a day timer would. On the left of the tab is the hour listing
- for the current day. The light grey coloring in the hour list separates the
- work hours from the non-work hours. If you would like to change the work
- hours displayed in light grey you can do so in <xref
- LinkEnd="calsetup">.
- </para>
- <figure>
- <title>The Day View</title>
- <screenshot>
- <screeninfo>The Day View</screeninfo>
- <Graphic Format="gif" Fileref="images/calday" srccredit="dcm">
- </graphic>
- </screenshot>
- </figure>
- <tip>
- <title>TIP</title>
- <para>
- One tip for adding a new appointment in the Day View is to select a few
- hours in the hours list by clicking and dragging your mouse down the hours
- list. Once the correct range of time has been selected you may press Enter
- and type in the appointment. This will allow you to skip the Create New
- Appointment dialog.
- </para>
- </tip>
- <para>
- Next to the hours listing in the top right hand corner is a small full
- month calendar. You may change the month or year of the small month
- calendar by pressing the forward and backward arrows on the top. You may
- use the small month calendar to navigate the days as well. Double clicking
- on any day in the small month calendar will move the current day view to
- that particular day.
- </para>
- <para>
- Below the small month calendar is your Todo list. The Todo list is a
- simple list where you can keep all your tasks on hand. To add an item to
- the Todo list press the <guibutton>Add</guibutton> button. This will
- launch a small editing box where you can type in the item. Once you have
- entered an item in the Todo list you may use the
- <guibutton>Edit</guibutton> and <guibutton>Delete</guibutton> to manage
- your items. The Todo items are available no matter which days are displayed
- in the Day View and can only be deleted with the
- <guibutton>Delete</guibutton> button.
- </para>
- </sect2>
- <sect2 id="calweek">
- <title>The Week View</title>
- <para>
- The Week View shows the current week with detailed descriptions of your
- appointments. If you would like to add an appointment for any of the days
- in the week view you may right mouse click on the day and select the
- <guimenuitem>New appointment</guimenuitem> menu item from the
- <guimenu>pop-up</guimenu> menu. You may also use the week view to navigate
- to particular days in the Day View. Double-click on any day in the Week
- View and you will go to that day in the Day View.
- </para>
- <figure>
- <title>The Week View</title>
- <screenshot>
- <screeninfo>The Week View</screeninfo>
- <Graphic Format="gif" Fileref="images/calweek" srccredit="dcm">
- </graphic>
- </screenshot>
- </figure>
- <para>
- In the lower left corner of the Week View there is a small month calendar.
- You may change the month or year of the small month calendar by pressing
- the forward and backward arrows on the top. You may use the small month
- calendar to navigate the days as well. Double clicking on any day in the
- small month calendar will move the current week view to that particular
- week.
- </para>
- </sect2>
- <sect2 id="calmonth">
- <title>The Month View</title>
- <para>
- The Month View shows the entire month with brief detailed descriptions of
- your appointments. The Month View makes use of the customized colors
- available in the Calendar. You may read about how to set these colors in
- <xref Linkend="calsetup">. For any day with a brief description of an
- appointment you may click on the day to display a detailed description of
- the appointment in a pop-up window. If you would like to add an appointment
- to a day in the Month View you may right mouse click on any day and select
- the <guimenuitem>New Appointment in this day</guimenuitem> item from the
- <guimenu>pop-up</guimenu> menu. You may use the items in the
- <guimenu>pop-up</guimenu> menu to navigate in the Day, Week, and Year views
- by selecting either <guimenuitem>Jump to this day</guimenuitem>,
- <guimenuitem>Jump to this week</guimenuitem>, or<guimenuitem>Jump to this
- Year</guimenuitem>.
- </para>
- <figure>
- <title>The Month View</title>
- <screenshot>
- <screeninfo>The Month View</screeninfo>
- <Graphic Format="gif" Fileref="images/calmonth" srccredit="dcm">
- </graphic>
- </screenshot>
- </figure>
- </sect2>
- <sect2 id="calyear">
- <title>The Year View</title>
- <para>
- The Year View shows you the entire year with no descriptions of
- appointments. Like the Month View, the Year View makes use of the
- customized colors available in the Calendar. You may read about how to set
- these colors in <xref Linkend="calsetup">. If you have an appointment on a
- day you may click on that day and a description of the appointment will be
- displayed in the pop-up window. If you would like to add an appointment to
- a day in the Year View you may right mouse click on any day and select the
- <guimenuitem>New Appointment in this day</guimenuitem> item from the
- <guimenu>pop-up</guimenu> menu. You may use the items in the
- <guimenu>pop-up</guimenu> menu to navigate in the Day, Week, and Month
- views by selecting either <guimenuitem>Jump to this day</guimenuitem>,
- <guimenuitem>Jump to this week</guimenuitem>, or <guimenuitem>Jump to this
- Month</guimenuitem>.
- </para>
- <figure>
- <title>The Year View</title>
- <screenshot>
- <screeninfo>The Year View</screeninfo>
- <Graphic Format="gif" Fileref="images/calyear" srccredit="dcm">
- </graphic>
- </screenshot>
- </figure>
- </sect2>
- </sect1>
- <sect1 id="calappoint">
- <title>Making a New Appointment</title>
- <para>
- There are many methods for making a new appointment in the GNOME Calendar,
- the easiest is by pressing the <guibutton>New</guibutton> button on the
- button bar. Whenever you make a new appointment you will launch the Create
- New Appointment dialog that allows you to set the properties of that
- appointment. The Create New Appointment dialog is broken into two
- different tabs, the General and the Recurrence tabs.
- </para>
- <para>
- General - The General tab is the area in which you specify the time of the
- appointment and set reminders for yourself. There are four different areas
- on the General tab: Summary, Time, Alarms, and Classification.
- <ITEMIZEDLIST MARK="bullet">
- <listitem>
- <para>
- Summary - The Summary box allows you to type a description of the
- appointment. Keep in mind that only a portion of this description will
- be available in the Week and Month Views.
- </para>
- </listitem>
- <listitem>
- <para>
- Time - The Time area allows you to set the time range for the
- appointment by selecting the date and hours. To the right of the start
- and end days there is a small selection box named Calendar. This will
- bring up a small Calendar when pressed. You may select the start and end
- date in the small calendar. To the right of the start en end hours
- there is a small button which will display the hours of the day when
- pressed. Each hour in the list will have a sub menu displaying each
- quarter hour so you may select them. The hours are restricted to those
- included in the Day Range.
- </para>
- </listitem>
- <listitem>
- <para>
- Alarms - The Alarms area allows you to set up an alarm to remind you of
- an appointment. There are four different types of alarms you may use to
- remind yourself of appointments: Display, Audio, Program, and Mail. The
- Display alarm will display a message on your screen in the time you
- set. The Audio alarm will play an audio file at the time you set. The
- Program alarm will run a program you specify at the time you set. The
- Mail alarm will send email to the user specified at the time you set.
- </para>
- </listitem>
- <!-- <listitem>
- <para>
- Classification - TO BE DONE
- </para>
- </listitem> -->
- </itemizedlist>
- </para>
- <para>
- Recurrence - The Recurrence tab allows you to specify how often an
- appointment should recur, if at all. The first property you should set if
- you want a recurring appointment is the Recurrence rule. You may choose
- among None, Daily, Weekly, Monthly, and Yearly. For each selection you may
- adjust the recurrence properties for your selection. In the Ending date
- area you may set a rule which will stop the recurrence of your appointment
- or allow it to repeat forever. In the Exceptions area you may make
- exceptions to the recurring appointment by double-clicking the date and
- pressing the <guibutton>Add</guibutton> button.
- </para>
- </sect1>
- </chapter>
-</book>
diff --git a/calendar/doc/C/images/cal-props.gif b/calendar/doc/C/images/cal-props.gif
deleted file mode 100644
index 4a3ca0c706..0000000000
--- a/calendar/doc/C/images/cal-props.gif
+++ /dev/null
Binary files differ
diff --git a/calendar/doc/C/images/calday.gif b/calendar/doc/C/images/calday.gif
deleted file mode 100644
index d708cbb2e7..0000000000
--- a/calendar/doc/C/images/calday.gif
+++ /dev/null
Binary files differ
diff --git a/calendar/doc/C/images/calmonth.gif b/calendar/doc/C/images/calmonth.gif
deleted file mode 100644
index be20d3255c..0000000000
--- a/calendar/doc/C/images/calmonth.gif
+++ /dev/null
Binary files differ
diff --git a/calendar/doc/C/images/calweek.gif b/calendar/doc/C/images/calweek.gif
deleted file mode 100644
index 04820f9470..0000000000
--- a/calendar/doc/C/images/calweek.gif
+++ /dev/null
Binary files differ
diff --git a/calendar/doc/C/images/calyear.gif b/calendar/doc/C/images/calyear.gif
deleted file mode 100644
index 6e2333f419..0000000000
--- a/calendar/doc/C/images/calyear.gif
+++ /dev/null
Binary files differ
diff --git a/calendar/doc/C/topic.dat b/calendar/doc/C/topic.dat
deleted file mode 100644
index 23af169d62..0000000000
--- a/calendar/doc/C/topic.dat
+++ /dev/null
@@ -1,2 +0,0 @@
-gnomecal.html Manual
-cmdline.html Command line options
diff --git a/calendar/doc/Makefile.am b/calendar/doc/Makefile.am
deleted file mode 100644
index 42ffacc264..0000000000
--- a/calendar/doc/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = C
diff --git a/calendar/eventedit.c b/calendar/eventedit.c
deleted file mode 100644
index 5b45674d00..0000000000
--- a/calendar/eventedit.c
+++ /dev/null
@@ -1,1580 +0,0 @@
-/*
- * EventEditor widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors: Miguel de Icaza (miguel@kernel.org)
- * Federico Mena (quartic@gimp.org)
- */
-#include <config.h>
-#include <gnome.h>
-#include <string.h>
-#include "calendar.h"
-#include "eventedit.h"
-#include "main.h"
-#include "timeutil.h"
-
-
-static void event_editor_class_init (EventEditorClass *class);
-static void event_editor_init (EventEditor *ee);
-static void event_editor_destroy (GtkObject *object);
-
-GtkWidget* make_spin_button (int val, int low, int high);
-void ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType type,
- int y, gboolean control_sens, GtkSignalFunc dirty_func);
-void ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type);
-
-/* Note: do not i18n these strings, they are part of the vCalendar protocol */
-static char *class_names [] = { "PUBLIC", "PRIVATE", "CONFIDENTIAL" };
-
-static GnomeDialogClass *parent_class;
-
-struct numbered_item {
- char *text;
- int num;
-};
-
-
-guint
-event_editor_get_type (void)
-{
- static guint event_editor_type = 0;
-
- if(!event_editor_type) {
- GtkTypeInfo event_editor_info = {
- "EventEditor",
- sizeof(EventEditor),
- sizeof(EventEditorClass),
- (GtkClassInitFunc) event_editor_class_init,
- (GtkObjectInitFunc) event_editor_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
- event_editor_type = gtk_type_unique (gnome_dialog_get_type (), &event_editor_info);
- }
- return event_editor_type;
-}
-
-static void
-event_editor_class_init (EventEditorClass *class)
-{
- GtkObjectClass *object_class;
-
- parent_class = gtk_type_class (gnome_dialog_get_type ());
- object_class = (GtkObjectClass*) class;
- object_class->destroy = event_editor_destroy;
-}
-
-GtkWidget *
-make_spin_button (int val, int low, int high)
-{
- GtkAdjustment *adj;
- GtkWidget *spin;
-
- adj = GTK_ADJUSTMENT (gtk_adjustment_new (val, low, high, 1, 10, 10));
- spin = gtk_spin_button_new (adj, 0.5, 0);
- gtk_widget_set_usize (spin, 60, 0);
-
- return spin;
-}
-
-/*
- * Checks if the day range occupies all the day, and if so, check the
- * box accordingly
- */
-static void
-ee_check_all_day (EventEditor *ee)
-{
- time_t ev_start, ev_end;
-
- ev_start = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- ev_end = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- if (get_time_t_hour (ev_start) <= day_begin && get_time_t_hour (ev_end) >= day_end)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (ee->general_allday), 1);
- else
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (ee->general_allday), 0);
-}
-
-/*
- * Callback: checks that the dates are start < end
- */
-static void
-check_dates (GnomeDateEdit *gde, EventEditor *ee)
-{
- time_t start, end;
- struct tm tm_start, tm_end;
-
- start = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- end = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- if (start > end) {
- tm_start = *localtime (&start);
- tm_end = *localtime (&end);
-
- if (GTK_WIDGET (gde) == ee->start_time) {
- tm_end.tm_year = tm_start.tm_year;
- tm_end.tm_mon = tm_start.tm_mon;
- tm_end.tm_mday = tm_start.tm_mday;
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (&tm_end));
- } else if (GTK_WIDGET (gde) == ee->end_time) {
- tm_start.tm_year = tm_end.tm_year;
- tm_start.tm_mon = tm_end.tm_mon;
- tm_start.tm_mday = tm_end.tm_mday;
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (&tm_start));
- }
- }
-}
-
-/*
- * Callback: checks that start_time < end_time and whether the
- * selected hour range spans all of the day
- */
-static void
-check_times (GnomeDateEdit *gde, EventEditor *ee)
-{
- time_t start, end;
- struct tm tm_start, tm_end;
-
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gdk_flush ();
-
- start = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- end = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- if (start >= end) {
- tm_start = *localtime (&start);
- tm_end = *localtime (&end);
-
- if (GTK_WIDGET (gde) == ee->start_time) {
- tm_end.tm_min = tm_start.tm_min;
- tm_end.tm_sec = tm_start.tm_sec;
-
- tm_end.tm_hour = tm_start.tm_hour + 1;
-
- if (tm_end.tm_hour >= 24) {
- tm_end.tm_hour = 24; /* mktime() will bump the day */
- tm_end.tm_min = 0;
- tm_end.tm_sec = 0;
- }
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (&tm_end));
- } else if (GTK_WIDGET (gde) == ee->end_time) {
- tm_start.tm_min = tm_end.tm_min;
- tm_start.tm_sec = tm_end.tm_sec;
-
- tm_start.tm_hour = tm_end.tm_hour - 1;
-
- if (tm_start.tm_hour < 0) {
- tm_start.tm_hour = 0;
- tm_start.tm_min = 0;
- tm_start.tm_min = 0;
- }
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (&tm_start));
- }
- }
-
- /* Check whether the event spans the whole day */
-
- ee_check_all_day (ee);
-}
-
-/*
- * Callback: all day event box clicked
- */
-static void
-set_all_day (GtkToggleButton *toggle, EventEditor *ee)
-{
- struct tm tm;
- time_t start_t;
-
- start_t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- tm = *localtime (&start_t);
- tm.tm_hour = day_begin;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (&tm));
-
- if (toggle->active)
- tm.tm_hour = day_end;
- else
- tm.tm_hour++;
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (&tm));
-}
-
-/* Convenience function to create a properly-configured date editor widget */
-GtkWidget *
-date_edit_new (time_t the_time, int show_time)
-{
- return gnome_date_edit_new_flags (the_time,
- ((show_time ? GNOME_DATE_EDIT_SHOW_TIME : 0)
- | (am_pm_flag ? 0 : GNOME_DATE_EDIT_24_HR)
- | (week_starts_on_monday
- ? GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY
- : 0)));
-}
-
-static GtkWidget *
-event_editor_setup_time_frame (EventEditor *ee)
-{
- GtkWidget *frame;
- GtkWidget *start_time, *end_time;
- GtkTable *t;
-
- frame = gtk_frame_new (_("Time"));
- t = GTK_TABLE (ee->general_time_table = gtk_table_new (1, 1, 0));
- gtk_container_border_width (GTK_CONTAINER (t), 4);
- gtk_table_set_row_spacings (t, 4);
- gtk_table_set_col_spacings (t, 4);
- gtk_container_add (GTK_CONTAINER (frame), ee->general_time_table);
-
- /* 1. Start time */
- if (ee->ical->dtstart == 0){
- ee->ical->dtstart = time (NULL);
- ee->ical->dtend = time_add_minutes (ee->ical->dtstart, 30);
- }
- ee->start_time = start_time = date_edit_new (ee->ical->dtstart, TRUE);
- gnome_date_edit_set_popup_range ((GnomeDateEdit *) start_time, day_begin, day_end);
- gtk_signal_connect (GTK_OBJECT (start_time), "date_changed",
- GTK_SIGNAL_FUNC (check_dates), ee);
- gtk_signal_connect (GTK_OBJECT (start_time), "time_changed",
- GTK_SIGNAL_FUNC (check_times), ee);
- gtk_table_attach (t, gtk_label_new (_("Start time:")), 1, 2, 1, 2,
- GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
- gtk_table_attach (t, start_time, 2, 3, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- /* 2. End time */
- ee->end_time = end_time = date_edit_new (ee->ical->dtend, TRUE);
- gnome_date_edit_set_popup_range ((GnomeDateEdit *) end_time, day_begin, day_end);
- gtk_signal_connect (GTK_OBJECT (end_time), "date_changed",
- GTK_SIGNAL_FUNC (check_dates), ee);
- gtk_signal_connect (GTK_OBJECT (end_time), "time_changed",
- GTK_SIGNAL_FUNC (check_times), ee);
- gtk_table_attach (t, gtk_label_new (_("End time:")), 1, 2, 2, 3,
- GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
- gtk_table_attach (t, end_time, 2, 3, 2, 3,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- /* 3. All day checkbox */
- ee->general_allday = gtk_check_button_new_with_label (_("All day event"));
- gtk_signal_connect (GTK_OBJECT (ee->general_allday), "toggled",
- GTK_SIGNAL_FUNC (set_all_day), ee);
- gtk_table_attach (t, ee->general_allday, 3, 4, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 4, 0);
- ee_check_all_day (ee);
-
- return frame;
-}
-
-static GtkWidget *
-timesel_new (void)
-{
- GtkWidget *menu, *option_menu;
- char *items [] = { N_("Minutes"), N_("Hours"), N_("Days") };
- int i;
-
- option_menu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
- for (i = 0; i < 3; i++){
- GtkWidget *item;
-
- item = gtk_menu_item_new_with_label (_(items [i]));
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
- return option_menu;
-}
-
-/*
- * Set the sensitive state depending on whether the alarm enabled flag.
- */
-static void
-ee_alarm_setting (CalendarAlarm *alarm, int sensitive)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_count), sensitive);
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_timesel), sensitive);
-
- if (alarm->type == ALARM_PROGRAM || alarm->type == ALARM_MAIL){
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_entry), sensitive);
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_label), sensitive);
- }
-}
-
-static void
-alarm_toggle (GtkToggleButton *toggle, CalendarAlarm *alarm)
-{
- ee_alarm_setting (alarm, toggle->active);
-}
-
-#define FXS (GTK_FILL | GTK_EXPAND | GTK_SHRINK)
-#define FS (GTK_FILL | GTK_SHRINK)
-
-void
-ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType type, int y, gboolean control_sens, GtkSignalFunc dirty_func)
-{
- GtkWidget *entry;
-
- alarm->w_enabled = gtk_check_button_new_with_label (str);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (alarm->w_enabled),
- alarm->enabled);
- if (control_sens)
- gtk_signal_connect (GTK_OBJECT (alarm->w_enabled), "toggled",
- GTK_SIGNAL_FUNC (alarm_toggle), alarm);
- if (dirty_func)
- gtk_signal_connect (GTK_OBJECT (alarm->w_enabled), "toggled",
- GTK_SIGNAL_FUNC (dirty_func), NULL);
- gtk_table_attach (table, alarm->w_enabled, 0, 1, y, y+1, FS, FS, 0, 0);
-
- alarm->w_count = make_spin_button (alarm->count, 0, 10000);
- if (dirty_func)
- gtk_signal_connect (GTK_OBJECT (alarm->w_count), "changed",
- GTK_SIGNAL_FUNC (dirty_func), NULL);
- gtk_table_attach (table, alarm->w_count, 1, 2, y, y+1, FS, FS, 0, 0);
-
- alarm->w_timesel = timesel_new ();
- /* is there a "changed" signal which we can connect to? */
- gtk_option_menu_set_history (GTK_OPTION_MENU (alarm->w_timesel), alarm->units);
- gtk_table_attach (table, alarm->w_timesel, 2, 3, y, y+1, FS, FS, 0, 0);
-
- switch (type){
- case ALARM_MAIL:
- alarm->w_label = gtk_label_new (_("Mail to:"));
- gtk_misc_set_alignment (GTK_MISC (alarm->w_label), 1.0, 0.5);
- gtk_table_attach (table, alarm->w_label, 3, 4, y, y+1, FS, FS, 0, 0);
- alarm->w_entry = gtk_entry_new ();
- gtk_table_attach (table, alarm->w_entry, 4, 5, y, y+1, FXS, FS, 0, 0);
- gtk_entry_set_text (GTK_ENTRY (alarm->w_entry), alarm->data ? alarm->data : "");
- if (dirty_func)
- gtk_signal_connect (GTK_OBJECT (alarm->w_entry),
- "changed",
- GTK_SIGNAL_FUNC (dirty_func),
- NULL);
- break;
-
- case ALARM_PROGRAM:
- alarm->w_label = gtk_label_new (_("Run program:"));
- gtk_misc_set_alignment (GTK_MISC (alarm->w_label), 1.0, 0.5);
- gtk_table_attach (table, alarm->w_label, 3, 4, y, y+1, FS, FS, 0, 0);
- alarm->w_entry = gnome_file_entry_new ("alarm-program", _("Select program to run at alarm time"));
- entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (alarm->w_entry));
- gtk_entry_set_text (GTK_ENTRY (entry), alarm->data ? alarm->data : "");
- gtk_table_attach (table, alarm->w_entry, 4, 5, y, y+1, FXS, FS, 0, 0);
- if (dirty_func)
- gtk_signal_connect (GTK_OBJECT (entry),
- "changed",
- GTK_SIGNAL_FUNC (dirty_func),
- NULL);
- break;
-
- default:
- break;
- }
-
- if (control_sens)
- ee_alarm_setting (alarm, alarm->enabled);
- else
- ee_alarm_setting (alarm, TRUE);
-}
-
-static GtkWidget *
-ee_alarm_widgets (EventEditor *ee)
-{
- GtkWidget *table, *mailto, *mailte, *l;
-
- l = gtk_frame_new (_("Alarms"));
-
- table = gtk_table_new (1, 1, 0);
- gtk_container_border_width (GTK_CONTAINER (table), 4);
- gtk_table_set_row_spacings (GTK_TABLE (table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (table), 4);
- gtk_container_add (GTK_CONTAINER (l), table);
-
- mailto = gtk_label_new (_("Mail to:"));
- mailte = gtk_entry_new ();
-
- ee_create_ae (GTK_TABLE (table), _("Display"), &ee->ical->dalarm, ALARM_DISPLAY, 1, TRUE, NULL);
- ee_create_ae (GTK_TABLE (table), _("Audio"), &ee->ical->aalarm, ALARM_AUDIO, 2, TRUE, NULL);
- ee_create_ae (GTK_TABLE (table), _("Program"), &ee->ical->palarm, ALARM_PROGRAM, 3, TRUE, NULL);
- ee_create_ae (GTK_TABLE (table), _("Mail"), &ee->ical->malarm, ALARM_MAIL, 4, TRUE, NULL);
-
- return l;
-}
-
-static GtkWidget *
-ee_classification_widgets (EventEditor *ee)
-{
- GtkWidget *rpub, *rpriv, *rconf;
- GtkWidget *frame, *hbox;
-
- frame = gtk_frame_new (_("Classification"));
-
- hbox = gtk_hbox_new (TRUE, 0);
- gtk_container_border_width (GTK_CONTAINER (hbox), 4);
- gtk_container_add (GTK_CONTAINER (frame), hbox);
-
- rpub = gtk_radio_button_new_with_label (NULL, _("Public"));
- rpriv = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rpub), _("Private"));
- rconf = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rpub), _("Confidential"));
-
- gtk_box_pack_start (GTK_BOX (hbox), rpub, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), rpriv, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), rconf, FALSE, FALSE, 0);
-
- if (strcmp (ee->ical->class, class_names[0]) == 0)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (rpub), TRUE);
- else if (strcmp (ee->ical->class, class_names[1]) == 0)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (rpriv), TRUE);
- else if (strcmp (ee->ical->class, class_names[2]) == 0)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (rconf), TRUE);
-
- ee->general_radios = rpub;
-
- return frame;
-}
-
-/*
- * Retrieves the information from the CalendarAlarm widgets and stores them
- * on the CalendarAlarm generic values
- */
-void
-ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type)
-{
- GtkWidget *item;
- GtkMenu *menu;
- GList *child;
- int idx;
-
- if (alarm->data){
- g_free (alarm->data);
- alarm->data = 0;
- }
-
- alarm->enabled = GTK_TOGGLE_BUTTON (alarm->w_enabled)->active;
-
- if (!alarm->enabled)
- return;
-
- if (type == ALARM_PROGRAM)
- alarm->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (alarm->w_entry))));
- if (type == ALARM_MAIL)
- alarm->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (alarm->w_entry)));
-
- /* Find out the index */
- menu = GTK_MENU (GTK_OPTION_MENU (alarm->w_timesel)->menu);
-
- item = gtk_menu_get_active (menu);
-
- for (idx = 0, child = GTK_MENU_SHELL (menu)->children; child->data != item; child = child->next)
- idx++;
-
- alarm->units = idx;
- alarm->count = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (alarm->w_count));
-}
-
-static void
-ee_store_general_values_to_ical (EventEditor *ee)
-{
- GtkRadioButton *radio = GTK_RADIO_BUTTON (ee->general_radios);
- iCalObject *ical = ee->ical;
- GSList *list = radio->group;
- int idx;
- time_t now;
-
- now = time (NULL);
- ical->dtstart = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- ical->dtend = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- if (ical->summary)
- g_free (ical->summary);
-
- ical->summary = gtk_editable_get_chars (GTK_EDITABLE (ee->general_summary), 0, -1);
-
- ee_store_alarm (&ical->dalarm, ALARM_DISPLAY);
- ee_store_alarm (&ical->aalarm, ALARM_AUDIO);
- ee_store_alarm (&ical->palarm, ALARM_PROGRAM);
- ee_store_alarm (&ical->malarm, ALARM_MAIL);
-
- for (idx = 2; list; list = list->next) {
- if (GTK_TOGGLE_BUTTON (list->data)->active)
- break;
- idx--; /* The group is stored in reverse order of insertion */
- }
-
- g_free (ical->class);
- ical->class = g_strdup (class_names [idx]);
-}
-
-static int
-option_menu_active_number (GtkWidget *omenu)
-{
- GtkWidget *menu;
- GtkWidget *item;
- struct numbered_item *ni;
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (omenu));
- item = gtk_menu_get_active (GTK_MENU (menu));
-
- ni = gtk_object_get_user_data (GTK_OBJECT (item));
-
- return ni->num;
-}
-
-static int
-ee_store_recur_rule_to_ical (EventEditor *ee)
-{
- iCalObject *ical;
- int i, j;
- GSList *list;
-
- ical = ee->ical;
-
- for (i = 0, list = ee->recur_rr_group; list; i++, list = list->next)
- if (GTK_TOGGLE_BUTTON (list->data)->active)
- break;
-
- i = g_slist_length (ee->recur_rr_group) - i - 1; /* buttons are stored in reverse order of insertion */
-
- /* None selected, no rule to be stored */
- if (i == 0)
- return 0;
-
- if (!ical->recur)
- ical->recur = g_new0 (Recurrence, 1);
-
- switch (i) {
- case 1:
- /* Daily */
- ical->recur->type = RECUR_DAILY;
- ical->recur->interval = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ee->recur_rr_day_period));
- break;
-
- case 2:
- /* Weekly */
- ical->recur->type = RECUR_WEEKLY;
- ical->recur->interval = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ee->recur_rr_week_period));
- ical->recur->weekday = 0;
-
- for (j = 0; j < 7; j++)
- if (GTK_TOGGLE_BUTTON (ee->recur_rr_week_days[j])->active) {
- if (j == 6)
- ical->recur->weekday |= 1 << 0; /* sunday is at bit 0 */
- else
- ical->recur->weekday |= 1 << (j + 1);
- }
-
- break;
-
- case 3:
- /* Monthly */
-
- if (GTK_WIDGET_SENSITIVE (ee->recur_rr_month_date)) {
- /* by day */
-
- ical->recur->type = RECUR_MONTHLY_BY_DAY;
- ical->recur->u.month_day =
- gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (ee->recur_rr_month_date));
- ical->recur->interval =
- gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (ee->recur_rr_month_period));
- } else {
- /* by position */
-
- ical->recur->type = RECUR_MONTHLY_BY_POS;
-
- ical->recur->u.month_pos =
- option_menu_active_number (ee->recur_rr_month_day);
- ical->recur->weekday =
- option_menu_active_number (ee->recur_rr_month_weekday);
- ical->recur->interval =
- gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (ee->recur_rr_month_period));
- }
-
- break;
-
- case 4:
- /* Yearly */
- ical->recur->type = RECUR_YEARLY_BY_DAY;
- ical->recur->interval = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ee->recur_rr_year_period));
- /* FIXME: need to specify anything else? I am assuming the code will look at the dtstart
- * to figure out when to recur. - Federico
- */
- break;
-
- default:
- g_assert_not_reached ();
- }
- return 1;
-}
-
-static void
-ee_store_recur_end_to_ical (EventEditor *ee)
-{
- iCalObject *ical;
- GSList *list;
- int i;
-
- /* Ending date of recurrence */
-
- ical = ee->ical;
-
- for (i = 0, list = ee->recur_ed_group; list; i++, list = list->next)
- if (GTK_TOGGLE_BUTTON (list->data)->active)
- break;
-
- i = g_slist_length (ee->recur_ed_group) - i - 1; /* the list is stored in reverse order of insertion */
-
- switch (i) {
- case 0:
- /* repeat forever */
- ical->recur->_enddate = 0;
- ical->recur->enddate = 0;
- ical->recur->duration = 0;
- break;
-
- case 1:
- /* end date */
- ical->recur->_enddate = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->recur_ed_end_on));
- ical->recur->enddate = ical->recur->_enddate;
- ical->recur->duration = 0;
- break;
-
- case 2:
- /* end after n occurrences */
- ical->recur->duration = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ee->recur_ed_end_after));
- ical_object_compute_end (ical);
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-static void
-free_exdate (iCalObject *ical)
-{
- GList *list;
-
- if (!ical->exdate)
- return;
-
- for (list = ical->exdate; list; list = list->next)
- g_free (list->data);
-
- g_list_free (ical->exdate);
- ical->exdate = NULL;
-}
-
-static void
-ee_store_recur_exceptions_to_ical (EventEditor *ee)
-{
- iCalObject *ical;
- GtkCList *clist;
- int i;
- time_t *t;
-
- ical = ee->ical;
- clist = GTK_CLIST (ee->recur_ex_clist);
-
- free_exdate (ical);
-
- for (i = 0; i < clist->rows; i++) {
- t = gtk_clist_get_row_data (clist, i);
- ical->exdate = g_list_prepend (ical->exdate, t);
- }
-}
-
-static void
-ee_store_recur_values_to_ical (EventEditor *ee)
-{
- if (ee_store_recur_rule_to_ical (ee)){
- ee_store_recur_exceptions_to_ical (ee);
- ee_store_recur_end_to_ical (ee);
- } else if (ee->ical->recur) {
- g_free (ee->ical->recur);
- ee->ical->recur = NULL;
- if (ee->ical->exdate){
- GList *l = ee->ical->exdate;
-
- for (; l; l = l->next)
- g_free (l->data);
- g_list_free (l);
- }
- }
-}
-
-/*
- * Retrieves all of the information from the different widgets and updates
- * the iCalObject accordingly.
- */
-static void
-ee_store_dlg_values_to_ical (EventEditor *ee)
-{
- time_t now;
-
- ee_store_general_values_to_ical (ee);
- ee_store_recur_values_to_ical (ee);
-
- now = time (NULL);
-
- /* FIXME: This is not entirely correct; we should check if the values actually changed */
- ee->ical->last_mod = now;
-
- if (ee->ical->new)
- ee->ical->created = now;
-}
-
-static void
-ee_ok (GtkWidget *widget, EventEditor *ee)
-{
- ee_store_dlg_values_to_ical (ee);
-
- if (ee->ical->new)
- gnome_calendar_add_object (ee->gnome_cal, ee->ical);
- else
- gnome_calendar_object_changed (ee->gnome_cal, ee->ical, CHANGE_ALL);
-
- save_default_calendar (ee->gnome_cal);
- ee->ical->new = 0;
-}
-
-static void
-ee_cancel (GtkWidget *widget, EventEditor *ee)
-{
- if (ee->ical->new) {
- ical_object_destroy (ee->ical);
- ee->ical = NULL;
- }
-
-}
-
-static void
-ee_create_buttons (EventEditor *ee)
-{
- gnome_dialog_append_buttons(GNOME_DIALOG(ee),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL, NULL);
- gnome_dialog_set_default (GNOME_DIALOG (ee), 0);
- gnome_dialog_button_connect (GNOME_DIALOG (ee), 0, GTK_SIGNAL_FUNC(ee_ok), ee);
- gnome_dialog_button_connect (GNOME_DIALOG (ee), 1, GTK_SIGNAL_FUNC(ee_cancel), ee);
-
- return;
-}
-
-/*
- * Load the contents in a delayed fashion, as the GtkText widget needs it
- */
-static void
-ee_fill_summary (GtkWidget *widget, EventEditor *ee)
-{
- int pos = 0;
-
- gtk_editable_insert_text (GTK_EDITABLE (ee->general_summary), ee->ical->summary,
- strlen (ee->ical->summary), &pos);
- gtk_text_thaw (GTK_TEXT (ee->general_summary));
-}
-
-enum {
- OWNER_LINE,
- DESC_LINE,
- SUMMARY_LINE,
- TIME_LINE,
- ALARM_LINE,
- CLASS_LINE
-};
-
-/* Create/setup the general page */
-static void
-ee_init_general_page (EventEditor *ee)
-{
- GtkWidget *l;
- GtkWidget *hbox;
-
- ee->general_table = gtk_table_new (1, 1, FALSE);
- gtk_container_border_width (GTK_CONTAINER (ee->general_table), 4);
- gtk_table_set_row_spacings (GTK_TABLE (ee->general_table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (ee->general_table), 4);
- gtk_notebook_append_page (GTK_NOTEBOOK (ee->notebook), GTK_WIDGET (ee->general_table),
- gtk_label_new (_("General")));
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_table_attach (GTK_TABLE (ee->general_table), hbox,
- 0, 1, OWNER_LINE, OWNER_LINE + 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 4);
-
- l = gtk_label_new (_("Owner:"));
- gtk_box_pack_start (GTK_BOX (hbox), l, FALSE, FALSE, 0);
-
- ee->general_owner = gtk_label_new (ee->ical->organizer ? ee->ical->organizer : _("?"));
- gtk_misc_set_alignment (GTK_MISC (ee->general_owner), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (hbox), ee->general_owner, TRUE, TRUE, 4);
-
- l = gtk_label_new (_("Summary:"));
- gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (ee->general_table), l,
- 0, 1, DESC_LINE, DESC_LINE + 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- ee->general_summary = gtk_text_new (NULL, NULL);
- gtk_text_freeze (GTK_TEXT (ee->general_summary));
- gtk_signal_connect (GTK_OBJECT (ee->general_summary), "realize",
- GTK_SIGNAL_FUNC (ee_fill_summary), ee);
- gtk_widget_set_usize (ee->general_summary, 0, 60);
- gtk_text_set_editable (GTK_TEXT (ee->general_summary), 1);
- gtk_table_attach (GTK_TABLE (ee->general_table), ee->general_summary,
- 0, 1, SUMMARY_LINE, SUMMARY_LINE+1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- l = ee_alarm_widgets (ee);
- gtk_table_attach (GTK_TABLE (ee->general_table), l,
- 0, 1, ALARM_LINE, ALARM_LINE + 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- l = event_editor_setup_time_frame (ee);
- gtk_table_attach (GTK_TABLE (ee->general_table), l,
- 0, 1, TIME_LINE, TIME_LINE + 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- l = ee_classification_widgets (ee);
- gtk_table_attach (GTK_TABLE (ee->general_table), l,
- 0, 1, CLASS_LINE, CLASS_LINE + 1,
- GTK_EXPAND | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-}
-
-static void
-ee_init_summary_page (EventEditor *ee)
-{
-}
-
-struct {
- char *name;
-} recurrence_types [] = {
- { N_("None") },
- { N_("Daily") },
- { N_("Weekly") },
- { N_("Monthly") },
- { N_("Yearly") },
- { 0 }
-};
-
-static void
-recurrence_toggled (GtkRadioButton *radio, EventEditor *ee)
-{
- GSList *list = ee->recur_rr_group;
- int which;
-
- if (!GTK_TOGGLE_BUTTON (radio)->active)
- return;
-
- for (which = 0; list; list = list->next, which++) {
- if (list->data == radio) {
- gtk_notebook_set_page (GTK_NOTEBOOK (ee->recur_rr_notebook), 4 - which);
- return;
- }
- }
-}
-
-static struct numbered_item weekday_positions[] = {
- { N_("1st"), 1 },
- { N_("2nd"), 2 },
- { N_("3rd"), 3 },
- { N_("4th"), 4 },
- { N_("5th"), 5 },
- { 0 }
-};
-
-static struct numbered_item weekday_names[] = {
- { N_("Monday"), 1 },
- { N_("Tuesday"), 2 },
- { N_("Wednesday"), 3 },
- { N_("Thursday"), 4 },
- { N_("Friday"), 5 },
- { N_("Saturday"), 6 },
- { N_("Sunday"), 0 }, /* on the spec, Sunday is zero */
- { 0 }
-};
-
-static GtkWidget *
-make_numbered_menu (struct numbered_item *items, int sel)
-{
- GtkWidget *option_menu, *menu;
- int i;
-
- option_menu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
-
- for (i = 0; items[i].text; i++) {
- GtkWidget *item;
-
- item = gtk_menu_item_new_with_label (_(items[i].text));
- gtk_object_set_user_data (GTK_OBJECT (item), &items[i]);
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
- }
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), sel);
-
- return option_menu;
-}
-
-static void
-month_sensitize (EventEditor *ee, int state)
-{
- gtk_widget_set_sensitive (ee->recur_rr_month_date, state);
- gtk_widget_set_sensitive (ee->recur_rr_month_date_label, state);
-
- gtk_widget_set_sensitive (ee->recur_rr_month_day, !state);
- gtk_widget_set_sensitive (ee->recur_rr_month_weekday, !state);
-}
-
-static void
-recur_month_enable_date (GtkToggleButton *button, EventEditor *ee)
-{
- month_sensitize (ee, button->active);
-}
-
-static void
-desensitize_on_toggle (GtkToggleButton *toggle, gpointer data)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (data), !toggle->active);
-}
-
-static void
-ee_rp_init_rule (EventEditor *ee)
-{
- static char *day_names [] = { N_("Mon"), N_("Tue"), N_("Wed"), N_("Thu"), N_("Fri"), N_("Sat"), N_("Sun") };
- GtkWidget *r, *re, *r1, *f, *vbox, *hbox, *b, *week_hbox, *week_day, *w;
- GtkWidget *none, *daily, *weekly, *monthly, *yearly;
- GtkNotebook *notebook;
- GSList *group;
- int i, page, day_period, week_period, month_period, year_period;
- int week_vector, default_day, def_pos, def_off;
- struct tm tm;
-
- tm = *localtime (&ee->ical->dtstart);
-
- f = gtk_frame_new (_("Recurrence rule"));
-
- hbox = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (hbox), 4);
- gtk_container_add (GTK_CONTAINER (f), hbox);
-
- vbox = gtk_vbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (hbox), gtk_vseparator_new (), FALSE, FALSE, 0);
-
- ee->recur_rr_notebook = gtk_notebook_new ();
- notebook = GTK_NOTEBOOK (ee->recur_rr_notebook);
- gtk_box_pack_start (GTK_BOX (hbox), ee->recur_rr_notebook, TRUE, TRUE, 0);
-
- day_period = 1;
- week_period = 1;
- month_period = 1;
- year_period = 1;
-
- /* Default to today */
-
- week_vector = 1 << tm.tm_wday;
- default_day = tm.tm_mday;
- def_pos = 0;
- def_off = 0;
-
- /* Determine which should be the default selection */
-
- page = 0;
- if (ee->ical->recur) {
- enum RecurType type = ee->ical->recur->type;
- int interval = ee->ical->recur->interval;
-
- switch (type) {
- case RECUR_DAILY:
- page = 1;
- day_period = interval;
- break;
-
- case RECUR_WEEKLY:
- page = 2;
- week_period = interval;
- week_vector = ee->ical->recur->weekday;
- break;
-
- case RECUR_MONTHLY_BY_POS:
- page = 3;
- month_period = interval;
- def_pos = ee->ical->recur->u.month_pos;
- default_day = ee->ical->recur->weekday; /* you can't use u.month_pos and u.month_day-- it's a union... */
- break;
-
- case RECUR_MONTHLY_BY_DAY:
- page = 3;
- month_period = interval;
- default_day = ee->ical->recur->u.month_day;
- break;
-
- case RECUR_YEARLY_BY_MONTH:
- page = 4;
- year_period = interval;
- break;
-
- case RECUR_YEARLY_BY_DAY:
- page = 4;
- year_period = interval;
- break;
- }
- } else
- page = 0;
-
- /* The recurrency selector */
-
- for (i = 0, group = NULL; recurrence_types [i].name; i++) {
- r = gtk_radio_button_new_with_label (group, _(recurrence_types [i].name));
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (r));
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (r), i == page);
- gtk_signal_connect (GTK_OBJECT (r), "toggled", GTK_SIGNAL_FUNC (recurrence_toggled), ee);
- gtk_box_pack_start (GTK_BOX (vbox), r, FALSE, FALSE, 0);
-
- if (i == 0)
- gtk_signal_connect (GTK_OBJECT (r), "toggled",
- (GtkSignalFunc) desensitize_on_toggle,
- ee->recur_hbox);
- }
-
- ee->recur_rr_group = group;
-
- /* 0. No recurrence */
- none = gtk_label_new ("");
-
- /* 1. The daily recurrence */
-
- daily = gtk_vbox_new (FALSE, 0);
-
- b = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (daily), b, FALSE, FALSE, 0);
-
- ee->recur_rr_day_period = make_spin_button (day_period, 1, 10000);
- /* in some languages "Every" can follow the gender of the word it
- refers to (here "day(s)"). leave the two leadin letter "d_"
- in the translation they are ther on purpose */
- gtk_box_pack_start (GTK_BOX (b), gtk_label_new (_("d_Every") +2), FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (b), ee->recur_rr_day_period, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (b), gtk_label_new (_("day(s)")), FALSE, FALSE, 0);
-
- /* 2. The weekly recurrence */
-
- weekly = gtk_vbox_new (FALSE, 4);
-
- week_hbox = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (weekly), week_hbox, FALSE, FALSE, 0);
-
- /* 2.1 The week period selector */
-
- ee->recur_rr_week_period = make_spin_button (week_period, 1, 10000);
- /* in some languages "Every" can follow the gender of the word it
- refers to (here "week(s)"). leave the two leadin letter "w_"
- in the translation they are ther on purpose */
- gtk_box_pack_start (GTK_BOX (week_hbox), gtk_label_new (_("w_Every") +2), FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (week_hbox), ee->recur_rr_week_period, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (week_hbox), gtk_label_new (_("week(s)")), FALSE, FALSE, 0);
-
- /* 2.2 The week day selector */
-
- week_day = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (weekly), week_day, FALSE, FALSE, 0);
-
- for (i = 0; i < 7; i++) {
- ee->recur_rr_week_days [i] = gtk_check_button_new_with_label (_(day_names [i]));
- gtk_box_pack_start (GTK_BOX (week_day), ee->recur_rr_week_days [i], FALSE, FALSE, 0);
-
- if (week_vector & (1 << ((i + 1) % 7))) /* on the spec, Sunday is 0 */
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (ee->recur_rr_week_days [i]), TRUE);
- }
-
- /* 3. The monthly recurrence */
-
- monthly = gtk_table_new (0, 0, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (monthly), 4);
- gtk_table_set_col_spacings (GTK_TABLE (monthly), 4);
-
- re = gtk_radio_button_new_with_label (NULL, _("Recur on the"));
- ee->recur_rr_month_date = make_spin_button (default_day, 1, 31);
- ee->recur_rr_month_date_label = w = gtk_label_new (_("th day of the month"));
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (monthly), re,
- 0, 1, 0, 1, FS, FS, 0, 0);
- gtk_table_attach (GTK_TABLE (monthly), ee->recur_rr_month_date,
- 1, 2, 0, 1, FS, FS, 0, 0);
- gtk_table_attach (GTK_TABLE (monthly), w,
- 2, 3, 0, 1, FS, FS, 0, 0);
- gtk_signal_connect (GTK_OBJECT (re), "toggled", GTK_SIGNAL_FUNC (recur_month_enable_date), ee);
-
- r1 = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (re)), _("Recur on the"));
- ee->recur_rr_month_day = make_numbered_menu (weekday_positions, def_pos);
- ee->recur_rr_month_weekday = make_numbered_menu (weekday_names, default_day);
- gtk_table_attach (GTK_TABLE (monthly), r1,
- 0, 1, 1, 2, FS, FS, 0, 0);
- gtk_table_attach (GTK_TABLE (monthly), ee->recur_rr_month_day,
- 1, 2, 1, 2, FS, FS, 0, 0);
- gtk_table_attach (GTK_TABLE (monthly), ee->recur_rr_month_weekday,
- 2, 3, 1, 2, FS, FS, 0, 0);
-
- /* in some languages "Every" can follow the gender of the word it
- refers to (here "month(s)"). leave the two leadin letter "m_"
- in the translation they are ther on purpose */
- gtk_table_attach (GTK_TABLE (monthly), gtk_label_new (_("m_Every") +2),
- 3, 4, 0, 2, FS, FS, 0, 0);
- ee->recur_rr_month_period = make_spin_button (month_period, 1, 10000);
- gtk_table_attach (GTK_TABLE (monthly), ee->recur_rr_month_period,
- 4, 5, 0, 2, FS, FS, 0, 0);
- gtk_table_attach (GTK_TABLE (monthly), gtk_label_new (_("month(s)")),
- 5, 6, 0, 2, FS, FS, 0, 0);
-
- if (ee->ical->recur) {
- if (ee->ical->recur->type == RECUR_MONTHLY_BY_POS)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (r1), 1);
- } else
- recur_month_enable_date (GTK_TOGGLE_BUTTON (re), ee);
-
- /* 4. The yearly recurrence */
-
- yearly = gtk_vbox_new (FALSE, 0);
-
- b = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (yearly), b, FALSE, FALSE, 0);
-
- ee->recur_rr_year_period = make_spin_button (year_period, 1, 10000);
- /* in some languages "Every" can follow the gender of the word it
- refers to (here "year(s)"). leave the two leadin letter "y_"
- in the translation they are ther on purpose */
- gtk_box_pack_start (GTK_BOX (b), gtk_label_new (_("y_Every") +2), FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (b), ee->recur_rr_year_period, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (b), gtk_label_new (_("year(s)")), FALSE, FALSE, 0);
-
- /* Finish setting this up */
-
- gtk_notebook_append_page (notebook, none, gtk_label_new (""));
- gtk_notebook_append_page (notebook, daily, gtk_label_new (""));
- gtk_notebook_append_page (notebook, weekly, gtk_label_new (""));
- gtk_notebook_append_page (notebook, monthly, gtk_label_new (""));
- gtk_notebook_append_page (notebook, yearly, gtk_label_new (""));
- gtk_notebook_set_show_tabs (notebook, FALSE);
- gtk_notebook_set_show_border (notebook, FALSE);
-
- gtk_notebook_set_page (notebook, page);
-
- /* Attach to the main box */
-
- gtk_box_pack_start (GTK_BOX (ee->recur_vbox), f, FALSE, FALSE, 0);
-}
-
-static void
-sensitize_on_toggle (GtkToggleButton *toggle, gpointer data)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (data), toggle->active);
-}
-
-static void
-ee_rp_init_ending_date (EventEditor *ee)
-{
- GtkWidget *frame;
- GtkWidget *vbox;
- GSList *group;
- GtkWidget *radio0, *radio1, *radio2;
- GtkWidget *hbox;
- GtkWidget *ihbox;
- GtkWidget *widget;
- time_t enddate;
- int repeat;
-
- frame = gtk_frame_new (_("Ending date"));
-
- vbox = gtk_vbox_new (TRUE, 4);
- gtk_container_border_width (GTK_CONTAINER (vbox), 4);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- group = NULL;
-
- /* repeat forever */
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- radio0 = gtk_radio_button_new_with_label (group, _("Repeat forever"));
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio0));
- gtk_box_pack_start (GTK_BOX (hbox), radio0, FALSE, FALSE, 0);
-
- /* end on date */
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- radio1 = gtk_radio_button_new_with_label (group, _("End on"));
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio1));
- gtk_box_pack_start (GTK_BOX (hbox), radio1, FALSE, FALSE, 0);
-
- ihbox = gtk_hbox_new (FALSE, 4);
- gtk_widget_set_sensitive (ihbox, FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), ihbox, FALSE, FALSE, 0);
-
- if (ee->ical->recur)
- enddate = ee->ical->recur->enddate;
- else
- enddate = ee->ical->dtend;
-
- ee->recur_ed_end_on = widget = date_edit_new (enddate, FALSE);
- gtk_box_pack_start (GTK_BOX (ihbox), widget, FALSE, FALSE, 0);
-
- gtk_signal_connect (GTK_OBJECT (radio1), "toggled",
- (GtkSignalFunc) sensitize_on_toggle,
- ihbox);
-
- /* end after n occurrences */
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- radio2 = gtk_radio_button_new_with_label (group, _("End after"));
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio2));
- gtk_box_pack_start (GTK_BOX (hbox), radio2, FALSE, FALSE, 0);
-
- ihbox = gtk_hbox_new (FALSE, 4);
- gtk_widget_set_sensitive (ihbox, FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), ihbox, FALSE, FALSE, 0);
-
- if (ee->ical->recur && ee->ical->recur->duration)
- repeat = ee->ical->recur->duration;
- else
- repeat = 2;
-
- ee->recur_ed_end_after = widget = make_spin_button (repeat, 1, 10000);
- gtk_box_pack_start (GTK_BOX (ihbox), widget, FALSE, FALSE, 0);
-
- widget = gtk_label_new (_("occurrence(s)"));
- gtk_box_pack_start (GTK_BOX (ihbox), widget, FALSE, FALSE, 0);
-
- gtk_signal_connect (GTK_OBJECT (radio2), "toggled",
- (GtkSignalFunc) sensitize_on_toggle,
- ihbox);
-
- /* Activate appropriate item */
-
- if (ee->ical->recur) {
- if (ee->ical->recur->_enddate == 0) {
- if (ee->ical->recur->duration == 0)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (radio0), TRUE);
- else {
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (ee->recur_ed_end_after),
- ee->ical->recur->duration);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (radio2), TRUE);
- }
- } else {
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->recur_ed_end_on), ee->ical->recur->enddate);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (radio1), TRUE);
- }
- }
-
- /* Done, add to main table */
-
- ee->recur_ed_group = group;
-
- gtk_box_pack_start (GTK_BOX (ee->recur_hbox), frame, FALSE, FALSE, 0);
-}
-
-static char *
-get_exception_string (time_t t)
-{
- static char buf[256];
-
- strftime (buf, sizeof(buf), _("%a %b %d %Y"), localtime (&t));
- return buf;
-}
-
-static void
-append_exception (EventEditor *ee, time_t t)
-{
- time_t *tt;
- char *c[1];
- int i;
-
- c[0] = get_exception_string (t);
-
- tt = g_new (time_t, 1);
- *tt = t;
-
- i = gtk_clist_append (GTK_CLIST (ee->recur_ex_clist), c);
- gtk_clist_set_row_data (GTK_CLIST (ee->recur_ex_clist), i, tt);
- gtk_clist_select_row (GTK_CLIST (ee->recur_ex_clist), i, 0);
-
- gtk_widget_set_sensitive (ee->recur_ex_vbox, TRUE);
-}
-
-static void
-fill_exception_clist (EventEditor *ee)
-{
- GList *list;
-
- for (list = ee->ical->exdate; list; list = list->next)
- append_exception (ee, *((time_t *) list->data));
-}
-
-static void
-add_exception (GtkWidget *widget, EventEditor *ee)
-{
- time_t t;
-
- t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->recur_ex_date));
- append_exception (ee, t);
-}
-
-static void
-change_exception (GtkWidget *widget, EventEditor *ee)
-{
- GtkCList *clist;
- time_t *t;
- int sel;
-
- clist = GTK_CLIST (ee->recur_ex_clist);
- sel = GPOINTER_TO_INT(clist->selection->data);
-
- t = gtk_clist_get_row_data (clist, sel);
- *t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->recur_ex_date));
-
- gtk_clist_set_text (clist, sel, 0, get_exception_string (*t));
-}
-
-static void
-delete_exception (GtkWidget *widget, EventEditor *ee)
-{
- GtkCList *clist;
- int sel, length;
-
- clist = GTK_CLIST (ee->recur_ex_clist);
- sel = GPOINTER_TO_INT(clist->selection->data);
-
- g_free (gtk_clist_get_row_data (clist, sel)); /* free the time_t stored there */
-
- gtk_clist_remove (clist, sel);
- length = g_list_length(clist->row_list);
- if (sel >= length)
- sel--;
- gtk_clist_select_row (GTK_CLIST (ee->recur_ex_clist), sel, 0);
-
- if (clist->rows == 0)
- gtk_widget_set_sensitive (ee->recur_ex_vbox, FALSE);
-}
-
-static void
-ee_rp_init_exceptions (EventEditor *ee)
-{
- GtkWidget *frame;
- GtkWidget *hbox;
- GtkWidget *vbox;
- GtkWidget *ivbox;
- GtkWidget *widget;
- GtkWidget *sw;
-
- frame = gtk_frame_new (_("Exceptions"));
-
- hbox = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (hbox), 4);
- gtk_container_add (GTK_CONTAINER (frame), hbox);
-
- vbox = gtk_vbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
-
- ee->recur_ex_date = widget = date_edit_new (time (NULL), FALSE);
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
-
- widget = gtk_button_new_with_label (_("Add exception"));
- gtk_signal_connect (GTK_OBJECT (widget), "clicked",
- (GtkSignalFunc) add_exception,
- ee);
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
-
- ee->recur_ex_vbox = ivbox = gtk_vbox_new (FALSE, 4);
- gtk_widget_set_sensitive (ivbox, FALSE); /* at first there are no items to change or delete */
- gtk_box_pack_start (GTK_BOX (vbox), ivbox, FALSE, FALSE, 0);
-
- widget = gtk_button_new_with_label (_("Change selected"));
- gtk_signal_connect (GTK_OBJECT (widget), "clicked",
- (GtkSignalFunc) change_exception,
- ee);
- gtk_box_pack_start (GTK_BOX (ivbox), widget, FALSE, FALSE, 0);
-
- widget = gtk_button_new_with_label (_("Delete selected"));
- gtk_signal_connect (GTK_OBJECT (widget), "clicked",
- (GtkSignalFunc) delete_exception,
- ee);
- gtk_box_pack_start (GTK_BOX (ivbox), widget, FALSE, FALSE, 0);
-
- ee->recur_ex_clist = widget = gtk_clist_new (1);
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (sw), widget);
- gtk_clist_set_selection_mode (GTK_CLIST (widget), GTK_SELECTION_BROWSE);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- fill_exception_clist (ee);
- gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0);
-
- /* Done, add to main table */
-
- gtk_box_pack_start (GTK_BOX (ee->recur_hbox), frame, TRUE, TRUE, 0);
-}
-
-static void
-ee_init_recurrence_page (EventEditor *ee)
-{
- ee->recur_vbox = gtk_vbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (ee->recur_vbox), 4);
-
- ee->recur_hbox = gtk_hbox_new (FALSE, 4);
- gtk_widget_set_sensitive (ee->recur_hbox, FALSE);
-
- ee->recur_page_label = gtk_label_new (_("Recurrence"));
-
- gtk_notebook_append_page (GTK_NOTEBOOK (ee->notebook), ee->recur_vbox,
- ee->recur_page_label);
-
- ee_rp_init_rule (ee);
-
- /* pack here so that the box gets inserted after the recurrence rule frame */
- gtk_box_pack_start (GTK_BOX (ee->recur_vbox), ee->recur_hbox, FALSE, FALSE, 0);
-
- ee_rp_init_ending_date (ee);
- ee_rp_init_exceptions (ee);
-}
-
-static void
-event_editor_init_widgets (EventEditor *ee)
-{
- ee->notebook = gtk_notebook_new ();
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG(ee)->vbox), ee->notebook, 1, 1, 0);
-
- /* Init the various configuration pages */
- ee_init_general_page (ee);
- ee_init_summary_page (ee);
- ee_init_recurrence_page (ee);
-
- /* Buttons */
- ee_create_buttons(ee);
-
- /* We show all of the contained widgets */
- gtk_widget_show_all (GTK_BIN (ee)->child);
-}
-
-static void
-event_editor_init (EventEditor *ee)
-{
- ee->ical = 0;
- gnome_dialog_set_close (GNOME_DIALOG(ee), TRUE);
-}
-
-static void
-event_editor_destroy (GtkObject *object)
-{
- EventEditor *ee;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_EVENT_EDITOR (object));
-
- ee = EVENT_EDITOR (object);
-
- if (ee->ical)
- ee->ical->user_data = NULL; /* we are no longer editing it */
-}
-
-GtkWidget *
-event_editor_new (GnomeCalendar *gcal, iCalObject *ical)
-{
- GtkWidget *retval;
- EventEditor *ee;
-
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gdk_flush ();
-
- retval = gtk_type_new (event_editor_get_type ());
- ee = EVENT_EDITOR (retval);
-
- if (ical == 0){
- ical = ical_new ("", user_name, "");
- ical->new = 1;
- }
-
- if (ical->new){
- gtk_window_set_title (GTK_WINDOW (ee), _("Create new appointment"));
- } else {
- gtk_window_set_title (GTK_WINDOW (ee), _("Edit appointment"));
- }
-
- ical->user_data = ee; /* so that the world can know we are editing it */
-
- ee->ical = ical;
- ee->gnome_cal = gcal;
- event_editor_init_widgets (ee);
-
- return retval;
-}
-
-void
-event_editor_new_whole_day (GnomeCalendar *owner, time_t day)
-{
- struct tm tm;
- iCalObject *ico;
- GtkWidget *ee;
-
- g_return_if_fail (owner != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (owner));
-
- ico = ical_new ("", user_name, "");
- ico->new = TRUE;
-
- tm = *localtime (&day);
-
- /* Set the start time of the event to the beginning of the day */
-
- tm.tm_hour = day_begin;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- ico->dtstart = mktime (&tm);
-
- /* Set the end time of the event to the end of the day */
-
- tm.tm_hour = day_end;
- ico->dtend = mktime (&tm);
-
- /* Launch the event editor */
-
- ee = event_editor_new (owner, ico);
- gtk_widget_show (ee);
-}
diff --git a/calendar/eventedit.h b/calendar/eventedit.h
deleted file mode 100644
index 4d605892dd..0000000000
--- a/calendar/eventedit.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * EventEditor widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#ifndef EVENT_EDITOR_H
-#define EVENT_EDITOR_H
-
-#include "gnome-cal.h"
-#include <libgnomeui/gnome-dialog.h>
-
-BEGIN_GNOME_DECLS
-
-
-#define EVENT_EDITOR(obj) GTK_CHECK_CAST(obj, event_editor_get_type(), EventEditor)
-#define EVENT_EDITOR_CLASS(class) GTK_CHECK_CAST_CLASS(class, event_editor_get_type(), EventEditorClass)
-#define IS_EVENT_EDITOR(obj) GTK_CHECK_TYPE(obj, event_editor_get_type())
-
-
-typedef struct {
- GnomeDialog dialog;
- GtkWidget *notebook;
-
- GtkWidget *general;
- GtkWidget *general_table;
- GtkWidget *general_time_table;
- GtkWidget *general_allday;
- GtkWidget *general_owner;
- GtkWidget *general_summary;
- GtkWidget *start_time, *end_time;
- GtkWidget *general_radios;
-
- GtkWidget *recur_page_label;
- GtkWidget *recur_vbox;
- GtkWidget *recur_hbox;
-
- GSList *recur_rr_group;
- GtkWidget *recur_rr_notebook;
- GtkWidget *recur_rr_day_period;
- GtkWidget *recur_rr_week_period;
- GtkWidget *recur_rr_week_days [7];
- GtkWidget *recur_rr_month_date;
- GtkWidget *recur_rr_month_date_label;
- GtkWidget *recur_rr_month_day;
- GtkWidget *recur_rr_month_weekday;
- GtkWidget *recur_rr_month_period;
- GtkWidget *recur_rr_year_period;
-
- GSList *recur_ed_group;
- GtkWidget *recur_ed_end_on;
- GtkWidget *recur_ed_end_after;
-
- GtkWidget *recur_ex_date;
- GtkWidget *recur_ex_vbox;
- GtkWidget *recur_ex_clist;
-
- /* The associated ical object */
- iCalObject *ical;
-
- /* The calendar owner of this event */
- GnomeCalendar *gnome_cal;
-} EventEditor;
-
-typedef struct {
- GnomeDialogClass parent_class;
-} EventEditorClass;
-
-
-guint event_editor_get_type (void);
-GtkWidget *event_editor_new (GnomeCalendar *owner, iCalObject *);
-
-/* Convenience function to create and show a new event editor for an event that goes from day_begin
- * to day_end of the specified day.
- */
-void event_editor_new_whole_day (GnomeCalendar *owner, time_t day);
-
-GtkWidget *date_edit_new (time_t the_time, int show_time);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/getdate.y b/calendar/getdate.y
deleted file mode 100644
index 6df71bddda..0000000000
--- a/calendar/getdate.y
+++ /dev/null
@@ -1,1001 +0,0 @@
-%{
-/*
-** Originally) written by Steven M. Bellovin <smb@research.att.com> while
-** at the University of North Carolina at Chapel Hill. Later tweaked by
-** a couple of people on Usenet. Completely overhauled by Rich $alz
-** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
-** send any email to Rich.
-**
-** This grammar has 10 shift/reduce conflicts.
-**
-** This code is in the public domain and has no copyright.
-*/
-/* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */
-/* SUPPRESS 288 on yyerrlab *//* Label unused */
-
-#include <config.h>
-#include <gnome.h>
-
-/* Since the code of getdate.y is not included in the Emacs executable
- itself, there is no need to #define static in this file. Even if
- the code were included in the Emacs executable, it probably
- wouldn't do any harm to #undef it here; this will only cause
- problems if we try to write to a static variable, which I don't
- think this code needs to do. */
-#ifdef emacs
-#undef static
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-
-/* The code at the top of get_date which figures out the offset of the
- current time zone checks various CPP symbols to see if special
- tricks are need, but defaults to using the gettimeofday system call.
- Include <sys/time.h> if that will be used. */
-
-#if defined(vms)
-
-#include <types.h>
-#include <time.h>
-
-#else
-
-#include <sys/types.h>
-
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-
-#ifdef timezone
-#undef timezone /* needed for sgi */
-#endif
-
-#if defined(HAVE_SYS_TIMEB_H)
-#include <sys/timeb.h>
-#else
-/*
-** We use the obsolete `struct timeb' as part of our interface!
-** Since the system doesn't have it, we define it here;
-** our callers must do likewise.
-*/
-struct timeb {
- time_t time; /* Seconds since the epoch */
- unsigned short millitm; /* Field not used */
- short timezone; /* Minutes west of GMT */
- short dstflag; /* Field not used */
-};
-#endif /* defined(HAVE_SYS_TIMEB_H) */
-
-#endif /* defined(vms) */
-
-#if defined (STDC_HEADERS) || defined (USG)
-#include <string.h>
-#endif
-
-/* Some old versions of bison generate parsers that use bcopy.
- That loses on systems that don't provide the function, so we have
- to redefine it here. */
-#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
-#define bcopy(from, to, len) memcpy ((to), (from), (len))
-#endif
-
-#if defined (STDC_HEADERS)
-#include <stdlib.h>
-#endif
-
-/* NOTES on rebuilding getdate.c (particularly for inclusion in CVS
- releases):
-
- We don't want to mess with all the portability hassles of alloca.
- In particular, most (all?) versions of bison will use alloca in
- their parser. If bison works on your system (e.g. it should work
- with gcc), then go ahead and use it, but the more general solution
- is to use byacc instead of bison, which should generate a portable
- parser. I played with adding "#define alloca dont_use_alloca", to
- give an error if the parser generator uses alloca (and thus detect
- unportable getdate.c's), but that seems to cause as many problems
- as it solves. */
-
-extern struct tm *gmtime();
-extern struct tm *localtime();
-
-#define yyparse getdate_yyparse
-#define yylex getdate_yylex
-#define yyerror getdate_yyerror
-
-static int yylex ();
-static int yyerror ();
-
-#define EPOCH 1970
-#define HOUR(x) ((time_t)(x) * 60)
-#define SECSPERDAY (24L * 60L * 60L)
-
-
-/*
-** An entry in the lexical lookup table.
-*/
-typedef struct _TABLE {
- char *name;
- int type;
- time_t value;
-} TABLE;
-
-
-/*
-** Daylight-savings mode: on, off, or not yet known.
-*/
-typedef enum _DSTMODE {
- DSTon, DSToff, DSTmaybe
-} DSTMODE;
-
-/*
-** Meridian: am, pm, or 24-hour style.
-*/
-typedef enum _MERIDIAN {
- MERam, MERpm, MER24
-} MERIDIAN;
-
-
-/*
-** Global variables. We could get rid of most of these by using a good
-** union as the yacc stack. (This routine was originally written before
-** yacc had the %union construct.) Maybe someday; right now we only use
-** the %union very rarely.
-*/
-static char *yyInput;
-static DSTMODE yyDSTmode;
-static time_t yyDayOrdinal;
-static time_t yyDayNumber;
-static int yyHaveDate;
-static int yyHaveDay;
-static int yyHaveRel;
-static int yyHaveTime;
-static int yyHaveZone;
-static time_t yyTimezone;
-static time_t yyDay;
-static time_t yyHour;
-static time_t yyMinutes;
-static time_t yyMonth;
-static time_t yySeconds;
-static time_t yyYear;
-static MERIDIAN yyMeridian;
-static time_t yyRelMonth;
-static time_t yyRelSeconds;
-
-%}
-
-%union {
- time_t Number;
- enum _MERIDIAN Meridian;
-}
-
-%token tAGO tDAY tDAYZONE tID tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT
-%token tSEC_UNIT tSNUMBER tUNUMBER tZONE tDST
-
-%type <Number> tDAY tDAYZONE tMINUTE_UNIT tMONTH tMONTH_UNIT
-%type <Number> tSEC_UNIT tSNUMBER tUNUMBER tZONE
-%type <Meridian> tMERIDIAN o_merid
-
-%%
-
-spec : /* NULL */
- | spec item
- ;
-
-item : time {
- yyHaveTime++;
- }
- | zone {
- yyHaveZone++;
- }
- | date {
- yyHaveDate++;
- }
- | day {
- yyHaveDay++;
- }
- | rel {
- yyHaveRel++;
- }
- | number
- ;
-
-time : tUNUMBER tMERIDIAN {
- yyHour = $1;
- yyMinutes = 0;
- yySeconds = 0;
- yyMeridian = $2;
- }
- | tUNUMBER ':' tUNUMBER o_merid {
- yyHour = $1;
- yyMinutes = $3;
- yySeconds = 0;
- yyMeridian = $4;
- }
- | tUNUMBER ':' tUNUMBER tSNUMBER {
- yyHour = $1;
- yyMinutes = $3;
- yyMeridian = MER24;
- yyDSTmode = DSToff;
- yyTimezone = - ($4 % 100 + ($4 / 100) * 60);
- }
- | tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
- yyHour = $1;
- yyMinutes = $3;
- yySeconds = $5;
- yyMeridian = $6;
- }
- | tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER {
- yyHour = $1;
- yyMinutes = $3;
- yySeconds = $5;
- yyMeridian = MER24;
- yyDSTmode = DSToff;
- yyTimezone = - ($6 % 100 + ($6 / 100) * 60);
- }
- ;
-
-zone : tZONE {
- yyTimezone = $1;
- yyDSTmode = DSToff;
- }
- | tDAYZONE {
- yyTimezone = $1;
- yyDSTmode = DSTon;
- }
- |
- tZONE tDST {
- yyTimezone = $1;
- yyDSTmode = DSTon;
- }
- ;
-
-day : tDAY {
- yyDayOrdinal = 1;
- yyDayNumber = $1;
- }
- | tDAY ',' {
- yyDayOrdinal = 1;
- yyDayNumber = $1;
- }
- | tUNUMBER tDAY {
- yyDayOrdinal = $1;
- yyDayNumber = $2;
- }
- ;
-
-date : tUNUMBER '/' tUNUMBER {
- yyMonth = $1;
- yyDay = $3;
- }
- | tUNUMBER '/' tUNUMBER '/' tUNUMBER {
- yyMonth = $1;
- yyDay = $3;
- yyYear = $5;
- }
- | tUNUMBER tSNUMBER tSNUMBER {
- /* ISO 8601 format. yyyy-mm-dd. */
- yyYear = $1;
- yyMonth = -$2;
- yyDay = -$3;
- }
- | tUNUMBER tMONTH tSNUMBER {
- /* e.g. 17-JUN-1992. */
- yyDay = $1;
- yyMonth = $2;
- yyYear = -$3;
- }
- | tMONTH tUNUMBER {
- yyMonth = $1;
- yyDay = $2;
- }
- | tMONTH tUNUMBER ',' tUNUMBER {
- yyMonth = $1;
- yyDay = $2;
- yyYear = $4;
- }
- | tUNUMBER tMONTH {
- yyMonth = $2;
- yyDay = $1;
- }
- | tUNUMBER tMONTH tUNUMBER {
- yyMonth = $2;
- yyDay = $1;
- yyYear = $3;
- }
- ;
-
-rel : relunit tAGO {
- yyRelSeconds = -yyRelSeconds;
- yyRelMonth = -yyRelMonth;
- }
- | relunit
- ;
-
-relunit : tUNUMBER tMINUTE_UNIT {
- yyRelSeconds += $1 * $2 * 60L;
- }
- | tSNUMBER tMINUTE_UNIT {
- yyRelSeconds += $1 * $2 * 60L;
- }
- | tMINUTE_UNIT {
- yyRelSeconds += $1 * 60L;
- }
- | tSNUMBER tSEC_UNIT {
- yyRelSeconds += $1;
- }
- | tUNUMBER tSEC_UNIT {
- yyRelSeconds += $1;
- }
- | tSEC_UNIT {
- yyRelSeconds++;
- }
- | tSNUMBER tMONTH_UNIT {
- yyRelMonth += $1 * $2;
- }
- | tUNUMBER tMONTH_UNIT {
- yyRelMonth += $1 * $2;
- }
- | tMONTH_UNIT {
- yyRelMonth += $1;
- }
- ;
-
-number : tUNUMBER {
- if (yyHaveTime && yyHaveDate && !yyHaveRel)
- yyYear = $1;
- else {
- if($1>10000) {
- yyHaveDate++;
- yyDay= ($1)%100;
- yyMonth= ($1/100)%100;
- yyYear = $1/10000;
- }
- else {
- yyHaveTime++;
- if ($1 < 100) {
- yyHour = $1;
- yyMinutes = 0;
- }
- else {
- yyHour = $1 / 100;
- yyMinutes = $1 % 100;
- }
- yySeconds = 0;
- yyMeridian = MER24;
- }
- }
- }
- ;
-
-o_merid : /* NULL */ {
- $$ = MER24;
- }
- | tMERIDIAN {
- $$ = $1;
- }
- ;
-
-%%
-
-/* Month and day table. */
-static TABLE const MonthDayTable[] = {
- { N_("january"), tMONTH, 1 },
- { N_("february"), tMONTH, 2 },
- { N_("march"), tMONTH, 3 },
- { N_("april"), tMONTH, 4 },
- { N_("may"), tMONTH, 5 },
- { N_("june"), tMONTH, 6 },
- { N_("july"), tMONTH, 7 },
- { N_("august"), tMONTH, 8 },
- { N_("september"), tMONTH, 9 },
- { N_("sept"), tMONTH, 9 },
- { N_("october"), tMONTH, 10 },
- { N_("november"), tMONTH, 11 },
- { N_("december"), tMONTH, 12 },
- { N_("sunday"), tDAY, 0 },
- { N_("monday"), tDAY, 1 },
- { N_("tuesday"), tDAY, 2 },
- { N_("tues"), tDAY, 2 },
- { N_("wednesday"), tDAY, 3 },
- { N_("wednes"), tDAY, 3 },
- { N_("thursday"), tDAY, 4 },
- { N_("thur"), tDAY, 4 },
- { N_("thurs"), tDAY, 4 },
- { N_("friday"), tDAY, 5 },
- { N_("saturday"), tDAY, 6 },
- { NULL }
-};
-
-/* Time units table. */
-static TABLE const UnitsTable[] = {
- { N_("year"), tMONTH_UNIT, 12 },
- { N_("month"), tMONTH_UNIT, 1 },
- { N_("fortnight"), tMINUTE_UNIT, 14 * 24 * 60 },
- { N_("week"), tMINUTE_UNIT, 7 * 24 * 60 },
- { N_("day"), tMINUTE_UNIT, 1 * 24 * 60 },
- { N_("hour"), tMINUTE_UNIT, 60 },
- { N_("minute"), tMINUTE_UNIT, 1 },
- { N_("min"), tMINUTE_UNIT, 1 },
- { N_("second"), tSEC_UNIT, 1 },
- { N_("sec"), tSEC_UNIT, 1 },
- { NULL }
-};
-
-/* Assorted relative-time words. */
-static TABLE const OtherTable[] = {
- { N_("tomorrow"), tMINUTE_UNIT, 1 * 24 * 60 },
- { N_("yesterday"), tMINUTE_UNIT, -1 * 24 * 60 },
- { N_("today"), tMINUTE_UNIT, 0 },
- { N_("now"), tMINUTE_UNIT, 0 },
- { N_("last"), tUNUMBER, -1 },
- { N_("this"), tMINUTE_UNIT, 0 },
- { N_("next"), tUNUMBER, 2 },
- { N_("first"), tUNUMBER, 1 },
-/* { N_("second"), tUNUMBER, 2 }, */
- { N_("third"), tUNUMBER, 3 },
- { N_("fourth"), tUNUMBER, 4 },
- { N_("fifth"), tUNUMBER, 5 },
- { N_("sixth"), tUNUMBER, 6 },
- { N_("seventh"), tUNUMBER, 7 },
- { N_("eighth"), tUNUMBER, 8 },
- { N_("ninth"), tUNUMBER, 9 },
- { N_("tenth"), tUNUMBER, 10 },
- { N_("eleventh"), tUNUMBER, 11 },
- { N_("twelfth"), tUNUMBER, 12 },
- { N_("ago"), tAGO, 1 },
- { NULL }
-};
-
-/* The timezone table. */
-/* Some of these are commented out because a time_t can't store a float. */
-static TABLE const TimezoneTable[] = {
- { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */
- { "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */
- { "utc", tZONE, HOUR( 0) },
- { "wet", tZONE, HOUR( 0) }, /* Western European */
- { "bst", tDAYZONE, HOUR( 0) }, /* British Summer */
- { "wat", tZONE, HOUR( 1) }, /* West Africa */
- { "at", tZONE, HOUR( 2) }, /* Azores */
-#if 0
- /* For completeness. BST is also British Summer, and GST is
- * also Guam Standard. */
- { "bst", tZONE, HOUR( 3) }, /* Brazil Standard */
- { "gst", tZONE, HOUR( 3) }, /* Greenland Standard */
-#endif
-#if 0
- { "nft", tZONE, HOUR(3.5) }, /* Newfoundland */
- { "nst", tZONE, HOUR(3.5) }, /* Newfoundland Standard */
- { "ndt", tDAYZONE, HOUR(3.5) }, /* Newfoundland Daylight */
-#endif
- { "ast", tZONE, HOUR( 4) }, /* Atlantic Standard */
- { "adt", tDAYZONE, HOUR( 4) }, /* Atlantic Daylight */
- { "est", tZONE, HOUR( 5) }, /* Eastern Standard */
- { "edt", tDAYZONE, HOUR( 5) }, /* Eastern Daylight */
- { "cst", tZONE, HOUR( 6) }, /* Central Standard */
- { "cdt", tDAYZONE, HOUR( 6) }, /* Central Daylight */
- { "mst", tZONE, HOUR( 7) }, /* Mountain Standard */
- { "mdt", tDAYZONE, HOUR( 7) }, /* Mountain Daylight */
- { "pst", tZONE, HOUR( 8) }, /* Pacific Standard */
- { "pdt", tDAYZONE, HOUR( 8) }, /* Pacific Daylight */
- { "yst", tZONE, HOUR( 9) }, /* Yukon Standard */
- { "ydt", tDAYZONE, HOUR( 9) }, /* Yukon Daylight */
- { "hst", tZONE, HOUR(10) }, /* Hawaii Standard */
- { "hdt", tDAYZONE, HOUR(10) }, /* Hawaii Daylight */
- { "cat", tZONE, HOUR(10) }, /* Central Alaska */
- { "ahst", tZONE, HOUR(10) }, /* Alaska-Hawaii Standard */
- { "nt", tZONE, HOUR(11) }, /* Nome */
- { "idlw", tZONE, HOUR(12) }, /* International Date Line West */
- { "cet", tZONE, -HOUR(1) }, /* Central European */
- { "met", tZONE, -HOUR(1) }, /* Middle European */
- { "mewt", tZONE, -HOUR(1) }, /* Middle European Winter */
- { "mest", tDAYZONE, -HOUR(1) }, /* Middle European Summer */
- { "swt", tZONE, -HOUR(1) }, /* Swedish Winter */
- { "sst", tDAYZONE, -HOUR(1) }, /* Swedish Summer */
- { "fwt", tZONE, -HOUR(1) }, /* French Winter */
- { "fst", tDAYZONE, -HOUR(1) }, /* French Summer */
- { "eet", tZONE, -HOUR(2) }, /* Eastern Europe, USSR Zone 1 */
- { "bt", tZONE, -HOUR(3) }, /* Baghdad, USSR Zone 2 */
-#if 0
- { "it", tZONE, -HOUR(3.5) },/* Iran */
-#endif
- { "zp4", tZONE, -HOUR(4) }, /* USSR Zone 3 */
- { "zp5", tZONE, -HOUR(5) }, /* USSR Zone 4 */
-#if 0
- { "ist", tZONE, -HOUR(5.5) },/* Indian Standard */
-#endif
- { "zp6", tZONE, -HOUR(6) }, /* USSR Zone 5 */
-#if 0
- /* For completeness. NST is also Newfoundland Stanard, and SST is
- * also Swedish Summer. */
- { "nst", tZONE, -HOUR(6.5) },/* North Sumatra */
- { "sst", tZONE, -HOUR(7) }, /* South Sumatra, USSR Zone 6 */
-#endif /* 0 */
- { "wast", tZONE, -HOUR(7) }, /* West Australian Standard */
- { "wadt", tDAYZONE, -HOUR(7) }, /* West Australian Daylight */
-#if 0
- { "jt", tZONE, -HOUR(7.5) },/* Java (3pm in Cronusland!) */
-#endif
- { "cct", tZONE, -HOUR(8) }, /* China Coast, USSR Zone 7 */
- { "jst", tZONE, -HOUR(9) }, /* Japan Standard, USSR Zone 8 */
-#if 0
- { "cast", tZONE, -HOUR(9.5) },/* Central Australian Standard */
- { "cadt", tDAYZONE, -HOUR(9.5) },/* Central Australian Daylight */
-#endif
- { "east", tZONE, -HOUR(10) }, /* Eastern Australian Standard */
- { "eadt", tDAYZONE, -HOUR(10) }, /* Eastern Australian Daylight */
- { "gst", tZONE, -HOUR(10) }, /* Guam Standard, USSR Zone 9 */
- { "nzt", tZONE, -HOUR(12) }, /* New Zealand */
- { "nzst", tZONE, -HOUR(12) }, /* New Zealand Standard */
- { "nzdt", tDAYZONE, -HOUR(12) }, /* New Zealand Daylight */
- { "idle", tZONE, -HOUR(12) }, /* International Date Line East */
- { NULL }
-};
-
-/* Military timezone table. */
-static TABLE const MilitaryTable[] = {
- { "a", tZONE, HOUR( 1) },
- { "b", tZONE, HOUR( 2) },
- { "c", tZONE, HOUR( 3) },
- { "d", tZONE, HOUR( 4) },
- { "e", tZONE, HOUR( 5) },
- { "f", tZONE, HOUR( 6) },
- { "g", tZONE, HOUR( 7) },
- { "h", tZONE, HOUR( 8) },
- { "i", tZONE, HOUR( 9) },
- { "k", tZONE, HOUR( 10) },
- { "l", tZONE, HOUR( 11) },
- { "m", tZONE, HOUR( 12) },
- { "n", tZONE, HOUR(- 1) },
- { "o", tZONE, HOUR(- 2) },
- { "p", tZONE, HOUR(- 3) },
- { "q", tZONE, HOUR(- 4) },
- { "r", tZONE, HOUR(- 5) },
- { "s", tZONE, HOUR(- 6) },
- { "t", tZONE, HOUR(- 7) },
- { "u", tZONE, HOUR(- 8) },
- { "v", tZONE, HOUR(- 9) },
- { "w", tZONE, HOUR(-10) },
- { "x", tZONE, HOUR(-11) },
- { "y", tZONE, HOUR(-12) },
- { "z", tZONE, HOUR( 0) },
- { NULL }
-};
-
-
-
-
-/* ARGSUSED */
-static int
-yyerror(s)
- char *s;
-{
- return 0;
-}
-
-
-static time_t
-ToSeconds(Hours, Minutes, Seconds, Meridian)
- time_t Hours;
- time_t Minutes;
- time_t Seconds;
- MERIDIAN Meridian;
-{
- if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59)
- return -1;
- switch (Meridian) {
- case MER24:
- if (Hours < 0 || Hours > 23)
- return -1;
- return (Hours * 60L + Minutes) * 60L + Seconds;
- case MERam:
- if (Hours < 1 || Hours > 12)
- return -1;
- return (Hours * 60L + Minutes) * 60L + Seconds;
- case MERpm:
- if (Hours < 1 || Hours > 12)
- return -1;
- return ((Hours + 12) * 60L + Minutes) * 60L + Seconds;
- default:
- abort ();
- }
- /* NOTREACHED */
-}
-
-
-static time_t
-Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
- time_t Month;
- time_t Day;
- time_t Year;
- time_t Hours;
- time_t Minutes;
- time_t Seconds;
- MERIDIAN Meridian;
- DSTMODE DSTmode;
-{
- static int DaysInMonth[12] = {
- 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
- };
- time_t tod;
- time_t Julian;
- int i;
-
- if (Year < 0)
- Year = -Year;
- if (Year < 100)
- Year += 1900;
- DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
- ? 29 : 28;
- if (Year < EPOCH || Year > 1999
- || Month < 1 || Month > 12
- /* Lint fluff: "conversion from long may lose accuracy" */
- || Day < 1 || Day > DaysInMonth[(int)--Month])
- return -1;
-
- for (Julian = Day - 1, i = 0; i < Month; i++)
- Julian += DaysInMonth[i];
- for (i = EPOCH; i < Year; i++)
- Julian += 365 + (i % 4 == 0);
- Julian *= SECSPERDAY;
- Julian += yyTimezone * 60L;
- if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
- return -1;
- Julian += tod;
- if (DSTmode == DSTon
- || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
- Julian -= 60 * 60;
- return Julian;
-}
-
-
-static time_t
-DSTcorrect(Start, Future)
- time_t Start;
- time_t Future;
-{
- time_t StartDay;
- time_t FutureDay;
-
- StartDay = (localtime(&Start)->tm_hour + 1) % 24;
- FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
- return (Future - Start) + (StartDay - FutureDay) * 60L * 60L;
-}
-
-
-static time_t
-RelativeDate(Start, DayOrdinal, DayNumber)
- time_t Start;
- time_t DayOrdinal;
- time_t DayNumber;
-{
- struct tm *tm;
- time_t now;
-
- now = Start;
- tm = localtime(&now);
- now += SECSPERDAY * ((DayNumber - tm->tm_wday + 7) % 7);
- now += 7 * SECSPERDAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
- return DSTcorrect(Start, now);
-}
-
-
-static time_t
-RelativeMonth(Start, RelMonth)
- time_t Start;
- time_t RelMonth;
-{
- struct tm *tm;
- time_t Month;
- time_t Year;
-
- if (RelMonth == 0)
- return 0;
- tm = localtime(&Start);
- Month = 12 * tm->tm_year + tm->tm_mon + RelMonth;
- Year = Month / 12;
- Month = Month % 12 + 1;
- return DSTcorrect(Start,
- Convert(Month, (time_t)tm->tm_mday, Year,
- (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
- MER24, DSTmaybe));
-}
-
-
-static int
-LookupWord(buff)
- char *buff;
-{
- register char *p;
- register char *q;
- register const TABLE *tp;
- int i;
- int abbrev;
-
- /* Make it lowercase. */
- for (p = buff; *p; p++)
- if (isupper(*p))
- *p = tolower(*p);
-
- if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
- yylval.Meridian = MERam;
- return tMERIDIAN;
- }
- if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
- yylval.Meridian = MERpm;
- return tMERIDIAN;
- }
-
- /* See if we have an abbreviation for a month. */
- if (strlen(buff) == 3)
- abbrev = 1;
- else if (strlen(buff) == 4 && buff[3] == '.') {
- abbrev = 1;
- buff[3] = '\0';
- }
- else
- abbrev = 0;
-
- for (tp = MonthDayTable; tp->name; tp++) {
- if (abbrev) {
- if (strncmp(buff, tp->name, 3) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
- }
- else if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
- }
-
- for (tp = TimezoneTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- if (strcmp(buff, "dst") == 0)
- return tDST;
-
- for (tp = UnitsTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- /* Strip off any plural and try the units table again. */
- i = strlen(buff) - 1;
- if (buff[i] == 's') {
- buff[i] = '\0';
- for (tp = UnitsTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
- buff[i] = 's'; /* Put back for "this" in OtherTable. */
- }
-
- for (tp = OtherTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- /* Military timezones. */
- if (buff[1] == '\0' && isalpha(*buff)) {
- for (tp = MilitaryTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
- }
-
- /* Drop out any periods and try the timezone table again. */
- for (i = 0, p = q = buff; *q; q++)
- if (*q != '.')
- *p++ = *q;
- else
- i++;
- *p = '\0';
- if (i)
- for (tp = TimezoneTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- return tID;
-}
-
-
-static int
-yylex()
-{
- register char c;
- register char *p;
- char buff[20];
- int Count;
- int sign;
-
- for ( ; ; ) {
- while (isspace(*yyInput))
- yyInput++;
-
- if (isdigit(c = *yyInput) || c == '-' || c == '+') {
- if (c == '-' || c == '+') {
- sign = c == '-' ? -1 : 1;
- if (!isdigit(*++yyInput))
- /* skip the '-' sign */
- continue;
- }
- else
- sign = 0;
- for (yylval.Number = 0; isdigit(c = *yyInput++); )
- yylval.Number = 10 * yylval.Number + c - '0';
- yyInput--;
- if (sign < 0)
- yylval.Number = -yylval.Number;
- return sign ? tSNUMBER : tUNUMBER;
- }
- if (isalpha(c)) {
- for (p = buff; isalpha(c = *yyInput++) || c == '.'; )
- if (p < &buff[sizeof buff - 1])
- *p++ = c;
- *p = '\0';
- yyInput--;
- return LookupWord(buff);
- }
- if (c != '(')
- return *yyInput++;
- Count = 0;
- do {
- c = *yyInput++;
- if (c == '\0')
- return c;
- if (c == '(')
- Count++;
- else if (c == ')')
- Count--;
- } while (Count > 0);
- }
-}
-
-#define TM_YEAR_ORIGIN 1900
-
-/* Yield A - B, measured in seconds. */
-static long
-difftm (a, b)
- struct tm *a, *b;
-{
- int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
- int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
- int days = (
- /* difference in day of year */
- a->tm_yday - b->tm_yday
- /* + intervening leap days */
- + ((ay >> 2) - (by >> 2))
- - (ay/100 - by/100)
- + ((ay/100 >> 2) - (by/100 >> 2))
- /* + difference in years * 365 */
- + (long)(ay-by) * 365
- );
- return (60*(60*(24*days + (a->tm_hour - b->tm_hour))
- + (a->tm_min - b->tm_min))
- + (a->tm_sec - b->tm_sec));
-}
-
-time_t
-get_date(p, now)
- char *p;
- struct timeb *now;
-{
- struct tm *tm, gmt;
- struct timeb ftz;
- time_t Start;
- time_t tod;
- time_t nowtime;
-
- yyInput = p;
- if (now == NULL) {
- now = &ftz;
- (void)time (&nowtime);
-
- if (! (tm = gmtime (&nowtime)))
- return -1;
- gmt = *tm; /* Make a copy, in case localtime modifies *tm. */
-
- if (! (tm = localtime (&nowtime)))
- return -1;
-
- ftz.timezone = difftm (&gmt, tm) / 60;
- if(tm->tm_isdst)
- ftz.timezone += 60;
- }
- else
- {
- nowtime = now->time;
- }
-
- tm = localtime(&nowtime);
- yyYear = tm->tm_year;
- yyMonth = tm->tm_mon + 1;
- yyDay = tm->tm_mday;
- yyTimezone = now->timezone;
- yyDSTmode = DSTmaybe;
- yyHour = 0;
- yyMinutes = 0;
- yySeconds = 0;
- yyMeridian = MER24;
- yyRelSeconds = 0;
- yyRelMonth = 0;
- yyHaveDate = 0;
- yyHaveDay = 0;
- yyHaveRel = 0;
- yyHaveTime = 0;
- yyHaveZone = 0;
-
- if (yyparse()
- || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
- return -1;
-
- if (yyHaveDate || yyHaveTime || yyHaveDay) {
- Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
- yyMeridian, yyDSTmode);
- if (Start < 0)
- return -1;
- }
- else {
- Start = nowtime;
- if (!yyHaveRel)
- Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) + tm->tm_sec;
- }
-
- Start += yyRelSeconds;
- Start += RelativeMonth(Start, yyRelMonth);
-
- if (yyHaveDay && !yyHaveDate) {
- tod = RelativeDate(Start, yyDayOrdinal, yyDayNumber);
- Start += tod;
- }
-
- /* Have to do *something* with a legitimate -1 so it's distinguishable
- * from the error return value. (Alternately could set errno on error.) */
- return Start == -1 ? 0 : Start;
-}
-
-
-#if defined(TEST)
-
-/* ARGSUSED */
-int
-main(ac, av)
- int ac;
- char *av[];
-{
- char buff[128];
- time_t d;
-
- (void)printf("Enter date, or blank line to exit.\n\t> ");
- (void)fflush(stdout);
- while (gets(buff) && buff[0]) {
- d = get_date(buff, (struct timeb *)NULL);
- if (d == -1)
- (void)printf("Bad format - couldn't convert.\n");
- else
- (void)printf("%s", ctime(&d));
- (void)printf("\t> ");
- (void)fflush(stdout);
- }
- exit(0);
- /* NOTREACHED */
-}
-#endif /* defined(TEST) */
diff --git a/calendar/gncal-day-panel.c b/calendar/gncal-day-panel.c
deleted file mode 100644
index f407a497d3..0000000000
--- a/calendar/gncal-day-panel.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/* Day view notebook panel for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <gtk/gtkhseparator.h>
-#include "gncal-day-panel.h"
-#include "main.h"
-#include "timeutil.h"
-
-
-guint
-gncal_day_panel_get_type (void)
-{
- static guint day_panel_type = 0;
-
- if (!day_panel_type) {
- GtkTypeInfo day_panel_info = {
- "GncalDayPanel",
- sizeof (GncalDayPanel),
- sizeof (GncalDayPanelClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) NULL,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- day_panel_type = gtk_type_unique (gtk_table_get_type (), &day_panel_info);
- }
-
- return day_panel_type;
-}
-
-static void
-day_view_range_activated (GncalFullDay *fullday, GncalDayPanel *dpanel)
-{
- iCalObject *ical;
-
- ical = ical_new ("", user_name, "");
- ical->new = 1;
-
- gncal_full_day_selection_range (fullday, &ical->dtstart, &ical->dtend);
-
- gnome_calendar_add_object (dpanel->calendar, ical);
- save_default_calendar (dpanel->calendar);
- gncal_full_day_focus_child (fullday, ical);
-}
-
-static void
-full_day_size_allocated (GtkWidget *widget, GtkAllocation *allocation, GncalDayPanel *dpanel)
-{
- GtkAdjustment *adj;
- int yoffset;
- gfloat newval;
-
- adj = gtk_scrolled_window_get_vadjustment (dpanel->fullday_sw);
-
- yoffset = gncal_full_day_get_day_start_yoffset (GNCAL_FULL_DAY (widget));
-
- newval = adj->lower + (adj->upper - adj->lower) * (double) yoffset / allocation->height;
- if (newval != adj->value)
- gtk_signal_emit_by_name (GTK_OBJECT (adj), "value_changed");
-}
-
-static void
-calendar_day_selected (GtkCalendar *calendar, GncalDayPanel *dpanel)
-{
- gint y, m, d;
- struct tm tm;
-
- gtk_calendar_get_date (calendar, &y, &m, &d);
-
- tm.tm_year = y - 1900;
- tm.tm_mon = m;
- tm.tm_mday = d;
- tm.tm_hour = 5; /* for daylight savings time fix */
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- gnome_calendar_goto (dpanel->calendar, mktime (&tm));
-}
-
-static void
-retag_calendar (GtkCalendar *calendar, GncalDayPanel *dpanel)
-{
- gnome_calendar_tag_calendar (dpanel->calendar, GTK_CALENDAR (dpanel->gtk_calendar));
-}
-
-GtkWidget *
-gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day)
-{
- GncalDayPanel *dpanel;
- GtkWidget *w;
- GtkWidget *hpane, *vpane;
- gint start_pos = 265;
- struct tm tm;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- dpanel = gtk_type_new (gncal_day_panel_get_type ());
-
- gtk_container_border_width (GTK_CONTAINER (dpanel), 4);
- gtk_table_set_row_spacings (GTK_TABLE (dpanel), 4);
- gtk_table_set_col_spacings (GTK_TABLE (dpanel), 4);
-
- dpanel->calendar = calendar;
-
- /* Date label */
-
- w = gtk_label_new ("");
- dpanel->date_label = GTK_LABEL (w);
- gtk_table_attach (GTK_TABLE (dpanel), w,
- 0, 1, 0, 1,
- GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
- gtk_widget_show (w);
-
- /* Create horizontal pane */
-
- hpane = gtk_hpaned_new ();
- gtk_table_attach (GTK_TABLE (dpanel), hpane,
- 0, 1, 2, 4,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- /* Full day */
-
- w = gtk_scrolled_window_new (NULL, NULL);
- dpanel->fullday_sw = GTK_SCROLLED_WINDOW (w);
- gtk_scrolled_window_set_policy (dpanel->fullday_sw,
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_paned_pack1 (GTK_PANED (hpane), w, FALSE, TRUE);
- /*gtk_paned_add1 (GTK_PANED (hpane), w);*/
- gtk_widget_show (w);
-
- w = gncal_full_day_new (calendar, time_day_begin (start_of_day), time_day_end (start_of_day));
- dpanel->fullday = GNCAL_FULL_DAY (w);
- gtk_signal_connect (GTK_OBJECT (dpanel->fullday), "range_activated",
- (GtkSignalFunc) day_view_range_activated,
- dpanel);
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (dpanel->fullday_sw), w);
- gtk_widget_show (w);
-
- /* We'll scroll the list to the proper initial position */
-
- gtk_signal_connect (GTK_OBJECT (dpanel->fullday), "size_allocate",
- (GtkSignalFunc) full_day_size_allocated,
- dpanel);
-
- /* Create vertical pane */
-
- vpane = gtk_vpaned_new ();
- gtk_paned_pack2 (GTK_PANED (hpane), GTK_WIDGET (vpane), TRUE, TRUE);
- /*gtk_paned_add2 (GTK_PANED (hpane), GTK_WIDGET (vpane));*/
-
- /* Gtk calendar */
-
- tm = *localtime (&start_of_day);
-
- w = gtk_calendar_new ();
- dpanel->gtk_calendar = GTK_CALENDAR (w);
- gtk_calendar_display_options (dpanel->gtk_calendar,
- (GTK_CALENDAR_SHOW_HEADING
- | GTK_CALENDAR_SHOW_DAY_NAMES
- | (week_starts_on_monday
- ? GTK_CALENDAR_WEEK_START_MONDAY : 0)));
- gtk_calendar_select_month (dpanel->gtk_calendar, tm.tm_mon, tm.tm_year + 1900);
- gtk_calendar_select_day (dpanel->gtk_calendar, tm.tm_mday);
- dpanel->day_selected_id = gtk_signal_connect (GTK_OBJECT (dpanel->gtk_calendar),
- "day_selected_double_click",
- (GtkSignalFunc) calendar_day_selected,
- dpanel);
- gtk_signal_connect (GTK_OBJECT (dpanel->gtk_calendar), "month_changed",
- GTK_SIGNAL_FUNC (retag_calendar), dpanel);
- gtk_paned_add1 (GTK_PANED (vpane), w);
- gtk_widget_show (w);
-
- /* To-do */
-
- w = gncal_todo_new (calendar);
- dpanel->todo = GNCAL_TODO (w);
- gtk_paned_add2 (GTK_PANED (vpane), w);
- gtk_widget_show (w);
-
- /* Done */
-
- gncal_day_panel_set (dpanel, start_of_day);
-
- gtk_paned_set_position (GTK_PANED (hpane), start_pos);
-
- return GTK_WIDGET (dpanel);
-}
-
-static void
-update (GncalDayPanel *dpanel, int update_fullday, iCalObject *ico, int flags)
-{
- char buf [80];
-
- if (update_fullday){
- gncal_full_day_update (dpanel->fullday, ico, flags);
- retag_calendar (dpanel->gtk_calendar, dpanel);
- }
- gncal_todo_update (dpanel->todo, ico, flags);
-
- strftime (buf, sizeof (buf), _("%a %b %d %Y"), localtime (&dpanel->start_of_day));
- gtk_label_set (GTK_LABEL (dpanel->date_label), buf);
-}
-
-void
-gncal_day_panel_update (GncalDayPanel *dpanel, iCalObject *ico, int flags)
-{
- g_return_if_fail (dpanel != NULL);
- g_return_if_fail (GNCAL_IS_DAY_PANEL (dpanel));
-
- update (dpanel, TRUE, ico, flags);
-}
-
-void
-gncal_day_panel_set (GncalDayPanel *dpanel, time_t start_of_day)
-{
- char buf[80];
- struct tm tm;
-
- g_return_if_fail (dpanel != NULL);
- g_return_if_fail (GNCAL_IS_DAY_PANEL (dpanel));
-
- dpanel->start_of_day = time_day_begin(start_of_day);
- if (dpanel->fullday->lower == dpanel->start_of_day)
- return;
-
- tm = *localtime (&dpanel->start_of_day);
- strftime (buf, sizeof (buf), _("%a %b %d %Y"), &tm);
- gtk_label_set (GTK_LABEL (dpanel->date_label), buf);
-
- gncal_full_day_set_bounds (dpanel->fullday, dpanel->start_of_day, time_day_end (dpanel->start_of_day));
-
- gtk_calendar_select_month (dpanel->gtk_calendar, tm.tm_mon, tm.tm_year + 1900);
-
- gtk_signal_handler_block (GTK_OBJECT (dpanel->gtk_calendar), dpanel->day_selected_id);
- gtk_calendar_select_day (dpanel->gtk_calendar, tm.tm_mday);
- gtk_signal_handler_unblock (GTK_OBJECT (dpanel->gtk_calendar), dpanel->day_selected_id);
-
- update (dpanel, FALSE, NULL, 0);
-}
-
-void
-gncal_day_panel_time_format_changed (GncalDayPanel *dpanel)
-{
- g_return_if_fail (dpanel != NULL);
- g_return_if_fail (GNCAL_IS_DAY_PANEL (dpanel));
-
- gtk_calendar_display_options (dpanel->gtk_calendar,
- (week_starts_on_monday
- ? (dpanel->gtk_calendar->display_flags
- | GTK_CALENDAR_WEEK_START_MONDAY)
- : (dpanel->gtk_calendar->display_flags
- & ~GTK_CALENDAR_WEEK_START_MONDAY)));
-}
-
-void
-todo_list_properties_changed (GncalDayPanel *dpanel)
-{
- g_return_if_fail (dpanel != NULL);
- g_return_if_fail (GNCAL_IS_DAY_PANEL (dpanel));
-
- gncal_todo_update (dpanel->todo, NULL, 0);
-}
-
-
-
diff --git a/calendar/gncal-day-panel.h b/calendar/gncal-day-panel.h
deleted file mode 100644
index 6bf8768d9c..0000000000
--- a/calendar/gncal-day-panel.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Day view notebook panel for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef GNCAL_DAY_PANEL_H
-#define GNCAL_DAY_PANEL_H
-
-#include <gtk/gtklabel.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktable.h>
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-#include "gncal-full-day.h"
-#include "gncal-todo.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_DAY_PANEL(obj) GTK_CHECK_CAST (obj, gncal_day_panel_get_type (), GncalDayPanel)
-#define GNCAL_DAY_PANEL_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_day_panel_get_type (), GncalDayPanelClass)
-#define GNCAL_IS_DAY_PANEL(obj) GTK_CHECK_TYPE (obj, gncal_day_panel_get_type ())
-
-
-typedef struct _GncalDayPanel GncalDayPanel;
-typedef struct _GncalDayPanelClass GncalDayPanelClass;
-
-struct _GncalDayPanel {
- GtkTable table;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- time_t start_of_day;
-
- GtkLabel *date_label;
- GncalFullDay *fullday;
- GtkScrolledWindow *fullday_sw;
- GtkCalendar *gtk_calendar;
- GncalTodo *todo;
-
- guint day_selected_id;
-};
-
-struct _GncalDayPanelClass {
- GtkTableClass parent_class;
-};
-
-
-guint gncal_day_panel_get_type (void);
-GtkWidget *gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day);
-
-void gncal_day_panel_update (GncalDayPanel *dpanel, iCalObject *ico, int flags);
-void gncal_day_panel_set (GncalDayPanel *dpanel, time_t start_of_day);
-void gncal_day_panel_time_format_changed (GncalDayPanel *dpanel);
-
-void todo_list_properties_changed (GncalDayPanel *dpanel);
-
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gncal-day-view.c b/calendar/gncal-day-view.c
deleted file mode 100644
index eafd237029..0000000000
--- a/calendar/gncal-day-view.c
+++ /dev/null
@@ -1,396 +0,0 @@
-/* Day view widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <quartic@gimp.org>
- * Miguel de Icaza <miguel@kernel.org>
- */
-
-#include <gnome.h>
-#include "gncal-day-view.h"
-#include "timeutil.h"
-#include "view-utils.h"
-#include "main.h"
-#include "eventedit.h"
-#include "popup-menu.h"
-
-
-#define TEXT_BORDER 2
-#define MIN_INFO_WIDTH 50
-
-
-static void gncal_day_view_class_init (GncalDayViewClass *class);
-static void gncal_day_view_init (GncalDayView *dview);
-static void gncal_day_view_destroy (GtkObject *object);
-static void gncal_day_view_realize (GtkWidget *widget);
-static void gncal_day_view_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static gint gncal_day_view_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gncal_day_view_button_press (GtkWidget *widget,
- GdkEventButton *event);
-
-
-static GtkWidgetClass *parent_class;
-
-
-guint
-gncal_day_view_get_type (void)
-{
- static guint day_view_type = 0;
-
- if (!day_view_type) {
- GtkTypeInfo day_view_info = {
- "GncalDayView",
- sizeof (GncalDayView),
- sizeof (GncalDayViewClass),
- (GtkClassInitFunc) gncal_day_view_class_init,
- (GtkObjectInitFunc) gncal_day_view_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- day_view_type = gtk_type_unique (gtk_widget_get_type (), &day_view_info);
- }
-
- return day_view_type;
-}
-
-static void
-gncal_day_view_class_init (GncalDayViewClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = gtk_type_class (gtk_widget_get_type ());
-
- object_class->destroy = gncal_day_view_destroy;
-
- widget_class->realize = gncal_day_view_realize;
- widget_class->size_request = gncal_day_view_size_request;
- widget_class->expose_event = gncal_day_view_expose;
- widget_class->button_press_event = gncal_day_view_button_press;
-}
-
-static void
-gncal_day_view_init (GncalDayView *dview)
-{
- GTK_WIDGET_UNSET_FLAGS (dview, GTK_NO_WINDOW);
-
- dview->calendar = NULL;
-
- dview->lower = 0;
- dview->upper = 0;
-
- dview->shadow_type = GTK_SHADOW_ETCHED_IN;
-}
-
-static void
-gncal_day_view_destroy (GtkObject *object)
-{
- GncalDayView *dview;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (object));
-
- dview = GNCAL_DAY_VIEW (object);
-
- if (dview->day_str)
- g_free (dview->day_str);
- if (dview->events)
- calendar_destroy_event_list (dview->events);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static int
-new_appointment (GtkWidget *widget, gpointer data)
-{
- GncalDayView *dayview = GNCAL_DAY_VIEW (data);
- iCalObject *ico;
- GtkWidget *ee;
- struct tm tm;
-
- ico = ical_new ("", user_name, "");
- ico->new = 1;
-
- tm = *localtime (&dayview->lower);
- tm.tm_hour = day_begin;
- ico->dtstart = mktime (&tm);
- tm.tm_hour++;
- ico->dtend = mktime (&tm);
- ee = event_editor_new (dayview->calendar, ico);
- gtk_widget_show (ee);
- return 1;
-}
-
-static void
-context_menu (GncalDayView *dayview, GdkEventButton *event)
-{
- static struct menu_item main_items[] = {
- { N_("New appointment..."), (GtkSignalFunc) new_appointment, NULL, TRUE }
- };
-
- main_items [0].data = dayview;
- popup_menu (main_items, 1, event);
-}
-
-static gint
-gncal_day_view_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- GncalDayView *dayview;
-
- dayview = GNCAL_DAY_VIEW (widget);
-
- if (event->button == 3)
- context_menu (dayview, event);
-
- if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
- gnome_calendar_dayjump (dayview->calendar, dayview->lower);
-
- return TRUE;
-}
-
-GtkWidget *
-gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper)
-{
- GncalDayView *dview;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- dview = gtk_type_new (gncal_day_view_get_type ());
-
- dview->calendar = calendar;
- dview->lower = lower;
- dview->upper = upper;
- dview->events = 0;
-
- gncal_day_view_update (dview, NULL, 0);
-
- return GTK_WIDGET (dview);
-}
-
-static void
-gncal_day_view_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.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)
- | GDK_EXPOSURE_MASK
- | GDK_BUTTON_PRESS_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);
-
- gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_PRELIGHT]);
-}
-
-static void
-gncal_day_view_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- GncalDayView *dview;
- int str_width, width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (widget));
- g_return_if_fail (requisition != NULL);
-
- dview = GNCAL_DAY_VIEW (widget);
-
- /* border and min width */
-
- str_width = gdk_string_width (widget->style->font, dview->day_str);
-
- width = MAX (MIN_INFO_WIDTH, str_width);
-
- requisition->width = 2 * (widget->style->klass->xthickness + TEXT_BORDER) + width;
- requisition->height = 2 * (widget->style->klass->ythickness + TEXT_BORDER);
-
- /* division line */
-
- requisition->height += 2 * TEXT_BORDER + widget->style->klass->ythickness;
-
- /* title and at least one line of text */
-
- requisition->height += 2 * (widget->style->font->ascent + widget->style->font->descent);
-}
-
-static gint
-gncal_day_view_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- GncalDayView *dview;
- int x1, y1, width, height;
- GdkRectangle rect, dest;
- GdkFont *font;
- int str_width;
- GdkGC *gc;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_DAY_VIEW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return FALSE;
-
- gc = widget->style->fg_gc [GTK_STATE_NORMAL];
- dview = GNCAL_DAY_VIEW (widget);
-
- x1 = widget->style->klass->xthickness;
- y1 = widget->style->klass->ythickness;
- width = widget->allocation.width - 2 * x1;
- height = widget->allocation.height - 2 * y1;
-
- /* Clear and paint frame shadow */
-
- gdk_window_clear_area (widget->window,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, dview->shadow_type,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- /* Clear and paint title */
-
- font = widget->style->font;
-
- rect.x = x1;
- rect.y = y1;
- rect.width = width;
- rect.height = 2 * TEXT_BORDER + font->ascent + font->descent;
-
- if (gdk_rectangle_intersect (&rect, &event->area, &dest)) {
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- dest = rect;
-
- dest.x += TEXT_BORDER;
- dest.y += TEXT_BORDER;
- dest.width -= 2 * TEXT_BORDER;
- dest.height -= 2 * TEXT_BORDER;
-
- gdk_gc_set_clip_rectangle (gc, &dest);
-
- str_width = gdk_string_width (font, dview->day_str);
-
- gdk_draw_string (widget->window, font, gc,
- dest.x + (dest.width - str_width) / 2,
- dest.y + font->ascent,
- dview->day_str);
-
- gdk_gc_set_clip_rectangle (gc, NULL);
- }
-
- /* Division line */
-
- gtk_draw_hline (widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- rect.x,
- rect.x + rect.width - 1,
- rect.y + rect.height);
-
- /* Text */
-
- if (dview->events != NULL){
- rect.x = x1 + TEXT_BORDER;
- rect.y = y1 + 3 * TEXT_BORDER +
- font->ascent + font->descent +
- widget->style->klass->ythickness;
- rect.width = width - 2 * TEXT_BORDER;
- rect.height = height - (rect.y - y1) - TEXT_BORDER;
-
- if (gdk_rectangle_intersect (&rect, &event->area, &dest))
- view_utils_draw_events (
- widget, widget->window, gc,
- &rect,
- VIEW_UTILS_DRAW_END | VIEW_UTILS_DRAW_SPLIT,
- dview->events,
- dview->lower,
- dview->upper);
- }
-
- return FALSE;
-}
-
-void
-gncal_day_view_update (GncalDayView *dview, iCalObject *ico, int flags)
-{
- struct tm tm;
- char buf[256];
-
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
- g_return_if_fail (dview->calendar->cal);
-
- if (dview->day_str)
- g_free (dview->day_str);
-
- tm = *localtime (&dview->lower);
- strftime (buf, sizeof (buf)-1, "%A %d", &tm);
- dview->day_str = g_strdup (buf);
-
- if (dview->events)
- calendar_destroy_event_list (dview->events);
-
- dview->events = calendar_get_events_in_range (dview->calendar->cal,
- dview->lower,
- dview->upper);
-
- gtk_widget_draw (GTK_WIDGET (dview), NULL);
-}
-
-void
-gncal_day_view_set_bounds (GncalDayView *dview, time_t lower, time_t upper)
-{
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
-
- if ((lower != dview->lower) || (upper != dview->upper)) {
- dview->lower = lower;
- dview->upper = upper;
-
- gncal_day_view_update (dview, NULL, 0);
- }
-}
-
-void
-gncal_day_view_set_shadow (GncalDayView *dview, GtkShadowType shadow_type)
-{
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
-
- if (shadow_type != dview->shadow_type) {
- dview->shadow_type = shadow_type;
-
- gtk_widget_draw (GTK_WIDGET (dview), NULL);
- }
-}
diff --git a/calendar/gncal-day-view.h b/calendar/gncal-day-view.h
deleted file mode 100644
index dae1897fb6..0000000000
--- a/calendar/gncal-day-view.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Day view widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef GNCAL_DAY_VIEW_H
-#define GNCAL_DAY_VIEW_H
-
-
-#include <gtk/gtkwidget.h>
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_DAY_VIEW(obj) GTK_CHECK_CAST (obj, gncal_day_view_get_type (), GncalDayView)
-#define GNCAL_DAY_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_day_view_get_type (), GncalDayViewClass)
-#define GNCAL_IS_DAY_VIEW(obj) GTK_CHECK_TYPE (obj, gncal_day_view_get_type ())
-
-
-typedef struct _GncalDayView GncalDayView;
-typedef struct _GncalDayViewClass GncalDayViewClass;
-
-struct _GncalDayView {
- GtkWidget widget;
-
- GnomeCalendar *calendar;/* the calendar we are associated to */
-
- time_t lower; /* lower and upper times to display */
- time_t upper; /* these include the full day */
-
- char *day_str; /* what day is it? */
- GList *events; /* the events for the this day */
- GtkShadowType shadow_type;
-};
-
-struct _GncalDayViewClass {
- GtkWidgetClass parent_class;
-};
-
-
-guint gncal_day_view_get_type (void);
-GtkWidget *gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper);
-
-void gncal_day_view_update (GncalDayView *dview, iCalObject *ico, int flags);
-void gncal_day_view_set_bounds (GncalDayView *dview, time_t lower, time_t upper);
-
-void gncal_day_view_set_shadow (GncalDayView *dview, GtkShadowType shadow_type);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gncal-full-day.c b/calendar/gncal-full-day.c
deleted file mode 100644
index c07d9a5710..0000000000
--- a/calendar/gncal-full-day.c
+++ /dev/null
@@ -1,2287 +0,0 @@
-/* Full day widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <quartic@gimp.org>
- * Miguel de Icaza <miguel@kernel.org>
- */
-#include <config.h>
-#include <string.h>
-#include <gdk/gdkkeysyms.h>
-#include <gnome.h>
-#include "eventedit.h"
-#include "gncal-full-day.h"
-#include "view-utils.h"
-#include "layout.h"
-#include "main.h"
-#include "popup-menu.h"
-
-/* Images */
-#include "bell.xpm"
-#include "recur.xpm"
-
-#define TEXT_BORDER 2
-#define HANDLE_SIZE 8
-#define MIN_WIDTH 200
-#define XOR_RECT_WIDTH 2
-#define UNSELECT_TIMEOUT 0 /* ms */
-
-/* Size of the pixmaps */
-#define DECOR_WIDTH 16
-#define DECOR_HEIGHT 16
-
-typedef struct {
- iCalObject *ico;
- GtkWidget *widget;
- GdkWindow *window;
- GdkWindow *decor_window;
- guint focus_out_id;
- int lower_row; /* zero is first displayed row */
- int rows_used;
- int x; /* coords of child's window */
- int y;
- int width;
- int height;
- int decor_width;
- int decor_height;
- int items; /* number of decoration bitmaps */
- time_t start, end;
-} Child;
-
-struct drag_info {
- enum {
- DRAG_NONE,
- DRAG_SELECT, /* selecting a range in the main window */
- DRAG_MOVE, /* moving a child */
- DRAG_SIZE_TOP, /* resizing a child */
- DRAG_SIZE_BOTTOM
- } drag_mode;
-
- Child *child;
- int child_click_y;
- int child_start_row;
- int child_rows_used;
-
- int sel_click_row;
- int sel_start_row;
- int sel_rows_used;
- guint32 click_time;
-};
-
-
-enum {
- RANGE_ACTIVATED,
- LAST_SIGNAL
-};
-
-
-static void gncal_full_day_class_init (GncalFullDayClass *class);
-static void gncal_full_day_init (GncalFullDay *fullday);
-static void gncal_full_day_destroy (GtkObject *object);
-static void gncal_full_day_map (GtkWidget *widget);
-static void gncal_full_day_unmap (GtkWidget *widget);
-static void gncal_full_day_realize (GtkWidget *widget);
-static void gncal_full_day_unrealize (GtkWidget *widget);
-static void gncal_full_day_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gncal_full_day_draw_focus (GtkWidget *widget);
-static void gncal_full_day_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gncal_full_day_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint gncal_full_day_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gncal_full_day_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gncal_full_day_motion (GtkWidget *widget,
- GdkEventMotion *event);
-static gint gncal_full_day_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gncal_full_day_key_press (GtkWidget *widget,
- GdkEventKey *event);
-static gint gncal_full_day_focus_in (GtkWidget *widget,
- GdkEventFocus *event);
-static gint gncal_full_day_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
-static void gncal_full_day_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
-
-static void range_activated (GncalFullDay *fullday);
-
-static GtkContainerClass *parent_class;
-
-static int fullday_signals[LAST_SIGNAL] = { 0 };
-
-/* The little images */
-static GdkPixmap *pixmap_bell, *pixmap_recur;
-
-static void
-get_tm_range (GncalFullDay *fullday,
- time_t time_lower, time_t time_upper,
- struct tm *lower, struct tm *upper,
- int *lower_row, int *rows_used)
-{
- struct tm tm_lower, tm_upper;
- int lmin, umin;
- int lrow;
-
- /* Lower */
-
- tm_lower = *localtime (&time_lower);
-
- if ((tm_lower.tm_min % fullday->interval) != 0) {
- tm_lower.tm_min -= tm_lower.tm_min % fullday->interval; /* round down */
- mktime (&tm_lower);
- }
-
- /* Upper */
-
- tm_upper = *localtime (&time_upper);
-
- if ((tm_upper.tm_min % fullday->interval) != 0) {
- tm_upper.tm_min += fullday->interval - (tm_upper.tm_min % fullday->interval); /* round up */
- mktime (&tm_upper);
- }
-
- if (lower)
- *lower = tm_lower;
-
- if (upper)
- *upper = tm_upper;
-
- lmin = 60 * tm_lower.tm_hour + tm_lower.tm_min;
- umin = 60 * tm_upper.tm_hour + tm_upper.tm_min;
-
- if (umin == 0) /* midnight of next day? */
- umin = 60 * 24;
-
- lrow = lmin / fullday->interval;
-
- if (lower_row)
- *lower_row = lrow;
-
- if (rows_used)
- *rows_used = (umin - lmin) / fullday->interval;
-}
-
-static void
-child_map (GncalFullDay *fullday, Child *child)
-{
- gdk_window_show (child->window);
- if (child->decor_width)
- gdk_window_show (child->decor_window);
- gtk_widget_show (child->widget); /* OK, not just a map... */
-}
-
-static void
-child_unmap (GncalFullDay *fullday, Child *child)
-{
- gdk_window_hide (child->window);
- gdk_window_hide (child->decor_window);
- if (GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_unmap (child->widget);
-}
-
-static void
-child_set_text_pos (Child *child)
-{
- GtkAllocation allocation;
- int has_focus;
- int handle_size;
-
- has_focus = GTK_WIDGET_HAS_FOCUS (child->widget);
-
- handle_size = (child->ico->recur) ? 0 : HANDLE_SIZE;
-
- allocation.x = handle_size;
- allocation.y = has_focus ? handle_size : 0;
- allocation.width = child->width - handle_size - child->decor_width;
- allocation.height = child->height - (has_focus ? (2 * handle_size) : 0);
-
- gtk_widget_size_request (child->widget, NULL);
- gtk_widget_size_allocate (child->widget, &allocation);
-}
-
-static void
-child_realize (GncalFullDay *fullday, Child *child)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
- GtkWidget *widget;
- GdkColor c;
-
- widget = GTK_WIDGET (fullday);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = child->x;
- attributes.y = child->y;
- attributes.width = child->width - child->decor_width;;
- attributes.height = child->height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.cursor = fullday->up_down_cursor;
- attributes.event_mask = (GDK_EXPOSURE_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_KEY_PRESS_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP | GDK_WA_CURSOR;
- child->window = gdk_window_new (widget->window, &attributes, attributes_mask);
- gdk_window_set_user_data (child->window, widget);
- gtk_style_set_background (widget->style, child->window, GTK_STATE_NORMAL);
- gtk_widget_set_parent_window (child->widget, child->window);
-
- /* Create the decoration window */
- attributes.x = child->x + child->width - child->decor_width;
- attributes.width = child->decor_width ? child->decor_width : 1;
- attributes.height = child->decor_height ? child->decor_height : 1;
- attributes.visual = gdk_imlib_get_visual ();
- attributes.colormap = gdk_imlib_get_colormap ();
- attributes.event_mask = (GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- child->decor_window = gdk_window_new (widget->window, &attributes, attributes_mask);
- gdk_color_white (gdk_imlib_get_colormap (), &c);
- gdk_window_set_background (child->decor_window, &c);
- gdk_window_set_user_data (child->decor_window, widget);
-
- if (!pixmap_bell){
- GdkImlibImage *imlib_bell, *imlib_recur;
- GdkPixmap *mask;
-
- imlib_bell = gdk_imlib_create_image_from_xpm_data (bell_xpm);
- gdk_imlib_render (imlib_bell, DECOR_WIDTH, DECOR_HEIGHT);
- pixmap_bell = gdk_imlib_move_image (imlib_bell);
- mask = gdk_imlib_move_mask (imlib_bell);
- gdk_imlib_destroy_image (imlib_bell);
- fullday->bell_gc = gdk_gc_new (child->decor_window);
- if (mask)
- gdk_gc_set_clip_mask (fullday->bell_gc, mask);
-
- imlib_recur = gdk_imlib_create_image_from_xpm_data (recur_xpm);
- gdk_imlib_render (imlib_recur, DECOR_WIDTH, DECOR_HEIGHT);
- pixmap_recur = gdk_imlib_move_image (imlib_recur);
- mask = gdk_imlib_move_mask (imlib_recur);
- gdk_imlib_destroy_image (imlib_recur);
- fullday->recur_gc = gdk_gc_new (child->decor_window);
- if (mask)
- gdk_gc_set_clip_mask (fullday->recur_gc, mask);
- }
- child_set_text_pos (child);
-}
-
-static void
-child_unrealize (GncalFullDay *fullday, Child *child)
-{
- if (GTK_WIDGET_REALIZED (child->widget))
- gtk_widget_unrealize (child->widget);
-
- gdk_window_set_user_data (child->window, NULL);
- gdk_window_destroy (child->window);
- child->window = NULL;
-}
-
-static void
-child_draw_decor (GncalFullDay *fullday, Child *child)
-{
- iCalObject *ico = child->ico;
- int ry = 0;
-
- if (ico->recur) {
- gdk_gc_set_clip_origin (fullday->recur_gc, 0, ry);
- gdk_draw_pixmap (child->decor_window,
- fullday->recur_gc,
- pixmap_recur,
- 0, 0,
- 0, ry,
- DECOR_WIDTH, DECOR_HEIGHT);
- ry += DECOR_HEIGHT;
- }
-
- if (ico->dalarm.enabled || ico->malarm.enabled || ico->palarm.enabled || ico->aalarm.enabled) {
- gdk_gc_set_clip_origin (fullday->bell_gc, 0, ry);
- gdk_draw_pixmap (child->decor_window,
- fullday->bell_gc,
- pixmap_bell,
- 0, 0,
- 0, ry,
- DECOR_WIDTH, DECOR_HEIGHT);
- ry += DECOR_HEIGHT;
- }
-}
-
-static void
-child_draw (GncalFullDay *fullday, Child *child, GdkRectangle *area, GdkWindow *window, int draw_child)
-{
- GdkRectangle arect, rect, dest;
- int has_focus;
-
- has_focus = GTK_WIDGET_HAS_FOCUS (child->widget);
-
- if (!window || (window == child->window)) {
- if (!area) {
- arect.x = 0;
- arect.y = 0;
- arect.width = child->width;
- arect.height = child->height;
-
- area = &arect;
- }
-
- /* Left handle */
-
- rect.x = 0;
- rect.y = has_focus ? HANDLE_SIZE : 0;
- rect.width = HANDLE_SIZE;
- rect.height = has_focus ? (child->height - 2 * HANDLE_SIZE) : child->height;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- view_utils_draw_textured_frame (GTK_WIDGET (fullday), child->window, &rect, GTK_SHADOW_OUT);
-
- if (has_focus) {
- /* Top handle */
-
- rect.x = 0;
- rect.y = 0;
- rect.width = child->width - child->decor_width;
- rect.height = HANDLE_SIZE;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- view_utils_draw_textured_frame (GTK_WIDGET (fullday), child->window,
- &rect, GTK_SHADOW_OUT);
-
- /* Bottom handle */
-
- rect.y = child->height - HANDLE_SIZE;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- view_utils_draw_textured_frame (GTK_WIDGET (fullday), child->window,
- &rect, GTK_SHADOW_OUT);
- }
-
- } else if (!window || (window == child->decor_window)) {
- if (!area) {
- arect.x = 0;
- arect.y = 0;
- arect.width = child->decor_width;
- arect.height = child->decor_height;
-
- area = &arect;
- }
-
- child_draw_decor (fullday, child);
- }
-
- if (draw_child)
- gtk_widget_draw (child->widget, NULL);
-}
-
-static void
-child_range_changed (GncalFullDay *fullday, Child *child)
-{
- struct tm start, end;
- int lower_row, rows_used;
- int f_lower_row;
-
- /* Calc display range for event */
-
- get_tm_range (fullday, child->start, child->end, &start, &end, &lower_row, &rows_used);
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, &f_lower_row, NULL);
-
- child->lower_row = lower_row - f_lower_row;
- child->rows_used = rows_used;
-}
-
-static void
-new_appointment (GtkWidget *widget, gpointer data)
-{
- GncalFullDay *fullday;
- GtkWidget *ee;
- iCalObject *ico;
-
- fullday = GNCAL_FULL_DAY (data);
-
- ico = ical_new ("", user_name, "");
- ico->new = 1;
-
- gncal_full_day_selection_range (fullday, &ico->dtstart, &ico->dtend);
- ee = event_editor_new (fullday->calendar, ico);
- gtk_widget_show (ee);
-}
-
-static void
-edit_appointment (GtkWidget *widget, gpointer data)
-{
- Child *child;
- GtkWidget *ee;
-
- child = data;
-
- ee = event_editor_new (GNCAL_FULL_DAY (child->widget->parent)->calendar, child->ico);
- gtk_widget_show (ee);
-}
-
-static void
-delete_occurance (GtkWidget *widget, gpointer data)
-{
- Child *child = data;
- iCalObject *ical;
- time_t *t;
- GnomeCalendar *gcal = GNCAL_FULL_DAY (child->widget->parent)->calendar;
-
- child = data;
- ical = child->ico;
- t = g_new(time_t, 1);
- *t = child->start;
- ical->exdate = g_list_prepend(ical->exdate, t);
- gnome_calendar_object_changed (gcal, child->ico, CHANGE_DATES);
- save_default_calendar (gcal);
-
-}
-
-static void
-delete_appointment (GtkWidget *widget, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
-
- child = data;
-
- fullday = GNCAL_FULL_DAY (child->widget->parent);
-
- gnome_calendar_remove_object (fullday->calendar, child->ico);
- save_default_calendar (fullday->calendar);
-}
-
-static void
-unrecur_appointment (GtkWidget *widget, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
- iCalObject *new;
-
- child = data;
- fullday = GNCAL_FULL_DAY (child->widget->parent);
-
- /* New object */
- new = ical_object_duplicate (child->ico);
- g_free (new->recur);
- new->recur = 0;
- new->dtstart = child->start;
- new->dtend = child->end;
-
- /* Duplicate, and eliminate the recurrency fields */
- ical_object_add_exdate (child->ico, child->start);
- gnome_calendar_object_changed (fullday->calendar, child->ico, CHANGE_ALL);
-
- gnome_calendar_add_object (fullday->calendar, new);
- save_default_calendar (fullday->calendar);
-}
-
-static void
-child_popup_menu (GncalFullDay *fullday, Child *child, GdkEventButton *event)
-{
- int sensitive, items;
- struct menu_item *context_menu;
-
- static struct menu_item child_items[] = {
- { N_("Edit this appointment..."), (GtkSignalFunc) edit_appointment, NULL, TRUE },
- { N_("Delete this appointment"), (GtkSignalFunc) delete_appointment, NULL, TRUE },
- { NULL, NULL, NULL, TRUE },
- { N_("New appointment..."), (GtkSignalFunc) new_appointment, NULL, TRUE }
- };
-
- static struct menu_item recur_child_items[] = {
- { N_("Make this appointment movable"), (GtkSignalFunc) unrecur_appointment, NULL, TRUE },
- { N_("Edit this appointment..."), (GtkSignalFunc) edit_appointment, NULL, TRUE },
- { N_("Delete this occurance"), (GtkSignalFunc) delete_occurance, NULL, TRUE },
- { N_("Delete all occurances"), (GtkSignalFunc) delete_appointment, NULL, TRUE },
- { NULL, NULL, NULL, TRUE },
- { N_("New appointment..."), (GtkSignalFunc) new_appointment, NULL, TRUE }
- };
-
- sensitive = (child->ico->user_data == NULL);
-
- if (child->ico->recur){
- items = 6;
- context_menu = &recur_child_items[0];
- context_menu[2].data = child;
- context_menu[3].data = child;
- context_menu[3].sensitive = sensitive;
- context_menu[4].data = fullday;
- context_menu[5].data = fullday;
- } else {
- items = 4;
- context_menu = &child_items[0];
- context_menu[3].data = fullday;
- }
- /* These settings are common for each context sensitive menu */
- context_menu[0].data = child;
- context_menu[1].data = child;
- context_menu[0].sensitive = sensitive;
- context_menu[1].sensitive = sensitive;
- context_menu[2].sensitive = sensitive;
-
- popup_menu (context_menu, items, event);
-}
-
-static void
-child_realized_setup (GtkWidget *widget, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
-
- child = data;
- fullday = GNCAL_FULL_DAY (widget->parent);
-
- gdk_window_set_cursor (widget->window, fullday->beam_cursor);
-}
-
-static void
-child_set_pos (GncalFullDay *fullday, Child *child, int x, int y, int width, int height)
-{
- const int decor_width = child->decor_width;
-
- child->x = x;
- child->y = y;
- child->width = width;
- child->height = height;
-
- if (!child->window) /* realized? */
- return;
-
- child_set_text_pos (child);
- gdk_window_move_resize (child->window, x, y, width - decor_width, height);
-
- if (decor_width){
- gdk_window_move_resize (child->decor_window, x + width - decor_width, y,
- decor_width, child->decor_height);
- }
-}
-
-static int
-calc_row_height (GncalFullDay *fullday)
-{
- int f_rows;
- GtkWidget *widget;
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &f_rows);
-
- widget = GTK_WIDGET (fullday);
-
- return (widget->allocation.height - 2 * widget->style->klass->ythickness) / f_rows;
-}
-
-static void
-child_set_size (Child *child)
-{
- int row_height;
- int x, y, width, height;
- GncalFullDay *fullday;
-
- fullday = GNCAL_FULL_DAY (child->widget->parent);
-
- row_height = calc_row_height (fullday);
-
- x = child->x;
- y = child->lower_row * row_height + GTK_WIDGET (fullday)->style->klass->ythickness;
- width = child->width;
- height = child->rows_used * row_height;
-
- if (GTK_WIDGET_HAS_FOCUS (child->widget) && !child->ico->recur) {
- y -= HANDLE_SIZE;
- height += 2 * HANDLE_SIZE;
- }
-
- child_set_pos (fullday, child, x, y, width, height);
-}
-
-static gint
-child_focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- child_set_size (data);
- return FALSE;
-}
-
-static gint
-child_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
- char *text;
-
- child = data;
-
- child_set_size (child);
-
- /* Update summary in calendar object */
-
- text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
- if (child->ico->summary && strcmp (text, child->ico->summary) == 0)
- return FALSE;
-
- if (child->ico->summary)
- g_free (child->ico->summary);
-
- child->ico->summary = text;
-
- /* Notify calendar of change */
-
- fullday = GNCAL_FULL_DAY (widget->parent);
-
- gnome_calendar_object_changed (fullday->calendar, child->ico, CHANGE_SUMMARY);
- save_default_calendar (fullday->calendar);
-
- return FALSE;
-}
-
-static gint
-child_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data)
-{
- if (event->keyval != GDK_Escape)
- return FALSE;
-
- /* If user pressed Esc, un-focus the child by focusing the fullday widget */
-
- gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key_press_event");
- gtk_widget_grab_focus (widget->parent);
-
- return FALSE;
-}
-
-static gint
-child_button_press (GtkWidget *widget, GdkEventButton *event, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
-
- if (event->button != 3)
- return FALSE;
-
- child = data;
- fullday = GNCAL_FULL_DAY (widget->parent);
-
- gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "button_press_event");
- gtk_widget_grab_focus (widget);
- child_popup_menu (fullday, child, event);
-
- return TRUE;
-}
-
-/*
- * compute the space required to display the decorations
- */
-static void
-child_compute_decor (Child *child)
-{
- iCalObject *ico = child->ico;
- int rows_used;
-
- child->items = 0;
- rows_used = (child->rows_used < 1) ? 1 : child->rows_used;
- if (ico->recur)
- child->items++;
- if (ico->dalarm.enabled || ico->aalarm.enabled || ico->palarm.enabled || ico->malarm.enabled)
- child->items++;
-
- if (child->items > rows_used){
- child->decor_width = DECOR_WIDTH * 2;
- child->decor_height = DECOR_HEIGHT;
- } else {
- child->decor_width = DECOR_WIDTH * (child->items ? 1 : 0);
- child->decor_height = DECOR_HEIGHT * child->items;
- }
-}
-
-static Child *
-child_new (GncalFullDay *fullday, time_t start, time_t end, iCalObject *ico)
-{
- Child *child;
-
- child = g_new (Child, 1);
-
- child->ico = ico;
- child->widget = gtk_text_new (NULL, NULL);
- child->window = NULL;
- child->x = 0;
- child->y = 0;
- child->width = 0;
- child->height = 0;
- child->start = start;
- child->end = end;
- child_range_changed (fullday, child);
- child_compute_decor (child);
-
- if (ico->summary)
- gtk_text_insert (GTK_TEXT (child->widget), NULL, NULL, NULL,
- ico->summary,
- strlen (ico->summary));
-
- /* We set the i-beam cursor of the text widget upon realization */
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "realize",
- (GtkSignalFunc) child_realized_setup,
- child);
-
- gtk_signal_connect_after (GTK_OBJECT (child->widget), "focus_in_event",
- (GtkSignalFunc) child_focus_in,
- child);
-
- child->focus_out_id = gtk_signal_connect_after (GTK_OBJECT (child->widget), "focus_out_event",
- (GtkSignalFunc) child_focus_out,
- child);
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "key_press_event",
- (GtkSignalFunc) child_key_press,
- child);
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "button_press_event",
- (GtkSignalFunc) child_button_press,
- child);
-
- /* Finish setup */
-
- gtk_text_set_editable (GTK_TEXT (child->widget), TRUE);
- gtk_text_set_word_wrap (GTK_TEXT (child->widget), TRUE);
-
- gtk_widget_set_parent (child->widget, GTK_WIDGET (fullday));
-
- return child;
-}
-
-static void
-squick (GtkWidget *widget, gpointer data)
-{
-}
-
-static void
-child_destroy (GncalFullDay *fullday, Child *child)
-{
- /* Disconnect the focus_out_event signal since we will get such an event
- * from the destroy call.
- */
- gtk_signal_disconnect (GTK_OBJECT (child->widget), child->focus_out_id);
-
- if (GTK_WIDGET_MAPPED (fullday))
- child_unmap (fullday, child);
-
- if (GTK_WIDGET_REALIZED (fullday))
- child_unrealize (fullday, child);
-
- /* Unparent the child widget manually as we don't have a remove method */
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "destroy",
- (GtkSignalFunc) squick,
- NULL);
-
- gtk_widget_unparent (child->widget);
- g_free (child);
-}
-
-static int
-calc_labels_width (GncalFullDay *fullday)
-{
- struct tm cur, upper;
- time_t tim, time_upper;
- int width, max_w;
- char buf[40];
-
- get_tm_range (fullday, fullday->lower, fullday->upper, &cur, &upper, NULL, NULL);
-
- max_w = 0;
-
- tim = mktime (&cur);
- time_upper = mktime (&upper);
-
- while (tim < time_upper) {
- if (am_pm_flag)
- strftime (buf, sizeof (buf), "%I:%M%p", &cur);
- else
- strftime (buf, sizeof (buf), "%H:%M", &cur);
-
-
- width = gdk_string_width (GTK_WIDGET (fullday)->style->font, buf);
-
- if (width > max_w)
- max_w = width;
-
- cur.tm_min += fullday->interval;
- tim = mktime (&cur);
- }
-
- return max_w;
-}
-
-/* Used with layout_events(), takes in a list element and returns the start and end times for the
- * event corresponding to that element.
- */
-static void
-child_layout_query_func (GList *event, time_t *start, time_t *end)
-{
- Child *child;
-
- child = event->data;
-
- *start = child->start;
- *end = child->end;
-}
-
-/* Takes the list of children in the full day view and lays them out nicely without overlapping.
- * Basically it calls the layout_events() function in layout.c and resizes the fullday's children.
- */
-static void
-layout_children (GncalFullDay *fullday)
-{
- GtkWidget *widget;
- GList *children;
- Child *child;
- int num_slots;
- int *allocations;
- int *slots;
- int left_x;
- int usable_pixels, pixels_per_col, extra_pixels;
- int i;
-
- if (!fullday->children)
- return;
-
- layout_events (fullday->children, child_layout_query_func, &num_slots, &allocations, &slots);
-
- /* Set the size and position of each child */
-
- widget = GTK_WIDGET (fullday);
- left_x = 2 * (widget->style->klass->xthickness + TEXT_BORDER) + calc_labels_width (fullday);
-
- usable_pixels = widget->allocation.width - left_x - widget->style->klass->xthickness;
- pixels_per_col = usable_pixels / num_slots;
- extra_pixels = usable_pixels % num_slots;
-
- for (children = fullday->children, i = 0; children; children = children->next, i++) {
- child = children->data;
-
- child->x = left_x + pixels_per_col * allocations[i];
- child->width = pixels_per_col * slots[i];
-
- if ((allocations[i] + slots[i]) == num_slots)
- child->width += extra_pixels;
-
- child_set_size (child);
- }
-
- g_free (allocations);
- g_free (slots);
-}
-
-guint
-gncal_full_day_get_type (void)
-{
- static guint full_day_type = 0;
-
- if (!full_day_type) {
- GtkTypeInfo full_day_info = {
- "GncalFullDay",
- sizeof (GncalFullDay),
- sizeof (GncalFullDayClass),
- (GtkClassInitFunc) gncal_full_day_class_init,
- (GtkObjectInitFunc) gncal_full_day_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- full_day_type = gtk_type_unique (gtk_container_get_type (), &full_day_info);
- }
-
- return full_day_type;
-}
-
-static void
-gncal_full_day_class_init (GncalFullDayClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- fullday_signals[RANGE_ACTIVATED] =
- gtk_signal_new ("range_activated",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GncalFullDayClass, range_activated),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, fullday_signals, LAST_SIGNAL);
-
- object_class->destroy = gncal_full_day_destroy;
-
- widget_class->map = gncal_full_day_map;
- widget_class->unmap = gncal_full_day_unmap;
- widget_class->realize = gncal_full_day_realize;
- widget_class->unrealize = gncal_full_day_unrealize;
- widget_class->draw = gncal_full_day_draw;
- widget_class->draw_focus = gncal_full_day_draw_focus;
- widget_class->size_request = gncal_full_day_size_request;
- widget_class->size_allocate = gncal_full_day_size_allocate;
- widget_class->button_press_event = gncal_full_day_button_press;
- widget_class->button_release_event = gncal_full_day_button_release;
- widget_class->motion_notify_event = gncal_full_day_motion;
- widget_class->expose_event = gncal_full_day_expose;
- widget_class->key_press_event = gncal_full_day_key_press;
- widget_class->focus_in_event = gncal_full_day_focus_in;
- widget_class->focus_out_event = gncal_full_day_focus_out;
-
- container_class->forall = gncal_full_day_forall;
-
- class->range_activated = range_activated;
-}
-
-static void
-gncal_full_day_init (GncalFullDay *fullday)
-{
- GTK_WIDGET_UNSET_FLAGS (fullday, GTK_NO_WINDOW);
- GTK_WIDGET_SET_FLAGS (fullday, GTK_CAN_FOCUS);
-
- fullday->calendar = NULL;
-
- fullday->lower = 0;
- fullday->upper = 0;
- fullday->interval = 30; /* 30 minutes by default */
-
- fullday->children = NULL;
- fullday->drag_info = g_new0 (struct drag_info, 1);
-
- fullday->up_down_cursor = NULL;
- fullday->beam_cursor = NULL;
- fullday->recur_gc = NULL;
- fullday->bell_gc = NULL;
-}
-
-/* Destroys all the children in the full day widget */
-static void
-destroy_children (GncalFullDay *fullday)
-{
- GList *children;
-
- for (children = fullday->children; children; children = children->next)
- child_destroy (fullday, children->data);
-
- g_list_free (fullday->children);
- fullday->children = NULL;
-}
-
-static void
-gncal_full_day_destroy (GtkObject *object)
-{
- GncalFullDay *fullday;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (object));
-
- fullday = GNCAL_FULL_DAY (object);
-
- destroy_children (fullday);
-
- g_free (fullday->drag_info);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-GtkWidget *
-gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper)
-{
- GncalFullDay *fullday;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- fullday = gtk_type_new (gncal_full_day_get_type ());
-
- fullday->calendar = calendar;
-
- gncal_full_day_set_bounds (fullday, lower, upper);
-
- return GTK_WIDGET (fullday);
-}
-
-static void
-gncal_full_day_map (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- gdk_window_show (widget->window);
-
- for (children = fullday->children; children; children = children->next)
- child_map (fullday, children->data);
-}
-
-static void
-gncal_full_day_unmap (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- gdk_window_hide (widget->window);
-
- for (children = fullday->children; children; children = children->next)
- child_unmap (fullday, children->data);
-}
-
-static void
-gncal_full_day_realize (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GdkWindowAttr attributes;
- gint attributes_mask;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.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)
- | GDK_EXPOSURE_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_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);
- gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_PRELIGHT]);
-
- fullday->up_down_cursor = gdk_cursor_new (GDK_DOUBLE_ARROW);
- fullday->beam_cursor = gdk_cursor_new (GDK_XTERM);
-
- for (children = fullday->children; children; children = children->next)
- child_realize (fullday, children->data);
-
-}
-
-static void
-gncal_full_day_unrealize (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- fullday = GNCAL_FULL_DAY (widget);
-
- for (children = fullday->children; children; children = children->next)
- child_unrealize (fullday, children->data);
-
- gdk_cursor_destroy (fullday->up_down_cursor);
- fullday->up_down_cursor = NULL;
-
- gdk_cursor_destroy (fullday->beam_cursor);
- fullday->beam_cursor = NULL;
-
- if (fullday->bell_gc)
- gdk_gc_destroy (fullday->bell_gc);
- if (fullday->recur_gc)
- gdk_gc_destroy (fullday->recur_gc);
-
- if (pixmap_bell){
- gdk_pixmap_unref (pixmap_bell);
- pixmap_bell = NULL;
- }
-
- if (pixmap_recur){
- gdk_pixmap_unref (pixmap_recur);
- pixmap_recur = NULL;
- }
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-struct paint_info {
- GtkWidget *widget;
- struct drag_info *di;
- GdkRectangle *area;
- int x1, y1, width, height;
- int labels_width;
- int row_height;
- struct tm start_tm;
-};
-
-static void
-paint_row (GncalFullDay *fullday, int row, struct paint_info *p)
-{
- GdkRectangle rect, dest;
- GdkGC *left_gc, *right_gc, *text_gc;
- int begin_row, end_row;
- struct tm tm;
- char buf[40];
-
- begin_row = (day_begin * 60) / fullday->interval;
- end_row = (day_end * 60) / fullday->interval;
-
- /* See which GCs we will use */
-
- if ((p->di->sel_rows_used != 0)
- && (row >= p->di->sel_start_row)
- && (row < (p->di->sel_start_row + p->di->sel_rows_used))) {
- left_gc = p->widget->style->bg_gc[GTK_STATE_SELECTED];
- right_gc = left_gc;
- text_gc = p->widget->style->fg_gc[GTK_STATE_SELECTED];
- } else if ((row < begin_row) || (row >= end_row)) {
- left_gc = p->widget->style->bg_gc[GTK_STATE_NORMAL];
- right_gc = p->widget->style->bg_gc[GTK_STATE_ACTIVE];
- text_gc = p->widget->style->fg_gc[GTK_STATE_NORMAL];
- } else {
- left_gc = p->widget->style->bg_gc[GTK_STATE_NORMAL];
- right_gc = p->widget->style->bg_gc[GTK_STATE_PRELIGHT];
- text_gc = p->widget->style->fg_gc[GTK_STATE_NORMAL];
- }
-
- /* Left background and text */
-
- rect.x = p->x1;
- rect.y = p->y1 + row * p->row_height;
- rect.width = 2 * TEXT_BORDER + p->labels_width;
- rect.height = p->row_height - 1;
-
- if (gdk_rectangle_intersect (&rect, p->area, &dest)) {
- gdk_draw_rectangle (p->widget->window,
- left_gc,
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- tm = p->start_tm;
- tm.tm_min += row * fullday->interval;
- mktime (&tm);
-
- if (am_pm_flag)
- strftime (buf, sizeof (buf), "%I:%M%p", &tm);
- else
- strftime (buf, sizeof (buf), "%H:%M", &tm);
-
- gdk_draw_string (p->widget->window,
- p->widget->style->font,
- text_gc,
- rect.x + TEXT_BORDER,
- rect.y + TEXT_BORDER + p->widget->style->font->ascent,
- buf);
- }
-
- /* Right background */
-
- rect.x += rect.width + p->widget->style->klass->xthickness;
- rect.width = p->width - (rect.x - p->x1);
-
- if (gdk_rectangle_intersect (&rect, p->area, &dest))
- gdk_draw_rectangle (p->widget->window,
- right_gc,
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- /* Horizontal division at bottom of row */
-
- rect.x = p->x1;
- rect.y += rect.height;
- rect.width = p->width;
- rect.height = 1;
-
- if (gdk_rectangle_intersect (&rect, p->area, &dest))
- gdk_draw_line (p->widget->window,
- p->widget->style->black_gc,
- rect.x, rect.y,
- rect.x + rect.width - 1, rect.y);
-}
-
-static void
-paint_back (GncalFullDay *fullday, GdkRectangle *area)
-{
- struct paint_info p;
- int start_row, end_row;
- int i;
- GdkRectangle rect, dest, aarea;
- int f_rows;
- int draw_focus;
-
- p.widget = GTK_WIDGET (fullday);
- p.di = fullday->drag_info;
-
- if (!area) {
- area = &aarea;
-
- area->x = 0;
- area->y = 0;
- area->width = p.widget->allocation.width;
- area->height = p.widget->allocation.height;
- }
- p.area = area;
-
- p.x1 = p.widget->style->klass->xthickness;
- p.y1 = p.widget->style->klass->ythickness;
- p.width = p.widget->allocation.width - 2 * p.x1;
- p.height = p.widget->allocation.height - 2 * p.y1;
-
- p.labels_width = calc_labels_width (fullday);
- p.row_height = calc_row_height (fullday);
- get_tm_range (fullday, fullday->lower, fullday->upper, &p.start_tm, NULL, NULL, &f_rows);
-
- /* Frame shadow */
-
- rect.x = 0;
- rect.y = 0;
- rect.width = p.widget->allocation.width;
- rect.height = p.widget->style->klass->ythickness;
-
- draw_focus = gdk_rectangle_intersect (&rect, area, &dest);
-
- if (!draw_focus) {
- rect.y = p.widget->allocation.height - rect.height;
-
- draw_focus = gdk_rectangle_intersect (&rect, area, &dest);
- }
-
- if (!draw_focus) {
- rect.y = p.widget->style->klass->ythickness;
- rect.width = p.widget->style->klass->xthickness;
- rect.height = p.widget->allocation.height - 2 * rect.y;
-
- draw_focus = gdk_rectangle_intersect (&rect, area, &dest);
- }
-
- if (!draw_focus) {
- rect.x = p.widget->allocation.width - rect.width;
-
- draw_focus = gdk_rectangle_intersect (&rect, area, &dest);
- }
-
- if (draw_focus)
- gtk_widget_draw_focus (p.widget);
-
- /* Rows */
-
- start_row = (area->y - p.y1) / p.row_height;
- end_row = (area->y + area->height - 1 - p.y1) / p.row_height;
-
- if (end_row >= f_rows)
- end_row = f_rows - 1;
-
- for (i = start_row; i <= end_row; i++)
- paint_row (fullday, i, &p);
-
- /* Slack area at bottom of widget */
-
- rect.x = p.x1;
- rect.y = p.y1 + f_rows * p.row_height;
- rect.width = p.width;
- rect.height = p.height - (rect.y - p.y1);
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- gdk_draw_rectangle (p.widget->window,
- p.widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- /* Vertical division */
-
- rect.x = p.x1 + 2 * TEXT_BORDER + p.labels_width;
- rect.y = p.y1;
- rect.width = p.widget->style->klass->xthickness;
- rect.height = p.height;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- gtk_draw_vline (p.widget->style, p.widget->window,
- GTK_STATE_NORMAL,
- rect.y,
- rect.y + rect.height - 1,
- rect.x);
-}
-
-static void
-paint_back_rows (GncalFullDay *fullday, int start_row, int rows_used)
-{
- int row_height;
- int xthickness, ythickness;
- GtkWidget *widget;
- GdkRectangle area;
-
- widget = GTK_WIDGET (fullday);
-
- row_height = calc_row_height (fullday);
-
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
-
- area.x = xthickness;
- area.y = ythickness + start_row * row_height;
- area.width = widget->allocation.width - 2 * xthickness;
- area.height = rows_used * row_height;
-
- paint_back (fullday, &area);
-}
-
-static void
-gncal_full_day_draw (GtkWidget *widget, GdkRectangle *area)
-{
- GncalFullDay *fullday;
- GList *children;
- Child *child;
- GdkRectangle rect, dest;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (area != NULL);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- paint_back (fullday, area);
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- rect.x = child->x;
- rect.y = child->y;
- rect.width = child->width;
- rect.height = child->height;
-
- if (gdk_rectangle_intersect (&rect, area, &dest)) {
- child_draw (fullday, child, NULL, NULL, TRUE);
- }
- }
-}
-
-static void
-gncal_full_day_draw_focus (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return;
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_IN,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gdk_draw_rectangle (widget->window,
- widget->style->black_gc,
- FALSE,
- 0, 0,
- widget->allocation.width - 1,
- widget->allocation.height - 1);
-}
-
-static void
-gncal_full_day_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- GncalFullDay *fullday;
- int labels_width;
- int rows;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (requisition != NULL);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- /* Border and min width */
-
- labels_width = calc_labels_width (fullday);
-
- requisition->width = 2 * widget->style->klass->xthickness + 4 * TEXT_BORDER + labels_width + MIN_WIDTH;
- requisition->height = 2 * widget->style->klass->ythickness;
-
- /* Rows */
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &rows);
-
- requisition->height += (rows * (2 * TEXT_BORDER + widget->style->font->ascent + widget->style->font->descent)
- + (rows - 1)); /* division lines */
-}
-
-static void
-gncal_full_day_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- GncalFullDay *fullday;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- layout_children (fullday);
-}
-
-static Child *
-find_child_by_window (GncalFullDay *fullday, GdkWindow *window, int *on_text)
-{
- GList *children;
- Child *child;
- GtkWidget *owner;
-
- *on_text = FALSE;
-
- gdk_window_get_user_data (window, (gpointer *) &owner);
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (child->window == window || child->decor_window == window)
- return child;
-
- if (child->widget == owner) {
- *on_text = TRUE;
- return child;
- }
- }
-
- return NULL;
-}
-
-static void
-draw_xor_rect (GncalFullDay *fullday)
-{
- GtkWidget *widget;
- struct drag_info *di;
- int i;
- int row_height;
- int ythickness;
-
- widget = GTK_WIDGET (fullday);
-
- gdk_gc_set_function (widget->style->white_gc, GDK_INVERT);
- gdk_gc_set_subwindow (widget->style->white_gc, GDK_INCLUDE_INFERIORS);
-
- ythickness = widget->style->klass->ythickness;
-
- di = fullday->drag_info;
-
- row_height = calc_row_height (fullday);
-
- for (i = 0; i < XOR_RECT_WIDTH; i++)
- gdk_draw_rectangle (widget->window,
- widget->style->white_gc,
- FALSE,
- di->child->x + i,
- di->child_start_row * row_height + ythickness + i,
- di->child->width - 2 * i - 1,
- di->child_rows_used * row_height - 2 - 2 * i);
-
- gdk_gc_set_function (widget->style->white_gc, GDK_COPY);
- gdk_gc_set_subwindow (widget->style->white_gc, GDK_CLIP_BY_CHILDREN);
-}
-
-static int
-get_row_from_y (GncalFullDay *fullday, int y, int round)
-{
- GtkWidget *widget;
- int row_height;
- int f_rows;
- int ythickness;
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &f_rows);
-
- row_height = calc_row_height (fullday);
-
- widget = GTK_WIDGET (fullday);
-
- ythickness = widget->style->klass->ythickness;
-
- y -= ythickness;
-
- if (y < 0)
- y = 0;
- else if (y >= (f_rows * row_height))
- y = f_rows * row_height - 1;
-
- if (round)
- y += row_height / 2;
-
- y /= row_height;
-
- if (y > f_rows)
- y = f_rows; /* note that this is 1 more than the last row's index */
-
- return y;
-}
-
-static int
-button_1 (GncalFullDay *fullday, GdkEventButton *event)
-{
- GtkWidget *widget;
- Child *child;
- int on_text;
- struct drag_info *di;
- gint y;
- int row_height;
- int has_focus;
- int old_start_row, old_rows_used;
- int old_max;
- int paint_start_row, paint_rows_used;
-
- widget = GTK_WIDGET (fullday);
-
- if (event->window == widget->window) {
- /* Clicked on main window */
-
- if (!GTK_WIDGET_HAS_FOCUS (widget))
- gtk_widget_grab_focus (widget);
-
- /* Prepare for drag */
-
- di = fullday->drag_info;
-
- di->drag_mode = DRAG_SELECT;
-
- old_start_row = di->sel_start_row;
- old_rows_used = di->sel_rows_used;
-
- di->sel_click_row = get_row_from_y (fullday, event->y, FALSE);
- di->sel_start_row = di->sel_click_row;
- di->sel_rows_used = 1;
-
- di->click_time = event->time;
-
- gdk_pointer_grab (widget->window, FALSE,
- (GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_RELEASE_MASK),
- NULL,
- fullday->up_down_cursor,
- event->time);
-
- if (old_rows_used == 0) {
- paint_start_row = di->sel_start_row;
- paint_rows_used = di->sel_rows_used;
- } else {
- paint_start_row = MIN (old_start_row, di->sel_start_row);
- old_max = old_start_row + old_rows_used - 1;
- paint_rows_used = MAX (old_max, di->sel_start_row) - paint_start_row + 1;
- }
-
- paint_back_rows (fullday, paint_start_row, paint_rows_used);
-
- return TRUE;
- } else {
- /* Clicked on a child? */
-
- child = find_child_by_window (fullday, event->window, &on_text);
-
- if (!child || on_text || child->ico->recur)
- return FALSE;
-
- /* Prepare for drag */
-
- di = fullday->drag_info;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- has_focus = GTK_WIDGET_HAS_FOCUS (child->widget);
-
- if (has_focus) {
- if (event->y < HANDLE_SIZE)
- di->drag_mode = DRAG_SIZE_TOP;
- else if (event->y >= (child->height - HANDLE_SIZE))
- di->drag_mode = DRAG_SIZE_BOTTOM;
- else
- di->drag_mode = DRAG_MOVE;
- } else
- di->drag_mode = DRAG_MOVE;
-
- row_height = calc_row_height (fullday);
-
- di->child = child;
-
- di->child_click_y = event->y;
- di->child_start_row = child->lower_row;
- di->child_rows_used = child->rows_used;
-
- gdk_pointer_grab (child->window, FALSE,
- (GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_RELEASE_MASK),
- NULL,
- fullday->up_down_cursor,
- event->time);
-
- draw_xor_rect (fullday);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static int
-button_3 (GncalFullDay *fullday, GdkEventButton *event)
-{
- static struct menu_item main_items[] = {
- { N_("New appointment..."), (GtkSignalFunc) new_appointment, NULL, TRUE }
- };
-
- GtkWidget *widget;
- Child *child;
- int on_text;
-
- widget = GTK_WIDGET (fullday);
-
- if (event->window == widget->window) {
- /* Clicked on main window */
-
- if (!GTK_WIDGET_HAS_FOCUS (widget))
- gtk_widget_grab_focus (widget);
-
- main_items[0].data = fullday;
-
- popup_menu (main_items, sizeof (main_items) / sizeof (main_items[0]), event);
-
- return TRUE;
- } else {
- child = find_child_by_window (fullday, event->window, &on_text);
-
- if (!child || on_text)
- return FALSE;
-
- child_popup_menu (fullday, child, event);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- GncalFullDay *fullday;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- switch (event->button) {
- case 1:
- return button_1 (fullday, event);
-
- case 3:
- return button_3 (fullday, event);
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-static void
-recompute_motion (GncalFullDay *fullday, int y)
-{
- struct drag_info *di;
- int f_rows;
- int row;
- int has_focus;
-
- di = fullday->drag_info;
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &f_rows);
-
- switch (di->drag_mode) {
- case DRAG_SELECT:
- row = get_row_from_y (fullday, y, FALSE);
-
- if (row >= f_rows)
- row = f_rows - 1;
-
- if (row < di->sel_click_row) {
- di->sel_start_row = row;
- di->sel_rows_used = di->sel_click_row - row + 1;
- } else {
- di->sel_start_row = di->sel_click_row;
- di->sel_rows_used = row - di->sel_start_row + 1;
- }
-
- break;
-
- case DRAG_MOVE:
- has_focus = GTK_WIDGET_HAS_FOCUS (di->child->widget);
-
- if (has_focus)
- child_focus_out (di->child->widget, NULL, di->child);
-
- row = get_row_from_y (fullday, y - di->child_click_y + (has_focus ? HANDLE_SIZE : 0), TRUE);
-
- if (row > (f_rows - di->child_rows_used))
- row = f_rows - di->child_rows_used;
-
- di->child_start_row = row;
-
- break;
-
- case DRAG_SIZE_TOP:
- has_focus = GTK_WIDGET_HAS_FOCUS (di->child->widget);
-
- if (has_focus)
- child_focus_out (di->child->widget, NULL, di->child);
-
- row = get_row_from_y (fullday, y + HANDLE_SIZE, TRUE);
-
- if (row > (di->child_start_row + di->child_rows_used - 1))
- row = di->child_start_row + di->child_rows_used - 1;
-
- di->child_rows_used = (di->child_start_row + di->child_rows_used) - row;
- di->child_start_row = row;
-
- break;
-
- case DRAG_SIZE_BOTTOM:
- has_focus = GTK_WIDGET_HAS_FOCUS (di->child->widget);
-
- if (has_focus)
- child_focus_out (di->child->widget, NULL, di->child);
-
- row = get_row_from_y (fullday, y - HANDLE_SIZE, TRUE);
-
- if (row <= di->child_start_row)
- row = di->child_start_row + 1;
- else if (row > f_rows)
- row = f_rows;
-
- di->child_rows_used = row - di->child_start_row;
-
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-static void
-get_time_from_rows (GncalFullDay *fullday, int start_row, int rows_used, time_t *t_lower, time_t *t_upper)
-{
- struct tm tm;
- int row_height;
-
- get_tm_range (fullday, fullday->lower, fullday->upper, &tm, NULL, NULL, NULL);
-
- row_height = calc_row_height (fullday);
-
- tm.tm_min += fullday->interval * start_row;
- *t_lower = mktime (&tm);
-
- tm.tm_min += fullday->interval * rows_used;
- *t_upper = mktime (&tm);
-}
-
-static void
-update_from_drag_info (GncalFullDay *fullday)
-{
- struct drag_info *di;
- GtkWidget *widget;
-
- di = fullday->drag_info;
-
- widget = GTK_WIDGET (fullday);
-
- get_time_from_rows (fullday, di->child_start_row, di->child_rows_used,
- &di->child->ico->dtstart,
- &di->child->ico->dtend);
-
- child_range_changed (fullday, di->child);
-
- /* Notify calendar of change */
-
- gnome_calendar_object_changed (fullday->calendar, di->child->ico, CHANGE_DATES);
- save_default_calendar (fullday->calendar);
-}
-
-static gint
-gncal_full_day_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- GncalFullDay *fullday;
- struct drag_info *di;
- gint y;
- int retval;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- di = fullday->drag_info;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- retval = FALSE;
-
- switch (di->drag_mode) {
- case DRAG_NONE:
- break;
-
- case DRAG_SELECT:
- if ((event->time - di->click_time) < UNSELECT_TIMEOUT)
- di->sel_rows_used = 0;
- else
- recompute_motion (fullday, y);
-
- gdk_pointer_ungrab (event->time);
-
- paint_back_rows (fullday, di->sel_start_row, MAX (di->sel_rows_used, 1));
-
- retval = TRUE;
- break;
-
- case DRAG_MOVE:
- case DRAG_SIZE_TOP:
- case DRAG_SIZE_BOTTOM:
- draw_xor_rect (fullday);
- recompute_motion (fullday, y);
- gdk_pointer_ungrab (event->time);
-
- update_from_drag_info (fullday);
-
- di->child_rows_used = 0;
-
- retval = TRUE;
- break;
-
- default:
- g_assert_not_reached ();
- }
-
- di->drag_mode = DRAG_NONE;
- di->child = NULL;
-
- return retval;
-}
-
-static gint
-gncal_full_day_motion (GtkWidget *widget, GdkEventMotion *event)
-{
- GncalFullDay *fullday;
- struct drag_info *di;
- gint y;
- int old_min, old_max;
- int new_min, new_max;
- int new_start_row, new_rows_used;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
- di = fullday->drag_info;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- switch (di->drag_mode) {
- case DRAG_NONE:
- break;
-
- case DRAG_SELECT:
- old_min = di->sel_start_row;
- old_max = di->sel_start_row + di->sel_rows_used - 1;
-
- recompute_motion (fullday, y);
-
- new_min = di->sel_start_row;
- new_max = di->sel_start_row + di->sel_rows_used - 1;
-
- new_start_row = MIN (old_min, new_min);
- new_rows_used = MAX (old_max, new_max) - new_start_row + 1;
-
- paint_back_rows (fullday, new_start_row, new_rows_used);
-
- return TRUE;
-
- case DRAG_MOVE:
- case DRAG_SIZE_TOP:
- case DRAG_SIZE_BOTTOM:
- draw_xor_rect (fullday);
- recompute_motion (fullday, y);
- draw_xor_rect (fullday);
-
- return TRUE;
-
- default:
- g_assert_not_reached ();
- }
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- GncalFullDay *fullday;
- Child *child;
- int on_text;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return FALSE;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- if (event->window == widget->window)
- paint_back (fullday, &event->area);
- else {
- child = find_child_by_window (fullday, event->window, &on_text);
-
- if (child && !on_text)
- child_draw (fullday, child, &event->area, event->window, FALSE);
- }
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event)
-{
- GncalFullDay *fullday;
- struct drag_info *di;
- GList *children;
- Child *child;
- gint pos;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- di = fullday->drag_info;
-
- if (di->sel_rows_used == 0)
- return FALSE;
-
- if (event->keyval == GDK_Return) {
- gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals[RANGE_ACTIVATED]);
- return TRUE;
- }
-
- /*
- * If a non-printable key was pressed, bail. Otherwise, begin
- * editing the appointment.
- */
- if ((event->keyval < 0x20) || (event->keyval > 0xFF)
- || (event->length == 0) || (event->state & GDK_CONTROL_MASK)
- || (event->state & GDK_MOD1_MASK))
- return FALSE;
-
- gtk_signal_emit (GTK_OBJECT (fullday),
- fullday_signals[RANGE_ACTIVATED]);
-
- /*
- * Find the new child, which should hopefully be focused, and
- * insert the keypress.
- */
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (GTK_WIDGET_HAS_FOCUS (child->widget)) {
- pos = gtk_text_get_length (GTK_TEXT (child->widget));
-
- gtk_editable_insert_text (GTK_EDITABLE (child->widget),
- event->string,
- event->length,
- &pos);
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_focus_in (GtkWidget *widget, GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_focus_out (GtkWidget *widget, GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
- return FALSE;
-}
-
-static void
-gncal_full_day_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data)
-{
- GncalFullDay *fullday;
- GList *children;
- Child *child;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (container));
- g_return_if_fail (callback != NULL);
-
- fullday = GNCAL_FULL_DAY (container);
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- (*callback) (child->widget, callback_data);
- }
-}
-
-static gint
-child_compare (gconstpointer a, gconstpointer b)
-{
- const Child *ca = a;
- const Child *cb = b;
- time_t diff;
-
- diff = ca->start - cb->start;
-
- if (diff == 0)
- diff = cb->end - ca->end;
-
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-static int
-fullday_add_children (iCalObject *obj, time_t start, time_t end, void *c)
-{
- GncalFullDay *fullday = c;
- Child *child;
-
- child = child_new (fullday, start, end, obj);
- fullday->children = g_list_insert_sorted (fullday->children, child, child_compare);
-
- return 1;
-}
-
-void
-gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags)
-{
- GList *children;
- Child *child;
-
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (fullday));
-
- if (!fullday->calendar->cal)
- return;
-
- /* Try to find child that changed */
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (child->ico == ico)
- break;
- }
-
- /* If child was found and nothing but the summary changed, we can just paint the child and return */
-
- if (children && !(flags & ~CHANGE_SUMMARY)) {
- child_draw (fullday, child, NULL, NULL, TRUE);
- return;
- }
-
- /* We have to regenerate and layout our list of children */
-
- destroy_children (fullday);
-
- calendar_iterate (fullday->calendar->cal,
- fullday->lower,
- fullday->upper,
- fullday_add_children,
- fullday);
-
- layout_children (fullday);
-
- /* Realize and map children */
-
- for (children = fullday->children; children; children = children->next) {
- if (GTK_WIDGET_REALIZED (fullday))
- child_realize (fullday, children->data);
-
- if (GTK_WIDGET_MAPPED (fullday))
- child_map (fullday, children->data);
- }
-
- gtk_widget_draw (GTK_WIDGET (fullday), NULL);
-}
-
-void
-gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper)
-{
- struct drag_info *di;
-
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (fullday));
-
- if ((lower != fullday->lower) || (upper != fullday->upper)) {
- fullday->lower = lower;
- fullday->upper = upper;
-
- di = fullday->drag_info;
-
- di->sel_rows_used = 0; /* clear selection */
-
- gncal_full_day_update (fullday, NULL, 0);
- }
-}
-
-int
-gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper)
-{
- struct drag_info *di;
- time_t alower, aupper;
-
- g_return_val_if_fail (fullday != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (fullday), FALSE);
-
- di = fullday->drag_info;
-
- if (di->sel_rows_used == 0){
- time_t now = time (NULL);
- struct tm tm = *localtime (&now);
- struct tm thisd = *localtime (&fullday->lower);
-
- thisd.tm_hour = tm.tm_hour;
- thisd.tm_min = tm.tm_min;
- thisd.tm_sec = 0;
- *lower = mktime (&thisd);
- thisd.tm_hour++;
- *upper = mktime (&thisd);
- return FALSE;
- }
-
- get_time_from_rows (fullday, di->sel_start_row, di->sel_rows_used, &alower, &aupper);
-
- if (lower)
- *lower = alower;
-
- if (upper)
- *upper= aupper;
-
- return TRUE;
-}
-
-void
-gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico)
-{
- GList *children;
- Child *child;
-
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (ico != NULL);
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (child->ico == ico) {
- gtk_widget_grab_focus (child->widget);
- break;
- }
- }
-}
-
-int
-gncal_full_day_get_day_start_yoffset (GncalFullDay *fullday)
-{
- GtkWidget *widget;
- int begin_row;
-
- g_return_val_if_fail (fullday != NULL, 0);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (fullday), 0);
-
- widget = GTK_WIDGET (fullday);
-
- begin_row = (day_begin * 60) / fullday->interval;
-
- return widget->style->klass->ythickness + begin_row * calc_row_height (fullday);
-}
-
-static void
-range_activated (GncalFullDay *fullday)
-{
- struct drag_info *di;
-
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (fullday));
-
- di = fullday->drag_info;
-
- /* Remove selection; at this point someone should already have added an appointment */
-
- di->sel_rows_used = 0;
-
- paint_back (fullday, NULL);
-}
diff --git a/calendar/gncal-full-day.h b/calendar/gncal-full-day.h
deleted file mode 100644
index 287c5f63f6..0000000000
--- a/calendar/gncal-full-day.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Full day widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef GNCAL_FULL_DAY_H
-#define GNCAL_FULL_DAY_H
-
-
-#include <gtk/gtkcontainer.h>
-#include <libgnome/gnome-defs.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_FULL_DAY(obj) GTK_CHECK_CAST (obj, gncal_full_day_get_type (), GncalFullDay)
-#define GNCAL_FULL_DAY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_full_day_get_type (), GncalFullDayClass)
-#define GNCAL_IS_FULL_DAY(obj) GTK_CHECK_TYPE (obj, gncal_full_day_get_type ())
-
-
-typedef struct _GncalFullDay GncalFullDay;
-typedef struct _GncalFullDayClass GncalFullDayClass;
-
-struct _GncalFullDay {
- GtkContainer container;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- time_t lower; /* lower time to display */
- time_t upper; /* upper time to display */
- int interval; /* interval between rows in minutes */
-
- GList *children; /* container children */
- gpointer drag_info; /* internal drag information */
-
- GdkCursor *up_down_cursor; /* for dragging children */
- GdkCursor *beam_cursor; /* for the text widgets */
- GdkGC *recur_gc; /* The gc used to draw the recur image */
- GdkGC *bell_gc; /* The gc used to draw on imlib windows */
-
-};
-
-struct _GncalFullDayClass {
- GtkContainerClass parent_class;
-
- void (* range_activated) (GncalFullDay *fullday);
-};
-
-
-guint gncal_full_day_get_type (void);
-GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
-
-void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags);
-void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
-
-/* Returns the selected range in lower and upper. If nothing is
- * selected, return value is FALSE, otherwise it is TRUE.
- * The lower and upper values are always set to proper values, regardless of
- * the selection value
- */
-int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
-
-void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico);
-
-int gncal_full_day_get_day_start_yoffset (GncalFullDay *fullday);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gncal-todo.c b/calendar/gncal-todo.c
deleted file mode 100644
index 3be3ac4517..0000000000
--- a/calendar/gncal-todo.c
+++ /dev/null
@@ -1,877 +0,0 @@
-/* To-do widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#include <config.h>
-#include <string.h>
-#include <gnome.h>
-#include "gncal-todo.h"
-#include "main.h"
-#include "popup-menu.h"
-#include "eventedit.h"
-
-int todo_show_due_date = 0;
-int todo_show_priority = 0;
-int todo_show_time_remaining = 0;
-
-int todo_item_dstatus_highlight_overdue = 0;
-int todo_item_dstatus_highlight_due_today = 0;
-int todo_item_dstatus_highlight_not_due_yet = 0;
-
-
-char *todo_overdue_font_text;
-gint todo_current_sort_column = 0;
-gint todo_current_sort_type = GTK_SORT_ASCENDING;
-
-gboolean todo_style_changed =0;
-gboolean todo_list_autoresize = 1;
-gboolean todo_list_redraw_in_progess = 0;
-static void gncal_todo_init (GncalTodo *todo);
-
-
-guint
-gncal_todo_get_type (void)
-{
- static guint todo_type = 0;
-
- if (!todo_type) {
- GtkTypeInfo todo_info = {
- "GncalTodo",
- sizeof (GncalTodo),
- sizeof (GncalTodoClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) gncal_todo_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- todo_type = gtk_type_unique (gtk_vbox_get_type (), &todo_info);
- }
-
- return todo_type;
-}
-
-static void
-ok_button (GtkWidget *widget, GnomeDialog *dialog)
-{
- iCalObject *ico;
- GncalTodo *todo;
- GtkEntry *entry;
- GnomeDateEdit *due_date;
- GtkText *comment;
- GtkSpinButton *priority;
-
- ico = gtk_object_get_user_data (GTK_OBJECT (dialog));
-
- todo = GNCAL_TODO (gtk_object_get_data (GTK_OBJECT (dialog), "gncal_todo"));
- entry = GTK_ENTRY (gtk_object_get_data (GTK_OBJECT (dialog), "summary_entry"));
- due_date = GNOME_DATE_EDIT (gtk_object_get_data(GTK_OBJECT(dialog), "due_date"));
- priority = GTK_SPIN_BUTTON (gtk_object_get_data(GTK_OBJECT(dialog), "priority"));
- comment = GTK_TEXT(gtk_object_get_data (GTK_OBJECT(dialog), "comment"));
- if (ico->summary)
- g_free (ico->summary);
- if (ico->comment)
- g_free (ico->comment);
- ico->dtend = gnome_date_edit_get_date (due_date);
- ico->summary = g_strdup (gtk_entry_get_text (entry));
- ico->priority = gtk_spin_button_get_value_as_int (priority);
- ico->comment = gtk_editable_get_chars( GTK_EDITABLE(comment), 0, -1);
- ico->user_data = NULL;
-
- if (ico->new) {
- gnome_calendar_add_object (todo->calendar, ico);
- ico->new = FALSE;
- } else
- gnome_calendar_object_changed (todo->calendar, ico, CHANGE_ALL); /* ok, summary only... */
-
- save_default_calendar (todo->calendar);
- gtk_widget_destroy (GTK_WIDGET (dialog));
-}
-
-static void
-cancel_button (GtkWidget *widget, GnomeDialog *dialog)
-{
- iCalObject *ico;
-
- ico = gtk_object_get_user_data (GTK_OBJECT (dialog));
-
- ico->user_data = NULL;
-
- if (ico->new)
- ical_object_destroy (ico);
-
- gtk_widget_destroy (GTK_WIDGET (dialog));
-
-
-}
-
-static gint
-delete_event (GtkWidget *widget, GdkEvent *event, GnomeDialog *dialog)
-{
- cancel_button (NULL, dialog);
- return TRUE;
-}
-
-static void
-simple_todo_editor (GncalTodo *todo, iCalObject *ico)
-{
- GtkWidget *dialog;
- GtkWidget *hbox;
- GtkWidget *due_box;
- GtkWidget *due_label;
- GtkWidget *due_entry;
- GtkWidget *comment_box;
- GtkWidget *comment_label;
- GtkWidget *comment_text;
- GtkWidget *comment_internal_box;
- GtkWidget *comment_sep;
- GtkWidget *w;
- GtkWidget *pri_box;
- GtkWidget *pri_label;
- GtkWidget *pri_spin;
- GtkObject *pri_adj;
-
- GtkWidget *entry;
-
- dialog = gnome_dialog_new (ico->new ? _("Create to-do item") : _("Edit to-do item"),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
- gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (todo->calendar));
- hbox = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (hbox), 4);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
-
- due_box = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (due_box), 4);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), due_box, FALSE, FALSE, 0);
- gtk_widget_show (due_box);
-
- pri_box = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (pri_box), 4);
- gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)->vbox), pri_box, FALSE, FALSE, 0);
- gtk_widget_show (pri_box);
-
- comment_box = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (comment_box), 4);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), comment_box, FALSE, FALSE, 0);
- gtk_widget_show (comment_box);
-
- comment_internal_box = gtk_vbox_new(FALSE,2);
- gtk_container_border_width (GTK_CONTAINER (comment_internal_box), 4);
-
- gtk_box_pack_start (GTK_BOX (comment_box), comment_internal_box, TRUE, TRUE, 0);
- gtk_widget_show (comment_internal_box);
-
- w = gtk_label_new (_("Summary:"));
- gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- entry = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (entry), ico->summary);
- gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
- gtk_widget_show (entry);
-
-
- due_label = gtk_label_new (_("Due Date:"));
- gtk_box_pack_start (GTK_BOX (due_box), due_label, FALSE, FALSE, 0);
- gtk_widget_show (due_label);
-
- due_entry = gtk_entry_new ();
- due_entry = date_edit_new (ico->dtend, TRUE);
- gtk_box_pack_start (GTK_BOX (due_box), due_entry, TRUE, TRUE, 0);
- gtk_widget_show (due_entry);
-
- pri_label = gtk_label_new (_("Priority:"));
- gtk_box_pack_start (GTK_BOX (pri_box), pri_label, FALSE, FALSE, 0);
- gtk_widget_show (pri_label);
-
- pri_adj = gtk_adjustment_new (5.0, 1.0, 9.0, 1.0, 3.0, 0.0);
- pri_spin = gtk_spin_button_new (GTK_ADJUSTMENT(pri_adj), 0.0, 0);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (pri_spin), TRUE);
- gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (pri_spin), FALSE);
- gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (pri_spin), FALSE);
- gtk_box_pack_start (GTK_BOX (pri_box), pri_spin, FALSE, FALSE, 0);
- gtk_widget_show (pri_spin);
-
- comment_sep = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (comment_box), comment_sep, FALSE, FALSE, 0);
- gtk_widget_show(comment_sep);
-
- comment_label = gtk_label_new (_("Item Comments:"));
- gtk_label_set_justify(GTK_LABEL(comment_label), GTK_JUSTIFY_LEFT);
- gtk_box_pack_start (GTK_BOX (comment_internal_box), comment_label, TRUE, TRUE, 0);
- gtk_widget_show (comment_label);
-
-
-
-
- comment_text = gtk_text_new (NULL, NULL);
- gtk_text_set_editable (GTK_TEXT (comment_text), TRUE);
- gtk_text_set_word_wrap( GTK_TEXT(comment_text), TRUE);
- gtk_text_freeze(GTK_TEXT(comment_text));
- if(ico->comment) {
- gtk_text_insert(GTK_TEXT(comment_text), NULL, NULL, NULL, ico->comment, strlen(ico->comment));
- }
- gtk_text_thaw(GTK_TEXT(comment_text));
- gtk_box_pack_start (GTK_BOX (comment_internal_box), comment_text, FALSE, TRUE, 0);
- gtk_widget_show (comment_text);
-
- ico->user_data = dialog;
-
- gtk_object_set_user_data (GTK_OBJECT (dialog), ico);
-
- gtk_object_set_data (GTK_OBJECT (dialog), "gncal_todo", todo);
- gtk_object_set_data (GTK_OBJECT (dialog), "summary_entry", entry);
- gtk_object_set_data (GTK_OBJECT (dialog), "due_date", due_entry);
- gtk_object_set_data (GTK_OBJECT (dialog), "priority", pri_spin);
- gtk_object_set_data (GTK_OBJECT (dialog), "comment", comment_text);
-
- gnome_dialog_button_connect (GNOME_DIALOG (dialog), 0, (GtkSignalFunc) ok_button, dialog);
- gnome_dialog_button_connect (GNOME_DIALOG (dialog), 1, (GtkSignalFunc) cancel_button, dialog);
-
- gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
- (GtkSignalFunc) delete_event,
- dialog);
-
- gnome_dialog_set_default (GNOME_DIALOG (dialog), 0);
- gnome_dialog_editable_enters (GNOME_DIALOG (dialog), GTK_EDITABLE(entry));
-
- gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
- gtk_widget_show (dialog);
- gtk_widget_grab_focus (entry);
-}
-
-static iCalObject *
-get_clist_selected_ico (GtkCList *clist)
-{
- gint sel;
-
- if (!clist->selection)
- return NULL;
-
- sel = GPOINTER_TO_INT(clist->selection->data);
-
- return gtk_clist_get_row_data (clist, sel);
-}
-
-static void
-add_todo (GncalTodo *todo)
-{
- iCalObject *ico;
-
- ico = ical_new ("", user_name, "");
- ico->type = ICAL_TODO;
- ico->new = TRUE;
-
- simple_todo_editor (todo, ico);
-}
-
-static void
-edit_todo (GncalTodo *todo)
-{
- simple_todo_editor (todo, get_clist_selected_ico (todo->clist));
-}
-
-static void
-delete_todo (GncalTodo *todo)
-{
- gnome_calendar_remove_object (todo->calendar, get_clist_selected_ico (todo->clist));
- save_default_calendar (todo->calendar);
-
-}
-
-static void
-add_activated (GtkWidget *widget, GncalTodo *todo)
-{
- GtkWidget *w;
-
- while ((w = gtk_grab_get_current ()) != NULL)
- gtk_grab_remove (w);
-
- add_todo (todo);
-}
-
-static void
-edit_activated (GtkWidget *widget, GncalTodo *todo)
-{
- GtkWidget *w;
-
- while ((w = gtk_grab_get_current ()) != NULL)
- gtk_grab_remove (w);
-
- edit_todo (todo);
-}
-
-static void
-delete_activated (GtkWidget *widget, GncalTodo *todo)
-{
- delete_todo (todo);
-}
-
-
-static void
-clist_row_selected (GtkCList *clist, gint row, gint column, GdkEventButton *event, GncalTodo *todo)
-{
- static struct menu_item items[] = {
- { N_("Add to-do item..."), (GtkSignalFunc) add_activated, NULL, TRUE },
- { N_("Edit this item..."), (GtkSignalFunc) edit_activated, NULL, TRUE },
- { N_("Delete this item"), (GtkSignalFunc) delete_activated, NULL, TRUE }
- };
-
- int i;
-
- gtk_widget_set_sensitive (todo->edit_button, (todo->clist->selection != NULL));
- gtk_widget_set_sensitive (todo->delete_button, (todo->clist->selection != NULL));
-
- if (!event)
- return;
-
- switch (event->button) {
- case 1:
- if (event->type == GDK_2BUTTON_PRESS)
- edit_todo (todo);
- break;
-
- case 3:
- for (i = 0; i < (sizeof (items) / sizeof (items[0])); i++)
- items[i].data = todo;
-
- popup_menu (items, sizeof (items) / sizeof (items[0]), event);
- break;
-
- default:
- break;
- }
-}
-
-/*
- * once we get a call back stating that a column
- * has been resized never ever automatically resize again
- */
-void
-column_resized (GtkWidget *widget, GncalTodo *todo)
-{
- /* disabling autoresize of columns */
- if (todo_list_autoresize && !todo_list_redraw_in_progess){
- todo_list_autoresize = 0;
- }
-}
-
-/*
- * restore the previously set settings for sorting the
- * todo list
- */
-static void
-init_column_sorting (GtkCList *clist)
-{
-
- /* due date isn't shown so we can't sort by it */
- if (todo_current_sort_column == 1 && ! todo_show_due_date)
- todo_current_sort_column = 0;
-
- clist->sort_type = todo_current_sort_type;
- clist->sort_column = todo_current_sort_column;
-
- gtk_clist_set_sort_column (clist, todo_current_sort_column);
- gtk_clist_sort (clist);
-}
-
-static void
-todo_click_column (GtkCList *clist, gint column, gpointer data)
-{
- if (column == clist->sort_column)
- {
- if (clist->sort_type == GTK_SORT_ASCENDING) {
- clist->sort_type = GTK_SORT_DESCENDING;
- todo_current_sort_type = GTK_SORT_DESCENDING;
- } else {
- clist->sort_type = GTK_SORT_ASCENDING;
- todo_current_sort_type = GTK_SORT_ASCENDING;
- }
- }
- else {
- gtk_clist_set_sort_column (clist, column);
- todo_current_sort_column = column;
- }
-
- gtk_clist_sort (clist);
-
- /*
- * save the sorting preferences cause I hate to have the user
- * click twice
- */
-
- gnome_config_set_int("/calendar/Todo/sort_column", todo_current_sort_column);
- gnome_config_set_int("/calendar/Todo/sort_type", todo_current_sort_type);
- gnome_config_sync();
-}
-
-static void
-gncal_todo_init (GncalTodo *todo)
-{
- GtkWidget *w;
- GtkWidget *sw;
- GtkWidget *hbox;
- gchar *titles[4] = {
- N_("Summary"),
- N_("Due Date"),
- N_("Priority"),
- N_("Time Left")
- };
- char *tmp[4];
- tmp[0] = _(titles[0]);
- tmp[1] = _(titles[1]);
- tmp[2] = _(titles[2]);
- tmp[3] = _(titles[3]);
-
- gtk_box_set_spacing (GTK_BOX (todo), 4);
-
- /* Label */
-
- w = gtk_label_new (_("To-do list"));
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (todo), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- /* Clist */
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (todo), sw, TRUE, TRUE, 0);
- gtk_widget_show (sw);
-
-
- w = gtk_clist_new_with_titles(4, tmp);
-
- todo->clist = GTK_CLIST (w);
- gtk_clist_set_selection_mode (todo->clist, GTK_SELECTION_BROWSE);
-
- gtk_signal_connect (GTK_OBJECT (todo->clist), "select_row",
- (GtkSignalFunc) clist_row_selected,
- todo);
- gtk_clist_set_button_actions (todo->clist, 2, GTK_BUTTON_SELECTS);
- gtk_signal_connect (GTK_OBJECT (todo->clist), "resize_column",
- (GtkSignalFunc) column_resized,
- todo);
- gtk_signal_connect (GTK_OBJECT (todo->clist), "click_column",
- (GtkSignalFunc) todo_click_column, NULL);
-
- gtk_container_add (GTK_CONTAINER (sw), w);
- gtk_widget_show (w);
-
- /* Box for buttons */
-
- hbox = gtk_hbox_new (TRUE, 4);
- gtk_box_pack_start (GTK_BOX (todo), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- /* Add */
-
- w = gtk_button_new_with_label (_("Add..."));
- gtk_signal_connect (GTK_OBJECT (w), "clicked",
- (GtkSignalFunc) add_activated,
- todo);
- gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
- gtk_widget_show (w);
-
- /* Edit */
-
- w = gtk_button_new_with_label (_("Edit..."));
- todo->edit_button = w;
- gtk_widget_set_sensitive (w, FALSE);
- gtk_signal_connect (GTK_OBJECT (w), "clicked",
- (GtkSignalFunc) edit_activated,
- todo);
- gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
- gtk_widget_show (w);
-
- /* Delete */
-
- w = gtk_button_new_with_label (_("Delete"));
- todo->delete_button = w;
- gtk_widget_set_sensitive (w, FALSE);
- gtk_signal_connect (GTK_OBJECT (w), "clicked",
- (GtkSignalFunc) delete_activated,
- todo);
- gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
- gtk_widget_show (w);
-}
-
-GtkWidget *
-gncal_todo_new (GnomeCalendar *calendar)
-{
- GncalTodo *todo;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- todo = gtk_type_new (gncal_todo_get_type ());
-
- todo->calendar = calendar;
-
- gncal_todo_update (todo, NULL, 0);
-
- return GTK_WIDGET (todo);
-}
-
-static char *
-convert_time_t_to_char (time_t t)
-{
- char buf[100];
- struct tm tm;
-
- tm = *localtime (&t);
- strftime(buf, sizeof (buf), "%m/%d/%Y", &tm);
-
- return g_strdup (buf);
-}
-
-enum todo_styles {
- TODO_STYLE_OVERDUE,
- TODO_STYLE_DUE_TODAY,
- TODO_STYLE_NOT_DUE
-};
-
-
-enum todo_status {
- TODO_ITEM_DSTATUS_NOT_DUE_YET,
- TODO_ITEM_DSTATUS_DUE_TODAY,
- TODO_ITEM_DSTATUS_OVERDUE,
- TODO_ITEM_DSTATUS_LAST_DUE_STATUS
-};
-typedef enum todo_status todo_status;
-
-static GtkStyle *
-make_todo_style(GncalTodo *todo, todo_status style_type)
-{
- GtkStyle *style = NULL;
- GdkColor style_color;
- int color_prop = 0;
- switch(style_type) {
- case TODO_ITEM_DSTATUS_NOT_DUE_YET:
- color_prop = COLOR_PROP_TODO_NOT_DUE_YET;
- break;
- case TODO_ITEM_DSTATUS_DUE_TODAY:
- color_prop = COLOR_PROP_TODO_DUE_TODAY;
- break;
- case TODO_ITEM_DSTATUS_OVERDUE:
- color_prop = COLOR_PROP_TODO_OVERDUE;
- break;
- case TODO_ITEM_DSTATUS_LAST_DUE_STATUS:
- }
-
- style_color.red = color_props[color_prop].r;
- style_color.green = color_props[color_prop].g;
- style_color.blue = color_props[color_prop].b;
-
- style = gtk_style_copy (GTK_WIDGET (todo->clist)->style);
- style->base[GTK_STATE_NORMAL] = style_color;
- return style;
-}
-
-
-
-
-static
-todo_status todo_item_due_status(time_t *todo_due_time) {
- struct tm due_tm_time;
- struct tm current_time;
- struct tm *temp_tm;
- time_t current_time_val = time(NULL);
- temp_tm = localtime(todo_due_time);
- /* make a copy so it dosen't get over written */
- memcpy(&due_tm_time, temp_tm, sizeof(struct tm));
-
-
- temp_tm = localtime(&current_time_val);
- memcpy(&current_time, temp_tm, sizeof(struct tm));
-
- if(due_tm_time.tm_mon == current_time.tm_mon &&
- due_tm_time.tm_mday == current_time.tm_mday &&
- due_tm_time.tm_year == current_time.tm_year) {
- return TODO_ITEM_DSTATUS_DUE_TODAY;
- }
-
- if((*todo_due_time) < current_time_val) {
- return TODO_ITEM_DSTATUS_OVERDUE;
- }
-
- return TODO_ITEM_DSTATUS_NOT_DUE_YET;
-}
-
-
-enum todo_remaining_time_form {
- TODO_ITEM_REMAINING_WEEKS,
- TODO_ITEM_REMAINING_DAYS,
- TODO_ITEM_REMAINING_HOURS,
- TODO_ITEM_REMAINING_MINUTES,
- TODO_ITEM_REMAINING_SECONDS
-};
-typedef enum todo_remaining_time_form todo_remaining_time_form;
-
-static void
-insert_in_clist (GncalTodo *todo, iCalObject *ico)
-{
- int i;
- char *text[4];
- char time_remaining_buffer[100];
- time_t time_remain;
- todo_remaining_time_form time_remaining_form;
- int sec_in_week = 3600*7*24;
- int sec_in_day = 3600*24;
- int sec_in_hour = 3600;
- int sec_in_minute = 60;
- int weeks = 0;
- int days = 0;
- int hours = 0;
- int minutes = 0;
- int seconds = 0;
-
-
- /* an array for the styles of items */
- static GtkStyle *dstatus_styles[TODO_ITEM_DSTATUS_LAST_DUE_STATUS];
- /* we want to remake the styles when the status is changed,
- also we need to check for the null value in the pointer so we init them
- at startup */
- if (todo_style_changed || !dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]) {
- g_free(dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]);
- g_free(dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE]);
- g_free(dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY]);
-
- dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET] = make_todo_style(todo, TODO_ITEM_DSTATUS_NOT_DUE_YET);
- dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE] = make_todo_style(todo, TODO_ITEM_DSTATUS_OVERDUE);
- dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY] = make_todo_style(todo, TODO_ITEM_DSTATUS_DUE_TODAY);
-
- todo_style_changed = 0;
- }
-
-
-
-
-
- text[0] = ico->summary;
-
- if(todo_show_time_remaining) {
- memset(time_remaining_buffer, 0, 100);
- /* we need to make a string that represents the amount of time remaining
- before this task is due */
-
- /* for right now all I'll do is up to the hours. */
- time_remain = (ico->dtend - time(NULL));
- if(time_remain < 0) {
- text[3] = "Overdue!";
- }
- else {
-
- /* lets determine a decent denomination to display */
- if(time_remain / (sec_in_week))
- {
- /* we have weeks available */
- time_remaining_form = TODO_ITEM_REMAINING_WEEKS;
- weeks = time_remain / sec_in_week;
- days = (time_remain % (sec_in_week))/sec_in_day;
- }
- else if(time_remain / (sec_in_day))
- {
- /* we have days available */
- time_remaining_form = TODO_ITEM_REMAINING_DAYS;
- days = time_remain / sec_in_day;
- hours = (time_remain % sec_in_day)/sec_in_hour;
- }
- else if(time_remain / (sec_in_hour))
- {
- /* we have hours available */
- time_remaining_form = TODO_ITEM_REMAINING_HOURS;
- hours = time_remain /sec_in_hour;
- minutes = (time_remain % sec_in_hour) / sec_in_minute;
- }
- else if(time_remain / sec_in_minute)
- {
- time_remaining_form = TODO_ITEM_REMAINING_MINUTES;
- minutes = time_remain / sec_in_minute;
- seconds = time_remain % sec_in_minute;
- }
- else
- {
- time_remaining_form = TODO_ITEM_REMAINING_SECONDS;
- seconds = time_remain;
- }
-
- switch(time_remaining_form)
- {
- case TODO_ITEM_REMAINING_WEEKS:
- snprintf(time_remaining_buffer, 100, "%d %s %d %s", weeks,
- (weeks > 1) ? _("Weeks") : _("Week"),
- days, (days > 1) ? _("Days") : _("Day"));
- break;
- case TODO_ITEM_REMAINING_DAYS:
- snprintf(time_remaining_buffer, 100, "%d %s %d %s", days,
- (days > 1) ? _("Days") : _("Day"),
- hours, (hours > 1) ? _("Hours") : _("Hour"));
- break;
- case TODO_ITEM_REMAINING_HOURS:
- snprintf(time_remaining_buffer, 100, "%d %s %d %s", hours,
- (hours > 1) ? _("Hours") : _("Hour"),
- minutes, (minutes > 1) ? _("Minutes") : _("Minute"));
- break;
- case TODO_ITEM_REMAINING_MINUTES:
- snprintf(time_remaining_buffer, 100, "%d %s %d %s", minutes,
- (minutes > 1) ? _("Minutes") : _("Minute"),
- seconds, (seconds > 1) ? _("Seconds") : _("Second"));
- break;
- case TODO_ITEM_REMAINING_SECONDS:
- snprintf(time_remaining_buffer, 100, "%d %s", seconds,
- (seconds > 1) ? _("Seconds") : _("Second"));
- break;
- }
- text[3] = g_strdup(time_remaining_buffer);
- todo->data_ptrs = g_slist_append(todo->data_ptrs, text[3]);
- }
-
- }
- else {
- text[3] = "Loose penguini!";
- }
- /*
- * right now column 0 will be the summary
- * and column 1 will be the due date.
- * WISH: this should be able to be changed on the fly
- */
-
- if(ico->dtend && todo_show_due_date)
- {
- text[1] = convert_time_t_to_char (ico->dtend);
- /* Append the data's pointer so later it can be properly freed */
- todo->data_ptrs = g_slist_append (todo->data_ptrs, text[1]);
- }
- else
- text[1] = NULL;
-
- if(ico->priority && todo_show_priority)
- {
- text[2] = g_strdup_printf ("%d", ico->priority);
- todo->data_ptrs = g_slist_append (todo->data_ptrs, text[2]);
- }
- else
- text[2] = NULL;
-
- i = gtk_clist_append (todo->clist, text);
-
- gtk_clist_set_row_data (todo->clist, i, ico);
-
- /*
- * determine if the task is overdue..
- * if so mark with the apropriate style
- */
-
- switch(todo_item_due_status(&ico->dtend)) {
- case TODO_ITEM_DSTATUS_NOT_DUE_YET:
- if(todo_item_dstatus_highlight_not_due_yet)
- {
- gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]);
- }
- break;
- case TODO_ITEM_DSTATUS_DUE_TODAY:
- if(todo_item_dstatus_highlight_due_today)
- {
- gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY]);
- }
- break;
- case TODO_ITEM_DSTATUS_OVERDUE:
- if(todo_item_dstatus_highlight_overdue)
- {
- gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE]);
- }
- break;
- case TODO_ITEM_DSTATUS_LAST_DUE_STATUS:
- }
-
- /* keep the list in order */
- gtk_clist_sort (todo->clist);
-}
-
-void
-gncal_todo_update (GncalTodo *todo, iCalObject *ico, int flags)
-{
- GList *list;
- GSList *current_list;
-
- g_return_if_fail (todo != NULL);
- g_return_if_fail (GNCAL_IS_TODO (todo));
-
- /*
- * shut down the resize handler cause we are playing with the list.
- * In otherwords turn off the event handler
- */
- todo_list_redraw_in_progess =1;
-
- /* freeze the list */
- gtk_clist_freeze (todo->clist);
- init_column_sorting (todo->clist);
-
- /*
- * before here we have to free some of the memory that
- * stores the due date, or else we have a memory leak.
- * luckily all of the pointers are stored in todo->data_ptrs;
- */
-
- /* check on the columns that we should display */
- /* check for due date */
-
- if(todo_show_due_date) {
- gtk_clist_set_column_visibility (todo->clist, 1, 1);
- }
- else {
- gtk_clist_set_column_visibility (todo->clist, 1, 0);
- }
-
- if(todo_show_time_remaining) {
- gtk_clist_set_column_visibility (todo->clist, 3, 1);
- }
- else {
- gtk_clist_set_column_visibility (todo->clist, 3, 0);
- }
-
-
- if(todo_show_priority)
- gtk_clist_set_column_visibility (todo->clist, 2, 1);
- else
- gtk_clist_set_column_visibility (todo->clist, 2, 0);
-
- /* free the memory locations that were used in the previous display */
- for (current_list = todo->data_ptrs; current_list != NULL; current_list = g_slist_next(current_list)){
- g_free(current_list->data);
- }
-
- /* free the list and clear out the pointer */
- g_slist_free(todo->data_ptrs);
- todo->data_ptrs = NULL;
-
- gtk_clist_clear (todo->clist);
-
- for (list = todo->calendar->cal->todo; list; list = list->next)
- insert_in_clist (todo, list->data);
-
- /* if we are autoresizing then do it now */
- if(todo_list_autoresize && todo->clist->rows != 0)
- gtk_clist_columns_autosize (todo->clist);
-
- gtk_clist_thaw (todo->clist);
-
- gtk_widget_set_sensitive (todo->edit_button, (todo->clist->selection != NULL));
- gtk_widget_set_sensitive (todo->delete_button, (todo->clist->selection != NULL));
- todo_list_redraw_in_progess = 0;
-}
-
-
-
-
-
-
-
-
diff --git a/calendar/gncal-todo.h b/calendar/gncal-todo.h
deleted file mode 100644
index 51cfadea3f..0000000000
--- a/calendar/gncal-todo.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* To-do widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef GNCAL_TODO_H
-#define GNCAL_TODO_H
-
-#include <gtk/gtkclist.h>
-#include <gtk/gtkvbox.h>
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_TODO(obj) GTK_CHECK_CAST (obj, gncal_todo_get_type (), GncalTodo)
-#define GNCAL_TODO_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_todo_get_type (), GncalTodoClass)
-#define GNCAL_IS_TODO(obj) GTK_CHECK_TYPE (obj, gncal_todo_get_type ())
-
-
-typedef struct _GncalTodo GncalTodo;
-typedef struct _GncalTodoClass GncalTodoClass;
-
-struct _GncalTodo {
- GtkVBox vbox;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- GtkCList *clist;
-
- GtkWidget *edit_button;
- GtkWidget *delete_button;
- GSList *data_ptrs;
-
-
-};
-
-struct _GncalTodoClass {
- GtkVBoxClass parent_class;
-};
-
-
-guint gncal_todo_get_type (void);
-GtkWidget *gncal_todo_new (GnomeCalendar *calendar);
-
-void gncal_todo_update (GncalTodo *todo, iCalObject *ico, int flags);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gncal-week-view.c b/calendar/gncal-week-view.c
deleted file mode 100644
index 888c656ff4..0000000000
--- a/calendar/gncal-week-view.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/* Week view composite widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <quartic@gimp.org>
- * Miguel de Icaza <miguel@kernel.org>
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <string.h>
-#include <gtk/gtk.h>
-#include "gncal-week-view.h"
-#include "main.h"
-#include "timeutil.h"
-
-static void gncal_week_view_init (GncalWeekView *wview);
-
-
-guint
-gncal_week_view_get_type (void)
-{
- static guint week_view_type = 0;
-
- if (!week_view_type) {
- GtkTypeInfo week_view_info = {
- "GncalWeekView",
- sizeof (GncalWeekView),
- sizeof (GncalWeekViewClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) gncal_week_view_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- week_view_type = gtk_type_unique (gtk_vbox_get_type (), &week_view_info);
- }
-
- return week_view_type;
-}
-
-static void
-gncal_week_view_init (GncalWeekView *wview)
-{
- int i;
-
- wview->calendar = NULL;
- memset (&wview->start_of_week, 0, sizeof (wview->start_of_week));
-
- for (i = 0; i < 7; i++)
- wview->days[i] = NULL;
-
- wview->gtk_calendar = NULL;
-}
-
-static void
-jump_to_day (GtkCalendar *cal, GncalWeekView *wview, int day)
-{
- struct tm tm;
- time_t t;
- static int inside;
-
- if (inside)
- return;
- inside = 1;
- tm.tm_mday = day;
- tm.tm_mon = cal->month;
- tm.tm_year = cal->year - 1900;
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_isdst = -1;
- t = mktime (&tm);
-
- gncal_week_view_set (wview, t);
- inside = 0;
-}
-
-static void
-jump_to_day_click (GtkCalendar *cal, GncalWeekView *wview)
-{
- jump_to_day (cal, wview, cal->selected_day);
-}
-
-static void
-sync_week (GtkCalendar *cal, GncalWeekView *wview)
-{
- jump_to_day (cal, wview, wview->start_of_week.tm_mday + 7);
- gnome_calendar_tag_calendar (wview->calendar, wview->gtk_calendar);
-}
-
-static void
-double_click_on_weekday (GtkWidget *widget, GdkEvent *e, GncalWeekView *wview)
-{
-}
-
-GtkWidget *
-gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week)
-{
- GncalWeekView *wview;
- GtkWidget *table;
- int i;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- wview = gtk_type_new (gncal_week_view_get_type ());
-
- table = gtk_table_new (0, 0, 0);
- gtk_table_set_homogeneous (GTK_TABLE (table), TRUE);
- wview->label = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (wview), wview->label, 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (wview), table, 1, 1, 0);
- wview->calendar = calendar;
- for (i = 0; i < 7; i++) {
- wview->days[i] = GNCAL_DAY_VIEW (gncal_day_view_new (calendar, 0, 0));
- gtk_signal_connect (GTK_OBJECT (wview->days [i]), "button_press_event",
- GTK_SIGNAL_FUNC(double_click_on_weekday), wview);
-
- if (i < 5)
- gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (wview->days[i]),
- i, i + 1,
- 0, 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
- else
- gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (wview->days[i]),
- i - 2, i - 1,
- 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- gtk_widget_show (GTK_WIDGET (wview->days[i]));
- }
-
- wview->gtk_calendar = GTK_CALENDAR (gtk_calendar_new ());
-
- gtk_signal_connect (GTK_OBJECT (wview->gtk_calendar), "day_selected_double_click",
- GTK_SIGNAL_FUNC(jump_to_day_click), wview);
- gtk_signal_connect (GTK_OBJECT (wview->gtk_calendar), "month_changed",
- GTK_SIGNAL_FUNC(sync_week), wview);
-
- gtk_calendar_display_options (wview->gtk_calendar,
- (GTK_CALENDAR_SHOW_HEADING
- | GTK_CALENDAR_SHOW_DAY_NAMES
- | (week_starts_on_monday
- ? GTK_CALENDAR_WEEK_START_MONDAY : 0)));
-
- gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (wview->gtk_calendar),
- 0, 3,
- 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 4, 4);
- gtk_widget_show (GTK_WIDGET (wview->gtk_calendar));
-
- gncal_week_view_set (wview, start_of_week);
-
- return GTK_WIDGET (wview);
-}
-
-static void
-update (GncalWeekView *wview, int update_days, iCalObject *object, int flags)
-{
- int i;
-
- if (update_days)
- for (i = 0; i < 7; i++)
- gncal_day_view_update (wview->days[i], object, flags);
-
- /* FIXME: update extra widgets */
-}
-
-void
-gncal_week_view_update (GncalWeekView *wview, iCalObject *ico, int flags)
-{
- g_return_if_fail (wview != NULL);
- g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview));
-
- update (wview, TRUE, ico, flags);
-}
-
-void
-gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
-{
- struct tm tm;
- time_t day_start, day_end, week_start, week_end;
- int i;
-
- g_return_if_fail (wview != NULL);
- g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview));
-
- tm = *localtime (&start_of_week);
-
- /* back up to start of week (Monday) */
-
- tm.tm_mday -= (tm.tm_wday == 0) ? 6 : (tm.tm_wday - 1);
-
- /* Start of day */
-
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- day_start = week_start = mktime (&tm);
-
- /* Calendar */
-
- gtk_calendar_select_month (wview->gtk_calendar, tm.tm_mon, tm.tm_year + 1900);
-
- /* Day views */
-
- for (i = 0; i < 7; i++) { /* rest of days */
- tm.tm_mday++;
- day_end = mktime (&tm);
-
- gncal_day_view_set_bounds (wview->days[i], day_start, day_end - 1);
-
- day_start = day_end;
- }
-
- update (wview, FALSE, NULL, 0);
-
- /* The label */
- {
- char buf [3][100];
-
- week_end = time_add_day (week_start, 6);
-
- strftime (buf[0], sizeof (buf[0]), _("%a %b %d %Y"),
- localtime(&week_start));
-
- strftime (buf[1], sizeof (buf[1]), _("%a %b %d %Y"),
- localtime(&week_end));
-
- g_snprintf(buf[2], sizeof(buf[2]), "%s - %s", buf[0], buf[1]);
- gtk_label_set (GTK_LABEL (wview->label), buf[2]);
-
- }
-}
-
-void
-gncal_week_view_time_format_changed (GncalWeekView *wview)
-{
- g_return_if_fail (wview != NULL);
- g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview));
-
- gtk_calendar_display_options (wview->gtk_calendar,
- (week_starts_on_monday
- ? (wview->gtk_calendar->display_flags
- | GTK_CALENDAR_WEEK_START_MONDAY)
- : (wview->gtk_calendar->display_flags
- & ~GTK_CALENDAR_WEEK_START_MONDAY)));
-}
diff --git a/calendar/gncal-week-view.h b/calendar/gncal-week-view.h
deleted file mode 100644
index ab06161844..0000000000
--- a/calendar/gncal-week-view.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Week view composite widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef WEEK_VIEW_H
-#define WEEK_VIEW_H
-
-
-#include <gtk/gtkvbox.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkvbox.h>
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-#include "gncal-day-view.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_WEEK_VIEW(obj) GTK_CHECK_CAST (obj, gncal_week_view_get_type (), GncalWeekView)
-#define GNCAL_WEEK_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_week_view_get_type (), GncalWeekViewClass)
-#define GNCAL_IS_WEEK_VIEW(obj) GTK_CHECK_TYPE (obj, gncal_week_view_get_type ())
-
-
-typedef struct _GncalWeekView GncalWeekView;
-typedef struct _GncalWeekViewClass GncalWeekViewClass;
-
-struct _GncalWeekView {
- GtkVBox box;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- struct tm start_of_week;
-
- GncalDayView *days[7]; /* the day view widgets */
- GtkCalendar *gtk_calendar; /* At least for now; see the FIXME comments in the .c file */
- GtkWidget *label;
-};
-
-struct _GncalWeekViewClass {
- GtkVBoxClass parent_class;
-};
-
-
-guint gncal_week_view_get_type (void);
-GtkWidget *gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week);
-
-void gncal_week_view_update (GncalWeekView *wview, iCalObject *ico, int flags);
-void gncal_week_view_set (GncalWeekView *wview, time_t start_of_week);
-void gncal_week_view_time_format_changed (GncalWeekView *wview);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gncal.desktop b/calendar/gncal.desktop
deleted file mode 100644
index 0ffd97e1fe..0000000000
--- a/calendar/gncal.desktop
+++ /dev/null
@@ -1,35 +0,0 @@
-[Desktop Entry]
-Name=Calendar
-Name[da]=Kalender
-Name[de]=Kalender
-Name[el]=Çìåñïëüãéï
-Name[es]=Calendario
-Name[et]=Kalender
-Name[fi]=Kalenteri
-Name[fr]=Calendrier
-Name[ja]=¥«¥ì¥ó¥À¡¼
-Name[ko]=´Þ·Â
-Name[no]=Kalender
-Name[pt]=Agenda
-Name[pt_BR]=Calendário
-Name[ru]=ëÁÌÅÎÄÁÒØ
-Name[sv]=Kalender
-Comment=Calendar application
-Comment[da]=Gnome Kalender
-Comment[de]=Gnome Kalender
-Comment[el]=Çìåñïëüãéï ôïõ Gnome
-Comment[es]=Calendario de Gnome
-Comment[et]=GNOME kalender
-Comment[fi]=GNOME-kalenteri
-Comment[fr]=Calendrier GNOME
-Comment[ja]=GNOME¥«¥ì¥ó¥À¡¼
-Comment[ko]=±×³ð ´Þ·Â
-Comment[no]=Gnome Kalender
-Comment[pt]=Agenda Gnome
-Comment[pt_BR]=Calendário GNOME
-Comment[ru]=ëÁÌÅÎÄÁÒØ Gnome
-Comment[sv]=Gnome-kalender
-Exec=gnomecal
-Icon=gnome-calendar.png
-Terminal=0
-Type=Application
diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c
deleted file mode 100644
index 9b3479e473..0000000000
--- a/calendar/gnome-cal.c
+++ /dev/null
@@ -1,613 +0,0 @@
-/*
- * GnomeCalendar widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-#include <config.h>
-#include <gnome.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-#include "gncal-day-panel.h"
-#include "gncal-week-view.h"
-#include "month-view.h"
-#include "year-view.h"
-#include "timeutil.h"
-#include "main.h"
-#include "corba-cal.h"
-
-GnomeApp *parent_class;
-
-guint
-gnome_calendar_get_type (void)
-{
- static guint gnome_calendar_type = 0;
- if(!gnome_calendar_type) {
- GtkTypeInfo gnome_calendar_info = {
- "GnomeCalendar",
- sizeof(GnomeCalendar),
- sizeof(GnomeCalendarClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) NULL,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
- gnome_calendar_type = gtk_type_unique(gnome_app_get_type(), &gnome_calendar_info);
- parent_class = gtk_type_class (gnome_app_get_type());
- }
- return gnome_calendar_type;
-}
-
-static void
-setup_widgets (GnomeCalendar *gcal)
-{
- time_t now;
-
- now = time (NULL);
-
- gcal->notebook = gtk_notebook_new ();
- gcal->day_view = gncal_day_panel_new (gcal, now);
- gcal->week_view = gncal_week_view_new (gcal, now);
- gcal->month_view = month_view_new (gcal, now);
- gcal->year_view = year_view_new (gcal, now);
-
- gcal->year_view_sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (gcal->year_view_sw),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (gcal->year_view_sw), gcal->year_view);
- GTK_LAYOUT (gcal->year_view)->vadjustment->step_increment = 10.0;
- gtk_adjustment_changed (GTK_ADJUSTMENT (GTK_LAYOUT (gcal->year_view)->vadjustment));
-
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->day_view, gtk_label_new (_("Day View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->week_view, gtk_label_new (_("Week View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->month_view, gtk_label_new (_("Month View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->year_view_sw, gtk_label_new (_("Year View")));
-
- gtk_widget_show_all (gcal->notebook);
-
- gnome_app_set_contents (GNOME_APP (gcal), gcal->notebook);
-}
-
-static GtkWidget *
-get_current_page (GnomeCalendar *gcal)
-{
- return GTK_NOTEBOOK (gcal->notebook)->cur_page->child;
-}
-
-char *
-gnome_calendar_get_current_view_name (GnomeCalendar *gcal)
-{
- GtkWidget *page;
-
- g_return_val_if_fail (gcal != NULL, "dayview");
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), "dayview");
-
- page = get_current_page (gcal);
-
- if (page == gcal->day_view)
- return "dayview";
- else if (page == gcal->week_view)
- return "weekview";
- else if (page == gcal->month_view)
- return "monthview";
- else if (page == gcal->year_view_sw)
- return "yearview";
- else
- return "dayview";
-}
-
-void
-gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time)
-{
- GtkWidget *current;
-
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (new_time != -1);
-
- current = get_current_page (gcal);
- new_time = time_day_begin (new_time);
-
- if (current == gcal->day_view)
- gncal_day_panel_set (GNCAL_DAY_PANEL (gcal->day_view), new_time);
- else if (current == gcal->week_view)
- gncal_week_view_set (GNCAL_WEEK_VIEW (gcal->week_view), new_time);
- else if (current == gcal->month_view)
- month_view_set (MONTH_VIEW (gcal->month_view), new_time);
- else if (current == gcal->year_view_sw)
- year_view_set (YEAR_VIEW (gcal->year_view), new_time);
- else {
- g_warning ("My penguin is gone!");
- g_assert_not_reached ();
- }
-
- gcal->current_display = new_time;
-}
-
-static void
-gnome_calendar_direction (GnomeCalendar *gcal, int direction)
-{
- GtkWidget *cp = get_current_page (gcal);
- time_t new_time;
-
- if (cp == gcal->day_view)
- new_time = time_add_day (time_day_begin (gcal->current_display), 1 * direction);
- else if (cp == gcal->week_view)
- new_time = time_add_week (time_week_begin (gcal->current_display), 1 * direction);
- else if (cp == gcal->month_view)
- new_time = time_add_month (time_month_begin (gcal->current_display), 1 * direction);
- else if (cp == gcal->year_view_sw)
- new_time = time_add_year (time_year_begin (gcal->current_display), 1 * direction);
- else {
- g_warning ("Weee! Where did the penguin go?");
- g_assert_not_reached ();
- new_time = 0;
- }
-
- gnome_calendar_goto (gcal, new_time);
-}
-
-void
-gnome_calendar_next (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- gnome_calendar_direction (gcal, 1);
-}
-
-void
-gnome_calendar_previous (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- gnome_calendar_direction (gcal, -1);
-}
-
-void
-gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- gtk_notebook_set_page (GTK_NOTEBOOK (gcal->notebook), 0);
- gnome_calendar_goto (gcal, time);
-}
-
-void
-gnome_calendar_goto_today (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- gnome_calendar_goto (gcal, time (NULL));
-}
-
-void
-gnome_calendar_set_view (GnomeCalendar *gcal, char *page_name)
-{
- int page = 0;
-
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (page_name != NULL);
-
-
- if (strcmp (page_name, "dayview") == 0)
- page = 0;
- else if (strcmp (page_name, "weekview") == 0)
- page = 1;
- else if (strcmp (page_name, "monthview") == 0)
- page = 2;
- else if (strcmp (page_name, "yearview") == 0)
- page = 3;
- gtk_notebook_set_page (GTK_NOTEBOOK (gcal->notebook), page);
-}
-
-GtkWidget *
-gnome_calendar_new (char *title)
-{
- GtkWidget *retval;
- GnomeCalendar *gcal;
- GnomeApp *app;
-
- retval = gtk_type_new (gnome_calendar_get_type ());
- app = GNOME_APP (retval);
- gcal = GNOME_CALENDAR (retval);
-
- app->name = g_strdup ("calendar");
- app->prefix = g_strconcat ("/", app->name, "/", NULL);
-
- gtk_window_set_title(GTK_WINDOW(retval), title);
-
- gcal->current_display = time_day_begin (time (NULL));
- gcal->cal = calendar_new (title);
- setup_widgets (gcal);
- gnome_calendar_create_corba_server (gcal);
-
- return retval;
-}
-
-static void
-gnome_calendar_update_all (GnomeCalendar *cal, iCalObject *object, int flags)
-{
- gncal_day_panel_update (GNCAL_DAY_PANEL (cal->day_view), object, flags);
- gncal_week_view_update (GNCAL_WEEK_VIEW (cal->week_view), object, flags);
- month_view_update (MONTH_VIEW (cal->month_view), object, flags);
- year_view_update (YEAR_VIEW (cal->year_view), object, flags);
-}
-
-int
-gnome_calendar_load (GnomeCalendar *gcal, char *file)
-{
- char *r;
-
- g_return_val_if_fail (gcal != NULL, 0);
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), 0);
- g_return_val_if_fail (file != NULL, 0);
-
- if ((r = calendar_load (gcal->cal, file)) != NULL){
- printf ("Error loading calendar: %s\n", r);
- return 0;
- }
- gnome_calendar_update_all (gcal, NULL, 0);
- return 1;
-}
-
-void
-gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (obj != NULL);
-
- calendar_add_object (gcal->cal, obj);
- gnome_calendar_update_all (gcal, obj, CHANGE_NEW);
-}
-
-void
-gnome_calendar_remove_object (GnomeCalendar *gcal, iCalObject *obj)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (obj != NULL);
-
- calendar_remove_object (gcal->cal, obj);
- gnome_calendar_update_all (gcal, obj, CHANGE_ALL);
-}
-
-void
-gnome_calendar_object_changed (GnomeCalendar *gcal, iCalObject *obj, int flags)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (obj != NULL);
-
- gcal->cal->modified = TRUE;
-
- gnome_calendar_update_all (gcal, obj, flags);
- calendar_object_changed (gcal->cal, obj, flags);
-}
-
-static int
-max_open_files (void)
-{
- static int files;
-
- if (files)
- return files;
-
- files = sysconf (_SC_OPEN_MAX);
- if (files != -1)
- return files;
-#ifdef OPEN_MAX
- return files = OPEN_MAX;
-#else
- return files = 256;
-#endif
-}
-
-static void
-execute (char *command, int close_standard)
-{
- struct sigaction ignore, save_intr, save_quit;
- int status = 0, i;
- pid_t pid;
-
- ignore.sa_handler = SIG_IGN;
- sigemptyset (&ignore.sa_mask);
- ignore.sa_flags = 0;
-
- sigaction (SIGINT, &ignore, &save_intr);
- sigaction (SIGQUIT, &ignore, &save_quit);
-
- if ((pid = fork ()) < 0){
- fprintf (stderr, "\n\nfork () = -1\n");
- return;
- }
- if (pid == 0){
- pid = fork ();
- if (pid == 0){
- const int top = max_open_files ();
- sigaction (SIGINT, &save_intr, NULL);
- sigaction (SIGQUIT, &save_quit, NULL);
-
- for (i = (close_standard ? 0 : 3); i < top; i++)
- close (i);
-
- /* FIXME: As an excercise to the reader, copy the
- * code from mc to setup shell properly instead of
- * /bin/sh. Yes, this comment is larger than a cut and paste.
- */
- execl ("/bin/sh", "/bin/sh", "-c", command, (char *) 0);
-
- _exit (127);
- } else {
- _exit (127);
- }
- }
- wait (&status);
- sigaction (SIGINT, &save_intr, NULL);
- sigaction (SIGQUIT, &save_quit, NULL);
-}
-
-void
-mail_notify (char *mail_address, char *text, time_t app_time)
-{
- pid_t pid;
- int p [2];
- char *command;
-
- pipe (p);
- pid = fork ();
- if (pid == 0){
- int dev_null;
-
- dev_null = open ("/dev/null", O_RDWR);
- dup2 (p [0], 0);
- dup2 (dev_null, 1);
- dup2 (dev_null, 2);
- execl ("/usr/lib/sendmail", "/usr/lib/sendmail",
- mail_address, NULL);
- _exit (127);
- }
- command = g_strconcat ("To: ", mail_address, "\n",
- "Subject: ", _("Reminder of your appointment at "),
- ctime (&app_time), "\n\n", text, "\n", NULL);
- write (p [1], command, strlen (command));
- close (p [1]);
- close (p [0]);
- g_free (command);
-}
-
-static void
-stop_beeping (GtkObject* object, gpointer data)
-{
- guint timer_tag, beep_tag;
- timer_tag = GPOINTER_TO_INT (gtk_object_get_data (object, "timer_tag"));
- beep_tag = GPOINTER_TO_INT (gtk_object_get_data (object, "beep_tag"));
-
- if (beep_tag > 0) {
- gtk_timeout_remove (beep_tag);
- gtk_object_set_data (object, "beep_tag", GINT_TO_POINTER (0));
- }
- if (timer_tag > 0) {
- gtk_timeout_remove (timer_tag);
- gtk_object_set_data (object, "timer_tag", GINT_TO_POINTER (0));
- }
-}
-
-static gint
-start_beeping (gpointer data)
-{
- gdk_beep ();
-
- return TRUE;
-}
-
-static gint
-timeout_beep (gpointer data)
-{
- stop_beeping (data, NULL);
- return FALSE;
-}
-
-void
-calendar_notify (time_t activation_time, CalendarAlarm *which, void *data)
-{
- iCalObject *ico = data;
- guint beep_tag, timer_tag;
- int ret;
- gchar* snooze_button = (enable_snooze ? _("Snooze") : NULL);
- time_t now, diff;
-
- if (&ico->aalarm == which){
- time_t app = ico->aalarm.trigger + ico->aalarm.offset;
- GtkWidget *w;
- char *msg;
-
- msg = g_strconcat (_("Reminder of your appointment at "),
- ctime (&app), "`",
- ico->summary, "'", NULL);
-
- /* Idea: we need Snooze option :-) */
- w = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_INFO, _("Ok"), snooze_button, NULL);
- beep_tag = gtk_timeout_add (1000, start_beeping, NULL);
- if (enable_aalarm_timeout)
- timer_tag = gtk_timeout_add (audio_alarm_timeout*1000,
- timeout_beep, w);
- else
- timer_tag = 0;
- gtk_object_set_data (GTK_OBJECT (w), "timer_tag",
- GINT_TO_POINTER (timer_tag));
- gtk_object_set_data (GTK_OBJECT (w), "beep_tag",
- GINT_TO_POINTER (beep_tag));
- gtk_widget_ref (w);
- ret = gnome_dialog_run (GNOME_DIALOG (w));
- switch (ret) {
- case 1:
- stop_beeping (GTK_OBJECT (w), NULL);
- now = time (NULL);
- diff = now - which->trigger;
- which->trigger = which->trigger + diff + snooze_secs;
- which->offset = which->offset - diff - snooze_secs;
- alarm_add (which, &calendar_notify, data);
- break;
- default:
- stop_beeping (GTK_OBJECT (w), NULL);
- break;
- }
-
- gtk_widget_unref (w);
- return;
- }
-
- if (&ico->palarm == which){
- execute (ico->palarm.data, 0);
- return;
- }
-
- if (&ico->malarm == which){
- time_t app = ico->malarm.trigger + ico->malarm.offset;
-
- mail_notify (ico->malarm.data, ico->summary, app);
- return;
- }
-
- if (&ico->dalarm == which){
- time_t app = ico->dalarm.trigger + ico->dalarm.offset;
- GtkWidget *w;
- char *msg;
-
- if (beep_on_display)
- gdk_beep ();
- msg = g_strconcat (_("Reminder of your appointment at "),
- ctime (&app), "`",
- ico->summary, "'", NULL);
- w = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_INFO,
- _("Ok"), snooze_button, NULL);
- ret = gnome_dialog_run (GNOME_DIALOG (w));
- switch (ret) {
- case 1:
- now = time (NULL);
- diff = now - which->trigger;
- which->trigger = which->trigger + diff + snooze_secs;
- which->offset = which->offset - diff - snooze_secs;
- alarm_add (which, &calendar_notify, data);
- break;
- default:
- break;
- }
-
- return;
- }
-}
-
-/*
- * called from the calendar_iterate routine to mark the days of a GtkCalendar
- */
-static int
-mark_gtk_calendar_day (iCalObject *obj, time_t start, time_t end, void *c)
-{
- GtkCalendar *gtk_cal = c;
- struct tm tm_s;
- time_t t, day_end;
-
- tm_s = *localtime (&start);
- day_end = time_day_end (end);
-
- for (t = start; t <= day_end; t += 60*60*24){
- time_t new = mktime (&tm_s);
- struct tm tm_day;
-
- tm_day = *localtime (&new);
- gtk_calendar_mark_day (gtk_cal, tm_day.tm_mday);
- tm_s.tm_mday++;
- }
- return TRUE;
-}
-
-/*
- * Tags the dates with appointments in a GtkCalendar based on the
- * GnomeCalendar contents
- */
-void
-gnome_calendar_tag_calendar (GnomeCalendar *cal, GtkCalendar *gtk_cal)
-{
- time_t month_begin, month_end;
- struct tm tm;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (cal));
- g_return_if_fail (gtk_cal != NULL);
- g_return_if_fail (GTK_IS_CALENDAR (gtk_cal));
-
- /* compute month_begin */
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_mday = 1; /* setting this to zero is a no-no; it will set mktime back to the end of the
- previous month, which may be 28,29,30; this may chop some days from the calendar */
- tm.tm_mon = gtk_cal->month;
- tm.tm_year = gtk_cal->year - 1900;
- tm.tm_isdst= -1;
-
- month_begin = mktime (&tm);
- tm.tm_mon++;
- month_end = mktime (&tm);
-
- gtk_calendar_freeze (gtk_cal);
- gtk_calendar_clear_marks (gtk_cal);
- calendar_iterate (cal->cal, month_begin, month_end, mark_gtk_calendar_day, gtk_cal);
- gtk_calendar_thaw (gtk_cal);
-}
-
-void
-gnome_calendar_time_format_changed (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- /* FIXME: the queue resizes will do until we rewrite those views... */
-
- gncal_day_panel_time_format_changed (GNCAL_DAY_PANEL (gcal->day_view));
- gtk_widget_queue_resize (gcal->day_view);
- gncal_week_view_time_format_changed (GNCAL_WEEK_VIEW (gcal->week_view));
- gtk_widget_queue_resize (gcal->week_view);
- month_view_time_format_changed (MONTH_VIEW (gcal->month_view));
- year_view_time_format_changed (YEAR_VIEW (gcal->year_view));
-}
-
-void
-gnome_calendar_colors_changed (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- /* FIXME: add day and week view when they are done */
-
- month_view_colors_changed (MONTH_VIEW (gcal->month_view));
- year_view_colors_changed (YEAR_VIEW (gcal->year_view));
- todo_style_changed = 1;
- todo_list_properties_changed (GNCAL_DAY_PANEL (gcal->day_view));
-}
-
-void
-gnome_calendar_todo_properties_changed (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- /* FIXME: add day and week view when they are done */
-
- todo_style_changed = 1;
- todo_list_properties_changed (GNCAL_DAY_PANEL (gcal->day_view));
-}
-
-
diff --git a/calendar/gnome-cal.h b/calendar/gnome-cal.h
deleted file mode 100644
index da53f29882..0000000000
--- a/calendar/gnome-cal.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * GnomeCalendar widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#ifndef GNOME_CALENDAR_APP_H
-#define GNOME_CALENDAR_APP_H
-
-#include <gnome.h>
-
-#include "calendar.h"
-
-BEGIN_GNOME_DECLS
-
-#define GNOME_CALENDAR(obj) GTK_CHECK_CAST(obj, gnome_calendar_get_type(), GnomeCalendar)
-#define GNOME_CALENDAR_CLASS(class) GTK_CHECK_CAST_CLASS(class, gnome_calendar_get_type(), GnomeCalendarClass)
-#define GNOME_IS_CALENDAR(obj) GTK_CHECK_TYPE(obj, gnome_calendar_get_type())
-
-typedef struct {
- GnomeApp gnome_app;
- Calendar *cal;
- time_t current_display;
-
- GtkWidget *notebook;
- GtkWidget *day_view;
- GtkWidget *week_view;
- GtkWidget *month_view;
- GtkWidget *year_view;
- GtkWidget *year_view_sw;
- void *event_editor;
-} GnomeCalendar;
-
-typedef struct {
- GnomeAppClass parent_class;
-} GnomeCalendarClass;
-
-guint gnome_calendar_get_type (void);
-GtkWidget *gnome_calendar_new (char *title);
-int gnome_calendar_load (GnomeCalendar *gcal,
- char *file);
-void gnome_calendar_add_object (GnomeCalendar *gcal,
- iCalObject *obj);
-void gnome_calendar_remove_object (GnomeCalendar *gcal,
- iCalObject *obj);
-void gnome_calendar_next (GnomeCalendar *gcal);
-void gnome_calendar_previous (GnomeCalendar *gcal);
-void gnome_calendar_goto (GnomeCalendar *gcal,
- time_t new_time);
-void gnome_calendar_dayjump (GnomeCalendar *gcal,
- time_t time);
-/* Jumps to the current day */
-void gnome_calendar_goto_today (GnomeCalendar *gcal);
-void gnome_calendar_tag_calendar (GnomeCalendar *cal,
- GtkCalendar *gtk_cal);
-char *gnome_calendar_get_current_view_name (GnomeCalendar *gcal);
-void gnome_calendar_set_view (GnomeCalendar *gcal,
- char *page_name);
-
-/* Flags is a bitmask of CalObjectChange values */
-void gnome_calendar_object_changed (GnomeCalendar *gcal,
- iCalObject *obj,
- int flags);
-
-GnomeCalendar *gnome_calendar_locate (const char *pathname);
-
-/* Notifies the calendar that the time format has changed and it must update all its views */
-void gnome_calendar_time_format_changed (GnomeCalendar *gcal);
-
-/* Notifies the calendar that the todo list properties have changed and its time to update the views */
-void
-gnome_calendar_colors_changed (GnomeCalendar *gcal);
-
-/* Notifies the calendar that the todo list properties have changed and its time to update the views */
-void
-gnome_calendar_todo_properties_changed (GnomeCalendar *gcal);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gnome-cal.html b/calendar/gnome-cal.html
deleted file mode 100644
index 5a7d0a537f..0000000000
--- a/calendar/gnome-cal.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!-- Some simple instructions on how to use the help browser -->
-<BODY>
-<!-- <TITLE>GNOME Calendar Documentation</TITLE> -->
-<H2> GNOME Calendar Documentation </H2>
-<p>
-The GNOME calendar program is the calendaring program of the GNOME
-system. It uses the vCalendar standard for transfering calendar
-information (and is also the on-disk format used).
-
-<p>
-
-<a name="cmdline">
-<h2>Command line options</h2>
-
-Several options are available on the command line, they are:
-<ul>
- <li><tt>--events</tt> Displays the events for the date
- specified (or today, if no date is specified).
-
- <li><tt>--from DATE</tt> Define the beginning of the range for
- the event display, or the startup day on the calenday views.
- By default, the event will span the whole day specified in
- DATE.
-
- <li><tt>--to DATE</tt> Define the range end for the event
- display. If this is not specified, it will default to the end
- of the day specified by the <tt>--from</tt> option.
-
- <li><tt>--file FILE</tt> Set the calendar to the FILE
- specified on the command line.
-
- <li><tt>--todo</tt> Dumps the to-do values to standard output.
-</ul>
-
-<p>
-
-DATE is interpreted as being in the local time- zone, unless a
-specific timezone is specified. Examples of valid date specifications
-include: "1 month ago", "2 hours ago", "400000 seconds ago", "last
-year", "last Monday", "yesterday", "a fortnight ago", "3/31/92
-10:00:07 PST", "January 23, 1987 10:05pm", "22:00 GMT".
-
-</BODY>
-
diff --git a/calendar/gnome-calendar-conduit.png b/calendar/gnome-calendar-conduit.png
deleted file mode 100644
index e867ba90b2..0000000000
--- a/calendar/gnome-calendar-conduit.png
+++ /dev/null
Binary files differ
diff --git a/calendar/gnome-month-item.c b/calendar/gnome-month-item.c
deleted file mode 100644
index 58e393e4ee..0000000000
--- a/calendar/gnome-month-item.c
+++ /dev/null
@@ -1,1246 +0,0 @@
-/* General-purpose monthly calendar canvas item for GNOME
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include <math.h>
-#include <time.h>
-#include <gnome.h>
-#include "gnome-month-item.h"
-
-
-#define DEFAULT_FONT "-*-helvetica-medium-r-normal--10-*-*-*-p-*-*-*"
-
-
-/* Number of days in a month, for normal and leap years */
-static const int days_in_month[2][12] = {
- { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
- { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
-};
-
-/* The weird month of September 1752, where 3 Sep through 13 Sep were eliminated due to the
- * Gregorian reformation.
- */
-static const int sept_1752[42] = {
- 0, 0, 1, 2, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0
-};
-
-#define REFORMATION_DAY 639787 /* First day of the reformation, counted from 1 Jan 1 */
-#define MISSING_DAYS 11 /* They corrected out 11 days */
-#define THURSDAY 4 /* First day of reformation */
-#define SATURDAY 6 /* Offset value; 1 Jan 1 was a Saturday */
-#define SEPT_1752_START 2 /* Start day within month */
-#define SEPT_1752_END 20 /* End day within month */
-
-
-enum {
- ARG_0,
- ARG_YEAR,
- ARG_MONTH,
- ARG_X,
- ARG_Y,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_ANCHOR,
- ARG_HEAD_PADDING,
- ARG_DAY_PADDING,
- ARG_DAY_NAMES,
- ARG_HEADING_HEIGHT,
- ARG_HEADING_ANCHOR,
- ARG_DAY_ANCHOR,
- ARG_START_ON_MONDAY,
- ARG_HEAD_FONT,
- ARG_HEAD_FONTSET,
- ARG_HEAD_FONT_GDK,
- ARG_DAY_FONT,
- ARG_DAY_FONTSET,
- ARG_DAY_FONT_GDK,
- ARG_HEAD_COLOR,
- ARG_HEAD_COLOR_GDK,
- ARG_OUTLINE_COLOR,
- ARG_OUTLINE_COLOR_GDK,
- ARG_DAY_BOX_COLOR,
- ARG_DAY_BOX_COLOR_GDK,
- ARG_DAY_COLOR,
- ARG_DAY_COLOR_GDK
-};
-
-
-static void gnome_month_item_class_init (GnomeMonthItemClass *class);
-static void gnome_month_item_init (GnomeMonthItem *mitem);
-static void gnome_month_item_destroy (GtkObject *object);
-static void gnome_month_item_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-static void gnome_month_item_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-
-
-
-static GnomeCanvasGroupClass *parent_class;
-
-
-GtkType
-gnome_month_item_get_type (void)
-{
- static GtkType month_item_type = 0;
-
- if (!month_item_type) {
- GtkTypeInfo month_item_info = {
- "GnomeMonthItem",
- sizeof (GnomeMonthItem),
- sizeof (GnomeMonthItemClass),
- (GtkClassInitFunc) gnome_month_item_class_init,
- (GtkObjectInitFunc) gnome_month_item_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- month_item_type = gtk_type_unique (gnome_canvas_group_get_type (), &month_item_info);
- }
-
- return month_item_type;
-}
-
-static void
-gnome_month_item_class_init (GnomeMonthItemClass *class)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GtkObjectClass *) class;
- item_class = (GnomeCanvasItemClass *) class;
-
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
-
- gtk_object_add_arg_type ("GnomeMonthItem::year", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_YEAR);
- gtk_object_add_arg_type ("GnomeMonthItem::month", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_MONTH);
- gtk_object_add_arg_type ("GnomeMonthItem::x", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X);
- gtk_object_add_arg_type ("GnomeMonthItem::y", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y);
- gtk_object_add_arg_type ("GnomeMonthItem::width", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("GnomeMonthItem::height", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEIGHT);
- gtk_object_add_arg_type ("GnomeMonthItem::anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_ANCHOR);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEAD_PADDING);
- gtk_object_add_arg_type ("GnomeMonthItem::day_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_DAY_PADDING);
- gtk_object_add_arg_type ("GnomeMonthItem::day_names", GTK_TYPE_POINTER, GTK_ARG_WRITABLE, ARG_DAY_NAMES);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_height", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEADING_HEIGHT);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_HEADING_ANCHOR);
- gtk_object_add_arg_type ("GnomeMonthItem::day_anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_DAY_ANCHOR);
- gtk_object_add_arg_type ("GnomeMonthItem::start_on_monday", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_START_ON_MONDAY);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_FONT);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_fontset", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_FONTSET);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_font_gdk", GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_HEAD_FONT_GDK);
- gtk_object_add_arg_type ("GnomeMonthItem::day_font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_FONT);
- gtk_object_add_arg_type ("GnomeMonthItem::day_fontset", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_FONTSET);
- gtk_object_add_arg_type ("GnomeMonthItem::day_font_gdk", GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_DAY_FONT_GDK);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_COLOR);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_HEAD_COLOR_GDK);
- gtk_object_add_arg_type ("GnomeMonthItem::outline_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_OUTLINE_COLOR);
- gtk_object_add_arg_type ("GnomeMonthItem::outline_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_OUTLINE_COLOR_GDK);
- gtk_object_add_arg_type ("GnomeMonthItem::day_box_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_BOX_COLOR);
- gtk_object_add_arg_type ("GnomeMonthItem::day_box_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_DAY_BOX_COLOR_GDK);
- gtk_object_add_arg_type ("GnomeMonthItem::day_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_COLOR);
- gtk_object_add_arg_type ("GnomeMonthItem::day_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_DAY_COLOR_GDK);
-
- object_class->destroy = gnome_month_item_destroy;
- object_class->set_arg = gnome_month_item_set_arg;
- object_class->get_arg = gnome_month_item_get_arg;
-}
-
-/* Calculates the minimum heading height based on the heading font size and padding. It also
- * calculates the minimum width of the month item based on the width of the headings.
- */
-static void
-check_heading_sizes (GnomeMonthItem *mitem)
-{
- double m_height;
- double m_width;
- int width;
- int max_width;
- int i;
-
- /* Calculate minimum height */
-
- m_height = mitem->head_font->ascent + mitem->head_font->descent + 2 * mitem->head_padding;
-
- if (mitem->head_height < m_height)
- mitem->head_height = m_height;
-
- /* Go through each heading and remember the widest one */
-
- max_width = 0;
-
- for (i = 0; i < 7; i++) {
- width = gdk_string_width (mitem->head_font, mitem->day_names[i]);
- if (max_width < width)
- max_width = width;
- }
-
- m_width = 7 * (max_width + 2 * mitem->head_padding);
-
- if (mitem->width < m_width)
- mitem->width = m_width;
-}
-
-/* Calculates the minimum width and height of the month item based on the day font size and padding.
- * Assumes that the minimum heading height has already been computed.
- */
-static void
-check_day_sizes (GnomeMonthItem *mitem)
-{
- double m_height;
- double m_width;
- int width;
- int max_width;
- char buf[100];
- int i;
-
- /* Calculate minimum height */
-
- m_height = mitem->head_height + 6 * (mitem->day_font->ascent + mitem->day_font->descent + 2 * mitem->day_padding);
-
- if (mitem->height < m_height)
- mitem->height = m_height;
-
- /* Calculate minimum width */
-
- max_width = 0;
-
- for (i = 1; i < 32; i++) {
- sprintf (buf, "%d", i);
- width = gdk_string_width (mitem->day_font, buf);
- if (max_width < width)
- max_width = width;
- }
-
- m_width = 7 * (max_width + 2 * mitem->day_padding);
-
- if (mitem->width < m_width)
- mitem->width = m_width;
-}
-
-/* Calculates the minimum size of the month item based on the font sizes and paddings. If the
- * current size of the month item is smaller than the required minimum size, this function will
- * change the size to the appropriate values.
- */
-static void
-check_sizes (GnomeMonthItem *mitem)
-{
- check_heading_sizes (mitem);
- check_day_sizes (mitem);
-}
-
-/* Recalculates the position of the toplevel calendar group based on the logical position and anchor */
-static void
-reanchor (GnomeMonthItem *mitem)
-{
- double x, y;
-
- x = mitem->x;
- y = mitem->y;
-
- switch (mitem->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_SW:
- break;
-
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_S:
- x -= mitem->width / 2;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- x -= mitem->width;
- break;
- }
-
- switch (mitem->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_NE:
- break;
-
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_E:
- y -= mitem->height / 2;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- y -= mitem->height;
- break;
- }
-
- /* Explicitly use the canvas group class prefix since the month item class has x and y
- * arguments as well.
- */
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem),
- "GnomeCanvasGroup::x", x,
- "GnomeCanvasGroup::y", y,
- NULL);
-}
-
-/* Takes an anchor specification and the corners of a rectangle, and returns an anchored point with
- * respect to that rectangle.
- */
-static void
-get_label_anchor (GtkAnchorType anchor, double x1, double y1, double x2, double y2, double *x, double *y)
-{
- switch (anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_SW:
- *x = x1;
- break;
-
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_S:
- *x = (x1 + x2) / 2.0;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- *x = x2;
- break;
- }
-
- switch (anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_NE:
- *y = y1;
- break;
-
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_E:
- *y = (y1 + y2) / 2.0;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- *y = y2;
- break;
- }
-}
-
-/* Resets the position of the day name headings in the calendar */
-static void
-reshape_headings (GnomeMonthItem *mitem)
-{
- double width;
- int i;
- double x, y;
-
- width = mitem->width / 7;
-
- for (i = 0; i < 7; i++) {
- /* Group */
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i],
- "x", width * i,
- "y", 0.0,
- NULL);
-
- /* Box */
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_BOX + i],
- "x1", 0.0,
- "y1", 0.0,
- "x2", width,
- "y2", mitem->head_height,
- NULL);
-
- /* Label */
- get_label_anchor (mitem->head_anchor,
- mitem->head_padding,
- mitem->head_padding,
- width - mitem->head_padding,
- mitem->head_height - mitem->head_padding,
- &x, &y);
-
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
- "x", x,
- "y", y,
- "anchor", mitem->head_anchor,
- NULL);
- }
-}
-
-/* Resets the position of the days in the calendar */
-static void
-reshape_days (GnomeMonthItem *mitem)
-{
- double width, height;
- double x, y;
- int row, col;
- int i;
-
- width = mitem->width / 7;
- height = (mitem->height - mitem->head_height) / 6;
-
- i = 0;
-
- for (row = 0; row < 6; row++)
- for (col = 0; col < 7; col++) {
- /* Group */
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i],
- "x", width * col,
- "y", mitem->head_height + height * row,
- NULL);
-
- /* Box */
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_BOX + i],
- "x1", 0.0,
- "y1", 0.0,
- "x2", width,
- "y2", height,
- NULL);
-
- /* Label */
- get_label_anchor (mitem->day_anchor,
- mitem->day_padding,
- mitem->day_padding,
- width - mitem->day_padding,
- height - mitem->day_padding,
- &x, &y);
-
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "x", x,
- "y", y,
- "anchor", mitem->day_anchor,
- NULL);
-
- i++;
- }
-}
-
-/* Changes the positions and resizes the items in the calendar to match the new size of the
- * calendar.
- */
-static void
-reshape (GnomeMonthItem *mitem)
-{
- check_sizes (mitem);
- reanchor (mitem);
- reshape_headings (mitem);
- reshape_days (mitem);
-}
-
-/* Sets the font for all the day headings */
-static void
-set_head_font (GnomeMonthItem *mitem)
-{
- int i;
-
- for (i = 0; i < 7; i++)
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
- "font_gdk", mitem->head_font,
- NULL);
-}
-
-/* Sets the color for all the headings */
-static void
-set_head_color (GnomeMonthItem *mitem)
-{
- int i;
- GdkColor outline;
- GdkColor head;
-
- outline.pixel = mitem->outline_pixel;
- head.pixel = mitem->head_pixel;
-
- for (i = 0; i < 7; i++) {
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_BOX + i],
- "fill_color_gdk", &outline,
- NULL);
-
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
- "fill_color_gdk", &head,
- NULL);
- }
-}
-
-/* Creates the items for the day name headings */
-static void
-create_headings (GnomeMonthItem *mitem)
-{
- int i;
-
- /* Just create the items; they will be positioned and configured by a call to reshape() */
-
- for (i = 0; i < 7; i++) {
- /* Group */
- mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem),
- gnome_canvas_group_get_type (),
- NULL);
-
- /* Box */
- mitem->items[GNOME_MONTH_ITEM_HEAD_BOX + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i]),
- gnome_canvas_rect_get_type (),
- NULL);
-
- /* Label */
- mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i]),
- gnome_canvas_text_get_type (),
- NULL);
- }
-
- set_head_font (mitem);
- set_head_color (mitem);
-}
-
-/* Returns the number of leap years since year 1 up to (but not including) the specified year */
-static int
-leap_years_up_to (int year)
-{
- return (year / 4 /* trivial leapness */
- - ((year > 1700) ? (year / 100 - 17) : 0) /* minus centuries since 1700 */
- + ((year > 1600) ? ((year - 1600) / 400) : 0)); /* plus centuries since 1700 divisible by 400 */
-}
-
-/* Returns whether the specified year is a leap year */
-static int
-is_leap_year (int year)
-{
- if (year <= 1752)
- return !(year % 4);
- else
- return (!(year % 4) && (year % 100)) || !(year % 400);
-}
-
-/* Returns the 1-based day number within the year of the specified date */
-static int
-day_in_year (int day, int month, int year)
-{
- int is_leap, i;
-
- is_leap = is_leap_year (year);
-
- for (i = 0; i < month; i++)
- day += days_in_month [is_leap][i];
-
- return day;
-}
-
-/* Returns the day of the week (zero-based, zero is Sunday) for the specified date. For the days
- * that were removed on the Gregorian reformation, it returns Thursday.
- */
-static int
-day_in_week (int day, int month, int year)
-{
- int n;
-
- n = (year - 1) * 365 + leap_years_up_to (year - 1) + day_in_year (day, month, year);
-
- if (n < REFORMATION_DAY)
- return (n - 1 + SATURDAY) % 7;
-
- if (n >= (REFORMATION_DAY + MISSING_DAYS))
- return (n - 1 + SATURDAY - MISSING_DAYS) % 7;
-
- return THURSDAY;
-}
-
-/* Fills the 42-element days array with the day numbers for the specified month. Slots outside the
- * bounds of the month are filled with zeros. The starting and ending indexes of the days are
- * returned in the start and end arguments.
- */
-static void
-build_month (int month, int year, int start_on_monday, int *days, int *start, int *end)
-{
- int i;
- int d_month, d_week;
-
- /* Note that months are zero-based, so September is month 8 */
-
- if ((year == 1752) && (month == 8)) {
- memcpy (days, sept_1752, 42 * sizeof (int));
-
- if (start)
- *start = SEPT_1752_START;
-
- if (end)
- *end = SEPT_1752_END;
-
- return;
- }
-
- for (i = 0; i < 42; i++)
- days[i] = 0;
-
- d_month = days_in_month[is_leap_year (year)][month];
- d_week = day_in_week (1, month, year);
-
- if (start_on_monday)
- d_week = (d_week + 6) % 7;
-
- for (i = 0; i < d_month; i++)
- days[d_week + i] = i + 1;
-
- if (start)
- *start = d_week;
-
- if (end)
- *end = d_week + d_month - 1;
-}
-
-/* Set the day numbers in the monthly calendar */
-static void
-set_days (GnomeMonthItem *mitem)
-{
- int i;
- int start, end;
- char buf[100];
-
- build_month (mitem->month, mitem->year, mitem->start_on_monday, mitem->day_numbers, &start, &end);
-
- /* Clear days before start of month */
-
- for (i = 0; i < start; i++)
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "text", NULL,
- NULL);
-
- /* Set days of month */
-
- for (; start <= end; start++, i++) {
- sprintf (buf, "%d", mitem->day_numbers[start]);
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "text", buf,
- NULL);
- }
-
- /* Clear days after end of month */
-
- for (; i < 42; i++)
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "text", NULL,
- NULL);
-}
-
-/* Sets the font for all the day numbers */
-static void
-set_day_font (GnomeMonthItem *mitem)
-{
- int i;
-
- for (i = 0; i < 42; i++)
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "font_gdk", mitem->day_font,
- NULL);
-}
-
-/* Sets the color for all the day items */
-static void
-set_day_color (GnomeMonthItem *mitem)
-{
- int i;
- GdkColor outline;
- GdkColor day_box;
- GdkColor day;
-
- outline.pixel = mitem->outline_pixel;
- day_box.pixel = mitem->day_box_pixel;
- day.pixel = mitem->day_pixel;
-
- for (i = 0; i < 42; i++) {
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_BOX + i],
- "outline_color_gdk", &outline,
- "fill_color_gdk", &day_box,
- NULL);
-
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "fill_color_gdk", &day,
- NULL);
- }
-}
-
-/* Creates the items for the days */
-static void
-create_days (GnomeMonthItem *mitem)
-{
- int i;
-
- /* Just create the items; they will be positioned and configured by a call to reshape() */
-
- for (i = 0; i < 42; i++) {
- /* Group */
- mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem),
- gnome_canvas_group_get_type (),
- NULL);
-
- /* Box */
- mitem->items[GNOME_MONTH_ITEM_DAY_BOX + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i]),
- gnome_canvas_rect_get_type (),
- NULL);
-
- /* Label */
- mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i]),
- gnome_canvas_text_get_type (),
- NULL);
- }
-
- set_day_font (mitem);
- set_day_color (mitem);
- set_days (mitem);
-}
-
-/* Resets the text of the day name headings */
-static void
-set_day_names (GnomeMonthItem *mitem)
-{
- int i;
-
- for (i = 0; i < 7; i++)
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
- "text", mitem->day_names[mitem->start_on_monday ? ((i + 1) % 7) : i],
- NULL);
-}
-
-/* Creates all the canvas items that make up the calendar */
-static void
-create_items (GnomeMonthItem *mitem)
-{
- mitem->items = g_new (GnomeCanvasItem *, GNOME_MONTH_ITEM_LAST);
-
- create_headings (mitem);
- create_days (mitem);
-
- /* Initialize by default to three-letter day names */
-
- mitem->day_names[0] = g_strdup (_("Sun"));
- mitem->day_names[1] = g_strdup (_("Mon"));
- mitem->day_names[2] = g_strdup (_("Tue"));
- mitem->day_names[3] = g_strdup (_("Wed"));
- mitem->day_names[4] = g_strdup (_("Thu"));
- mitem->day_names[5] = g_strdup (_("Fri"));
- mitem->day_names[6] = g_strdup (_("Sat"));
-
- set_day_names (mitem);
- reshape (mitem);
-}
-
-static void
-gnome_month_item_init (GnomeMonthItem *mitem)
-{
- time_t t;
- struct tm tm;
-
- /* Initialize to the current month by default */
-
- t = time (NULL);
- tm = *localtime (&t);
-
- mitem->year = tm.tm_year + 1900;
- mitem->month = tm.tm_mon;
-
- mitem->x = 0.0;
- mitem->y = 0.0;
- mitem->width = 150.0; /* not unreasonable defaults, I hope */
- mitem->height = 100.0;
- mitem->anchor = GTK_ANCHOR_NW;
- mitem->head_padding = 0.0;
- mitem->day_padding = 2.0;
- mitem->head_height = 14.0;
- mitem->head_anchor = GTK_ANCHOR_CENTER;
- mitem->day_anchor = GTK_ANCHOR_CENTER;
-
- /* Load the default fonts */
-
- mitem->head_font = gdk_font_load (DEFAULT_FONT);
- if (!mitem->head_font) {
- mitem->head_font = gdk_font_load ("fixed");
- g_assert (mitem->head_font != NULL);
- }
-
- mitem->day_font = gdk_font_load (DEFAULT_FONT);
- if (!mitem->day_font) {
- mitem->day_font = gdk_font_load ("fixed");
- g_assert (mitem->day_font != NULL);
- }
-}
-
-GnomeCanvasItem *
-gnome_month_item_new (GnomeCanvasGroup *parent)
-{
- GnomeMonthItem *mitem;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CANVAS_GROUP (parent), NULL);
-
- mitem = GNOME_MONTH_ITEM (gnome_canvas_item_new (parent,
- gnome_month_item_get_type (),
- NULL));
-
- gnome_month_item_construct (mitem);
-
- return GNOME_CANVAS_ITEM (mitem);
-}
-
-void
-gnome_month_item_construct (GnomeMonthItem *mitem)
-{
- GdkColor color;
-
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
-
- gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, "#d6d6d6d6d6d6", &color);
- mitem->head_pixel = color.pixel;
- mitem->day_box_pixel = color.pixel;
-
- gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, "black", &color);
- mitem->outline_pixel = color.pixel;
- mitem->day_pixel = color.pixel;
-
- create_items (mitem);
-}
-
-static void
-free_day_names (GnomeMonthItem *mitem)
-{
- int i;
-
- if (mitem->day_names[0])
- for (i = 0; i < 7; i++)
- g_free (mitem->day_names[i]);
-}
-
-static void
-gnome_month_item_destroy (GtkObject *object)
-{
- GnomeMonthItem *mitem;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (object));
-
- mitem = GNOME_MONTH_ITEM (object);
-
- free_day_names (mitem);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-/* Sets the color of the specified pixel value to that of the specified argument, which must be in
- * GdkColor format if format is TRUE, otherwise it must be in string format.
- */
-static void
-set_color_arg (GnomeMonthItem *mitem, gulong *pixel, GtkArg *arg, int gdk_format, int set_head, int set_day)
-{
- GdkColor color;
-
- if (gdk_format)
- *pixel = ((GdkColor *) GTK_VALUE_BOXED (*arg))->pixel;
- else {
- if (gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, GTK_VALUE_STRING (*arg), &color))
- *pixel = color.pixel;
- else
- *pixel = 0;
- }
-
- if (set_head)
- set_head_color (mitem);
-
- if (set_day)
- set_day_color (mitem);
-}
-
-static void
-gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- GnomeMonthItem *mitem;
- char **day_names;
- int i;
-
- mitem = GNOME_MONTH_ITEM (object);
-
- switch (arg_id) {
- case ARG_YEAR:
- mitem->year = GTK_VALUE_UINT (*arg);
- set_days (mitem);
- break;
-
- case ARG_MONTH:
- mitem->month = GTK_VALUE_UINT (*arg);
- set_days (mitem);
- break;
-
- case ARG_X:
- mitem->x = GTK_VALUE_DOUBLE (*arg);
- reanchor (mitem);
- break;
-
- case ARG_Y:
- mitem->y = GTK_VALUE_DOUBLE (*arg);
- reanchor (mitem);
- break;
-
- case ARG_WIDTH:
- mitem->width = fabs (GTK_VALUE_DOUBLE (*arg));
- reshape (mitem);
- break;
-
- case ARG_HEIGHT:
- mitem->height = fabs (GTK_VALUE_DOUBLE (*arg));
- reshape (mitem);
- break;
-
- case ARG_ANCHOR:
- mitem->anchor = GTK_VALUE_ENUM (*arg);
- reanchor (mitem);
- break;
-
- case ARG_HEAD_PADDING:
- mitem->head_padding = fabs (GTK_VALUE_DOUBLE (*arg));
- reshape (mitem);
- break;
-
- case ARG_DAY_PADDING:
- mitem->day_padding = fabs (GTK_VALUE_DOUBLE (*arg));
- reshape (mitem);
- break;
-
- case ARG_DAY_NAMES:
- day_names = GTK_VALUE_POINTER (*arg);
-
- /* First, check that none of the names is null */
-
- for (i = 0; i < 7; i++)
- if (!day_names[i]) {
- g_warning ("Day number %d was NULL; day names cannot be NULL!", i);
- return;
- }
-
- /* Set the new names */
-
- free_day_names (mitem);
- for (i = 0; i < 7; i++)
- mitem->day_names[i] = g_strdup (day_names[i]);
-
- set_day_names (mitem);
- reshape (mitem);
- break;
-
- case ARG_HEADING_HEIGHT:
- mitem->head_height = fabs (GTK_VALUE_DOUBLE (*arg));
- reshape (mitem);
- break;
-
- case ARG_HEADING_ANCHOR:
- mitem->head_anchor = GTK_VALUE_ENUM (*arg);
- reshape (mitem);
- break;
-
- case ARG_DAY_ANCHOR:
- mitem->day_anchor = GTK_VALUE_ENUM (*arg);
- reshape (mitem);
- break;
-
- case ARG_START_ON_MONDAY:
- mitem->start_on_monday = GTK_VALUE_BOOL (*arg);
- set_day_names (mitem);
- set_days (mitem);
- break;
-
- case ARG_HEAD_FONT:
- gdk_font_unref (mitem->head_font);
-
- mitem->head_font = gdk_font_load (GTK_VALUE_STRING (*arg));
- if (!mitem->head_font) {
- mitem->head_font = gdk_font_load ("fixed");
- g_assert (mitem->head_font != NULL);
- }
-
- set_head_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_HEAD_FONTSET:
- gdk_font_unref (mitem->head_font);
-
- mitem->head_font = gdk_fontset_load (GTK_VALUE_STRING (*arg));
- if (!mitem->head_font) {
- mitem->head_font =
- gdk_fontset_load ("-*-fixed-medium-r-semicondensed--13-120-75-75-c-60-*-*");
- g_assert (mitem->head_font != NULL);
- }
-
- set_head_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_HEAD_FONT_GDK:
- gdk_font_unref (mitem->head_font);
-
- mitem->head_font = GTK_VALUE_BOXED (*arg);
- gdk_font_ref (mitem->head_font);
- set_head_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_DAY_FONT:
- gdk_font_unref (mitem->day_font);
-
- mitem->day_font = gdk_font_load (GTK_VALUE_STRING (*arg));
- if (!mitem->day_font) {
- mitem->day_font = gdk_font_load ("fixed");
- g_assert (mitem->day_font != NULL);
- }
-
- set_day_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_DAY_FONTSET:
- gdk_font_unref (mitem->day_font);
-
- mitem->day_font = gdk_fontset_load (GTK_VALUE_STRING (*arg));
- if (!mitem->day_font) {
- mitem->day_font =
- gdk_fontset_load ("-*-fixed-medium-r-semicondensed--13-120-75-75-c-60-*-*");
- g_assert (mitem->day_font != NULL);
- }
-
- set_day_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_DAY_FONT_GDK:
- gdk_font_unref (mitem->day_font);
-
- mitem->day_font = GTK_VALUE_BOXED (*arg);
- gdk_font_ref (mitem->day_font);
- set_day_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_HEAD_COLOR:
- set_color_arg (mitem, &mitem->head_pixel, arg, FALSE, TRUE, FALSE);
- break;
-
- case ARG_HEAD_COLOR_GDK:
- set_color_arg (mitem, &mitem->head_pixel, arg, TRUE, TRUE, FALSE);
- break;
-
- case ARG_OUTLINE_COLOR:
- set_color_arg (mitem, &mitem->outline_pixel, arg, FALSE, TRUE, TRUE);
- break;
-
- case ARG_OUTLINE_COLOR_GDK:
- set_color_arg (mitem, &mitem->outline_pixel, arg, TRUE, TRUE, TRUE);
- break;
-
- case ARG_DAY_BOX_COLOR:
- set_color_arg (mitem, &mitem->day_box_pixel, arg, FALSE, FALSE, TRUE);
- break;
-
- case ARG_DAY_BOX_COLOR_GDK:
- set_color_arg (mitem, &mitem->day_box_pixel, arg, TRUE, FALSE, TRUE);
- break;
-
- case ARG_DAY_COLOR:
- set_color_arg (mitem, &mitem->day_pixel, arg, FALSE, FALSE, TRUE);
- break;
-
- case ARG_DAY_COLOR_GDK:
- set_color_arg (mitem, &mitem->day_pixel, arg, TRUE, FALSE, TRUE);
- break;
-
- default:
- break;
- }
-}
-
-/* Allocates a GdkColor structure filled with the specified pixel, and puts it into the specified
- * arg for returning it in the get_arg method.
- */
-static void
-get_color_arg (GnomeMonthItem *mitem, gulong pixel, GtkArg *arg)
-{
- GdkColor *color;
-
- color = g_new (GdkColor, 1);
- color->pixel = pixel;
- gdk_color_context_query_color (GNOME_CANVAS_ITEM (mitem)->canvas->cc, color);
- GTK_VALUE_BOXED (*arg) = color;
-}
-
-static void
-gnome_month_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- GnomeMonthItem *mitem;
-
- mitem = GNOME_MONTH_ITEM (object);
-
- switch (arg_id) {
- case ARG_YEAR:
- GTK_VALUE_UINT (*arg) = mitem->year;
- break;
-
- case ARG_MONTH:
- GTK_VALUE_UINT (*arg) = mitem->month;
- break;
-
- case ARG_X:
- GTK_VALUE_DOUBLE (*arg) = mitem->x;
- break;
-
- case ARG_Y:
- GTK_VALUE_DOUBLE (*arg) = mitem->y;
- break;
-
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = mitem->width;
- break;
-
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = mitem->height;
- break;
-
- case ARG_ANCHOR:
- GTK_VALUE_ENUM (*arg) = mitem->anchor;
- break;
-
- case ARG_HEAD_PADDING:
- GTK_VALUE_DOUBLE (*arg) = mitem->head_padding;
- break;
-
- case ARG_DAY_PADDING:
- GTK_VALUE_DOUBLE (*arg) = mitem->day_padding;
- break;
-
- case ARG_HEADING_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = mitem->head_height;
- break;
-
- case ARG_HEADING_ANCHOR:
- GTK_VALUE_ENUM (*arg) = mitem->head_anchor;
- break;
-
- case ARG_DAY_ANCHOR:
- GTK_VALUE_ENUM (*arg) = mitem->day_anchor;
- break;
-
- case ARG_START_ON_MONDAY:
- GTK_VALUE_BOOL (*arg) = mitem->start_on_monday;
- break;
-
- case ARG_HEAD_FONT_GDK:
- GTK_VALUE_BOXED (*arg) = mitem->head_font;
- break;
-
- case ARG_DAY_FONT_GDK:
- GTK_VALUE_BOXED (*arg) = mitem->day_font;
- break;
-
- case ARG_HEAD_COLOR_GDK:
- get_color_arg (mitem, mitem->head_pixel, arg);
- break;
-
- case ARG_OUTLINE_COLOR_GDK:
- get_color_arg (mitem, mitem->outline_pixel, arg);
- break;
-
- case ARG_DAY_BOX_COLOR_GDK:
- get_color_arg (mitem, mitem->day_box_pixel, arg);
- break;
-
- case ARG_DAY_COLOR_GDK:
- get_color_arg (mitem, mitem->day_pixel, arg);
- break;
-
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-GnomeCanvasItem *
-gnome_month_item_num2child (GnomeMonthItem *mitem, int child_num)
-{
- g_return_val_if_fail (mitem != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), NULL);
-
- return mitem->items[child_num];
-}
-
-int
-gnome_month_item_child2num (GnomeMonthItem *mitem, GnomeCanvasItem *child)
-{
- int i;
-
- g_return_val_if_fail (mitem != NULL, -1);
- g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), -1);
- g_return_val_if_fail (child != NULL, -1);
- g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (child), -1);
-
- for (i = 0; i < GNOME_MONTH_ITEM_LAST; i++)
- if (mitem->items[i] == child)
- return i;
-
- return -1;
-}
-
-int
-gnome_month_item_num2day (GnomeMonthItem *mitem, int child_num)
-{
- g_return_val_if_fail (mitem != NULL, 0);
- g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), 0);
-
- if ((child_num >= GNOME_MONTH_ITEM_DAY_GROUP) && (child_num < GNOME_MONTH_ITEM_LAST)) {
- child_num = (child_num - GNOME_MONTH_ITEM_DAY_GROUP) % 42;
- return mitem->day_numbers[child_num];
- } else
- return 0;
-}
-
-int
-gnome_month_item_day2index (GnomeMonthItem *mitem, int day_num)
-{
- int i;
-
- g_return_val_if_fail (mitem != NULL, -1);
- g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), -1);
- g_return_val_if_fail (day_num >= 1, -1);
-
- /* Find first day of month */
-
- for (i = 0; mitem->day_numbers[i] == 0; i++)
- ;
-
- /* Find the specified day */
-
- for (; (mitem->day_numbers[i] != 0) && (i < 42); i++)
- if (mitem->day_numbers[i] == day_num)
- return i;
-
- /* Bail out */
-
- return -1;
-}
diff --git a/calendar/gnome-month-item.h b/calendar/gnome-month-item.h
deleted file mode 100644
index 0ec4fd484c..0000000000
--- a/calendar/gnome-month-item.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/* General-purpose monthly calendar canvas item for GNOME
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef GNOME_MONTH_ITEM_H
-#define GNOME_MONTH_ITEM_H
-
-#include <libgnome/gnome-defs.h>
-#include <gtk/gtkpacker.h> /* why the hell is GtkAnchorType here and not in gtkenums.h? */
-#include <libgnomeui/gnome-canvas.h>
-
-
-BEGIN_GNOME_DECLS
-
-
-/* These values are used to identify the canvas items that make up a complete GnomeMonthItem, which
- * is made up of the following "pieces":
- *
- * Headings line:
- * - 7 GnomeCanvasGroups:
- * Each group contains one box (GnomeCanvasRectangle) and one label
- * (GnomeCanvasText)
- *
- * Day slots:
- * - 42 GnomeCanvasGroups:
- * Each group contains one box (GnomeCanvasRectangle) and one label
- * (GnomeCanvasText)
- *
- * The headings are organized from left to right. The day slots are organized as a table in
- * row-major order.
- *
- * If you want to access the individual items of the GnomeMonthItem, you can use these numbers with
- * the gnome_month_item_num2child() function. If you want to convert a number into the
- * corresponding GnomeCanvasItem, you can use the gnome_month_item_child2num() function.
- */
-typedef enum {
- GNOME_MONTH_ITEM_HEAD_GROUP = 0, /* 7 groups for headings */
- GNOME_MONTH_ITEM_HEAD_BOX = 7, /* 7 boxes for headings */
- GNOME_MONTH_ITEM_HEAD_LABEL = 14, /* 7 labels for headings */
- GNOME_MONTH_ITEM_DAY_GROUP = 21, /* 42 groups for days */
- GNOME_MONTH_ITEM_DAY_BOX = 63, /* 42 boxes for days */
- GNOME_MONTH_ITEM_DAY_LABEL = 105, /* 42 labels for days */
- GNOME_MONTH_ITEM_LAST = 147 /* total number of items */
-} GnomeMonthItemChild;
-
-/* The MonthItem canvas item defines a simple monthly calendar. It is made out of a number of
- * canvas items, which can be accessed using the functions provided. The monthly calendar is
- * anchored with respect to a point. The following arguments are available:
- *
- * name type read/write description
- * ------------------------------------------------------------------------------------------
- * year uint RW Full year (1-9999)
- * month uint RW Number of month (0-11)
- * x double RW X position of anchor point
- * y double RW Y position of anchor point
- * width double RW Width of calendar in canvas units
- * height double RW Height of calendar in canvas units
- * anchor GtkAnchorType RW Anchor side for calendar
- * heading_padding double RW Padding inside heading boxes
- * day_padding double RW Padding inside day boxes
- * day_names char ** W Array of strings corresponding to the day names (sun-sat)
- * heading_height double RW Height of headings bar in canvas units
- * heading_anchor GtkAnchorType RW Anchor side for headings inside heading boxes
- * day_anchor GtkAnchorType RW Anchor side for day numbers inside day boxes
- * start_on_monday boolean RW Specifies whether the week starts on Monday or Sunday
- * heading_font string W X logical font descriptor for the headings
- * heading_fontset string W X logical fontset descriptor for the headings
- * heading_font_gdk GdkFont * RW Pointer to GdkFont for the headings
- * day_font string W X logical font descriptor for the day numbers
- * day_fontset string W X logical fontset descriptor for the day numbers
- * day_font_gdk GdkFont * RW Pointer to GdkFont for the day numbers
- * heading_color string W X color specification for heading labels
- * heading_color_gdk GdkColor * RW Pointer to an allocated GdkColor for heading labels
- * outline_color string W X color specification for outline (lines and fill of heading boxes)
- * outline_color_gdk GdkColor * RW Pointer to an allocated GdkColor for outline
- * day_box_color string W X color specification for day boxes
- * day_box_color_gdk GdkColor * RW Pointer to an allocated GdkColor for day boxes
- * day_color string W X color specification for day number labels
- * day_color_gdk GdkColor * RW Pointer to an allocated GdkColor for day number labels
- */
-
-#define GNOME_TYPE_MONTH_ITEM (gnome_month_item_get_type ())
-#define GNOME_MONTH_ITEM(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_MONTH_ITEM, GnomeMonthItem))
-#define GNOME_MONTH_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_MONTH_ITEM, GnomeMonthItemClass))
-#define GNOME_IS_MONTH_ITEM(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_MONTH_ITEM))
-#define GNOME_IS_MONTH_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_MONTH_ITEM))
-
-
-typedef struct _GnomeMonthItem GnomeMonthItem;
-typedef struct _GnomeMonthItemClass GnomeMonthItemClass;
-
-struct _GnomeMonthItem {
- GnomeCanvasGroup group;
-
- int year; /* Year to show (full, no two-digit crap) */
- int month; /* Month to show (0-11) */
-
- double x, y; /* Position at anchor */
- double width, height; /* Size of calendar */
- GtkAnchorType anchor; /* Anchor side for calendar */
-
- double head_padding; /* Padding to use between heading lines and text */
- double day_padding; /* Padding to use between day number lines and text */
-
- char *day_names[7]; /* Names to use for the day labels, starting from Sunday */
-
- double head_height; /* Height of the headings row */
- GtkAnchorType head_anchor; /* Anchor side for the heading labels */
- GtkAnchorType day_anchor; /* Anchor side for the day number labels */
-
- GnomeCanvasItem **items; /* All the items that make up the calendar */
- int day_numbers[42]; /* The numbers of the days, as they are shown in the display */
-
- GdkFont *head_font; /* Font for the headings */
- GdkFont *day_font; /* Font for the day numbers */
-
- gulong head_pixel; /* Color for heading labels */
- gulong outline_pixel; /* Color for the outline (lines and heading boxes) */
- gulong day_box_pixel; /* Color for the day boxes */
- gulong day_pixel; /* Color for day number labels */
-
- int start_on_monday : 1; /* Start the week on Monday? If false, then start from Sunday */
-};
-
-struct _GnomeMonthItemClass {
- GnomeCanvasGroupClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType gnome_month_item_get_type (void);
-
-/* Creates a new month item with the specified group as parent */
-GnomeCanvasItem *gnome_month_item_new (GnomeCanvasGroup *parent);
-
-/* Constructor function useful for derived classes */
-void gnome_month_item_construct (GnomeMonthItem *mitem);
-
-/* Returns the child item defined by the child number (as specified on the GnomeMonthItemChild
- * enumeration above).
- */
-GnomeCanvasItem *gnome_month_item_num2child (GnomeMonthItem *mitem, int child_num);
-
-/* Returns the number of the specified child item, as defined on the GnomeMonthItemChild enumeration
- * above. If the specified object is not found, it returns -1.
- */
-int gnome_month_item_child2num (GnomeMonthItem *mitem, GnomeCanvasItem *child);
-
-/* Returns the number of the day relevant to the specified child item. Day numbers are 1-based. If
- * the specified child is outside the range of displayed days, then it returns 0.
- */
-int gnome_month_item_num2day (GnomeMonthItem *mitem, int child_num);
-
-/* Returns the index (0-41) of the specified date within the table of days. If the day number is
- * invalid for the current monthly calendar, then -1 is returned.
- */
-int gnome_month_item_day2index (GnomeMonthItem *mitem, int day_num);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gnomecal.gnorba b/calendar/gnomecal.gnorba
deleted file mode 100644
index 74df8ecf04..0000000000
--- a/calendar/gnomecal.gnorba
+++ /dev/null
@@ -1,11 +0,0 @@
-[IDL:GNOME:Calendar:Repository:1.0]
-type=factory
-repo_id=IDL:Gnome/Calendar/Repository:1.0
-description=Calendar Repository
-location_info=IDL:GNOME:Calendar:RepositoryLocator:1.0
-
-[IDL:GNOME:Calendar:RepositoryLocator:1.0]
-type=exe
-repo_id=IDL:GNOME/GenericFactory:1.0
-description=Calendar Server
-location_info=gnomecal
diff --git a/calendar/goto.c b/calendar/goto.c
deleted file mode 100644
index 41609da678..0000000000
--- a/calendar/goto.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/* Go to date dialog for gnomecal
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include <gnome.h>
-#include "gnome-cal.h"
-#include "gnome-month-item.h"
-#include "main.h"
-#include "mark.h"
-#include "timeutil.h"
-
-
-static GtkWidget *goto_win; /* The goto dialog window */
-static GnomeMonthItem *month_item; /* The month item in the dialog */
-static GnomeCalendar *gnome_calendar; /* The gnome calendar the dialog refers to */
-static int current_index; /* The index of the day marked as current, or -1 if none */
-
-
-/* Updates the specified month item by marking it appropriately from the calendar the dialog refers
- * to. Also marks the current day if appropriate.
- */
-static void
-update (void)
-{
- GnomeCanvasItem *item;
- time_t t;
- struct tm tm;
-
- unmark_month_item (month_item);
- mark_month_item (month_item, gnome_calendar->cal);
-
- if (current_index != -1) {
- item = gnome_month_item_num2child (month_item,
- GNOME_MONTH_ITEM_DAY_LABEL + current_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_DAY_FG),
- "fontset", NORMAL_DAY_FONTSET,
- NULL);
- current_index = -1;
- }
-
- t = time (NULL);
- tm = *localtime (&t);
-
- if (((tm.tm_year + 1900) == month_item->year) && (tm.tm_mon == month_item->month)) {
- current_index = gnome_month_item_day2index (month_item, tm.tm_mday);
- g_assert (current_index != -1);
-
- item = gnome_month_item_num2child (month_item,
- GNOME_MONTH_ITEM_DAY_LABEL + current_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_CURRENT_DAY_FG),
- "fontset", CURRENT_DAY_FONTSET,
- NULL);
- }
-}
-
-/* Callback used when the year adjustment is changed */
-static void
-year_changed (GtkAdjustment *adj, gpointer data)
-{
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (month_item),
- "year", (int) adj->value,
- NULL);
- update ();
-}
-
-/* Creates the year control with its adjustment */
-static GtkWidget *
-create_year (int year)
-{
- GtkWidget *hbox;
- GtkAdjustment *adj;
- GtkWidget *w;
-
- hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
-
- w = gtk_label_new (_("Year:"));
- gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- adj = GTK_ADJUSTMENT (gtk_adjustment_new (year, 1900, 9999, 1, 10, 10));
- gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
- (GtkSignalFunc) year_changed,
- NULL);
-
- w = gtk_spin_button_new (adj, 1.0, 0);
- gtk_widget_set_usize (w, 60, 0);
- gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- return hbox;
-}
-
-/* Callback used when a month button is toggled */
-static void
-month_toggled (GtkToggleButton *toggle, gpointer data)
-{
- if (!toggle->active)
- return;
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (month_item),
- "month", GPOINTER_TO_INT (data),
- NULL);
- update ();
-}
-
-/* Creates the months control */
-static GtkWidget *
-create_months (int month)
-{
- GtkWidget *table;
- GtkWidget *w;
- GSList *group;
- int i, row, col;
- struct tm tm;
- char buf[100];
-
- tm = *localtime (&gnome_calendar->current_display);
-
- table = gtk_table_new (2, 6, TRUE);
-
- group = NULL;
-
- for (i = 0; i < 12; i++) {
- row = i / 6;
- col = i % 6;
-
- tm.tm_mon = i;
- strftime (buf, 100, "%b", &tm);
-
- w = gtk_radio_button_new (group);
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (w));
- gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (w), FALSE);
-
- gtk_container_add (GTK_CONTAINER (w), gtk_label_new (buf));
-
- if (i == month)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w), TRUE);
-
- gtk_signal_connect (GTK_OBJECT (w), "toggled",
- (GtkSignalFunc) month_toggled,
- GINT_TO_POINTER (i));
- gtk_table_attach (GTK_TABLE (table), w,
- col, col + 1,
- row, row + 1,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
- gtk_widget_show_all (w);
- }
-
- return table;
-}
-
-/* Sets the scrolling region of the canvas to the allocation size */
-static void
-set_scroll_region (GtkWidget *widget, GtkAllocation *allocation)
-{
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (month_item),
- "width", (double) (allocation->width - 1),
- "height", (double) (allocation->height - 1),
- NULL);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (widget),
- 0, 0,
- allocation->width, allocation->height);
-}
-
-/* Event handler for day groups in the month item. A button press makes the calendar jump to the
- * selected day and destroys the Go-to dialog box.
- */
-static gint
-day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- int child_num, day;
-
- child_num = gnome_month_item_child2num (month_item, item);
- day = gnome_month_item_num2day (month_item, child_num);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if ((event->button.button == 1) && (day != 0)) {
- gnome_calendar_goto (gnome_calendar,
- time_from_day (month_item->year, month_item->month, day));
- gtk_widget_destroy (goto_win);
- }
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Creates the canvas with the month item for selecting days */
-static GtkWidget *
-create_days (int day, int month, int year)
-{
- GtkWidget *canvas;
- int i;
- GnomeCanvasItem *day_group;
-
- canvas = gnome_canvas_new ();
- gtk_widget_set_usize (canvas, 150, 120);
-
- month_item = GNOME_MONTH_ITEM (gnome_month_item_new (gnome_canvas_root (GNOME_CANVAS (canvas))));
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (month_item),
- "month", month,
- "year", year,
- "start_on_monday", week_starts_on_monday,
- NULL);
- colorify_month_item (month_item, default_color_func, NULL);
- month_item_prepare_prelight (month_item, default_color_func, NULL);
- update ();
-
- /* Connect to size_allocate so that we can change the size of the month item and the
- * scrolling region appropriately.
- */
-
- gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate",
- (GtkSignalFunc) set_scroll_region,
- NULL);
-
- /* Bind the day groups to our event handler */
-
- for (i = 0; i < 42; i++) {
- day_group = gnome_month_item_num2child (month_item, i + GNOME_MONTH_ITEM_DAY_GROUP);
- gtk_signal_connect (GTK_OBJECT (day_group), "event",
- (GtkSignalFunc) day_event,
- NULL);
- }
-
- return canvas;
-}
-
-static void
-goto_today (GtkWidget *widget, gpointer data)
-{
- gnome_calendar_goto_today (gnome_calendar);
- gtk_widget_destroy (goto_win);
-}
-
-/* Creates a "goto date" dialog and runs it */
-void
-goto_dialog (GnomeCalendar *gcal)
-{
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *w;
- GtkWidget *days;
- struct tm tm;
-
- gnome_calendar = gcal;
- current_index = -1;
-
- tm = *localtime (&gnome_calendar->current_display);
-
- goto_win = gnome_dialog_new (_("Go to date"),
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
- gnome_dialog_set_parent (GNOME_DIALOG (goto_win), GTK_WINDOW (gcal));
-
- vbox = GNOME_DIALOG (goto_win)->vbox;
-
- /* Instructions */
-
- w = gtk_label_new (_("Please select the date you want to go to.\n"
- "When you click on a day, you will be taken\n"
- "to that date."));
- gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_LEFT);
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.0);
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- /* Create month item before creating the year controls, since the latter ones need the
- * month_item to be created.
- */
-
- days = create_days (tm.tm_mday, tm.tm_mon, tm.tm_year + 1900);
-
- /* Year */
-
- w = create_year (tm.tm_year + 1900);
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- /* Month */
-
- w = create_months (tm.tm_mon);
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- /* Days (canvas with month item) */
-
- gtk_box_pack_start (GTK_BOX (vbox), days, TRUE, TRUE, 0);
- gtk_widget_show (days);
-
- /* Today button */
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- w = gtk_button_new_with_label (_("Go to today"));
- gtk_signal_connect (GTK_OBJECT (w), "clicked",
- (GtkSignalFunc) goto_today,
- NULL);
- gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- /* Run! */
-
- gtk_window_set_modal (GTK_WINDOW (goto_win), TRUE);
- gnome_dialog_set_close (GNOME_DIALOG (goto_win), TRUE);
- gnome_dialog_set_parent (GNOME_DIALOG (goto_win), GTK_WINDOW (gnome_calendar));
- gtk_widget_show (goto_win);
-}
diff --git a/calendar/gui/GnomeCal.idl b/calendar/gui/GnomeCal.idl
deleted file mode 100644
index 3f9a64d291..0000000000
--- a/calendar/gui/GnomeCal.idl
+++ /dev/null
@@ -1,115 +0,0 @@
-module GNOME {
-
- module Calendar {
-
- interface Repository {
-
- exception NotFound {};
- typedef sequence<string> String_Sequence;
-
- /*
- * get_object:
- * @uid: Unique Identifier for the object
- *
- * Returns a vCalendar object for the object
- * that matches the UID @uid.
- */
- string get_object (in string uid)
- raises (NotFound);
-
- /*
- * get_objects_by_id_list:
- * @uid_list: a sequence of Unique Identifiers
- *
- * Returns a vCalendar object for the objects
- * that matches the given UID list @uid_list;
- * NotFound is raised if any of the given UIDs
- * were not found.
- */
- string get_objects_by_id_list (in String_Sequence uid)
- raises (NotFound);
-
- /*
- * get_object_by_pilot_id:
- * @pilot_id: the pilot id
- *
- * Returns the object that has the @pilot_id
- * identifier.
- */
- string get_object_by_pilot_id (in long pilot_id)
- raises (NotFound);
-
- /*
- * get_id_from_pilot_id:
- * @pilot_id: the pilot id
- *
- * Returns the object id that matches the @pilot_id
- * identifier.
- */
- string get_id_from_pilot_id (in long pilot_id)
- raises (NotFound);
-
- /*
- * delete_object:
- * @uid: Unique Identifier for the object
- */
- void delete_object (in string uid)
- raises (NotFound);
-
- /*
- * update_object:
- * @uid: uid of object to update
- * @object: vcard object to update
- */
- void update_object (in string uid, in string object);
-
- /*
- * update_pilot_id:
- * @uid: Unique identifier for the event we want to update
- * @pilot_id: new ID assigned by the pilot
- * @pilot_status: Status to flag the event with
- */
- void update_pilot_id (in string uid, in long pilot_id, in long pilot_status)
- raises (NotFound);
-
- /*
- * get_objects:
- *
- * Danger Will Robinson : This can result in a
- * huge string, namely the size of all your entries.
- * Returns a vCalendar with all the objects
- */
- string get_objects ();
-
- /*
- * get_object_id_list
- *
- * Returns a sequence of the UID's of the entries
- */
- String_Sequence get_object_id_list();
-
- /*
- * get_updated_objects:
- *
- * Returns a vCalendar with all the objects that have been
- * modified since the last Pilot Sync
- */
- string get_updated_objects ();
-
- /*
- * Returns the number of objects in the calendar
- * repository.
- */
- long get_number_of_objects();
-
- /*
- * done:
- *
- * Informs the calendar that we are done using it,
- * gets a chance to destroy windows and save information.
- */
- void done ();
- };
- };
-};
-
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
deleted file mode 100644
index 914bd8c398..0000000000
--- a/calendar/gui/Makefile.am
+++ /dev/null
@@ -1,223 +0,0 @@
-SUBDIRS = doc
-
-idldir = $(datadir)/idl
-idl_DATA = GnomeCal.idl
-
-gnorbadir = $(sysconfdir)/CORBA/servers
-gnorba_DATA = gnomecal.gnorba
-
-help_base = $(datadir)/gnome/help/cal
-
-if HAVE_GNOME_PILOT
-extra_pilot_bins = \
- calendar-conduit-control-applet \
- calendar-pilot-sync
-endif
-bin_PROGRAMS = gnomecal $(extra_pilot_bins)
-
-INCLUDES = \
- -I$(includedir) \
- $(GNOME_INCLUDEDIR) \
- $(GNOME_CONDUIT_INCLUDEDIR) \
- $(PISOCK_INCLUDEDIR) \
- -DGNOMELOCALEDIR=\""$(datadir)/locale"\"
-
-GNOMECAL_CORBA_GENERATED = \
- GnomeCal.h \
- GnomeCal.c \
- GnomeCal-common.c \
- GnomeCal-skels.c \
- GnomeCal-stubs.c
-
-$(GNOMECAL_CORBA_GENERATED): my_gnomecal_idl
-
-my_gnomecal_idl: GnomeCal.idl
- orbit-idl $(srcdir)/GnomeCal.idl
- touch my_gnomecal_idl
-
-corba-cal.c \
-corba-cal.h \
-corba-cal-factory.c \
-corba-cal-factory.h: GnomeCal.h
-
-gnomecal_SOURCES = \
- GnomeCal-common.c \
- GnomeCal-skels.c \
- GnomeCal.h \
- alarm.c \
- alarm.h \
- calendar.c \
- calendar.h \
- calendar-conduit.h \
- calobj.c \
- calobj.h \
- eventedit.c \
- eventedit.h \
- getdate.y \
- corba-cal.c \
- corba-cal.h \
- corba-cal-factory.c \
- corba-cal-factory.h \
- gncal-day-panel.c \
- gncal-day-panel.h \
- gncal-day-view.c \
- gncal-day-view.h \
- gncal-full-day.c \
- gncal-full-day.h \
- gncal-week-view.c \
- gncal-week-view.h \
- gncal-todo.c \
- gncal-todo.h \
- gnome-month-item.c \
- gnome-month-item.h \
- gnome-cal.c \
- gnome-cal.h \
- html-month.c \
- goto.c \
- layout.c \
- layout.h \
- main.c \
- main.h \
- mark.c \
- mark.h \
- month-view.c \
- month-view.h \
- popup-menu.c \
- popup-menu.h \
- prop.c \
- quick-view.c \
- quick-view.h \
- timeutil.c \
- timeutil.h \
- todo-conduit.h \
- view-utils.h \
- view-utils.c \
- year-view.c \
- year-view.h
-
-calendar_pilot_sync_SOURCES = \
- GnomeCal-common.c \
- GnomeCal-stubs.c \
- alarm.c \
- calendar-pilot-sync.c \
- calobj.c \
- calobj.h \
- calendar.c \
- calendar.h \
- timeutil.c \
- timeutil.h
-
-LINK_FLAGS = \
- $(GNOME_LIBDIR) \
- $(GNOMEGNORBA_LIBS) \
- $(INTLLIBS) \
- ../libversit/libversit.la
-
-calendar_pilot_sync_LDADD = \
- $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
- $(LINK_FLAGS)
-
-if HAVE_GNOME_PILOT
-#calendar_conduit
-calendar_conduitsdir=$(libdir)/gnome-pilot/conduits
-
-calendar_conduits_LTLIBRARIES = libcalendar_conduit.la
-endif
-
-libcalendar_conduit_la_SOURCES = \
- GnomeCal-common.c \
- GnomeCal-stubs.c \
- calendar-conduit.c \
- calobj.c \
- alarm.c \
- calendar.c \
- timeutil.c
-
-calendar-conduit.c: my_gnomecal_idl
-
-libcalendar_conduit_la_LDFLAGS = \
- -rpath $(libdir)
-
-libcalendar_conduit_la_LIBADD = \
- ../libversit/libversit.la \
- $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
- $(GNOME_LIBDIR) \
- $(GNOME_LIBS)
-
-calendar_conduit_control_applet_SOURCES = \
- calendar-conduit-control-applet.c
-
-calendar_conduit_control_applet_LDADD = \
- $(CAPPLET_LIBS) \
- $(GNOME_LIBDIR) \
- $(GNOME_CAPPLET_LIBS) \
- $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
- $(GNOMEUI_LIBS) \
- $(GNOME_PILOT_LIBS) \
- $(INTLLIBS)
-
-#todo_conduit
-#todo_conduitsdir=$(libdir)/gnome-pilot/conduits
-
-#todo_conduits_LTLIBRARIES = libtodo_conduit.la
-
-#libtodo_conduit_la_LDFLAGS = \
-# -rpath $(libdir)
-
-#libtodo_conduit_la_LIBADD = \
-# $(GNOME_LIBDIR) \
-# $(GNOME_LIBS)
-
-#libtodo_conduit_la_SOURCES = \
-# todo-conduit.c
-
-#todo-conduit.c: GnomeCal.h
-
-#todo_conduit_control_applet_SOURCES = \
-# todo-conduit-control-applet.c
-
-#todo_conduit_control_applet_LDADD = \
-# $(CAPPLET_LIBS) \
-# $(GNOME_LIBDIR) \
-# $(GNOME_CAPPLET_LIBS) \
-# $(PISOCK_LIBDIR) $(PISOCK_LIBS) \
-# $(GNOMEUI_LIBS) \
-# $(GNOME_PILOT_LIBS) \
-# $(INTLLIBS)
-
-gnomecal_LDADD = $(LINK_FLAGS)
-
-if HAVE_GNOME_PILOT
-ccenterdir = $(datadir)/control-center
-Rootdir = $(ccenterdir)
-PalmPilotdir = $(ccenterdir)/Peripherals/PalmPilot
-Conduitsdir = $(PalmPilotdir)/Conduits
-
-Conduits_DATA = \
- calendar-conduit-control-applet.desktop \
- todo-conduit-control-applet.desktop
-
-Conduits_seconddir = $(datadir)/gnome/apps/Settings/Peripherals/PalmPilot/Conduits/
-Conduits_second_DATA = $(Conduits_DATA)
-endif
-
-EXTRA_DIST = \
- gncal.desktop \
- calendar-conduit-control-applet.desktop \
- todo-conduit-control-applet.desktop \
- bell.xpm \
- recur.xpm \
- $(idl_DATA) \
- $(gnorba_DATA) \
- gnome-calendar-conduit.png
-
-appicondir = $(datadir)/pixmaps
-appicon_DATA = gnome-calendar-conduit.png
-
-Productivitydir = $(datadir)/gnome/apps/Applications
-
-Productivity_DATA = gncal.desktop
-
-install-data-local:
- $(mkinstalldirs) $(DESTDIR)$(help_base)/C
- $(mkinstalldirs) $(Conduitsdir)
diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c
deleted file mode 100644
index cf1cd8fb60..0000000000
--- a/calendar/gui/alarm-notify/alarm.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Alarm handling for the GNOME Calendar.
- *
- * (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-#include <config.h>
-#include <time.h>
-#include <gnome.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/time.h>
-#include "calobj.h"
-#include "alarm.h"
-
-/* The pipes used to notify about an alarm */
-int alarm_pipes [2];
-
-/* The list of pending alarms */
-static GList *alarms;
-
-static void *head_alarm;
-
-typedef struct {
- time_t activation_time;
- AlarmFunction fn;
- void *closure;
- CalendarAlarm *alarm;
-} AlarmRecord;
-
-enum DebugAction {
- ALARM_ACTIVATED,
- ALARM_ADDED,
- ALARM_NOT_ADDED
-};
-
-void debug_alarm (AlarmRecord* ar, enum DebugAction action);
-void calendar_notify (time_t time, CalendarAlarm *which, void *data);
-extern int debug_alarms;
-
-/*
- * SIGALRM handler. Notifies the callback about the alarm
- */
-static void
-alarm_activate ()
-{
- char c = 0;
-
- write (alarm_pipes [1], &c, 1);
-}
-
-/*
- * SIGUSR1 handler. Toggles debugging output
- */
-static void
-toggle_debugging ()
-{
- debug_alarms = !debug_alarms;
-}
-
-static void
-alarm_ready (void *closure, int fd, GdkInputCondition cond)
-{
- AlarmRecord *ar = head_alarm;
- time_t now = time (NULL);
- char c;
-
- if (read (alarm_pipes [0], &c, 1) != 1)
- return;
-
- if (ar == NULL){
- g_warning ("Empty events. This should not happen\n");
- return;
- }
-
- while (head_alarm){
- if (debug_alarms)
- debug_alarm (ar, ALARM_ACTIVATED);
- (*ar->fn)(ar->activation_time, ar->alarm, ar->closure);
- alarms = g_list_remove (alarms, head_alarm);
-
- /* Schedule next alarm */
- if (alarms){
- AlarmRecord *next;
-
- head_alarm = alarms->data;
- next = head_alarm;
-
- if (next->activation_time > now){
- struct itimerval itimer;
-
- itimer.it_interval.tv_sec = 0;
- itimer.it_interval.tv_usec = 0;
- itimer.it_value.tv_sec = next->activation_time - now;
- itimer.it_value.tv_usec = 0;
- setitimer (ITIMER_REAL, &itimer, NULL);
- break;
- } else {
- g_free (ar);
- ar = next;
- }
- } else
- head_alarm = NULL;
- }
- g_free (ar);
-}
-
-static int
-alarm_compare_by_time (gconstpointer a, gconstpointer b)
-{
- const AlarmRecord *ara = a;
- const AlarmRecord *arb = b;
- time_t diff;
-
- diff = ara->activation_time - arb->activation_time;
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-/**
- * alarm_add:
- *
- * Tries to schedule @alarm.
- *
- * Returns TRUE if the alarm was scheduled.
- */
-gboolean
-alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure)
-{
- time_t now = time (NULL);
- AlarmRecord *ar;
- time_t alarm_time = alarm->trigger;
-
- ar = g_new0 (AlarmRecord, 1);
- ar->activation_time = alarm_time;
- ar->fn = fn;
- ar->closure = closure;
- ar->alarm = alarm;
-
- /* If it already expired, do not add it */
- if (alarm_time < now) {
- if (debug_alarms)
- debug_alarm (ar, ALARM_NOT_ADDED);
- return FALSE;
- }
-
- alarms = g_list_insert_sorted (alarms, ar, alarm_compare_by_time);
-
- /* If first alarm is not the previous first alarm, reschedule SIGALRM */
- if (head_alarm != alarms->data){
- struct itimerval itimer;
- int v;
-
- /* Set the timer to disable upon activation */
- itimer.it_interval.tv_sec = 0;
- itimer.it_interval.tv_usec = 0;
- itimer.it_value.tv_sec = alarm_time - now;
- itimer.it_value.tv_usec = 0;
- v = setitimer (ITIMER_REAL, &itimer, NULL);
- head_alarm = alarms->data;
- }
- if (debug_alarms)
- debug_alarm (ar, ALARM_ADDED);
- return TRUE;
-}
-
-int
-alarm_kill (void *closure_key)
-{
- GList *p;
-
- for (p = alarms; p; p = p->next){
- AlarmRecord *ar = p->data;
-
- if (ar->closure == closure_key){
- alarms = g_list_remove (alarms, p->data);
- if (alarms)
- head_alarm = alarms->data;
- else
- head_alarm = NULL;
- return 1;
- }
- }
- return 0;
-}
-
-void
-alarm_init (void)
-{
- struct sigaction sa;
- struct sigaction debug_sa;
- int flags = 0;
-
- pipe (alarm_pipes);
-
- /* set non blocking mode */
- fcntl (alarm_pipes [0], F_GETFL, &flags);
- fcntl (alarm_pipes [0], F_SETFL, flags | O_NONBLOCK);
- gdk_input_add (alarm_pipes [0], GDK_INPUT_READ, alarm_ready, 0);
-
- /* Setup the signal handler */
- sa.sa_handler = alarm_activate;
- sigemptyset (&sa.sa_mask);
- sa.sa_flags = SA_RESTART;
- sigaction (SIGALRM, &sa, NULL);
-
- /* Setup a signal handler to toggle debugging */
- debug_sa.sa_handler = toggle_debugging;
- sigemptyset (&debug_sa.sa_mask);
- debug_sa.sa_flags = SA_RESTART;
- sigaction (SIGUSR1, &debug_sa, NULL);
-}
-
-void
-debug_alarm (AlarmRecord* ar, enum DebugAction action)
-{
- time_t now = time (NULL);
- iCalObject *ico = ar->closure;
- printf ("%s", ctime(&now));
- switch (action) {
- case ALARM_ADDED:
- printf ("Added alarm for %s", ctime(&ar->activation_time));
- break;
- case ALARM_NOT_ADDED:
- printf ("Alarm not added for %s", ctime(&ar->activation_time));
- break;
- case ALARM_ACTIVATED:
- printf ("Activated alarm\n");
- break;
- }
-
- if (ar->fn!=&calendar_notify) return;
- printf ("--- Summary: %s\n", ico->summary);
- switch (ar->alarm->type) {
- case ALARM_MAIL:
- printf ("--- Type: Mail\n");
- break;
- case ALARM_PROGRAM:
- printf ("--- Type: Program\n");
- break;
- case ALARM_DISPLAY:
- printf ("--- Type: Display\n");
- break;
- case ALARM_AUDIO:
- printf ("--- Type: Audio\n");
- break;
- }
-}
-
-
diff --git a/calendar/gui/alarm-notify/alarm.h b/calendar/gui/alarm-notify/alarm.h
deleted file mode 100644
index 81710bda5e..0000000000
--- a/calendar/gui/alarm-notify/alarm.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef ALARM_H
-#define ALARM_H
-
-#include <time.h>
-
-typedef void (*AlarmFunction)(time_t time, CalendarAlarm *which, void *closuse);
-
-void alarm_init (void);
-gboolean alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure);
-int alarm_kill (void *closure);
-
-#endif
diff --git a/calendar/gui/alarm.c b/calendar/gui/alarm.c
deleted file mode 100644
index cf1cd8fb60..0000000000
--- a/calendar/gui/alarm.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Alarm handling for the GNOME Calendar.
- *
- * (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-#include <config.h>
-#include <time.h>
-#include <gnome.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/time.h>
-#include "calobj.h"
-#include "alarm.h"
-
-/* The pipes used to notify about an alarm */
-int alarm_pipes [2];
-
-/* The list of pending alarms */
-static GList *alarms;
-
-static void *head_alarm;
-
-typedef struct {
- time_t activation_time;
- AlarmFunction fn;
- void *closure;
- CalendarAlarm *alarm;
-} AlarmRecord;
-
-enum DebugAction {
- ALARM_ACTIVATED,
- ALARM_ADDED,
- ALARM_NOT_ADDED
-};
-
-void debug_alarm (AlarmRecord* ar, enum DebugAction action);
-void calendar_notify (time_t time, CalendarAlarm *which, void *data);
-extern int debug_alarms;
-
-/*
- * SIGALRM handler. Notifies the callback about the alarm
- */
-static void
-alarm_activate ()
-{
- char c = 0;
-
- write (alarm_pipes [1], &c, 1);
-}
-
-/*
- * SIGUSR1 handler. Toggles debugging output
- */
-static void
-toggle_debugging ()
-{
- debug_alarms = !debug_alarms;
-}
-
-static void
-alarm_ready (void *closure, int fd, GdkInputCondition cond)
-{
- AlarmRecord *ar = head_alarm;
- time_t now = time (NULL);
- char c;
-
- if (read (alarm_pipes [0], &c, 1) != 1)
- return;
-
- if (ar == NULL){
- g_warning ("Empty events. This should not happen\n");
- return;
- }
-
- while (head_alarm){
- if (debug_alarms)
- debug_alarm (ar, ALARM_ACTIVATED);
- (*ar->fn)(ar->activation_time, ar->alarm, ar->closure);
- alarms = g_list_remove (alarms, head_alarm);
-
- /* Schedule next alarm */
- if (alarms){
- AlarmRecord *next;
-
- head_alarm = alarms->data;
- next = head_alarm;
-
- if (next->activation_time > now){
- struct itimerval itimer;
-
- itimer.it_interval.tv_sec = 0;
- itimer.it_interval.tv_usec = 0;
- itimer.it_value.tv_sec = next->activation_time - now;
- itimer.it_value.tv_usec = 0;
- setitimer (ITIMER_REAL, &itimer, NULL);
- break;
- } else {
- g_free (ar);
- ar = next;
- }
- } else
- head_alarm = NULL;
- }
- g_free (ar);
-}
-
-static int
-alarm_compare_by_time (gconstpointer a, gconstpointer b)
-{
- const AlarmRecord *ara = a;
- const AlarmRecord *arb = b;
- time_t diff;
-
- diff = ara->activation_time - arb->activation_time;
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-/**
- * alarm_add:
- *
- * Tries to schedule @alarm.
- *
- * Returns TRUE if the alarm was scheduled.
- */
-gboolean
-alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure)
-{
- time_t now = time (NULL);
- AlarmRecord *ar;
- time_t alarm_time = alarm->trigger;
-
- ar = g_new0 (AlarmRecord, 1);
- ar->activation_time = alarm_time;
- ar->fn = fn;
- ar->closure = closure;
- ar->alarm = alarm;
-
- /* If it already expired, do not add it */
- if (alarm_time < now) {
- if (debug_alarms)
- debug_alarm (ar, ALARM_NOT_ADDED);
- return FALSE;
- }
-
- alarms = g_list_insert_sorted (alarms, ar, alarm_compare_by_time);
-
- /* If first alarm is not the previous first alarm, reschedule SIGALRM */
- if (head_alarm != alarms->data){
- struct itimerval itimer;
- int v;
-
- /* Set the timer to disable upon activation */
- itimer.it_interval.tv_sec = 0;
- itimer.it_interval.tv_usec = 0;
- itimer.it_value.tv_sec = alarm_time - now;
- itimer.it_value.tv_usec = 0;
- v = setitimer (ITIMER_REAL, &itimer, NULL);
- head_alarm = alarms->data;
- }
- if (debug_alarms)
- debug_alarm (ar, ALARM_ADDED);
- return TRUE;
-}
-
-int
-alarm_kill (void *closure_key)
-{
- GList *p;
-
- for (p = alarms; p; p = p->next){
- AlarmRecord *ar = p->data;
-
- if (ar->closure == closure_key){
- alarms = g_list_remove (alarms, p->data);
- if (alarms)
- head_alarm = alarms->data;
- else
- head_alarm = NULL;
- return 1;
- }
- }
- return 0;
-}
-
-void
-alarm_init (void)
-{
- struct sigaction sa;
- struct sigaction debug_sa;
- int flags = 0;
-
- pipe (alarm_pipes);
-
- /* set non blocking mode */
- fcntl (alarm_pipes [0], F_GETFL, &flags);
- fcntl (alarm_pipes [0], F_SETFL, flags | O_NONBLOCK);
- gdk_input_add (alarm_pipes [0], GDK_INPUT_READ, alarm_ready, 0);
-
- /* Setup the signal handler */
- sa.sa_handler = alarm_activate;
- sigemptyset (&sa.sa_mask);
- sa.sa_flags = SA_RESTART;
- sigaction (SIGALRM, &sa, NULL);
-
- /* Setup a signal handler to toggle debugging */
- debug_sa.sa_handler = toggle_debugging;
- sigemptyset (&debug_sa.sa_mask);
- debug_sa.sa_flags = SA_RESTART;
- sigaction (SIGUSR1, &debug_sa, NULL);
-}
-
-void
-debug_alarm (AlarmRecord* ar, enum DebugAction action)
-{
- time_t now = time (NULL);
- iCalObject *ico = ar->closure;
- printf ("%s", ctime(&now));
- switch (action) {
- case ALARM_ADDED:
- printf ("Added alarm for %s", ctime(&ar->activation_time));
- break;
- case ALARM_NOT_ADDED:
- printf ("Alarm not added for %s", ctime(&ar->activation_time));
- break;
- case ALARM_ACTIVATED:
- printf ("Activated alarm\n");
- break;
- }
-
- if (ar->fn!=&calendar_notify) return;
- printf ("--- Summary: %s\n", ico->summary);
- switch (ar->alarm->type) {
- case ALARM_MAIL:
- printf ("--- Type: Mail\n");
- break;
- case ALARM_PROGRAM:
- printf ("--- Type: Program\n");
- break;
- case ALARM_DISPLAY:
- printf ("--- Type: Display\n");
- break;
- case ALARM_AUDIO:
- printf ("--- Type: Audio\n");
- break;
- }
-}
-
-
diff --git a/calendar/gui/alarm.h b/calendar/gui/alarm.h
deleted file mode 100644
index 81710bda5e..0000000000
--- a/calendar/gui/alarm.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef ALARM_H
-#define ALARM_H
-
-#include <time.h>
-
-typedef void (*AlarmFunction)(time_t time, CalendarAlarm *which, void *closuse);
-
-void alarm_init (void);
-gboolean alarm_add (CalendarAlarm *alarm, AlarmFunction fn, void *closure);
-int alarm_kill (void *closure);
-
-#endif
diff --git a/calendar/gui/bell.xpm b/calendar/gui/bell.xpm
deleted file mode 100644
index b1ab537a17..0000000000
--- a/calendar/gui/bell.xpm
+++ /dev/null
@@ -1,83 +0,0 @@
-/* XPM */
-static char * bell_xpm[] = {
-"16 16 64 1",
-" c None",
-". c #000000",
-"+ c #E3BB43",
-"@ c #E6C049",
-"# c #EED275",
-"$ c #F4E193",
-"% c #F4DF8C",
-"& c #EAC95C",
-"* c #EFD57A",
-"= c #FAEFBB",
-"- c #FDF6D3",
-"; c #FDF5C6",
-"> c #F4E18F",
-", c #E4BD43",
-"' c #F6E295",
-") c #FEF9D8",
-"! c #FFFFFF",
-"~ c #FFFADA",
-"{ c #FCEEAA",
-"] c #EBCA5A",
-"^ c #E9C550",
-"/ c #FAEA9C",
-"( c #FEF7CB",
-"_ c #FFF8CC",
-": c #FDF1A8",
-"< c #EED060",
-"[ c #D39D12",
-"} c #F2D55D",
-"| c #FCEC91",
-"1 c #FFF4AE",
-"2 c #FFF5B6",
-"3 c #FEEF97",
-"4 c #F3D65E",
-"5 c #D5A216",
-"6 c #FAE05C",
-"7 c #FFED7C",
-"8 c #FFEF8C",
-"9 c #FFF092",
-"0 c #FDEB7A",
-"a c #F4D750",
-"b c #D8A717",
-"c c #EAC01D",
-"d c #F6D83E",
-"e c #FAE255",
-"f c #FAE362",
-"g c #F9E161",
-"h c #F6DE5B",
-"i c #F1D145",
-"j c #E6BE28",
-"k c #D09B09",
-"l c #B67E00",
-"m c #CE9100",
-"n c #D69F04",
-"o c #E0B011",
-"p c #E6BA1D",
-"q c #E3B721",
-"r c #E0B21E",
-"s c #DCAB16",
-"t c #D7A20D",
-"u c #CC9303",
-"v c #BE8400",
-"w c #AC7500",
-"x c #A06B00",
-"y c #FFDD00",
-" ",
-" .. ",
-" .+@. ",
-" .#$%&. ",
-" .*=-;>,. ",
-" .')!~{]. ",
-" .^/(~_:<[. ",
-" .}|121345. ",
-" .678980ab. ",
-" .cdefghijkl. ",
-" .mnopqrstuvwx. ",
-" .............. ",
-" .8y. ",
-" .. ",
-" ",
-" "};
diff --git a/calendar/gui/cal_struct.h b/calendar/gui/cal_struct.h
deleted file mode 100644
index 411036c7aa..0000000000
--- a/calendar/gui/cal_struct.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#define MAX_SZ 30
-
-enum RepeatType {
- Single,
- Days,
- Months,
- WeekDays,
- MonthDays
-};
-
-
-struct actionitem {
- char date[MAX_SZ];
- int time; /* Minutes past midnight */
-};
-
-struct event {
- struct actionitem start;
- struct actionitem end;
-
- enum RepeatType repeat;
- int repeatcount;
- char description[MAX_SZ];
- char subtype[MAX_SZ];
- GList *properties;
-};
-
diff --git a/calendar/gui/calendar-conduit-control-applet.c b/calendar/gui/calendar-conduit-control-applet.c
deleted file mode 100644
index ae4bda428f..0000000000
--- a/calendar/gui/calendar-conduit-control-applet.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/* Control applet ("capplet") for the gnome-pilot calendar conduit, */
-/* based on */
-/* gpilotd control applet ('capplet') for use with the GNOME control center */
-/* $Id$ */
-
-#include <pwd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <gnome.h>
-#include <ctype.h>
-
-#include <config.h>
-#include <capplet-widget.h>
-
-#include <gpilotd/gpilotd-conduit-mgmt.h>
-#include <gpilotd/gpilotd-app.h>
-#include <gpilotd/gpilotd-app-dummy-callbacks.h>
-
-#include "calendar-conduit.h"
-
-/* tell changes callbacks to ignore changes or not */
-static gboolean ignore_changes=FALSE;
-
-/* capplet widget */
-static GtkWidget *capplet=NULL;
-
-/* host/device/pilot configuration windows */
-GtkWidget *cfgOptionsWindow=NULL;
-GtkWidget *cfgStateWindow=NULL;
-GtkWidget *dialogWindow=NULL;
-
-GnomePilotConduitMgmt *conduit;
-
-static void doTrySettings(GtkWidget *widget, gpointer);
-static void doRevertSettings(GtkWidget *widget, gpointer);
-static void doSaveSettings(GtkWidget *widget, gpointer);
-
-static void readStateCfg(GtkWidget *w,GCalConduitCfg *cfg);
-static void setStateCfg(GtkWidget *w,GCalConduitCfg *cfg);
-void about_cb (GtkWidget *, gpointer);
-GCalConduitCfg *origState = NULL;
-GCalConduitCfg *curState = NULL;
-
-gint pilotId;
-CORBA_Environment ev;
-
-/* This array must be in the same order as enumerations
- in GnomePilotConduitSyncType as they are used as index.
- Custom type implies Disabled state.
-*/
-static gchar* sync_options[] ={ N_("Disabled"),
- N_("Synchronize"),
- N_("Copy From Pilot"),
- N_("Copy To Pilot"),
- N_("Merge From Pilot"),
- N_("Merge To Pilot")};
-#define SYNC_OPTIONS_COUNT 6
-
-static void
-setSettings(GCalConduitCfg* conduitCfg)
-{
- if(conduitCfg->sync_type!=GnomePilotConduitSyncTypeCustom)
- gpilotd_conduit_mgmt_enable_with_first_sync(conduit,pilotId,
- conduitCfg->sync_type,
- conduitCfg->sync_type,
- TRUE);
- else
- gpilotd_conduit_mgmt_disable(conduit,pilotId);
-
- gcalconduit_save_configuration(conduitCfg);
-}
-
-static void
-doTrySettings(GtkWidget *widget, gpointer whatever)
-{
- readStateCfg(cfgStateWindow,curState);
- setSettings(curState);
-}
-
-static void
-doSaveSettings(GtkWidget *widget, gpointer whatever)
-{
- doTrySettings(widget,whatever);
-}
-
-static void
-doCancelSettings(GtkWidget *widget, gpointer whatever)
-{
- setSettings(origState);
-}
-
-static void
-doRevertSettings(GtkWidget *widget, gpointer whatever)
-{
- gcalconduit_destroy_configuration(&curState);
- curState = gcalconduit_dupe_configuration(origState);
- setStateCfg(cfgStateWindow,curState);
- setSettings(curState);
-}
-
-static void
-insert_dir_callback (GtkEditable *editable, const gchar *text,
- gint len, gint *position, void *data)
-{
- gint i;
- gchar *curname;
-
- curname = gtk_entry_get_text(GTK_ENTRY(editable));
- if (*curname == '\0' && len > 0) {
- if (isspace(text[0])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert_text");
- return;
- }
- } else {
- for (i=0; i<len; i++) {
- if (isspace(text[i])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable),
- "insert_text");
- return;
- }
- }
- }
-}
-static void
-insert_dir_callback2(GtkEditable *editable, const gchar *text,
- gint length, gint *position,
- void *data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static void
-clist_changed(GtkWidget *widget, gpointer data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-void about_cb (GtkWidget *widget, gpointer data) {
- GtkWidget *about;
- const gchar *authors[] = {_("Eskil Heyn Olsen <deity@eskil.dk>"),NULL};
-
- about = gnome_about_new(_("GnomeCalendar Conduit"), VERSION,
- _("(C) 1998"),
- authors,
- _("Configuration utility for the calendar conduit.\n"),
- _("gnome-calendar-conduit.png"));
- gtk_widget_show (about);
-
- return;
-}
-
-static void toggled_cb(GtkWidget *widget, gpointer data) {
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-/* called by the sync_type GtkOptionMenu */
-static void
-sync_action_selection(GtkMenuShell *widget, gpointer unused)
-{
- if (!ignore_changes) {
- capplet_widget_state_changed(CAPPLET_WIDGET (capplet), TRUE);
- }
-}
-
-/* called by the sync_type GtkOptionMenu */
-static void
-activate_sync_type(GtkMenuItem *widget, gpointer data)
-{
- curState->sync_type = GPOINTER_TO_INT(data);
- if(!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static GtkWidget
-*createStateCfgWindow(void)
-{
- GtkWidget *vbox, *table;
- GtkWidget *label;
- GtkWidget *optionMenu,*menuItem;
- GtkMenu *menu;
- gint i;
-
- vbox = gtk_vbox_new(FALSE, GNOME_PAD);
-
- table = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD);
-
- label = gtk_label_new(_("Synchronize Action"));
- gtk_box_pack_start(GTK_BOX(table), label, FALSE, FALSE, GNOME_PAD);
-
- optionMenu=gtk_option_menu_new();
- gtk_object_set_data(GTK_OBJECT(vbox), "conduit_state", optionMenu);
- menu = GTK_MENU(gtk_menu_new());
-
- for (i=0; i<SYNC_OPTIONS_COUNT;i++) {
- sync_options[i]=_(sync_options[i]);
- menuItem = gtk_menu_item_new_with_label(sync_options[i]);
- gtk_widget_show(menuItem);
- gtk_signal_connect(GTK_OBJECT(menuItem),"activate",
- GTK_SIGNAL_FUNC(activate_sync_type),
- GINT_TO_POINTER(i));
- gtk_menu_append(menu,menuItem);
- }
-
- gtk_option_menu_set_menu(GTK_OPTION_MENU(optionMenu),GTK_WIDGET(menu));
- gtk_signal_connect(GTK_OBJECT(menu), "selection-done",
- GTK_SIGNAL_FUNC(sync_action_selection),
- NULL);
-
- gtk_box_pack_start(GTK_BOX(table), optionMenu, FALSE, FALSE, 0);
-
- return vbox;
-}
-
-static void
-setStateCfg(GtkWidget *widget,GCalConduitCfg *cfg)
-{
- GtkOptionMenu *optionMenu;
- GtkMenu *menu;
-
- optionMenu = gtk_object_get_data(GTK_OBJECT(widget), "conduit_state");
- g_assert(optionMenu!=NULL);
- menu = GTK_MENU(gtk_option_menu_get_menu(optionMenu));
-
-
- ignore_changes = TRUE;
- /* Here were are relying on the items in menu being the same
- order as in GnomePilotConduitSyncType. */
- gtk_option_menu_set_history(optionMenu,(int)cfg->sync_type);
- ignore_changes = FALSE;
-}
-
-
-static void
-readStateCfg(GtkWidget *w,GCalConduitCfg *cfg)
-{
-/*
- GtkWidget *button;
-
- button = gtk_object_get_data(GTK_OBJECT(w), "conduit_on_off");
-
- g_assert(button!=NULL);
-
- activated = GTK_TOGGLE_BUTTON(button)->active;
-*/
-}
-
-static void
-pilot_capplet_setup(void)
-{
- GtkWidget *frame, *table;
-
- capplet = capplet_widget_new();
-
- table = gtk_table_new(1, 2, FALSE);
- gtk_container_border_width(GTK_CONTAINER(table), GNOME_PAD);
- gtk_container_add(GTK_CONTAINER(capplet), table);
-
- frame = gtk_frame_new(_("Conduit state"));
- gtk_container_border_width(GTK_CONTAINER(frame), GNOME_PAD_SMALL);
- gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1);
- cfgStateWindow = createStateCfgWindow();
- gtk_container_add(GTK_CONTAINER(frame), cfgStateWindow);
-
- gtk_signal_connect(GTK_OBJECT(capplet), "try",
- GTK_SIGNAL_FUNC(doTrySettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "revert",
- GTK_SIGNAL_FUNC(doRevertSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "ok",
- GTK_SIGNAL_FUNC(doSaveSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "cancel",
- GTK_SIGNAL_FUNC(doCancelSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "help",
- GTK_SIGNAL_FUNC(about_cb), NULL);
-
-
- setStateCfg(cfgStateWindow,curState);
-
- gtk_widget_show_all(capplet);
-}
-
-static void
-run_error_dialog(gchar *mesg,...) {
- char tmp[80];
- va_list ap;
-
- va_start(ap,mesg);
- vsnprintf(tmp,79,mesg,ap);
- dialogWindow = gnome_message_box_new(mesg,GNOME_MESSAGE_BOX_ERROR,GNOME_STOCK_BUTTON_OK,NULL);
- gnome_dialog_run_and_close(GNOME_DIALOG(dialogWindow));
- va_end(ap);
-}
-
-gint get_pilot_id_from_gpilotd() {
- gint *pilots;
- int i;
-
- i=0;
- gpilotd_get_pilot_ids(&pilots);
- if(pilots) {
- while(pilots[i]!=-1) { g_message("pilot %d = \"%d\"",i,pilots[i]); i++; }
- if(i==0) {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- } else {
- if(i==1)
- return pilots[0];
- else {
- g_message("too many pilots...");
- return pilots[0];
- }
- }
- } else {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- }
-}
-
-int
-main( int argc, char *argv[] )
-{
- /* we're a capplet */
- gnome_capplet_init ("calendar conduit control applet", NULL, argc, argv,
- NULL,
- 0, NULL);
-
- /* put all code to set things up in here */
- conduit = gpilotd_conduit_mgmt_new("calendar_conduit");
-
- /* get pilot name from gpilotd */
- /* 1. initialize the gpilotd connection */
- if (gpilotd_init(&argc,argv)!=0) {
- run_error_dialog(_("Cannot initialze the GnomePilot Daemon"));
- g_error(_("Cannot initialze the GnomePilot Daemon"));
- return -1;
- }
-
- /* 2 connect to gpilotd */
- if (gpilotd_connect()!=0) {
- run_error_dialog(_("Cannot connect to the GnomePilot Daemon"));
- g_error(_("Cannot connect to the GnomePilot Daemon"));
- return -1;
- }
-
- pilotId = get_pilot_id_from_gpilotd();
- if(!pilotId) return -1;
-
- /* put all code to set things up in here */
- gcalconduit_load_configuration(&origState,pilotId);
- gpilotd_conduit_mgmt_get_sync_type(conduit,pilotId,&origState->sync_type);
-
- curState = gcalconduit_dupe_configuration(origState);
-
- pilot_capplet_setup();
-
-
- /* done setting up, now run main loop */
- capplet_gtk_main();
- return 0;
-}
diff --git a/calendar/gui/calendar-conduit-control-applet.desktop b/calendar/gui/calendar-conduit-control-applet.desktop
deleted file mode 100644
index 43c429ef97..0000000000
--- a/calendar/gui/calendar-conduit-control-applet.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Name=GnomeCalendar
-Comment=Configure the GnomeCal conduit
-Exec=calendar-conduit-control-applet --cap-id=1
-Terminal=0
-Type=Application
-Icon=gnome-calendar-conduit.png
diff --git a/calendar/gui/calendar-conduit.c b/calendar/gui/calendar-conduit.c
deleted file mode 100644
index d7ec8083ae..0000000000
--- a/calendar/gui/calendar-conduit.c
+++ /dev/null
@@ -1,1433 +0,0 @@
-/* $Id$ */
-
-#include <glib.h>
-#include <gnome.h>
-
-#include <pi-source.h>
-#include <pi-socket.h>
-#include <pi-file.h>
-#include <pi-dlp.h>
-#include <pi-version.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <utime.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <signal.h>
-#include <errno.h>
-
-#include <libgnorba/gnorba.h>
-#include <libgnorba/gnome-factory.h>
-
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-standard-abs.h>
-
-#include "GnomeCal.h"
-#include "calobj.h"
-#include "calendar.h"
-#include "timeutil.h"
-
-#include "calendar-conduit.h"
-
-int debug_alarms = 0; /* needed to satisfy some other part of gncal */
-/* Default values for alarms */ /* needed to satisfy some other part of gncal */
-CalendarAlarm alarm_defaults[4] = {
- { ALARM_MAIL, 0, 15, ALARM_MINUTES },
- { ALARM_PROGRAM, 0, 15, ALARM_MINUTES },
- { ALARM_DISPLAY, 0, 15, ALARM_MINUTES },
- { ALARM_AUDIO, 0, 15, ALARM_MINUTES }
-};
-
-GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
-void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
-void local_record_from_icalobject(GCalLocalRecord *local,iCalObject *obj);
-
-#define CONDUIT_VERSION "0.8.9"
-#ifdef G_LOG_DOMAIN
-#undef G_LOG_DOMAIN
-#endif
-#define G_LOG_DOMAIN "gcalconduit"
-
-#define DEBUG_CALCONDUIT
-#undef DEBUG_CALCONDUIT
-
-#ifdef DEBUG_CALCONDUIT
-#define show_exception(e) g_warning ("Exception: %s\n", CORBA_exception_id (e))
-#define LOG(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE, e)
-#else
-#define show_exception(e)
-#define LOG(e...)
-#endif
-
-#define WARN(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_WARNING, e)
-#define INFO(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE, e)
-
-static int
-start_calendar_server (GnomePilotConduitStandardAbs *conduit,
- GCalConduitContext *ctxt)
-{
-
- g_return_val_if_fail(conduit!=NULL,-2);
- g_return_val_if_fail(ctxt!=NULL,-2);
-
- ctxt->calendar = goad_server_activate_with_id (NULL,
- "IDL:GNOME:Calendar:Repository:1.0",
- 0, NULL);
- if (ctxt->calendar == CORBA_OBJECT_NIL) {
- g_error ("Can not communicate with GnomeCalendar server");
- return -1;
- }
-
- if (ctxt->ev._major != CORBA_NO_EXCEPTION){
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- }
- return 0;
-}
-
-
-/* Just a stub to link with */
-void
-calendar_notify (time_t time, CalendarAlarm *which, void *data)
-{
-}
-
-static GSList *
-get_calendar_objects(GnomePilotConduitStandardAbs *conduit,
- gboolean *status,
- GCalConduitContext *ctxt)
-{
- GSList *result;
- GNOME_Calendar_Repository_String_Sequence *uids;
-
- g_return_val_if_fail(conduit!=NULL,NULL);
- g_return_val_if_fail(ctxt!=NULL,NULL);
-
- result = NULL;
- uids = GNOME_Calendar_Repository_get_object_id_list (ctxt->calendar, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- if(status!=NULL) (*status) = FALSE;
- return NULL;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- if(status!=NULL) (*status) = FALSE;
- return NULL;
- }
-
- if(status!=NULL) (*status) = TRUE;
- if(uids->_length>0) {
- int i;
- for(i=0;i<uids->_length;i++) {
- result = g_slist_prepend(result,g_strdup(uids->_buffer[i]));
- }
- } else {
- INFO ("No entries found");
- }
-
- CORBA_free(uids);
-
- return result;
-}
-
-#if 0
-static GList *
-get_calendar_objects(GnomePilotConduitStandardAbs *conduit)
-{
- char *vcalendar_string;
- char *error;
- GList *retval,*l;
- Calendar *cal;
-
- g_return_val_if_fail(conduit!=NULL,NULL);
-
- vcalendar_string =
- GNOME_Calendar_Repository_get_objects (calendar, &ev);
-
- cal = calendar_new("Temporary");
-
- error = calendar_load_from_memory(cal,vcalendar_string);
-
- if (ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&ev);
- CORBA_exception_free(&ev);
- return;
- } else if(ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&ev);
- CORBA_exception_free(&ev);
- return;
- }
-
- if(error != NULL) {
- WARN ("Error while converting records");
- WARN ("Error : %s",error);
- return NULL;
- }
- retval = NULL;
- for(l=cal->events ; l ; l=l->next) {
- LOG ("duping %d [%s]",
- ((iCalObject*)l->data)->pilot_id,
- ((iCalObject*)l->data)->summary);
- retval = g_list_prepend(retval,ical_object_duplicate(l->data));
- }
-
- /* g_free(vcalendar_string); FIXME: this coredumps, but won't it leak without ? */
- calendar_destroy(cal);
-
- return retval;
-}
-#endif
-
-static void
-local_record_from_ical_uid(GCalLocalRecord *local,
- char *uid,
- GCalConduitContext *ctxt)
-{
- iCalObject *obj;
- char *vcalendar_string;
-
- g_assert(local!=NULL);
-
- vcalendar_string = GNOME_Calendar_Repository_get_object(ctxt->calendar, uid, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- }
- g_return_if_fail(vcalendar_string!=NULL);
-
- obj = ical_object_new_from_string (vcalendar_string);
-
- local_record_from_icalobject(local,obj);
-
- return;
-}
-
-
-/*
- * converts a iCalObject to a GCalLocalRecord
- */
-
-void
-local_record_from_icalobject(GCalLocalRecord *local,
- iCalObject *obj)
-{
- g_return_if_fail(local!=NULL);
- g_return_if_fail(obj!=NULL);
-
- local->ical = obj;
- local->local.ID = local->ical->pilot_id;
-
-/*
- LOG ("local->Id = %ld [%s], status = %d",
- local->local.ID,obj->summary,local->ical->pilot_status);
-*/
- switch(local->ical->pilot_status) {
- case ICAL_PILOT_SYNC_NONE:
- local->local.attr = GnomePilotRecordNothing;
- break;
- case ICAL_PILOT_SYNC_MOD:
- local->local.attr = GnomePilotRecordModified;
- break;
- case ICAL_PILOT_SYNC_DEL:
- local->local.attr = GnomePilotRecordDeleted;
- break;
- }
-
- /* Records without a pilot_id are new */
- if(local->local.ID == 0)
- local->local.attr = GnomePilotRecordNew;
-
- local->local.secret = 0;
- if(obj->class!=NULL)
- if(strcmp(obj->class,"PRIVATE")==0)
- local->local.secret = 1;
-
- local->local.archived = 0;
-}
-
-/*
- * Given a PilotRecord, find the matching record in
- * the calendar repository. If no match, return NULL
- */
-static GCalLocalRecord *
-find_record_in_repository(GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- char *vcal_string;
- GCalLocalRecord *loc;
-
- g_return_val_if_fail(conduit!=NULL,NULL);
- g_return_val_if_fail(remote!=NULL,NULL);
-
- LOG ("requesting %ld", remote->ID);
-
- vcal_string =
- GNOME_Calendar_Repository_get_object_by_pilot_id (ctxt->calendar, remote->ID, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return NULL;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return NULL;
- } else {
- LOG ("Found");
- loc = g_new0(GCalLocalRecord,1);
- /* memory allocated in new_from_string is freed in free_match */
- local_record_from_icalobject(loc,
- ical_object_new_from_string (vcal_string));
- /* g_free(vcal_string); FIXME: this coredumps, but won't it leak without ? */
- return loc;
- }
-
- return NULL;
-}
-
-/*
- * updates an given iCalObject in the repository
- */
-static void
-update_calendar_entry_in_repository(GnomePilotConduitStandardAbs *conduit,
- iCalObject *obj,
- GCalConduitContext *ctxt)
-{
- char *str;
-
- g_return_if_fail(conduit!=NULL);
- g_return_if_fail(obj!=NULL);
-
- str = calendar_string_from_object (obj);
-
- GNOME_Calendar_Repository_update_object (ctxt->calendar, obj->uid, str, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return;
- }
-
- free (str);
-}
-
-static iCalObject *
-ical_from_remote_record(GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- iCalObject *in_obj)
-{
- iCalObject *obj;
- int i;
- struct Appointment a;
- time_t now;
-
- now = time (NULL);
-
- g_return_val_if_fail(remote!=NULL,NULL);
- memset(&a,0,sizeof(struct Appointment));
- unpack_Appointment(&a,remote->record,remote->length);
-
- if (in_obj == NULL)
- obj = ical_new (a.note ? a.note : "",
- g_get_user_name (),
- a.description ? a.description : "");
- else
- obj = in_obj;
-
- if (a.note) {
- g_free(obj->comment);
- obj->comment = g_strdup(a.note);
- }
- if (a.description) {
- g_free(obj->summary);
- obj->summary = g_strdup(a.description);
- }
-
- obj->created = now;
- obj->last_mod = now;
- obj->priority = 0;
- obj->transp = 0;
- obj->related = NULL;
- obj->pilot_id = remote->ID;
- obj->pilot_status = ICAL_PILOT_SYNC_NONE;
-
- /*
- * Begin and end
- */
-
- if (a.event)
- {
- /* turn day-long events into a full day's appointment
- FIXME: get settings from gnomecal */
- a.begin.tm_sec = 0;
- a.begin.tm_min = 0;
- a.begin.tm_hour = 0;
-
- a.end.tm_sec = 0;
- a.end.tm_min =59;
- a.end.tm_hour = 23;
- }
-
- obj->dtstart = mktime (&a.begin);
- obj->dtend = mktime (&a.end);
-
- /* Special case: daily repetitions are converted to a multi-day event */
- /* This sucketh, a pilot event scheduled for dailyRepeat, freq 1, end on
- whatever is cleary converted wrong
- if (a.repeatType == repeatDaily){
- time_t newt = time_add_day (obj->dtend, a.repeatFrequency);
-
- obj->dtend = newt;
- }
- */
-
- /*
- * Alarm
- */
- if (a.alarm){
- obj->aalarm.type = ALARM_AUDIO;
- obj->aalarm.enabled = 1;
- obj->aalarm.count = a.advance;
-
- switch (a.advanceUnits){
- case advMinutes:
- obj->aalarm.units = ALARM_MINUTES;
- break;
-
- case advHours:
- obj->aalarm.units = ALARM_HOURS;
- break;
-
- case advDays:
- obj->aalarm.units = ALARM_DAYS;
- break;
- default:
- }
- }
-
- /*
- * Recurrence
- */
- if (a.repeatFrequency){
- obj->recur = g_new0 (Recurrence, 1);
-
- switch (a.repeatType){
- case repeatDaily:
- /*
- * In the Pilot daily repetitions are actually
- * multi-day events
- */
- obj->recur->type = RECUR_DAILY;
- break;
-
- case repeatMonthlyByDate:
- obj->recur->type = RECUR_MONTHLY_BY_DAY;
- obj->recur->u.month_day = a.repeatFrequency;
- break;
-
- case repeatWeekly:
- {
- int wd;
-
- obj->recur->type = RECUR_WEEKLY;
- for (wd = 0; wd < 7; wd++)
- if (a.repeatDays [wd])
- obj->recur->weekday |= 1 << wd;
-
- if (obj->recur->weekday == 0){
- struct tm tm = *localtime (&obj->dtstart);
-
- obj->recur->weekday = 1 << tm.tm_wday;
- }
- break;
- }
-
- case repeatMonthlyByDay:
- obj->recur->type = RECUR_MONTHLY_BY_POS;
- obj->recur->u.month_pos = a.repeatFrequency;
- obj->recur->weekday = (a.repeatDay / 7);
- break;
-
- case repeatYearly:
- obj->recur->type = RECUR_YEARLY_BY_DAY;
- break;
-
- default:
- g_assert_not_reached();
- }
-
- if (a.repeatForever)
- obj->recur->duration = 0;
- else
- obj->recur->_enddate = mktime (&a.repeatEnd);
-
- obj->recur->interval = a.repeatFrequency;
- }
-
- /*
- * Load exception dates
- */
- obj->exdate = NULL;
- for (i = 0; i < a.exceptions; i++){
- time_t *t = g_new (time_t, 1);
-
- *t = mktime (&(a.exception [i]));
- obj->exdate = g_list_prepend (obj->exdate, t);
- }
-
- g_free (obj->class);
-
- if (remote->attr & dlpRecAttrSecret)
- obj->class = g_strdup ("PRIVATE");
- else
- obj->class = g_strdup ("PUBLIC");
-
-
- free_Appointment(&a);
-
- return obj;
-}
-
-/* Code blatantly stolen from
- * calendar-pilot-sync.c:
- *
- * (C) 1999 International GNOME Support
- *
- * Author:
- * Miguel de Icaza (miguel@gnome-support.com)
- *
- */
-static gint
-update_record (GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- char *vcal_string;
- iCalObject *obj;
- struct Appointment a;
-
- g_return_val_if_fail(remote!=NULL,-1);
-
- memset(&a,0,sizeof(struct Appointment));
- unpack_Appointment(&a,remote->record,remote->length);
-
- obj = ical_new (a.note ? a.note : "",
- g_get_user_name (),
- a.description ? a.description : "");
-
- LOG ("requesting %ld [%s]", remote->ID, a.description);
- vcal_string = GNOME_Calendar_Repository_get_object_by_pilot_id (ctxt->calendar, remote->ID, &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- LOG ("Object did not exist, creating a new one");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- ical_from_remote_record(conduit,remote,obj);
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- ical_object_destroy (obj);
- free_Appointment(&a);
- return -1;
- } else {
- LOG ("Found");
- ical_object_destroy (obj);
- obj = ical_object_new_from_string (vcal_string);
- ical_from_remote_record(conduit,remote,obj);
- CORBA_free(vcal_string);
- }
-
- /* update record on server */
-
- update_calendar_entry_in_repository(conduit,obj,ctxt);
-
- /*
- * Shutdown
- */
- ical_object_destroy (obj);
- free_Appointment(&a);
-
- return 0;
-}
-
-static void
-check_for_slow_setting(GnomePilotConduit *c,
- GCalConduitContext *ctxt)
-{
- CORBA_long entry_number;
- entry_number =
- GNOME_Calendar_Repository_get_number_of_objects(ctxt->calendar,
- &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- } else {
- LOG (_("Calendar holds %d entries"),entry_number);
- /* If the local base is empty, do a slow sync */
- if ( entry_number <= 0) {
- gnome_pilot_conduit_standard_set_slow(c);
- }
- }
-}
-
-static gint
-pre_sync(GnomePilotConduit *c,
- GnomePilotDBInfo *dbi,
- GCalConduitContext *ctxt)
-{
- int l;
- unsigned char *buf;
-
- g_message ("GnomeCal Conduit v.%s",CONDUIT_VERSION);
-
- ctxt->calendar = CORBA_OBJECT_NIL;
-
- if (start_calendar_server(GNOME_PILOT_CONDUIT_STANDARD_ABS(c),ctxt) != 0) {
- WARN(_("Could not start gnomecal server"));
- return -1;
- }
-
- gtk_object_set_data(GTK_OBJECT(c),"dbinfo",dbi);
-
- /* load_records(c); */
-
- buf = (unsigned char*)g_malloc(0xffff);
- if((l=dlp_ReadAppBlock(dbi->pilot_socket,dbi->db_handle,0,(unsigned char *)buf,0xffff))<0) {
- WARN(_("Could not read pilot's DateBook application block"));
- return -1;
- }
- unpack_AppointmentAppInfo(&(ctxt->ai),buf,l);
- g_free(buf);
-
- check_for_slow_setting(c,ctxt);
-
- return 0;
-}
-
-/**
- * Find (if possible) the local record which matches
- * the given PilotRecord.
- * if successfull, return non-zero and set *local to
- * a non-null value (the located local record),
- * otherwise return 0 and set *local = NULL;
- */
-
-static gint
-match_record (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("in match_record");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
-
- *local = find_record_in_repository(conduit,remote,ctxt);
-
- if (*local==NULL) return -1;
- return 0;
-}
-
-/**
- * Free the data allocated by a previous match_record call.
- * If successfull, return non-zero and ser *local=NULL, otherwise
- * return 0.
- */
-static gint
-free_match (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- GCalConduitContext *ctxt)
-{
- LOG ("entering free_match");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(*local!=NULL,-1);
-
- ical_object_destroy (GCAL_LOCALRECORD(*local)->ical);
- g_free(*local);
-
- *local = NULL;
- return 0;
-}
-
-/*
- Move to archive and set status to Nothing
- */
-static gint
-archive_local (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- GCalConduitContext *ctxt)
-{
- LOG ("entering archive_local");
-
- g_return_val_if_fail(local!=NULL,-1);
-
- return -1;
-}
-
-/*
- Store in archive and set status to Nothing
- */
-static gint
-archive_remote (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering archive_remote");
-
- g_return_val_if_fail(remote!=NULL,-1);
- g_return_val_if_fail(local!=NULL,-1);
-
- return -1;
-}
-
-/*
- Store and set status to Nothing
- */
-static gint
-store_remote (GnomePilotConduitStandardAbs *conduit,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering store_remote");
-
- g_return_val_if_fail(remote!=NULL,-1);
- remote->attr = GnomePilotRecordNothing;
-
- return update_record(conduit,remote,ctxt);
-}
-
-static gint
-clear_status_archive_local (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- GCalConduitContext *ctxt)
-{
- LOG ("entering clear_status_archive_local");
-
- g_return_val_if_fail(local!=NULL,-1);
-
- return -1;
-}
-
-static gint
-iterate (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- GCalConduitContext *ctxt)
-{
- static GSList *events,*iterator;
- static int hest;
-
- g_return_val_if_fail(local!=NULL,-1);
-
- if(*local==NULL) {
- LOG ("beginning iteration");
-
- events = get_calendar_objects(conduit,NULL,ctxt);
- hest = 0;
-
- if(events!=NULL) {
- LOG ("iterating over %d records",g_slist_length(events));
- *local = g_new0(GCalLocalRecord,1);
-
- local_record_from_ical_uid(*local,(gchar*)events->data,ctxt);
- iterator = events;
- } else {
- LOG ("no events");
- (*local) = NULL;
- }
- } else {
- /*LOG ("continuing iteration");*/
- hest++;
- if(g_slist_next(iterator)==NULL) {
- GSList *l;
-
- LOG ("ending");
- /** free stuff allocated for iteration */
- g_free((*local));
-
- LOG ("iterated over %d records",hest);
- for(l=events;l;l=l->next)
- g_free(l->data);
-
- g_slist_free(events);
-
- /* ends iteration */
- (*local) = NULL;
- return 0;
- } else {
- iterator = g_slist_next(iterator);
- local_record_from_ical_uid(*local,(gchar*)(iterator->data),ctxt);
- }
- }
- return 1;
-}
-
-static gint
-iterate_specific (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord **local,
- gint flag,
- gint archived,
- GCalConduitContext *ctxt)
-{
-#ifdef DEBUG_CALCONDUIT
- {
- gchar *tmp;
- switch (flag) {
- case GnomePilotRecordNothing: tmp = g_strdup("RecordNothing"); break;
- case GnomePilotRecordModified: tmp = g_strdup("RecordModified"); break;
- case GnomePilotRecordNew: tmp = g_strdup("RecordNew"); break;
- default: tmp = g_strdup_printf("0x%x",flag); break;
- }
- LOG ("entering iterate_specific(flag = %s)",tmp);
- g_free(tmp);
- }
-#endif
- g_return_val_if_fail(local!=NULL,-1);
-
- /* iterate until a record meets the criteria */
- while(gnome_pilot_conduit_standard_abs_iterate(conduit,(LocalRecord**)local)) {
- if((*local)==NULL) break;
- if(archived && ((*local)->local.archived==archived)) break;
- if(((*local)->local.attr == flag)) break;
- }
-
- return (*local)==NULL?0:1;
-}
-
-static gint
-purge (GnomePilotConduitStandardAbs *conduit,
- GCalConduitContext *ctxt)
-{
- LOG ("entering purge");
-
-
- /* HEST, gem posterne her */
-
- return -1;
-}
-
-static gint
-set_status (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- gint status,
- GCalConduitContext *ctxt)
-{
- LOG ("entering set_status(status=%d)",status);
-
- g_return_val_if_fail(local!=NULL,-1);
-
- g_assert(local->ical!=NULL);
-
- local->local.attr = status;
- switch(status) {
- case GnomePilotRecordPending:
- case GnomePilotRecordNothing:
- local->ical->pilot_status = ICAL_PILOT_SYNC_NONE;
- break;
- case GnomePilotRecordDeleted:
- break;
- case GnomePilotRecordNew:
- case GnomePilotRecordModified:
- local->ical->pilot_status = ICAL_PILOT_SYNC_MOD;
- break;
- }
-
- if ( status == GnomePilotRecordDeleted) {
- GNOME_Calendar_Repository_delete_object(ctxt->calendar,local->ical->uid,&(ctxt->ev));
- } else {
- GNOME_Calendar_Repository_update_pilot_id(ctxt->calendar,
- local->ical->uid,
- local->local.ID,
- local->ical->pilot_status,
- &(ctxt->ev));
- }
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- LOG ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- }
- return 0;
-}
-
-static gint
-set_archived (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- gint archived,
- GCalConduitContext *ctxt)
-{
- LOG ("entering set_archived");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_assert(local->ical!=NULL);
-
- local->local.archived = archived;
- update_calendar_entry_in_repository(conduit,local->ical,ctxt);
- /* FIXME: This should move the entry into a speciel
- calendar file, eg. Archive, or (by config option), simply
- delete it */
- return 0;
-}
-
-static gint
-set_pilot_id (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- guint32 ID,
- GCalConduitContext *ctxt)
-{
- LOG ("entering set_pilot_id(id=%d)",ID);
-
- g_return_val_if_fail(local!=NULL,-1);
- g_assert(local->ical!=NULL);
-
- local->local.ID = ID;
- local->ical->pilot_id = ID;
- GNOME_Calendar_Repository_update_pilot_id(ctxt->calendar,
- local->ical->uid,
- local->local.ID,
- local->ical->pilot_status,
- &(ctxt->ev));
-
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- LOG ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- return -1;
- }
- return 0;
-}
-
-static gint
-transmit (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord **remote,
- GCalConduitContext *ctxt)
-{
- PilotRecord *p;
- int daycount;
-
- LOG ("entering transmit");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
- g_assert(local->ical!=NULL);
-
- p = g_new0(PilotRecord,1);
-
- p->ID = local->local.ID;
- p->attr = local->local.attr;
- p->archived = local->local.archived;
- p->secret = local->local.secret;
-
- local->a = g_new0(struct Appointment,1);
-
- local->a->event = 0; /* if no start time, leave at 1 */
- local->a->begin = *localtime(&local->ical->dtstart);
- local->a->end = *localtime(&local->ical->dtend);
-
- /* set the Audio Alarm parameters */
- if(local->ical->aalarm.enabled) {
- local->a->alarm = 1;
- local->a->advance = local->ical->aalarm.count;
- switch(local->ical->aalarm.units) {
- case ALARM_MINUTES:
- local->a->advanceUnits = advMinutes;
- break;
- case ALARM_HOURS:
- local->a->advanceUnits = advHours;
- break;
- case ALARM_DAYS:
- local->a->advanceUnits = advDays;
- break;
- }
- } else {
- local->a->alarm = 0;
- local->a->advance = 0;
- local->a->advanceUnits = advMinutes;
- }
-
- /* set the recurrence parameters */
- if (local->ical->recur != NULL) {
- switch (local->ical->recur->type) {
- case RECUR_DAILY:
- local->a->repeatType = repeatDaily;
- break;
- case RECUR_WEEKLY:
- local->a->repeatType = repeatWeekly;
- break;
- case RECUR_MONTHLY_BY_POS:
- local->a->repeatType = repeatMonthlyByDate;
- break;
- case RECUR_MONTHLY_BY_DAY:
- local->a->repeatType = repeatMonthlyByDay;
- break;
- case RECUR_YEARLY_BY_MONTH:
- local->a->repeatType = repeatYearly;
- break;
- case RECUR_YEARLY_BY_DAY:
- local->a->repeatType = repeatYearly;
- break;
- }
- if (local->ical->recur->duration == 0) {
- local->a->repeatForever = 1;
- } else {
- local->a->repeatForever = 0;
- local->a->repeatEnd = *localtime(&local->ical->recur->_enddate);
- }
- local->a->repeatFrequency = local->ical->recur->interval;
-
-
- for ( daycount=0; daycount<7; daycount++ ) {
- if (local->ical->recur->weekday & (1 << daycount))
- local->a->repeatDays[daycount] = 1;
- }
- } else {
- local->a->repeatType = repeatNone;
- local->a->repeatForever = 0;
- local->a->repeatEnd = local->a->end;
- local->a->repeatFrequency = 0;
- local->a->repeatDay = dom1stSun;
- local->a->repeatDays[0] = 0;
- local->a->repeatDays[1] = 0;
- local->a->repeatDays[2] = 0;
- local->a->repeatDays[3] = 0;
- local->a->repeatDays[4] = 0;
- local->a->repeatDays[5] = 0;
- local->a->repeatDays[6] = 0;
- local->a->repeatWeekstart = 0;
- local->a->exceptions = 0;
- local->a->exception = NULL;
- }
-
- /* STOP: don't replace these with g_strdup, since free_Appointment
- uses free to deallocte */
- local->a->note =
- local->ical->comment==NULL?NULL:strdup(local->ical->comment);
- local->a->description =
- local->ical->summary==NULL?NULL:strdup(local->ical->summary);
-
- /* Generate pilot record structure */
- p->record = g_new0(char,0xffff);
- p->length = pack_Appointment(local->a,p->record,0xffff);
-
-#if 0
- /* This is some debug code that hexdumps the calendar entry...
- You won't need this. */
- {
- int x,y;
- g_message("calconduit: new item from %s to %s",asctime(&(local->a->begin)),asctime(&(local->a->end)));
-
- g_message("local->a->note = %s",local->a->note);
- g_message("local->a->description = %s",local->a->description);
- g_message("sizeof(p->record) = %d, length is %d",sizeof(p->record),p->length);
- for(x=0;x<p->length;x+=32) {
- for(y=x;y<x+32;y++)
- if(p->record[y]<33 || p->record[y]>128)
- printf("%02X",p->record[y]);
- else
- printf(" %c",p->record[y]);
- printf("\n");
- }
- }
-#endif
-
- *remote = p;
-
- return 0;
-}
-
-static gint
-free_transmit (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord **remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering free_transmit");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
-
- free_Appointment(local->a);
- g_free((*remote)->record);
- *remote = NULL;
- return 0;
-}
-
-static gint
-compare (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- /* used by the quick compare */
- PilotRecord *remoteOfLocal;
- int err;
- int retval;
-
- /* used by the tedious compare */
- struct Appointment a;
- int daycount;
-
- g_message ("entering compare");
-
- g_return_val_if_fail (local!=NULL,-1);
- g_return_val_if_fail (remote!=NULL,-1);
-#if 1
- err = transmit(conduit,local,&remoteOfLocal,ctxt);
- if (err != 0) return err;
-
- retval = 0;
- if (remote->length == remoteOfLocal->length) {
- if (memcmp(remoteOfLocal->record,remote->record,remote->length)!=0) {
- g_message("compare failed on contents");
- retval = 1;
- }
- } else {
- g_message("compare failed on length");
- retval = 1;
- }
-
- free_transmit(conduit,local,&remoteOfLocal,ctxt);
- return retval;
-
-#else
- /** FIXME: All the { LOG("yadayada"); return 1; } bloat is for debug purposes.
- Once this is known to work, compact to return 1;'s */
-
- /* Check record attributes */
- if (local->local.ID != remote->ID) {
- LOG("failed local->local.ID == remote->ID");
- return 1;
- }
- if (local->local.attr != remote->attr) {
- LOG("failed local->local.attr == remote->attr");
- return 1;
- }
- if (local->local.archived != remote->archived) {
- LOG("failed local->local.archived == remote->archived");
- return 1;
- }
- if (local->local.secret != remote->secret) {
- LOG("failed local->local.secret == remote->secret");
- return 1;
- }
-
- unpack_Appointment(&a,remote->record,remote->length);
-
- /* Check records begin/end time */
- if (a.event==0) {
-/* FIXME
- if (a.begin != *localtime(&local->ical->dtstart)) {
- LOG("a.begin == *localtime(&local->ical->dtstart)");
- return 1;
- }
- if (a.end != *localtime(&local->ical->dtend)) {
- LOG("a.end == *localtime(&local->ical->dtend)");
- return 1;
- }
-*/
- } else {
- LOG("failed local->a.event != 0, unsupported by gnomecal");
- return 1;
- }
-
- /* Check records alarm settings */
- if(a.alarm == 1) {
- if (local->ical->aalarm.enabled == 1) {
- if (a.advance != local->ical->aalarm.count) {
- LOG("failed a.advance == local->ical->aalarm.count");
- return 1;
- }
- switch(local->ical->aalarm.units) {
- case ALARM_MINUTES:
- if (a.advanceUnits != advMinutes) {
- LOG("failed local->ical->aalarm.units == a.advanceUnits");
- return 1;
- }
- break;
- case ALARM_HOURS:
- if (a.advanceUnits != advHours) {
- LOG("failed local->ical->aalarm.units == a.advanceUnits");
- return 1;
- }
- break;
- case ALARM_DAYS:
- if (a.advanceUnits != advDays) {
- LOG("failed local->ical->aalarm.units == a.advanceUnits");
- return 1;
- }
- break;
- }
- } else {
- LOG("failed a.alarm == 1 && local->ical->aalarm.enabled == 1");
- return 1;
- }
- } else if (local->ical->aalarm.enabled == 1) {
- LOG("failed a.alarm != 1 && local->ical->aalarm.enabled != 1");
- return 1;
- }
-
- /* Check records recurrence settings */
- /* If this code is broken, a more or less safe although not efficient
- approach is (other the fixing the bug), if either has recurrence,
- return 1, thus failing the comparision */
- if (local->ical->recur != NULL) {
- if (a.repeatType == repeatNone) {
- LOG("failed: local->ical->recur != NULL && a.repeatType != repeatNone");
- return 1;
- }
- switch (local->ical->recur->type) {
- case RECUR_DAILY:
- if (a.repeatType != repeatDaily) {
- LOG("failed a.repeatType == repeatDaily");
- return 1; }
- break;
- case RECUR_WEEKLY:
- if (a.repeatType != repeatWeekly) {
- LOG("failed a.repeatType == repeatWeekly");
- return 1; }
- break;
- case RECUR_MONTHLY_BY_POS:
- if (a.repeatType != repeatMonthlyByDate) {
- LOG("failed a.repeatType == repeatMonthlyByDate");
- return 1; }
- break;
- case RECUR_MONTHLY_BY_DAY:
- if (a.repeatType != repeatMonthlyByDay) {
- LOG("failed a.repeatType == repeatMonthlyByDay");
- return 1; }
- break;
- case RECUR_YEARLY_BY_MONTH:
- if (a.repeatType != repeatYearly) {
- LOG("failed a.repeatType == repeatYearly");
- return 1; }
- break;
- case RECUR_YEARLY_BY_DAY:
- if (a.repeatType != repeatYearly) {
- LOG("failed a.repeatType == repeatYearly");
- return 1; }
- break;
- }
- if (local->ical->recur->duration == 0) {
- if(a.repeatForever != 1) {
- LOG("failed local->ical->recur->duration == 0 && a.repeatForever == 1");
- return 1;
- }
- } else {
- if(a.repeatForever != 0) {
- LOG("failed local->ical->recur->duration != 0 && ! a.repeatForever == 0");
- return 1;
- }
-/* FIXME
- if(a.repeatEnd != *localtime(&local->ical->recur->_enddate)) {
- LOG("failed a.repeatEnd == *localtime(&local->ical->recur->_enddate)");
- return 1;
- }
-*/
- }
- if (a.repeatFrequency != local->ical->recur->interval) {
- LOG("failed a.repeatFrequency == local->ical->recur->interval");
- return 1;
- }
- for (daycount = 0; daycount<7; daycount++) {
- if(local->ical->recur->weekday & (1<<daycount)) {
- if (a.repeatDays[daycount]!=1) {
- LOG("failed local->ical->recur->weekday & (1<<daycount) && a.repeatDays[daycount]==1");
- return 1;
- }
- } else {
- if (a.repeatDays[daycount]!=0) {
- LOG("failed local->ical->recur->weekday &! (1<<daycount) && a.repeatDays[daycount]==0");
- return 1;
- }
- }
- }
- } else if (a.repeatType != repeatNone ) {
- LOG("failed: local->ical->recur == NULL && a.repeatType == repeatNone");
- return 1;
- }
-
- /* check the note and description */
- if(a.note!=NULL) {
- if(local->ical->comment==NULL) {
- LOG("failed a.note != NULL && local->ical->coment != NULL");
- return 1;
- }
- if(strcmp(local->ical->comment,a.note)!=0) {
- LOG("failed strcmp(local->ical->comment,a.note)==0");
- return 1;
- }
- } if(local->ical->comment!=NULL) {
- LOG("failed a.note == NULL && local->ical->coment == NULL");
- return 1;
- }
- if(a.description!=NULL) {
- if(local->ical->summary==NULL) {
- LOG("failed a.description != NULL && local->ical->coment != NULL");
- return 1;
- }
- if(strcmp(local->ical->summary,a.description)!=0) {
- LOG("failed strcmp(local->ical->summary,a.description)==0");
- return 1;
- }
- } if(local->ical->summary!=NULL) {
- LOG("failed a.description == NULL && local->ical->coment == NULL");
- return 1;
- }
-#endif
- return 0;
-}
-
-static gint
-compare_backup (GnomePilotConduitStandardAbs *conduit,
- GCalLocalRecord *local,
- PilotRecord *remote,
- GCalConduitContext *ctxt)
-{
- LOG ("entering compare_backup");
-
- g_return_val_if_fail(local!=NULL,-1);
- g_return_val_if_fail(remote!=NULL,-1);
-
- return -1;
-}
-
-static gint
-delete_all (GnomePilotConduitStandardAbs *conduit,
- GCalConduitContext *ctxt)
-{
- GSList *events,*it;
- gboolean error;
-
- events = get_calendar_objects(conduit,&error,ctxt);
-
- if (error == FALSE) return -1;
- for (it=events;it;it = g_slist_next(it)) {
- GNOME_Calendar_Repository_delete_object(ctxt->calendar,
- it->data,
- &(ctxt->ev));
- if (ctxt->ev._major == CORBA_USER_EXCEPTION){
- INFO ("Object did not exist");
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- } else if(ctxt->ev._major != CORBA_NO_EXCEPTION) {
- WARN (_("Error while communicating with calendar server"));
- show_exception(&(ctxt->ev));
- CORBA_exception_free(&(ctxt->ev));
- /* destroy loop, free data */
- for (it=events;it;it = g_slist_next(it)) g_free(it->data);
- g_slist_free(events);
- return -1;
- }
- g_free(it->data);
- }
- g_slist_free(events);
- return -1;
-}
-
-GnomePilotConduit *
-conduit_get_gpilot_conduit (guint32 pilotId)
-{
- GtkObject *retval;
- GCalConduitCfg *cfg;
- GCalConduitContext *ctxt;
-
-
- retval = gnome_pilot_conduit_standard_abs_new ("DatebookDB", 0x64617465);
- g_assert (retval != NULL);
- gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"GnomeCalConduit");
-
- gcalconduit_load_configuration(&cfg,pilotId);
- gtk_object_set_data(retval,"gcalconduit_cfg",cfg);
-
- gcalconduit_new_context(&ctxt,cfg);
- gtk_object_set_data(GTK_OBJECT(retval),"gcalconduit_context",ctxt);
-
- gtk_signal_connect (retval, "match_record", (GtkSignalFunc) match_record, ctxt);
- gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt);
- gtk_signal_connect (retval, "archive_local", (GtkSignalFunc) archive_local, ctxt);
- gtk_signal_connect (retval, "archive_remote", (GtkSignalFunc) archive_remote, ctxt);
- gtk_signal_connect (retval, "store_remote", (GtkSignalFunc) store_remote, ctxt);
- gtk_signal_connect (retval, "clear_status_archive_local", (GtkSignalFunc) clear_status_archive_local, ctxt);
- gtk_signal_connect (retval, "iterate", (GtkSignalFunc) iterate, ctxt);
- gtk_signal_connect (retval, "iterate_specific", (GtkSignalFunc) iterate_specific, ctxt);
- gtk_signal_connect (retval, "purge", (GtkSignalFunc) purge, ctxt);
- gtk_signal_connect (retval, "set_status", (GtkSignalFunc) set_status, ctxt);
- gtk_signal_connect (retval, "set_archived", (GtkSignalFunc) set_archived, ctxt);
- gtk_signal_connect (retval, "set_pilot_id", (GtkSignalFunc) set_pilot_id, ctxt);
- gtk_signal_connect (retval, "compare", (GtkSignalFunc) compare, ctxt);
- gtk_signal_connect (retval, "compare_backup", (GtkSignalFunc) compare_backup, ctxt);
- gtk_signal_connect (retval, "free_transmit", (GtkSignalFunc) free_transmit, ctxt);
- gtk_signal_connect (retval, "delete_all", (GtkSignalFunc) delete_all, ctxt);
- gtk_signal_connect (retval, "transmit", (GtkSignalFunc) transmit, ctxt);
- gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, ctxt);
-
- return GNOME_PILOT_CONDUIT (retval);
-}
-
-void
-conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit)
-{
- GCalConduitCfg *cc;
- GCalConduitContext *ctxt;
-
- cc = GET_GCALCONFIG(conduit);
- ctxt = GET_GCALCONTEXT(conduit);
-
- if(ctxt->calendar!=CORBA_OBJECT_NIL)
- GNOME_Calendar_Repository_done (ctxt->calendar, &(ctxt->ev));
-
- gcalconduit_destroy_configuration(&cc);
-
- gcalconduit_destroy_context(&ctxt);
-
- gtk_object_destroy (GTK_OBJECT (conduit));
-
-}
-
-
diff --git a/calendar/gui/calendar-conduit.h b/calendar/gui/calendar-conduit.h
deleted file mode 100644
index 711609e96a..0000000000
--- a/calendar/gui/calendar-conduit.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* $Id$ */
-
-#ifndef __CALENDAR_CONDUIT_H__
-#define __CALENDAR_CONDUIT_H__
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <pi-datebook.h>
-#include <gnome.h>
-
-#include "GnomeCal.h"
-#include "calobj.h"
-#include "calendar.h"
-#include "timeutil.h"
-
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-standard-abs.h>
-
-/* This is the local record structure for the GnomeCal conduit. */
-typedef struct _GCalLocalRecord GCalLocalRecord;
-struct _GCalLocalRecord {
- /* The stuff from gnome-pilot-conduit-standard-abs.h
- Must be first in the structure, or instances of this
- structure cannot be used by gnome-pilot-conduit-standard-abs.
- */
- LocalRecord local;
- /* The corresponding iCal object, as found by GnomeCal. */
- iCalObject *ical;
- /* pilot-link appointment structure, used for implementing Transmit. */
- struct Appointment *a;
-};
-#define GCAL_LOCALRECORD(s) ((GCalLocalRecord*)(s))
-
-/* This is the configuration of the GnomeCal conduit. */
-typedef struct _GCalConduitCfg GCalConduitCfg;
-struct _GCalConduitCfg {
- gboolean open_secret;
- guint32 pilotId;
- GnomePilotConduitSyncType sync_type; /* only used by capplet */
-};
-#define GET_GCALCONFIG(c) ((GCalConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"gcalconduit_cfg"))
-
-/* This is the context for all the GnomeCal conduit methods. */
-typedef struct _GCalConduitContext GCalConduitContext;
-struct _GCalConduitContext {
- struct AppointmentAppInfo ai;
- GCalConduitCfg *cfg;
- GNOME_Calendar_Repository calendar;
- CORBA_Environment ev;
- CORBA_ORB orb;
-};
-#define GET_GCALCONTEXT(c) ((GCalConduitContext*)gtk_object_get_data(GTK_OBJECT(c),"gcalconduit_context"))
-
-/* Given a GCalConduitCfg*, allocates the structure and
- loads the configuration data for the given pilot. */
-static void
-gcalconduit_load_configuration(GCalConduitCfg **c,
- guint32 pilotId)
-{
- gchar prefix[256];
- g_snprintf(prefix,255,"/gnome-pilot.d/calendard-conduit/Pilot_%u/",pilotId);
-
- *c = g_new0(GCalConduitCfg,1);
- g_assert(*c != NULL);
- gnome_config_push_prefix(prefix);
- (*c)->open_secret = gnome_config_get_bool("open_secret=FALSE");
- (*c)->sync_type = GnomePilotConduitSyncTypeCustom; /* set in capplets main */
- gnome_config_pop_prefix();
-
- (*c)->pilotId = pilotId;
-}
-
-/* Saves the configuration data. */
-static void
-gcalconduit_save_configuration(GCalConduitCfg *c)
-{
- gchar prefix[256];
-
- g_snprintf(prefix,255,"/gnome-pilot.d/calendar-conduit/Pilot_%u/",c->pilotId);
-
- gnome_config_push_prefix(prefix);
- gnome_config_set_bool("open_secret",c->open_secret);
- gnome_config_pop_prefix();
-
- gnome_config_sync();
- gnome_config_drop_all();
-}
-
-/* Creates a duplicate of the configuration data */
-static GCalConduitCfg*
-gcalconduit_dupe_configuration(GCalConduitCfg *c) {
- GCalConduitCfg *retval;
- g_return_val_if_fail(c!=NULL,NULL);
- retval = g_new0(GCalConduitCfg,1);
- retval->sync_type = c->sync_type;
- retval->open_secret = c->open_secret;
- retval->pilotId = c->pilotId;
- return retval;
-}
-
-/* Destroys any data allocated by gcalconduit_load_configuration
- and deallocates the given configuration. */
-static void
-gcalconduit_destroy_configuration(GCalConduitCfg **c)
-{
- g_return_if_fail(c!=NULL);
- g_return_if_fail(*c!=NULL);
- g_free(*c);
- *c = NULL;
-}
-
-/* Given a GCalConduitContxt*, allocates the structure */
-static void
-gcalconduit_new_context(GCalConduitContext **ctxt,
- GCalConduitCfg *c)
-{
- *ctxt = g_new0(GCalConduitContext,1);
- g_assert(ctxt!=NULL);
- (*ctxt)->cfg = c;
- CORBA_exception_init (&((*ctxt)->ev));
-}
-
-/* Destroys any data allocated by gcalconduit_new_context
- and deallocates its data. */
-static void
-gcalconduit_destroy_context(GCalConduitContext **ctxt)
-{
- g_return_if_fail(ctxt!=NULL);
- g_return_if_fail(*ctxt!=NULL);
-/*
- if ((*ctxt)->cfg!=NULL)
- gcalconduit_destroy_configuration(&((*ctxt)->cfg));
-*/
- g_free(*ctxt);
- *ctxt = NULL;
-}
-#endif __CALENDAR_CONDUIT_H__
diff --git a/calendar/gui/calendar-pilot-sync.c b/calendar/gui/calendar-pilot-sync.c
deleted file mode 100644
index a98ff9b49b..0000000000
--- a/calendar/gui/calendar-pilot-sync.c
+++ /dev/null
@@ -1,658 +0,0 @@
-/*
- * calendar-pilot-sync.c:
- *
- * (C) 1999 International GNOME Support
- *
- * Author:
- * Miguel de Icaza (miguel@gnome-support.com)
- *
- */
-#include <config.h>
-#include <gnome.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libgnorba/gnome-factory.h>
-#include <libgnorba/gnorba.h>
-#include "calobj.h"
-#include "calendar.h"
-#include "timeutil.h"
-#include "GnomeCal.h"
-#include "pi-source.h"
-#include "pi-socket.h"
-#include "pi-datebook.h"
-#include "pi-dlp.h"
-
-/* the CORBA ORB */
-CORBA_ORB orb;
-
-/* The default port to communicate with */
-char *pilot_port = "/dev/pilot";
-
-CORBA_Environment ev;
-
-/* Our pi-socket address where we connect to */
-struct pi_sockaddr addr;
-
-/* The Pilot DB identifier for DateBook */
-int db;
-
-/* If true, enable debug output for alarms */
-int debug_alarms = 0;
-
-/* True if you want to dump the flags bits from the records */
-int debug_attrs = 0;
-
-/* Default values for alarms */
-CalendarAlarm alarm_defaults[4] = {
- { ALARM_MAIL, 0, 15, ALARM_MINUTES },
- { ALARM_PROGRAM, 0, 15, ALARM_MINUTES },
- { ALARM_DISPLAY, 0, 15, ALARM_MINUTES },
- { ALARM_AUDIO, 0, 15, ALARM_MINUTES }
-};
-
-int only_desktop_to_pilot = 0;
-
-int only_pilot_to_desktop = 0;
-
-const struct poptOption calendar_sync_options [] = {
- { "pilot", 0, POPT_ARG_STRING, &pilot_port, 0,
- N_("Specifies the port on which the Pilot is"), N_("PORT") },
- { "debug-attrs", 0, POPT_ARG_NONE, &debug_attrs, 0,
- N_("If you want to debug the attributes on records"), NULL },
- { "only-desktop", 0, POPT_ARG_NONE, &only_desktop_to_pilot, 0,
- N_("Only syncs from desktop to pilot"), NULL },
- { "only-pilot", 0, POPT_ARG_INT, &only_pilot_to_desktop, 0,
- N_("Only syncs from pilot to desktop"), NULL },
- { NULL, '\0', 0, NULL, 0 }
-};
-
-static void
-conduit_free_Appointment (struct Appointment *a)
-{
- /* free_Appointment is brain-dead with respect to guarding against
- double-frees */
-
- free_Appointment (a);
- a->exception = 0;
- a->description = 0;
- a->note = 0;
-}
-
-static int
-setup_connection (void)
-{
- int socket;
- int ret, news;
-
- if (!(socket = pi_socket(PI_AF_SLP, PI_SOCK_STREAM, PI_PF_PADP)))
- g_error (_("Can not create Pilot socket\n"));
-
- addr.pi_family = PI_AF_SLP;
- strncpy ((void *) &addr.pi_device, pilot_port, sizeof (addr.pi_device));
-
- ret = pi_bind (socket, (struct sockaddr *)&addr, sizeof (addr));
- if (ret == -1)
- g_error (_("Can not bind to device %s\n"), pilot_port);
-
- if (pi_listen (socket, 1) == -1)
- g_error (_("Failed to get a connection from the Pilot device"));
-
- if ((news = pi_accept (socket, 0, 0)) == -1)
- g_error (_("pi_accept failed"));
-
- return news;
-}
-
-static GNOME_Calendar_Repository
-locate_calendar_server (void)
-{
- GNOME_Calendar_Repository repo;
-
- repo = goad_server_activate_with_id (
- NULL, "IDL:GNOME:Calendar:Repository:1.0",
- 0, NULL);
-
- if (repo == CORBA_OBJECT_NIL)
- g_error ("Can not communicate with GnomeCalendar server");
-
- if (ev._major != CORBA_NO_EXCEPTION){
- printf ("Exception: %s\n", CORBA_exception_id (&ev));
- abort ();
- }
-
- return repo;
-}
-
-static void
-delete_record (GNOME_Calendar_Repository repo, int id)
-{
- char *uid;
-
- uid = GNOME_Calendar_Repository_get_id_from_pilot_id (repo, id, &ev);
-
- /* The record was already deleted */
- if (ev._major != CORBA_NO_EXCEPTION)
- return;
-
- GNOME_Calendar_Repository_delete_object (repo, uid, &ev);
- CORBA_free (uid);
-}
-
-static void
-update_record (GNOME_Calendar_Repository repo, int id, struct Appointment *a, int attr)
-{
- char *vcal_string;
- iCalObject *obj;
- int i;
- char *str;
-
- obj = ical_new (a->note ? a->note : "",
- g_get_user_name (),
- a->description ? a->description : "");
-
- printf ("requesting %d [%s]\n", id, a->description);
- vcal_string = GNOME_Calendar_Repository_get_object_by_pilot_id (repo, id, &ev);
-
- if (ev._major == CORBA_USER_EXCEPTION){
- time_t now = time (NULL);
-
- obj->created = now;
- obj->last_mod = now;
- obj->priority = 0;
- obj->transp = 0;
- obj->related = NULL;
- obj->pilot_id = id;
- obj->pilot_status = ICAL_PILOT_SYNC_NONE;
- printf (_("\tObject did not exist, creating a new one\n"));
- } else {
- printf ("\tFound\n");
- obj = ical_object_new_from_string (vcal_string);
- }
-
- if (obj->pilot_status == ICAL_PILOT_SYNC_MOD){
- printf (_("\tObject has been modified on desktop and on the pilot, desktop takes precedence\n"));
- ical_object_destroy (obj);
- return;
- }
-
- /*
- * Begin and end
- */
-
- if (a->event)
- {
- /* turn day-long events into a full day's appointment */
- a->begin.tm_sec = 0;
- a->begin.tm_min = 0;
- a->begin.tm_hour = 6;
-
- a->end.tm_sec = 0;
- a->end.tm_min = 0;
- a->end.tm_hour = 10;
- }
-
- obj->dtstart = mktime (&a->begin);
- obj->dtend = mktime (&a->end);
-
- /* Special case: daily repetitions are converted to a multi-day event */
- if (a->repeatType == repeatDaily){
- time_t newt = time_add_day (obj->dtend, a->repeatFrequency);
-
- obj->dtend = newt;
- }
-
- /*
- * Alarm
- */
- if (a->alarm){
- obj->aalarm.type = ALARM_AUDIO;
- obj->aalarm.enabled = 1;
- obj->aalarm.count = a->advance;
-
- switch (a->advanceUnits){
- case advMinutes:
- obj->aalarm.units = ALARM_MINUTES;
- break;
-
- case advHours:
- obj->aalarm.units = ALARM_HOURS;
- break;
-
- case advDays:
- obj->aalarm.units = ALARM_DAYS;
- break;
- default:
- }
- }
-
- /*
- * Recurrence
- */
- if (a->repeatFrequency && a->repeatType != repeatDaily){
- obj->recur = g_new0 (Recurrence, 1);
-
- switch (a->repeatType){
- case repeatDaily:
- /*
- * In the Pilot daily repetitions are actually
- * multi-day events
- */
- g_warning ("Should not have got here");
- break;
-
- case repeatMonthlyByDate:
- obj->recur->type = RECUR_MONTHLY_BY_DAY;
- obj->recur->u.month_day = a->repeatFrequency;
- break;
-
- case repeatWeekly:
- {
- int wd;
-
- obj->recur->type = RECUR_WEEKLY;
- for (wd = 0; wd < 7; wd++)
- if (a->repeatDays [wd])
- obj->recur->weekday |= 1 << wd;
-
- if (obj->recur->weekday == 0){
- struct tm tm = *localtime (&obj->dtstart);
-
- obj->recur->weekday = 1 << tm.tm_wday;
- }
- break;
- }
-
- case repeatMonthlyByDay:
- obj->recur->type = RECUR_MONTHLY_BY_POS;
- obj->recur->u.month_pos = a->repeatFrequency;
- obj->recur->weekday = (a->repeatDay / 7);
- break;
-
- case repeatYearly:
- obj->recur->type = RECUR_YEARLY_BY_DAY;
- break;
-
- default:
- g_warning ("Unhandled repeate case");
- }
-
- if (a->repeatForever)
- obj->recur->duration = 0;
- else
- obj->recur->_enddate = mktime (&a->repeatEnd);
- }
-
- /*
- * Load exception dates
- */
- obj->exdate = NULL;
- for (i = 0; i < a->exceptions; i++){
- time_t *t = g_new (time_t, 1);
-
- *t = mktime (&(a->exception [i]));
- obj->exdate = g_list_prepend (obj->exdate, t);
- }
-
- g_free (obj->class);
-
- if (attr & dlpRecAttrSecret)
- obj->class = g_strdup ("PRIVATE");
- else
- obj->class = g_strdup ("PUBLIC");
-
- /*
- * Now, convert the in memory iCalObject to a full vCalendar we can send
- */
- str = calendar_string_from_object (obj);
-
- GNOME_Calendar_Repository_update_object (repo, obj->uid, str, &ev);
-
- free (str);
-
- /*
- * Shutdown
- */
- ical_object_destroy (obj);
-}
-
-/*
- * Sets the alarm for Appointment based on @alarm
- */
-static int
-try_alarm (CalendarAlarm *alarm, struct Appointment *a)
-{
- if (!alarm->enabled)
- return 0;
-
- a->advance = alarm->count;
- switch (alarm->type){
- case ALARM_DAYS:
- a->advanceUnits = advDays;
- break;
-
- case ALARM_HOURS:
- a->advanceUnits = advHours;
- break;
-
- case ALARM_MINUTES:
- a->advanceUnits = advMinutes;
- break;
-
- default:
- return 0;
- }
- a->alarm = 1;
- return 1;
-}
-
-static void
-sync_object_to_pilot (GNOME_Calendar_Repository repo, iCalObject *obj, int pilot_fd)
-{
- char buffer [65536];
- struct Appointment *a;
- int wd, i, idx, attr, cat, rec_len;
- recordid_t new_id;
- GList *l;
-
- a = g_new0 (struct Appointment, 1);
-
- attr = 0;
- cat = 0;
- idx = 0;
-
- if (obj->pilot_id){
- rec_len = dlp_ReadRecordById (pilot_fd, db, obj->pilot_id,
- buffer, &idx, &rec_len, &attr, &cat);
-
- if (rec_len > 0)
- unpack_Appointment (a, buffer, rec_len);
- } else {
- attr = 0;
- cat = 0;
- }
-
- /* a contains the appointment either cleared or with the data from the Pilot */
- a->begin = *localtime (&obj->dtstart);
- a->end = *localtime (&obj->dtend);
-
- /* FIXME: add support for timeless */
- a->event = 0;
-
- /* Alarms, try the various ones. Probably we should only do Audio?
- * Otherwise going gnomecal->pilot->gnomecal would get the gnomecal
- * with *possibly* an alarm that was not originally defined.
- */
- a->alarm = 0;
- if (try_alarm (&obj->aalarm, a) == 0)
- if (try_alarm (&obj->dalarm, a) == 0)
- try_alarm (&obj->palarm, a);
-
- /* Recurrence */
- if (obj->recur){
- a->repeatFrequency = obj->recur->interval;
-
- switch (obj->recur->type){
- case RECUR_MONTHLY_BY_POS:
- a->repeatType = repeatMonthlyByDay;
- a->repeatFrequency = obj->recur->u.month_pos;
- a->repeatDay = obj->recur->weekday * 7;
- break;
-
- case RECUR_MONTHLY_BY_DAY:
- a->repeatType = repeatMonthlyByDate;
- a->repeatFrequency = obj->recur->u.month_day;
- break;
-
- case RECUR_YEARLY_BY_DAY:
- a->repeatType = repeatYearly;
- break;
-
- case RECUR_WEEKLY:
- for (wd = 0; wd < 7; wd++)
- if (obj->recur->weekday & (1 << wd))
- a->repeatDays [wd] = 1;
- a->repeatType = repeatWeekly;
- break;
- case RECUR_DAILY:
-
- default:
- a->repeatType = repeatNone;
- break;
- }
- if (obj->recur->enddate == 0){
- a->repeatForever = 1;
- } else
- a->repeatEnd = *localtime (&obj->recur->enddate);
- }
-
- /*
- * Pilot uses a repeat-daily for a multi-day event, adjust for that case
- */
- if ((a->end.tm_mday != a->begin.tm_mday) ||
- (a->end.tm_mon != a->begin.tm_mon) ||
- (a->end.tm_year != a->begin.tm_year)){
- a->event = 1;
- a->begin.tm_sec = 0;
- a->begin.tm_min = 0;
- a->begin.tm_hour = 0;
-
- a->end.tm_sec = 0;
- a->end.tm_min = 0;
- a->end.tm_hour = 0;
-
- a->repeatEnd = a->end;
- a->repeatForever = 0;
- a->repeatFrequency = 1;
- a->repeatType = repeatDaily;
- }
-
- /*
- * Exceptions
- */
- a->exceptions = g_list_length (obj->exdate);
- a->exception = (struct tm *) malloc (sizeof (struct tm) * a->exceptions);
- for (i = 0, l = obj->exdate; l; l = l->next, i++){
- time_t *exdate = l->data;
-
- a->exception [i] = *localtime (exdate);
- }
-
- /*
- * Description and note.
- *
- * We use strdup to be correct. free_Appointment assumes we used
- * malloc.
- */
- if (obj->comment)
- a->note = strdup (obj->comment);
- else
- a->note = 0;
-
- if (obj->summary)
- a->description = strdup (obj->summary);
- else
- a->description = strdup (_("No description"));
-
- if (strcmp (obj->class, "PUBLIC") != 0)
- attr |= dlpRecAttrSecret;
- else
- attr &= ~dlpRecAttrSecret;
-
- /*
- * Send the appointment to the pilot
- */
- rec_len = pack_Appointment (a, buffer, sizeof (buffer));
- attr &= ~dlpRecAttrDirty;
-
- dlp_WriteRecord (
- pilot_fd, db, 0,
- obj->pilot_id, 0, buffer, rec_len, &new_id);
-
- GNOME_Calendar_Repository_update_pilot_id (repo, obj->uid, new_id, ICAL_PILOT_SYNC_NONE, &ev);
-
- conduit_free_Appointment (a);
- g_free (a);
-}
-
-static void
-sync_cal_to_pilot (GNOME_Calendar_Repository repo, Calendar *cal, int pilot_fd)
-{
- GList *l;
- int c = g_list_length (cal->events);
- int i;
-
- printf ("\n");
- for (i = 0, l = cal->events; l; l = l->next, i++){
- iCalObject *obj = l->data;
-
- printf ("Syncing desktop to pilot: %d/%d\r", i + 1, c);
- fflush (stdout);
- if (obj->pilot_status != ICAL_PILOT_SYNC_MOD){
- g_warning ("Strange, we were supposed to get only a dirty object");
- continue;
- }
-
- sync_object_to_pilot (repo, obj, pilot_fd);
- }
- printf ("\n");
-}
-
-static void
-dump_attr (int flags)
-{
- if (flags & dlpRecAttrDeleted)
- fprintf(stderr, " Deleted");
- if (flags & dlpRecAttrDirty)
- fprintf(stderr, " Dirty");
- if (flags & dlpRecAttrBusy)
- fprintf(stderr, " Busy");
- if (flags & dlpRecAttrSecret)
- fprintf(stderr, " Secret");
- if (flags & dlpRecAttrArchived)
- fprintf(stderr, " Archive");
- fprintf (stderr, "\n");
-}
-
-static void
-sync_pilot (GNOME_Calendar_Repository repo, int pilot_fd)
-{
- struct PilotUser user_info;
- int record;
- unsigned char buffer [65536];
- Calendar *dirty_cal;
- char *vcalendar_string;
- char *error;
-
- printf (_("Syncing with the pilot..."));
- dlp_ReadUserInfo (pilot_fd, &user_info);
-
- /* This informs the user of the progress on the Pilot */
- dlp_OpenConduit (pilot_fd);
-
- if (dlp_OpenDB (pilot_fd, 0, 0x80 | 0x40, "DatebookDB", &db) < 0){
- g_warning (_("Could not open DatebookDB on the Pilot"));
- dlp_AddSyncLogEntry (pilot_fd, _("Unable to open DatebookDB"));
- pi_close (pilot_fd);
- exit (1);
- }
-
- /*
- * 1. Pull all the records from the Pilot, and make any updates
- * required on the desktop side
- */
- if (!only_desktop_to_pilot){
- for (record = 0;; record++){
- struct Appointment a;
- int rec_len, attr, size;
- recordid_t id;
-
- rec_len = dlp_ReadRecordByIndex (
- pilot_fd, db,
- record, buffer, &id, &size, &attr, 0);
-
- if (rec_len < 0)
- break;
-
- printf ("processing record %d\n", record);
- unpack_Appointment (&a, buffer, rec_len);
-
- if (debug_attrs)
- dump_attr (attr);
-
- /* If the object was deleted, remove it from the database */
- if (attr & dlpRecAttrDeleted){
- printf ("Deleting id %ld\n", id);
- delete_record (repo, id);
- conduit_free_Appointment (&a);
- dlp_DeleteRecord (pilot_fd, db, 0, id);
- continue;
- }
-
- if (attr & dlpRecAttrArchived)
- continue;
-
- printf ("updating record\n");
- update_record (repo, id, &a, attr);
-
- conduit_free_Appointment (&a);
- }
- }
-
- /*
- * 2. Pull all the records from the Calendar, and move any new items
- * to the pilot
- */
- if (!only_pilot_to_desktop){
- vcalendar_string = GNOME_Calendar_Repository_get_updated_objects (repo, &ev);
- dirty_cal = calendar_new ("Temporal");
- error = calendar_load_from_memory (dirty_cal, vcalendar_string);
- if (!error)
- sync_cal_to_pilot (repo, dirty_cal, pilot_fd);
- calendar_destroy (dirty_cal);
- }
-
-
- dlp_CloseDB (pilot_fd, db);
- dlp_AddSyncLogEntry (pilot_fd, _("Synced DateBook from Pilot to GnomeCal"));
- pi_close (pilot_fd);
-}
-
-int
-main (int argc, char *argv [])
-{
- int link;
- GNOME_Calendar_Repository repository;
-
- CORBA_exception_init (&ev);
- orb = gnome_CORBA_init_with_popt_table (
- "calendar-pilot-sync", VERSION, &argc, argv,
- calendar_sync_options, 0, NULL, 0, &ev);
-
- printf ("Please, press HotSync button on the palm...");
- fflush (stdout);
- link = setup_connection ();
- printf ("Connected\n");
-
- printf ("Launching GnomeCal...");
- fflush (stdout);
- repository = locate_calendar_server ();
- printf ("Done\n");
-
- printf ("<Syncing>\n");
- sync_pilot (repository, link);
- printf ("</Syncing>\n");
-
- GNOME_Calendar_Repository_done (repository, &ev);
-
- CORBA_exception_free (&ev);
-
- return 0;
-}
-
-/* Just a stub to link with */
-void
-calendar_notify (time_t time, CalendarAlarm *which, void *data)
-{
-}
-
diff --git a/calendar/gui/calendar.c b/calendar/gui/calendar.c
deleted file mode 100644
index 0fbecaf6f6..0000000000
--- a/calendar/gui/calendar.c
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * Calendar manager object
- *
- * This keeps track of a given calendar. Eventually this will abtract everything
- * related to getting calendars/saving calendars locally or to a remote Calendar Service
- *
- * Copyright (C) 1998, 1999 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (quartic@gimp.org)
- *
- */
-
-#include <gnome.h>
-#include <stdio.h>
-#include <config.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include "calendar.h"
-#include "alarm.h"
-#include "timeutil.h"
-#include "../libversit/vcc.h"
-
-#ifdef HAVE_TZNAME
-extern char *tzname[2];
-#endif
-
-/* Our day range */
-time_t calendar_day_begin, calendar_day_end;
-
-static void calendar_init_alarms (Calendar *cal);
-static void calendar_set_day (void);
-
-Calendar *
-calendar_new (char *title)
-{
- Calendar *cal;
-
- cal = g_new0 (Calendar, 1);
-
- cal->title = g_strdup (title);
-
- if ((calendar_day_begin == 0) || (calendar_day_end == 0))
- calendar_set_day ();
-
- cal->event_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- calendar_init_alarms (cal);
-
- return cal;
-}
-
-static void
-try_add (iCalObject *ico, CalendarAlarm *alarm, time_t start, time_t end)
-{
- alarm->trigger = start-alarm->offset;
-
- if (alarm->trigger < calendar_day_begin)
- return;
- if (alarm->trigger > calendar_day_end)
- return;
- alarm_add (alarm, &calendar_notify, ico);
-}
-
-static int
-add_object_alarms (iCalObject *obj, time_t start, time_t end, void *closure)
-{
- if (obj->aalarm.enabled)
- try_add (obj, &obj->aalarm, start, end);
- if (obj->dalarm.enabled)
- try_add (obj, &obj->dalarm, start, end);
- if (obj->palarm.enabled)
- try_add (obj,&obj->palarm, start, end);
- if (obj->malarm.enabled)
- try_add (obj, &obj->malarm, start, end);
-
- return TRUE;
-}
-
-#define max(a,b) ((a > b) ? a : b)
-
-static void
-ical_object_try_alarms (iCalObject *obj)
-{
- int ao, po, od, mo;
- int max_o;
-
- ao = alarm_compute_offset (&obj->aalarm);
- po = alarm_compute_offset (&obj->palarm);
- od = alarm_compute_offset (&obj->dalarm);
- mo = alarm_compute_offset (&obj->malarm);
-
- max_o = max (ao, max (po, max (od, mo)));
- if (max_o == -1)
- return;
-
- ical_object_generate_events (obj, calendar_day_begin, calendar_day_end + max_o, add_object_alarms, obj);
-}
-
-void
-calendar_add_object (Calendar *cal, iCalObject *obj)
-{
- g_return_if_fail (cal != NULL);
- g_return_if_fail (obj != NULL);
- g_return_if_fail (obj->uid != NULL);
-
- obj->new = 0;
- switch (obj->type){
- case ICAL_EVENT:
- g_hash_table_insert (cal->event_hash, obj->uid, obj);
- cal->events = g_list_prepend (cal->events, obj);
- ical_object_try_alarms (obj);
-#ifdef DEBUGGING_MAIL_ALARM
- obj->malarm.trigger = 0;
- calendar_notify (0, obj);
-#endif
- break;
-
- case ICAL_TODO:
- cal->todo = g_list_prepend (cal->todo, obj);
- break;
-
- case ICAL_JOURNAL:
- cal->journal = g_list_prepend (cal->journal, obj);
- break;
- default:
- g_assert_not_reached ();
- }
-
- if (!obj->uid){
- char buffer [80];
-
- snprintf (buffer, sizeof (buffer), "GnomeCalendar-%ld\n", time (NULL));
- obj->uid = g_strdup (buffer);
- }
-
- cal->modified = TRUE;
-
- obj->last_mod = time (NULL);
-}
-
-void
-calendar_remove_object (Calendar *cal, iCalObject *obj)
-{
- switch (obj->type){
- case ICAL_EVENT:
- cal->events = g_list_remove (cal->events, obj);
- g_hash_table_remove (cal->event_hash, obj->uid);
- break;
-
- case ICAL_TODO:
- cal->todo = g_list_remove (cal->todo, obj);
- break;
-
- case ICAL_JOURNAL:
- cal->journal = g_list_remove (cal->journal, obj);
- break;
- default:
- g_assert_not_reached ();
- }
-
- cal->modified = TRUE;
-}
-
-void
-calendar_destroy (Calendar *cal)
-{
- g_list_foreach (cal->events, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->events);
-
- g_list_foreach (cal->todo, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->todo);
-
- g_list_foreach (cal->journal, (GFunc) ical_object_destroy, NULL);
- g_list_free (cal->journal);
-
- g_hash_table_destroy (cal->event_hash);
-
- if (cal->title)
- g_free (cal->title);
- if (cal->filename)
- g_free (cal->filename);
-
- g_free (cal);
-}
-
-void
-calendar_iterate_on_objects (GList *objects, time_t start, time_t end, calendarfn cb, void *closure)
-{
- for (; objects; objects = objects->next){
- iCalObject *object = objects->data;
-
- ical_object_generate_events (object, start, end, cb, closure);
- }
-}
-
-void
-calendar_iterate (Calendar *cal, time_t start, time_t end, calendarfn cb, void *closure)
-{
- calendar_iterate_on_objects (cal->events, start, end, cb, closure);
-}
-
-GList *
-calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func)
-{
- GList *new_events = 0;
-
- for (; objects; objects = objects->next){
- iCalObject *object = objects->data;
-
- if ((start <= object->dtstart) && (object->dtend <= end)){
- if (sort_func)
- new_events = g_list_insert_sorted (new_events, object, sort_func);
- else
- new_events = g_list_prepend (new_events, object);
- }
- }
-
- /* Put the list in increasing order if no sort function was specified */
-
- if (!sort_func)
- new_events = g_list_reverse (new_events);
-
- return new_events;
-}
-
-GList *
-calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- return calendar_get_objects_in_range (cal->todo, start, end, sort_func);
-}
-
-GList *
-calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func)
-{
- return calendar_get_objects_in_range (cal->journal, start, end, sort_func);
-}
-
-gint
-calendar_compare_by_dtstart (gpointer a, gpointer b)
-{
- iCalObject *obj1, *obj2;
- time_t diff;
-
- obj1 = a;
- obj2 = b;
-
- diff = obj1->dtstart - obj2->dtstart;
-
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-#define str_val(obj) (char *) vObjectUStringZValue (obj)
-
-/* Loads our calendar contents from a vObject */
-void
-calendar_load_from_vobject (Calendar *cal, VObject *vcal)
-{
- VObjectIterator i;
-
- initPropIterator (&i, vcal);
-
- while (moreIteration (&i)){
- VObject *this = nextVObject (&i);
- iCalObject *ical;
- const char *object_name = vObjectName (this);
-
- if (strcmp (object_name, VCDCreatedProp) == 0){
- cal->created = time_from_isodate (str_val (this));
- continue;
- }
-
- if (strcmp (object_name, VCLocationProp) == 0)
- continue; /* FIXME: imlement */
-
- if (strcmp (object_name, VCProdIdProp) == 0)
- continue; /* FIXME: implement */
-
- if (strcmp (object_name, VCVersionProp) == 0)
- continue; /* FIXME: implement */
-
- if (strcmp (object_name, VCTimeZoneProp) == 0)
- continue; /* FIXME: implement */
-
- ical = ical_object_create_from_vobject (this, object_name);
-
- if (ical)
- calendar_add_object (cal, ical);
- }
-}
-
-static void
-calendar_set_day (void)
-{
- time_t calendar_today;
-
- calendar_today = time (NULL);
- calendar_day_begin = time_day_begin (calendar_today);
- calendar_day_end = time_day_end (calendar_today);
-}
-
-/* Loads a calendar from a file */
-char *
-calendar_load (Calendar *cal, char *fname)
-{
- VObject *vcal;
- struct stat s;
-
- if (cal->filename){
- g_warning ("Calendar load called again\n");
- return "Internal error";
- }
-
- cal->filename = g_strdup (fname);
- vcal = Parse_MIME_FromFileName (fname);
- if (!vcal)
- return "Could not load the calendar";
-
- stat (fname, &s);
- cal->file_time = s.st_mtime;
-
- calendar_set_day ();
-
- calendar_load_from_vobject (cal, vcal);
- cleanVObject (vcal);
- cleanStrTbl ();
- return NULL;
-}
-
-/*
- * calendar_load_from_memory:
- * @cal: calendar on which we load the information
- * @buffer: A buffer that contains a vCalendar file
- *
- * Loads the information from the vCalendar information in @buffer
- * into the Calendar
- */
-char *
-calendar_load_from_memory (Calendar *cal, const char *buffer)
-{
- VObject *vcal;
-
- g_return_val_if_fail (buffer != NULL, NULL);
-
- cal->filename = g_strdup ("memory-based-calendar");
- vcal = Parse_MIME (buffer, strlen (buffer));
- if (!vcal)
- return "Could not load the calendar";
-
- cal->file_time = time (NULL);
- calendar_load_from_vobject (cal, vcal);
- cleanVObject (vcal);
- cleanStrTbl ();
-
- return NULL;
-}
-
-static VObject *
-vcalendar_create_from_calendar (Calendar *cal)
-{
- VObject *vcal;
- GList *l;
- time_t now = time (NULL);
- struct tm tm;
-
- /* WE call localtime for the side effect of setting tzname */
- tm = *localtime (&now);
-
- vcal = newVObject (VCCalProp);
- addPropValue (vcal, VCProdIdProp, "-//GNOME//NONSGML GnomeCalendar//EN");
-#if defined(HAVE_TM_ZONE)
- addPropValue (vcal, VCTimeZoneProp, tm.tm_zone);
-#elif defined(HAVE_TZNAME)
- addPropValue (vcal, VCTimeZoneProp, tzname[0]);
-#endif
- addPropValue (vcal, VCVersionProp, VERSION);
- cal->temp = vcal;
-
- /* Events */
-
- for (l = cal->events; l; l = l->next) {
- VObject *obj;
-
- obj = ical_object_to_vobject ((iCalObject *) l->data);
- addVObjectProp (vcal, obj);
- }
-
- /* To-do entries */
-
- for (l = cal->todo; l; l = l->next) {
- VObject *obj;
-
- obj = ical_object_to_vobject ((iCalObject *) l->data);
- addVObjectProp (vcal, obj);
- }
-
- return vcal;
-}
-
-void
-calendar_save (Calendar *cal, char *fname)
-{
- VObject *vcal;
- FILE *fp;
- GtkWidget *dlg;
- struct stat s;
- int status;
-
- if (fname == NULL)
- fname = cal->filename;
-
- vcal = vcalendar_create_from_calendar (cal);
- if (g_file_exists (fname)){
- char *backup_name = g_strconcat (fname, "~", NULL);
-
- if (g_file_exists (backup_name)){
- unlink (backup_name);
- }
- rename (fname, backup_name);
- g_free (backup_name);
- }
-
- fp = fopen(fname,"w");
- if (fp) {
- writeVObject(fp, vcal);
- fclose(fp);
- if (strcmp(cal->filename, fname)) {
- if (cal->filename)
- g_free (cal->filename);
- cal->filename = g_strdup (fname);
- }
- status = stat (fname, &s);
- cal->file_time = s.st_mtime;
- } else {
- dlg = gnome_message_box_new(_("Failed to save calendar!"),
- GNOME_MESSAGE_BOX_ERROR, "Ok", NULL);
- gtk_widget_show(dlg);
- }
-
- cleanVObject (vcal);
- cleanStrTbl ();
-}
-
-char *
-calendar_get_as_vcal_string (Calendar *cal)
-{
- VObject *vcal;
- char *result;
-
- g_return_val_if_fail (cal != NULL, NULL);
-
- vcal = vcalendar_create_from_calendar (cal);
- result = writeMemVObject (NULL, 0, vcal);
-
- cleanVObject (vcal);
- cleanStrTbl ();
-
- return result;
-}
-
-static gint
-calendar_object_compare_by_start (gconstpointer a, gconstpointer b)
-{
- const CalendarObject *ca = a;
- const CalendarObject *cb = b;
- time_t diff;
-
- diff = ca->ev_start - cb->ev_start;
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-static int
-assemble_event_list (iCalObject *obj, time_t start, time_t end, void *c)
-{
- CalendarObject *co;
- GList **l = c;
-
- co = g_new (CalendarObject, 1);
-
- co->ev_start = start;
- co->ev_end = end;
- co->ico = obj;
- *l = g_list_insert_sorted (*l, co, calendar_object_compare_by_start);
-
- return 1;
-}
-
-void
-calendar_destroy_event_list (GList *l)
-{
- GList *p;
-
- for (p = l; p; p = p->next)
- g_free (p->data);
- g_list_free (l);
-}
-
-GList *
-calendar_get_events_in_range (Calendar *cal, time_t start, time_t end)
-{
- GList *l = 0;
-
- calendar_iterate (cal, start, end, assemble_event_list, &l);
- return l;
-}
-
-void
-calendar_object_changed (Calendar *cal, iCalObject *obj, int flags)
-{
- obj->last_mod = time (NULL);
- obj->pilot_status = ICAL_PILOT_SYNC_MOD;
-
- if (!(flags & CHANGE_DATES))
- return;
-
- /* Remove any alarms on the alarm list for this object */
- while (alarm_kill (obj))
- ;
-
- ical_object_try_alarms (obj);
-}
-
-static void
-calendar_day_change (time_t time, CalendarAlarm *which, void *closure)
-{
- GList *events;
- Calendar *cal = closure;
-
- calendar_set_day ();
- calendar_init_alarms (cal);
-
- for (events = cal->events; events; events = events->next){
- iCalObject *obj = events->data;
-
- ical_object_try_alarms (obj);
- }
-}
-
-static void
-calendar_init_alarms (Calendar *cal)
-{
- CalendarAlarm day_change_alarm;
-
- day_change_alarm.trigger = calendar_day_end;
- alarm_add (&day_change_alarm, calendar_day_change, cal);
-}
-
-static iCalObject *
-calendar_object_find_in_list (Calendar *cal, GList *list, const char *uid)
-{
- GList *l;
-
- for (l = list; l; l = l->next){
- iCalObject *obj = l->data;
-
- if (strcmp (obj->uid, uid) == 0)
- return obj;
- }
-
- return NULL;
-}
-
-iCalObject *
-calendar_object_find_event (Calendar *cal, const char *uid)
-{
- g_return_val_if_fail (cal != NULL, NULL);
- g_return_val_if_fail (uid != NULL, NULL);
-
- return g_hash_table_lookup (cal->event_hash, uid);
-}
-
-iCalObject *
-calendar_object_find_todo (Calendar *cal, const char *uid)
-{
- g_return_val_if_fail (cal != NULL, NULL);
- g_return_val_if_fail (uid != NULL, NULL);
-
- return calendar_object_find_in_list (cal, cal->todo, uid);
-}
-
-iCalObject *
-calendar_object_find (Calendar *cal, const char *uid)
-{
- iCalObject *obj;
-
- g_return_val_if_fail (cal != NULL, NULL);
- g_return_val_if_fail (uid != NULL, NULL);
-
- obj = calendar_object_find_in_list (cal, cal->todo, uid);
-
- if (obj == NULL)
- obj = calendar_object_find_in_list (cal, cal->events, uid);
-
- return obj;
-}
-
-iCalObject *
-calendar_object_find_by_pilot (Calendar *cal, int pilot_id)
-{
- GList *l;
-
- g_return_val_if_fail (cal != NULL, NULL);
-
- for (l = cal->events; l; l = l->next){
- iCalObject *obj = l->data;
-
- if (obj->pilot_id == pilot_id)
- return obj;
- }
-
- for (l = cal->todo; l; l = l->next){
- iCalObject *obj = l->data;
-
- if (obj->pilot_id == pilot_id)
- return obj;
- }
-
- return NULL;
-}
-
-/*
- * calendar_string_from_object:
- *
- * Returns the iCalObject @object armored around a vCalendar
- * object as a string.
- */
-char *
-calendar_string_from_object (iCalObject *object)
-{
- Calendar *cal;
- char *str;
-
- g_return_val_if_fail (object != NULL, NULL);
-
- cal = calendar_new ("Temporal");
- calendar_add_object (cal, object);
- str = calendar_get_as_vcal_string (cal);
- calendar_remove_object (cal, object);
-
- calendar_destroy (cal);
-
- return str;
-}
diff --git a/calendar/gui/calendar.h b/calendar/gui/calendar.h
deleted file mode 100644
index 4a9d4bcff2..0000000000
--- a/calendar/gui/calendar.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef CALENDAR_H
-#define CALENDAR_H
-
-#include "calobj.h"
-
-BEGIN_GNOME_DECLS
-
-typedef struct {
- /* This calendar's title */
- char *title;
-
- /* backing store for this calendar object */
- char *filename;
-
- /* The list of events; todo's and journal entries */
- GList *events;
- GList *todo;
- GList *journal;
-
- GHashTable *event_hash;
-
- /* Time at which the calendar was created */
- time_t created;
-
- /* Timestamp in the filename */
- time_t file_time;
-
- /* If the calendar was last modified */
- int modified;
- void *temp;
-
- void *corba_server;
-} Calendar;
-
-/* This is only used by the calendar_get_events_in_range routine to get
- * a list of objects that recur on a specific date
- */
-typedef struct {
- time_t ev_start;
- time_t ev_end;
- iCalObject *ico;
-} CalendarObject;
-
-Calendar *calendar_new (char *title);
-char *calendar_get_as_vcal_string (Calendar *cal);
-char *calendar_string_from_object (iCalObject *object);
-
-char *calendar_load (Calendar *cal, char *fname);
-char *calendar_load_from_memory (Calendar *cal, const char *buffer);
-void calendar_load_from_vobject (Calendar *cal, VObject *vcal);
-void calendar_save (Calendar *cal, char *fname);
-void calendar_add_object (Calendar *cal, iCalObject *obj);
-void calendar_remove_object (Calendar *cal, iCalObject *obj);
-void calendar_destroy (Calendar *cal);
-GList *calendar_get_objects_in_range (GList *objects, time_t start, time_t end, GCompareFunc sort_func);
-GList *calendar_get_todo_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
-GList *calendar_get_journal_in_range (Calendar *cal, time_t start, time_t end, GCompareFunc sort_func);
-gint calendar_compare_by_dtstart (gpointer a, gpointer b);
-
-void calendar_iterate_on_objects (GList *objects, time_t start, time_t end, calendarfn cb, void *closure);
-void calendar_iterate (Calendar *cal, time_t start, time_t end, calendarfn cb, void *closure);
-
-/* Returns a list of CalendarObject structures. These represent the events in the calendar that are
- * in the specified range.
- */
-GList *calendar_get_events_in_range (Calendar *cal, time_t start, time_t end);
-
-/* Destroy list returned by calendar_get_events_in_range() with this function */
-void calendar_destroy_event_list (GList *l);
-
-/* Informs the calendar that obj information has changed */
-void calendar_object_changed (Calendar *cal, iCalObject *obj, int flags);
-
-void calendar_notify (time_t time, CalendarAlarm *which, void *data);
-
-iCalObject *calendar_object_find_event (Calendar *cal, const char *uid);
-iCalObject *calendar_object_find_todo (Calendar *cal, const char *uid);
-iCalObject *calendar_object_find (Calendar *cal, const char *uid);
-iCalObject *calendar_object_find_by_pilot (Calendar *cal, int pilot_id);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/corba-cal-factory.c b/calendar/gui/corba-cal-factory.c
deleted file mode 100644
index c10929376b..0000000000
--- a/calendar/gui/corba-cal-factory.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * corba-cal-factory.c: Service that provides access to the calendar repositories.
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include "gnome-cal.h"
-#include "main.h"
-#include "alarm.h"
-#include "timeutil.h"
-#include "../libversit/vcc.h"
-#include <libgnorba/gnome-factory.h>
-#include <libgnorba/gnorba.h>
-#include "GnomeCal.h"
-#include "corba-cal-factory.h"
-#include "corba-cal.h"
-
-CORBA_ORB orb;
-PortableServer_POA poa;
-PortableServer_POAManager poa_manager;
-
-static POA_GNOME_GenericFactory__epv calendar_epv;
-static POA_GNOME_GenericFactory__vepv calendar_vepv;
-
-/*
- * Servant and Object Factory
- */
-static POA_GNOME_GenericFactory calendar_servant;
-static GNOME_GenericFactory calendar_factory;
-
-static CORBA_boolean
-calendar_supports (PortableServer_Servant servant,
- CORBA_char * obj_goad_id,
- CORBA_Environment * ev)
-{
- if (strcmp (obj_goad_id, "IDL:GNOME:Calendar:Repository:1.0") == 0)
- return CORBA_TRUE;
- else
- return CORBA_FALSE;
-}
-
-static CORBA_Object
-calendar_create_object (PortableServer_Servant servant,
- CORBA_char *goad_id,
- const GNOME_stringlist *params,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal;
- struct stat s;
- char *name;
-
- if (params->_length == 1)
- name = params->_buffer [0];
- else
- name = NULL;
-
- if (strcmp (goad_id, "IDL:GNOME:Calendar:Repository:1.0") != 0){
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_GenericFactory_CannotActivate,
- NULL);
- return CORBA_OBJECT_NIL;
- }
-
- gcal = gnome_calendar_locate (name);
- if (gcal != NULL)
- return CORBA_Object_duplicate (gcal->cal->corba_server, ev);
-
- if (stat (name, &s) != 0){
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_GenericFactory_CannotActivate,
- NULL);
- return CORBA_OBJECT_NIL;
- }
-
- gcal = new_calendar ("", name, NULL, NULL, FALSE);
-
- return CORBA_Object_duplicate (gcal->cal->corba_server, ev);
-}
-
-void
-init_corba_server (void)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- poa_manager = PortableServer_POA__get_the_POAManager (poa, &ev);
- if (ev._major != CORBA_NO_EXCEPTION){
- g_warning ("Can not get the POA manager");
- CORBA_exception_free (&ev);
- return;
- }
-
- PortableServer_POAManager_activate (poa_manager, &ev);
-
- /* First create the locator for the repositories as a factory object */
- calendar_vepv.GNOME_GenericFactory_epv = &calendar_epv;
- calendar_epv.supports = calendar_supports;
- calendar_epv.create_object = calendar_create_object;
-
- calendar_servant.vepv = &calendar_vepv;
- POA_GNOME_GenericFactory__init ((PortableServer_Servant) &calendar_servant, &ev);
- CORBA_free (PortableServer_POA_activate_object (
- poa, (PortableServer_Servant)&calendar_servant, &ev));
-
- calendar_factory = PortableServer_POA_servant_to_reference (
- poa, (PortableServer_Servant) &calendar_servant, &ev);
-
- goad_server_register (
- CORBA_OBJECT_NIL, calendar_factory,
- "IDL:GNOME:Calendar:RepositoryLocator:1.0", "object", &ev);
- CORBA_exception_free (&ev);
-}
-
-void
-unregister_calendar_services (void)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- goad_server_unregister (
- CORBA_OBJECT_NIL,
- "IDL:GNOME:Calendar:RepositoryLocator:1.0", "object", &ev);
- CORBA_exception_free (&ev);
-}
diff --git a/calendar/gui/corba-cal-factory.h b/calendar/gui/corba-cal-factory.h
deleted file mode 100644
index 5d3bcb3140..0000000000
--- a/calendar/gui/corba-cal-factory.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _CORBA_CAL_FACTORY_H_
-#define _CORBA_CAL_FACTORY_H_
-
-/* The CORBA globals */
-CORBA_ORB orb;
-PortableServer_POA poa;
-
-void corba_server_init (void);
-void unregister_calendar_services (void);
-
-#endif /* _CORBA_CAL_FACTORY_H_ */
diff --git a/calendar/gui/corba-cal.c b/calendar/gui/corba-cal.c
deleted file mode 100644
index 472d83008e..0000000000
--- a/calendar/gui/corba-cal.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * corba-cal.c: Service that provides access to the calendar repository
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-#include "alarm.h"
-#include "timeutil.h"
-#include "../libversit/vcc.h"
-#include <libgnorba/gnome-factory.h>
-#include "GnomeCal.h"
-#include "corba-cal-factory.h"
-#include "corba-cal.h"
-
-typedef struct {
- POA_GNOME_Calendar_Repository servant;
- GnomeCalendar *calendar;
-} CalendarServant;
-
-/*
- * Vectors
- */
-static POA_GNOME_Calendar_Repository__epv calendar_repository_epv;
-static POA_GNOME_Calendar_Repository__vepv calendar_repository_vepv;
-
-/*
- * Servant and Object Factory
- */
-static POA_GNOME_Calendar_Repository calendar_repository_servant;
-
-static inline GnomeCalendar *
-gnomecal_from_servant (PortableServer_Servant servant)
-{
- CalendarServant *cs = (CalendarServant *) servant;
-
- return cs->calendar;
-}
-
-static CORBA_char *
-cal_repo_get_object (PortableServer_Servant servant,
- const CORBA_char *uid,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
- char *buffer;
- CORBA_char *ret;
-
- obj = calendar_object_find_event (gcal->cal, uid);
- if (obj == NULL){
- GNOME_Calendar_Repository_NotFound *exn;
-
- exn = GNOME_Calendar_Repository_NotFound__alloc();
- CORBA_exception_set (
- ev,
- CORBA_USER_EXCEPTION,
- ex_GNOME_Calendar_Repository_NotFound,
- exn);
- return NULL;
- }
-
- buffer = calendar_string_from_object (obj);
- ret = CORBA_string_dup (buffer);
- free (buffer);
-
- return ret;
-}
-
-static CORBA_char *
-cal_repo_get_object_by_pilot_id (PortableServer_Servant servant,
- CORBA_long pilot_id,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
- char *buffer;
- CORBA_char *ret;
-
- obj = calendar_object_find_by_pilot (gcal->cal, pilot_id);
- if (obj == NULL){
- GNOME_Calendar_Repository_NotFound *exn;
-
- exn = GNOME_Calendar_Repository_NotFound__alloc();
- CORBA_exception_set (ev,
- CORBA_USER_EXCEPTION,
- ex_GNOME_Calendar_Repository_NotFound, exn);
- return NULL;
- }
-
- buffer = calendar_string_from_object (obj);
- ret = CORBA_string_dup (buffer);
- free (buffer);
-
- return ret;
-
-}
-
-static CORBA_char *
-cal_repo_get_id_from_pilot_id (PortableServer_Servant servant,
- CORBA_long pilot_id,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
-
- obj = calendar_object_find_by_pilot (gcal->cal, pilot_id);
- if (obj == NULL){
- GNOME_Calendar_Repository_NotFound *exn;
-
- exn = GNOME_Calendar_Repository_NotFound__alloc();
- CORBA_exception_set (ev,
- CORBA_USER_EXCEPTION,
- ex_GNOME_Calendar_Repository_NotFound, exn);
- return NULL;
- }
-
- return CORBA_string_dup (obj->uid);
-}
-
-static void
-cal_repo_delete_object (PortableServer_Servant servant,
- const CORBA_char *uid,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
-
- obj = calendar_object_find_event (gcal->cal, uid);
- if (obj == NULL){
- GNOME_Calendar_Repository_NotFound *exn;
-
- exn = GNOME_Calendar_Repository_NotFound__alloc();
- CORBA_exception_set (ev,
- CORBA_USER_EXCEPTION,
- ex_GNOME_Calendar_Repository_NotFound, exn);
- return;
- }
-
- gnome_calendar_remove_object (gcal, obj);
-}
-
-static void
-cal_repo_update_object (PortableServer_Servant servant,
- const CORBA_char *uid,
- const CORBA_char *vcalendar_object,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
- iCalObject *new_object;
-
- new_object = ical_object_new_from_string (vcalendar_object);
-
- obj = calendar_object_find_event (gcal->cal, uid);
- if (obj != NULL){
- calendar_remove_object (gcal->cal, obj);
- }
-
- calendar_add_object (gcal->cal, new_object);
-}
-
-static void
-cal_repo_update_pilot_id (PortableServer_Servant servant,
- const CORBA_char *uid,
- const CORBA_long pilot_id,
- const CORBA_long pilot_status,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- iCalObject *obj;
-
- obj = calendar_object_find_event (gcal->cal, uid);
- if (obj == NULL){
- GNOME_Calendar_Repository_NotFound *exn;
-
- exn = GNOME_Calendar_Repository_NotFound__alloc();
- CORBA_exception_set (
- ev,
- CORBA_USER_EXCEPTION,
- ex_GNOME_Calendar_Repository_NotFound,
- exn);
- return;
- }
-
- obj->pilot_id = pilot_id;
- obj->pilot_status = pilot_status;
-}
-
-static CORBA_char *
-cal_repo_get_objects (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- char *str;
- CORBA_char *res;
-
- str = calendar_get_as_vcal_string (gcal->cal);
- g_message("length of result is %d",strlen(str));
- res = CORBA_string_dup (str);
- free(str); /* ...get_as_vcal calls writeMemVObject, which uses realloc to
- allocate this string */
-
- return res;
-}
-
-static CORBA_long
-cal_repo_get_number_of_objects (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- return g_list_length(gcal->cal->events);
-}
-
-static GNOME_Calendar_Repository_String_Sequence*
-cal_repo_get_object_id_list(PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- GList *l;
- GNOME_Calendar_Repository_String_Sequence *result;
- int counter;
-
- result = GNOME_Calendar_Repository_String_Sequence__alloc();
- result->_length = g_list_length(gcal->cal->events);
- result->_buffer = CORBA_sequence_CORBA_string_allocbuf(result->_length);
-
- counter = 0;
- for (l = gcal->cal->events ; l; l = l->next){
- iCalObject *obj = l->data;
- result->_buffer[counter] = CORBA_string_dup(obj->uid);
- counter++;
- }
-
- return result;
-}
-
-static CORBA_char *
-cal_repo_get_updated_objects (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
- Calendar *dirty_cal;
- GList *l;
- CORBA_char *res;
- char *str;
-
- dirty_cal = calendar_new ("Temporal");
-
- for (l = gcal->cal->events; l; l = l->next){
- iCalObject *obj = l->data;
-
- if (obj->pilot_status != ICAL_PILOT_SYNC_MOD)
- continue;
-
- obj = ical_object_duplicate (l->data);
-
- calendar_add_object (dirty_cal, obj);
- }
- str = calendar_get_as_vcal_string (dirty_cal);
- res = CORBA_string_dup (str);
- g_free (str);
- calendar_destroy (dirty_cal);
-
- return res;
-}
-
-static void
-cal_repo_done (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- GnomeCalendar *gcal = gnomecal_from_servant (servant);
-
- calendar_save (gcal->cal, NULL);
-}
-
-static void
-init_calendar_repo_class (void)
-{
- calendar_repository_epv.get_object = cal_repo_get_object;
- calendar_repository_epv.get_object_by_pilot_id = cal_repo_get_object_by_pilot_id;
- calendar_repository_epv.get_id_from_pilot_id = cal_repo_get_id_from_pilot_id;
- calendar_repository_epv.delete_object = cal_repo_delete_object;
- calendar_repository_epv.update_object = cal_repo_update_object;
- calendar_repository_epv.get_objects = cal_repo_get_objects;
- calendar_repository_epv.get_number_of_objects = cal_repo_get_number_of_objects;
- calendar_repository_epv.get_updated_objects = cal_repo_get_updated_objects;
- calendar_repository_epv.update_pilot_id = cal_repo_update_pilot_id;
- calendar_repository_epv.get_object_id_list = cal_repo_get_object_id_list;
-
- calendar_repository_epv.done = cal_repo_done;
-
- calendar_repository_vepv.GNOME_Calendar_Repository_epv =
- &calendar_repository_epv;
-
- calendar_repository_servant.vepv = &calendar_repository_vepv;
-}
-
-/*
- * Initializes the CORBA parts of the @calendar object
- */
-void
-gnome_calendar_create_corba_server (GnomeCalendar *calendar)
-{
- static gboolean class_inited = FALSE;
- CalendarServant *calendar_servant;
- CORBA_Environment ev;
-
- if (!class_inited){
- init_calendar_repo_class ();
- class_inited = TRUE;
- }
-
- calendar_servant = g_new0 (CalendarServant, 1);
- calendar_servant->servant.vepv = &calendar_repository_vepv;
- calendar_servant->calendar = calendar;
-
- CORBA_exception_init (&ev);
- POA_GNOME_Calendar_Repository__init ((PortableServer_Servant) calendar_servant, &ev);
- CORBA_free (
- PortableServer_POA_activate_object (poa, calendar_servant, &ev));
- calendar->cal->corba_server = PortableServer_POA_servant_to_reference (
- poa, calendar_servant, &ev);
- CORBA_exception_free (&ev);
-}
diff --git a/calendar/gui/corba-cal.h b/calendar/gui/corba-cal.h
deleted file mode 100644
index 47caacba70..0000000000
--- a/calendar/gui/corba-cal.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _CORBA_CAL_H_
-#define _CORBA_CAL_H_
-
-void gnome_calendar_create_corba_server (GnomeCalendar *calendar);
-
-#endif /* _CORBA_CAL_H_ */
diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c
deleted file mode 100644
index 5b45674d00..0000000000
--- a/calendar/gui/eventedit.c
+++ /dev/null
@@ -1,1580 +0,0 @@
-/*
- * EventEditor widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors: Miguel de Icaza (miguel@kernel.org)
- * Federico Mena (quartic@gimp.org)
- */
-#include <config.h>
-#include <gnome.h>
-#include <string.h>
-#include "calendar.h"
-#include "eventedit.h"
-#include "main.h"
-#include "timeutil.h"
-
-
-static void event_editor_class_init (EventEditorClass *class);
-static void event_editor_init (EventEditor *ee);
-static void event_editor_destroy (GtkObject *object);
-
-GtkWidget* make_spin_button (int val, int low, int high);
-void ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType type,
- int y, gboolean control_sens, GtkSignalFunc dirty_func);
-void ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type);
-
-/* Note: do not i18n these strings, they are part of the vCalendar protocol */
-static char *class_names [] = { "PUBLIC", "PRIVATE", "CONFIDENTIAL" };
-
-static GnomeDialogClass *parent_class;
-
-struct numbered_item {
- char *text;
- int num;
-};
-
-
-guint
-event_editor_get_type (void)
-{
- static guint event_editor_type = 0;
-
- if(!event_editor_type) {
- GtkTypeInfo event_editor_info = {
- "EventEditor",
- sizeof(EventEditor),
- sizeof(EventEditorClass),
- (GtkClassInitFunc) event_editor_class_init,
- (GtkObjectInitFunc) event_editor_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
- event_editor_type = gtk_type_unique (gnome_dialog_get_type (), &event_editor_info);
- }
- return event_editor_type;
-}
-
-static void
-event_editor_class_init (EventEditorClass *class)
-{
- GtkObjectClass *object_class;
-
- parent_class = gtk_type_class (gnome_dialog_get_type ());
- object_class = (GtkObjectClass*) class;
- object_class->destroy = event_editor_destroy;
-}
-
-GtkWidget *
-make_spin_button (int val, int low, int high)
-{
- GtkAdjustment *adj;
- GtkWidget *spin;
-
- adj = GTK_ADJUSTMENT (gtk_adjustment_new (val, low, high, 1, 10, 10));
- spin = gtk_spin_button_new (adj, 0.5, 0);
- gtk_widget_set_usize (spin, 60, 0);
-
- return spin;
-}
-
-/*
- * Checks if the day range occupies all the day, and if so, check the
- * box accordingly
- */
-static void
-ee_check_all_day (EventEditor *ee)
-{
- time_t ev_start, ev_end;
-
- ev_start = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- ev_end = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- if (get_time_t_hour (ev_start) <= day_begin && get_time_t_hour (ev_end) >= day_end)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (ee->general_allday), 1);
- else
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (ee->general_allday), 0);
-}
-
-/*
- * Callback: checks that the dates are start < end
- */
-static void
-check_dates (GnomeDateEdit *gde, EventEditor *ee)
-{
- time_t start, end;
- struct tm tm_start, tm_end;
-
- start = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- end = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- if (start > end) {
- tm_start = *localtime (&start);
- tm_end = *localtime (&end);
-
- if (GTK_WIDGET (gde) == ee->start_time) {
- tm_end.tm_year = tm_start.tm_year;
- tm_end.tm_mon = tm_start.tm_mon;
- tm_end.tm_mday = tm_start.tm_mday;
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (&tm_end));
- } else if (GTK_WIDGET (gde) == ee->end_time) {
- tm_start.tm_year = tm_end.tm_year;
- tm_start.tm_mon = tm_end.tm_mon;
- tm_start.tm_mday = tm_end.tm_mday;
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (&tm_start));
- }
- }
-}
-
-/*
- * Callback: checks that start_time < end_time and whether the
- * selected hour range spans all of the day
- */
-static void
-check_times (GnomeDateEdit *gde, EventEditor *ee)
-{
- time_t start, end;
- struct tm tm_start, tm_end;
-
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gdk_flush ();
-
- start = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- end = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- if (start >= end) {
- tm_start = *localtime (&start);
- tm_end = *localtime (&end);
-
- if (GTK_WIDGET (gde) == ee->start_time) {
- tm_end.tm_min = tm_start.tm_min;
- tm_end.tm_sec = tm_start.tm_sec;
-
- tm_end.tm_hour = tm_start.tm_hour + 1;
-
- if (tm_end.tm_hour >= 24) {
- tm_end.tm_hour = 24; /* mktime() will bump the day */
- tm_end.tm_min = 0;
- tm_end.tm_sec = 0;
- }
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (&tm_end));
- } else if (GTK_WIDGET (gde) == ee->end_time) {
- tm_start.tm_min = tm_end.tm_min;
- tm_start.tm_sec = tm_end.tm_sec;
-
- tm_start.tm_hour = tm_end.tm_hour - 1;
-
- if (tm_start.tm_hour < 0) {
- tm_start.tm_hour = 0;
- tm_start.tm_min = 0;
- tm_start.tm_min = 0;
- }
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (&tm_start));
- }
- }
-
- /* Check whether the event spans the whole day */
-
- ee_check_all_day (ee);
-}
-
-/*
- * Callback: all day event box clicked
- */
-static void
-set_all_day (GtkToggleButton *toggle, EventEditor *ee)
-{
- struct tm tm;
- time_t start_t;
-
- start_t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- tm = *localtime (&start_t);
- tm.tm_hour = day_begin;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->start_time), mktime (&tm));
-
- if (toggle->active)
- tm.tm_hour = day_end;
- else
- tm.tm_hour++;
-
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->end_time), mktime (&tm));
-}
-
-/* Convenience function to create a properly-configured date editor widget */
-GtkWidget *
-date_edit_new (time_t the_time, int show_time)
-{
- return gnome_date_edit_new_flags (the_time,
- ((show_time ? GNOME_DATE_EDIT_SHOW_TIME : 0)
- | (am_pm_flag ? 0 : GNOME_DATE_EDIT_24_HR)
- | (week_starts_on_monday
- ? GNOME_DATE_EDIT_WEEK_STARTS_ON_MONDAY
- : 0)));
-}
-
-static GtkWidget *
-event_editor_setup_time_frame (EventEditor *ee)
-{
- GtkWidget *frame;
- GtkWidget *start_time, *end_time;
- GtkTable *t;
-
- frame = gtk_frame_new (_("Time"));
- t = GTK_TABLE (ee->general_time_table = gtk_table_new (1, 1, 0));
- gtk_container_border_width (GTK_CONTAINER (t), 4);
- gtk_table_set_row_spacings (t, 4);
- gtk_table_set_col_spacings (t, 4);
- gtk_container_add (GTK_CONTAINER (frame), ee->general_time_table);
-
- /* 1. Start time */
- if (ee->ical->dtstart == 0){
- ee->ical->dtstart = time (NULL);
- ee->ical->dtend = time_add_minutes (ee->ical->dtstart, 30);
- }
- ee->start_time = start_time = date_edit_new (ee->ical->dtstart, TRUE);
- gnome_date_edit_set_popup_range ((GnomeDateEdit *) start_time, day_begin, day_end);
- gtk_signal_connect (GTK_OBJECT (start_time), "date_changed",
- GTK_SIGNAL_FUNC (check_dates), ee);
- gtk_signal_connect (GTK_OBJECT (start_time), "time_changed",
- GTK_SIGNAL_FUNC (check_times), ee);
- gtk_table_attach (t, gtk_label_new (_("Start time:")), 1, 2, 1, 2,
- GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
- gtk_table_attach (t, start_time, 2, 3, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- /* 2. End time */
- ee->end_time = end_time = date_edit_new (ee->ical->dtend, TRUE);
- gnome_date_edit_set_popup_range ((GnomeDateEdit *) end_time, day_begin, day_end);
- gtk_signal_connect (GTK_OBJECT (end_time), "date_changed",
- GTK_SIGNAL_FUNC (check_dates), ee);
- gtk_signal_connect (GTK_OBJECT (end_time), "time_changed",
- GTK_SIGNAL_FUNC (check_times), ee);
- gtk_table_attach (t, gtk_label_new (_("End time:")), 1, 2, 2, 3,
- GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
- gtk_table_attach (t, end_time, 2, 3, 2, 3,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- /* 3. All day checkbox */
- ee->general_allday = gtk_check_button_new_with_label (_("All day event"));
- gtk_signal_connect (GTK_OBJECT (ee->general_allday), "toggled",
- GTK_SIGNAL_FUNC (set_all_day), ee);
- gtk_table_attach (t, ee->general_allday, 3, 4, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 4, 0);
- ee_check_all_day (ee);
-
- return frame;
-}
-
-static GtkWidget *
-timesel_new (void)
-{
- GtkWidget *menu, *option_menu;
- char *items [] = { N_("Minutes"), N_("Hours"), N_("Days") };
- int i;
-
- option_menu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
- for (i = 0; i < 3; i++){
- GtkWidget *item;
-
- item = gtk_menu_item_new_with_label (_(items [i]));
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
- return option_menu;
-}
-
-/*
- * Set the sensitive state depending on whether the alarm enabled flag.
- */
-static void
-ee_alarm_setting (CalendarAlarm *alarm, int sensitive)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_count), sensitive);
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_timesel), sensitive);
-
- if (alarm->type == ALARM_PROGRAM || alarm->type == ALARM_MAIL){
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_entry), sensitive);
- gtk_widget_set_sensitive (GTK_WIDGET (alarm->w_label), sensitive);
- }
-}
-
-static void
-alarm_toggle (GtkToggleButton *toggle, CalendarAlarm *alarm)
-{
- ee_alarm_setting (alarm, toggle->active);
-}
-
-#define FXS (GTK_FILL | GTK_EXPAND | GTK_SHRINK)
-#define FS (GTK_FILL | GTK_SHRINK)
-
-void
-ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm, enum AlarmType type, int y, gboolean control_sens, GtkSignalFunc dirty_func)
-{
- GtkWidget *entry;
-
- alarm->w_enabled = gtk_check_button_new_with_label (str);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (alarm->w_enabled),
- alarm->enabled);
- if (control_sens)
- gtk_signal_connect (GTK_OBJECT (alarm->w_enabled), "toggled",
- GTK_SIGNAL_FUNC (alarm_toggle), alarm);
- if (dirty_func)
- gtk_signal_connect (GTK_OBJECT (alarm->w_enabled), "toggled",
- GTK_SIGNAL_FUNC (dirty_func), NULL);
- gtk_table_attach (table, alarm->w_enabled, 0, 1, y, y+1, FS, FS, 0, 0);
-
- alarm->w_count = make_spin_button (alarm->count, 0, 10000);
- if (dirty_func)
- gtk_signal_connect (GTK_OBJECT (alarm->w_count), "changed",
- GTK_SIGNAL_FUNC (dirty_func), NULL);
- gtk_table_attach (table, alarm->w_count, 1, 2, y, y+1, FS, FS, 0, 0);
-
- alarm->w_timesel = timesel_new ();
- /* is there a "changed" signal which we can connect to? */
- gtk_option_menu_set_history (GTK_OPTION_MENU (alarm->w_timesel), alarm->units);
- gtk_table_attach (table, alarm->w_timesel, 2, 3, y, y+1, FS, FS, 0, 0);
-
- switch (type){
- case ALARM_MAIL:
- alarm->w_label = gtk_label_new (_("Mail to:"));
- gtk_misc_set_alignment (GTK_MISC (alarm->w_label), 1.0, 0.5);
- gtk_table_attach (table, alarm->w_label, 3, 4, y, y+1, FS, FS, 0, 0);
- alarm->w_entry = gtk_entry_new ();
- gtk_table_attach (table, alarm->w_entry, 4, 5, y, y+1, FXS, FS, 0, 0);
- gtk_entry_set_text (GTK_ENTRY (alarm->w_entry), alarm->data ? alarm->data : "");
- if (dirty_func)
- gtk_signal_connect (GTK_OBJECT (alarm->w_entry),
- "changed",
- GTK_SIGNAL_FUNC (dirty_func),
- NULL);
- break;
-
- case ALARM_PROGRAM:
- alarm->w_label = gtk_label_new (_("Run program:"));
- gtk_misc_set_alignment (GTK_MISC (alarm->w_label), 1.0, 0.5);
- gtk_table_attach (table, alarm->w_label, 3, 4, y, y+1, FS, FS, 0, 0);
- alarm->w_entry = gnome_file_entry_new ("alarm-program", _("Select program to run at alarm time"));
- entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (alarm->w_entry));
- gtk_entry_set_text (GTK_ENTRY (entry), alarm->data ? alarm->data : "");
- gtk_table_attach (table, alarm->w_entry, 4, 5, y, y+1, FXS, FS, 0, 0);
- if (dirty_func)
- gtk_signal_connect (GTK_OBJECT (entry),
- "changed",
- GTK_SIGNAL_FUNC (dirty_func),
- NULL);
- break;
-
- default:
- break;
- }
-
- if (control_sens)
- ee_alarm_setting (alarm, alarm->enabled);
- else
- ee_alarm_setting (alarm, TRUE);
-}
-
-static GtkWidget *
-ee_alarm_widgets (EventEditor *ee)
-{
- GtkWidget *table, *mailto, *mailte, *l;
-
- l = gtk_frame_new (_("Alarms"));
-
- table = gtk_table_new (1, 1, 0);
- gtk_container_border_width (GTK_CONTAINER (table), 4);
- gtk_table_set_row_spacings (GTK_TABLE (table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (table), 4);
- gtk_container_add (GTK_CONTAINER (l), table);
-
- mailto = gtk_label_new (_("Mail to:"));
- mailte = gtk_entry_new ();
-
- ee_create_ae (GTK_TABLE (table), _("Display"), &ee->ical->dalarm, ALARM_DISPLAY, 1, TRUE, NULL);
- ee_create_ae (GTK_TABLE (table), _("Audio"), &ee->ical->aalarm, ALARM_AUDIO, 2, TRUE, NULL);
- ee_create_ae (GTK_TABLE (table), _("Program"), &ee->ical->palarm, ALARM_PROGRAM, 3, TRUE, NULL);
- ee_create_ae (GTK_TABLE (table), _("Mail"), &ee->ical->malarm, ALARM_MAIL, 4, TRUE, NULL);
-
- return l;
-}
-
-static GtkWidget *
-ee_classification_widgets (EventEditor *ee)
-{
- GtkWidget *rpub, *rpriv, *rconf;
- GtkWidget *frame, *hbox;
-
- frame = gtk_frame_new (_("Classification"));
-
- hbox = gtk_hbox_new (TRUE, 0);
- gtk_container_border_width (GTK_CONTAINER (hbox), 4);
- gtk_container_add (GTK_CONTAINER (frame), hbox);
-
- rpub = gtk_radio_button_new_with_label (NULL, _("Public"));
- rpriv = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rpub), _("Private"));
- rconf = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rpub), _("Confidential"));
-
- gtk_box_pack_start (GTK_BOX (hbox), rpub, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), rpriv, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), rconf, FALSE, FALSE, 0);
-
- if (strcmp (ee->ical->class, class_names[0]) == 0)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (rpub), TRUE);
- else if (strcmp (ee->ical->class, class_names[1]) == 0)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (rpriv), TRUE);
- else if (strcmp (ee->ical->class, class_names[2]) == 0)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (rconf), TRUE);
-
- ee->general_radios = rpub;
-
- return frame;
-}
-
-/*
- * Retrieves the information from the CalendarAlarm widgets and stores them
- * on the CalendarAlarm generic values
- */
-void
-ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type)
-{
- GtkWidget *item;
- GtkMenu *menu;
- GList *child;
- int idx;
-
- if (alarm->data){
- g_free (alarm->data);
- alarm->data = 0;
- }
-
- alarm->enabled = GTK_TOGGLE_BUTTON (alarm->w_enabled)->active;
-
- if (!alarm->enabled)
- return;
-
- if (type == ALARM_PROGRAM)
- alarm->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (alarm->w_entry))));
- if (type == ALARM_MAIL)
- alarm->data = g_strdup (gtk_entry_get_text (GTK_ENTRY (alarm->w_entry)));
-
- /* Find out the index */
- menu = GTK_MENU (GTK_OPTION_MENU (alarm->w_timesel)->menu);
-
- item = gtk_menu_get_active (menu);
-
- for (idx = 0, child = GTK_MENU_SHELL (menu)->children; child->data != item; child = child->next)
- idx++;
-
- alarm->units = idx;
- alarm->count = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (alarm->w_count));
-}
-
-static void
-ee_store_general_values_to_ical (EventEditor *ee)
-{
- GtkRadioButton *radio = GTK_RADIO_BUTTON (ee->general_radios);
- iCalObject *ical = ee->ical;
- GSList *list = radio->group;
- int idx;
- time_t now;
-
- now = time (NULL);
- ical->dtstart = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->start_time));
- ical->dtend = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->end_time));
-
- if (ical->summary)
- g_free (ical->summary);
-
- ical->summary = gtk_editable_get_chars (GTK_EDITABLE (ee->general_summary), 0, -1);
-
- ee_store_alarm (&ical->dalarm, ALARM_DISPLAY);
- ee_store_alarm (&ical->aalarm, ALARM_AUDIO);
- ee_store_alarm (&ical->palarm, ALARM_PROGRAM);
- ee_store_alarm (&ical->malarm, ALARM_MAIL);
-
- for (idx = 2; list; list = list->next) {
- if (GTK_TOGGLE_BUTTON (list->data)->active)
- break;
- idx--; /* The group is stored in reverse order of insertion */
- }
-
- g_free (ical->class);
- ical->class = g_strdup (class_names [idx]);
-}
-
-static int
-option_menu_active_number (GtkWidget *omenu)
-{
- GtkWidget *menu;
- GtkWidget *item;
- struct numbered_item *ni;
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (omenu));
- item = gtk_menu_get_active (GTK_MENU (menu));
-
- ni = gtk_object_get_user_data (GTK_OBJECT (item));
-
- return ni->num;
-}
-
-static int
-ee_store_recur_rule_to_ical (EventEditor *ee)
-{
- iCalObject *ical;
- int i, j;
- GSList *list;
-
- ical = ee->ical;
-
- for (i = 0, list = ee->recur_rr_group; list; i++, list = list->next)
- if (GTK_TOGGLE_BUTTON (list->data)->active)
- break;
-
- i = g_slist_length (ee->recur_rr_group) - i - 1; /* buttons are stored in reverse order of insertion */
-
- /* None selected, no rule to be stored */
- if (i == 0)
- return 0;
-
- if (!ical->recur)
- ical->recur = g_new0 (Recurrence, 1);
-
- switch (i) {
- case 1:
- /* Daily */
- ical->recur->type = RECUR_DAILY;
- ical->recur->interval = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ee->recur_rr_day_period));
- break;
-
- case 2:
- /* Weekly */
- ical->recur->type = RECUR_WEEKLY;
- ical->recur->interval = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ee->recur_rr_week_period));
- ical->recur->weekday = 0;
-
- for (j = 0; j < 7; j++)
- if (GTK_TOGGLE_BUTTON (ee->recur_rr_week_days[j])->active) {
- if (j == 6)
- ical->recur->weekday |= 1 << 0; /* sunday is at bit 0 */
- else
- ical->recur->weekday |= 1 << (j + 1);
- }
-
- break;
-
- case 3:
- /* Monthly */
-
- if (GTK_WIDGET_SENSITIVE (ee->recur_rr_month_date)) {
- /* by day */
-
- ical->recur->type = RECUR_MONTHLY_BY_DAY;
- ical->recur->u.month_day =
- gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (ee->recur_rr_month_date));
- ical->recur->interval =
- gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (ee->recur_rr_month_period));
- } else {
- /* by position */
-
- ical->recur->type = RECUR_MONTHLY_BY_POS;
-
- ical->recur->u.month_pos =
- option_menu_active_number (ee->recur_rr_month_day);
- ical->recur->weekday =
- option_menu_active_number (ee->recur_rr_month_weekday);
- ical->recur->interval =
- gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (ee->recur_rr_month_period));
- }
-
- break;
-
- case 4:
- /* Yearly */
- ical->recur->type = RECUR_YEARLY_BY_DAY;
- ical->recur->interval = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ee->recur_rr_year_period));
- /* FIXME: need to specify anything else? I am assuming the code will look at the dtstart
- * to figure out when to recur. - Federico
- */
- break;
-
- default:
- g_assert_not_reached ();
- }
- return 1;
-}
-
-static void
-ee_store_recur_end_to_ical (EventEditor *ee)
-{
- iCalObject *ical;
- GSList *list;
- int i;
-
- /* Ending date of recurrence */
-
- ical = ee->ical;
-
- for (i = 0, list = ee->recur_ed_group; list; i++, list = list->next)
- if (GTK_TOGGLE_BUTTON (list->data)->active)
- break;
-
- i = g_slist_length (ee->recur_ed_group) - i - 1; /* the list is stored in reverse order of insertion */
-
- switch (i) {
- case 0:
- /* repeat forever */
- ical->recur->_enddate = 0;
- ical->recur->enddate = 0;
- ical->recur->duration = 0;
- break;
-
- case 1:
- /* end date */
- ical->recur->_enddate = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->recur_ed_end_on));
- ical->recur->enddate = ical->recur->_enddate;
- ical->recur->duration = 0;
- break;
-
- case 2:
- /* end after n occurrences */
- ical->recur->duration = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ee->recur_ed_end_after));
- ical_object_compute_end (ical);
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-}
-
-static void
-free_exdate (iCalObject *ical)
-{
- GList *list;
-
- if (!ical->exdate)
- return;
-
- for (list = ical->exdate; list; list = list->next)
- g_free (list->data);
-
- g_list_free (ical->exdate);
- ical->exdate = NULL;
-}
-
-static void
-ee_store_recur_exceptions_to_ical (EventEditor *ee)
-{
- iCalObject *ical;
- GtkCList *clist;
- int i;
- time_t *t;
-
- ical = ee->ical;
- clist = GTK_CLIST (ee->recur_ex_clist);
-
- free_exdate (ical);
-
- for (i = 0; i < clist->rows; i++) {
- t = gtk_clist_get_row_data (clist, i);
- ical->exdate = g_list_prepend (ical->exdate, t);
- }
-}
-
-static void
-ee_store_recur_values_to_ical (EventEditor *ee)
-{
- if (ee_store_recur_rule_to_ical (ee)){
- ee_store_recur_exceptions_to_ical (ee);
- ee_store_recur_end_to_ical (ee);
- } else if (ee->ical->recur) {
- g_free (ee->ical->recur);
- ee->ical->recur = NULL;
- if (ee->ical->exdate){
- GList *l = ee->ical->exdate;
-
- for (; l; l = l->next)
- g_free (l->data);
- g_list_free (l);
- }
- }
-}
-
-/*
- * Retrieves all of the information from the different widgets and updates
- * the iCalObject accordingly.
- */
-static void
-ee_store_dlg_values_to_ical (EventEditor *ee)
-{
- time_t now;
-
- ee_store_general_values_to_ical (ee);
- ee_store_recur_values_to_ical (ee);
-
- now = time (NULL);
-
- /* FIXME: This is not entirely correct; we should check if the values actually changed */
- ee->ical->last_mod = now;
-
- if (ee->ical->new)
- ee->ical->created = now;
-}
-
-static void
-ee_ok (GtkWidget *widget, EventEditor *ee)
-{
- ee_store_dlg_values_to_ical (ee);
-
- if (ee->ical->new)
- gnome_calendar_add_object (ee->gnome_cal, ee->ical);
- else
- gnome_calendar_object_changed (ee->gnome_cal, ee->ical, CHANGE_ALL);
-
- save_default_calendar (ee->gnome_cal);
- ee->ical->new = 0;
-}
-
-static void
-ee_cancel (GtkWidget *widget, EventEditor *ee)
-{
- if (ee->ical->new) {
- ical_object_destroy (ee->ical);
- ee->ical = NULL;
- }
-
-}
-
-static void
-ee_create_buttons (EventEditor *ee)
-{
- gnome_dialog_append_buttons(GNOME_DIALOG(ee),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL, NULL);
- gnome_dialog_set_default (GNOME_DIALOG (ee), 0);
- gnome_dialog_button_connect (GNOME_DIALOG (ee), 0, GTK_SIGNAL_FUNC(ee_ok), ee);
- gnome_dialog_button_connect (GNOME_DIALOG (ee), 1, GTK_SIGNAL_FUNC(ee_cancel), ee);
-
- return;
-}
-
-/*
- * Load the contents in a delayed fashion, as the GtkText widget needs it
- */
-static void
-ee_fill_summary (GtkWidget *widget, EventEditor *ee)
-{
- int pos = 0;
-
- gtk_editable_insert_text (GTK_EDITABLE (ee->general_summary), ee->ical->summary,
- strlen (ee->ical->summary), &pos);
- gtk_text_thaw (GTK_TEXT (ee->general_summary));
-}
-
-enum {
- OWNER_LINE,
- DESC_LINE,
- SUMMARY_LINE,
- TIME_LINE,
- ALARM_LINE,
- CLASS_LINE
-};
-
-/* Create/setup the general page */
-static void
-ee_init_general_page (EventEditor *ee)
-{
- GtkWidget *l;
- GtkWidget *hbox;
-
- ee->general_table = gtk_table_new (1, 1, FALSE);
- gtk_container_border_width (GTK_CONTAINER (ee->general_table), 4);
- gtk_table_set_row_spacings (GTK_TABLE (ee->general_table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (ee->general_table), 4);
- gtk_notebook_append_page (GTK_NOTEBOOK (ee->notebook), GTK_WIDGET (ee->general_table),
- gtk_label_new (_("General")));
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_table_attach (GTK_TABLE (ee->general_table), hbox,
- 0, 1, OWNER_LINE, OWNER_LINE + 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 4);
-
- l = gtk_label_new (_("Owner:"));
- gtk_box_pack_start (GTK_BOX (hbox), l, FALSE, FALSE, 0);
-
- ee->general_owner = gtk_label_new (ee->ical->organizer ? ee->ical->organizer : _("?"));
- gtk_misc_set_alignment (GTK_MISC (ee->general_owner), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (hbox), ee->general_owner, TRUE, TRUE, 4);
-
- l = gtk_label_new (_("Summary:"));
- gtk_misc_set_alignment (GTK_MISC (l), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (ee->general_table), l,
- 0, 1, DESC_LINE, DESC_LINE + 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- ee->general_summary = gtk_text_new (NULL, NULL);
- gtk_text_freeze (GTK_TEXT (ee->general_summary));
- gtk_signal_connect (GTK_OBJECT (ee->general_summary), "realize",
- GTK_SIGNAL_FUNC (ee_fill_summary), ee);
- gtk_widget_set_usize (ee->general_summary, 0, 60);
- gtk_text_set_editable (GTK_TEXT (ee->general_summary), 1);
- gtk_table_attach (GTK_TABLE (ee->general_table), ee->general_summary,
- 0, 1, SUMMARY_LINE, SUMMARY_LINE+1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- l = ee_alarm_widgets (ee);
- gtk_table_attach (GTK_TABLE (ee->general_table), l,
- 0, 1, ALARM_LINE, ALARM_LINE + 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- l = event_editor_setup_time_frame (ee);
- gtk_table_attach (GTK_TABLE (ee->general_table), l,
- 0, 1, TIME_LINE, TIME_LINE + 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- l = ee_classification_widgets (ee);
- gtk_table_attach (GTK_TABLE (ee->general_table), l,
- 0, 1, CLASS_LINE, CLASS_LINE + 1,
- GTK_EXPAND | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
-}
-
-static void
-ee_init_summary_page (EventEditor *ee)
-{
-}
-
-struct {
- char *name;
-} recurrence_types [] = {
- { N_("None") },
- { N_("Daily") },
- { N_("Weekly") },
- { N_("Monthly") },
- { N_("Yearly") },
- { 0 }
-};
-
-static void
-recurrence_toggled (GtkRadioButton *radio, EventEditor *ee)
-{
- GSList *list = ee->recur_rr_group;
- int which;
-
- if (!GTK_TOGGLE_BUTTON (radio)->active)
- return;
-
- for (which = 0; list; list = list->next, which++) {
- if (list->data == radio) {
- gtk_notebook_set_page (GTK_NOTEBOOK (ee->recur_rr_notebook), 4 - which);
- return;
- }
- }
-}
-
-static struct numbered_item weekday_positions[] = {
- { N_("1st"), 1 },
- { N_("2nd"), 2 },
- { N_("3rd"), 3 },
- { N_("4th"), 4 },
- { N_("5th"), 5 },
- { 0 }
-};
-
-static struct numbered_item weekday_names[] = {
- { N_("Monday"), 1 },
- { N_("Tuesday"), 2 },
- { N_("Wednesday"), 3 },
- { N_("Thursday"), 4 },
- { N_("Friday"), 5 },
- { N_("Saturday"), 6 },
- { N_("Sunday"), 0 }, /* on the spec, Sunday is zero */
- { 0 }
-};
-
-static GtkWidget *
-make_numbered_menu (struct numbered_item *items, int sel)
-{
- GtkWidget *option_menu, *menu;
- int i;
-
- option_menu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
-
- for (i = 0; items[i].text; i++) {
- GtkWidget *item;
-
- item = gtk_menu_item_new_with_label (_(items[i].text));
- gtk_object_set_user_data (GTK_OBJECT (item), &items[i]);
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
- }
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), sel);
-
- return option_menu;
-}
-
-static void
-month_sensitize (EventEditor *ee, int state)
-{
- gtk_widget_set_sensitive (ee->recur_rr_month_date, state);
- gtk_widget_set_sensitive (ee->recur_rr_month_date_label, state);
-
- gtk_widget_set_sensitive (ee->recur_rr_month_day, !state);
- gtk_widget_set_sensitive (ee->recur_rr_month_weekday, !state);
-}
-
-static void
-recur_month_enable_date (GtkToggleButton *button, EventEditor *ee)
-{
- month_sensitize (ee, button->active);
-}
-
-static void
-desensitize_on_toggle (GtkToggleButton *toggle, gpointer data)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (data), !toggle->active);
-}
-
-static void
-ee_rp_init_rule (EventEditor *ee)
-{
- static char *day_names [] = { N_("Mon"), N_("Tue"), N_("Wed"), N_("Thu"), N_("Fri"), N_("Sat"), N_("Sun") };
- GtkWidget *r, *re, *r1, *f, *vbox, *hbox, *b, *week_hbox, *week_day, *w;
- GtkWidget *none, *daily, *weekly, *monthly, *yearly;
- GtkNotebook *notebook;
- GSList *group;
- int i, page, day_period, week_period, month_period, year_period;
- int week_vector, default_day, def_pos, def_off;
- struct tm tm;
-
- tm = *localtime (&ee->ical->dtstart);
-
- f = gtk_frame_new (_("Recurrence rule"));
-
- hbox = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (hbox), 4);
- gtk_container_add (GTK_CONTAINER (f), hbox);
-
- vbox = gtk_vbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (hbox), gtk_vseparator_new (), FALSE, FALSE, 0);
-
- ee->recur_rr_notebook = gtk_notebook_new ();
- notebook = GTK_NOTEBOOK (ee->recur_rr_notebook);
- gtk_box_pack_start (GTK_BOX (hbox), ee->recur_rr_notebook, TRUE, TRUE, 0);
-
- day_period = 1;
- week_period = 1;
- month_period = 1;
- year_period = 1;
-
- /* Default to today */
-
- week_vector = 1 << tm.tm_wday;
- default_day = tm.tm_mday;
- def_pos = 0;
- def_off = 0;
-
- /* Determine which should be the default selection */
-
- page = 0;
- if (ee->ical->recur) {
- enum RecurType type = ee->ical->recur->type;
- int interval = ee->ical->recur->interval;
-
- switch (type) {
- case RECUR_DAILY:
- page = 1;
- day_period = interval;
- break;
-
- case RECUR_WEEKLY:
- page = 2;
- week_period = interval;
- week_vector = ee->ical->recur->weekday;
- break;
-
- case RECUR_MONTHLY_BY_POS:
- page = 3;
- month_period = interval;
- def_pos = ee->ical->recur->u.month_pos;
- default_day = ee->ical->recur->weekday; /* you can't use u.month_pos and u.month_day-- it's a union... */
- break;
-
- case RECUR_MONTHLY_BY_DAY:
- page = 3;
- month_period = interval;
- default_day = ee->ical->recur->u.month_day;
- break;
-
- case RECUR_YEARLY_BY_MONTH:
- page = 4;
- year_period = interval;
- break;
-
- case RECUR_YEARLY_BY_DAY:
- page = 4;
- year_period = interval;
- break;
- }
- } else
- page = 0;
-
- /* The recurrency selector */
-
- for (i = 0, group = NULL; recurrence_types [i].name; i++) {
- r = gtk_radio_button_new_with_label (group, _(recurrence_types [i].name));
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (r));
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (r), i == page);
- gtk_signal_connect (GTK_OBJECT (r), "toggled", GTK_SIGNAL_FUNC (recurrence_toggled), ee);
- gtk_box_pack_start (GTK_BOX (vbox), r, FALSE, FALSE, 0);
-
- if (i == 0)
- gtk_signal_connect (GTK_OBJECT (r), "toggled",
- (GtkSignalFunc) desensitize_on_toggle,
- ee->recur_hbox);
- }
-
- ee->recur_rr_group = group;
-
- /* 0. No recurrence */
- none = gtk_label_new ("");
-
- /* 1. The daily recurrence */
-
- daily = gtk_vbox_new (FALSE, 0);
-
- b = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (daily), b, FALSE, FALSE, 0);
-
- ee->recur_rr_day_period = make_spin_button (day_period, 1, 10000);
- /* in some languages "Every" can follow the gender of the word it
- refers to (here "day(s)"). leave the two leadin letter "d_"
- in the translation they are ther on purpose */
- gtk_box_pack_start (GTK_BOX (b), gtk_label_new (_("d_Every") +2), FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (b), ee->recur_rr_day_period, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (b), gtk_label_new (_("day(s)")), FALSE, FALSE, 0);
-
- /* 2. The weekly recurrence */
-
- weekly = gtk_vbox_new (FALSE, 4);
-
- week_hbox = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (weekly), week_hbox, FALSE, FALSE, 0);
-
- /* 2.1 The week period selector */
-
- ee->recur_rr_week_period = make_spin_button (week_period, 1, 10000);
- /* in some languages "Every" can follow the gender of the word it
- refers to (here "week(s)"). leave the two leadin letter "w_"
- in the translation they are ther on purpose */
- gtk_box_pack_start (GTK_BOX (week_hbox), gtk_label_new (_("w_Every") +2), FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (week_hbox), ee->recur_rr_week_period, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (week_hbox), gtk_label_new (_("week(s)")), FALSE, FALSE, 0);
-
- /* 2.2 The week day selector */
-
- week_day = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (weekly), week_day, FALSE, FALSE, 0);
-
- for (i = 0; i < 7; i++) {
- ee->recur_rr_week_days [i] = gtk_check_button_new_with_label (_(day_names [i]));
- gtk_box_pack_start (GTK_BOX (week_day), ee->recur_rr_week_days [i], FALSE, FALSE, 0);
-
- if (week_vector & (1 << ((i + 1) % 7))) /* on the spec, Sunday is 0 */
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (ee->recur_rr_week_days [i]), TRUE);
- }
-
- /* 3. The monthly recurrence */
-
- monthly = gtk_table_new (0, 0, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (monthly), 4);
- gtk_table_set_col_spacings (GTK_TABLE (monthly), 4);
-
- re = gtk_radio_button_new_with_label (NULL, _("Recur on the"));
- ee->recur_rr_month_date = make_spin_button (default_day, 1, 31);
- ee->recur_rr_month_date_label = w = gtk_label_new (_("th day of the month"));
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (monthly), re,
- 0, 1, 0, 1, FS, FS, 0, 0);
- gtk_table_attach (GTK_TABLE (monthly), ee->recur_rr_month_date,
- 1, 2, 0, 1, FS, FS, 0, 0);
- gtk_table_attach (GTK_TABLE (monthly), w,
- 2, 3, 0, 1, FS, FS, 0, 0);
- gtk_signal_connect (GTK_OBJECT (re), "toggled", GTK_SIGNAL_FUNC (recur_month_enable_date), ee);
-
- r1 = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (re)), _("Recur on the"));
- ee->recur_rr_month_day = make_numbered_menu (weekday_positions, def_pos);
- ee->recur_rr_month_weekday = make_numbered_menu (weekday_names, default_day);
- gtk_table_attach (GTK_TABLE (monthly), r1,
- 0, 1, 1, 2, FS, FS, 0, 0);
- gtk_table_attach (GTK_TABLE (monthly), ee->recur_rr_month_day,
- 1, 2, 1, 2, FS, FS, 0, 0);
- gtk_table_attach (GTK_TABLE (monthly), ee->recur_rr_month_weekday,
- 2, 3, 1, 2, FS, FS, 0, 0);
-
- /* in some languages "Every" can follow the gender of the word it
- refers to (here "month(s)"). leave the two leadin letter "m_"
- in the translation they are ther on purpose */
- gtk_table_attach (GTK_TABLE (monthly), gtk_label_new (_("m_Every") +2),
- 3, 4, 0, 2, FS, FS, 0, 0);
- ee->recur_rr_month_period = make_spin_button (month_period, 1, 10000);
- gtk_table_attach (GTK_TABLE (monthly), ee->recur_rr_month_period,
- 4, 5, 0, 2, FS, FS, 0, 0);
- gtk_table_attach (GTK_TABLE (monthly), gtk_label_new (_("month(s)")),
- 5, 6, 0, 2, FS, FS, 0, 0);
-
- if (ee->ical->recur) {
- if (ee->ical->recur->type == RECUR_MONTHLY_BY_POS)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (r1), 1);
- } else
- recur_month_enable_date (GTK_TOGGLE_BUTTON (re), ee);
-
- /* 4. The yearly recurrence */
-
- yearly = gtk_vbox_new (FALSE, 0);
-
- b = gtk_hbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (yearly), b, FALSE, FALSE, 0);
-
- ee->recur_rr_year_period = make_spin_button (year_period, 1, 10000);
- /* in some languages "Every" can follow the gender of the word it
- refers to (here "year(s)"). leave the two leadin letter "y_"
- in the translation they are ther on purpose */
- gtk_box_pack_start (GTK_BOX (b), gtk_label_new (_("y_Every") +2), FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (b), ee->recur_rr_year_period, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (b), gtk_label_new (_("year(s)")), FALSE, FALSE, 0);
-
- /* Finish setting this up */
-
- gtk_notebook_append_page (notebook, none, gtk_label_new (""));
- gtk_notebook_append_page (notebook, daily, gtk_label_new (""));
- gtk_notebook_append_page (notebook, weekly, gtk_label_new (""));
- gtk_notebook_append_page (notebook, monthly, gtk_label_new (""));
- gtk_notebook_append_page (notebook, yearly, gtk_label_new (""));
- gtk_notebook_set_show_tabs (notebook, FALSE);
- gtk_notebook_set_show_border (notebook, FALSE);
-
- gtk_notebook_set_page (notebook, page);
-
- /* Attach to the main box */
-
- gtk_box_pack_start (GTK_BOX (ee->recur_vbox), f, FALSE, FALSE, 0);
-}
-
-static void
-sensitize_on_toggle (GtkToggleButton *toggle, gpointer data)
-{
- gtk_widget_set_sensitive (GTK_WIDGET (data), toggle->active);
-}
-
-static void
-ee_rp_init_ending_date (EventEditor *ee)
-{
- GtkWidget *frame;
- GtkWidget *vbox;
- GSList *group;
- GtkWidget *radio0, *radio1, *radio2;
- GtkWidget *hbox;
- GtkWidget *ihbox;
- GtkWidget *widget;
- time_t enddate;
- int repeat;
-
- frame = gtk_frame_new (_("Ending date"));
-
- vbox = gtk_vbox_new (TRUE, 4);
- gtk_container_border_width (GTK_CONTAINER (vbox), 4);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- group = NULL;
-
- /* repeat forever */
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- radio0 = gtk_radio_button_new_with_label (group, _("Repeat forever"));
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio0));
- gtk_box_pack_start (GTK_BOX (hbox), radio0, FALSE, FALSE, 0);
-
- /* end on date */
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- radio1 = gtk_radio_button_new_with_label (group, _("End on"));
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio1));
- gtk_box_pack_start (GTK_BOX (hbox), radio1, FALSE, FALSE, 0);
-
- ihbox = gtk_hbox_new (FALSE, 4);
- gtk_widget_set_sensitive (ihbox, FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), ihbox, FALSE, FALSE, 0);
-
- if (ee->ical->recur)
- enddate = ee->ical->recur->enddate;
- else
- enddate = ee->ical->dtend;
-
- ee->recur_ed_end_on = widget = date_edit_new (enddate, FALSE);
- gtk_box_pack_start (GTK_BOX (ihbox), widget, FALSE, FALSE, 0);
-
- gtk_signal_connect (GTK_OBJECT (radio1), "toggled",
- (GtkSignalFunc) sensitize_on_toggle,
- ihbox);
-
- /* end after n occurrences */
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
-
- radio2 = gtk_radio_button_new_with_label (group, _("End after"));
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio2));
- gtk_box_pack_start (GTK_BOX (hbox), radio2, FALSE, FALSE, 0);
-
- ihbox = gtk_hbox_new (FALSE, 4);
- gtk_widget_set_sensitive (ihbox, FALSE);
- gtk_box_pack_start (GTK_BOX (hbox), ihbox, FALSE, FALSE, 0);
-
- if (ee->ical->recur && ee->ical->recur->duration)
- repeat = ee->ical->recur->duration;
- else
- repeat = 2;
-
- ee->recur_ed_end_after = widget = make_spin_button (repeat, 1, 10000);
- gtk_box_pack_start (GTK_BOX (ihbox), widget, FALSE, FALSE, 0);
-
- widget = gtk_label_new (_("occurrence(s)"));
- gtk_box_pack_start (GTK_BOX (ihbox), widget, FALSE, FALSE, 0);
-
- gtk_signal_connect (GTK_OBJECT (radio2), "toggled",
- (GtkSignalFunc) sensitize_on_toggle,
- ihbox);
-
- /* Activate appropriate item */
-
- if (ee->ical->recur) {
- if (ee->ical->recur->_enddate == 0) {
- if (ee->ical->recur->duration == 0)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (radio0), TRUE);
- else {
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (ee->recur_ed_end_after),
- ee->ical->recur->duration);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (radio2), TRUE);
- }
- } else {
- gnome_date_edit_set_time (GNOME_DATE_EDIT (ee->recur_ed_end_on), ee->ical->recur->enddate);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (radio1), TRUE);
- }
- }
-
- /* Done, add to main table */
-
- ee->recur_ed_group = group;
-
- gtk_box_pack_start (GTK_BOX (ee->recur_hbox), frame, FALSE, FALSE, 0);
-}
-
-static char *
-get_exception_string (time_t t)
-{
- static char buf[256];
-
- strftime (buf, sizeof(buf), _("%a %b %d %Y"), localtime (&t));
- return buf;
-}
-
-static void
-append_exception (EventEditor *ee, time_t t)
-{
- time_t *tt;
- char *c[1];
- int i;
-
- c[0] = get_exception_string (t);
-
- tt = g_new (time_t, 1);
- *tt = t;
-
- i = gtk_clist_append (GTK_CLIST (ee->recur_ex_clist), c);
- gtk_clist_set_row_data (GTK_CLIST (ee->recur_ex_clist), i, tt);
- gtk_clist_select_row (GTK_CLIST (ee->recur_ex_clist), i, 0);
-
- gtk_widget_set_sensitive (ee->recur_ex_vbox, TRUE);
-}
-
-static void
-fill_exception_clist (EventEditor *ee)
-{
- GList *list;
-
- for (list = ee->ical->exdate; list; list = list->next)
- append_exception (ee, *((time_t *) list->data));
-}
-
-static void
-add_exception (GtkWidget *widget, EventEditor *ee)
-{
- time_t t;
-
- t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->recur_ex_date));
- append_exception (ee, t);
-}
-
-static void
-change_exception (GtkWidget *widget, EventEditor *ee)
-{
- GtkCList *clist;
- time_t *t;
- int sel;
-
- clist = GTK_CLIST (ee->recur_ex_clist);
- sel = GPOINTER_TO_INT(clist->selection->data);
-
- t = gtk_clist_get_row_data (clist, sel);
- *t = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->recur_ex_date));
-
- gtk_clist_set_text (clist, sel, 0, get_exception_string (*t));
-}
-
-static void
-delete_exception (GtkWidget *widget, EventEditor *ee)
-{
- GtkCList *clist;
- int sel, length;
-
- clist = GTK_CLIST (ee->recur_ex_clist);
- sel = GPOINTER_TO_INT(clist->selection->data);
-
- g_free (gtk_clist_get_row_data (clist, sel)); /* free the time_t stored there */
-
- gtk_clist_remove (clist, sel);
- length = g_list_length(clist->row_list);
- if (sel >= length)
- sel--;
- gtk_clist_select_row (GTK_CLIST (ee->recur_ex_clist), sel, 0);
-
- if (clist->rows == 0)
- gtk_widget_set_sensitive (ee->recur_ex_vbox, FALSE);
-}
-
-static void
-ee_rp_init_exceptions (EventEditor *ee)
-{
- GtkWidget *frame;
- GtkWidget *hbox;
- GtkWidget *vbox;
- GtkWidget *ivbox;
- GtkWidget *widget;
- GtkWidget *sw;
-
- frame = gtk_frame_new (_("Exceptions"));
-
- hbox = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (hbox), 4);
- gtk_container_add (GTK_CONTAINER (frame), hbox);
-
- vbox = gtk_vbox_new (FALSE, 4);
- gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
-
- ee->recur_ex_date = widget = date_edit_new (time (NULL), FALSE);
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
-
- widget = gtk_button_new_with_label (_("Add exception"));
- gtk_signal_connect (GTK_OBJECT (widget), "clicked",
- (GtkSignalFunc) add_exception,
- ee);
- gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
-
- ee->recur_ex_vbox = ivbox = gtk_vbox_new (FALSE, 4);
- gtk_widget_set_sensitive (ivbox, FALSE); /* at first there are no items to change or delete */
- gtk_box_pack_start (GTK_BOX (vbox), ivbox, FALSE, FALSE, 0);
-
- widget = gtk_button_new_with_label (_("Change selected"));
- gtk_signal_connect (GTK_OBJECT (widget), "clicked",
- (GtkSignalFunc) change_exception,
- ee);
- gtk_box_pack_start (GTK_BOX (ivbox), widget, FALSE, FALSE, 0);
-
- widget = gtk_button_new_with_label (_("Delete selected"));
- gtk_signal_connect (GTK_OBJECT (widget), "clicked",
- (GtkSignalFunc) delete_exception,
- ee);
- gtk_box_pack_start (GTK_BOX (ivbox), widget, FALSE, FALSE, 0);
-
- ee->recur_ex_clist = widget = gtk_clist_new (1);
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (sw), widget);
- gtk_clist_set_selection_mode (GTK_CLIST (widget), GTK_SELECTION_BROWSE);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- fill_exception_clist (ee);
- gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0);
-
- /* Done, add to main table */
-
- gtk_box_pack_start (GTK_BOX (ee->recur_hbox), frame, TRUE, TRUE, 0);
-}
-
-static void
-ee_init_recurrence_page (EventEditor *ee)
-{
- ee->recur_vbox = gtk_vbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (ee->recur_vbox), 4);
-
- ee->recur_hbox = gtk_hbox_new (FALSE, 4);
- gtk_widget_set_sensitive (ee->recur_hbox, FALSE);
-
- ee->recur_page_label = gtk_label_new (_("Recurrence"));
-
- gtk_notebook_append_page (GTK_NOTEBOOK (ee->notebook), ee->recur_vbox,
- ee->recur_page_label);
-
- ee_rp_init_rule (ee);
-
- /* pack here so that the box gets inserted after the recurrence rule frame */
- gtk_box_pack_start (GTK_BOX (ee->recur_vbox), ee->recur_hbox, FALSE, FALSE, 0);
-
- ee_rp_init_ending_date (ee);
- ee_rp_init_exceptions (ee);
-}
-
-static void
-event_editor_init_widgets (EventEditor *ee)
-{
- ee->notebook = gtk_notebook_new ();
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG(ee)->vbox), ee->notebook, 1, 1, 0);
-
- /* Init the various configuration pages */
- ee_init_general_page (ee);
- ee_init_summary_page (ee);
- ee_init_recurrence_page (ee);
-
- /* Buttons */
- ee_create_buttons(ee);
-
- /* We show all of the contained widgets */
- gtk_widget_show_all (GTK_BIN (ee)->child);
-}
-
-static void
-event_editor_init (EventEditor *ee)
-{
- ee->ical = 0;
- gnome_dialog_set_close (GNOME_DIALOG(ee), TRUE);
-}
-
-static void
-event_editor_destroy (GtkObject *object)
-{
- EventEditor *ee;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_EVENT_EDITOR (object));
-
- ee = EVENT_EDITOR (object);
-
- if (ee->ical)
- ee->ical->user_data = NULL; /* we are no longer editing it */
-}
-
-GtkWidget *
-event_editor_new (GnomeCalendar *gcal, iCalObject *ical)
-{
- GtkWidget *retval;
- EventEditor *ee;
-
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gdk_flush ();
-
- retval = gtk_type_new (event_editor_get_type ());
- ee = EVENT_EDITOR (retval);
-
- if (ical == 0){
- ical = ical_new ("", user_name, "");
- ical->new = 1;
- }
-
- if (ical->new){
- gtk_window_set_title (GTK_WINDOW (ee), _("Create new appointment"));
- } else {
- gtk_window_set_title (GTK_WINDOW (ee), _("Edit appointment"));
- }
-
- ical->user_data = ee; /* so that the world can know we are editing it */
-
- ee->ical = ical;
- ee->gnome_cal = gcal;
- event_editor_init_widgets (ee);
-
- return retval;
-}
-
-void
-event_editor_new_whole_day (GnomeCalendar *owner, time_t day)
-{
- struct tm tm;
- iCalObject *ico;
- GtkWidget *ee;
-
- g_return_if_fail (owner != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (owner));
-
- ico = ical_new ("", user_name, "");
- ico->new = TRUE;
-
- tm = *localtime (&day);
-
- /* Set the start time of the event to the beginning of the day */
-
- tm.tm_hour = day_begin;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- ico->dtstart = mktime (&tm);
-
- /* Set the end time of the event to the end of the day */
-
- tm.tm_hour = day_end;
- ico->dtend = mktime (&tm);
-
- /* Launch the event editor */
-
- ee = event_editor_new (owner, ico);
- gtk_widget_show (ee);
-}
diff --git a/calendar/gui/eventedit.h b/calendar/gui/eventedit.h
deleted file mode 100644
index 4d605892dd..0000000000
--- a/calendar/gui/eventedit.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * EventEditor widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#ifndef EVENT_EDITOR_H
-#define EVENT_EDITOR_H
-
-#include "gnome-cal.h"
-#include <libgnomeui/gnome-dialog.h>
-
-BEGIN_GNOME_DECLS
-
-
-#define EVENT_EDITOR(obj) GTK_CHECK_CAST(obj, event_editor_get_type(), EventEditor)
-#define EVENT_EDITOR_CLASS(class) GTK_CHECK_CAST_CLASS(class, event_editor_get_type(), EventEditorClass)
-#define IS_EVENT_EDITOR(obj) GTK_CHECK_TYPE(obj, event_editor_get_type())
-
-
-typedef struct {
- GnomeDialog dialog;
- GtkWidget *notebook;
-
- GtkWidget *general;
- GtkWidget *general_table;
- GtkWidget *general_time_table;
- GtkWidget *general_allday;
- GtkWidget *general_owner;
- GtkWidget *general_summary;
- GtkWidget *start_time, *end_time;
- GtkWidget *general_radios;
-
- GtkWidget *recur_page_label;
- GtkWidget *recur_vbox;
- GtkWidget *recur_hbox;
-
- GSList *recur_rr_group;
- GtkWidget *recur_rr_notebook;
- GtkWidget *recur_rr_day_period;
- GtkWidget *recur_rr_week_period;
- GtkWidget *recur_rr_week_days [7];
- GtkWidget *recur_rr_month_date;
- GtkWidget *recur_rr_month_date_label;
- GtkWidget *recur_rr_month_day;
- GtkWidget *recur_rr_month_weekday;
- GtkWidget *recur_rr_month_period;
- GtkWidget *recur_rr_year_period;
-
- GSList *recur_ed_group;
- GtkWidget *recur_ed_end_on;
- GtkWidget *recur_ed_end_after;
-
- GtkWidget *recur_ex_date;
- GtkWidget *recur_ex_vbox;
- GtkWidget *recur_ex_clist;
-
- /* The associated ical object */
- iCalObject *ical;
-
- /* The calendar owner of this event */
- GnomeCalendar *gnome_cal;
-} EventEditor;
-
-typedef struct {
- GnomeDialogClass parent_class;
-} EventEditorClass;
-
-
-guint event_editor_get_type (void);
-GtkWidget *event_editor_new (GnomeCalendar *owner, iCalObject *);
-
-/* Convenience function to create and show a new event editor for an event that goes from day_begin
- * to day_end of the specified day.
- */
-void event_editor_new_whole_day (GnomeCalendar *owner, time_t day);
-
-GtkWidget *date_edit_new (time_t the_time, int show_time);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/getdate.y b/calendar/gui/getdate.y
deleted file mode 100644
index 6df71bddda..0000000000
--- a/calendar/gui/getdate.y
+++ /dev/null
@@ -1,1001 +0,0 @@
-%{
-/*
-** Originally) written by Steven M. Bellovin <smb@research.att.com> while
-** at the University of North Carolina at Chapel Hill. Later tweaked by
-** a couple of people on Usenet. Completely overhauled by Rich $alz
-** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
-** send any email to Rich.
-**
-** This grammar has 10 shift/reduce conflicts.
-**
-** This code is in the public domain and has no copyright.
-*/
-/* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */
-/* SUPPRESS 288 on yyerrlab *//* Label unused */
-
-#include <config.h>
-#include <gnome.h>
-
-/* Since the code of getdate.y is not included in the Emacs executable
- itself, there is no need to #define static in this file. Even if
- the code were included in the Emacs executable, it probably
- wouldn't do any harm to #undef it here; this will only cause
- problems if we try to write to a static variable, which I don't
- think this code needs to do. */
-#ifdef emacs
-#undef static
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-
-/* The code at the top of get_date which figures out the offset of the
- current time zone checks various CPP symbols to see if special
- tricks are need, but defaults to using the gettimeofday system call.
- Include <sys/time.h> if that will be used. */
-
-#if defined(vms)
-
-#include <types.h>
-#include <time.h>
-
-#else
-
-#include <sys/types.h>
-
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-
-#ifdef timezone
-#undef timezone /* needed for sgi */
-#endif
-
-#if defined(HAVE_SYS_TIMEB_H)
-#include <sys/timeb.h>
-#else
-/*
-** We use the obsolete `struct timeb' as part of our interface!
-** Since the system doesn't have it, we define it here;
-** our callers must do likewise.
-*/
-struct timeb {
- time_t time; /* Seconds since the epoch */
- unsigned short millitm; /* Field not used */
- short timezone; /* Minutes west of GMT */
- short dstflag; /* Field not used */
-};
-#endif /* defined(HAVE_SYS_TIMEB_H) */
-
-#endif /* defined(vms) */
-
-#if defined (STDC_HEADERS) || defined (USG)
-#include <string.h>
-#endif
-
-/* Some old versions of bison generate parsers that use bcopy.
- That loses on systems that don't provide the function, so we have
- to redefine it here. */
-#if !defined (HAVE_BCOPY) && defined (HAVE_MEMCPY) && !defined (bcopy)
-#define bcopy(from, to, len) memcpy ((to), (from), (len))
-#endif
-
-#if defined (STDC_HEADERS)
-#include <stdlib.h>
-#endif
-
-/* NOTES on rebuilding getdate.c (particularly for inclusion in CVS
- releases):
-
- We don't want to mess with all the portability hassles of alloca.
- In particular, most (all?) versions of bison will use alloca in
- their parser. If bison works on your system (e.g. it should work
- with gcc), then go ahead and use it, but the more general solution
- is to use byacc instead of bison, which should generate a portable
- parser. I played with adding "#define alloca dont_use_alloca", to
- give an error if the parser generator uses alloca (and thus detect
- unportable getdate.c's), but that seems to cause as many problems
- as it solves. */
-
-extern struct tm *gmtime();
-extern struct tm *localtime();
-
-#define yyparse getdate_yyparse
-#define yylex getdate_yylex
-#define yyerror getdate_yyerror
-
-static int yylex ();
-static int yyerror ();
-
-#define EPOCH 1970
-#define HOUR(x) ((time_t)(x) * 60)
-#define SECSPERDAY (24L * 60L * 60L)
-
-
-/*
-** An entry in the lexical lookup table.
-*/
-typedef struct _TABLE {
- char *name;
- int type;
- time_t value;
-} TABLE;
-
-
-/*
-** Daylight-savings mode: on, off, or not yet known.
-*/
-typedef enum _DSTMODE {
- DSTon, DSToff, DSTmaybe
-} DSTMODE;
-
-/*
-** Meridian: am, pm, or 24-hour style.
-*/
-typedef enum _MERIDIAN {
- MERam, MERpm, MER24
-} MERIDIAN;
-
-
-/*
-** Global variables. We could get rid of most of these by using a good
-** union as the yacc stack. (This routine was originally written before
-** yacc had the %union construct.) Maybe someday; right now we only use
-** the %union very rarely.
-*/
-static char *yyInput;
-static DSTMODE yyDSTmode;
-static time_t yyDayOrdinal;
-static time_t yyDayNumber;
-static int yyHaveDate;
-static int yyHaveDay;
-static int yyHaveRel;
-static int yyHaveTime;
-static int yyHaveZone;
-static time_t yyTimezone;
-static time_t yyDay;
-static time_t yyHour;
-static time_t yyMinutes;
-static time_t yyMonth;
-static time_t yySeconds;
-static time_t yyYear;
-static MERIDIAN yyMeridian;
-static time_t yyRelMonth;
-static time_t yyRelSeconds;
-
-%}
-
-%union {
- time_t Number;
- enum _MERIDIAN Meridian;
-}
-
-%token tAGO tDAY tDAYZONE tID tMERIDIAN tMINUTE_UNIT tMONTH tMONTH_UNIT
-%token tSEC_UNIT tSNUMBER tUNUMBER tZONE tDST
-
-%type <Number> tDAY tDAYZONE tMINUTE_UNIT tMONTH tMONTH_UNIT
-%type <Number> tSEC_UNIT tSNUMBER tUNUMBER tZONE
-%type <Meridian> tMERIDIAN o_merid
-
-%%
-
-spec : /* NULL */
- | spec item
- ;
-
-item : time {
- yyHaveTime++;
- }
- | zone {
- yyHaveZone++;
- }
- | date {
- yyHaveDate++;
- }
- | day {
- yyHaveDay++;
- }
- | rel {
- yyHaveRel++;
- }
- | number
- ;
-
-time : tUNUMBER tMERIDIAN {
- yyHour = $1;
- yyMinutes = 0;
- yySeconds = 0;
- yyMeridian = $2;
- }
- | tUNUMBER ':' tUNUMBER o_merid {
- yyHour = $1;
- yyMinutes = $3;
- yySeconds = 0;
- yyMeridian = $4;
- }
- | tUNUMBER ':' tUNUMBER tSNUMBER {
- yyHour = $1;
- yyMinutes = $3;
- yyMeridian = MER24;
- yyDSTmode = DSToff;
- yyTimezone = - ($4 % 100 + ($4 / 100) * 60);
- }
- | tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
- yyHour = $1;
- yyMinutes = $3;
- yySeconds = $5;
- yyMeridian = $6;
- }
- | tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER {
- yyHour = $1;
- yyMinutes = $3;
- yySeconds = $5;
- yyMeridian = MER24;
- yyDSTmode = DSToff;
- yyTimezone = - ($6 % 100 + ($6 / 100) * 60);
- }
- ;
-
-zone : tZONE {
- yyTimezone = $1;
- yyDSTmode = DSToff;
- }
- | tDAYZONE {
- yyTimezone = $1;
- yyDSTmode = DSTon;
- }
- |
- tZONE tDST {
- yyTimezone = $1;
- yyDSTmode = DSTon;
- }
- ;
-
-day : tDAY {
- yyDayOrdinal = 1;
- yyDayNumber = $1;
- }
- | tDAY ',' {
- yyDayOrdinal = 1;
- yyDayNumber = $1;
- }
- | tUNUMBER tDAY {
- yyDayOrdinal = $1;
- yyDayNumber = $2;
- }
- ;
-
-date : tUNUMBER '/' tUNUMBER {
- yyMonth = $1;
- yyDay = $3;
- }
- | tUNUMBER '/' tUNUMBER '/' tUNUMBER {
- yyMonth = $1;
- yyDay = $3;
- yyYear = $5;
- }
- | tUNUMBER tSNUMBER tSNUMBER {
- /* ISO 8601 format. yyyy-mm-dd. */
- yyYear = $1;
- yyMonth = -$2;
- yyDay = -$3;
- }
- | tUNUMBER tMONTH tSNUMBER {
- /* e.g. 17-JUN-1992. */
- yyDay = $1;
- yyMonth = $2;
- yyYear = -$3;
- }
- | tMONTH tUNUMBER {
- yyMonth = $1;
- yyDay = $2;
- }
- | tMONTH tUNUMBER ',' tUNUMBER {
- yyMonth = $1;
- yyDay = $2;
- yyYear = $4;
- }
- | tUNUMBER tMONTH {
- yyMonth = $2;
- yyDay = $1;
- }
- | tUNUMBER tMONTH tUNUMBER {
- yyMonth = $2;
- yyDay = $1;
- yyYear = $3;
- }
- ;
-
-rel : relunit tAGO {
- yyRelSeconds = -yyRelSeconds;
- yyRelMonth = -yyRelMonth;
- }
- | relunit
- ;
-
-relunit : tUNUMBER tMINUTE_UNIT {
- yyRelSeconds += $1 * $2 * 60L;
- }
- | tSNUMBER tMINUTE_UNIT {
- yyRelSeconds += $1 * $2 * 60L;
- }
- | tMINUTE_UNIT {
- yyRelSeconds += $1 * 60L;
- }
- | tSNUMBER tSEC_UNIT {
- yyRelSeconds += $1;
- }
- | tUNUMBER tSEC_UNIT {
- yyRelSeconds += $1;
- }
- | tSEC_UNIT {
- yyRelSeconds++;
- }
- | tSNUMBER tMONTH_UNIT {
- yyRelMonth += $1 * $2;
- }
- | tUNUMBER tMONTH_UNIT {
- yyRelMonth += $1 * $2;
- }
- | tMONTH_UNIT {
- yyRelMonth += $1;
- }
- ;
-
-number : tUNUMBER {
- if (yyHaveTime && yyHaveDate && !yyHaveRel)
- yyYear = $1;
- else {
- if($1>10000) {
- yyHaveDate++;
- yyDay= ($1)%100;
- yyMonth= ($1/100)%100;
- yyYear = $1/10000;
- }
- else {
- yyHaveTime++;
- if ($1 < 100) {
- yyHour = $1;
- yyMinutes = 0;
- }
- else {
- yyHour = $1 / 100;
- yyMinutes = $1 % 100;
- }
- yySeconds = 0;
- yyMeridian = MER24;
- }
- }
- }
- ;
-
-o_merid : /* NULL */ {
- $$ = MER24;
- }
- | tMERIDIAN {
- $$ = $1;
- }
- ;
-
-%%
-
-/* Month and day table. */
-static TABLE const MonthDayTable[] = {
- { N_("january"), tMONTH, 1 },
- { N_("february"), tMONTH, 2 },
- { N_("march"), tMONTH, 3 },
- { N_("april"), tMONTH, 4 },
- { N_("may"), tMONTH, 5 },
- { N_("june"), tMONTH, 6 },
- { N_("july"), tMONTH, 7 },
- { N_("august"), tMONTH, 8 },
- { N_("september"), tMONTH, 9 },
- { N_("sept"), tMONTH, 9 },
- { N_("october"), tMONTH, 10 },
- { N_("november"), tMONTH, 11 },
- { N_("december"), tMONTH, 12 },
- { N_("sunday"), tDAY, 0 },
- { N_("monday"), tDAY, 1 },
- { N_("tuesday"), tDAY, 2 },
- { N_("tues"), tDAY, 2 },
- { N_("wednesday"), tDAY, 3 },
- { N_("wednes"), tDAY, 3 },
- { N_("thursday"), tDAY, 4 },
- { N_("thur"), tDAY, 4 },
- { N_("thurs"), tDAY, 4 },
- { N_("friday"), tDAY, 5 },
- { N_("saturday"), tDAY, 6 },
- { NULL }
-};
-
-/* Time units table. */
-static TABLE const UnitsTable[] = {
- { N_("year"), tMONTH_UNIT, 12 },
- { N_("month"), tMONTH_UNIT, 1 },
- { N_("fortnight"), tMINUTE_UNIT, 14 * 24 * 60 },
- { N_("week"), tMINUTE_UNIT, 7 * 24 * 60 },
- { N_("day"), tMINUTE_UNIT, 1 * 24 * 60 },
- { N_("hour"), tMINUTE_UNIT, 60 },
- { N_("minute"), tMINUTE_UNIT, 1 },
- { N_("min"), tMINUTE_UNIT, 1 },
- { N_("second"), tSEC_UNIT, 1 },
- { N_("sec"), tSEC_UNIT, 1 },
- { NULL }
-};
-
-/* Assorted relative-time words. */
-static TABLE const OtherTable[] = {
- { N_("tomorrow"), tMINUTE_UNIT, 1 * 24 * 60 },
- { N_("yesterday"), tMINUTE_UNIT, -1 * 24 * 60 },
- { N_("today"), tMINUTE_UNIT, 0 },
- { N_("now"), tMINUTE_UNIT, 0 },
- { N_("last"), tUNUMBER, -1 },
- { N_("this"), tMINUTE_UNIT, 0 },
- { N_("next"), tUNUMBER, 2 },
- { N_("first"), tUNUMBER, 1 },
-/* { N_("second"), tUNUMBER, 2 }, */
- { N_("third"), tUNUMBER, 3 },
- { N_("fourth"), tUNUMBER, 4 },
- { N_("fifth"), tUNUMBER, 5 },
- { N_("sixth"), tUNUMBER, 6 },
- { N_("seventh"), tUNUMBER, 7 },
- { N_("eighth"), tUNUMBER, 8 },
- { N_("ninth"), tUNUMBER, 9 },
- { N_("tenth"), tUNUMBER, 10 },
- { N_("eleventh"), tUNUMBER, 11 },
- { N_("twelfth"), tUNUMBER, 12 },
- { N_("ago"), tAGO, 1 },
- { NULL }
-};
-
-/* The timezone table. */
-/* Some of these are commented out because a time_t can't store a float. */
-static TABLE const TimezoneTable[] = {
- { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */
- { "ut", tZONE, HOUR( 0) }, /* Universal (Coordinated) */
- { "utc", tZONE, HOUR( 0) },
- { "wet", tZONE, HOUR( 0) }, /* Western European */
- { "bst", tDAYZONE, HOUR( 0) }, /* British Summer */
- { "wat", tZONE, HOUR( 1) }, /* West Africa */
- { "at", tZONE, HOUR( 2) }, /* Azores */
-#if 0
- /* For completeness. BST is also British Summer, and GST is
- * also Guam Standard. */
- { "bst", tZONE, HOUR( 3) }, /* Brazil Standard */
- { "gst", tZONE, HOUR( 3) }, /* Greenland Standard */
-#endif
-#if 0
- { "nft", tZONE, HOUR(3.5) }, /* Newfoundland */
- { "nst", tZONE, HOUR(3.5) }, /* Newfoundland Standard */
- { "ndt", tDAYZONE, HOUR(3.5) }, /* Newfoundland Daylight */
-#endif
- { "ast", tZONE, HOUR( 4) }, /* Atlantic Standard */
- { "adt", tDAYZONE, HOUR( 4) }, /* Atlantic Daylight */
- { "est", tZONE, HOUR( 5) }, /* Eastern Standard */
- { "edt", tDAYZONE, HOUR( 5) }, /* Eastern Daylight */
- { "cst", tZONE, HOUR( 6) }, /* Central Standard */
- { "cdt", tDAYZONE, HOUR( 6) }, /* Central Daylight */
- { "mst", tZONE, HOUR( 7) }, /* Mountain Standard */
- { "mdt", tDAYZONE, HOUR( 7) }, /* Mountain Daylight */
- { "pst", tZONE, HOUR( 8) }, /* Pacific Standard */
- { "pdt", tDAYZONE, HOUR( 8) }, /* Pacific Daylight */
- { "yst", tZONE, HOUR( 9) }, /* Yukon Standard */
- { "ydt", tDAYZONE, HOUR( 9) }, /* Yukon Daylight */
- { "hst", tZONE, HOUR(10) }, /* Hawaii Standard */
- { "hdt", tDAYZONE, HOUR(10) }, /* Hawaii Daylight */
- { "cat", tZONE, HOUR(10) }, /* Central Alaska */
- { "ahst", tZONE, HOUR(10) }, /* Alaska-Hawaii Standard */
- { "nt", tZONE, HOUR(11) }, /* Nome */
- { "idlw", tZONE, HOUR(12) }, /* International Date Line West */
- { "cet", tZONE, -HOUR(1) }, /* Central European */
- { "met", tZONE, -HOUR(1) }, /* Middle European */
- { "mewt", tZONE, -HOUR(1) }, /* Middle European Winter */
- { "mest", tDAYZONE, -HOUR(1) }, /* Middle European Summer */
- { "swt", tZONE, -HOUR(1) }, /* Swedish Winter */
- { "sst", tDAYZONE, -HOUR(1) }, /* Swedish Summer */
- { "fwt", tZONE, -HOUR(1) }, /* French Winter */
- { "fst", tDAYZONE, -HOUR(1) }, /* French Summer */
- { "eet", tZONE, -HOUR(2) }, /* Eastern Europe, USSR Zone 1 */
- { "bt", tZONE, -HOUR(3) }, /* Baghdad, USSR Zone 2 */
-#if 0
- { "it", tZONE, -HOUR(3.5) },/* Iran */
-#endif
- { "zp4", tZONE, -HOUR(4) }, /* USSR Zone 3 */
- { "zp5", tZONE, -HOUR(5) }, /* USSR Zone 4 */
-#if 0
- { "ist", tZONE, -HOUR(5.5) },/* Indian Standard */
-#endif
- { "zp6", tZONE, -HOUR(6) }, /* USSR Zone 5 */
-#if 0
- /* For completeness. NST is also Newfoundland Stanard, and SST is
- * also Swedish Summer. */
- { "nst", tZONE, -HOUR(6.5) },/* North Sumatra */
- { "sst", tZONE, -HOUR(7) }, /* South Sumatra, USSR Zone 6 */
-#endif /* 0 */
- { "wast", tZONE, -HOUR(7) }, /* West Australian Standard */
- { "wadt", tDAYZONE, -HOUR(7) }, /* West Australian Daylight */
-#if 0
- { "jt", tZONE, -HOUR(7.5) },/* Java (3pm in Cronusland!) */
-#endif
- { "cct", tZONE, -HOUR(8) }, /* China Coast, USSR Zone 7 */
- { "jst", tZONE, -HOUR(9) }, /* Japan Standard, USSR Zone 8 */
-#if 0
- { "cast", tZONE, -HOUR(9.5) },/* Central Australian Standard */
- { "cadt", tDAYZONE, -HOUR(9.5) },/* Central Australian Daylight */
-#endif
- { "east", tZONE, -HOUR(10) }, /* Eastern Australian Standard */
- { "eadt", tDAYZONE, -HOUR(10) }, /* Eastern Australian Daylight */
- { "gst", tZONE, -HOUR(10) }, /* Guam Standard, USSR Zone 9 */
- { "nzt", tZONE, -HOUR(12) }, /* New Zealand */
- { "nzst", tZONE, -HOUR(12) }, /* New Zealand Standard */
- { "nzdt", tDAYZONE, -HOUR(12) }, /* New Zealand Daylight */
- { "idle", tZONE, -HOUR(12) }, /* International Date Line East */
- { NULL }
-};
-
-/* Military timezone table. */
-static TABLE const MilitaryTable[] = {
- { "a", tZONE, HOUR( 1) },
- { "b", tZONE, HOUR( 2) },
- { "c", tZONE, HOUR( 3) },
- { "d", tZONE, HOUR( 4) },
- { "e", tZONE, HOUR( 5) },
- { "f", tZONE, HOUR( 6) },
- { "g", tZONE, HOUR( 7) },
- { "h", tZONE, HOUR( 8) },
- { "i", tZONE, HOUR( 9) },
- { "k", tZONE, HOUR( 10) },
- { "l", tZONE, HOUR( 11) },
- { "m", tZONE, HOUR( 12) },
- { "n", tZONE, HOUR(- 1) },
- { "o", tZONE, HOUR(- 2) },
- { "p", tZONE, HOUR(- 3) },
- { "q", tZONE, HOUR(- 4) },
- { "r", tZONE, HOUR(- 5) },
- { "s", tZONE, HOUR(- 6) },
- { "t", tZONE, HOUR(- 7) },
- { "u", tZONE, HOUR(- 8) },
- { "v", tZONE, HOUR(- 9) },
- { "w", tZONE, HOUR(-10) },
- { "x", tZONE, HOUR(-11) },
- { "y", tZONE, HOUR(-12) },
- { "z", tZONE, HOUR( 0) },
- { NULL }
-};
-
-
-
-
-/* ARGSUSED */
-static int
-yyerror(s)
- char *s;
-{
- return 0;
-}
-
-
-static time_t
-ToSeconds(Hours, Minutes, Seconds, Meridian)
- time_t Hours;
- time_t Minutes;
- time_t Seconds;
- MERIDIAN Meridian;
-{
- if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59)
- return -1;
- switch (Meridian) {
- case MER24:
- if (Hours < 0 || Hours > 23)
- return -1;
- return (Hours * 60L + Minutes) * 60L + Seconds;
- case MERam:
- if (Hours < 1 || Hours > 12)
- return -1;
- return (Hours * 60L + Minutes) * 60L + Seconds;
- case MERpm:
- if (Hours < 1 || Hours > 12)
- return -1;
- return ((Hours + 12) * 60L + Minutes) * 60L + Seconds;
- default:
- abort ();
- }
- /* NOTREACHED */
-}
-
-
-static time_t
-Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
- time_t Month;
- time_t Day;
- time_t Year;
- time_t Hours;
- time_t Minutes;
- time_t Seconds;
- MERIDIAN Meridian;
- DSTMODE DSTmode;
-{
- static int DaysInMonth[12] = {
- 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
- };
- time_t tod;
- time_t Julian;
- int i;
-
- if (Year < 0)
- Year = -Year;
- if (Year < 100)
- Year += 1900;
- DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
- ? 29 : 28;
- if (Year < EPOCH || Year > 1999
- || Month < 1 || Month > 12
- /* Lint fluff: "conversion from long may lose accuracy" */
- || Day < 1 || Day > DaysInMonth[(int)--Month])
- return -1;
-
- for (Julian = Day - 1, i = 0; i < Month; i++)
- Julian += DaysInMonth[i];
- for (i = EPOCH; i < Year; i++)
- Julian += 365 + (i % 4 == 0);
- Julian *= SECSPERDAY;
- Julian += yyTimezone * 60L;
- if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
- return -1;
- Julian += tod;
- if (DSTmode == DSTon
- || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
- Julian -= 60 * 60;
- return Julian;
-}
-
-
-static time_t
-DSTcorrect(Start, Future)
- time_t Start;
- time_t Future;
-{
- time_t StartDay;
- time_t FutureDay;
-
- StartDay = (localtime(&Start)->tm_hour + 1) % 24;
- FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
- return (Future - Start) + (StartDay - FutureDay) * 60L * 60L;
-}
-
-
-static time_t
-RelativeDate(Start, DayOrdinal, DayNumber)
- time_t Start;
- time_t DayOrdinal;
- time_t DayNumber;
-{
- struct tm *tm;
- time_t now;
-
- now = Start;
- tm = localtime(&now);
- now += SECSPERDAY * ((DayNumber - tm->tm_wday + 7) % 7);
- now += 7 * SECSPERDAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
- return DSTcorrect(Start, now);
-}
-
-
-static time_t
-RelativeMonth(Start, RelMonth)
- time_t Start;
- time_t RelMonth;
-{
- struct tm *tm;
- time_t Month;
- time_t Year;
-
- if (RelMonth == 0)
- return 0;
- tm = localtime(&Start);
- Month = 12 * tm->tm_year + tm->tm_mon + RelMonth;
- Year = Month / 12;
- Month = Month % 12 + 1;
- return DSTcorrect(Start,
- Convert(Month, (time_t)tm->tm_mday, Year,
- (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
- MER24, DSTmaybe));
-}
-
-
-static int
-LookupWord(buff)
- char *buff;
-{
- register char *p;
- register char *q;
- register const TABLE *tp;
- int i;
- int abbrev;
-
- /* Make it lowercase. */
- for (p = buff; *p; p++)
- if (isupper(*p))
- *p = tolower(*p);
-
- if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) {
- yylval.Meridian = MERam;
- return tMERIDIAN;
- }
- if (strcmp(buff, "pm") == 0 || strcmp(buff, "p.m.") == 0) {
- yylval.Meridian = MERpm;
- return tMERIDIAN;
- }
-
- /* See if we have an abbreviation for a month. */
- if (strlen(buff) == 3)
- abbrev = 1;
- else if (strlen(buff) == 4 && buff[3] == '.') {
- abbrev = 1;
- buff[3] = '\0';
- }
- else
- abbrev = 0;
-
- for (tp = MonthDayTable; tp->name; tp++) {
- if (abbrev) {
- if (strncmp(buff, tp->name, 3) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
- }
- else if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
- }
-
- for (tp = TimezoneTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- if (strcmp(buff, "dst") == 0)
- return tDST;
-
- for (tp = UnitsTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- /* Strip off any plural and try the units table again. */
- i = strlen(buff) - 1;
- if (buff[i] == 's') {
- buff[i] = '\0';
- for (tp = UnitsTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
- buff[i] = 's'; /* Put back for "this" in OtherTable. */
- }
-
- for (tp = OtherTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- /* Military timezones. */
- if (buff[1] == '\0' && isalpha(*buff)) {
- for (tp = MilitaryTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
- }
-
- /* Drop out any periods and try the timezone table again. */
- for (i = 0, p = q = buff; *q; q++)
- if (*q != '.')
- *p++ = *q;
- else
- i++;
- *p = '\0';
- if (i)
- for (tp = TimezoneTable; tp->name; tp++)
- if (strcmp(buff, tp->name) == 0) {
- yylval.Number = tp->value;
- return tp->type;
- }
-
- return tID;
-}
-
-
-static int
-yylex()
-{
- register char c;
- register char *p;
- char buff[20];
- int Count;
- int sign;
-
- for ( ; ; ) {
- while (isspace(*yyInput))
- yyInput++;
-
- if (isdigit(c = *yyInput) || c == '-' || c == '+') {
- if (c == '-' || c == '+') {
- sign = c == '-' ? -1 : 1;
- if (!isdigit(*++yyInput))
- /* skip the '-' sign */
- continue;
- }
- else
- sign = 0;
- for (yylval.Number = 0; isdigit(c = *yyInput++); )
- yylval.Number = 10 * yylval.Number + c - '0';
- yyInput--;
- if (sign < 0)
- yylval.Number = -yylval.Number;
- return sign ? tSNUMBER : tUNUMBER;
- }
- if (isalpha(c)) {
- for (p = buff; isalpha(c = *yyInput++) || c == '.'; )
- if (p < &buff[sizeof buff - 1])
- *p++ = c;
- *p = '\0';
- yyInput--;
- return LookupWord(buff);
- }
- if (c != '(')
- return *yyInput++;
- Count = 0;
- do {
- c = *yyInput++;
- if (c == '\0')
- return c;
- if (c == '(')
- Count++;
- else if (c == ')')
- Count--;
- } while (Count > 0);
- }
-}
-
-#define TM_YEAR_ORIGIN 1900
-
-/* Yield A - B, measured in seconds. */
-static long
-difftm (a, b)
- struct tm *a, *b;
-{
- int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
- int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
- int days = (
- /* difference in day of year */
- a->tm_yday - b->tm_yday
- /* + intervening leap days */
- + ((ay >> 2) - (by >> 2))
- - (ay/100 - by/100)
- + ((ay/100 >> 2) - (by/100 >> 2))
- /* + difference in years * 365 */
- + (long)(ay-by) * 365
- );
- return (60*(60*(24*days + (a->tm_hour - b->tm_hour))
- + (a->tm_min - b->tm_min))
- + (a->tm_sec - b->tm_sec));
-}
-
-time_t
-get_date(p, now)
- char *p;
- struct timeb *now;
-{
- struct tm *tm, gmt;
- struct timeb ftz;
- time_t Start;
- time_t tod;
- time_t nowtime;
-
- yyInput = p;
- if (now == NULL) {
- now = &ftz;
- (void)time (&nowtime);
-
- if (! (tm = gmtime (&nowtime)))
- return -1;
- gmt = *tm; /* Make a copy, in case localtime modifies *tm. */
-
- if (! (tm = localtime (&nowtime)))
- return -1;
-
- ftz.timezone = difftm (&gmt, tm) / 60;
- if(tm->tm_isdst)
- ftz.timezone += 60;
- }
- else
- {
- nowtime = now->time;
- }
-
- tm = localtime(&nowtime);
- yyYear = tm->tm_year;
- yyMonth = tm->tm_mon + 1;
- yyDay = tm->tm_mday;
- yyTimezone = now->timezone;
- yyDSTmode = DSTmaybe;
- yyHour = 0;
- yyMinutes = 0;
- yySeconds = 0;
- yyMeridian = MER24;
- yyRelSeconds = 0;
- yyRelMonth = 0;
- yyHaveDate = 0;
- yyHaveDay = 0;
- yyHaveRel = 0;
- yyHaveTime = 0;
- yyHaveZone = 0;
-
- if (yyparse()
- || yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
- return -1;
-
- if (yyHaveDate || yyHaveTime || yyHaveDay) {
- Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
- yyMeridian, yyDSTmode);
- if (Start < 0)
- return -1;
- }
- else {
- Start = nowtime;
- if (!yyHaveRel)
- Start -= ((tm->tm_hour * 60L + tm->tm_min) * 60L) + tm->tm_sec;
- }
-
- Start += yyRelSeconds;
- Start += RelativeMonth(Start, yyRelMonth);
-
- if (yyHaveDay && !yyHaveDate) {
- tod = RelativeDate(Start, yyDayOrdinal, yyDayNumber);
- Start += tod;
- }
-
- /* Have to do *something* with a legitimate -1 so it's distinguishable
- * from the error return value. (Alternately could set errno on error.) */
- return Start == -1 ? 0 : Start;
-}
-
-
-#if defined(TEST)
-
-/* ARGSUSED */
-int
-main(ac, av)
- int ac;
- char *av[];
-{
- char buff[128];
- time_t d;
-
- (void)printf("Enter date, or blank line to exit.\n\t> ");
- (void)fflush(stdout);
- while (gets(buff) && buff[0]) {
- d = get_date(buff, (struct timeb *)NULL);
- if (d == -1)
- (void)printf("Bad format - couldn't convert.\n");
- else
- (void)printf("%s", ctime(&d));
- (void)printf("\t> ");
- (void)fflush(stdout);
- }
- exit(0);
- /* NOTREACHED */
-}
-#endif /* defined(TEST) */
diff --git a/calendar/gui/gncal-day-panel.c b/calendar/gui/gncal-day-panel.c
deleted file mode 100644
index f407a497d3..0000000000
--- a/calendar/gui/gncal-day-panel.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/* Day view notebook panel for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <gtk/gtkhseparator.h>
-#include "gncal-day-panel.h"
-#include "main.h"
-#include "timeutil.h"
-
-
-guint
-gncal_day_panel_get_type (void)
-{
- static guint day_panel_type = 0;
-
- if (!day_panel_type) {
- GtkTypeInfo day_panel_info = {
- "GncalDayPanel",
- sizeof (GncalDayPanel),
- sizeof (GncalDayPanelClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) NULL,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- day_panel_type = gtk_type_unique (gtk_table_get_type (), &day_panel_info);
- }
-
- return day_panel_type;
-}
-
-static void
-day_view_range_activated (GncalFullDay *fullday, GncalDayPanel *dpanel)
-{
- iCalObject *ical;
-
- ical = ical_new ("", user_name, "");
- ical->new = 1;
-
- gncal_full_day_selection_range (fullday, &ical->dtstart, &ical->dtend);
-
- gnome_calendar_add_object (dpanel->calendar, ical);
- save_default_calendar (dpanel->calendar);
- gncal_full_day_focus_child (fullday, ical);
-}
-
-static void
-full_day_size_allocated (GtkWidget *widget, GtkAllocation *allocation, GncalDayPanel *dpanel)
-{
- GtkAdjustment *adj;
- int yoffset;
- gfloat newval;
-
- adj = gtk_scrolled_window_get_vadjustment (dpanel->fullday_sw);
-
- yoffset = gncal_full_day_get_day_start_yoffset (GNCAL_FULL_DAY (widget));
-
- newval = adj->lower + (adj->upper - adj->lower) * (double) yoffset / allocation->height;
- if (newval != adj->value)
- gtk_signal_emit_by_name (GTK_OBJECT (adj), "value_changed");
-}
-
-static void
-calendar_day_selected (GtkCalendar *calendar, GncalDayPanel *dpanel)
-{
- gint y, m, d;
- struct tm tm;
-
- gtk_calendar_get_date (calendar, &y, &m, &d);
-
- tm.tm_year = y - 1900;
- tm.tm_mon = m;
- tm.tm_mday = d;
- tm.tm_hour = 5; /* for daylight savings time fix */
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- gnome_calendar_goto (dpanel->calendar, mktime (&tm));
-}
-
-static void
-retag_calendar (GtkCalendar *calendar, GncalDayPanel *dpanel)
-{
- gnome_calendar_tag_calendar (dpanel->calendar, GTK_CALENDAR (dpanel->gtk_calendar));
-}
-
-GtkWidget *
-gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day)
-{
- GncalDayPanel *dpanel;
- GtkWidget *w;
- GtkWidget *hpane, *vpane;
- gint start_pos = 265;
- struct tm tm;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- dpanel = gtk_type_new (gncal_day_panel_get_type ());
-
- gtk_container_border_width (GTK_CONTAINER (dpanel), 4);
- gtk_table_set_row_spacings (GTK_TABLE (dpanel), 4);
- gtk_table_set_col_spacings (GTK_TABLE (dpanel), 4);
-
- dpanel->calendar = calendar;
-
- /* Date label */
-
- w = gtk_label_new ("");
- dpanel->date_label = GTK_LABEL (w);
- gtk_table_attach (GTK_TABLE (dpanel), w,
- 0, 1, 0, 1,
- GTK_FILL | GTK_SHRINK,
- GTK_FILL | GTK_SHRINK,
- 0, 0);
- gtk_widget_show (w);
-
- /* Create horizontal pane */
-
- hpane = gtk_hpaned_new ();
- gtk_table_attach (GTK_TABLE (dpanel), hpane,
- 0, 1, 2, 4,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- /* Full day */
-
- w = gtk_scrolled_window_new (NULL, NULL);
- dpanel->fullday_sw = GTK_SCROLLED_WINDOW (w);
- gtk_scrolled_window_set_policy (dpanel->fullday_sw,
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_paned_pack1 (GTK_PANED (hpane), w, FALSE, TRUE);
- /*gtk_paned_add1 (GTK_PANED (hpane), w);*/
- gtk_widget_show (w);
-
- w = gncal_full_day_new (calendar, time_day_begin (start_of_day), time_day_end (start_of_day));
- dpanel->fullday = GNCAL_FULL_DAY (w);
- gtk_signal_connect (GTK_OBJECT (dpanel->fullday), "range_activated",
- (GtkSignalFunc) day_view_range_activated,
- dpanel);
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (dpanel->fullday_sw), w);
- gtk_widget_show (w);
-
- /* We'll scroll the list to the proper initial position */
-
- gtk_signal_connect (GTK_OBJECT (dpanel->fullday), "size_allocate",
- (GtkSignalFunc) full_day_size_allocated,
- dpanel);
-
- /* Create vertical pane */
-
- vpane = gtk_vpaned_new ();
- gtk_paned_pack2 (GTK_PANED (hpane), GTK_WIDGET (vpane), TRUE, TRUE);
- /*gtk_paned_add2 (GTK_PANED (hpane), GTK_WIDGET (vpane));*/
-
- /* Gtk calendar */
-
- tm = *localtime (&start_of_day);
-
- w = gtk_calendar_new ();
- dpanel->gtk_calendar = GTK_CALENDAR (w);
- gtk_calendar_display_options (dpanel->gtk_calendar,
- (GTK_CALENDAR_SHOW_HEADING
- | GTK_CALENDAR_SHOW_DAY_NAMES
- | (week_starts_on_monday
- ? GTK_CALENDAR_WEEK_START_MONDAY : 0)));
- gtk_calendar_select_month (dpanel->gtk_calendar, tm.tm_mon, tm.tm_year + 1900);
- gtk_calendar_select_day (dpanel->gtk_calendar, tm.tm_mday);
- dpanel->day_selected_id = gtk_signal_connect (GTK_OBJECT (dpanel->gtk_calendar),
- "day_selected_double_click",
- (GtkSignalFunc) calendar_day_selected,
- dpanel);
- gtk_signal_connect (GTK_OBJECT (dpanel->gtk_calendar), "month_changed",
- GTK_SIGNAL_FUNC (retag_calendar), dpanel);
- gtk_paned_add1 (GTK_PANED (vpane), w);
- gtk_widget_show (w);
-
- /* To-do */
-
- w = gncal_todo_new (calendar);
- dpanel->todo = GNCAL_TODO (w);
- gtk_paned_add2 (GTK_PANED (vpane), w);
- gtk_widget_show (w);
-
- /* Done */
-
- gncal_day_panel_set (dpanel, start_of_day);
-
- gtk_paned_set_position (GTK_PANED (hpane), start_pos);
-
- return GTK_WIDGET (dpanel);
-}
-
-static void
-update (GncalDayPanel *dpanel, int update_fullday, iCalObject *ico, int flags)
-{
- char buf [80];
-
- if (update_fullday){
- gncal_full_day_update (dpanel->fullday, ico, flags);
- retag_calendar (dpanel->gtk_calendar, dpanel);
- }
- gncal_todo_update (dpanel->todo, ico, flags);
-
- strftime (buf, sizeof (buf), _("%a %b %d %Y"), localtime (&dpanel->start_of_day));
- gtk_label_set (GTK_LABEL (dpanel->date_label), buf);
-}
-
-void
-gncal_day_panel_update (GncalDayPanel *dpanel, iCalObject *ico, int flags)
-{
- g_return_if_fail (dpanel != NULL);
- g_return_if_fail (GNCAL_IS_DAY_PANEL (dpanel));
-
- update (dpanel, TRUE, ico, flags);
-}
-
-void
-gncal_day_panel_set (GncalDayPanel *dpanel, time_t start_of_day)
-{
- char buf[80];
- struct tm tm;
-
- g_return_if_fail (dpanel != NULL);
- g_return_if_fail (GNCAL_IS_DAY_PANEL (dpanel));
-
- dpanel->start_of_day = time_day_begin(start_of_day);
- if (dpanel->fullday->lower == dpanel->start_of_day)
- return;
-
- tm = *localtime (&dpanel->start_of_day);
- strftime (buf, sizeof (buf), _("%a %b %d %Y"), &tm);
- gtk_label_set (GTK_LABEL (dpanel->date_label), buf);
-
- gncal_full_day_set_bounds (dpanel->fullday, dpanel->start_of_day, time_day_end (dpanel->start_of_day));
-
- gtk_calendar_select_month (dpanel->gtk_calendar, tm.tm_mon, tm.tm_year + 1900);
-
- gtk_signal_handler_block (GTK_OBJECT (dpanel->gtk_calendar), dpanel->day_selected_id);
- gtk_calendar_select_day (dpanel->gtk_calendar, tm.tm_mday);
- gtk_signal_handler_unblock (GTK_OBJECT (dpanel->gtk_calendar), dpanel->day_selected_id);
-
- update (dpanel, FALSE, NULL, 0);
-}
-
-void
-gncal_day_panel_time_format_changed (GncalDayPanel *dpanel)
-{
- g_return_if_fail (dpanel != NULL);
- g_return_if_fail (GNCAL_IS_DAY_PANEL (dpanel));
-
- gtk_calendar_display_options (dpanel->gtk_calendar,
- (week_starts_on_monday
- ? (dpanel->gtk_calendar->display_flags
- | GTK_CALENDAR_WEEK_START_MONDAY)
- : (dpanel->gtk_calendar->display_flags
- & ~GTK_CALENDAR_WEEK_START_MONDAY)));
-}
-
-void
-todo_list_properties_changed (GncalDayPanel *dpanel)
-{
- g_return_if_fail (dpanel != NULL);
- g_return_if_fail (GNCAL_IS_DAY_PANEL (dpanel));
-
- gncal_todo_update (dpanel->todo, NULL, 0);
-}
-
-
-
diff --git a/calendar/gui/gncal-day-panel.h b/calendar/gui/gncal-day-panel.h
deleted file mode 100644
index 6bf8768d9c..0000000000
--- a/calendar/gui/gncal-day-panel.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Day view notebook panel for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef GNCAL_DAY_PANEL_H
-#define GNCAL_DAY_PANEL_H
-
-#include <gtk/gtklabel.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtktable.h>
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-#include "gncal-full-day.h"
-#include "gncal-todo.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_DAY_PANEL(obj) GTK_CHECK_CAST (obj, gncal_day_panel_get_type (), GncalDayPanel)
-#define GNCAL_DAY_PANEL_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_day_panel_get_type (), GncalDayPanelClass)
-#define GNCAL_IS_DAY_PANEL(obj) GTK_CHECK_TYPE (obj, gncal_day_panel_get_type ())
-
-
-typedef struct _GncalDayPanel GncalDayPanel;
-typedef struct _GncalDayPanelClass GncalDayPanelClass;
-
-struct _GncalDayPanel {
- GtkTable table;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- time_t start_of_day;
-
- GtkLabel *date_label;
- GncalFullDay *fullday;
- GtkScrolledWindow *fullday_sw;
- GtkCalendar *gtk_calendar;
- GncalTodo *todo;
-
- guint day_selected_id;
-};
-
-struct _GncalDayPanelClass {
- GtkTableClass parent_class;
-};
-
-
-guint gncal_day_panel_get_type (void);
-GtkWidget *gncal_day_panel_new (GnomeCalendar *calendar, time_t start_of_day);
-
-void gncal_day_panel_update (GncalDayPanel *dpanel, iCalObject *ico, int flags);
-void gncal_day_panel_set (GncalDayPanel *dpanel, time_t start_of_day);
-void gncal_day_panel_time_format_changed (GncalDayPanel *dpanel);
-
-void todo_list_properties_changed (GncalDayPanel *dpanel);
-
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/gncal-day-view.c b/calendar/gui/gncal-day-view.c
deleted file mode 100644
index eafd237029..0000000000
--- a/calendar/gui/gncal-day-view.c
+++ /dev/null
@@ -1,396 +0,0 @@
-/* Day view widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <quartic@gimp.org>
- * Miguel de Icaza <miguel@kernel.org>
- */
-
-#include <gnome.h>
-#include "gncal-day-view.h"
-#include "timeutil.h"
-#include "view-utils.h"
-#include "main.h"
-#include "eventedit.h"
-#include "popup-menu.h"
-
-
-#define TEXT_BORDER 2
-#define MIN_INFO_WIDTH 50
-
-
-static void gncal_day_view_class_init (GncalDayViewClass *class);
-static void gncal_day_view_init (GncalDayView *dview);
-static void gncal_day_view_destroy (GtkObject *object);
-static void gncal_day_view_realize (GtkWidget *widget);
-static void gncal_day_view_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static gint gncal_day_view_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gncal_day_view_button_press (GtkWidget *widget,
- GdkEventButton *event);
-
-
-static GtkWidgetClass *parent_class;
-
-
-guint
-gncal_day_view_get_type (void)
-{
- static guint day_view_type = 0;
-
- if (!day_view_type) {
- GtkTypeInfo day_view_info = {
- "GncalDayView",
- sizeof (GncalDayView),
- sizeof (GncalDayViewClass),
- (GtkClassInitFunc) gncal_day_view_class_init,
- (GtkObjectInitFunc) gncal_day_view_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- day_view_type = gtk_type_unique (gtk_widget_get_type (), &day_view_info);
- }
-
- return day_view_type;
-}
-
-static void
-gncal_day_view_class_init (GncalDayViewClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = gtk_type_class (gtk_widget_get_type ());
-
- object_class->destroy = gncal_day_view_destroy;
-
- widget_class->realize = gncal_day_view_realize;
- widget_class->size_request = gncal_day_view_size_request;
- widget_class->expose_event = gncal_day_view_expose;
- widget_class->button_press_event = gncal_day_view_button_press;
-}
-
-static void
-gncal_day_view_init (GncalDayView *dview)
-{
- GTK_WIDGET_UNSET_FLAGS (dview, GTK_NO_WINDOW);
-
- dview->calendar = NULL;
-
- dview->lower = 0;
- dview->upper = 0;
-
- dview->shadow_type = GTK_SHADOW_ETCHED_IN;
-}
-
-static void
-gncal_day_view_destroy (GtkObject *object)
-{
- GncalDayView *dview;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (object));
-
- dview = GNCAL_DAY_VIEW (object);
-
- if (dview->day_str)
- g_free (dview->day_str);
- if (dview->events)
- calendar_destroy_event_list (dview->events);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static int
-new_appointment (GtkWidget *widget, gpointer data)
-{
- GncalDayView *dayview = GNCAL_DAY_VIEW (data);
- iCalObject *ico;
- GtkWidget *ee;
- struct tm tm;
-
- ico = ical_new ("", user_name, "");
- ico->new = 1;
-
- tm = *localtime (&dayview->lower);
- tm.tm_hour = day_begin;
- ico->dtstart = mktime (&tm);
- tm.tm_hour++;
- ico->dtend = mktime (&tm);
- ee = event_editor_new (dayview->calendar, ico);
- gtk_widget_show (ee);
- return 1;
-}
-
-static void
-context_menu (GncalDayView *dayview, GdkEventButton *event)
-{
- static struct menu_item main_items[] = {
- { N_("New appointment..."), (GtkSignalFunc) new_appointment, NULL, TRUE }
- };
-
- main_items [0].data = dayview;
- popup_menu (main_items, 1, event);
-}
-
-static gint
-gncal_day_view_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- GncalDayView *dayview;
-
- dayview = GNCAL_DAY_VIEW (widget);
-
- if (event->button == 3)
- context_menu (dayview, event);
-
- if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
- gnome_calendar_dayjump (dayview->calendar, dayview->lower);
-
- return TRUE;
-}
-
-GtkWidget *
-gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper)
-{
- GncalDayView *dview;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- dview = gtk_type_new (gncal_day_view_get_type ());
-
- dview->calendar = calendar;
- dview->lower = lower;
- dview->upper = upper;
- dview->events = 0;
-
- gncal_day_view_update (dview, NULL, 0);
-
- return GTK_WIDGET (dview);
-}
-
-static void
-gncal_day_view_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.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)
- | GDK_EXPOSURE_MASK
- | GDK_BUTTON_PRESS_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);
-
- gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_PRELIGHT]);
-}
-
-static void
-gncal_day_view_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- GncalDayView *dview;
- int str_width, width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (widget));
- g_return_if_fail (requisition != NULL);
-
- dview = GNCAL_DAY_VIEW (widget);
-
- /* border and min width */
-
- str_width = gdk_string_width (widget->style->font, dview->day_str);
-
- width = MAX (MIN_INFO_WIDTH, str_width);
-
- requisition->width = 2 * (widget->style->klass->xthickness + TEXT_BORDER) + width;
- requisition->height = 2 * (widget->style->klass->ythickness + TEXT_BORDER);
-
- /* division line */
-
- requisition->height += 2 * TEXT_BORDER + widget->style->klass->ythickness;
-
- /* title and at least one line of text */
-
- requisition->height += 2 * (widget->style->font->ascent + widget->style->font->descent);
-}
-
-static gint
-gncal_day_view_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- GncalDayView *dview;
- int x1, y1, width, height;
- GdkRectangle rect, dest;
- GdkFont *font;
- int str_width;
- GdkGC *gc;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_DAY_VIEW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return FALSE;
-
- gc = widget->style->fg_gc [GTK_STATE_NORMAL];
- dview = GNCAL_DAY_VIEW (widget);
-
- x1 = widget->style->klass->xthickness;
- y1 = widget->style->klass->ythickness;
- width = widget->allocation.width - 2 * x1;
- height = widget->allocation.height - 2 * y1;
-
- /* Clear and paint frame shadow */
-
- gdk_window_clear_area (widget->window,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, dview->shadow_type,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- /* Clear and paint title */
-
- font = widget->style->font;
-
- rect.x = x1;
- rect.y = y1;
- rect.width = width;
- rect.height = 2 * TEXT_BORDER + font->ascent + font->descent;
-
- if (gdk_rectangle_intersect (&rect, &event->area, &dest)) {
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- dest = rect;
-
- dest.x += TEXT_BORDER;
- dest.y += TEXT_BORDER;
- dest.width -= 2 * TEXT_BORDER;
- dest.height -= 2 * TEXT_BORDER;
-
- gdk_gc_set_clip_rectangle (gc, &dest);
-
- str_width = gdk_string_width (font, dview->day_str);
-
- gdk_draw_string (widget->window, font, gc,
- dest.x + (dest.width - str_width) / 2,
- dest.y + font->ascent,
- dview->day_str);
-
- gdk_gc_set_clip_rectangle (gc, NULL);
- }
-
- /* Division line */
-
- gtk_draw_hline (widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- rect.x,
- rect.x + rect.width - 1,
- rect.y + rect.height);
-
- /* Text */
-
- if (dview->events != NULL){
- rect.x = x1 + TEXT_BORDER;
- rect.y = y1 + 3 * TEXT_BORDER +
- font->ascent + font->descent +
- widget->style->klass->ythickness;
- rect.width = width - 2 * TEXT_BORDER;
- rect.height = height - (rect.y - y1) - TEXT_BORDER;
-
- if (gdk_rectangle_intersect (&rect, &event->area, &dest))
- view_utils_draw_events (
- widget, widget->window, gc,
- &rect,
- VIEW_UTILS_DRAW_END | VIEW_UTILS_DRAW_SPLIT,
- dview->events,
- dview->lower,
- dview->upper);
- }
-
- return FALSE;
-}
-
-void
-gncal_day_view_update (GncalDayView *dview, iCalObject *ico, int flags)
-{
- struct tm tm;
- char buf[256];
-
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
- g_return_if_fail (dview->calendar->cal);
-
- if (dview->day_str)
- g_free (dview->day_str);
-
- tm = *localtime (&dview->lower);
- strftime (buf, sizeof (buf)-1, "%A %d", &tm);
- dview->day_str = g_strdup (buf);
-
- if (dview->events)
- calendar_destroy_event_list (dview->events);
-
- dview->events = calendar_get_events_in_range (dview->calendar->cal,
- dview->lower,
- dview->upper);
-
- gtk_widget_draw (GTK_WIDGET (dview), NULL);
-}
-
-void
-gncal_day_view_set_bounds (GncalDayView *dview, time_t lower, time_t upper)
-{
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
-
- if ((lower != dview->lower) || (upper != dview->upper)) {
- dview->lower = lower;
- dview->upper = upper;
-
- gncal_day_view_update (dview, NULL, 0);
- }
-}
-
-void
-gncal_day_view_set_shadow (GncalDayView *dview, GtkShadowType shadow_type)
-{
- g_return_if_fail (dview != NULL);
- g_return_if_fail (GNCAL_IS_DAY_VIEW (dview));
-
- if (shadow_type != dview->shadow_type) {
- dview->shadow_type = shadow_type;
-
- gtk_widget_draw (GTK_WIDGET (dview), NULL);
- }
-}
diff --git a/calendar/gui/gncal-day-view.h b/calendar/gui/gncal-day-view.h
deleted file mode 100644
index dae1897fb6..0000000000
--- a/calendar/gui/gncal-day-view.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Day view widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef GNCAL_DAY_VIEW_H
-#define GNCAL_DAY_VIEW_H
-
-
-#include <gtk/gtkwidget.h>
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_DAY_VIEW(obj) GTK_CHECK_CAST (obj, gncal_day_view_get_type (), GncalDayView)
-#define GNCAL_DAY_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_day_view_get_type (), GncalDayViewClass)
-#define GNCAL_IS_DAY_VIEW(obj) GTK_CHECK_TYPE (obj, gncal_day_view_get_type ())
-
-
-typedef struct _GncalDayView GncalDayView;
-typedef struct _GncalDayViewClass GncalDayViewClass;
-
-struct _GncalDayView {
- GtkWidget widget;
-
- GnomeCalendar *calendar;/* the calendar we are associated to */
-
- time_t lower; /* lower and upper times to display */
- time_t upper; /* these include the full day */
-
- char *day_str; /* what day is it? */
- GList *events; /* the events for the this day */
- GtkShadowType shadow_type;
-};
-
-struct _GncalDayViewClass {
- GtkWidgetClass parent_class;
-};
-
-
-guint gncal_day_view_get_type (void);
-GtkWidget *gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper);
-
-void gncal_day_view_update (GncalDayView *dview, iCalObject *ico, int flags);
-void gncal_day_view_set_bounds (GncalDayView *dview, time_t lower, time_t upper);
-
-void gncal_day_view_set_shadow (GncalDayView *dview, GtkShadowType shadow_type);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/gncal-full-day.c b/calendar/gui/gncal-full-day.c
deleted file mode 100644
index c07d9a5710..0000000000
--- a/calendar/gui/gncal-full-day.c
+++ /dev/null
@@ -1,2287 +0,0 @@
-/* Full day widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <quartic@gimp.org>
- * Miguel de Icaza <miguel@kernel.org>
- */
-#include <config.h>
-#include <string.h>
-#include <gdk/gdkkeysyms.h>
-#include <gnome.h>
-#include "eventedit.h"
-#include "gncal-full-day.h"
-#include "view-utils.h"
-#include "layout.h"
-#include "main.h"
-#include "popup-menu.h"
-
-/* Images */
-#include "bell.xpm"
-#include "recur.xpm"
-
-#define TEXT_BORDER 2
-#define HANDLE_SIZE 8
-#define MIN_WIDTH 200
-#define XOR_RECT_WIDTH 2
-#define UNSELECT_TIMEOUT 0 /* ms */
-
-/* Size of the pixmaps */
-#define DECOR_WIDTH 16
-#define DECOR_HEIGHT 16
-
-typedef struct {
- iCalObject *ico;
- GtkWidget *widget;
- GdkWindow *window;
- GdkWindow *decor_window;
- guint focus_out_id;
- int lower_row; /* zero is first displayed row */
- int rows_used;
- int x; /* coords of child's window */
- int y;
- int width;
- int height;
- int decor_width;
- int decor_height;
- int items; /* number of decoration bitmaps */
- time_t start, end;
-} Child;
-
-struct drag_info {
- enum {
- DRAG_NONE,
- DRAG_SELECT, /* selecting a range in the main window */
- DRAG_MOVE, /* moving a child */
- DRAG_SIZE_TOP, /* resizing a child */
- DRAG_SIZE_BOTTOM
- } drag_mode;
-
- Child *child;
- int child_click_y;
- int child_start_row;
- int child_rows_used;
-
- int sel_click_row;
- int sel_start_row;
- int sel_rows_used;
- guint32 click_time;
-};
-
-
-enum {
- RANGE_ACTIVATED,
- LAST_SIGNAL
-};
-
-
-static void gncal_full_day_class_init (GncalFullDayClass *class);
-static void gncal_full_day_init (GncalFullDay *fullday);
-static void gncal_full_day_destroy (GtkObject *object);
-static void gncal_full_day_map (GtkWidget *widget);
-static void gncal_full_day_unmap (GtkWidget *widget);
-static void gncal_full_day_realize (GtkWidget *widget);
-static void gncal_full_day_unrealize (GtkWidget *widget);
-static void gncal_full_day_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gncal_full_day_draw_focus (GtkWidget *widget);
-static void gncal_full_day_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gncal_full_day_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint gncal_full_day_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gncal_full_day_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gncal_full_day_motion (GtkWidget *widget,
- GdkEventMotion *event);
-static gint gncal_full_day_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gncal_full_day_key_press (GtkWidget *widget,
- GdkEventKey *event);
-static gint gncal_full_day_focus_in (GtkWidget *widget,
- GdkEventFocus *event);
-static gint gncal_full_day_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
-static void gncal_full_day_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
-
-static void range_activated (GncalFullDay *fullday);
-
-static GtkContainerClass *parent_class;
-
-static int fullday_signals[LAST_SIGNAL] = { 0 };
-
-/* The little images */
-static GdkPixmap *pixmap_bell, *pixmap_recur;
-
-static void
-get_tm_range (GncalFullDay *fullday,
- time_t time_lower, time_t time_upper,
- struct tm *lower, struct tm *upper,
- int *lower_row, int *rows_used)
-{
- struct tm tm_lower, tm_upper;
- int lmin, umin;
- int lrow;
-
- /* Lower */
-
- tm_lower = *localtime (&time_lower);
-
- if ((tm_lower.tm_min % fullday->interval) != 0) {
- tm_lower.tm_min -= tm_lower.tm_min % fullday->interval; /* round down */
- mktime (&tm_lower);
- }
-
- /* Upper */
-
- tm_upper = *localtime (&time_upper);
-
- if ((tm_upper.tm_min % fullday->interval) != 0) {
- tm_upper.tm_min += fullday->interval - (tm_upper.tm_min % fullday->interval); /* round up */
- mktime (&tm_upper);
- }
-
- if (lower)
- *lower = tm_lower;
-
- if (upper)
- *upper = tm_upper;
-
- lmin = 60 * tm_lower.tm_hour + tm_lower.tm_min;
- umin = 60 * tm_upper.tm_hour + tm_upper.tm_min;
-
- if (umin == 0) /* midnight of next day? */
- umin = 60 * 24;
-
- lrow = lmin / fullday->interval;
-
- if (lower_row)
- *lower_row = lrow;
-
- if (rows_used)
- *rows_used = (umin - lmin) / fullday->interval;
-}
-
-static void
-child_map (GncalFullDay *fullday, Child *child)
-{
- gdk_window_show (child->window);
- if (child->decor_width)
- gdk_window_show (child->decor_window);
- gtk_widget_show (child->widget); /* OK, not just a map... */
-}
-
-static void
-child_unmap (GncalFullDay *fullday, Child *child)
-{
- gdk_window_hide (child->window);
- gdk_window_hide (child->decor_window);
- if (GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_unmap (child->widget);
-}
-
-static void
-child_set_text_pos (Child *child)
-{
- GtkAllocation allocation;
- int has_focus;
- int handle_size;
-
- has_focus = GTK_WIDGET_HAS_FOCUS (child->widget);
-
- handle_size = (child->ico->recur) ? 0 : HANDLE_SIZE;
-
- allocation.x = handle_size;
- allocation.y = has_focus ? handle_size : 0;
- allocation.width = child->width - handle_size - child->decor_width;
- allocation.height = child->height - (has_focus ? (2 * handle_size) : 0);
-
- gtk_widget_size_request (child->widget, NULL);
- gtk_widget_size_allocate (child->widget, &allocation);
-}
-
-static void
-child_realize (GncalFullDay *fullday, Child *child)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
- GtkWidget *widget;
- GdkColor c;
-
- widget = GTK_WIDGET (fullday);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = child->x;
- attributes.y = child->y;
- attributes.width = child->width - child->decor_width;;
- attributes.height = child->height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.cursor = fullday->up_down_cursor;
- attributes.event_mask = (GDK_EXPOSURE_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_KEY_PRESS_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP | GDK_WA_CURSOR;
- child->window = gdk_window_new (widget->window, &attributes, attributes_mask);
- gdk_window_set_user_data (child->window, widget);
- gtk_style_set_background (widget->style, child->window, GTK_STATE_NORMAL);
- gtk_widget_set_parent_window (child->widget, child->window);
-
- /* Create the decoration window */
- attributes.x = child->x + child->width - child->decor_width;
- attributes.width = child->decor_width ? child->decor_width : 1;
- attributes.height = child->decor_height ? child->decor_height : 1;
- attributes.visual = gdk_imlib_get_visual ();
- attributes.colormap = gdk_imlib_get_colormap ();
- attributes.event_mask = (GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- child->decor_window = gdk_window_new (widget->window, &attributes, attributes_mask);
- gdk_color_white (gdk_imlib_get_colormap (), &c);
- gdk_window_set_background (child->decor_window, &c);
- gdk_window_set_user_data (child->decor_window, widget);
-
- if (!pixmap_bell){
- GdkImlibImage *imlib_bell, *imlib_recur;
- GdkPixmap *mask;
-
- imlib_bell = gdk_imlib_create_image_from_xpm_data (bell_xpm);
- gdk_imlib_render (imlib_bell, DECOR_WIDTH, DECOR_HEIGHT);
- pixmap_bell = gdk_imlib_move_image (imlib_bell);
- mask = gdk_imlib_move_mask (imlib_bell);
- gdk_imlib_destroy_image (imlib_bell);
- fullday->bell_gc = gdk_gc_new (child->decor_window);
- if (mask)
- gdk_gc_set_clip_mask (fullday->bell_gc, mask);
-
- imlib_recur = gdk_imlib_create_image_from_xpm_data (recur_xpm);
- gdk_imlib_render (imlib_recur, DECOR_WIDTH, DECOR_HEIGHT);
- pixmap_recur = gdk_imlib_move_image (imlib_recur);
- mask = gdk_imlib_move_mask (imlib_recur);
- gdk_imlib_destroy_image (imlib_recur);
- fullday->recur_gc = gdk_gc_new (child->decor_window);
- if (mask)
- gdk_gc_set_clip_mask (fullday->recur_gc, mask);
- }
- child_set_text_pos (child);
-}
-
-static void
-child_unrealize (GncalFullDay *fullday, Child *child)
-{
- if (GTK_WIDGET_REALIZED (child->widget))
- gtk_widget_unrealize (child->widget);
-
- gdk_window_set_user_data (child->window, NULL);
- gdk_window_destroy (child->window);
- child->window = NULL;
-}
-
-static void
-child_draw_decor (GncalFullDay *fullday, Child *child)
-{
- iCalObject *ico = child->ico;
- int ry = 0;
-
- if (ico->recur) {
- gdk_gc_set_clip_origin (fullday->recur_gc, 0, ry);
- gdk_draw_pixmap (child->decor_window,
- fullday->recur_gc,
- pixmap_recur,
- 0, 0,
- 0, ry,
- DECOR_WIDTH, DECOR_HEIGHT);
- ry += DECOR_HEIGHT;
- }
-
- if (ico->dalarm.enabled || ico->malarm.enabled || ico->palarm.enabled || ico->aalarm.enabled) {
- gdk_gc_set_clip_origin (fullday->bell_gc, 0, ry);
- gdk_draw_pixmap (child->decor_window,
- fullday->bell_gc,
- pixmap_bell,
- 0, 0,
- 0, ry,
- DECOR_WIDTH, DECOR_HEIGHT);
- ry += DECOR_HEIGHT;
- }
-}
-
-static void
-child_draw (GncalFullDay *fullday, Child *child, GdkRectangle *area, GdkWindow *window, int draw_child)
-{
- GdkRectangle arect, rect, dest;
- int has_focus;
-
- has_focus = GTK_WIDGET_HAS_FOCUS (child->widget);
-
- if (!window || (window == child->window)) {
- if (!area) {
- arect.x = 0;
- arect.y = 0;
- arect.width = child->width;
- arect.height = child->height;
-
- area = &arect;
- }
-
- /* Left handle */
-
- rect.x = 0;
- rect.y = has_focus ? HANDLE_SIZE : 0;
- rect.width = HANDLE_SIZE;
- rect.height = has_focus ? (child->height - 2 * HANDLE_SIZE) : child->height;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- view_utils_draw_textured_frame (GTK_WIDGET (fullday), child->window, &rect, GTK_SHADOW_OUT);
-
- if (has_focus) {
- /* Top handle */
-
- rect.x = 0;
- rect.y = 0;
- rect.width = child->width - child->decor_width;
- rect.height = HANDLE_SIZE;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- view_utils_draw_textured_frame (GTK_WIDGET (fullday), child->window,
- &rect, GTK_SHADOW_OUT);
-
- /* Bottom handle */
-
- rect.y = child->height - HANDLE_SIZE;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- view_utils_draw_textured_frame (GTK_WIDGET (fullday), child->window,
- &rect, GTK_SHADOW_OUT);
- }
-
- } else if (!window || (window == child->decor_window)) {
- if (!area) {
- arect.x = 0;
- arect.y = 0;
- arect.width = child->decor_width;
- arect.height = child->decor_height;
-
- area = &arect;
- }
-
- child_draw_decor (fullday, child);
- }
-
- if (draw_child)
- gtk_widget_draw (child->widget, NULL);
-}
-
-static void
-child_range_changed (GncalFullDay *fullday, Child *child)
-{
- struct tm start, end;
- int lower_row, rows_used;
- int f_lower_row;
-
- /* Calc display range for event */
-
- get_tm_range (fullday, child->start, child->end, &start, &end, &lower_row, &rows_used);
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, &f_lower_row, NULL);
-
- child->lower_row = lower_row - f_lower_row;
- child->rows_used = rows_used;
-}
-
-static void
-new_appointment (GtkWidget *widget, gpointer data)
-{
- GncalFullDay *fullday;
- GtkWidget *ee;
- iCalObject *ico;
-
- fullday = GNCAL_FULL_DAY (data);
-
- ico = ical_new ("", user_name, "");
- ico->new = 1;
-
- gncal_full_day_selection_range (fullday, &ico->dtstart, &ico->dtend);
- ee = event_editor_new (fullday->calendar, ico);
- gtk_widget_show (ee);
-}
-
-static void
-edit_appointment (GtkWidget *widget, gpointer data)
-{
- Child *child;
- GtkWidget *ee;
-
- child = data;
-
- ee = event_editor_new (GNCAL_FULL_DAY (child->widget->parent)->calendar, child->ico);
- gtk_widget_show (ee);
-}
-
-static void
-delete_occurance (GtkWidget *widget, gpointer data)
-{
- Child *child = data;
- iCalObject *ical;
- time_t *t;
- GnomeCalendar *gcal = GNCAL_FULL_DAY (child->widget->parent)->calendar;
-
- child = data;
- ical = child->ico;
- t = g_new(time_t, 1);
- *t = child->start;
- ical->exdate = g_list_prepend(ical->exdate, t);
- gnome_calendar_object_changed (gcal, child->ico, CHANGE_DATES);
- save_default_calendar (gcal);
-
-}
-
-static void
-delete_appointment (GtkWidget *widget, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
-
- child = data;
-
- fullday = GNCAL_FULL_DAY (child->widget->parent);
-
- gnome_calendar_remove_object (fullday->calendar, child->ico);
- save_default_calendar (fullday->calendar);
-}
-
-static void
-unrecur_appointment (GtkWidget *widget, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
- iCalObject *new;
-
- child = data;
- fullday = GNCAL_FULL_DAY (child->widget->parent);
-
- /* New object */
- new = ical_object_duplicate (child->ico);
- g_free (new->recur);
- new->recur = 0;
- new->dtstart = child->start;
- new->dtend = child->end;
-
- /* Duplicate, and eliminate the recurrency fields */
- ical_object_add_exdate (child->ico, child->start);
- gnome_calendar_object_changed (fullday->calendar, child->ico, CHANGE_ALL);
-
- gnome_calendar_add_object (fullday->calendar, new);
- save_default_calendar (fullday->calendar);
-}
-
-static void
-child_popup_menu (GncalFullDay *fullday, Child *child, GdkEventButton *event)
-{
- int sensitive, items;
- struct menu_item *context_menu;
-
- static struct menu_item child_items[] = {
- { N_("Edit this appointment..."), (GtkSignalFunc) edit_appointment, NULL, TRUE },
- { N_("Delete this appointment"), (GtkSignalFunc) delete_appointment, NULL, TRUE },
- { NULL, NULL, NULL, TRUE },
- { N_("New appointment..."), (GtkSignalFunc) new_appointment, NULL, TRUE }
- };
-
- static struct menu_item recur_child_items[] = {
- { N_("Make this appointment movable"), (GtkSignalFunc) unrecur_appointment, NULL, TRUE },
- { N_("Edit this appointment..."), (GtkSignalFunc) edit_appointment, NULL, TRUE },
- { N_("Delete this occurance"), (GtkSignalFunc) delete_occurance, NULL, TRUE },
- { N_("Delete all occurances"), (GtkSignalFunc) delete_appointment, NULL, TRUE },
- { NULL, NULL, NULL, TRUE },
- { N_("New appointment..."), (GtkSignalFunc) new_appointment, NULL, TRUE }
- };
-
- sensitive = (child->ico->user_data == NULL);
-
- if (child->ico->recur){
- items = 6;
- context_menu = &recur_child_items[0];
- context_menu[2].data = child;
- context_menu[3].data = child;
- context_menu[3].sensitive = sensitive;
- context_menu[4].data = fullday;
- context_menu[5].data = fullday;
- } else {
- items = 4;
- context_menu = &child_items[0];
- context_menu[3].data = fullday;
- }
- /* These settings are common for each context sensitive menu */
- context_menu[0].data = child;
- context_menu[1].data = child;
- context_menu[0].sensitive = sensitive;
- context_menu[1].sensitive = sensitive;
- context_menu[2].sensitive = sensitive;
-
- popup_menu (context_menu, items, event);
-}
-
-static void
-child_realized_setup (GtkWidget *widget, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
-
- child = data;
- fullday = GNCAL_FULL_DAY (widget->parent);
-
- gdk_window_set_cursor (widget->window, fullday->beam_cursor);
-}
-
-static void
-child_set_pos (GncalFullDay *fullday, Child *child, int x, int y, int width, int height)
-{
- const int decor_width = child->decor_width;
-
- child->x = x;
- child->y = y;
- child->width = width;
- child->height = height;
-
- if (!child->window) /* realized? */
- return;
-
- child_set_text_pos (child);
- gdk_window_move_resize (child->window, x, y, width - decor_width, height);
-
- if (decor_width){
- gdk_window_move_resize (child->decor_window, x + width - decor_width, y,
- decor_width, child->decor_height);
- }
-}
-
-static int
-calc_row_height (GncalFullDay *fullday)
-{
- int f_rows;
- GtkWidget *widget;
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &f_rows);
-
- widget = GTK_WIDGET (fullday);
-
- return (widget->allocation.height - 2 * widget->style->klass->ythickness) / f_rows;
-}
-
-static void
-child_set_size (Child *child)
-{
- int row_height;
- int x, y, width, height;
- GncalFullDay *fullday;
-
- fullday = GNCAL_FULL_DAY (child->widget->parent);
-
- row_height = calc_row_height (fullday);
-
- x = child->x;
- y = child->lower_row * row_height + GTK_WIDGET (fullday)->style->klass->ythickness;
- width = child->width;
- height = child->rows_used * row_height;
-
- if (GTK_WIDGET_HAS_FOCUS (child->widget) && !child->ico->recur) {
- y -= HANDLE_SIZE;
- height += 2 * HANDLE_SIZE;
- }
-
- child_set_pos (fullday, child, x, y, width, height);
-}
-
-static gint
-child_focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- child_set_size (data);
- return FALSE;
-}
-
-static gint
-child_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
- char *text;
-
- child = data;
-
- child_set_size (child);
-
- /* Update summary in calendar object */
-
- text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
- if (child->ico->summary && strcmp (text, child->ico->summary) == 0)
- return FALSE;
-
- if (child->ico->summary)
- g_free (child->ico->summary);
-
- child->ico->summary = text;
-
- /* Notify calendar of change */
-
- fullday = GNCAL_FULL_DAY (widget->parent);
-
- gnome_calendar_object_changed (fullday->calendar, child->ico, CHANGE_SUMMARY);
- save_default_calendar (fullday->calendar);
-
- return FALSE;
-}
-
-static gint
-child_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data)
-{
- if (event->keyval != GDK_Escape)
- return FALSE;
-
- /* If user pressed Esc, un-focus the child by focusing the fullday widget */
-
- gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key_press_event");
- gtk_widget_grab_focus (widget->parent);
-
- return FALSE;
-}
-
-static gint
-child_button_press (GtkWidget *widget, GdkEventButton *event, gpointer data)
-{
- Child *child;
- GncalFullDay *fullday;
-
- if (event->button != 3)
- return FALSE;
-
- child = data;
- fullday = GNCAL_FULL_DAY (widget->parent);
-
- gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "button_press_event");
- gtk_widget_grab_focus (widget);
- child_popup_menu (fullday, child, event);
-
- return TRUE;
-}
-
-/*
- * compute the space required to display the decorations
- */
-static void
-child_compute_decor (Child *child)
-{
- iCalObject *ico = child->ico;
- int rows_used;
-
- child->items = 0;
- rows_used = (child->rows_used < 1) ? 1 : child->rows_used;
- if (ico->recur)
- child->items++;
- if (ico->dalarm.enabled || ico->aalarm.enabled || ico->palarm.enabled || ico->malarm.enabled)
- child->items++;
-
- if (child->items > rows_used){
- child->decor_width = DECOR_WIDTH * 2;
- child->decor_height = DECOR_HEIGHT;
- } else {
- child->decor_width = DECOR_WIDTH * (child->items ? 1 : 0);
- child->decor_height = DECOR_HEIGHT * child->items;
- }
-}
-
-static Child *
-child_new (GncalFullDay *fullday, time_t start, time_t end, iCalObject *ico)
-{
- Child *child;
-
- child = g_new (Child, 1);
-
- child->ico = ico;
- child->widget = gtk_text_new (NULL, NULL);
- child->window = NULL;
- child->x = 0;
- child->y = 0;
- child->width = 0;
- child->height = 0;
- child->start = start;
- child->end = end;
- child_range_changed (fullday, child);
- child_compute_decor (child);
-
- if (ico->summary)
- gtk_text_insert (GTK_TEXT (child->widget), NULL, NULL, NULL,
- ico->summary,
- strlen (ico->summary));
-
- /* We set the i-beam cursor of the text widget upon realization */
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "realize",
- (GtkSignalFunc) child_realized_setup,
- child);
-
- gtk_signal_connect_after (GTK_OBJECT (child->widget), "focus_in_event",
- (GtkSignalFunc) child_focus_in,
- child);
-
- child->focus_out_id = gtk_signal_connect_after (GTK_OBJECT (child->widget), "focus_out_event",
- (GtkSignalFunc) child_focus_out,
- child);
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "key_press_event",
- (GtkSignalFunc) child_key_press,
- child);
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "button_press_event",
- (GtkSignalFunc) child_button_press,
- child);
-
- /* Finish setup */
-
- gtk_text_set_editable (GTK_TEXT (child->widget), TRUE);
- gtk_text_set_word_wrap (GTK_TEXT (child->widget), TRUE);
-
- gtk_widget_set_parent (child->widget, GTK_WIDGET (fullday));
-
- return child;
-}
-
-static void
-squick (GtkWidget *widget, gpointer data)
-{
-}
-
-static void
-child_destroy (GncalFullDay *fullday, Child *child)
-{
- /* Disconnect the focus_out_event signal since we will get such an event
- * from the destroy call.
- */
- gtk_signal_disconnect (GTK_OBJECT (child->widget), child->focus_out_id);
-
- if (GTK_WIDGET_MAPPED (fullday))
- child_unmap (fullday, child);
-
- if (GTK_WIDGET_REALIZED (fullday))
- child_unrealize (fullday, child);
-
- /* Unparent the child widget manually as we don't have a remove method */
-
- gtk_signal_connect (GTK_OBJECT (child->widget), "destroy",
- (GtkSignalFunc) squick,
- NULL);
-
- gtk_widget_unparent (child->widget);
- g_free (child);
-}
-
-static int
-calc_labels_width (GncalFullDay *fullday)
-{
- struct tm cur, upper;
- time_t tim, time_upper;
- int width, max_w;
- char buf[40];
-
- get_tm_range (fullday, fullday->lower, fullday->upper, &cur, &upper, NULL, NULL);
-
- max_w = 0;
-
- tim = mktime (&cur);
- time_upper = mktime (&upper);
-
- while (tim < time_upper) {
- if (am_pm_flag)
- strftime (buf, sizeof (buf), "%I:%M%p", &cur);
- else
- strftime (buf, sizeof (buf), "%H:%M", &cur);
-
-
- width = gdk_string_width (GTK_WIDGET (fullday)->style->font, buf);
-
- if (width > max_w)
- max_w = width;
-
- cur.tm_min += fullday->interval;
- tim = mktime (&cur);
- }
-
- return max_w;
-}
-
-/* Used with layout_events(), takes in a list element and returns the start and end times for the
- * event corresponding to that element.
- */
-static void
-child_layout_query_func (GList *event, time_t *start, time_t *end)
-{
- Child *child;
-
- child = event->data;
-
- *start = child->start;
- *end = child->end;
-}
-
-/* Takes the list of children in the full day view and lays them out nicely without overlapping.
- * Basically it calls the layout_events() function in layout.c and resizes the fullday's children.
- */
-static void
-layout_children (GncalFullDay *fullday)
-{
- GtkWidget *widget;
- GList *children;
- Child *child;
- int num_slots;
- int *allocations;
- int *slots;
- int left_x;
- int usable_pixels, pixels_per_col, extra_pixels;
- int i;
-
- if (!fullday->children)
- return;
-
- layout_events (fullday->children, child_layout_query_func, &num_slots, &allocations, &slots);
-
- /* Set the size and position of each child */
-
- widget = GTK_WIDGET (fullday);
- left_x = 2 * (widget->style->klass->xthickness + TEXT_BORDER) + calc_labels_width (fullday);
-
- usable_pixels = widget->allocation.width - left_x - widget->style->klass->xthickness;
- pixels_per_col = usable_pixels / num_slots;
- extra_pixels = usable_pixels % num_slots;
-
- for (children = fullday->children, i = 0; children; children = children->next, i++) {
- child = children->data;
-
- child->x = left_x + pixels_per_col * allocations[i];
- child->width = pixels_per_col * slots[i];
-
- if ((allocations[i] + slots[i]) == num_slots)
- child->width += extra_pixels;
-
- child_set_size (child);
- }
-
- g_free (allocations);
- g_free (slots);
-}
-
-guint
-gncal_full_day_get_type (void)
-{
- static guint full_day_type = 0;
-
- if (!full_day_type) {
- GtkTypeInfo full_day_info = {
- "GncalFullDay",
- sizeof (GncalFullDay),
- sizeof (GncalFullDayClass),
- (GtkClassInitFunc) gncal_full_day_class_init,
- (GtkObjectInitFunc) gncal_full_day_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- full_day_type = gtk_type_unique (gtk_container_get_type (), &full_day_info);
- }
-
- return full_day_type;
-}
-
-static void
-gncal_full_day_class_init (GncalFullDayClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- fullday_signals[RANGE_ACTIVATED] =
- gtk_signal_new ("range_activated",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GncalFullDayClass, range_activated),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, fullday_signals, LAST_SIGNAL);
-
- object_class->destroy = gncal_full_day_destroy;
-
- widget_class->map = gncal_full_day_map;
- widget_class->unmap = gncal_full_day_unmap;
- widget_class->realize = gncal_full_day_realize;
- widget_class->unrealize = gncal_full_day_unrealize;
- widget_class->draw = gncal_full_day_draw;
- widget_class->draw_focus = gncal_full_day_draw_focus;
- widget_class->size_request = gncal_full_day_size_request;
- widget_class->size_allocate = gncal_full_day_size_allocate;
- widget_class->button_press_event = gncal_full_day_button_press;
- widget_class->button_release_event = gncal_full_day_button_release;
- widget_class->motion_notify_event = gncal_full_day_motion;
- widget_class->expose_event = gncal_full_day_expose;
- widget_class->key_press_event = gncal_full_day_key_press;
- widget_class->focus_in_event = gncal_full_day_focus_in;
- widget_class->focus_out_event = gncal_full_day_focus_out;
-
- container_class->forall = gncal_full_day_forall;
-
- class->range_activated = range_activated;
-}
-
-static void
-gncal_full_day_init (GncalFullDay *fullday)
-{
- GTK_WIDGET_UNSET_FLAGS (fullday, GTK_NO_WINDOW);
- GTK_WIDGET_SET_FLAGS (fullday, GTK_CAN_FOCUS);
-
- fullday->calendar = NULL;
-
- fullday->lower = 0;
- fullday->upper = 0;
- fullday->interval = 30; /* 30 minutes by default */
-
- fullday->children = NULL;
- fullday->drag_info = g_new0 (struct drag_info, 1);
-
- fullday->up_down_cursor = NULL;
- fullday->beam_cursor = NULL;
- fullday->recur_gc = NULL;
- fullday->bell_gc = NULL;
-}
-
-/* Destroys all the children in the full day widget */
-static void
-destroy_children (GncalFullDay *fullday)
-{
- GList *children;
-
- for (children = fullday->children; children; children = children->next)
- child_destroy (fullday, children->data);
-
- g_list_free (fullday->children);
- fullday->children = NULL;
-}
-
-static void
-gncal_full_day_destroy (GtkObject *object)
-{
- GncalFullDay *fullday;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (object));
-
- fullday = GNCAL_FULL_DAY (object);
-
- destroy_children (fullday);
-
- g_free (fullday->drag_info);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-GtkWidget *
-gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper)
-{
- GncalFullDay *fullday;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- fullday = gtk_type_new (gncal_full_day_get_type ());
-
- fullday->calendar = calendar;
-
- gncal_full_day_set_bounds (fullday, lower, upper);
-
- return GTK_WIDGET (fullday);
-}
-
-static void
-gncal_full_day_map (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- gdk_window_show (widget->window);
-
- for (children = fullday->children; children; children = children->next)
- child_map (fullday, children->data);
-}
-
-static void
-gncal_full_day_unmap (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- gdk_window_hide (widget->window);
-
- for (children = fullday->children; children; children = children->next)
- child_unmap (fullday, children->data);
-}
-
-static void
-gncal_full_day_realize (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GdkWindowAttr attributes;
- gint attributes_mask;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.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)
- | GDK_EXPOSURE_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_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);
- gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_PRELIGHT]);
-
- fullday->up_down_cursor = gdk_cursor_new (GDK_DOUBLE_ARROW);
- fullday->beam_cursor = gdk_cursor_new (GDK_XTERM);
-
- for (children = fullday->children; children; children = children->next)
- child_realize (fullday, children->data);
-
-}
-
-static void
-gncal_full_day_unrealize (GtkWidget *widget)
-{
- GncalFullDay *fullday;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- fullday = GNCAL_FULL_DAY (widget);
-
- for (children = fullday->children; children; children = children->next)
- child_unrealize (fullday, children->data);
-
- gdk_cursor_destroy (fullday->up_down_cursor);
- fullday->up_down_cursor = NULL;
-
- gdk_cursor_destroy (fullday->beam_cursor);
- fullday->beam_cursor = NULL;
-
- if (fullday->bell_gc)
- gdk_gc_destroy (fullday->bell_gc);
- if (fullday->recur_gc)
- gdk_gc_destroy (fullday->recur_gc);
-
- if (pixmap_bell){
- gdk_pixmap_unref (pixmap_bell);
- pixmap_bell = NULL;
- }
-
- if (pixmap_recur){
- gdk_pixmap_unref (pixmap_recur);
- pixmap_recur = NULL;
- }
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-struct paint_info {
- GtkWidget *widget;
- struct drag_info *di;
- GdkRectangle *area;
- int x1, y1, width, height;
- int labels_width;
- int row_height;
- struct tm start_tm;
-};
-
-static void
-paint_row (GncalFullDay *fullday, int row, struct paint_info *p)
-{
- GdkRectangle rect, dest;
- GdkGC *left_gc, *right_gc, *text_gc;
- int begin_row, end_row;
- struct tm tm;
- char buf[40];
-
- begin_row = (day_begin * 60) / fullday->interval;
- end_row = (day_end * 60) / fullday->interval;
-
- /* See which GCs we will use */
-
- if ((p->di->sel_rows_used != 0)
- && (row >= p->di->sel_start_row)
- && (row < (p->di->sel_start_row + p->di->sel_rows_used))) {
- left_gc = p->widget->style->bg_gc[GTK_STATE_SELECTED];
- right_gc = left_gc;
- text_gc = p->widget->style->fg_gc[GTK_STATE_SELECTED];
- } else if ((row < begin_row) || (row >= end_row)) {
- left_gc = p->widget->style->bg_gc[GTK_STATE_NORMAL];
- right_gc = p->widget->style->bg_gc[GTK_STATE_ACTIVE];
- text_gc = p->widget->style->fg_gc[GTK_STATE_NORMAL];
- } else {
- left_gc = p->widget->style->bg_gc[GTK_STATE_NORMAL];
- right_gc = p->widget->style->bg_gc[GTK_STATE_PRELIGHT];
- text_gc = p->widget->style->fg_gc[GTK_STATE_NORMAL];
- }
-
- /* Left background and text */
-
- rect.x = p->x1;
- rect.y = p->y1 + row * p->row_height;
- rect.width = 2 * TEXT_BORDER + p->labels_width;
- rect.height = p->row_height - 1;
-
- if (gdk_rectangle_intersect (&rect, p->area, &dest)) {
- gdk_draw_rectangle (p->widget->window,
- left_gc,
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- tm = p->start_tm;
- tm.tm_min += row * fullday->interval;
- mktime (&tm);
-
- if (am_pm_flag)
- strftime (buf, sizeof (buf), "%I:%M%p", &tm);
- else
- strftime (buf, sizeof (buf), "%H:%M", &tm);
-
- gdk_draw_string (p->widget->window,
- p->widget->style->font,
- text_gc,
- rect.x + TEXT_BORDER,
- rect.y + TEXT_BORDER + p->widget->style->font->ascent,
- buf);
- }
-
- /* Right background */
-
- rect.x += rect.width + p->widget->style->klass->xthickness;
- rect.width = p->width - (rect.x - p->x1);
-
- if (gdk_rectangle_intersect (&rect, p->area, &dest))
- gdk_draw_rectangle (p->widget->window,
- right_gc,
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- /* Horizontal division at bottom of row */
-
- rect.x = p->x1;
- rect.y += rect.height;
- rect.width = p->width;
- rect.height = 1;
-
- if (gdk_rectangle_intersect (&rect, p->area, &dest))
- gdk_draw_line (p->widget->window,
- p->widget->style->black_gc,
- rect.x, rect.y,
- rect.x + rect.width - 1, rect.y);
-}
-
-static void
-paint_back (GncalFullDay *fullday, GdkRectangle *area)
-{
- struct paint_info p;
- int start_row, end_row;
- int i;
- GdkRectangle rect, dest, aarea;
- int f_rows;
- int draw_focus;
-
- p.widget = GTK_WIDGET (fullday);
- p.di = fullday->drag_info;
-
- if (!area) {
- area = &aarea;
-
- area->x = 0;
- area->y = 0;
- area->width = p.widget->allocation.width;
- area->height = p.widget->allocation.height;
- }
- p.area = area;
-
- p.x1 = p.widget->style->klass->xthickness;
- p.y1 = p.widget->style->klass->ythickness;
- p.width = p.widget->allocation.width - 2 * p.x1;
- p.height = p.widget->allocation.height - 2 * p.y1;
-
- p.labels_width = calc_labels_width (fullday);
- p.row_height = calc_row_height (fullday);
- get_tm_range (fullday, fullday->lower, fullday->upper, &p.start_tm, NULL, NULL, &f_rows);
-
- /* Frame shadow */
-
- rect.x = 0;
- rect.y = 0;
- rect.width = p.widget->allocation.width;
- rect.height = p.widget->style->klass->ythickness;
-
- draw_focus = gdk_rectangle_intersect (&rect, area, &dest);
-
- if (!draw_focus) {
- rect.y = p.widget->allocation.height - rect.height;
-
- draw_focus = gdk_rectangle_intersect (&rect, area, &dest);
- }
-
- if (!draw_focus) {
- rect.y = p.widget->style->klass->ythickness;
- rect.width = p.widget->style->klass->xthickness;
- rect.height = p.widget->allocation.height - 2 * rect.y;
-
- draw_focus = gdk_rectangle_intersect (&rect, area, &dest);
- }
-
- if (!draw_focus) {
- rect.x = p.widget->allocation.width - rect.width;
-
- draw_focus = gdk_rectangle_intersect (&rect, area, &dest);
- }
-
- if (draw_focus)
- gtk_widget_draw_focus (p.widget);
-
- /* Rows */
-
- start_row = (area->y - p.y1) / p.row_height;
- end_row = (area->y + area->height - 1 - p.y1) / p.row_height;
-
- if (end_row >= f_rows)
- end_row = f_rows - 1;
-
- for (i = start_row; i <= end_row; i++)
- paint_row (fullday, i, &p);
-
- /* Slack area at bottom of widget */
-
- rect.x = p.x1;
- rect.y = p.y1 + f_rows * p.row_height;
- rect.width = p.width;
- rect.height = p.height - (rect.y - p.y1);
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- gdk_draw_rectangle (p.widget->window,
- p.widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- dest.x, dest.y,
- dest.width, dest.height);
-
- /* Vertical division */
-
- rect.x = p.x1 + 2 * TEXT_BORDER + p.labels_width;
- rect.y = p.y1;
- rect.width = p.widget->style->klass->xthickness;
- rect.height = p.height;
-
- if (gdk_rectangle_intersect (&rect, area, &dest))
- gtk_draw_vline (p.widget->style, p.widget->window,
- GTK_STATE_NORMAL,
- rect.y,
- rect.y + rect.height - 1,
- rect.x);
-}
-
-static void
-paint_back_rows (GncalFullDay *fullday, int start_row, int rows_used)
-{
- int row_height;
- int xthickness, ythickness;
- GtkWidget *widget;
- GdkRectangle area;
-
- widget = GTK_WIDGET (fullday);
-
- row_height = calc_row_height (fullday);
-
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
-
- area.x = xthickness;
- area.y = ythickness + start_row * row_height;
- area.width = widget->allocation.width - 2 * xthickness;
- area.height = rows_used * row_height;
-
- paint_back (fullday, &area);
-}
-
-static void
-gncal_full_day_draw (GtkWidget *widget, GdkRectangle *area)
-{
- GncalFullDay *fullday;
- GList *children;
- Child *child;
- GdkRectangle rect, dest;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (area != NULL);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- paint_back (fullday, area);
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- rect.x = child->x;
- rect.y = child->y;
- rect.width = child->width;
- rect.height = child->height;
-
- if (gdk_rectangle_intersect (&rect, area, &dest)) {
- child_draw (fullday, child, NULL, NULL, TRUE);
- }
- }
-}
-
-static void
-gncal_full_day_draw_focus (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return;
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_IN,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gdk_draw_rectangle (widget->window,
- widget->style->black_gc,
- FALSE,
- 0, 0,
- widget->allocation.width - 1,
- widget->allocation.height - 1);
-}
-
-static void
-gncal_full_day_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- GncalFullDay *fullday;
- int labels_width;
- int rows;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (requisition != NULL);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- /* Border and min width */
-
- labels_width = calc_labels_width (fullday);
-
- requisition->width = 2 * widget->style->klass->xthickness + 4 * TEXT_BORDER + labels_width + MIN_WIDTH;
- requisition->height = 2 * widget->style->klass->ythickness;
-
- /* Rows */
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &rows);
-
- requisition->height += (rows * (2 * TEXT_BORDER + widget->style->font->ascent + widget->style->font->descent)
- + (rows - 1)); /* division lines */
-}
-
-static void
-gncal_full_day_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- GncalFullDay *fullday;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- layout_children (fullday);
-}
-
-static Child *
-find_child_by_window (GncalFullDay *fullday, GdkWindow *window, int *on_text)
-{
- GList *children;
- Child *child;
- GtkWidget *owner;
-
- *on_text = FALSE;
-
- gdk_window_get_user_data (window, (gpointer *) &owner);
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (child->window == window || child->decor_window == window)
- return child;
-
- if (child->widget == owner) {
- *on_text = TRUE;
- return child;
- }
- }
-
- return NULL;
-}
-
-static void
-draw_xor_rect (GncalFullDay *fullday)
-{
- GtkWidget *widget;
- struct drag_info *di;
- int i;
- int row_height;
- int ythickness;
-
- widget = GTK_WIDGET (fullday);
-
- gdk_gc_set_function (widget->style->white_gc, GDK_INVERT);
- gdk_gc_set_subwindow (widget->style->white_gc, GDK_INCLUDE_INFERIORS);
-
- ythickness = widget->style->klass->ythickness;
-
- di = fullday->drag_info;
-
- row_height = calc_row_height (fullday);
-
- for (i = 0; i < XOR_RECT_WIDTH; i++)
- gdk_draw_rectangle (widget->window,
- widget->style->white_gc,
- FALSE,
- di->child->x + i,
- di->child_start_row * row_height + ythickness + i,
- di->child->width - 2 * i - 1,
- di->child_rows_used * row_height - 2 - 2 * i);
-
- gdk_gc_set_function (widget->style->white_gc, GDK_COPY);
- gdk_gc_set_subwindow (widget->style->white_gc, GDK_CLIP_BY_CHILDREN);
-}
-
-static int
-get_row_from_y (GncalFullDay *fullday, int y, int round)
-{
- GtkWidget *widget;
- int row_height;
- int f_rows;
- int ythickness;
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &f_rows);
-
- row_height = calc_row_height (fullday);
-
- widget = GTK_WIDGET (fullday);
-
- ythickness = widget->style->klass->ythickness;
-
- y -= ythickness;
-
- if (y < 0)
- y = 0;
- else if (y >= (f_rows * row_height))
- y = f_rows * row_height - 1;
-
- if (round)
- y += row_height / 2;
-
- y /= row_height;
-
- if (y > f_rows)
- y = f_rows; /* note that this is 1 more than the last row's index */
-
- return y;
-}
-
-static int
-button_1 (GncalFullDay *fullday, GdkEventButton *event)
-{
- GtkWidget *widget;
- Child *child;
- int on_text;
- struct drag_info *di;
- gint y;
- int row_height;
- int has_focus;
- int old_start_row, old_rows_used;
- int old_max;
- int paint_start_row, paint_rows_used;
-
- widget = GTK_WIDGET (fullday);
-
- if (event->window == widget->window) {
- /* Clicked on main window */
-
- if (!GTK_WIDGET_HAS_FOCUS (widget))
- gtk_widget_grab_focus (widget);
-
- /* Prepare for drag */
-
- di = fullday->drag_info;
-
- di->drag_mode = DRAG_SELECT;
-
- old_start_row = di->sel_start_row;
- old_rows_used = di->sel_rows_used;
-
- di->sel_click_row = get_row_from_y (fullday, event->y, FALSE);
- di->sel_start_row = di->sel_click_row;
- di->sel_rows_used = 1;
-
- di->click_time = event->time;
-
- gdk_pointer_grab (widget->window, FALSE,
- (GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_RELEASE_MASK),
- NULL,
- fullday->up_down_cursor,
- event->time);
-
- if (old_rows_used == 0) {
- paint_start_row = di->sel_start_row;
- paint_rows_used = di->sel_rows_used;
- } else {
- paint_start_row = MIN (old_start_row, di->sel_start_row);
- old_max = old_start_row + old_rows_used - 1;
- paint_rows_used = MAX (old_max, di->sel_start_row) - paint_start_row + 1;
- }
-
- paint_back_rows (fullday, paint_start_row, paint_rows_used);
-
- return TRUE;
- } else {
- /* Clicked on a child? */
-
- child = find_child_by_window (fullday, event->window, &on_text);
-
- if (!child || on_text || child->ico->recur)
- return FALSE;
-
- /* Prepare for drag */
-
- di = fullday->drag_info;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- has_focus = GTK_WIDGET_HAS_FOCUS (child->widget);
-
- if (has_focus) {
- if (event->y < HANDLE_SIZE)
- di->drag_mode = DRAG_SIZE_TOP;
- else if (event->y >= (child->height - HANDLE_SIZE))
- di->drag_mode = DRAG_SIZE_BOTTOM;
- else
- di->drag_mode = DRAG_MOVE;
- } else
- di->drag_mode = DRAG_MOVE;
-
- row_height = calc_row_height (fullday);
-
- di->child = child;
-
- di->child_click_y = event->y;
- di->child_start_row = child->lower_row;
- di->child_rows_used = child->rows_used;
-
- gdk_pointer_grab (child->window, FALSE,
- (GDK_BUTTON_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_RELEASE_MASK),
- NULL,
- fullday->up_down_cursor,
- event->time);
-
- draw_xor_rect (fullday);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static int
-button_3 (GncalFullDay *fullday, GdkEventButton *event)
-{
- static struct menu_item main_items[] = {
- { N_("New appointment..."), (GtkSignalFunc) new_appointment, NULL, TRUE }
- };
-
- GtkWidget *widget;
- Child *child;
- int on_text;
-
- widget = GTK_WIDGET (fullday);
-
- if (event->window == widget->window) {
- /* Clicked on main window */
-
- if (!GTK_WIDGET_HAS_FOCUS (widget))
- gtk_widget_grab_focus (widget);
-
- main_items[0].data = fullday;
-
- popup_menu (main_items, sizeof (main_items) / sizeof (main_items[0]), event);
-
- return TRUE;
- } else {
- child = find_child_by_window (fullday, event->window, &on_text);
-
- if (!child || on_text)
- return FALSE;
-
- child_popup_menu (fullday, child, event);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- GncalFullDay *fullday;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- switch (event->button) {
- case 1:
- return button_1 (fullday, event);
-
- case 3:
- return button_3 (fullday, event);
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-static void
-recompute_motion (GncalFullDay *fullday, int y)
-{
- struct drag_info *di;
- int f_rows;
- int row;
- int has_focus;
-
- di = fullday->drag_info;
-
- get_tm_range (fullday, fullday->lower, fullday->upper, NULL, NULL, NULL, &f_rows);
-
- switch (di->drag_mode) {
- case DRAG_SELECT:
- row = get_row_from_y (fullday, y, FALSE);
-
- if (row >= f_rows)
- row = f_rows - 1;
-
- if (row < di->sel_click_row) {
- di->sel_start_row = row;
- di->sel_rows_used = di->sel_click_row - row + 1;
- } else {
- di->sel_start_row = di->sel_click_row;
- di->sel_rows_used = row - di->sel_start_row + 1;
- }
-
- break;
-
- case DRAG_MOVE:
- has_focus = GTK_WIDGET_HAS_FOCUS (di->child->widget);
-
- if (has_focus)
- child_focus_out (di->child->widget, NULL, di->child);
-
- row = get_row_from_y (fullday, y - di->child_click_y + (has_focus ? HANDLE_SIZE : 0), TRUE);
-
- if (row > (f_rows - di->child_rows_used))
- row = f_rows - di->child_rows_used;
-
- di->child_start_row = row;
-
- break;
-
- case DRAG_SIZE_TOP:
- has_focus = GTK_WIDGET_HAS_FOCUS (di->child->widget);
-
- if (has_focus)
- child_focus_out (di->child->widget, NULL, di->child);
-
- row = get_row_from_y (fullday, y + HANDLE_SIZE, TRUE);
-
- if (row > (di->child_start_row + di->child_rows_used - 1))
- row = di->child_start_row + di->child_rows_used - 1;
-
- di->child_rows_used = (di->child_start_row + di->child_rows_used) - row;
- di->child_start_row = row;
-
- break;
-
- case DRAG_SIZE_BOTTOM:
- has_focus = GTK_WIDGET_HAS_FOCUS (di->child->widget);
-
- if (has_focus)
- child_focus_out (di->child->widget, NULL, di->child);
-
- row = get_row_from_y (fullday, y - HANDLE_SIZE, TRUE);
-
- if (row <= di->child_start_row)
- row = di->child_start_row + 1;
- else if (row > f_rows)
- row = f_rows;
-
- di->child_rows_used = row - di->child_start_row;
-
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-static void
-get_time_from_rows (GncalFullDay *fullday, int start_row, int rows_used, time_t *t_lower, time_t *t_upper)
-{
- struct tm tm;
- int row_height;
-
- get_tm_range (fullday, fullday->lower, fullday->upper, &tm, NULL, NULL, NULL);
-
- row_height = calc_row_height (fullday);
-
- tm.tm_min += fullday->interval * start_row;
- *t_lower = mktime (&tm);
-
- tm.tm_min += fullday->interval * rows_used;
- *t_upper = mktime (&tm);
-}
-
-static void
-update_from_drag_info (GncalFullDay *fullday)
-{
- struct drag_info *di;
- GtkWidget *widget;
-
- di = fullday->drag_info;
-
- widget = GTK_WIDGET (fullday);
-
- get_time_from_rows (fullday, di->child_start_row, di->child_rows_used,
- &di->child->ico->dtstart,
- &di->child->ico->dtend);
-
- child_range_changed (fullday, di->child);
-
- /* Notify calendar of change */
-
- gnome_calendar_object_changed (fullday->calendar, di->child->ico, CHANGE_DATES);
- save_default_calendar (fullday->calendar);
-}
-
-static gint
-gncal_full_day_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- GncalFullDay *fullday;
- struct drag_info *di;
- gint y;
- int retval;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- di = fullday->drag_info;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- retval = FALSE;
-
- switch (di->drag_mode) {
- case DRAG_NONE:
- break;
-
- case DRAG_SELECT:
- if ((event->time - di->click_time) < UNSELECT_TIMEOUT)
- di->sel_rows_used = 0;
- else
- recompute_motion (fullday, y);
-
- gdk_pointer_ungrab (event->time);
-
- paint_back_rows (fullday, di->sel_start_row, MAX (di->sel_rows_used, 1));
-
- retval = TRUE;
- break;
-
- case DRAG_MOVE:
- case DRAG_SIZE_TOP:
- case DRAG_SIZE_BOTTOM:
- draw_xor_rect (fullday);
- recompute_motion (fullday, y);
- gdk_pointer_ungrab (event->time);
-
- update_from_drag_info (fullday);
-
- di->child_rows_used = 0;
-
- retval = TRUE;
- break;
-
- default:
- g_assert_not_reached ();
- }
-
- di->drag_mode = DRAG_NONE;
- di->child = NULL;
-
- return retval;
-}
-
-static gint
-gncal_full_day_motion (GtkWidget *widget, GdkEventMotion *event)
-{
- GncalFullDay *fullday;
- struct drag_info *di;
- gint y;
- int old_min, old_max;
- int new_min, new_max;
- int new_start_row, new_rows_used;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
- di = fullday->drag_info;
-
- gtk_widget_get_pointer (widget, NULL, &y);
-
- switch (di->drag_mode) {
- case DRAG_NONE:
- break;
-
- case DRAG_SELECT:
- old_min = di->sel_start_row;
- old_max = di->sel_start_row + di->sel_rows_used - 1;
-
- recompute_motion (fullday, y);
-
- new_min = di->sel_start_row;
- new_max = di->sel_start_row + di->sel_rows_used - 1;
-
- new_start_row = MIN (old_min, new_min);
- new_rows_used = MAX (old_max, new_max) - new_start_row + 1;
-
- paint_back_rows (fullday, new_start_row, new_rows_used);
-
- return TRUE;
-
- case DRAG_MOVE:
- case DRAG_SIZE_TOP:
- case DRAG_SIZE_BOTTOM:
- draw_xor_rect (fullday);
- recompute_motion (fullday, y);
- draw_xor_rect (fullday);
-
- return TRUE;
-
- default:
- g_assert_not_reached ();
- }
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- GncalFullDay *fullday;
- Child *child;
- int on_text;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return FALSE;
-
- fullday = GNCAL_FULL_DAY (widget);
-
- if (event->window == widget->window)
- paint_back (fullday, &event->area);
- else {
- child = find_child_by_window (fullday, event->window, &on_text);
-
- if (child && !on_text)
- child_draw (fullday, child, &event->area, event->window, FALSE);
- }
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_key_press (GtkWidget *widget, GdkEventKey *event)
-{
- GncalFullDay *fullday;
- struct drag_info *di;
- GList *children;
- Child *child;
- gint pos;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- fullday = GNCAL_FULL_DAY (widget);
-
- di = fullday->drag_info;
-
- if (di->sel_rows_used == 0)
- return FALSE;
-
- if (event->keyval == GDK_Return) {
- gtk_signal_emit (GTK_OBJECT (fullday), fullday_signals[RANGE_ACTIVATED]);
- return TRUE;
- }
-
- /*
- * If a non-printable key was pressed, bail. Otherwise, begin
- * editing the appointment.
- */
- if ((event->keyval < 0x20) || (event->keyval > 0xFF)
- || (event->length == 0) || (event->state & GDK_CONTROL_MASK)
- || (event->state & GDK_MOD1_MASK))
- return FALSE;
-
- gtk_signal_emit (GTK_OBJECT (fullday),
- fullday_signals[RANGE_ACTIVATED]);
-
- /*
- * Find the new child, which should hopefully be focused, and
- * insert the keypress.
- */
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (GTK_WIDGET_HAS_FOCUS (child->widget)) {
- pos = gtk_text_get_length (GTK_TEXT (child->widget));
-
- gtk_editable_insert_text (GTK_EDITABLE (child->widget),
- event->string,
- event->length,
- &pos);
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_focus_in (GtkWidget *widget, GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
- return FALSE;
-}
-
-static gint
-gncal_full_day_focus_out (GtkWidget *widget, GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
- return FALSE;
-}
-
-static void
-gncal_full_day_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data)
-{
- GncalFullDay *fullday;
- GList *children;
- Child *child;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (container));
- g_return_if_fail (callback != NULL);
-
- fullday = GNCAL_FULL_DAY (container);
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- (*callback) (child->widget, callback_data);
- }
-}
-
-static gint
-child_compare (gconstpointer a, gconstpointer b)
-{
- const Child *ca = a;
- const Child *cb = b;
- time_t diff;
-
- diff = ca->start - cb->start;
-
- if (diff == 0)
- diff = cb->end - ca->end;
-
- return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
-}
-
-static int
-fullday_add_children (iCalObject *obj, time_t start, time_t end, void *c)
-{
- GncalFullDay *fullday = c;
- Child *child;
-
- child = child_new (fullday, start, end, obj);
- fullday->children = g_list_insert_sorted (fullday->children, child, child_compare);
-
- return 1;
-}
-
-void
-gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags)
-{
- GList *children;
- Child *child;
-
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (fullday));
-
- if (!fullday->calendar->cal)
- return;
-
- /* Try to find child that changed */
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (child->ico == ico)
- break;
- }
-
- /* If child was found and nothing but the summary changed, we can just paint the child and return */
-
- if (children && !(flags & ~CHANGE_SUMMARY)) {
- child_draw (fullday, child, NULL, NULL, TRUE);
- return;
- }
-
- /* We have to regenerate and layout our list of children */
-
- destroy_children (fullday);
-
- calendar_iterate (fullday->calendar->cal,
- fullday->lower,
- fullday->upper,
- fullday_add_children,
- fullday);
-
- layout_children (fullday);
-
- /* Realize and map children */
-
- for (children = fullday->children; children; children = children->next) {
- if (GTK_WIDGET_REALIZED (fullday))
- child_realize (fullday, children->data);
-
- if (GTK_WIDGET_MAPPED (fullday))
- child_map (fullday, children->data);
- }
-
- gtk_widget_draw (GTK_WIDGET (fullday), NULL);
-}
-
-void
-gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper)
-{
- struct drag_info *di;
-
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (fullday));
-
- if ((lower != fullday->lower) || (upper != fullday->upper)) {
- fullday->lower = lower;
- fullday->upper = upper;
-
- di = fullday->drag_info;
-
- di->sel_rows_used = 0; /* clear selection */
-
- gncal_full_day_update (fullday, NULL, 0);
- }
-}
-
-int
-gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper)
-{
- struct drag_info *di;
- time_t alower, aupper;
-
- g_return_val_if_fail (fullday != NULL, FALSE);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (fullday), FALSE);
-
- di = fullday->drag_info;
-
- if (di->sel_rows_used == 0){
- time_t now = time (NULL);
- struct tm tm = *localtime (&now);
- struct tm thisd = *localtime (&fullday->lower);
-
- thisd.tm_hour = tm.tm_hour;
- thisd.tm_min = tm.tm_min;
- thisd.tm_sec = 0;
- *lower = mktime (&thisd);
- thisd.tm_hour++;
- *upper = mktime (&thisd);
- return FALSE;
- }
-
- get_time_from_rows (fullday, di->sel_start_row, di->sel_rows_used, &alower, &aupper);
-
- if (lower)
- *lower = alower;
-
- if (upper)
- *upper= aupper;
-
- return TRUE;
-}
-
-void
-gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico)
-{
- GList *children;
- Child *child;
-
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (ico != NULL);
-
- for (children = fullday->children; children; children = children->next) {
- child = children->data;
-
- if (child->ico == ico) {
- gtk_widget_grab_focus (child->widget);
- break;
- }
- }
-}
-
-int
-gncal_full_day_get_day_start_yoffset (GncalFullDay *fullday)
-{
- GtkWidget *widget;
- int begin_row;
-
- g_return_val_if_fail (fullday != NULL, 0);
- g_return_val_if_fail (GNCAL_IS_FULL_DAY (fullday), 0);
-
- widget = GTK_WIDGET (fullday);
-
- begin_row = (day_begin * 60) / fullday->interval;
-
- return widget->style->klass->ythickness + begin_row * calc_row_height (fullday);
-}
-
-static void
-range_activated (GncalFullDay *fullday)
-{
- struct drag_info *di;
-
- g_return_if_fail (fullday != NULL);
- g_return_if_fail (GNCAL_IS_FULL_DAY (fullday));
-
- di = fullday->drag_info;
-
- /* Remove selection; at this point someone should already have added an appointment */
-
- di->sel_rows_used = 0;
-
- paint_back (fullday, NULL);
-}
diff --git a/calendar/gui/gncal-full-day.h b/calendar/gui/gncal-full-day.h
deleted file mode 100644
index 287c5f63f6..0000000000
--- a/calendar/gui/gncal-full-day.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Full day widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef GNCAL_FULL_DAY_H
-#define GNCAL_FULL_DAY_H
-
-
-#include <gtk/gtkcontainer.h>
-#include <libgnome/gnome-defs.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_FULL_DAY(obj) GTK_CHECK_CAST (obj, gncal_full_day_get_type (), GncalFullDay)
-#define GNCAL_FULL_DAY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_full_day_get_type (), GncalFullDayClass)
-#define GNCAL_IS_FULL_DAY(obj) GTK_CHECK_TYPE (obj, gncal_full_day_get_type ())
-
-
-typedef struct _GncalFullDay GncalFullDay;
-typedef struct _GncalFullDayClass GncalFullDayClass;
-
-struct _GncalFullDay {
- GtkContainer container;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- time_t lower; /* lower time to display */
- time_t upper; /* upper time to display */
- int interval; /* interval between rows in minutes */
-
- GList *children; /* container children */
- gpointer drag_info; /* internal drag information */
-
- GdkCursor *up_down_cursor; /* for dragging children */
- GdkCursor *beam_cursor; /* for the text widgets */
- GdkGC *recur_gc; /* The gc used to draw the recur image */
- GdkGC *bell_gc; /* The gc used to draw on imlib windows */
-
-};
-
-struct _GncalFullDayClass {
- GtkContainerClass parent_class;
-
- void (* range_activated) (GncalFullDay *fullday);
-};
-
-
-guint gncal_full_day_get_type (void);
-GtkWidget *gncal_full_day_new (GnomeCalendar *calendar, time_t lower, time_t upper);
-
-void gncal_full_day_update (GncalFullDay *fullday, iCalObject *ico, int flags);
-void gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper);
-
-/* Returns the selected range in lower and upper. If nothing is
- * selected, return value is FALSE, otherwise it is TRUE.
- * The lower and upper values are always set to proper values, regardless of
- * the selection value
- */
-int gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper);
-
-void gncal_full_day_focus_child (GncalFullDay *fullday, iCalObject *ico);
-
-int gncal_full_day_get_day_start_yoffset (GncalFullDay *fullday);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/gncal-todo.c b/calendar/gui/gncal-todo.c
deleted file mode 100644
index 3be3ac4517..0000000000
--- a/calendar/gui/gncal-todo.c
+++ /dev/null
@@ -1,877 +0,0 @@
-/* To-do widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#include <config.h>
-#include <string.h>
-#include <gnome.h>
-#include "gncal-todo.h"
-#include "main.h"
-#include "popup-menu.h"
-#include "eventedit.h"
-
-int todo_show_due_date = 0;
-int todo_show_priority = 0;
-int todo_show_time_remaining = 0;
-
-int todo_item_dstatus_highlight_overdue = 0;
-int todo_item_dstatus_highlight_due_today = 0;
-int todo_item_dstatus_highlight_not_due_yet = 0;
-
-
-char *todo_overdue_font_text;
-gint todo_current_sort_column = 0;
-gint todo_current_sort_type = GTK_SORT_ASCENDING;
-
-gboolean todo_style_changed =0;
-gboolean todo_list_autoresize = 1;
-gboolean todo_list_redraw_in_progess = 0;
-static void gncal_todo_init (GncalTodo *todo);
-
-
-guint
-gncal_todo_get_type (void)
-{
- static guint todo_type = 0;
-
- if (!todo_type) {
- GtkTypeInfo todo_info = {
- "GncalTodo",
- sizeof (GncalTodo),
- sizeof (GncalTodoClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) gncal_todo_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- todo_type = gtk_type_unique (gtk_vbox_get_type (), &todo_info);
- }
-
- return todo_type;
-}
-
-static void
-ok_button (GtkWidget *widget, GnomeDialog *dialog)
-{
- iCalObject *ico;
- GncalTodo *todo;
- GtkEntry *entry;
- GnomeDateEdit *due_date;
- GtkText *comment;
- GtkSpinButton *priority;
-
- ico = gtk_object_get_user_data (GTK_OBJECT (dialog));
-
- todo = GNCAL_TODO (gtk_object_get_data (GTK_OBJECT (dialog), "gncal_todo"));
- entry = GTK_ENTRY (gtk_object_get_data (GTK_OBJECT (dialog), "summary_entry"));
- due_date = GNOME_DATE_EDIT (gtk_object_get_data(GTK_OBJECT(dialog), "due_date"));
- priority = GTK_SPIN_BUTTON (gtk_object_get_data(GTK_OBJECT(dialog), "priority"));
- comment = GTK_TEXT(gtk_object_get_data (GTK_OBJECT(dialog), "comment"));
- if (ico->summary)
- g_free (ico->summary);
- if (ico->comment)
- g_free (ico->comment);
- ico->dtend = gnome_date_edit_get_date (due_date);
- ico->summary = g_strdup (gtk_entry_get_text (entry));
- ico->priority = gtk_spin_button_get_value_as_int (priority);
- ico->comment = gtk_editable_get_chars( GTK_EDITABLE(comment), 0, -1);
- ico->user_data = NULL;
-
- if (ico->new) {
- gnome_calendar_add_object (todo->calendar, ico);
- ico->new = FALSE;
- } else
- gnome_calendar_object_changed (todo->calendar, ico, CHANGE_ALL); /* ok, summary only... */
-
- save_default_calendar (todo->calendar);
- gtk_widget_destroy (GTK_WIDGET (dialog));
-}
-
-static void
-cancel_button (GtkWidget *widget, GnomeDialog *dialog)
-{
- iCalObject *ico;
-
- ico = gtk_object_get_user_data (GTK_OBJECT (dialog));
-
- ico->user_data = NULL;
-
- if (ico->new)
- ical_object_destroy (ico);
-
- gtk_widget_destroy (GTK_WIDGET (dialog));
-
-
-}
-
-static gint
-delete_event (GtkWidget *widget, GdkEvent *event, GnomeDialog *dialog)
-{
- cancel_button (NULL, dialog);
- return TRUE;
-}
-
-static void
-simple_todo_editor (GncalTodo *todo, iCalObject *ico)
-{
- GtkWidget *dialog;
- GtkWidget *hbox;
- GtkWidget *due_box;
- GtkWidget *due_label;
- GtkWidget *due_entry;
- GtkWidget *comment_box;
- GtkWidget *comment_label;
- GtkWidget *comment_text;
- GtkWidget *comment_internal_box;
- GtkWidget *comment_sep;
- GtkWidget *w;
- GtkWidget *pri_box;
- GtkWidget *pri_label;
- GtkWidget *pri_spin;
- GtkObject *pri_adj;
-
- GtkWidget *entry;
-
- dialog = gnome_dialog_new (ico->new ? _("Create to-do item") : _("Edit to-do item"),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
- gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (todo->calendar));
- hbox = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (hbox), 4);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
-
- due_box = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (due_box), 4);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), due_box, FALSE, FALSE, 0);
- gtk_widget_show (due_box);
-
- pri_box = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (pri_box), 4);
- gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)->vbox), pri_box, FALSE, FALSE, 0);
- gtk_widget_show (pri_box);
-
- comment_box = gtk_hbox_new (FALSE, 4);
- gtk_container_border_width (GTK_CONTAINER (comment_box), 4);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), comment_box, FALSE, FALSE, 0);
- gtk_widget_show (comment_box);
-
- comment_internal_box = gtk_vbox_new(FALSE,2);
- gtk_container_border_width (GTK_CONTAINER (comment_internal_box), 4);
-
- gtk_box_pack_start (GTK_BOX (comment_box), comment_internal_box, TRUE, TRUE, 0);
- gtk_widget_show (comment_internal_box);
-
- w = gtk_label_new (_("Summary:"));
- gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- entry = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (entry), ico->summary);
- gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
- gtk_widget_show (entry);
-
-
- due_label = gtk_label_new (_("Due Date:"));
- gtk_box_pack_start (GTK_BOX (due_box), due_label, FALSE, FALSE, 0);
- gtk_widget_show (due_label);
-
- due_entry = gtk_entry_new ();
- due_entry = date_edit_new (ico->dtend, TRUE);
- gtk_box_pack_start (GTK_BOX (due_box), due_entry, TRUE, TRUE, 0);
- gtk_widget_show (due_entry);
-
- pri_label = gtk_label_new (_("Priority:"));
- gtk_box_pack_start (GTK_BOX (pri_box), pri_label, FALSE, FALSE, 0);
- gtk_widget_show (pri_label);
-
- pri_adj = gtk_adjustment_new (5.0, 1.0, 9.0, 1.0, 3.0, 0.0);
- pri_spin = gtk_spin_button_new (GTK_ADJUSTMENT(pri_adj), 0.0, 0);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (pri_spin), TRUE);
- gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (pri_spin), FALSE);
- gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (pri_spin), FALSE);
- gtk_box_pack_start (GTK_BOX (pri_box), pri_spin, FALSE, FALSE, 0);
- gtk_widget_show (pri_spin);
-
- comment_sep = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (comment_box), comment_sep, FALSE, FALSE, 0);
- gtk_widget_show(comment_sep);
-
- comment_label = gtk_label_new (_("Item Comments:"));
- gtk_label_set_justify(GTK_LABEL(comment_label), GTK_JUSTIFY_LEFT);
- gtk_box_pack_start (GTK_BOX (comment_internal_box), comment_label, TRUE, TRUE, 0);
- gtk_widget_show (comment_label);
-
-
-
-
- comment_text = gtk_text_new (NULL, NULL);
- gtk_text_set_editable (GTK_TEXT (comment_text), TRUE);
- gtk_text_set_word_wrap( GTK_TEXT(comment_text), TRUE);
- gtk_text_freeze(GTK_TEXT(comment_text));
- if(ico->comment) {
- gtk_text_insert(GTK_TEXT(comment_text), NULL, NULL, NULL, ico->comment, strlen(ico->comment));
- }
- gtk_text_thaw(GTK_TEXT(comment_text));
- gtk_box_pack_start (GTK_BOX (comment_internal_box), comment_text, FALSE, TRUE, 0);
- gtk_widget_show (comment_text);
-
- ico->user_data = dialog;
-
- gtk_object_set_user_data (GTK_OBJECT (dialog), ico);
-
- gtk_object_set_data (GTK_OBJECT (dialog), "gncal_todo", todo);
- gtk_object_set_data (GTK_OBJECT (dialog), "summary_entry", entry);
- gtk_object_set_data (GTK_OBJECT (dialog), "due_date", due_entry);
- gtk_object_set_data (GTK_OBJECT (dialog), "priority", pri_spin);
- gtk_object_set_data (GTK_OBJECT (dialog), "comment", comment_text);
-
- gnome_dialog_button_connect (GNOME_DIALOG (dialog), 0, (GtkSignalFunc) ok_button, dialog);
- gnome_dialog_button_connect (GNOME_DIALOG (dialog), 1, (GtkSignalFunc) cancel_button, dialog);
-
- gtk_signal_connect (GTK_OBJECT (dialog), "delete_event",
- (GtkSignalFunc) delete_event,
- dialog);
-
- gnome_dialog_set_default (GNOME_DIALOG (dialog), 0);
- gnome_dialog_editable_enters (GNOME_DIALOG (dialog), GTK_EDITABLE(entry));
-
- gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
- gtk_widget_show (dialog);
- gtk_widget_grab_focus (entry);
-}
-
-static iCalObject *
-get_clist_selected_ico (GtkCList *clist)
-{
- gint sel;
-
- if (!clist->selection)
- return NULL;
-
- sel = GPOINTER_TO_INT(clist->selection->data);
-
- return gtk_clist_get_row_data (clist, sel);
-}
-
-static void
-add_todo (GncalTodo *todo)
-{
- iCalObject *ico;
-
- ico = ical_new ("", user_name, "");
- ico->type = ICAL_TODO;
- ico->new = TRUE;
-
- simple_todo_editor (todo, ico);
-}
-
-static void
-edit_todo (GncalTodo *todo)
-{
- simple_todo_editor (todo, get_clist_selected_ico (todo->clist));
-}
-
-static void
-delete_todo (GncalTodo *todo)
-{
- gnome_calendar_remove_object (todo->calendar, get_clist_selected_ico (todo->clist));
- save_default_calendar (todo->calendar);
-
-}
-
-static void
-add_activated (GtkWidget *widget, GncalTodo *todo)
-{
- GtkWidget *w;
-
- while ((w = gtk_grab_get_current ()) != NULL)
- gtk_grab_remove (w);
-
- add_todo (todo);
-}
-
-static void
-edit_activated (GtkWidget *widget, GncalTodo *todo)
-{
- GtkWidget *w;
-
- while ((w = gtk_grab_get_current ()) != NULL)
- gtk_grab_remove (w);
-
- edit_todo (todo);
-}
-
-static void
-delete_activated (GtkWidget *widget, GncalTodo *todo)
-{
- delete_todo (todo);
-}
-
-
-static void
-clist_row_selected (GtkCList *clist, gint row, gint column, GdkEventButton *event, GncalTodo *todo)
-{
- static struct menu_item items[] = {
- { N_("Add to-do item..."), (GtkSignalFunc) add_activated, NULL, TRUE },
- { N_("Edit this item..."), (GtkSignalFunc) edit_activated, NULL, TRUE },
- { N_("Delete this item"), (GtkSignalFunc) delete_activated, NULL, TRUE }
- };
-
- int i;
-
- gtk_widget_set_sensitive (todo->edit_button, (todo->clist->selection != NULL));
- gtk_widget_set_sensitive (todo->delete_button, (todo->clist->selection != NULL));
-
- if (!event)
- return;
-
- switch (event->button) {
- case 1:
- if (event->type == GDK_2BUTTON_PRESS)
- edit_todo (todo);
- break;
-
- case 3:
- for (i = 0; i < (sizeof (items) / sizeof (items[0])); i++)
- items[i].data = todo;
-
- popup_menu (items, sizeof (items) / sizeof (items[0]), event);
- break;
-
- default:
- break;
- }
-}
-
-/*
- * once we get a call back stating that a column
- * has been resized never ever automatically resize again
- */
-void
-column_resized (GtkWidget *widget, GncalTodo *todo)
-{
- /* disabling autoresize of columns */
- if (todo_list_autoresize && !todo_list_redraw_in_progess){
- todo_list_autoresize = 0;
- }
-}
-
-/*
- * restore the previously set settings for sorting the
- * todo list
- */
-static void
-init_column_sorting (GtkCList *clist)
-{
-
- /* due date isn't shown so we can't sort by it */
- if (todo_current_sort_column == 1 && ! todo_show_due_date)
- todo_current_sort_column = 0;
-
- clist->sort_type = todo_current_sort_type;
- clist->sort_column = todo_current_sort_column;
-
- gtk_clist_set_sort_column (clist, todo_current_sort_column);
- gtk_clist_sort (clist);
-}
-
-static void
-todo_click_column (GtkCList *clist, gint column, gpointer data)
-{
- if (column == clist->sort_column)
- {
- if (clist->sort_type == GTK_SORT_ASCENDING) {
- clist->sort_type = GTK_SORT_DESCENDING;
- todo_current_sort_type = GTK_SORT_DESCENDING;
- } else {
- clist->sort_type = GTK_SORT_ASCENDING;
- todo_current_sort_type = GTK_SORT_ASCENDING;
- }
- }
- else {
- gtk_clist_set_sort_column (clist, column);
- todo_current_sort_column = column;
- }
-
- gtk_clist_sort (clist);
-
- /*
- * save the sorting preferences cause I hate to have the user
- * click twice
- */
-
- gnome_config_set_int("/calendar/Todo/sort_column", todo_current_sort_column);
- gnome_config_set_int("/calendar/Todo/sort_type", todo_current_sort_type);
- gnome_config_sync();
-}
-
-static void
-gncal_todo_init (GncalTodo *todo)
-{
- GtkWidget *w;
- GtkWidget *sw;
- GtkWidget *hbox;
- gchar *titles[4] = {
- N_("Summary"),
- N_("Due Date"),
- N_("Priority"),
- N_("Time Left")
- };
- char *tmp[4];
- tmp[0] = _(titles[0]);
- tmp[1] = _(titles[1]);
- tmp[2] = _(titles[2]);
- tmp[3] = _(titles[3]);
-
- gtk_box_set_spacing (GTK_BOX (todo), 4);
-
- /* Label */
-
- w = gtk_label_new (_("To-do list"));
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (todo), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- /* Clist */
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (todo), sw, TRUE, TRUE, 0);
- gtk_widget_show (sw);
-
-
- w = gtk_clist_new_with_titles(4, tmp);
-
- todo->clist = GTK_CLIST (w);
- gtk_clist_set_selection_mode (todo->clist, GTK_SELECTION_BROWSE);
-
- gtk_signal_connect (GTK_OBJECT (todo->clist), "select_row",
- (GtkSignalFunc) clist_row_selected,
- todo);
- gtk_clist_set_button_actions (todo->clist, 2, GTK_BUTTON_SELECTS);
- gtk_signal_connect (GTK_OBJECT (todo->clist), "resize_column",
- (GtkSignalFunc) column_resized,
- todo);
- gtk_signal_connect (GTK_OBJECT (todo->clist), "click_column",
- (GtkSignalFunc) todo_click_column, NULL);
-
- gtk_container_add (GTK_CONTAINER (sw), w);
- gtk_widget_show (w);
-
- /* Box for buttons */
-
- hbox = gtk_hbox_new (TRUE, 4);
- gtk_box_pack_start (GTK_BOX (todo), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- /* Add */
-
- w = gtk_button_new_with_label (_("Add..."));
- gtk_signal_connect (GTK_OBJECT (w), "clicked",
- (GtkSignalFunc) add_activated,
- todo);
- gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
- gtk_widget_show (w);
-
- /* Edit */
-
- w = gtk_button_new_with_label (_("Edit..."));
- todo->edit_button = w;
- gtk_widget_set_sensitive (w, FALSE);
- gtk_signal_connect (GTK_OBJECT (w), "clicked",
- (GtkSignalFunc) edit_activated,
- todo);
- gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
- gtk_widget_show (w);
-
- /* Delete */
-
- w = gtk_button_new_with_label (_("Delete"));
- todo->delete_button = w;
- gtk_widget_set_sensitive (w, FALSE);
- gtk_signal_connect (GTK_OBJECT (w), "clicked",
- (GtkSignalFunc) delete_activated,
- todo);
- gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
- gtk_widget_show (w);
-}
-
-GtkWidget *
-gncal_todo_new (GnomeCalendar *calendar)
-{
- GncalTodo *todo;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- todo = gtk_type_new (gncal_todo_get_type ());
-
- todo->calendar = calendar;
-
- gncal_todo_update (todo, NULL, 0);
-
- return GTK_WIDGET (todo);
-}
-
-static char *
-convert_time_t_to_char (time_t t)
-{
- char buf[100];
- struct tm tm;
-
- tm = *localtime (&t);
- strftime(buf, sizeof (buf), "%m/%d/%Y", &tm);
-
- return g_strdup (buf);
-}
-
-enum todo_styles {
- TODO_STYLE_OVERDUE,
- TODO_STYLE_DUE_TODAY,
- TODO_STYLE_NOT_DUE
-};
-
-
-enum todo_status {
- TODO_ITEM_DSTATUS_NOT_DUE_YET,
- TODO_ITEM_DSTATUS_DUE_TODAY,
- TODO_ITEM_DSTATUS_OVERDUE,
- TODO_ITEM_DSTATUS_LAST_DUE_STATUS
-};
-typedef enum todo_status todo_status;
-
-static GtkStyle *
-make_todo_style(GncalTodo *todo, todo_status style_type)
-{
- GtkStyle *style = NULL;
- GdkColor style_color;
- int color_prop = 0;
- switch(style_type) {
- case TODO_ITEM_DSTATUS_NOT_DUE_YET:
- color_prop = COLOR_PROP_TODO_NOT_DUE_YET;
- break;
- case TODO_ITEM_DSTATUS_DUE_TODAY:
- color_prop = COLOR_PROP_TODO_DUE_TODAY;
- break;
- case TODO_ITEM_DSTATUS_OVERDUE:
- color_prop = COLOR_PROP_TODO_OVERDUE;
- break;
- case TODO_ITEM_DSTATUS_LAST_DUE_STATUS:
- }
-
- style_color.red = color_props[color_prop].r;
- style_color.green = color_props[color_prop].g;
- style_color.blue = color_props[color_prop].b;
-
- style = gtk_style_copy (GTK_WIDGET (todo->clist)->style);
- style->base[GTK_STATE_NORMAL] = style_color;
- return style;
-}
-
-
-
-
-static
-todo_status todo_item_due_status(time_t *todo_due_time) {
- struct tm due_tm_time;
- struct tm current_time;
- struct tm *temp_tm;
- time_t current_time_val = time(NULL);
- temp_tm = localtime(todo_due_time);
- /* make a copy so it dosen't get over written */
- memcpy(&due_tm_time, temp_tm, sizeof(struct tm));
-
-
- temp_tm = localtime(&current_time_val);
- memcpy(&current_time, temp_tm, sizeof(struct tm));
-
- if(due_tm_time.tm_mon == current_time.tm_mon &&
- due_tm_time.tm_mday == current_time.tm_mday &&
- due_tm_time.tm_year == current_time.tm_year) {
- return TODO_ITEM_DSTATUS_DUE_TODAY;
- }
-
- if((*todo_due_time) < current_time_val) {
- return TODO_ITEM_DSTATUS_OVERDUE;
- }
-
- return TODO_ITEM_DSTATUS_NOT_DUE_YET;
-}
-
-
-enum todo_remaining_time_form {
- TODO_ITEM_REMAINING_WEEKS,
- TODO_ITEM_REMAINING_DAYS,
- TODO_ITEM_REMAINING_HOURS,
- TODO_ITEM_REMAINING_MINUTES,
- TODO_ITEM_REMAINING_SECONDS
-};
-typedef enum todo_remaining_time_form todo_remaining_time_form;
-
-static void
-insert_in_clist (GncalTodo *todo, iCalObject *ico)
-{
- int i;
- char *text[4];
- char time_remaining_buffer[100];
- time_t time_remain;
- todo_remaining_time_form time_remaining_form;
- int sec_in_week = 3600*7*24;
- int sec_in_day = 3600*24;
- int sec_in_hour = 3600;
- int sec_in_minute = 60;
- int weeks = 0;
- int days = 0;
- int hours = 0;
- int minutes = 0;
- int seconds = 0;
-
-
- /* an array for the styles of items */
- static GtkStyle *dstatus_styles[TODO_ITEM_DSTATUS_LAST_DUE_STATUS];
- /* we want to remake the styles when the status is changed,
- also we need to check for the null value in the pointer so we init them
- at startup */
- if (todo_style_changed || !dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]) {
- g_free(dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]);
- g_free(dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE]);
- g_free(dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY]);
-
- dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET] = make_todo_style(todo, TODO_ITEM_DSTATUS_NOT_DUE_YET);
- dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE] = make_todo_style(todo, TODO_ITEM_DSTATUS_OVERDUE);
- dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY] = make_todo_style(todo, TODO_ITEM_DSTATUS_DUE_TODAY);
-
- todo_style_changed = 0;
- }
-
-
-
-
-
- text[0] = ico->summary;
-
- if(todo_show_time_remaining) {
- memset(time_remaining_buffer, 0, 100);
- /* we need to make a string that represents the amount of time remaining
- before this task is due */
-
- /* for right now all I'll do is up to the hours. */
- time_remain = (ico->dtend - time(NULL));
- if(time_remain < 0) {
- text[3] = "Overdue!";
- }
- else {
-
- /* lets determine a decent denomination to display */
- if(time_remain / (sec_in_week))
- {
- /* we have weeks available */
- time_remaining_form = TODO_ITEM_REMAINING_WEEKS;
- weeks = time_remain / sec_in_week;
- days = (time_remain % (sec_in_week))/sec_in_day;
- }
- else if(time_remain / (sec_in_day))
- {
- /* we have days available */
- time_remaining_form = TODO_ITEM_REMAINING_DAYS;
- days = time_remain / sec_in_day;
- hours = (time_remain % sec_in_day)/sec_in_hour;
- }
- else if(time_remain / (sec_in_hour))
- {
- /* we have hours available */
- time_remaining_form = TODO_ITEM_REMAINING_HOURS;
- hours = time_remain /sec_in_hour;
- minutes = (time_remain % sec_in_hour) / sec_in_minute;
- }
- else if(time_remain / sec_in_minute)
- {
- time_remaining_form = TODO_ITEM_REMAINING_MINUTES;
- minutes = time_remain / sec_in_minute;
- seconds = time_remain % sec_in_minute;
- }
- else
- {
- time_remaining_form = TODO_ITEM_REMAINING_SECONDS;
- seconds = time_remain;
- }
-
- switch(time_remaining_form)
- {
- case TODO_ITEM_REMAINING_WEEKS:
- snprintf(time_remaining_buffer, 100, "%d %s %d %s", weeks,
- (weeks > 1) ? _("Weeks") : _("Week"),
- days, (days > 1) ? _("Days") : _("Day"));
- break;
- case TODO_ITEM_REMAINING_DAYS:
- snprintf(time_remaining_buffer, 100, "%d %s %d %s", days,
- (days > 1) ? _("Days") : _("Day"),
- hours, (hours > 1) ? _("Hours") : _("Hour"));
- break;
- case TODO_ITEM_REMAINING_HOURS:
- snprintf(time_remaining_buffer, 100, "%d %s %d %s", hours,
- (hours > 1) ? _("Hours") : _("Hour"),
- minutes, (minutes > 1) ? _("Minutes") : _("Minute"));
- break;
- case TODO_ITEM_REMAINING_MINUTES:
- snprintf(time_remaining_buffer, 100, "%d %s %d %s", minutes,
- (minutes > 1) ? _("Minutes") : _("Minute"),
- seconds, (seconds > 1) ? _("Seconds") : _("Second"));
- break;
- case TODO_ITEM_REMAINING_SECONDS:
- snprintf(time_remaining_buffer, 100, "%d %s", seconds,
- (seconds > 1) ? _("Seconds") : _("Second"));
- break;
- }
- text[3] = g_strdup(time_remaining_buffer);
- todo->data_ptrs = g_slist_append(todo->data_ptrs, text[3]);
- }
-
- }
- else {
- text[3] = "Loose penguini!";
- }
- /*
- * right now column 0 will be the summary
- * and column 1 will be the due date.
- * WISH: this should be able to be changed on the fly
- */
-
- if(ico->dtend && todo_show_due_date)
- {
- text[1] = convert_time_t_to_char (ico->dtend);
- /* Append the data's pointer so later it can be properly freed */
- todo->data_ptrs = g_slist_append (todo->data_ptrs, text[1]);
- }
- else
- text[1] = NULL;
-
- if(ico->priority && todo_show_priority)
- {
- text[2] = g_strdup_printf ("%d", ico->priority);
- todo->data_ptrs = g_slist_append (todo->data_ptrs, text[2]);
- }
- else
- text[2] = NULL;
-
- i = gtk_clist_append (todo->clist, text);
-
- gtk_clist_set_row_data (todo->clist, i, ico);
-
- /*
- * determine if the task is overdue..
- * if so mark with the apropriate style
- */
-
- switch(todo_item_due_status(&ico->dtend)) {
- case TODO_ITEM_DSTATUS_NOT_DUE_YET:
- if(todo_item_dstatus_highlight_not_due_yet)
- {
- gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_NOT_DUE_YET]);
- }
- break;
- case TODO_ITEM_DSTATUS_DUE_TODAY:
- if(todo_item_dstatus_highlight_due_today)
- {
- gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_DUE_TODAY]);
- }
- break;
- case TODO_ITEM_DSTATUS_OVERDUE:
- if(todo_item_dstatus_highlight_overdue)
- {
- gtk_clist_set_row_style(todo->clist, i, dstatus_styles[TODO_ITEM_DSTATUS_OVERDUE]);
- }
- break;
- case TODO_ITEM_DSTATUS_LAST_DUE_STATUS:
- }
-
- /* keep the list in order */
- gtk_clist_sort (todo->clist);
-}
-
-void
-gncal_todo_update (GncalTodo *todo, iCalObject *ico, int flags)
-{
- GList *list;
- GSList *current_list;
-
- g_return_if_fail (todo != NULL);
- g_return_if_fail (GNCAL_IS_TODO (todo));
-
- /*
- * shut down the resize handler cause we are playing with the list.
- * In otherwords turn off the event handler
- */
- todo_list_redraw_in_progess =1;
-
- /* freeze the list */
- gtk_clist_freeze (todo->clist);
- init_column_sorting (todo->clist);
-
- /*
- * before here we have to free some of the memory that
- * stores the due date, or else we have a memory leak.
- * luckily all of the pointers are stored in todo->data_ptrs;
- */
-
- /* check on the columns that we should display */
- /* check for due date */
-
- if(todo_show_due_date) {
- gtk_clist_set_column_visibility (todo->clist, 1, 1);
- }
- else {
- gtk_clist_set_column_visibility (todo->clist, 1, 0);
- }
-
- if(todo_show_time_remaining) {
- gtk_clist_set_column_visibility (todo->clist, 3, 1);
- }
- else {
- gtk_clist_set_column_visibility (todo->clist, 3, 0);
- }
-
-
- if(todo_show_priority)
- gtk_clist_set_column_visibility (todo->clist, 2, 1);
- else
- gtk_clist_set_column_visibility (todo->clist, 2, 0);
-
- /* free the memory locations that were used in the previous display */
- for (current_list = todo->data_ptrs; current_list != NULL; current_list = g_slist_next(current_list)){
- g_free(current_list->data);
- }
-
- /* free the list and clear out the pointer */
- g_slist_free(todo->data_ptrs);
- todo->data_ptrs = NULL;
-
- gtk_clist_clear (todo->clist);
-
- for (list = todo->calendar->cal->todo; list; list = list->next)
- insert_in_clist (todo, list->data);
-
- /* if we are autoresizing then do it now */
- if(todo_list_autoresize && todo->clist->rows != 0)
- gtk_clist_columns_autosize (todo->clist);
-
- gtk_clist_thaw (todo->clist);
-
- gtk_widget_set_sensitive (todo->edit_button, (todo->clist->selection != NULL));
- gtk_widget_set_sensitive (todo->delete_button, (todo->clist->selection != NULL));
- todo_list_redraw_in_progess = 0;
-}
-
-
-
-
-
-
-
-
diff --git a/calendar/gui/gncal-todo.h b/calendar/gui/gncal-todo.h
deleted file mode 100644
index 51cfadea3f..0000000000
--- a/calendar/gui/gncal-todo.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* To-do widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef GNCAL_TODO_H
-#define GNCAL_TODO_H
-
-#include <gtk/gtkclist.h>
-#include <gtk/gtkvbox.h>
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_TODO(obj) GTK_CHECK_CAST (obj, gncal_todo_get_type (), GncalTodo)
-#define GNCAL_TODO_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_todo_get_type (), GncalTodoClass)
-#define GNCAL_IS_TODO(obj) GTK_CHECK_TYPE (obj, gncal_todo_get_type ())
-
-
-typedef struct _GncalTodo GncalTodo;
-typedef struct _GncalTodoClass GncalTodoClass;
-
-struct _GncalTodo {
- GtkVBox vbox;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- GtkCList *clist;
-
- GtkWidget *edit_button;
- GtkWidget *delete_button;
- GSList *data_ptrs;
-
-
-};
-
-struct _GncalTodoClass {
- GtkVBoxClass parent_class;
-};
-
-
-guint gncal_todo_get_type (void);
-GtkWidget *gncal_todo_new (GnomeCalendar *calendar);
-
-void gncal_todo_update (GncalTodo *todo, iCalObject *ico, int flags);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/gncal-week-view.c b/calendar/gui/gncal-week-view.c
deleted file mode 100644
index 888c656ff4..0000000000
--- a/calendar/gui/gncal-week-view.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/* Week view composite widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <quartic@gimp.org>
- * Miguel de Icaza <miguel@kernel.org>
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <string.h>
-#include <gtk/gtk.h>
-#include "gncal-week-view.h"
-#include "main.h"
-#include "timeutil.h"
-
-static void gncal_week_view_init (GncalWeekView *wview);
-
-
-guint
-gncal_week_view_get_type (void)
-{
- static guint week_view_type = 0;
-
- if (!week_view_type) {
- GtkTypeInfo week_view_info = {
- "GncalWeekView",
- sizeof (GncalWeekView),
- sizeof (GncalWeekViewClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) gncal_week_view_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
- };
-
- week_view_type = gtk_type_unique (gtk_vbox_get_type (), &week_view_info);
- }
-
- return week_view_type;
-}
-
-static void
-gncal_week_view_init (GncalWeekView *wview)
-{
- int i;
-
- wview->calendar = NULL;
- memset (&wview->start_of_week, 0, sizeof (wview->start_of_week));
-
- for (i = 0; i < 7; i++)
- wview->days[i] = NULL;
-
- wview->gtk_calendar = NULL;
-}
-
-static void
-jump_to_day (GtkCalendar *cal, GncalWeekView *wview, int day)
-{
- struct tm tm;
- time_t t;
- static int inside;
-
- if (inside)
- return;
- inside = 1;
- tm.tm_mday = day;
- tm.tm_mon = cal->month;
- tm.tm_year = cal->year - 1900;
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_isdst = -1;
- t = mktime (&tm);
-
- gncal_week_view_set (wview, t);
- inside = 0;
-}
-
-static void
-jump_to_day_click (GtkCalendar *cal, GncalWeekView *wview)
-{
- jump_to_day (cal, wview, cal->selected_day);
-}
-
-static void
-sync_week (GtkCalendar *cal, GncalWeekView *wview)
-{
- jump_to_day (cal, wview, wview->start_of_week.tm_mday + 7);
- gnome_calendar_tag_calendar (wview->calendar, wview->gtk_calendar);
-}
-
-static void
-double_click_on_weekday (GtkWidget *widget, GdkEvent *e, GncalWeekView *wview)
-{
-}
-
-GtkWidget *
-gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week)
-{
- GncalWeekView *wview;
- GtkWidget *table;
- int i;
-
- g_return_val_if_fail (calendar != NULL, NULL);
-
- wview = gtk_type_new (gncal_week_view_get_type ());
-
- table = gtk_table_new (0, 0, 0);
- gtk_table_set_homogeneous (GTK_TABLE (table), TRUE);
- wview->label = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (wview), wview->label, 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (wview), table, 1, 1, 0);
- wview->calendar = calendar;
- for (i = 0; i < 7; i++) {
- wview->days[i] = GNCAL_DAY_VIEW (gncal_day_view_new (calendar, 0, 0));
- gtk_signal_connect (GTK_OBJECT (wview->days [i]), "button_press_event",
- GTK_SIGNAL_FUNC(double_click_on_weekday), wview);
-
- if (i < 5)
- gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (wview->days[i]),
- i, i + 1,
- 0, 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
- else
- gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (wview->days[i]),
- i - 2, i - 1,
- 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
-
- gtk_widget_show (GTK_WIDGET (wview->days[i]));
- }
-
- wview->gtk_calendar = GTK_CALENDAR (gtk_calendar_new ());
-
- gtk_signal_connect (GTK_OBJECT (wview->gtk_calendar), "day_selected_double_click",
- GTK_SIGNAL_FUNC(jump_to_day_click), wview);
- gtk_signal_connect (GTK_OBJECT (wview->gtk_calendar), "month_changed",
- GTK_SIGNAL_FUNC(sync_week), wview);
-
- gtk_calendar_display_options (wview->gtk_calendar,
- (GTK_CALENDAR_SHOW_HEADING
- | GTK_CALENDAR_SHOW_DAY_NAMES
- | (week_starts_on_monday
- ? GTK_CALENDAR_WEEK_START_MONDAY : 0)));
-
- gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (wview->gtk_calendar),
- 0, 3,
- 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 4, 4);
- gtk_widget_show (GTK_WIDGET (wview->gtk_calendar));
-
- gncal_week_view_set (wview, start_of_week);
-
- return GTK_WIDGET (wview);
-}
-
-static void
-update (GncalWeekView *wview, int update_days, iCalObject *object, int flags)
-{
- int i;
-
- if (update_days)
- for (i = 0; i < 7; i++)
- gncal_day_view_update (wview->days[i], object, flags);
-
- /* FIXME: update extra widgets */
-}
-
-void
-gncal_week_view_update (GncalWeekView *wview, iCalObject *ico, int flags)
-{
- g_return_if_fail (wview != NULL);
- g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview));
-
- update (wview, TRUE, ico, flags);
-}
-
-void
-gncal_week_view_set (GncalWeekView *wview, time_t start_of_week)
-{
- struct tm tm;
- time_t day_start, day_end, week_start, week_end;
- int i;
-
- g_return_if_fail (wview != NULL);
- g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview));
-
- tm = *localtime (&start_of_week);
-
- /* back up to start of week (Monday) */
-
- tm.tm_mday -= (tm.tm_wday == 0) ? 6 : (tm.tm_wday - 1);
-
- /* Start of day */
-
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- day_start = week_start = mktime (&tm);
-
- /* Calendar */
-
- gtk_calendar_select_month (wview->gtk_calendar, tm.tm_mon, tm.tm_year + 1900);
-
- /* Day views */
-
- for (i = 0; i < 7; i++) { /* rest of days */
- tm.tm_mday++;
- day_end = mktime (&tm);
-
- gncal_day_view_set_bounds (wview->days[i], day_start, day_end - 1);
-
- day_start = day_end;
- }
-
- update (wview, FALSE, NULL, 0);
-
- /* The label */
- {
- char buf [3][100];
-
- week_end = time_add_day (week_start, 6);
-
- strftime (buf[0], sizeof (buf[0]), _("%a %b %d %Y"),
- localtime(&week_start));
-
- strftime (buf[1], sizeof (buf[1]), _("%a %b %d %Y"),
- localtime(&week_end));
-
- g_snprintf(buf[2], sizeof(buf[2]), "%s - %s", buf[0], buf[1]);
- gtk_label_set (GTK_LABEL (wview->label), buf[2]);
-
- }
-}
-
-void
-gncal_week_view_time_format_changed (GncalWeekView *wview)
-{
- g_return_if_fail (wview != NULL);
- g_return_if_fail (GNCAL_IS_WEEK_VIEW (wview));
-
- gtk_calendar_display_options (wview->gtk_calendar,
- (week_starts_on_monday
- ? (wview->gtk_calendar->display_flags
- | GTK_CALENDAR_WEEK_START_MONDAY)
- : (wview->gtk_calendar->display_flags
- & ~GTK_CALENDAR_WEEK_START_MONDAY)));
-}
diff --git a/calendar/gui/gncal-week-view.h b/calendar/gui/gncal-week-view.h
deleted file mode 100644
index ab06161844..0000000000
--- a/calendar/gui/gncal-week-view.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Week view composite widget for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef WEEK_VIEW_H
-#define WEEK_VIEW_H
-
-
-#include <gtk/gtkvbox.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkvbox.h>
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-#include "gncal-day-view.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define GNCAL_WEEK_VIEW(obj) GTK_CHECK_CAST (obj, gncal_week_view_get_type (), GncalWeekView)
-#define GNCAL_WEEK_VIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gncal_week_view_get_type (), GncalWeekViewClass)
-#define GNCAL_IS_WEEK_VIEW(obj) GTK_CHECK_TYPE (obj, gncal_week_view_get_type ())
-
-
-typedef struct _GncalWeekView GncalWeekView;
-typedef struct _GncalWeekViewClass GncalWeekViewClass;
-
-struct _GncalWeekView {
- GtkVBox box;
-
- GnomeCalendar *calendar; /* the calendar we are associated to */
-
- struct tm start_of_week;
-
- GncalDayView *days[7]; /* the day view widgets */
- GtkCalendar *gtk_calendar; /* At least for now; see the FIXME comments in the .c file */
- GtkWidget *label;
-};
-
-struct _GncalWeekViewClass {
- GtkVBoxClass parent_class;
-};
-
-
-guint gncal_week_view_get_type (void);
-GtkWidget *gncal_week_view_new (GnomeCalendar *calendar, time_t start_of_week);
-
-void gncal_week_view_update (GncalWeekView *wview, iCalObject *ico, int flags);
-void gncal_week_view_set (GncalWeekView *wview, time_t start_of_week);
-void gncal_week_view_time_format_changed (GncalWeekView *wview);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/gncal.desktop b/calendar/gui/gncal.desktop
deleted file mode 100644
index 0ffd97e1fe..0000000000
--- a/calendar/gui/gncal.desktop
+++ /dev/null
@@ -1,35 +0,0 @@
-[Desktop Entry]
-Name=Calendar
-Name[da]=Kalender
-Name[de]=Kalender
-Name[el]=Çìåñïëüãéï
-Name[es]=Calendario
-Name[et]=Kalender
-Name[fi]=Kalenteri
-Name[fr]=Calendrier
-Name[ja]=¥«¥ì¥ó¥À¡¼
-Name[ko]=´Þ·Â
-Name[no]=Kalender
-Name[pt]=Agenda
-Name[pt_BR]=Calendário
-Name[ru]=ëÁÌÅÎÄÁÒØ
-Name[sv]=Kalender
-Comment=Calendar application
-Comment[da]=Gnome Kalender
-Comment[de]=Gnome Kalender
-Comment[el]=Çìåñïëüãéï ôïõ Gnome
-Comment[es]=Calendario de Gnome
-Comment[et]=GNOME kalender
-Comment[fi]=GNOME-kalenteri
-Comment[fr]=Calendrier GNOME
-Comment[ja]=GNOME¥«¥ì¥ó¥À¡¼
-Comment[ko]=±×³ð ´Þ·Â
-Comment[no]=Gnome Kalender
-Comment[pt]=Agenda Gnome
-Comment[pt_BR]=Calendário GNOME
-Comment[ru]=ëÁÌÅÎÄÁÒØ Gnome
-Comment[sv]=Gnome-kalender
-Exec=gnomecal
-Icon=gnome-calendar.png
-Terminal=0
-Type=Application
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
deleted file mode 100644
index 9b3479e473..0000000000
--- a/calendar/gui/gnome-cal.c
+++ /dev/null
@@ -1,613 +0,0 @@
-/*
- * GnomeCalendar widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-#include <config.h>
-#include <gnome.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include "calendar.h"
-#include "gnome-cal.h"
-#include "gncal-day-panel.h"
-#include "gncal-week-view.h"
-#include "month-view.h"
-#include "year-view.h"
-#include "timeutil.h"
-#include "main.h"
-#include "corba-cal.h"
-
-GnomeApp *parent_class;
-
-guint
-gnome_calendar_get_type (void)
-{
- static guint gnome_calendar_type = 0;
- if(!gnome_calendar_type) {
- GtkTypeInfo gnome_calendar_info = {
- "GnomeCalendar",
- sizeof(GnomeCalendar),
- sizeof(GnomeCalendarClass),
- (GtkClassInitFunc) NULL,
- (GtkObjectInitFunc) NULL,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
- gnome_calendar_type = gtk_type_unique(gnome_app_get_type(), &gnome_calendar_info);
- parent_class = gtk_type_class (gnome_app_get_type());
- }
- return gnome_calendar_type;
-}
-
-static void
-setup_widgets (GnomeCalendar *gcal)
-{
- time_t now;
-
- now = time (NULL);
-
- gcal->notebook = gtk_notebook_new ();
- gcal->day_view = gncal_day_panel_new (gcal, now);
- gcal->week_view = gncal_week_view_new (gcal, now);
- gcal->month_view = month_view_new (gcal, now);
- gcal->year_view = year_view_new (gcal, now);
-
- gcal->year_view_sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (gcal->year_view_sw),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (gcal->year_view_sw), gcal->year_view);
- GTK_LAYOUT (gcal->year_view)->vadjustment->step_increment = 10.0;
- gtk_adjustment_changed (GTK_ADJUSTMENT (GTK_LAYOUT (gcal->year_view)->vadjustment));
-
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->day_view, gtk_label_new (_("Day View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->week_view, gtk_label_new (_("Week View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->month_view, gtk_label_new (_("Month View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->year_view_sw, gtk_label_new (_("Year View")));
-
- gtk_widget_show_all (gcal->notebook);
-
- gnome_app_set_contents (GNOME_APP (gcal), gcal->notebook);
-}
-
-static GtkWidget *
-get_current_page (GnomeCalendar *gcal)
-{
- return GTK_NOTEBOOK (gcal->notebook)->cur_page->child;
-}
-
-char *
-gnome_calendar_get_current_view_name (GnomeCalendar *gcal)
-{
- GtkWidget *page;
-
- g_return_val_if_fail (gcal != NULL, "dayview");
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), "dayview");
-
- page = get_current_page (gcal);
-
- if (page == gcal->day_view)
- return "dayview";
- else if (page == gcal->week_view)
- return "weekview";
- else if (page == gcal->month_view)
- return "monthview";
- else if (page == gcal->year_view_sw)
- return "yearview";
- else
- return "dayview";
-}
-
-void
-gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time)
-{
- GtkWidget *current;
-
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (new_time != -1);
-
- current = get_current_page (gcal);
- new_time = time_day_begin (new_time);
-
- if (current == gcal->day_view)
- gncal_day_panel_set (GNCAL_DAY_PANEL (gcal->day_view), new_time);
- else if (current == gcal->week_view)
- gncal_week_view_set (GNCAL_WEEK_VIEW (gcal->week_view), new_time);
- else if (current == gcal->month_view)
- month_view_set (MONTH_VIEW (gcal->month_view), new_time);
- else if (current == gcal->year_view_sw)
- year_view_set (YEAR_VIEW (gcal->year_view), new_time);
- else {
- g_warning ("My penguin is gone!");
- g_assert_not_reached ();
- }
-
- gcal->current_display = new_time;
-}
-
-static void
-gnome_calendar_direction (GnomeCalendar *gcal, int direction)
-{
- GtkWidget *cp = get_current_page (gcal);
- time_t new_time;
-
- if (cp == gcal->day_view)
- new_time = time_add_day (time_day_begin (gcal->current_display), 1 * direction);
- else if (cp == gcal->week_view)
- new_time = time_add_week (time_week_begin (gcal->current_display), 1 * direction);
- else if (cp == gcal->month_view)
- new_time = time_add_month (time_month_begin (gcal->current_display), 1 * direction);
- else if (cp == gcal->year_view_sw)
- new_time = time_add_year (time_year_begin (gcal->current_display), 1 * direction);
- else {
- g_warning ("Weee! Where did the penguin go?");
- g_assert_not_reached ();
- new_time = 0;
- }
-
- gnome_calendar_goto (gcal, new_time);
-}
-
-void
-gnome_calendar_next (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- gnome_calendar_direction (gcal, 1);
-}
-
-void
-gnome_calendar_previous (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- gnome_calendar_direction (gcal, -1);
-}
-
-void
-gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- gtk_notebook_set_page (GTK_NOTEBOOK (gcal->notebook), 0);
- gnome_calendar_goto (gcal, time);
-}
-
-void
-gnome_calendar_goto_today (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- gnome_calendar_goto (gcal, time (NULL));
-}
-
-void
-gnome_calendar_set_view (GnomeCalendar *gcal, char *page_name)
-{
- int page = 0;
-
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (page_name != NULL);
-
-
- if (strcmp (page_name, "dayview") == 0)
- page = 0;
- else if (strcmp (page_name, "weekview") == 0)
- page = 1;
- else if (strcmp (page_name, "monthview") == 0)
- page = 2;
- else if (strcmp (page_name, "yearview") == 0)
- page = 3;
- gtk_notebook_set_page (GTK_NOTEBOOK (gcal->notebook), page);
-}
-
-GtkWidget *
-gnome_calendar_new (char *title)
-{
- GtkWidget *retval;
- GnomeCalendar *gcal;
- GnomeApp *app;
-
- retval = gtk_type_new (gnome_calendar_get_type ());
- app = GNOME_APP (retval);
- gcal = GNOME_CALENDAR (retval);
-
- app->name = g_strdup ("calendar");
- app->prefix = g_strconcat ("/", app->name, "/", NULL);
-
- gtk_window_set_title(GTK_WINDOW(retval), title);
-
- gcal->current_display = time_day_begin (time (NULL));
- gcal->cal = calendar_new (title);
- setup_widgets (gcal);
- gnome_calendar_create_corba_server (gcal);
-
- return retval;
-}
-
-static void
-gnome_calendar_update_all (GnomeCalendar *cal, iCalObject *object, int flags)
-{
- gncal_day_panel_update (GNCAL_DAY_PANEL (cal->day_view), object, flags);
- gncal_week_view_update (GNCAL_WEEK_VIEW (cal->week_view), object, flags);
- month_view_update (MONTH_VIEW (cal->month_view), object, flags);
- year_view_update (YEAR_VIEW (cal->year_view), object, flags);
-}
-
-int
-gnome_calendar_load (GnomeCalendar *gcal, char *file)
-{
- char *r;
-
- g_return_val_if_fail (gcal != NULL, 0);
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), 0);
- g_return_val_if_fail (file != NULL, 0);
-
- if ((r = calendar_load (gcal->cal, file)) != NULL){
- printf ("Error loading calendar: %s\n", r);
- return 0;
- }
- gnome_calendar_update_all (gcal, NULL, 0);
- return 1;
-}
-
-void
-gnome_calendar_add_object (GnomeCalendar *gcal, iCalObject *obj)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (obj != NULL);
-
- calendar_add_object (gcal->cal, obj);
- gnome_calendar_update_all (gcal, obj, CHANGE_NEW);
-}
-
-void
-gnome_calendar_remove_object (GnomeCalendar *gcal, iCalObject *obj)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (obj != NULL);
-
- calendar_remove_object (gcal->cal, obj);
- gnome_calendar_update_all (gcal, obj, CHANGE_ALL);
-}
-
-void
-gnome_calendar_object_changed (GnomeCalendar *gcal, iCalObject *obj, int flags)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (obj != NULL);
-
- gcal->cal->modified = TRUE;
-
- gnome_calendar_update_all (gcal, obj, flags);
- calendar_object_changed (gcal->cal, obj, flags);
-}
-
-static int
-max_open_files (void)
-{
- static int files;
-
- if (files)
- return files;
-
- files = sysconf (_SC_OPEN_MAX);
- if (files != -1)
- return files;
-#ifdef OPEN_MAX
- return files = OPEN_MAX;
-#else
- return files = 256;
-#endif
-}
-
-static void
-execute (char *command, int close_standard)
-{
- struct sigaction ignore, save_intr, save_quit;
- int status = 0, i;
- pid_t pid;
-
- ignore.sa_handler = SIG_IGN;
- sigemptyset (&ignore.sa_mask);
- ignore.sa_flags = 0;
-
- sigaction (SIGINT, &ignore, &save_intr);
- sigaction (SIGQUIT, &ignore, &save_quit);
-
- if ((pid = fork ()) < 0){
- fprintf (stderr, "\n\nfork () = -1\n");
- return;
- }
- if (pid == 0){
- pid = fork ();
- if (pid == 0){
- const int top = max_open_files ();
- sigaction (SIGINT, &save_intr, NULL);
- sigaction (SIGQUIT, &save_quit, NULL);
-
- for (i = (close_standard ? 0 : 3); i < top; i++)
- close (i);
-
- /* FIXME: As an excercise to the reader, copy the
- * code from mc to setup shell properly instead of
- * /bin/sh. Yes, this comment is larger than a cut and paste.
- */
- execl ("/bin/sh", "/bin/sh", "-c", command, (char *) 0);
-
- _exit (127);
- } else {
- _exit (127);
- }
- }
- wait (&status);
- sigaction (SIGINT, &save_intr, NULL);
- sigaction (SIGQUIT, &save_quit, NULL);
-}
-
-void
-mail_notify (char *mail_address, char *text, time_t app_time)
-{
- pid_t pid;
- int p [2];
- char *command;
-
- pipe (p);
- pid = fork ();
- if (pid == 0){
- int dev_null;
-
- dev_null = open ("/dev/null", O_RDWR);
- dup2 (p [0], 0);
- dup2 (dev_null, 1);
- dup2 (dev_null, 2);
- execl ("/usr/lib/sendmail", "/usr/lib/sendmail",
- mail_address, NULL);
- _exit (127);
- }
- command = g_strconcat ("To: ", mail_address, "\n",
- "Subject: ", _("Reminder of your appointment at "),
- ctime (&app_time), "\n\n", text, "\n", NULL);
- write (p [1], command, strlen (command));
- close (p [1]);
- close (p [0]);
- g_free (command);
-}
-
-static void
-stop_beeping (GtkObject* object, gpointer data)
-{
- guint timer_tag, beep_tag;
- timer_tag = GPOINTER_TO_INT (gtk_object_get_data (object, "timer_tag"));
- beep_tag = GPOINTER_TO_INT (gtk_object_get_data (object, "beep_tag"));
-
- if (beep_tag > 0) {
- gtk_timeout_remove (beep_tag);
- gtk_object_set_data (object, "beep_tag", GINT_TO_POINTER (0));
- }
- if (timer_tag > 0) {
- gtk_timeout_remove (timer_tag);
- gtk_object_set_data (object, "timer_tag", GINT_TO_POINTER (0));
- }
-}
-
-static gint
-start_beeping (gpointer data)
-{
- gdk_beep ();
-
- return TRUE;
-}
-
-static gint
-timeout_beep (gpointer data)
-{
- stop_beeping (data, NULL);
- return FALSE;
-}
-
-void
-calendar_notify (time_t activation_time, CalendarAlarm *which, void *data)
-{
- iCalObject *ico = data;
- guint beep_tag, timer_tag;
- int ret;
- gchar* snooze_button = (enable_snooze ? _("Snooze") : NULL);
- time_t now, diff;
-
- if (&ico->aalarm == which){
- time_t app = ico->aalarm.trigger + ico->aalarm.offset;
- GtkWidget *w;
- char *msg;
-
- msg = g_strconcat (_("Reminder of your appointment at "),
- ctime (&app), "`",
- ico->summary, "'", NULL);
-
- /* Idea: we need Snooze option :-) */
- w = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_INFO, _("Ok"), snooze_button, NULL);
- beep_tag = gtk_timeout_add (1000, start_beeping, NULL);
- if (enable_aalarm_timeout)
- timer_tag = gtk_timeout_add (audio_alarm_timeout*1000,
- timeout_beep, w);
- else
- timer_tag = 0;
- gtk_object_set_data (GTK_OBJECT (w), "timer_tag",
- GINT_TO_POINTER (timer_tag));
- gtk_object_set_data (GTK_OBJECT (w), "beep_tag",
- GINT_TO_POINTER (beep_tag));
- gtk_widget_ref (w);
- ret = gnome_dialog_run (GNOME_DIALOG (w));
- switch (ret) {
- case 1:
- stop_beeping (GTK_OBJECT (w), NULL);
- now = time (NULL);
- diff = now - which->trigger;
- which->trigger = which->trigger + diff + snooze_secs;
- which->offset = which->offset - diff - snooze_secs;
- alarm_add (which, &calendar_notify, data);
- break;
- default:
- stop_beeping (GTK_OBJECT (w), NULL);
- break;
- }
-
- gtk_widget_unref (w);
- return;
- }
-
- if (&ico->palarm == which){
- execute (ico->palarm.data, 0);
- return;
- }
-
- if (&ico->malarm == which){
- time_t app = ico->malarm.trigger + ico->malarm.offset;
-
- mail_notify (ico->malarm.data, ico->summary, app);
- return;
- }
-
- if (&ico->dalarm == which){
- time_t app = ico->dalarm.trigger + ico->dalarm.offset;
- GtkWidget *w;
- char *msg;
-
- if (beep_on_display)
- gdk_beep ();
- msg = g_strconcat (_("Reminder of your appointment at "),
- ctime (&app), "`",
- ico->summary, "'", NULL);
- w = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_INFO,
- _("Ok"), snooze_button, NULL);
- ret = gnome_dialog_run (GNOME_DIALOG (w));
- switch (ret) {
- case 1:
- now = time (NULL);
- diff = now - which->trigger;
- which->trigger = which->trigger + diff + snooze_secs;
- which->offset = which->offset - diff - snooze_secs;
- alarm_add (which, &calendar_notify, data);
- break;
- default:
- break;
- }
-
- return;
- }
-}
-
-/*
- * called from the calendar_iterate routine to mark the days of a GtkCalendar
- */
-static int
-mark_gtk_calendar_day (iCalObject *obj, time_t start, time_t end, void *c)
-{
- GtkCalendar *gtk_cal = c;
- struct tm tm_s;
- time_t t, day_end;
-
- tm_s = *localtime (&start);
- day_end = time_day_end (end);
-
- for (t = start; t <= day_end; t += 60*60*24){
- time_t new = mktime (&tm_s);
- struct tm tm_day;
-
- tm_day = *localtime (&new);
- gtk_calendar_mark_day (gtk_cal, tm_day.tm_mday);
- tm_s.tm_mday++;
- }
- return TRUE;
-}
-
-/*
- * Tags the dates with appointments in a GtkCalendar based on the
- * GnomeCalendar contents
- */
-void
-gnome_calendar_tag_calendar (GnomeCalendar *cal, GtkCalendar *gtk_cal)
-{
- time_t month_begin, month_end;
- struct tm tm;
-
- g_return_if_fail (cal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (cal));
- g_return_if_fail (gtk_cal != NULL);
- g_return_if_fail (GTK_IS_CALENDAR (gtk_cal));
-
- /* compute month_begin */
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_mday = 1; /* setting this to zero is a no-no; it will set mktime back to the end of the
- previous month, which may be 28,29,30; this may chop some days from the calendar */
- tm.tm_mon = gtk_cal->month;
- tm.tm_year = gtk_cal->year - 1900;
- tm.tm_isdst= -1;
-
- month_begin = mktime (&tm);
- tm.tm_mon++;
- month_end = mktime (&tm);
-
- gtk_calendar_freeze (gtk_cal);
- gtk_calendar_clear_marks (gtk_cal);
- calendar_iterate (cal->cal, month_begin, month_end, mark_gtk_calendar_day, gtk_cal);
- gtk_calendar_thaw (gtk_cal);
-}
-
-void
-gnome_calendar_time_format_changed (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- /* FIXME: the queue resizes will do until we rewrite those views... */
-
- gncal_day_panel_time_format_changed (GNCAL_DAY_PANEL (gcal->day_view));
- gtk_widget_queue_resize (gcal->day_view);
- gncal_week_view_time_format_changed (GNCAL_WEEK_VIEW (gcal->week_view));
- gtk_widget_queue_resize (gcal->week_view);
- month_view_time_format_changed (MONTH_VIEW (gcal->month_view));
- year_view_time_format_changed (YEAR_VIEW (gcal->year_view));
-}
-
-void
-gnome_calendar_colors_changed (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- /* FIXME: add day and week view when they are done */
-
- month_view_colors_changed (MONTH_VIEW (gcal->month_view));
- year_view_colors_changed (YEAR_VIEW (gcal->year_view));
- todo_style_changed = 1;
- todo_list_properties_changed (GNCAL_DAY_PANEL (gcal->day_view));
-}
-
-void
-gnome_calendar_todo_properties_changed (GnomeCalendar *gcal)
-{
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- /* FIXME: add day and week view when they are done */
-
- todo_style_changed = 1;
- todo_list_properties_changed (GNCAL_DAY_PANEL (gcal->day_view));
-}
-
-
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
deleted file mode 100644
index da53f29882..0000000000
--- a/calendar/gui/gnome-cal.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * GnomeCalendar widget
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Author: Miguel de Icaza (miguel@kernel.org)
- */
-
-#ifndef GNOME_CALENDAR_APP_H
-#define GNOME_CALENDAR_APP_H
-
-#include <gnome.h>
-
-#include "calendar.h"
-
-BEGIN_GNOME_DECLS
-
-#define GNOME_CALENDAR(obj) GTK_CHECK_CAST(obj, gnome_calendar_get_type(), GnomeCalendar)
-#define GNOME_CALENDAR_CLASS(class) GTK_CHECK_CAST_CLASS(class, gnome_calendar_get_type(), GnomeCalendarClass)
-#define GNOME_IS_CALENDAR(obj) GTK_CHECK_TYPE(obj, gnome_calendar_get_type())
-
-typedef struct {
- GnomeApp gnome_app;
- Calendar *cal;
- time_t current_display;
-
- GtkWidget *notebook;
- GtkWidget *day_view;
- GtkWidget *week_view;
- GtkWidget *month_view;
- GtkWidget *year_view;
- GtkWidget *year_view_sw;
- void *event_editor;
-} GnomeCalendar;
-
-typedef struct {
- GnomeAppClass parent_class;
-} GnomeCalendarClass;
-
-guint gnome_calendar_get_type (void);
-GtkWidget *gnome_calendar_new (char *title);
-int gnome_calendar_load (GnomeCalendar *gcal,
- char *file);
-void gnome_calendar_add_object (GnomeCalendar *gcal,
- iCalObject *obj);
-void gnome_calendar_remove_object (GnomeCalendar *gcal,
- iCalObject *obj);
-void gnome_calendar_next (GnomeCalendar *gcal);
-void gnome_calendar_previous (GnomeCalendar *gcal);
-void gnome_calendar_goto (GnomeCalendar *gcal,
- time_t new_time);
-void gnome_calendar_dayjump (GnomeCalendar *gcal,
- time_t time);
-/* Jumps to the current day */
-void gnome_calendar_goto_today (GnomeCalendar *gcal);
-void gnome_calendar_tag_calendar (GnomeCalendar *cal,
- GtkCalendar *gtk_cal);
-char *gnome_calendar_get_current_view_name (GnomeCalendar *gcal);
-void gnome_calendar_set_view (GnomeCalendar *gcal,
- char *page_name);
-
-/* Flags is a bitmask of CalObjectChange values */
-void gnome_calendar_object_changed (GnomeCalendar *gcal,
- iCalObject *obj,
- int flags);
-
-GnomeCalendar *gnome_calendar_locate (const char *pathname);
-
-/* Notifies the calendar that the time format has changed and it must update all its views */
-void gnome_calendar_time_format_changed (GnomeCalendar *gcal);
-
-/* Notifies the calendar that the todo list properties have changed and its time to update the views */
-void
-gnome_calendar_colors_changed (GnomeCalendar *gcal);
-
-/* Notifies the calendar that the todo list properties have changed and its time to update the views */
-void
-gnome_calendar_todo_properties_changed (GnomeCalendar *gcal);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/gnome-cal.html b/calendar/gui/gnome-cal.html
deleted file mode 100644
index 5a7d0a537f..0000000000
--- a/calendar/gui/gnome-cal.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!-- Some simple instructions on how to use the help browser -->
-<BODY>
-<!-- <TITLE>GNOME Calendar Documentation</TITLE> -->
-<H2> GNOME Calendar Documentation </H2>
-<p>
-The GNOME calendar program is the calendaring program of the GNOME
-system. It uses the vCalendar standard for transfering calendar
-information (and is also the on-disk format used).
-
-<p>
-
-<a name="cmdline">
-<h2>Command line options</h2>
-
-Several options are available on the command line, they are:
-<ul>
- <li><tt>--events</tt> Displays the events for the date
- specified (or today, if no date is specified).
-
- <li><tt>--from DATE</tt> Define the beginning of the range for
- the event display, or the startup day on the calenday views.
- By default, the event will span the whole day specified in
- DATE.
-
- <li><tt>--to DATE</tt> Define the range end for the event
- display. If this is not specified, it will default to the end
- of the day specified by the <tt>--from</tt> option.
-
- <li><tt>--file FILE</tt> Set the calendar to the FILE
- specified on the command line.
-
- <li><tt>--todo</tt> Dumps the to-do values to standard output.
-</ul>
-
-<p>
-
-DATE is interpreted as being in the local time- zone, unless a
-specific timezone is specified. Examples of valid date specifications
-include: "1 month ago", "2 hours ago", "400000 seconds ago", "last
-year", "last Monday", "yesterday", "a fortnight ago", "3/31/92
-10:00:07 PST", "January 23, 1987 10:05pm", "22:00 GMT".
-
-</BODY>
-
diff --git a/calendar/gui/gnome-calendar-conduit.png b/calendar/gui/gnome-calendar-conduit.png
deleted file mode 100644
index e867ba90b2..0000000000
--- a/calendar/gui/gnome-calendar-conduit.png
+++ /dev/null
Binary files differ
diff --git a/calendar/gui/gnome-month-item.c b/calendar/gui/gnome-month-item.c
deleted file mode 100644
index 58e393e4ee..0000000000
--- a/calendar/gui/gnome-month-item.c
+++ /dev/null
@@ -1,1246 +0,0 @@
-/* General-purpose monthly calendar canvas item for GNOME
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include <math.h>
-#include <time.h>
-#include <gnome.h>
-#include "gnome-month-item.h"
-
-
-#define DEFAULT_FONT "-*-helvetica-medium-r-normal--10-*-*-*-p-*-*-*"
-
-
-/* Number of days in a month, for normal and leap years */
-static const int days_in_month[2][12] = {
- { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
- { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
-};
-
-/* The weird month of September 1752, where 3 Sep through 13 Sep were eliminated due to the
- * Gregorian reformation.
- */
-static const int sept_1752[42] = {
- 0, 0, 1, 2, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0
-};
-
-#define REFORMATION_DAY 639787 /* First day of the reformation, counted from 1 Jan 1 */
-#define MISSING_DAYS 11 /* They corrected out 11 days */
-#define THURSDAY 4 /* First day of reformation */
-#define SATURDAY 6 /* Offset value; 1 Jan 1 was a Saturday */
-#define SEPT_1752_START 2 /* Start day within month */
-#define SEPT_1752_END 20 /* End day within month */
-
-
-enum {
- ARG_0,
- ARG_YEAR,
- ARG_MONTH,
- ARG_X,
- ARG_Y,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_ANCHOR,
- ARG_HEAD_PADDING,
- ARG_DAY_PADDING,
- ARG_DAY_NAMES,
- ARG_HEADING_HEIGHT,
- ARG_HEADING_ANCHOR,
- ARG_DAY_ANCHOR,
- ARG_START_ON_MONDAY,
- ARG_HEAD_FONT,
- ARG_HEAD_FONTSET,
- ARG_HEAD_FONT_GDK,
- ARG_DAY_FONT,
- ARG_DAY_FONTSET,
- ARG_DAY_FONT_GDK,
- ARG_HEAD_COLOR,
- ARG_HEAD_COLOR_GDK,
- ARG_OUTLINE_COLOR,
- ARG_OUTLINE_COLOR_GDK,
- ARG_DAY_BOX_COLOR,
- ARG_DAY_BOX_COLOR_GDK,
- ARG_DAY_COLOR,
- ARG_DAY_COLOR_GDK
-};
-
-
-static void gnome_month_item_class_init (GnomeMonthItemClass *class);
-static void gnome_month_item_init (GnomeMonthItem *mitem);
-static void gnome_month_item_destroy (GtkObject *object);
-static void gnome_month_item_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-static void gnome_month_item_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-
-
-
-static GnomeCanvasGroupClass *parent_class;
-
-
-GtkType
-gnome_month_item_get_type (void)
-{
- static GtkType month_item_type = 0;
-
- if (!month_item_type) {
- GtkTypeInfo month_item_info = {
- "GnomeMonthItem",
- sizeof (GnomeMonthItem),
- sizeof (GnomeMonthItemClass),
- (GtkClassInitFunc) gnome_month_item_class_init,
- (GtkObjectInitFunc) gnome_month_item_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- month_item_type = gtk_type_unique (gnome_canvas_group_get_type (), &month_item_info);
- }
-
- return month_item_type;
-}
-
-static void
-gnome_month_item_class_init (GnomeMonthItemClass *class)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GtkObjectClass *) class;
- item_class = (GnomeCanvasItemClass *) class;
-
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
-
- gtk_object_add_arg_type ("GnomeMonthItem::year", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_YEAR);
- gtk_object_add_arg_type ("GnomeMonthItem::month", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_MONTH);
- gtk_object_add_arg_type ("GnomeMonthItem::x", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X);
- gtk_object_add_arg_type ("GnomeMonthItem::y", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y);
- gtk_object_add_arg_type ("GnomeMonthItem::width", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("GnomeMonthItem::height", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEIGHT);
- gtk_object_add_arg_type ("GnomeMonthItem::anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_ANCHOR);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEAD_PADDING);
- gtk_object_add_arg_type ("GnomeMonthItem::day_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_DAY_PADDING);
- gtk_object_add_arg_type ("GnomeMonthItem::day_names", GTK_TYPE_POINTER, GTK_ARG_WRITABLE, ARG_DAY_NAMES);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_height", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEADING_HEIGHT);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_HEADING_ANCHOR);
- gtk_object_add_arg_type ("GnomeMonthItem::day_anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_DAY_ANCHOR);
- gtk_object_add_arg_type ("GnomeMonthItem::start_on_monday", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_START_ON_MONDAY);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_FONT);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_fontset", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_FONTSET);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_font_gdk", GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_HEAD_FONT_GDK);
- gtk_object_add_arg_type ("GnomeMonthItem::day_font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_FONT);
- gtk_object_add_arg_type ("GnomeMonthItem::day_fontset", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_FONTSET);
- gtk_object_add_arg_type ("GnomeMonthItem::day_font_gdk", GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_DAY_FONT_GDK);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_COLOR);
- gtk_object_add_arg_type ("GnomeMonthItem::heading_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_HEAD_COLOR_GDK);
- gtk_object_add_arg_type ("GnomeMonthItem::outline_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_OUTLINE_COLOR);
- gtk_object_add_arg_type ("GnomeMonthItem::outline_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_OUTLINE_COLOR_GDK);
- gtk_object_add_arg_type ("GnomeMonthItem::day_box_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_BOX_COLOR);
- gtk_object_add_arg_type ("GnomeMonthItem::day_box_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_DAY_BOX_COLOR_GDK);
- gtk_object_add_arg_type ("GnomeMonthItem::day_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_COLOR);
- gtk_object_add_arg_type ("GnomeMonthItem::day_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_DAY_COLOR_GDK);
-
- object_class->destroy = gnome_month_item_destroy;
- object_class->set_arg = gnome_month_item_set_arg;
- object_class->get_arg = gnome_month_item_get_arg;
-}
-
-/* Calculates the minimum heading height based on the heading font size and padding. It also
- * calculates the minimum width of the month item based on the width of the headings.
- */
-static void
-check_heading_sizes (GnomeMonthItem *mitem)
-{
- double m_height;
- double m_width;
- int width;
- int max_width;
- int i;
-
- /* Calculate minimum height */
-
- m_height = mitem->head_font->ascent + mitem->head_font->descent + 2 * mitem->head_padding;
-
- if (mitem->head_height < m_height)
- mitem->head_height = m_height;
-
- /* Go through each heading and remember the widest one */
-
- max_width = 0;
-
- for (i = 0; i < 7; i++) {
- width = gdk_string_width (mitem->head_font, mitem->day_names[i]);
- if (max_width < width)
- max_width = width;
- }
-
- m_width = 7 * (max_width + 2 * mitem->head_padding);
-
- if (mitem->width < m_width)
- mitem->width = m_width;
-}
-
-/* Calculates the minimum width and height of the month item based on the day font size and padding.
- * Assumes that the minimum heading height has already been computed.
- */
-static void
-check_day_sizes (GnomeMonthItem *mitem)
-{
- double m_height;
- double m_width;
- int width;
- int max_width;
- char buf[100];
- int i;
-
- /* Calculate minimum height */
-
- m_height = mitem->head_height + 6 * (mitem->day_font->ascent + mitem->day_font->descent + 2 * mitem->day_padding);
-
- if (mitem->height < m_height)
- mitem->height = m_height;
-
- /* Calculate minimum width */
-
- max_width = 0;
-
- for (i = 1; i < 32; i++) {
- sprintf (buf, "%d", i);
- width = gdk_string_width (mitem->day_font, buf);
- if (max_width < width)
- max_width = width;
- }
-
- m_width = 7 * (max_width + 2 * mitem->day_padding);
-
- if (mitem->width < m_width)
- mitem->width = m_width;
-}
-
-/* Calculates the minimum size of the month item based on the font sizes and paddings. If the
- * current size of the month item is smaller than the required minimum size, this function will
- * change the size to the appropriate values.
- */
-static void
-check_sizes (GnomeMonthItem *mitem)
-{
- check_heading_sizes (mitem);
- check_day_sizes (mitem);
-}
-
-/* Recalculates the position of the toplevel calendar group based on the logical position and anchor */
-static void
-reanchor (GnomeMonthItem *mitem)
-{
- double x, y;
-
- x = mitem->x;
- y = mitem->y;
-
- switch (mitem->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_SW:
- break;
-
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_S:
- x -= mitem->width / 2;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- x -= mitem->width;
- break;
- }
-
- switch (mitem->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_NE:
- break;
-
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_E:
- y -= mitem->height / 2;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- y -= mitem->height;
- break;
- }
-
- /* Explicitly use the canvas group class prefix since the month item class has x and y
- * arguments as well.
- */
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem),
- "GnomeCanvasGroup::x", x,
- "GnomeCanvasGroup::y", y,
- NULL);
-}
-
-/* Takes an anchor specification and the corners of a rectangle, and returns an anchored point with
- * respect to that rectangle.
- */
-static void
-get_label_anchor (GtkAnchorType anchor, double x1, double y1, double x2, double y2, double *x, double *y)
-{
- switch (anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_SW:
- *x = x1;
- break;
-
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_S:
- *x = (x1 + x2) / 2.0;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- *x = x2;
- break;
- }
-
- switch (anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_NE:
- *y = y1;
- break;
-
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_E:
- *y = (y1 + y2) / 2.0;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- *y = y2;
- break;
- }
-}
-
-/* Resets the position of the day name headings in the calendar */
-static void
-reshape_headings (GnomeMonthItem *mitem)
-{
- double width;
- int i;
- double x, y;
-
- width = mitem->width / 7;
-
- for (i = 0; i < 7; i++) {
- /* Group */
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i],
- "x", width * i,
- "y", 0.0,
- NULL);
-
- /* Box */
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_BOX + i],
- "x1", 0.0,
- "y1", 0.0,
- "x2", width,
- "y2", mitem->head_height,
- NULL);
-
- /* Label */
- get_label_anchor (mitem->head_anchor,
- mitem->head_padding,
- mitem->head_padding,
- width - mitem->head_padding,
- mitem->head_height - mitem->head_padding,
- &x, &y);
-
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
- "x", x,
- "y", y,
- "anchor", mitem->head_anchor,
- NULL);
- }
-}
-
-/* Resets the position of the days in the calendar */
-static void
-reshape_days (GnomeMonthItem *mitem)
-{
- double width, height;
- double x, y;
- int row, col;
- int i;
-
- width = mitem->width / 7;
- height = (mitem->height - mitem->head_height) / 6;
-
- i = 0;
-
- for (row = 0; row < 6; row++)
- for (col = 0; col < 7; col++) {
- /* Group */
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i],
- "x", width * col,
- "y", mitem->head_height + height * row,
- NULL);
-
- /* Box */
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_BOX + i],
- "x1", 0.0,
- "y1", 0.0,
- "x2", width,
- "y2", height,
- NULL);
-
- /* Label */
- get_label_anchor (mitem->day_anchor,
- mitem->day_padding,
- mitem->day_padding,
- width - mitem->day_padding,
- height - mitem->day_padding,
- &x, &y);
-
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "x", x,
- "y", y,
- "anchor", mitem->day_anchor,
- NULL);
-
- i++;
- }
-}
-
-/* Changes the positions and resizes the items in the calendar to match the new size of the
- * calendar.
- */
-static void
-reshape (GnomeMonthItem *mitem)
-{
- check_sizes (mitem);
- reanchor (mitem);
- reshape_headings (mitem);
- reshape_days (mitem);
-}
-
-/* Sets the font for all the day headings */
-static void
-set_head_font (GnomeMonthItem *mitem)
-{
- int i;
-
- for (i = 0; i < 7; i++)
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
- "font_gdk", mitem->head_font,
- NULL);
-}
-
-/* Sets the color for all the headings */
-static void
-set_head_color (GnomeMonthItem *mitem)
-{
- int i;
- GdkColor outline;
- GdkColor head;
-
- outline.pixel = mitem->outline_pixel;
- head.pixel = mitem->head_pixel;
-
- for (i = 0; i < 7; i++) {
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_BOX + i],
- "fill_color_gdk", &outline,
- NULL);
-
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
- "fill_color_gdk", &head,
- NULL);
- }
-}
-
-/* Creates the items for the day name headings */
-static void
-create_headings (GnomeMonthItem *mitem)
-{
- int i;
-
- /* Just create the items; they will be positioned and configured by a call to reshape() */
-
- for (i = 0; i < 7; i++) {
- /* Group */
- mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem),
- gnome_canvas_group_get_type (),
- NULL);
-
- /* Box */
- mitem->items[GNOME_MONTH_ITEM_HEAD_BOX + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i]),
- gnome_canvas_rect_get_type (),
- NULL);
-
- /* Label */
- mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i]),
- gnome_canvas_text_get_type (),
- NULL);
- }
-
- set_head_font (mitem);
- set_head_color (mitem);
-}
-
-/* Returns the number of leap years since year 1 up to (but not including) the specified year */
-static int
-leap_years_up_to (int year)
-{
- return (year / 4 /* trivial leapness */
- - ((year > 1700) ? (year / 100 - 17) : 0) /* minus centuries since 1700 */
- + ((year > 1600) ? ((year - 1600) / 400) : 0)); /* plus centuries since 1700 divisible by 400 */
-}
-
-/* Returns whether the specified year is a leap year */
-static int
-is_leap_year (int year)
-{
- if (year <= 1752)
- return !(year % 4);
- else
- return (!(year % 4) && (year % 100)) || !(year % 400);
-}
-
-/* Returns the 1-based day number within the year of the specified date */
-static int
-day_in_year (int day, int month, int year)
-{
- int is_leap, i;
-
- is_leap = is_leap_year (year);
-
- for (i = 0; i < month; i++)
- day += days_in_month [is_leap][i];
-
- return day;
-}
-
-/* Returns the day of the week (zero-based, zero is Sunday) for the specified date. For the days
- * that were removed on the Gregorian reformation, it returns Thursday.
- */
-static int
-day_in_week (int day, int month, int year)
-{
- int n;
-
- n = (year - 1) * 365 + leap_years_up_to (year - 1) + day_in_year (day, month, year);
-
- if (n < REFORMATION_DAY)
- return (n - 1 + SATURDAY) % 7;
-
- if (n >= (REFORMATION_DAY + MISSING_DAYS))
- return (n - 1 + SATURDAY - MISSING_DAYS) % 7;
-
- return THURSDAY;
-}
-
-/* Fills the 42-element days array with the day numbers for the specified month. Slots outside the
- * bounds of the month are filled with zeros. The starting and ending indexes of the days are
- * returned in the start and end arguments.
- */
-static void
-build_month (int month, int year, int start_on_monday, int *days, int *start, int *end)
-{
- int i;
- int d_month, d_week;
-
- /* Note that months are zero-based, so September is month 8 */
-
- if ((year == 1752) && (month == 8)) {
- memcpy (days, sept_1752, 42 * sizeof (int));
-
- if (start)
- *start = SEPT_1752_START;
-
- if (end)
- *end = SEPT_1752_END;
-
- return;
- }
-
- for (i = 0; i < 42; i++)
- days[i] = 0;
-
- d_month = days_in_month[is_leap_year (year)][month];
- d_week = day_in_week (1, month, year);
-
- if (start_on_monday)
- d_week = (d_week + 6) % 7;
-
- for (i = 0; i < d_month; i++)
- days[d_week + i] = i + 1;
-
- if (start)
- *start = d_week;
-
- if (end)
- *end = d_week + d_month - 1;
-}
-
-/* Set the day numbers in the monthly calendar */
-static void
-set_days (GnomeMonthItem *mitem)
-{
- int i;
- int start, end;
- char buf[100];
-
- build_month (mitem->month, mitem->year, mitem->start_on_monday, mitem->day_numbers, &start, &end);
-
- /* Clear days before start of month */
-
- for (i = 0; i < start; i++)
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "text", NULL,
- NULL);
-
- /* Set days of month */
-
- for (; start <= end; start++, i++) {
- sprintf (buf, "%d", mitem->day_numbers[start]);
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "text", buf,
- NULL);
- }
-
- /* Clear days after end of month */
-
- for (; i < 42; i++)
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "text", NULL,
- NULL);
-}
-
-/* Sets the font for all the day numbers */
-static void
-set_day_font (GnomeMonthItem *mitem)
-{
- int i;
-
- for (i = 0; i < 42; i++)
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "font_gdk", mitem->day_font,
- NULL);
-}
-
-/* Sets the color for all the day items */
-static void
-set_day_color (GnomeMonthItem *mitem)
-{
- int i;
- GdkColor outline;
- GdkColor day_box;
- GdkColor day;
-
- outline.pixel = mitem->outline_pixel;
- day_box.pixel = mitem->day_box_pixel;
- day.pixel = mitem->day_pixel;
-
- for (i = 0; i < 42; i++) {
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_BOX + i],
- "outline_color_gdk", &outline,
- "fill_color_gdk", &day_box,
- NULL);
-
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
- "fill_color_gdk", &day,
- NULL);
- }
-}
-
-/* Creates the items for the days */
-static void
-create_days (GnomeMonthItem *mitem)
-{
- int i;
-
- /* Just create the items; they will be positioned and configured by a call to reshape() */
-
- for (i = 0; i < 42; i++) {
- /* Group */
- mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem),
- gnome_canvas_group_get_type (),
- NULL);
-
- /* Box */
- mitem->items[GNOME_MONTH_ITEM_DAY_BOX + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i]),
- gnome_canvas_rect_get_type (),
- NULL);
-
- /* Label */
- mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i]),
- gnome_canvas_text_get_type (),
- NULL);
- }
-
- set_day_font (mitem);
- set_day_color (mitem);
- set_days (mitem);
-}
-
-/* Resets the text of the day name headings */
-static void
-set_day_names (GnomeMonthItem *mitem)
-{
- int i;
-
- for (i = 0; i < 7; i++)
- gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
- "text", mitem->day_names[mitem->start_on_monday ? ((i + 1) % 7) : i],
- NULL);
-}
-
-/* Creates all the canvas items that make up the calendar */
-static void
-create_items (GnomeMonthItem *mitem)
-{
- mitem->items = g_new (GnomeCanvasItem *, GNOME_MONTH_ITEM_LAST);
-
- create_headings (mitem);
- create_days (mitem);
-
- /* Initialize by default to three-letter day names */
-
- mitem->day_names[0] = g_strdup (_("Sun"));
- mitem->day_names[1] = g_strdup (_("Mon"));
- mitem->day_names[2] = g_strdup (_("Tue"));
- mitem->day_names[3] = g_strdup (_("Wed"));
- mitem->day_names[4] = g_strdup (_("Thu"));
- mitem->day_names[5] = g_strdup (_("Fri"));
- mitem->day_names[6] = g_strdup (_("Sat"));
-
- set_day_names (mitem);
- reshape (mitem);
-}
-
-static void
-gnome_month_item_init (GnomeMonthItem *mitem)
-{
- time_t t;
- struct tm tm;
-
- /* Initialize to the current month by default */
-
- t = time (NULL);
- tm = *localtime (&t);
-
- mitem->year = tm.tm_year + 1900;
- mitem->month = tm.tm_mon;
-
- mitem->x = 0.0;
- mitem->y = 0.0;
- mitem->width = 150.0; /* not unreasonable defaults, I hope */
- mitem->height = 100.0;
- mitem->anchor = GTK_ANCHOR_NW;
- mitem->head_padding = 0.0;
- mitem->day_padding = 2.0;
- mitem->head_height = 14.0;
- mitem->head_anchor = GTK_ANCHOR_CENTER;
- mitem->day_anchor = GTK_ANCHOR_CENTER;
-
- /* Load the default fonts */
-
- mitem->head_font = gdk_font_load (DEFAULT_FONT);
- if (!mitem->head_font) {
- mitem->head_font = gdk_font_load ("fixed");
- g_assert (mitem->head_font != NULL);
- }
-
- mitem->day_font = gdk_font_load (DEFAULT_FONT);
- if (!mitem->day_font) {
- mitem->day_font = gdk_font_load ("fixed");
- g_assert (mitem->day_font != NULL);
- }
-}
-
-GnomeCanvasItem *
-gnome_month_item_new (GnomeCanvasGroup *parent)
-{
- GnomeMonthItem *mitem;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CANVAS_GROUP (parent), NULL);
-
- mitem = GNOME_MONTH_ITEM (gnome_canvas_item_new (parent,
- gnome_month_item_get_type (),
- NULL));
-
- gnome_month_item_construct (mitem);
-
- return GNOME_CANVAS_ITEM (mitem);
-}
-
-void
-gnome_month_item_construct (GnomeMonthItem *mitem)
-{
- GdkColor color;
-
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
-
- gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, "#d6d6d6d6d6d6", &color);
- mitem->head_pixel = color.pixel;
- mitem->day_box_pixel = color.pixel;
-
- gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, "black", &color);
- mitem->outline_pixel = color.pixel;
- mitem->day_pixel = color.pixel;
-
- create_items (mitem);
-}
-
-static void
-free_day_names (GnomeMonthItem *mitem)
-{
- int i;
-
- if (mitem->day_names[0])
- for (i = 0; i < 7; i++)
- g_free (mitem->day_names[i]);
-}
-
-static void
-gnome_month_item_destroy (GtkObject *object)
-{
- GnomeMonthItem *mitem;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (object));
-
- mitem = GNOME_MONTH_ITEM (object);
-
- free_day_names (mitem);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-/* Sets the color of the specified pixel value to that of the specified argument, which must be in
- * GdkColor format if format is TRUE, otherwise it must be in string format.
- */
-static void
-set_color_arg (GnomeMonthItem *mitem, gulong *pixel, GtkArg *arg, int gdk_format, int set_head, int set_day)
-{
- GdkColor color;
-
- if (gdk_format)
- *pixel = ((GdkColor *) GTK_VALUE_BOXED (*arg))->pixel;
- else {
- if (gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, GTK_VALUE_STRING (*arg), &color))
- *pixel = color.pixel;
- else
- *pixel = 0;
- }
-
- if (set_head)
- set_head_color (mitem);
-
- if (set_day)
- set_day_color (mitem);
-}
-
-static void
-gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- GnomeMonthItem *mitem;
- char **day_names;
- int i;
-
- mitem = GNOME_MONTH_ITEM (object);
-
- switch (arg_id) {
- case ARG_YEAR:
- mitem->year = GTK_VALUE_UINT (*arg);
- set_days (mitem);
- break;
-
- case ARG_MONTH:
- mitem->month = GTK_VALUE_UINT (*arg);
- set_days (mitem);
- break;
-
- case ARG_X:
- mitem->x = GTK_VALUE_DOUBLE (*arg);
- reanchor (mitem);
- break;
-
- case ARG_Y:
- mitem->y = GTK_VALUE_DOUBLE (*arg);
- reanchor (mitem);
- break;
-
- case ARG_WIDTH:
- mitem->width = fabs (GTK_VALUE_DOUBLE (*arg));
- reshape (mitem);
- break;
-
- case ARG_HEIGHT:
- mitem->height = fabs (GTK_VALUE_DOUBLE (*arg));
- reshape (mitem);
- break;
-
- case ARG_ANCHOR:
- mitem->anchor = GTK_VALUE_ENUM (*arg);
- reanchor (mitem);
- break;
-
- case ARG_HEAD_PADDING:
- mitem->head_padding = fabs (GTK_VALUE_DOUBLE (*arg));
- reshape (mitem);
- break;
-
- case ARG_DAY_PADDING:
- mitem->day_padding = fabs (GTK_VALUE_DOUBLE (*arg));
- reshape (mitem);
- break;
-
- case ARG_DAY_NAMES:
- day_names = GTK_VALUE_POINTER (*arg);
-
- /* First, check that none of the names is null */
-
- for (i = 0; i < 7; i++)
- if (!day_names[i]) {
- g_warning ("Day number %d was NULL; day names cannot be NULL!", i);
- return;
- }
-
- /* Set the new names */
-
- free_day_names (mitem);
- for (i = 0; i < 7; i++)
- mitem->day_names[i] = g_strdup (day_names[i]);
-
- set_day_names (mitem);
- reshape (mitem);
- break;
-
- case ARG_HEADING_HEIGHT:
- mitem->head_height = fabs (GTK_VALUE_DOUBLE (*arg));
- reshape (mitem);
- break;
-
- case ARG_HEADING_ANCHOR:
- mitem->head_anchor = GTK_VALUE_ENUM (*arg);
- reshape (mitem);
- break;
-
- case ARG_DAY_ANCHOR:
- mitem->day_anchor = GTK_VALUE_ENUM (*arg);
- reshape (mitem);
- break;
-
- case ARG_START_ON_MONDAY:
- mitem->start_on_monday = GTK_VALUE_BOOL (*arg);
- set_day_names (mitem);
- set_days (mitem);
- break;
-
- case ARG_HEAD_FONT:
- gdk_font_unref (mitem->head_font);
-
- mitem->head_font = gdk_font_load (GTK_VALUE_STRING (*arg));
- if (!mitem->head_font) {
- mitem->head_font = gdk_font_load ("fixed");
- g_assert (mitem->head_font != NULL);
- }
-
- set_head_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_HEAD_FONTSET:
- gdk_font_unref (mitem->head_font);
-
- mitem->head_font = gdk_fontset_load (GTK_VALUE_STRING (*arg));
- if (!mitem->head_font) {
- mitem->head_font =
- gdk_fontset_load ("-*-fixed-medium-r-semicondensed--13-120-75-75-c-60-*-*");
- g_assert (mitem->head_font != NULL);
- }
-
- set_head_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_HEAD_FONT_GDK:
- gdk_font_unref (mitem->head_font);
-
- mitem->head_font = GTK_VALUE_BOXED (*arg);
- gdk_font_ref (mitem->head_font);
- set_head_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_DAY_FONT:
- gdk_font_unref (mitem->day_font);
-
- mitem->day_font = gdk_font_load (GTK_VALUE_STRING (*arg));
- if (!mitem->day_font) {
- mitem->day_font = gdk_font_load ("fixed");
- g_assert (mitem->day_font != NULL);
- }
-
- set_day_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_DAY_FONTSET:
- gdk_font_unref (mitem->day_font);
-
- mitem->day_font = gdk_fontset_load (GTK_VALUE_STRING (*arg));
- if (!mitem->day_font) {
- mitem->day_font =
- gdk_fontset_load ("-*-fixed-medium-r-semicondensed--13-120-75-75-c-60-*-*");
- g_assert (mitem->day_font != NULL);
- }
-
- set_day_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_DAY_FONT_GDK:
- gdk_font_unref (mitem->day_font);
-
- mitem->day_font = GTK_VALUE_BOXED (*arg);
- gdk_font_ref (mitem->day_font);
- set_day_font (mitem);
- reshape (mitem);
- break;
-
- case ARG_HEAD_COLOR:
- set_color_arg (mitem, &mitem->head_pixel, arg, FALSE, TRUE, FALSE);
- break;
-
- case ARG_HEAD_COLOR_GDK:
- set_color_arg (mitem, &mitem->head_pixel, arg, TRUE, TRUE, FALSE);
- break;
-
- case ARG_OUTLINE_COLOR:
- set_color_arg (mitem, &mitem->outline_pixel, arg, FALSE, TRUE, TRUE);
- break;
-
- case ARG_OUTLINE_COLOR_GDK:
- set_color_arg (mitem, &mitem->outline_pixel, arg, TRUE, TRUE, TRUE);
- break;
-
- case ARG_DAY_BOX_COLOR:
- set_color_arg (mitem, &mitem->day_box_pixel, arg, FALSE, FALSE, TRUE);
- break;
-
- case ARG_DAY_BOX_COLOR_GDK:
- set_color_arg (mitem, &mitem->day_box_pixel, arg, TRUE, FALSE, TRUE);
- break;
-
- case ARG_DAY_COLOR:
- set_color_arg (mitem, &mitem->day_pixel, arg, FALSE, FALSE, TRUE);
- break;
-
- case ARG_DAY_COLOR_GDK:
- set_color_arg (mitem, &mitem->day_pixel, arg, TRUE, FALSE, TRUE);
- break;
-
- default:
- break;
- }
-}
-
-/* Allocates a GdkColor structure filled with the specified pixel, and puts it into the specified
- * arg for returning it in the get_arg method.
- */
-static void
-get_color_arg (GnomeMonthItem *mitem, gulong pixel, GtkArg *arg)
-{
- GdkColor *color;
-
- color = g_new (GdkColor, 1);
- color->pixel = pixel;
- gdk_color_context_query_color (GNOME_CANVAS_ITEM (mitem)->canvas->cc, color);
- GTK_VALUE_BOXED (*arg) = color;
-}
-
-static void
-gnome_month_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- GnomeMonthItem *mitem;
-
- mitem = GNOME_MONTH_ITEM (object);
-
- switch (arg_id) {
- case ARG_YEAR:
- GTK_VALUE_UINT (*arg) = mitem->year;
- break;
-
- case ARG_MONTH:
- GTK_VALUE_UINT (*arg) = mitem->month;
- break;
-
- case ARG_X:
- GTK_VALUE_DOUBLE (*arg) = mitem->x;
- break;
-
- case ARG_Y:
- GTK_VALUE_DOUBLE (*arg) = mitem->y;
- break;
-
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = mitem->width;
- break;
-
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = mitem->height;
- break;
-
- case ARG_ANCHOR:
- GTK_VALUE_ENUM (*arg) = mitem->anchor;
- break;
-
- case ARG_HEAD_PADDING:
- GTK_VALUE_DOUBLE (*arg) = mitem->head_padding;
- break;
-
- case ARG_DAY_PADDING:
- GTK_VALUE_DOUBLE (*arg) = mitem->day_padding;
- break;
-
- case ARG_HEADING_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = mitem->head_height;
- break;
-
- case ARG_HEADING_ANCHOR:
- GTK_VALUE_ENUM (*arg) = mitem->head_anchor;
- break;
-
- case ARG_DAY_ANCHOR:
- GTK_VALUE_ENUM (*arg) = mitem->day_anchor;
- break;
-
- case ARG_START_ON_MONDAY:
- GTK_VALUE_BOOL (*arg) = mitem->start_on_monday;
- break;
-
- case ARG_HEAD_FONT_GDK:
- GTK_VALUE_BOXED (*arg) = mitem->head_font;
- break;
-
- case ARG_DAY_FONT_GDK:
- GTK_VALUE_BOXED (*arg) = mitem->day_font;
- break;
-
- case ARG_HEAD_COLOR_GDK:
- get_color_arg (mitem, mitem->head_pixel, arg);
- break;
-
- case ARG_OUTLINE_COLOR_GDK:
- get_color_arg (mitem, mitem->outline_pixel, arg);
- break;
-
- case ARG_DAY_BOX_COLOR_GDK:
- get_color_arg (mitem, mitem->day_box_pixel, arg);
- break;
-
- case ARG_DAY_COLOR_GDK:
- get_color_arg (mitem, mitem->day_pixel, arg);
- break;
-
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-GnomeCanvasItem *
-gnome_month_item_num2child (GnomeMonthItem *mitem, int child_num)
-{
- g_return_val_if_fail (mitem != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), NULL);
-
- return mitem->items[child_num];
-}
-
-int
-gnome_month_item_child2num (GnomeMonthItem *mitem, GnomeCanvasItem *child)
-{
- int i;
-
- g_return_val_if_fail (mitem != NULL, -1);
- g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), -1);
- g_return_val_if_fail (child != NULL, -1);
- g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (child), -1);
-
- for (i = 0; i < GNOME_MONTH_ITEM_LAST; i++)
- if (mitem->items[i] == child)
- return i;
-
- return -1;
-}
-
-int
-gnome_month_item_num2day (GnomeMonthItem *mitem, int child_num)
-{
- g_return_val_if_fail (mitem != NULL, 0);
- g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), 0);
-
- if ((child_num >= GNOME_MONTH_ITEM_DAY_GROUP) && (child_num < GNOME_MONTH_ITEM_LAST)) {
- child_num = (child_num - GNOME_MONTH_ITEM_DAY_GROUP) % 42;
- return mitem->day_numbers[child_num];
- } else
- return 0;
-}
-
-int
-gnome_month_item_day2index (GnomeMonthItem *mitem, int day_num)
-{
- int i;
-
- g_return_val_if_fail (mitem != NULL, -1);
- g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), -1);
- g_return_val_if_fail (day_num >= 1, -1);
-
- /* Find first day of month */
-
- for (i = 0; mitem->day_numbers[i] == 0; i++)
- ;
-
- /* Find the specified day */
-
- for (; (mitem->day_numbers[i] != 0) && (i < 42); i++)
- if (mitem->day_numbers[i] == day_num)
- return i;
-
- /* Bail out */
-
- return -1;
-}
diff --git a/calendar/gui/gnome-month-item.h b/calendar/gui/gnome-month-item.h
deleted file mode 100644
index 0ec4fd484c..0000000000
--- a/calendar/gui/gnome-month-item.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/* General-purpose monthly calendar canvas item for GNOME
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef GNOME_MONTH_ITEM_H
-#define GNOME_MONTH_ITEM_H
-
-#include <libgnome/gnome-defs.h>
-#include <gtk/gtkpacker.h> /* why the hell is GtkAnchorType here and not in gtkenums.h? */
-#include <libgnomeui/gnome-canvas.h>
-
-
-BEGIN_GNOME_DECLS
-
-
-/* These values are used to identify the canvas items that make up a complete GnomeMonthItem, which
- * is made up of the following "pieces":
- *
- * Headings line:
- * - 7 GnomeCanvasGroups:
- * Each group contains one box (GnomeCanvasRectangle) and one label
- * (GnomeCanvasText)
- *
- * Day slots:
- * - 42 GnomeCanvasGroups:
- * Each group contains one box (GnomeCanvasRectangle) and one label
- * (GnomeCanvasText)
- *
- * The headings are organized from left to right. The day slots are organized as a table in
- * row-major order.
- *
- * If you want to access the individual items of the GnomeMonthItem, you can use these numbers with
- * the gnome_month_item_num2child() function. If you want to convert a number into the
- * corresponding GnomeCanvasItem, you can use the gnome_month_item_child2num() function.
- */
-typedef enum {
- GNOME_MONTH_ITEM_HEAD_GROUP = 0, /* 7 groups for headings */
- GNOME_MONTH_ITEM_HEAD_BOX = 7, /* 7 boxes for headings */
- GNOME_MONTH_ITEM_HEAD_LABEL = 14, /* 7 labels for headings */
- GNOME_MONTH_ITEM_DAY_GROUP = 21, /* 42 groups for days */
- GNOME_MONTH_ITEM_DAY_BOX = 63, /* 42 boxes for days */
- GNOME_MONTH_ITEM_DAY_LABEL = 105, /* 42 labels for days */
- GNOME_MONTH_ITEM_LAST = 147 /* total number of items */
-} GnomeMonthItemChild;
-
-/* The MonthItem canvas item defines a simple monthly calendar. It is made out of a number of
- * canvas items, which can be accessed using the functions provided. The monthly calendar is
- * anchored with respect to a point. The following arguments are available:
- *
- * name type read/write description
- * ------------------------------------------------------------------------------------------
- * year uint RW Full year (1-9999)
- * month uint RW Number of month (0-11)
- * x double RW X position of anchor point
- * y double RW Y position of anchor point
- * width double RW Width of calendar in canvas units
- * height double RW Height of calendar in canvas units
- * anchor GtkAnchorType RW Anchor side for calendar
- * heading_padding double RW Padding inside heading boxes
- * day_padding double RW Padding inside day boxes
- * day_names char ** W Array of strings corresponding to the day names (sun-sat)
- * heading_height double RW Height of headings bar in canvas units
- * heading_anchor GtkAnchorType RW Anchor side for headings inside heading boxes
- * day_anchor GtkAnchorType RW Anchor side for day numbers inside day boxes
- * start_on_monday boolean RW Specifies whether the week starts on Monday or Sunday
- * heading_font string W X logical font descriptor for the headings
- * heading_fontset string W X logical fontset descriptor for the headings
- * heading_font_gdk GdkFont * RW Pointer to GdkFont for the headings
- * day_font string W X logical font descriptor for the day numbers
- * day_fontset string W X logical fontset descriptor for the day numbers
- * day_font_gdk GdkFont * RW Pointer to GdkFont for the day numbers
- * heading_color string W X color specification for heading labels
- * heading_color_gdk GdkColor * RW Pointer to an allocated GdkColor for heading labels
- * outline_color string W X color specification for outline (lines and fill of heading boxes)
- * outline_color_gdk GdkColor * RW Pointer to an allocated GdkColor for outline
- * day_box_color string W X color specification for day boxes
- * day_box_color_gdk GdkColor * RW Pointer to an allocated GdkColor for day boxes
- * day_color string W X color specification for day number labels
- * day_color_gdk GdkColor * RW Pointer to an allocated GdkColor for day number labels
- */
-
-#define GNOME_TYPE_MONTH_ITEM (gnome_month_item_get_type ())
-#define GNOME_MONTH_ITEM(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_MONTH_ITEM, GnomeMonthItem))
-#define GNOME_MONTH_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_MONTH_ITEM, GnomeMonthItemClass))
-#define GNOME_IS_MONTH_ITEM(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_MONTH_ITEM))
-#define GNOME_IS_MONTH_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_MONTH_ITEM))
-
-
-typedef struct _GnomeMonthItem GnomeMonthItem;
-typedef struct _GnomeMonthItemClass GnomeMonthItemClass;
-
-struct _GnomeMonthItem {
- GnomeCanvasGroup group;
-
- int year; /* Year to show (full, no two-digit crap) */
- int month; /* Month to show (0-11) */
-
- double x, y; /* Position at anchor */
- double width, height; /* Size of calendar */
- GtkAnchorType anchor; /* Anchor side for calendar */
-
- double head_padding; /* Padding to use between heading lines and text */
- double day_padding; /* Padding to use between day number lines and text */
-
- char *day_names[7]; /* Names to use for the day labels, starting from Sunday */
-
- double head_height; /* Height of the headings row */
- GtkAnchorType head_anchor; /* Anchor side for the heading labels */
- GtkAnchorType day_anchor; /* Anchor side for the day number labels */
-
- GnomeCanvasItem **items; /* All the items that make up the calendar */
- int day_numbers[42]; /* The numbers of the days, as they are shown in the display */
-
- GdkFont *head_font; /* Font for the headings */
- GdkFont *day_font; /* Font for the day numbers */
-
- gulong head_pixel; /* Color for heading labels */
- gulong outline_pixel; /* Color for the outline (lines and heading boxes) */
- gulong day_box_pixel; /* Color for the day boxes */
- gulong day_pixel; /* Color for day number labels */
-
- int start_on_monday : 1; /* Start the week on Monday? If false, then start from Sunday */
-};
-
-struct _GnomeMonthItemClass {
- GnomeCanvasGroupClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType gnome_month_item_get_type (void);
-
-/* Creates a new month item with the specified group as parent */
-GnomeCanvasItem *gnome_month_item_new (GnomeCanvasGroup *parent);
-
-/* Constructor function useful for derived classes */
-void gnome_month_item_construct (GnomeMonthItem *mitem);
-
-/* Returns the child item defined by the child number (as specified on the GnomeMonthItemChild
- * enumeration above).
- */
-GnomeCanvasItem *gnome_month_item_num2child (GnomeMonthItem *mitem, int child_num);
-
-/* Returns the number of the specified child item, as defined on the GnomeMonthItemChild enumeration
- * above. If the specified object is not found, it returns -1.
- */
-int gnome_month_item_child2num (GnomeMonthItem *mitem, GnomeCanvasItem *child);
-
-/* Returns the number of the day relevant to the specified child item. Day numbers are 1-based. If
- * the specified child is outside the range of displayed days, then it returns 0.
- */
-int gnome_month_item_num2day (GnomeMonthItem *mitem, int child_num);
-
-/* Returns the index (0-41) of the specified date within the table of days. If the day number is
- * invalid for the current monthly calendar, then -1 is returned.
- */
-int gnome_month_item_day2index (GnomeMonthItem *mitem, int day_num);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/gnomecal.gnorba b/calendar/gui/gnomecal.gnorba
deleted file mode 100644
index 74df8ecf04..0000000000
--- a/calendar/gui/gnomecal.gnorba
+++ /dev/null
@@ -1,11 +0,0 @@
-[IDL:GNOME:Calendar:Repository:1.0]
-type=factory
-repo_id=IDL:Gnome/Calendar/Repository:1.0
-description=Calendar Repository
-location_info=IDL:GNOME:Calendar:RepositoryLocator:1.0
-
-[IDL:GNOME:Calendar:RepositoryLocator:1.0]
-type=exe
-repo_id=IDL:GNOME/GenericFactory:1.0
-description=Calendar Server
-location_info=gnomecal
diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c
deleted file mode 100644
index 41609da678..0000000000
--- a/calendar/gui/goto.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/* Go to date dialog for gnomecal
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include <gnome.h>
-#include "gnome-cal.h"
-#include "gnome-month-item.h"
-#include "main.h"
-#include "mark.h"
-#include "timeutil.h"
-
-
-static GtkWidget *goto_win; /* The goto dialog window */
-static GnomeMonthItem *month_item; /* The month item in the dialog */
-static GnomeCalendar *gnome_calendar; /* The gnome calendar the dialog refers to */
-static int current_index; /* The index of the day marked as current, or -1 if none */
-
-
-/* Updates the specified month item by marking it appropriately from the calendar the dialog refers
- * to. Also marks the current day if appropriate.
- */
-static void
-update (void)
-{
- GnomeCanvasItem *item;
- time_t t;
- struct tm tm;
-
- unmark_month_item (month_item);
- mark_month_item (month_item, gnome_calendar->cal);
-
- if (current_index != -1) {
- item = gnome_month_item_num2child (month_item,
- GNOME_MONTH_ITEM_DAY_LABEL + current_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_DAY_FG),
- "fontset", NORMAL_DAY_FONTSET,
- NULL);
- current_index = -1;
- }
-
- t = time (NULL);
- tm = *localtime (&t);
-
- if (((tm.tm_year + 1900) == month_item->year) && (tm.tm_mon == month_item->month)) {
- current_index = gnome_month_item_day2index (month_item, tm.tm_mday);
- g_assert (current_index != -1);
-
- item = gnome_month_item_num2child (month_item,
- GNOME_MONTH_ITEM_DAY_LABEL + current_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_CURRENT_DAY_FG),
- "fontset", CURRENT_DAY_FONTSET,
- NULL);
- }
-}
-
-/* Callback used when the year adjustment is changed */
-static void
-year_changed (GtkAdjustment *adj, gpointer data)
-{
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (month_item),
- "year", (int) adj->value,
- NULL);
- update ();
-}
-
-/* Creates the year control with its adjustment */
-static GtkWidget *
-create_year (int year)
-{
- GtkWidget *hbox;
- GtkAdjustment *adj;
- GtkWidget *w;
-
- hbox = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
-
- w = gtk_label_new (_("Year:"));
- gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- adj = GTK_ADJUSTMENT (gtk_adjustment_new (year, 1900, 9999, 1, 10, 10));
- gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
- (GtkSignalFunc) year_changed,
- NULL);
-
- w = gtk_spin_button_new (adj, 1.0, 0);
- gtk_widget_set_usize (w, 60, 0);
- gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- return hbox;
-}
-
-/* Callback used when a month button is toggled */
-static void
-month_toggled (GtkToggleButton *toggle, gpointer data)
-{
- if (!toggle->active)
- return;
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (month_item),
- "month", GPOINTER_TO_INT (data),
- NULL);
- update ();
-}
-
-/* Creates the months control */
-static GtkWidget *
-create_months (int month)
-{
- GtkWidget *table;
- GtkWidget *w;
- GSList *group;
- int i, row, col;
- struct tm tm;
- char buf[100];
-
- tm = *localtime (&gnome_calendar->current_display);
-
- table = gtk_table_new (2, 6, TRUE);
-
- group = NULL;
-
- for (i = 0; i < 12; i++) {
- row = i / 6;
- col = i % 6;
-
- tm.tm_mon = i;
- strftime (buf, 100, "%b", &tm);
-
- w = gtk_radio_button_new (group);
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (w));
- gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (w), FALSE);
-
- gtk_container_add (GTK_CONTAINER (w), gtk_label_new (buf));
-
- if (i == month)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (w), TRUE);
-
- gtk_signal_connect (GTK_OBJECT (w), "toggled",
- (GtkSignalFunc) month_toggled,
- GINT_TO_POINTER (i));
- gtk_table_attach (GTK_TABLE (table), w,
- col, col + 1,
- row, row + 1,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
- gtk_widget_show_all (w);
- }
-
- return table;
-}
-
-/* Sets the scrolling region of the canvas to the allocation size */
-static void
-set_scroll_region (GtkWidget *widget, GtkAllocation *allocation)
-{
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (month_item),
- "width", (double) (allocation->width - 1),
- "height", (double) (allocation->height - 1),
- NULL);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (widget),
- 0, 0,
- allocation->width, allocation->height);
-}
-
-/* Event handler for day groups in the month item. A button press makes the calendar jump to the
- * selected day and destroys the Go-to dialog box.
- */
-static gint
-day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- int child_num, day;
-
- child_num = gnome_month_item_child2num (month_item, item);
- day = gnome_month_item_num2day (month_item, child_num);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if ((event->button.button == 1) && (day != 0)) {
- gnome_calendar_goto (gnome_calendar,
- time_from_day (month_item->year, month_item->month, day));
- gtk_widget_destroy (goto_win);
- }
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Creates the canvas with the month item for selecting days */
-static GtkWidget *
-create_days (int day, int month, int year)
-{
- GtkWidget *canvas;
- int i;
- GnomeCanvasItem *day_group;
-
- canvas = gnome_canvas_new ();
- gtk_widget_set_usize (canvas, 150, 120);
-
- month_item = GNOME_MONTH_ITEM (gnome_month_item_new (gnome_canvas_root (GNOME_CANVAS (canvas))));
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (month_item),
- "month", month,
- "year", year,
- "start_on_monday", week_starts_on_monday,
- NULL);
- colorify_month_item (month_item, default_color_func, NULL);
- month_item_prepare_prelight (month_item, default_color_func, NULL);
- update ();
-
- /* Connect to size_allocate so that we can change the size of the month item and the
- * scrolling region appropriately.
- */
-
- gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate",
- (GtkSignalFunc) set_scroll_region,
- NULL);
-
- /* Bind the day groups to our event handler */
-
- for (i = 0; i < 42; i++) {
- day_group = gnome_month_item_num2child (month_item, i + GNOME_MONTH_ITEM_DAY_GROUP);
- gtk_signal_connect (GTK_OBJECT (day_group), "event",
- (GtkSignalFunc) day_event,
- NULL);
- }
-
- return canvas;
-}
-
-static void
-goto_today (GtkWidget *widget, gpointer data)
-{
- gnome_calendar_goto_today (gnome_calendar);
- gtk_widget_destroy (goto_win);
-}
-
-/* Creates a "goto date" dialog and runs it */
-void
-goto_dialog (GnomeCalendar *gcal)
-{
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *w;
- GtkWidget *days;
- struct tm tm;
-
- gnome_calendar = gcal;
- current_index = -1;
-
- tm = *localtime (&gnome_calendar->current_display);
-
- goto_win = gnome_dialog_new (_("Go to date"),
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
- gnome_dialog_set_parent (GNOME_DIALOG (goto_win), GTK_WINDOW (gcal));
-
- vbox = GNOME_DIALOG (goto_win)->vbox;
-
- /* Instructions */
-
- w = gtk_label_new (_("Please select the date you want to go to.\n"
- "When you click on a day, you will be taken\n"
- "to that date."));
- gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_LEFT);
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.0);
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- /* Create month item before creating the year controls, since the latter ones need the
- * month_item to be created.
- */
-
- days = create_days (tm.tm_mday, tm.tm_mon, tm.tm_year + 1900);
-
- /* Year */
-
- w = create_year (tm.tm_year + 1900);
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- /* Month */
-
- w = create_months (tm.tm_mon);
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- /* Days (canvas with month item) */
-
- gtk_box_pack_start (GTK_BOX (vbox), days, TRUE, TRUE, 0);
- gtk_widget_show (days);
-
- /* Today button */
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-
- w = gtk_button_new_with_label (_("Go to today"));
- gtk_signal_connect (GTK_OBJECT (w), "clicked",
- (GtkSignalFunc) goto_today,
- NULL);
- gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
- gtk_widget_show (w);
-
- /* Run! */
-
- gtk_window_set_modal (GTK_WINDOW (goto_win), TRUE);
- gnome_dialog_set_close (GNOME_DIALOG (goto_win), TRUE);
- gnome_dialog_set_parent (GNOME_DIALOG (goto_win), GTK_WINDOW (gnome_calendar));
- gtk_widget_show (goto_win);
-}
diff --git a/calendar/gui/icalendar-types b/calendar/gui/icalendar-types
deleted file mode 100644
index e11f4c1789..0000000000
--- a/calendar/gui/icalendar-types
+++ /dev/null
@@ -1,39 +0,0 @@
-evento todo journal fbrequest fbreply busytime timezone
- attach attach attach
- attendee attendee attendee attendee attendee attendee
- categories categories categories
- class class class
- comment comment comment comment comment comment comment
- completed
- contact contact contact
- created created created created
- description description description
- dtstamp dtstamp
- dtend/duration due->dtend dtend [duration] dtend dtend
- dtstart dtstart dtstart dtstart dtstart dtstart dtstart
- exdate exdate exdate
- exrule exrule exrule
- geo geo
- last-mod last-mod last-mod last-mod last-mod
- location location
- organizer organizer organizer
- percent
- priority priority
- rstatus rstatus rstatus rstatus
- related related related
- resources resources
- rdate rdate rdate [rdate/rrule]
- rrule rrule rrule
- dtstamp dtstamp dtstamp dtstamp
- seq seq seq seq seq
- status status
- summary summary summary
- transp
- uid uid uid uid uid
- url url url url url
- recurid recurid recurid
- freebusy freebusy
- tzname
- tzoffset-to
- tzoffset-from
-
diff --git a/calendar/gui/layout.c b/calendar/gui/layout.c
deleted file mode 100644
index 1367ae3f8f..0000000000
--- a/calendar/gui/layout.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* Event layout engine for Gnomecal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Miguel de Icaza <miguel@nuclecu.unam.mx>
- * Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include "layout.h"
-
-
-/* This structure is used to pass around layout information among the internal layout functions */
-struct layout_info {
- GList *events; /* List of events from client */
- int num_events; /* The number of events (length of the list) */
- LayoutQueryTimeFunc func; /* Function to convert a list item to a start/end time pair */
- int num_rows; /* Size of the time partition */
- time_t *partition; /* The time partition containing start and end time values */
- int *array; /* Working array of free and allocated time slots */
- int *allocations; /* Returned array of slot allocations */
- int *slots; /* Returned array of slots used */
- int num_slots; /* Number of slots used */
-};
-
-
-/* This defines the maximum number of events to overlap per row. More than that number of events
- * will not be displayed. This is not ideal, so sue me.
- */
-#define MAX_EVENTS_PER_ROW 32
-
-
-/* Compares two time_t values, used for qsort() */
-static int
-compare_time_t (const void *a, const void *b)
-{
- time_t ta, tb;
-
- ta = *((time_t *) a);
- tb = *((time_t *) b);
-
- if (ta < tb)
- return -1;
- else if (ta > tb)
- return 1;
- else
- return 0;
-}
-
-/* Builds a partition of the time range occupied by the events in the list. It returns an array
- * with the times that define the partition and the number of items in the partition.
- */
-static void
-build_partition (struct layout_info *li)
-{
- time_t *rows, *p, *q;
- GList *list;
- int i, unique_vals;
-
- /* This is the maximum number of rows we would need */
-
- li->num_rows = li->num_events * 2;
-
- /* Fill the rows with the times */
-
- rows = g_new (time_t, li->num_rows);
-
- for (list = li->events, p = rows; list; list = list->next) {
- (* li->func) (list, &p[0], &p[1]);
- p += 2;
- }
-
- /* Do a sort | uniq on the array */
-
- qsort (rows, li->num_rows, sizeof (time_t), compare_time_t);
-
- p = rows;
- q = rows + 1;
- unique_vals = 1;
-
- for (i = 1; i < li->num_rows; i++, q++)
- if (*q != *p) {
- unique_vals++;
- p++;
- *p = *q;
- }
-
- /* Return the number of unique values in the partition and the partition array itself */
-
- li->num_rows = unique_vals;
- li->partition = rows;
-}
-
-/* Returns the index of the element in the partition that corresponds to the specified time */
-int
-find_index (struct layout_info *li, time_t t)
-{
- int i;
-
- for (i = 0; ; i++)
- if (li->partition[i] == t)
- return i;
-
- g_assert_not_reached ();
-}
-
-#define xy(li, x, y) li->array[(y * MAX_EVENTS_PER_ROW) + (x)]
-
-/* Checks that all the cells in the slot array at the specified slot column are free to use by an
- * event that has the specified range.
- */
-static int
-range_is_empty (struct layout_info *li, int slot, time_t start, time_t end)
-{
- int i;
-
- for (i = find_index (li, start); li->partition[i] < end; i++)
- if (xy (li, slot, i) != -1)
- return FALSE;
-
- return TRUE;
-}
-
-/* Allocates a time in the slot array for the specified event's index */
-static void
-range_allocate (struct layout_info *li, int slot, time_t start, time_t end, int ev_num)
-{
- int i;
-
- for (i = find_index (li, start); li->partition[i] < end; i++)
- xy (li, slot, i) = ev_num;
-}
-
-/* Performs the initial allocation of slots for events. Each event gets one column; they will be
- * expanded in a later stage. Returns the number of columns used.
- */
-static void
-initial_allocate (struct layout_info *li)
-{
- GList *events;
- int i;
- int slot;
- int num_slots;
- time_t start, end;
-
- num_slots = 0;
-
- for (i = 0, events = li->events; events; events = events->next, i++) {
- (* li->func) (events, &start, &end);
-
- /* Start with no allocation, no columns */
-
- li->allocations[i] = -1;
- li->slots[i] = 0;
-
- /* Find a free column for the event */
-
- for (slot = 0; slot < MAX_EVENTS_PER_ROW; slot++)
- if (range_is_empty (li, slot, start, end)) {
- range_allocate (li, slot, start, end, i);
-
- li->allocations[i] = slot;
- li->slots[i] = 1;
-
- if ((slot + 1) > num_slots)
- num_slots = slot + 1;
-
- break;
- }
- }
-
- li->num_slots = num_slots;
-}
-
-/* Returns the maximum number of columns that an event can expanded by in the slot array */
-static int
-columns_to_expand (struct layout_info *li, int ev_num, time_t start, time_t end)
-{
- int cols;
- int slot;
- int i_start;
- int i;
-
- cols = 0;
-
- i_start = find_index (li, start);
-
- for (slot = li->allocations[ev_num] + 1; slot < li->num_slots; slot++) {
- for (i = i_start; li->partition[i] < end; i++)
- if (xy (li, slot, i) != -1)
- return cols;
-
- cols++;
- }
-
- return cols;
-}
-
-/* Expands an event by the specified number of columns */
-static void
-do_expansion (struct layout_info *li, int ev_num, time_t start, time_t end, int num_cols)
-{
- int i, j;
- int slot;
-
- for (i = find_index (li, start); li->partition[i] < end; i++) {
- slot = li->allocations[ev_num] + 1;
-
- for (j = 0; j < num_cols; j++)
- xy (li, slot + j, i) = ev_num;
- }
-}
-
-/* Expands the events in the slot array to occupy as many columns as possible. This is the second
- * pass of the layout algorithm.
- */
-static void
-expand_events (struct layout_info *li)
-{
- GList *events;
- time_t start, end;
- int i;
- int cols;
-
- for (i = 0, events = li->events; events; events = events->next, i++) {
- (* li->func) (events, &start, &end);
-
- cols = columns_to_expand (li, i, start, end);
-
- if (cols == 0)
- continue; /* We can't expand this event */
-
- do_expansion (li, i, start, end, cols);
-
- li->slots[i] += cols;
- }
-}
-
-void
-layout_events (GList *events, LayoutQueryTimeFunc func, int *num_slots, int **allocations, int **slots)
-{
- struct layout_info li;
- int i;
-
- g_return_if_fail (num_slots != NULL);
- g_return_if_fail (allocations != NULL);
- g_return_if_fail (slots != NULL);
-
- if (!events) {
- *num_slots = 0;
- *allocations = NULL;
- *slots = NULL;
-
- return;
- }
-
- li.events = events;
- li.num_events = g_list_length (events);
- li.func = func;
-
- /* Build the partition of the time range, and then build the array of slots */
-
- build_partition (&li);
-
- li.array = g_new (int, li.num_rows * MAX_EVENTS_PER_ROW);
- for (i = 0; i < (li.num_rows * MAX_EVENTS_PER_ROW); i++)
- li.array[i] = -1; /* This is our 'empty' value */
-
- /* Build the arrays for allocations and columns used */
-
- li.allocations = g_new (int, li.num_events);
- li.slots = g_new (int, li.num_events);
-
- /* Perform initial allocation and then expand the events to as many slots as they can occupy */
-
- initial_allocate (&li);
- expand_events (&li);
-
- /* Clean up and return values */
-
- g_free (li.array);
-
- *num_slots = li.num_slots;
- *allocations = li.allocations;
- *slots = li.slots;
-}
diff --git a/calendar/gui/layout.h b/calendar/gui/layout.h
deleted file mode 100644
index 734b720b8b..0000000000
--- a/calendar/gui/layout.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Event layout engine for Gnomecal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Miguel de Icaza <miguel@nuclecu.unam.mx>
- * Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef LAYOUT_H
-#define LAYOUT_H
-
-#include <glib.h>
-#include <time.h>
-
-
-/* Functions of this type must translate the list item into two time_t values for the start and end
- * of an event.
- */
-typedef void (* LayoutQueryTimeFunc) (GList *event, time_t *start, time_t *end);
-
-
-/* This is the main layout function for overlapping events. You pass in a list of (presumably)
- * events and a function that should take a list element and return the start and end times for the
- * event corresponding to that list element.
- *
- * It returns the number of slots ("columns") that you need to take into account when actually
- * painting the events, the array of the first slot index that each event occupies, and the array of
- * number of slots that each event occupies. You have to free both arrays.
- *
- * You will get somewhat better-looking results if the list of events is sorted by using the start
- * time as the primary sort key and the end time as the secondary sort key -- so that "longer"
- * events go first in the list.
- */
-void layout_events (GList *events, LayoutQueryTimeFunc func, int *num_slots, int **allocations, int **slots);
-
-
-#endif
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
deleted file mode 100644
index 98157d101d..0000000000
--- a/calendar/gui/main.c
+++ /dev/null
@@ -1,1059 +0,0 @@
-/*
- * Main file for the GNOME Calendar program
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@kernel.org)
- * Federico Mena (federico@nuclecu.unam.mx)
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <libgnorba/gnorba.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include "calendar.h"
-#include "alarm.h"
-#include "eventedit.h"
-#include "gnome-cal.h"
-#include "main.h"
-#include "timeutil.h"
-#include "corba-cal-factory.h"
-
-#define COOKIE_USER_HOME_DIR ((char *) -1)
-
-
-/* The username, used to set the `owner' field of the event */
-char *user_name;
-
-/* The full user name from the Gecos field */
-char *full_name;
-
-/* The user's default calendar file */
-char *user_calendar_file;
-
-/* a gnome-config string prefix that can be used to access the calendar config info */
-char *calendar_settings;
-
-/* Day begin, day end parameters */
-int day_begin, day_end;
-
-/* Whether weeks starts on Sunday or Monday */
-int week_starts_on_monday;
-
-/* If true, do not show our top level window */
-int startup_hidden = 0;
-
-/* If true, enable debug output for alarms */
-int debug_alarms = 0;
-
-/* The array of color properties -- keep in sync with the enumeration defined in main.h. The color
- * values specified here are the defaults for the program.
- */
-struct color_prop color_props[] = {
- { 0x3e72, 0x35ec, 0x8ba2, N_("Outline:"), "/calendar/Colors/outline" },
- { 0xffff, 0xffff, 0xffff, N_("Headings:"), "/calendar/Colors/headings" },
- { 0xf26c, 0xecec, 0xbbe7, N_("Empty days:"), "/calendar/Colors/empty_bg" },
- { 0xfc1e, 0xf87f, 0x5f80, N_("Appointments:"), "/calendar/Colors/mark_bg" },
- { 0xd364, 0xc6b7, 0x7969, N_("Highlighted day:"), "/calendar/Colors/prelight_bg" },
- { 0x01f0, 0x01f0, 0x01f0, N_("Day numbers:"), "/calendar/Colors/day_fg" },
- { 0x0000, 0x0000, 0xffff, N_("Current day's number:"), "/calendar/Colors/current_fg" },
- { 0xbbbb, 0xbbbb, 0x0000, N_("To-Do item that is not yet due:"), "/calendar/Colors/todo_not_yet" },
- { 0xdddd, 0xbbbb, 0x0000, N_("To-Do item that is due today:"), "/calendar/Colors/todo_today" },
- { 0xbbbb, 0xdddd, 0x0000, N_("To-Do item that is overdue:"), "/calendar/Colors/todo_overdue" }
-};
-
-/* Number of active calendars */
-int active_calendars = 0;
-
-/* A list of all of the calendars started */
-GList *all_calendars = NULL;
-
-/* For dumping part of a calendar */
-static time_t from_t, to_t;
-
-/* File to load instead of the user default's file */
-static char *load_file;
-
-/* If set, show events for the specified date and quit */
-static int show_events;
-
-/* If set, show todo items quit */
-static int show_todo;
-
-/* If set, beep on display alarms */
-gboolean beep_on_display = 0;
-
-/* If true, timeout the beeper on audio alarms */
-
-gboolean enable_aalarm_timeout = 0;
-guint audio_alarm_timeout = 0;
-const guint MAX_AALARM_TIMEOUT = 3600;
-const guint MAX_SNOOZE_SECS = 3600;
-gboolean enable_snooze = 0;
-guint snooze_secs = 60;
-
-/* Default values for alarms */
-CalendarAlarm alarm_defaults[4] = {
- { ALARM_MAIL, 0, 15, ALARM_MINUTES },
- { ALARM_PROGRAM, 0, 15, ALARM_MINUTES },
- { ALARM_DISPLAY, 0, 15, ALARM_MINUTES },
- { ALARM_AUDIO, 0, 15, ALARM_MINUTES }
-};
-
-static void
-init_username (void)
-{
- user_name = g_strdup(g_get_user_name());
- full_name = g_strdup(g_get_real_name());
-}
-
-static int
-range_check_hour (int hour)
-{
- if (hour < 0)
- hour = 0;
- else if (hour >= 24)
- hour = 23;
-
- return hour;
-}
-
-static void
-init_default_alarms (void)
-{
- int i;
- gboolean def;
-
- alarm_defaults [ALARM_DISPLAY].type = ALARM_DISPLAY;
- alarm_defaults [ALARM_AUDIO].type = ALARM_AUDIO;
- alarm_defaults [ALARM_PROGRAM].type = ALARM_PROGRAM;
- alarm_defaults [ALARM_MAIL].type = ALARM_MAIL;
-
- for (i = 0; i < 4; i++) {
- switch (alarm_defaults [i].type) {
- case ALARM_DISPLAY:
- gnome_config_push_prefix ("/calendar/alarms/def_disp_");
- break;
- case ALARM_AUDIO:
- gnome_config_push_prefix ("/calendar/alarms/def_audio_");
- break;
- case ALARM_PROGRAM:
- gnome_config_push_prefix ("/calendar/alarms/def_prog_");
- break;
- case ALARM_MAIL:
- gnome_config_push_prefix ("/calendar/alarms/def_mail_");
- break;
- }
-
- alarm_defaults[i].enabled = gnome_config_get_int ("enabled=0");
- if (alarm_defaults[i].type != ALARM_MAIL) {
- alarm_defaults[i].count = gnome_config_get_int ("count=15");
- alarm_defaults[i].units = gnome_config_get_int ("units=0");
- } else {
- alarm_defaults[i].count = gnome_config_get_int ("count=1");
- alarm_defaults[i].count = gnome_config_get_int ("count=2");
- }
-
- alarm_defaults[i].data = gnome_config_get_string_with_default ("data=",
- &def);
- if (def)
- alarm_defaults[i].data = NULL;
-
- gnome_config_pop_prefix ();
- }
-}
-
-
-/*
- * Initializes the calendar internal variables, loads defaults
- */
-static void
-init_calendar (void)
-{
- int i;
- char *cspec, *color;
- char *str;
-
- init_username ();
- user_calendar_file = g_concat_dir_and_file (gnome_util_user_home (), ".gnome/user-cal.vcf");
-
- gnome_config_push_prefix (calendar_settings);
-
- /* Read calendar settings */
-
- day_begin = range_check_hour (gnome_config_get_int ("/calendar/Calendar/Day start=8"));
- day_end = range_check_hour (gnome_config_get_int ("/calendar/Calendar/Day end=17"));
- am_pm_flag = gnome_config_get_bool ("/calendar/Calendar/AM PM flag=0");
- week_starts_on_monday = gnome_config_get_bool ("/calendar/Calendar/Week starts on Monday=0");
-
- if (day_end < day_begin){
- day_begin = 8;
- day_end = 17;
- }
-
- /* Read color settings */
-
- for (i = 0; i < COLOR_PROP_LAST; i++) {
- cspec = build_color_spec (color_props[i].r, color_props[i].g, color_props[i].b);
- str = g_strconcat (color_props[i].key, "=", cspec, NULL);
-
- color = gnome_config_get_string (str);
- parse_color_spec (color, &color_props[i].r, &color_props[i].g, &color_props[i].b);
-
- g_free (str);
- g_free (color);
- }
-
- /* read todolist settings */
-
- todo_show_time_remaining = gnome_config_get_bool("/calendar/Todo/show_time_remain");
- todo_show_due_date = gnome_config_get_bool("/calendar/Todo/show_due_date");
-
- todo_item_dstatus_highlight_overdue = gnome_config_get_bool("/calendar/Todo/highlight_overdue");
-
- todo_item_dstatus_highlight_due_today = gnome_config_get_bool("/calendar/Todo/highlight_due_today");
-
- todo_item_dstatus_highlight_not_due_yet = gnome_config_get_bool("/calendar/Todo/highlight_not_due_yet");
-
- todo_current_sort_column = gnome_config_get_int("/calendar/Todo/sort_column");
-
- todo_current_sort_type = gnome_config_get_int("/calendar/Todo/sort_type");
-
- todo_show_priority = gnome_config_get_bool("/calendar/Todo/show_priority");
-
- /* read alarm settings */
- beep_on_display = gnome_config_get_bool ("/calendar/alarms/beep_on_display=FALSE");
- enable_aalarm_timeout = gnome_config_get_bool ("/calendar/alarms/enable_audio_timeout=FALSE");
- audio_alarm_timeout = gnome_config_get_int ("/calendar/alarms/audio_alarm_timeout=60");
- if (audio_alarm_timeout < 1)
- audio_alarm_timeout = 1;
- if (audio_alarm_timeout > MAX_AALARM_TIMEOUT)
- audio_alarm_timeout = MAX_AALARM_TIMEOUT;
- enable_snooze = gnome_config_get_bool ("/calendar/alarms/enable_snooze=FALSE");
- snooze_secs = gnome_config_get_int ("/calendar/alarms/snooze_secs=300");
- if (snooze_secs < 1)
- snooze_secs = 1;
- if (snooze_secs > MAX_SNOOZE_SECS)
- snooze_secs = MAX_SNOOZE_SECS;
-
- init_default_alarms ();
-
-
- /* Done */
-
- gnome_config_pop_prefix ();
-}
-
-
-
-static void save_calendar_cmd (GtkWidget *widget, void *data);
-
-static void
-about_calendar_cmd (GtkWidget *widget, void *data)
-{
- GtkWidget *about;
- const gchar *authors[] = {
- "Miguel de Icaza (miguel@kernel.org)",
- "Federico Mena (federico@gimp.org)",
- "Arturo Espinosa (arturo@nuclecu.unam.mx)",
- "Russell Steinthal (rms39@columbia.edu)",
- NULL
- };
-
- about = gnome_about_new (_("Gnome Calendar"), VERSION,
- "(C) 1998 the Free Software Foundation",
- authors,
- _("The GNOME personal calendar and schedule manager."),
- NULL);
- gtk_window_set_modal (GTK_WINDOW (about), TRUE);
- gnome_dialog_set_close (GNOME_DIALOG (about), TRUE);
- gtk_widget_show (about);
-}
-
-static void
-display_objedit (GtkWidget *widget, GnomeCalendar *gcal)
-{
- GtkWidget *ee;
- iCalObject *ico;
-
- /* Default to the day the user is looking at */
- ico = ical_new ("", user_name, "");
- ico->new = 1;
- ico->dtstart = time_add_minutes (gcal->current_display, day_begin * 60);
- ico->dtend = time_add_minutes (ico->dtstart, day_begin * 60 + 30 );
-
- ee = event_editor_new (gcal, ico);
- gtk_widget_show (ee);
-}
-
-static void
-display_objedit_today (GtkWidget *widget, GnomeCalendar *gcal)
-{
- GtkWidget *ee;
-
- ee = event_editor_new (gcal, NULL);
- gtk_widget_show (ee);
-}
-
-GnomeCalendar *
-gnome_calendar_locate (const char *pathname)
-{
- GList *l;
-
- if (pathname == NULL || pathname [0] == 0)
- pathname = user_calendar_file;
-
- for (l = all_calendars; l; l = l->next){
- GnomeCalendar *gcal = l->data;
-
- if (strcmp (gcal->cal->filename, pathname) == 0){
- return gcal;
- }
- }
- return NULL;
-}
-
-static void
-close_cmd (GtkWidget *widget, GnomeCalendar *gcal)
-{
- all_calendars = g_list_remove (all_calendars, gcal);
-
- if (gcal->cal->modified){
- if (!gcal->cal->filename)
- save_calendar_cmd (widget, gcal);
- else
- calendar_save (gcal->cal, gcal->cal->filename);
- }
-
- gtk_widget_destroy (GTK_WIDGET (gcal));
- active_calendars--;
-
- if (active_calendars == 0){
- unregister_calendar_services ();
- gtk_main_quit ();
- }
-}
-
-void
-time_format_changed (void)
-{
- GList *l;
-
- for (l = all_calendars; l; l = l->next)
- gnome_calendar_time_format_changed (GNOME_CALENDAR (l->data));
-}
-
-void
-colors_changed (void)
-{
- GList *l;
-
- for (l = all_calendars; l; l = l->next)
- gnome_calendar_colors_changed (GNOME_CALENDAR (l->data));
-}
-
-void
-todo_properties_changed(void)
-{
- GList *l;
-
- for (l = all_calendars; l; l = l->next)
- gnome_calendar_todo_properties_changed (GNOME_CALENDAR (l->data));
-}
-
-
-
-static void
-quit_cmd (void)
-{
- while (all_calendars){
- GnomeCalendar *cal = GNOME_CALENDAR (all_calendars->data);
-
- close_cmd (GTK_WIDGET (cal), cal);
- }
-}
-
-/* Sets a clock cursor for the specified calendar window */
-static void
-set_clock_cursor (GnomeCalendar *gcal)
-{
- GdkCursor *cursor;
-
- cursor = gdk_cursor_new (GDK_WATCH);
- gdk_window_set_cursor (GTK_WIDGET (gcal)->window, cursor);
- gdk_cursor_destroy (cursor);
- gdk_flush ();
-}
-
-/* Resets the normal cursor for the specified calendar window */
-static void
-set_normal_cursor (GnomeCalendar *gcal)
-{
- gdk_window_set_cursor (GTK_WIDGET (gcal)->window, NULL);
- gdk_flush ();
-}
-
-static void
-previous_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- set_clock_cursor (gcal);
- gnome_calendar_previous (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-next_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- set_clock_cursor (gcal);
- gnome_calendar_next (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-today_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- set_clock_cursor (gcal);
- gnome_calendar_goto_today (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-goto_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- goto_dialog (gcal);
-}
-
-static void
-new_calendar_cmd (GtkWidget *widget, void *data)
-{
- new_calendar (full_name, NULL, NULL, NULL, FALSE);
-}
-
-static void
-open_ok (GtkWidget *widget, GtkFileSelection *fs)
-{
- GtkWidget *error_dialog;
- int ret;
- if(!g_file_exists (gtk_file_selection_get_filename (fs))) {
- error_dialog = gnome_message_box_new (
- _("File not found"),
- GNOME_MESSAGE_BOX_ERROR,
- GNOME_STOCK_BUTTON_OK,
- NULL);
-
- gnome_dialog_set_parent (GNOME_DIALOG (error_dialog), GTK_WINDOW (fs));
- ret = gnome_dialog_run (GNOME_DIALOG (error_dialog));
- } else {
- /* FIXME: find out who owns this calendar and use that name */
- new_calendar ("Somebody", gtk_file_selection_get_filename (fs), NULL, NULL, FALSE);
- gtk_widget_destroy (GTK_WIDGET (fs));
- }
-}
-
-static void
-open_calendar_cmd (GtkWidget *widget, void *data)
-{
- GtkFileSelection *fs;
-
- fs = GTK_FILE_SELECTION (gtk_file_selection_new (_("Open calendar")));
-
- gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
- (GtkSignalFunc) open_ok,
- fs);
- gtk_signal_connect_object (GTK_OBJECT (fs->cancel_button), "clicked",
- (GtkSignalFunc) gtk_widget_destroy,
- GTK_OBJECT (fs));
-
- gtk_widget_show (GTK_WIDGET (fs));
- gtk_grab_add (GTK_WIDGET (fs)); /* Yes, it is modal, so sue me */
-}
-
-static void
-save_ok (GtkWidget *widget, GtkFileSelection *fs)
-{
- GnomeCalendar *gcal;
- gchar *fname;
-
- gcal = GNOME_CALENDAR (gtk_object_get_user_data (GTK_OBJECT (fs)));
- gtk_window_set_wmclass (GTK_WINDOW (gcal), "gnomecal", "gnomecal");
-
- fname = g_strdup (gtk_file_selection_get_filename (fs));
- calendar_save (gcal->cal, fname);
- g_free(fname);
- gtk_main_quit ();
-}
-
-static gint
-close_save (GtkWidget *w)
-{
- gtk_main_quit ();
- return TRUE;
-}
-
-static void
-save_as_calendar_cmd (GtkWidget *widget, void *data)
-{
- GtkFileSelection *fs;
-
- fs = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save calendar")));
- gtk_object_set_user_data (GTK_OBJECT (fs), data);
-
- gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
- (GtkSignalFunc) save_ok,
- fs);
- gtk_signal_connect_object (GTK_OBJECT (fs->cancel_button), "clicked",
- (GtkSignalFunc) close_save,
- GTK_OBJECT (fs));
- gtk_signal_connect_object (GTK_OBJECT (fs), "delete_event",
- GTK_SIGNAL_FUNC (close_save),
- GTK_OBJECT (fs));
- gtk_widget_show (GTK_WIDGET (fs));
- gtk_grab_add (GTK_WIDGET (fs)); /* Yes, it is modal, so sue me even more */
- gtk_main ();
- gtk_widget_destroy (GTK_WIDGET (fs));
-}
-
-static void
-properties_cmd (GtkWidget *widget, GtkWidget *gcal)
-{
- properties (gcal);
-}
-
-static void
-save_calendar_cmd (GtkWidget *widget, void *data)
-{
- GnomeCalendar *gcal = data;
-
- if (gcal->cal->filename){
- struct stat s;
-
- if (stat (gcal->cal->filename, &s) == -1){
- if (errno == ENOENT)
- calendar_save (gcal->cal, gcal->cal->filename);
-
- return;
- }
-
- if (s.st_mtime != gcal->cal->file_time){
- GtkWidget *box;
- char *str;
- int b;
-
- str = g_strdup_printf (
- _("File %s has changed since it was loaded\nContinue?"),
- gcal->cal->filename);
- box = gnome_message_box_new (str, GNOME_MESSAGE_BOX_INFO,
- GNOME_STOCK_BUTTON_YES,
- GNOME_STOCK_BUTTON_NO,
- NULL);
- g_free (str);
- gnome_dialog_set_default (GNOME_DIALOG (box), 1);
- b = gnome_dialog_run (GNOME_DIALOG (box));
-
- if (b != 0)
- return;
- }
-
- calendar_save (gcal->cal, gcal->cal->filename);
- } else
- save_as_calendar_cmd (widget, data);
-}
-
-/*
- * Saves @gcal if it is the default calendar
- */
-void
-save_default_calendar (GnomeCalendar *gcal)
-{
- if (!gcal->cal->filename)
- return;
-
- save_calendar_cmd (NULL, gcal);
-}
-
-#if 0
-static void
-make_html_cmd (GtkWidget *widget, GtkWidget *gcal)
-{
- make_month_html (gcal, "output.html");
-}
-#endif
-
-static GnomeUIInfo gnome_cal_file_menu [] = {
- GNOMEUIINFO_MENU_NEW_ITEM(N_("_New calendar"),
- N_("Create a new calendar"),
- new_calendar_cmd, NULL),
-
- GNOMEUIINFO_MENU_OPEN_ITEM(open_calendar_cmd, NULL),
-
- GNOMEUIINFO_MENU_SAVE_ITEM(save_calendar_cmd, NULL),
-
- GNOMEUIINFO_MENU_SAVE_AS_ITEM(save_as_calendar_cmd, NULL),
-
- GNOMEUIINFO_SEPARATOR,
-
-#if 0
- GNOMEUIINFO_ITEM(N_("Create HTML for this month"),
- N_("Creates an HTML version of this month's appointments"),
- make_html_cmd, NULL);
-#endif
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_MENU_CLOSE_ITEM(close_cmd, NULL),
-
- GNOMEUIINFO_MENU_EXIT_ITEM(quit_cmd, NULL),
-
- GNOMEUIINFO_END
-};
-
-static GnomeUIInfo gnome_cal_edit_menu [] = {
- { GNOME_APP_UI_ITEM, N_("_New appointment..."),
- N_("Create a new appointment"), display_objedit, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_NEW, 0, 0, NULL },
- { GNOME_APP_UI_ITEM, N_("New appointment for _today..."),
- N_("Create a new appointment for today"),
- display_objedit_today, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_NEW, 0, 0, NULL },
- GNOMEUIINFO_END
-};
-
-static GnomeUIInfo gnome_cal_help_menu [] = {
- GNOMEUIINFO_HELP ("gnomecal"),
-
- GNOMEUIINFO_MENU_ABOUT_ITEM(about_calendar_cmd, NULL),
-
- GNOMEUIINFO_END
-};
-
-static GnomeUIInfo gnome_cal_settings_menu [] = {
- GNOMEUIINFO_MENU_PREFERENCES_ITEM(properties_cmd, NULL),
-
- GNOMEUIINFO_END
-};
-
-static GnomeUIInfo gnome_cal_menu [] = {
- GNOMEUIINFO_MENU_FILE_TREE(gnome_cal_file_menu),
- GNOMEUIINFO_MENU_EDIT_TREE(gnome_cal_edit_menu),
- GNOMEUIINFO_MENU_SETTINGS_TREE(gnome_cal_settings_menu),
- GNOMEUIINFO_MENU_HELP_TREE(gnome_cal_help_menu),
- GNOMEUIINFO_END
-};
-
-static GnomeUIInfo gnome_toolbar [] = {
- GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new appointment"), display_objedit, GNOME_STOCK_PIXMAP_NEW),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Prev"), N_("Go back in time"), previous_clicked, GNOME_STOCK_PIXMAP_BACK),
- GNOMEUIINFO_ITEM_STOCK (N_("Today"), N_("Go to present time"), today_clicked, GNOME_STOCK_PIXMAP_HOME),
- GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Go forward in time"), next_clicked, GNOME_STOCK_PIXMAP_FORWARD),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Go to"), N_("Go to a specific date"), goto_clicked, GNOME_STOCK_PIXMAP_JUMP_TO),
-
- GNOMEUIINFO_END
-};
-
-static void
-setup_menu (GtkWidget *gcal)
-{
- gnome_app_create_menus_with_data (GNOME_APP (gcal), gnome_cal_menu, gcal);
- gnome_app_create_toolbar_with_data (GNOME_APP (gcal), gnome_toolbar, gcal);
- gnome_app_install_menu_hints(GNOME_APP(gcal), gnome_cal_menu);
-}
-
-static void
-setup_appbar (GtkWidget *gcal)
-{
- GtkWidget *appbar;
-
- appbar = gnome_appbar_new (FALSE, TRUE, GNOME_PREFERENCES_USER);
- gnome_app_set_statusbar (GNOME_APP (gcal), GTK_WIDGET (appbar));
-}
-
-static gint
-calendar_close_event (GtkWidget *widget, GdkEvent *event, GnomeCalendar *gcal)
-{
- close_cmd (widget, gcal);
- return TRUE;
-}
-
-GnomeCalendar *
-new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, gboolean hidden)
-{
- GtkWidget *toplevel;
- char title[128];
- int xpos, ypos, width, height;
-
- /* i18n: This "%s%s" indicates possession. Languages where the order is
- * the inverse should translate it to "%2$s%1$s".
- */
- g_snprintf(title, 128, _("%s%s"), full_name, _("'s calendar"));
-
- toplevel = gnome_calendar_new (title);
-
- if (gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height)){
- if (xpos != -1)
- gtk_widget_set_uposition (toplevel, xpos, ypos);
-#if 0
- if (width != -1)
- gtk_widget_set_usize (toplevel, width, 600);
-#endif
- }
-#if 0
- gtk_widget_set_usize (toplevel, width, 600);
-#endif
-
- setup_appbar (toplevel);
- setup_menu (toplevel);
-
-
- if (page)
- gnome_calendar_set_view (GNOME_CALENDAR (toplevel), page);
-
- if (calendar_file && g_file_exists (calendar_file))
- gnome_calendar_load (GNOME_CALENDAR (toplevel), calendar_file);
- else
- GNOME_CALENDAR (toplevel)->cal->filename = g_strdup (calendar_file);
-
- gtk_signal_connect (GTK_OBJECT (toplevel), "delete_event",
- GTK_SIGNAL_FUNC(calendar_close_event), toplevel);
-
- active_calendars++;
- all_calendars = g_list_prepend (all_calendars, toplevel);
-
- if (hidden){
- GnomeWinState state;
-
- /* Realize the toplevel window to prevent a segfault */
- gtk_widget_realize (toplevel);
- state = gnome_win_hints_get_state (toplevel);
-
- state |= WIN_STATE_MINIMIZED;
- gnome_win_hints_set_state (toplevel, state);
- }
-
- gtk_widget_show (toplevel);
-
- return GNOME_CALENDAR (toplevel);
-}
-
-static void
-process_dates (void)
-{
- if (!from_t)
- from_t = time_day_begin (time (NULL));
-
- if (!to_t || to_t < from_t)
- to_t = time_add_day (from_t, 1);
-}
-
-enum {
- GEOMETRY_KEY = -1,
- USERFILE_KEY = -2,
- VIEW_KEY = -3,
- HIDDEN_KEY = -4,
- TODO_KEY = -5,
- DEBUG_KEY = -6
-};
-
-/* Lists used to startup various GnomeCalendars */
-static GList *start_calendars;
-static GList *start_geometries;
-static GList *start_views;
-
-static int
-same_day (struct tm *a, struct tm *b)
-{
- return (a->tm_mday == b->tm_mday &&
- a->tm_mon == b->tm_mon &&
- a->tm_year == b->tm_year);
-}
-
-static void
-dump_events (void)
-{
- Calendar *cal;
- GList *l;
- char *s;
- time_t now = time (NULL);
- struct tm today = *localtime (&now);
-
- process_dates ();
- init_calendar ();
-
- cal = calendar_new (full_name);
- s = calendar_load (cal, load_file ? load_file : user_calendar_file);
- if (s){
- printf ("error: %s\n", s);
- exit (1);
- }
- l = calendar_get_events_in_range (cal, from_t, to_t);
- for (; l; l = l->next){
- char start [80], end [80];
- CalendarObject *co = l->data;
- struct tm ts, te;
- char *format;
-
- ts = *localtime (&co->ev_start);
- te = *localtime (&co->ev_end);
-
- if (same_day (&today, &ts))
- format = N_("%H:%M");
- else
- format = N_("%A %b %d, %H:%M");
- strftime (start, sizeof (start), _(format), &ts);
-
- if (!same_day (&ts, &te))
- format = N_("%A %b %d, %H:%M");
- strftime (end, sizeof (start), _(format), &te);
-
- printf ("%s -- %s\n", start, end);
- printf (" %s\n", co->ico->summary);
- }
- calendar_destroy_event_list (l);
- calendar_destroy (cal);
- exit (0);
-}
-
-static void
-dump_todo (void)
-{
- Calendar *cal;
- GList *l;
- char *s;
-
- process_dates ();
- init_calendar ();
-
- cal = calendar_new (full_name);
- s = calendar_load (cal, load_file ? load_file : user_calendar_file);
- if (s){
- printf ("error: %s\n", s);
- exit (1);
- }
- for (l = cal->todo; l; l = l->next){
- iCalObject *object = l->data;
-
- if (object->type != ICAL_TODO)
- continue;
-
- printf ("[%s]: %s\n", object->organizer, object->summary);
- }
- calendar_destroy (cal);
- exit (0);
-}
-
-extern time_t get_date ();
-
-static void
-parse_an_arg (poptContext ctx,
- enum poptCallbackReason reason,
- const struct poptOption *opt,
- char *arg, void *data)
-{
- switch (opt->val){
- case 'f':
- from_t = get_date (arg, NULL);
- break;
-
- case 't':
- to_t = get_date (arg, NULL);
- break;
-
- case GEOMETRY_KEY:
- start_geometries = g_list_append (start_geometries, arg);
- break;
-
- case USERFILE_KEY:
- /* This is a special key that tells the program to load
- * the user's calendar file. This allows session management
- * to work even if the User's home directory changes location
- * (ie, on a networked setup).
- */
- arg = COOKIE_USER_HOME_DIR;
- /* fall through */
- break;
-
- case VIEW_KEY:
- start_views = g_list_append (start_views, arg);
- break;
-
- case 'F':
- start_calendars = g_list_append (start_calendars, arg);
- break;
-
- case TODO_KEY:
- show_todo = 1;
- break;
-
- case 'e':
- show_events = 1;
- break;
-
- case HIDDEN_KEY:
- startup_hidden = 1;
- break;
-
- case DEBUG_KEY:
- if (!g_strcasecmp (arg, "alarms"))
- debug_alarms = 1;
- break;
-
- default:
- }
-}
-
-static const struct poptOption options [] = {
- { NULL, '\0', POPT_ARG_CALLBACK, parse_an_arg, 0, NULL, NULL },
- { "events", 'e', POPT_ARG_NONE, NULL, 'e', N_("Show events and quit"),
- NULL },
- { "todo", 0, POPT_ARG_NONE, NULL, TODO_KEY, N_("Show TO-DO items and quit"),
- NULL },
- { "from", 'f', POPT_ARG_STRING, NULL, 'f', N_("Specifies start date [for --events]"), N_("DATE") },
- { "file", 'F', POPT_ARG_STRING, NULL, 'F', N_("File to load calendar from"), N_("FILE") },
- { "userfile", '\0', POPT_ARG_NONE, NULL, USERFILE_KEY, N_("Load the user calendar"), NULL },
- { "geometry", '\0', POPT_ARG_STRING, NULL, GEOMETRY_KEY, N_("Geometry for starting up"), N_("GEOMETRY") },
- { "view", '\0', POPT_ARG_STRING, NULL, VIEW_KEY, N_("The startup view mode (dayview, weekview, monthview, yearview)"), N_("VIEW") },
- { "to", 't', POPT_ARG_STRING, NULL, 't', N_("Specifies ending date [for --events]"), N_("DATE") },
- { "hidden", 0, POPT_ARG_NONE, NULL, HIDDEN_KEY, N_("If used, starts in iconic mode"), NULL },
- { "debug", 'd', POPT_ARG_STRING, NULL, DEBUG_KEY, N_("Enable debugging output of TYPE (alarms)"), N_("TYPE") },
- { NULL, '\0', 0, NULL, 0}
-};
-
-static void
-session_die (void)
-{
- quit_cmd ();
-}
-
-/*
- * Save the session callback
- */
-static int
-session_save_state (GnomeClient *client, gint phase, GnomeRestartStyle save_style, gint shutdown,
- GnomeInteractStyle interact_style, gint fast, gpointer client_data)
-{
- char *sess_id;
- char **argv = (char **) g_malloc (sizeof (char *) * ((active_calendars * 6) + 3));
- GList *l, *free_list = 0;
- int i;
-
- sess_id = gnome_client_get_id (client);
-
- argv [0] = client_data;
- for (i = 1, l = all_calendars; l; l = l->next){
- GnomeCalendar *gcal = GNOME_CALENDAR (l->data);
- char *geometry;
-
- geometry = gnome_geometry_string (GTK_WIDGET (gcal)->window);
-
- if (strcmp (gcal->cal->filename, user_calendar_file) == 0)
- argv [i++] = "--userfile";
- else {
- argv [i++] = "--file";
- argv [i++] = gcal->cal->filename;
- }
- argv [i++] = "--geometry";
- argv [i++] = geometry;
- argv [i++] = "--view";
- argv [i++] = gnome_calendar_get_current_view_name (gcal);
- free_list = g_list_append (free_list, geometry);
- calendar_save (gcal->cal, gcal->cal->filename);
- }
- argv [i] = NULL;
- gnome_client_set_clone_command (client, i, argv);
- gnome_client_set_restart_command (client, i, argv);
-
- for (l = free_list; l; l = l->next)
- g_free (l->data);
- g_list_free (free_list);
-
- return 1;
-}
-
-int
-main(int argc, char *argv[])
-{
- GnomeClient *client;
- CORBA_Environment ev;
-
- bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);
-
- CORBA_exception_init (&ev);
-
- gnome_CORBA_init_with_popt_table (
- "calendar", VERSION, &argc, argv,
- options, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev);
-
- orb = gnome_CORBA_ORB ();
- poa = (PortableServer_POA)CORBA_ORB_resolve_initial_references (orb, "RootPOA", &ev);
- if (ev._major == CORBA_NO_EXCEPTION){
- init_corba_server ();
- }
-
- if (show_events)
- dump_events ();
- if (show_todo)
- dump_todo ();
-
- client = gnome_master_client ();
- if (client){
- gtk_signal_connect (GTK_OBJECT (client), "save_yourself",
- GTK_SIGNAL_FUNC (session_save_state), argv [0]);
- gtk_signal_connect (GTK_OBJECT (client), "die",
- GTK_SIGNAL_FUNC (session_die), NULL);
- }
-
- process_dates ();
- alarm_init ();
- init_calendar ();
-
- /*
- * Load all of the calendars specifies in the command line with
- * the geometry specificied -if any-
- */
- if (start_calendars){
- GList *p, *g, *v;
- char *title;
-
- p = start_calendars;
- g = start_geometries;
- v = start_views;
- while (p){
- char *file = p->data;
- char *geometry = g ? g->data : NULL;
- char *page_name = v ? v->data : NULL;
-
- if (file == COOKIE_USER_HOME_DIR)
- file = user_calendar_file;
-
- if (strcmp (file, user_calendar_file) == 0)
- title = full_name;
- else
- title = file;
- new_calendar (title, file, geometry, page_name, startup_hidden);
-
- p = p->next;
- if (g)
- g = g->next;
- if (v)
- v = v->next;
- }
- g_list_free (p);
- } else {
- char *geometry = start_geometries ? start_geometries->data : NULL;
- char *page_name = start_views ? start_views->data : NULL;
-
- new_calendar (full_name, user_calendar_file, geometry, page_name, startup_hidden);
- }
- gtk_main ();
- return 0;
-}
diff --git a/calendar/gui/main.h b/calendar/gui/main.h
deleted file mode 100644
index 2785e1d2d1..0000000000
--- a/calendar/gui/main.h
+++ /dev/null
@@ -1,101 +0,0 @@
-#ifndef MAIN_H
-#define MAIN_H
-
-/* Calendar preferences */
-
-extern int day_begin, day_end;
-extern char *user_name;
-extern int am_pm_flag;
-extern int week_starts_on_monday;
-
-
-/* This enum and the following array define the color preferences */
-
-typedef enum {
- COLOR_PROP_OUTLINE_COLOR, /* Color of calendar outline */
- COLOR_PROP_HEADING_COLOR, /* Color for headings */
- COLOR_PROP_EMPTY_DAY_BG, /* Background color for empty days */
- COLOR_PROP_MARK_DAY_BG, /* Background color for days with appointments */
- COLOR_PROP_PRELIGHT_DAY_BG, /* Background color for prelighted day */
- COLOR_PROP_DAY_FG, /* Color for day numbers */
- COLOR_PROP_CURRENT_DAY_FG, /* Color for current day's number */
- COLOR_PROP_TODO_NOT_DUE_YET, /* Color for Todo items not yet due */
- COLOR_PROP_TODO_DUE_TODAY, /* Color for Todo items due today */
- COLOR_PROP_TODO_OVERDUE, /* Color for Todo items that are overdue */
- COLOR_PROP_LAST /* Number of color properties */
-} ColorProp;
-
-struct color_prop {
- int r; /* Values are in [0, 65535] */
- int g;
- int b;
- char *label; /* Label for properties dialog */
- char *key; /* Key for gnome_config */
-};
-
-extern struct color_prop color_props[];
-
-
-/* todo preferences */
-extern int todo_show_due_date;
-
-extern int todo_item_dstatus_highlight_overdue;
-extern int todo_item_dstatus_highlight_due_today;
-extern int todo_item_dstatus_highlight_not_due_yet;
-
-extern int todo_show_time_remaining;
-extern int todo_show_priority;
-extern char *todo_overdue_font_text;
-extern gboolean todo_style_changed;
-extern gint todo_current_sort_column;
-extern gint todo_current_sort_type;
-
-/* alarm stuff */
-extern CalendarAlarm alarm_defaults[4];
-extern gboolean beep_on_display;
-extern gboolean enable_aalarm_timeout;
-extern guint audio_alarm_timeout;
-extern const guint MAX_AALARM_TIMEOUT;
-extern gboolean enable_snooze;
-extern guint snooze_secs;
-extern const guint MAX_SNOOZE_SECS;
-
-/* Creates and runs the preferences dialog box */
-void properties (GtkWidget *toplevel);
-
-/* Asks for all the time-related displays to be updated when the user changes the time format
- * preferences.
- */
-void time_format_changed (void);
-
-/* Asks for all the month items' colors to be reset */
-void colors_changed (void);
-
-/* Asks for all todo lists to reflect the accurate properties */
-void todo_properties_changed(void);
-
-/* Creates and runs the Go-to date dialog */
-void goto_dialog (GnomeCalendar *gcal);
-
-/* Returns a pointer to a statically-allocated string with a representation of the specified color.
- * Values must be in [0, 65535].
- */
-char *build_color_spec (int r, int g, int b);
-
-/* Parses a color specification of the form "#%04x%04x%04x" and returns the color components. */
-void parse_color_spec (char *spec, int *r, int *g, int *b);
-
-/* Calls build_color_spec() for the color in the specified property number */
-char *color_spec_from_prop (ColorProp propnum);
-
-void save_default_calendar (GnomeCalendar *gcal);
-
-GnomeCalendar *new_calendar (char *full_name, char *calendar_file,
- char *geometry, char *page, gboolean hidden);
-
-#endif
-
-
-
-
-
diff --git a/calendar/gui/mark.c b/calendar/gui/mark.c
deleted file mode 100644
index 2de8e2b880..0000000000
--- a/calendar/gui/mark.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Functions to mark calendars
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include "gnome-cal.h"
-#include "main.h"
-#include "mark.h"
-#include "timeutil.h"
-
-
-/* Frees the specified data when an object is destroyed */
-static void
-free_data (GtkObject *object, gpointer data)
-{
- g_free (data);
-}
-
-/* If the array of "marked" attributes for the days in a a month item has not been created yet, this
- * function creates the array and clears it. Otherwise, it just returns the existing array.
- */
-static char *
-get_attributes (GnomeMonthItem *mitem)
-{
- char *attrs;
-
- attrs = gtk_object_get_data (GTK_OBJECT (mitem), "day_mark_attributes");
-
- if (!attrs) {
- attrs = g_new0 (char, 42);
- gtk_object_set_data (GTK_OBJECT (mitem), "day_mark_attributes", attrs);
- gtk_signal_connect (GTK_OBJECT (mitem), "destroy",
- (GtkSignalFunc) free_data,
- attrs);
- }
-
- return attrs;
-}
-
-void
-colorify_month_item (GnomeMonthItem *mitem, GetColorFunc func, gpointer func_data)
-{
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
- g_return_if_fail (func != NULL);
-
- unmark_month_item (mitem);
-
- /* We have to do this in several calls to gnome_canvas_item_set(), as color_spec_from_prop()
- * returns a pointer to a static string -- and we need several values.
- */
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem),
- "heading_color", (* func) (COLOR_PROP_HEADING_COLOR, func_data),
- NULL);
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem),
- "outline_color", (* func) (COLOR_PROP_OUTLINE_COLOR, func_data),
- NULL);
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem),
- "day_box_color", (* func) (COLOR_PROP_EMPTY_DAY_BG, func_data),
- NULL);
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem),
- "day_color", (* func) (COLOR_PROP_DAY_FG, func_data),
- NULL);
-}
-
-/* In the month item, marks all the days that are touched by the specified time span. Assumes that
- * the time span is completely contained within the month. The array of day attributes is modified
- * accordingly.
- */
-static void
-mark_event_in_month (GnomeMonthItem *mitem, time_t start, time_t end)
-{
- struct tm tm;
- int day_index;
-
- tm = *localtime (&start);
-
- for (; start <= end; start += 60 * 60 * 24) {
- mktime (&tm); /* normalize the time */
-
- /* Figure out the day index that corresponds to this time */
-
- day_index = gnome_month_item_day2index (mitem, tm.tm_mday);
- g_assert (day_index >= 0);
-
- /* Mark the day box */
-
- mark_month_item_index (mitem, day_index, default_color_func, NULL);
-
- /* Next day */
-
- tm.tm_mday++;
- }
-}
-
-void
-mark_month_item (GnomeMonthItem *mitem, Calendar *cal)
-{
- time_t month_begin, month_end;
- GList *list, *l;
- CalendarObject *co;
-
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
- g_return_if_fail (cal != NULL);
-
- month_begin = time_month_begin (time_from_day (mitem->year, mitem->month, 1));
- month_end = time_month_end (month_begin);
-
- list = calendar_get_events_in_range (cal, month_begin, month_end);
-
- for (l = list; l; l = l->next) {
- co = l->data;
-
- /* We clip the event's start and end times to the month's limits */
-
- mark_event_in_month (mitem, MAX (co->ev_start, month_begin), MIN (co->ev_end, month_end));
- }
-
- calendar_destroy_event_list (list);
-}
-
-void
-mark_month_item_index (GnomeMonthItem *mitem, int index, GetColorFunc func, gpointer func_data)
-{
- char *attrs;
- GnomeCanvasItem *item;
-
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
- g_return_if_fail ((index >= 0) && (index < 42));
- g_return_if_fail (func != NULL);
-
- attrs = get_attributes (mitem);
-
- attrs[index] = TRUE;
-
- item = gnome_month_item_num2child (mitem, GNOME_MONTH_ITEM_DAY_BOX + index);
- gnome_canvas_item_set (item,
- "fill_color", (* func) (COLOR_PROP_MARK_DAY_BG, func_data),
- NULL);
-}
-
-void
-unmark_month_item (GnomeMonthItem *mitem)
-{
- int i;
- char *attrs;
- GnomeCanvasItem *item;
-
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
-
- attrs = get_attributes (mitem);
-
- /* Find marked days and unmark them by turning off their marked attribute flag and changing
- * the color.
- */
-
- for (i = 0; i < 42; i++)
- if (attrs[i]) {
- attrs[i] = FALSE;
-
- item = gnome_month_item_num2child (mitem, GNOME_MONTH_ITEM_DAY_BOX + i);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_EMPTY_DAY_BG),
- NULL);
- }
-}
-
-/* Handles EnterNotify and LeaveNotify events from the month item's day groups, and performs
- * appropriate prelighting.
- */
-static gint
-day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- GnomeMonthItem *mitem;
- GnomeCanvasItem *box;
- int child_num, day;
- GetColorFunc func;
- gpointer func_data;
- char *color;
- char *attrs;
-
- /* We only accept enters and leaves */
-
- if (!((event->type == GDK_ENTER_NOTIFY) || (event->type == GDK_LEAVE_NOTIFY)))
- return FALSE;
-
- /* Get index information */
-
- mitem = GNOME_MONTH_ITEM (data);
- child_num = gnome_month_item_child2num (mitem, item);
- day = gnome_month_item_num2day (mitem, child_num);
-
- if (day == 0)
- return FALSE; /* it was a day outside the month's range */
-
- child_num -= GNOME_MONTH_ITEM_DAY_GROUP;
- box = gnome_month_item_num2child (mitem, GNOME_MONTH_ITEM_DAY_BOX + child_num);
-
- /* Get colors */
-
- func = gtk_object_get_data (GTK_OBJECT (mitem), "prelight_color_func");
- func_data = gtk_object_get_data (GTK_OBJECT (mitem), "prelight_color_data");
-
- /* Now actually set the proper color in the item */
-
- switch (event->type) {
- case GDK_ENTER_NOTIFY:
- color = (* func) (COLOR_PROP_PRELIGHT_DAY_BG, func_data);
- gnome_canvas_item_set (box,
- "fill_color", color,
- NULL);
- break;
-
- case GDK_LEAVE_NOTIFY:
- attrs = get_attributes (mitem);
- color = (* func) (attrs[child_num] ? COLOR_PROP_MARK_DAY_BG : COLOR_PROP_EMPTY_DAY_BG,
- func_data);
- gnome_canvas_item_set (box,
- "fill_color", color,
- NULL);
- break;
-
- default:
- g_assert_not_reached ();
- }
-
- return TRUE;
-}
-
-void
-month_item_prepare_prelight (GnomeMonthItem *mitem, GetColorFunc func, gpointer func_data)
-{
- GnomeCanvasItem *day_group;
- int i;
-
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
- g_return_if_fail (func != NULL);
-
- /* Store the function in the object data */
-
- gtk_object_set_data (GTK_OBJECT (mitem), "prelight_color_func", func);
- gtk_object_set_data (GTK_OBJECT (mitem), "prelight_color_data", func_data);
-
- /* Connect the appropriate signals to perform prelighting */
-
- for (i = 0; i < 42; i++) {
- day_group = gnome_month_item_num2child (GNOME_MONTH_ITEM (mitem), GNOME_MONTH_ITEM_DAY_GROUP + i);
- gtk_signal_connect (GTK_OBJECT (day_group), "event",
- (GtkSignalFunc) day_event,
- mitem);
- }
-}
-
-char *
-default_color_func (ColorProp propnum, gpointer data)
-{
- return color_spec_from_prop (propnum);
-}
diff --git a/calendar/gui/mark.h b/calendar/gui/mark.h
deleted file mode 100644
index cf8f7c1496..0000000000
--- a/calendar/gui/mark.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Functions to mark calendars
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef MARK_H
-#define MARK_H
-
-#include "calendar.h"
-#include "gnome-month-item.h"
-
-
-/* These are the fonts used for the montly calendars */
-
-#define HEADING_FONTSET "-adobe-helvetica-medium-r-*-*-14-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-17-*-*-*-p-*-koi8-r,-*-*-medium-r-*-*-14-*-*-*-*-*-ksc5601.1987-0,*"
-#define TITLE_FONTSET "-adobe-helvetica-bold-r-normal--12-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-14-*-*-*-p-*-koi8-r,-*-*-bold-r-normal--12-*-*-*-*-*-ksc5601.1987-0,*"
-#define DAY_HEADING_FONTSET "-adobe-helvetica-medium-r-normal--10-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-11-*-*-*-p-*-koi8-r,-*-*-medium-r-normal--10-*-*-*-*-*-ksc5601.1987-0,*"
-#define NORMAL_DAY_FONTSET "-adobe-helvetica-medium-r-normal--10-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-11-*-*-*-p-*-koi8-r,-*-*-medium-r-normal--10-*-*-*-*-*-ksc5601.1987-0,*"
-#define CURRENT_DAY_FONTSET "-adobe-helvetica-bold-r-normal--12-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-14-*-*-*-p-*-koi8-r,-*-*-bold-r-normal--12-*-*-*-*-*-ksc5601.1987-0,*"
-#define BIG_DAY_HEADING_FONTSET "-adobe-helvetica-bold-r-normal--14-*-*-*-p-*-*-*,-cronyx-helvetica-bold-r-normal-*-17-*-*-*-p-*-koi8-r,-*-*-bold-r-normal--14-*-*-*-*-*-ksc5601.1987-0,*"
-#define BIG_NORMAL_DAY_FONTSET "-adobe-helvetica-medium-r-normal--14-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-17-*-*-*-p-*-koi8-r,-*-*-medium-r-normal--14-*-*-*-*-*-ksc5601.1987-0,*"
-#define BIG_CURRENT_DAY_FONTSET "-adobe-helvetica-bold-r-normal--14-*-*-*-p-*-*-*,-cronyx-helvetica-bold-r-normal-*-17-*-*-*-p-*-koi8-r,-*-*-bold-r-normal--14-*-*-*-*-*-ksc5601.1987-0,*"
-#define EVENT_FONTSET "-adobe-helvetica-medium-r-*-*-10-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-11-*-*-*-p-*-koi8-r,-*-*-medium-r-normal--10-*-*-*-*-*-ksc5601.1987-0,*"
-
-
-/* Functions of this type are used by the marking functions to fetch color specifications. Such
- * a function must return a color spec based on the property passed to it.
- */
-typedef char * (* GetColorFunc) (ColorProp propnum, gpointer data);
-
-
-/* Sets the user-configured colors and font for a month item. It also tags the days as unmarked. */
-void colorify_month_item (GnomeMonthItem *month, GetColorFunc func, gpointer func_data);
-
-/* Takes a monthly calendar item and marks the days that have events scheduled for them in the
- * specified calendar. It also highlights the current day.
- */
-void mark_month_item (GnomeMonthItem *mitem, Calendar *cal);
-
-/* Marks a day specified by index, not by day number */
-void mark_month_item_index (GnomeMonthItem *mitem, int index, GetColorFunc func, gpointer func_data);
-
-/* Unmarks all the days in the specified month item */
-void unmark_month_item (GnomeMonthItem *mitem);
-
-/* Prepares a monthly calendar item to prelight when the mouse goes over the days. */
-
-void month_item_prepare_prelight (GnomeMonthItem *mitem, GetColorFunc func, gpointer func_data);
-
-/* This is the default prelight function you can use for most puposes. You can use NULL as the
- * func_data.
- */
-char *default_color_func (ColorProp prop_num, gpointer data);
-
-
-#endif
diff --git a/calendar/gui/month-view.c b/calendar/gui/month-view.c
deleted file mode 100644
index 5df7b7a23d..0000000000
--- a/calendar/gui/month-view.c
+++ /dev/null
@@ -1,798 +0,0 @@
-/* Month view display for gncal
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <libgnomeui/gnome-canvas-text.h>
-#include "eventedit.h"
-#include "layout.h"
-#include "month-view.h"
-#include "main.h"
-#include "mark.h"
-#include "quick-view.h"
-#include "timeutil.h"
-
-
-/* Spacing between title and calendar */
-#define SPACING 4
-
-/* Padding between day borders and event text */
-#define EVENT_PADDING 3
-
-
-static void month_view_class_init (MonthViewClass *class);
-static void month_view_init (MonthView *mv);
-static void month_view_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void month_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-
-static GnomeCanvasClass *parent_class;
-
-
-GtkType
-month_view_get_type (void)
-{
- static GtkType month_view_type = 0;
-
- if (!month_view_type) {
- GtkTypeInfo month_view_info = {
- "MonthView",
- sizeof (MonthView),
- sizeof (MonthViewClass),
- (GtkClassInitFunc) month_view_class_init,
- (GtkObjectInitFunc) month_view_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- month_view_type = gtk_type_unique (gnome_canvas_get_type (), &month_view_info);
- }
-
- return month_view_type;
-}
-
-static void
-month_view_class_init (MonthViewClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = gtk_type_class (gnome_canvas_get_type ());
-
- widget_class->size_request = month_view_size_request;
- widget_class->size_allocate = month_view_size_allocate;
-}
-
-/* Creates the quick view when a day is clicked in the month view */
-static void
-do_quick_view_popup (MonthView *mv, GdkEventButton *event, int day)
-{
- time_t day_begin_time, day_end_time;
- GList *list;
- GtkWidget *qv;
- char date_str[256];
-
- day_begin_time = time_from_day (mv->year, mv->month, day);
- day_end_time = time_day_end (day_begin_time);
-
- list = calendar_get_events_in_range (mv->calendar->cal, day_begin_time, day_end_time);
-
- strftime (date_str, sizeof (date_str), _("%a %b %d %Y"), localtime (&day_begin_time));
- qv = quick_view_new (mv->calendar, date_str, list);
-
- quick_view_do_popup (QUICK_VIEW (qv), event);
-
- gtk_widget_destroy (qv);
- calendar_destroy_event_list (list);
-}
-
-/* Callback used to destroy the popup menu when the month view is destroyed */
-static void
-destroy_menu (GtkWidget *widget, gpointer data)
-{
- gtk_widget_destroy (GTK_WIDGET (data));
-}
-
-/* Creates a new appointment in the current day */
-static void
-new_appointment (GtkWidget *widget, gpointer data)
-{
- MonthView *mv;
- time_t *t;
-
- mv = MONTH_VIEW (data);
- t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
-
- event_editor_new_whole_day (mv->calendar, *t);
-}
-
-/* Convenience functions to jump to a view and set the time */
-static void
-do_jump (GtkWidget *widget, gpointer data, char *view_name)
-{
- MonthView *mv;
- time_t *t;
-
- mv = MONTH_VIEW (data);
-
- /* Get the time data from the menu item */
-
- t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
-
- /* Set the view and time */
-
- gnome_calendar_set_view (mv->calendar, view_name);
- gnome_calendar_goto (mv->calendar, *t);
-}
-
-/* The following three callbacks set the view in the calendar and change the time */
-
-static void
-jump_to_day (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "dayview");
-}
-
-static void
-jump_to_week (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "weekview");
-}
-
-static void
-jump_to_year (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "yearview");
-}
-
-static GnomeUIInfo mv_popup_menu[] = {
- GNOMEUIINFO_ITEM_STOCK (N_("_New appointment in this day..."), NULL, new_appointment, GNOME_STOCK_MENU_NEW),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _day"), NULL, jump_to_day, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _week"), NULL, jump_to_week, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _year"), NULL, jump_to_year, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_END
-};
-
-/* Creates the popup menu for the month view if it does not yet exist, and attaches it to the month
- * view object so that it can be destroyed when appropriate.
- */
-static GtkWidget *
-get_popup_menu (MonthView *mv)
-{
- GtkWidget *menu;
-
- menu = gtk_object_get_data (GTK_OBJECT (mv), "popup_menu");
-
- if (!menu) {
- menu = gnome_popup_menu_new (mv_popup_menu);
- gtk_object_set_data (GTK_OBJECT (mv), "popup_menu", menu);
- gtk_signal_connect (GTK_OBJECT (mv), "destroy",
- (GtkSignalFunc) destroy_menu,
- menu);
- }
-
- return menu;
-}
-
-/* Pops up the menu for the month view. */
-static void
-do_popup_menu (MonthView *mv, GdkEventButton *event, int day)
-{
- GtkWidget *menu;
- static time_t t;
-
- menu = get_popup_menu (mv);
-
- /* Enable or disable items as appropriate */
-
- gtk_widget_set_sensitive (mv_popup_menu[0].widget, day != 0);
- gtk_widget_set_sensitive (mv_popup_menu[2].widget, day != 0);
- gtk_widget_set_sensitive (mv_popup_menu[3].widget, day != 0);
-
- if (day == 0)
- day = 1;
-
- /* Store the time for the menu item callbacks to use */
-
- t = time_from_day (mv->year, mv->month, day);
-
- gtk_object_set_data (GTK_OBJECT (mv_popup_menu[0].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (mv_popup_menu[2].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (mv_popup_menu[3].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (mv_popup_menu[4].widget), "time_data", &t);
-
- gnome_popup_menu_do_popup (menu, NULL, NULL, event, mv);
-}
-
-/* Event handler for day groups. When mouse button 1 is pressed, it will pop up a quick view with
- * the events in that day. When mouse button 3 is pressed, it will pop up a menu.
- */
-static gint
-day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- MonthView *mv;
- int child_num;
- int day;
-
- mv = MONTH_VIEW (data);
-
- child_num = gnome_month_item_child2num (GNOME_MONTH_ITEM (mv->mitem), item);
- day = gnome_month_item_num2day (GNOME_MONTH_ITEM (mv->mitem), child_num);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if ((event->button.button == 1) && (day != 0)) {
- do_quick_view_popup (mv, (GdkEventButton *) event, day);
- return TRUE;
- } else if (event->button.button == 3) {
- do_popup_menu (mv, (GdkEventButton *) event, day);
- return TRUE;
- }
-
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Returns the index of the specified arrow in the array of arrows */
-static int
-get_arrow_index (MonthView *mv, GnomeCanvasItem *arrow)
-{
- int i;
-
- for (i = 0; i < 42; i++)
- if (mv->up[i] == arrow)
- return i;
- else if (mv->down[i] == arrow)
- return i + 42;
-
- g_warning ("Eeeek, arrow %p not found in month view %p", arrow, mv);
- return -1;
-}
-
-/* Checks whether arrows need to be displayed at the specified day index or not */
-static void
-check_arrow_visibility (MonthView *mv, int day_index)
-{
- GtkArg args[3];
- double text_height;
- double clip_height;
- double y_offset;
-
- args[0].name = "text_height";
- args[1].name = "clip_height";
- args[2].name = "y_offset";
- gtk_object_getv (GTK_OBJECT (mv->text[day_index]), 3, args);
-
- text_height = GTK_VALUE_DOUBLE (args[0]);
- clip_height = GTK_VALUE_DOUBLE (args[1]);
- y_offset = GTK_VALUE_DOUBLE (args[2]);
-
- /* Check up arrow */
-
- if (y_offset < 0.0)
- gnome_canvas_item_show (mv->up[day_index]);
- else
- gnome_canvas_item_hide (mv->up[day_index]);
-
- if (y_offset > (clip_height - text_height))
- gnome_canvas_item_show (mv->down[day_index]);
- else
- gnome_canvas_item_hide (mv->down[day_index]);
-}
-
-/* Finds which arrow was clicked and scrolls the corresponding text item in the month view */
-static void
-do_arrow_click (MonthView *mv, GnomeCanvasItem *arrow)
-{
- int arrow_index;
- int day_index;
- int up;
- GtkArg args[4];
- double text_height, clip_height;
- double y_offset;
- GdkFont *font;
-
- arrow_index = get_arrow_index (mv, arrow);
- up = (arrow_index < 42);
- day_index = up ? arrow_index : (arrow_index - 42);
-
- /* See how much we can scroll */
-
- args[0].name = "text_height";
- args[1].name = "clip_height";
- args[2].name = "y_offset";
- args[3].name = "font_gdk";
- gtk_object_getv (GTK_OBJECT (mv->text[day_index]), 4, args);
-
- text_height = GTK_VALUE_DOUBLE (args[0]);
- clip_height = GTK_VALUE_DOUBLE (args[1]);
- y_offset = GTK_VALUE_DOUBLE (args[2]);
- font = GTK_VALUE_BOXED (args[3]);
-
- if (up)
- y_offset += font->ascent + font->descent;
- else
- y_offset -= font->ascent + font->descent;
-
- if (y_offset > 0.0)
- y_offset = 0.0;
- else if (y_offset < (clip_height - text_height))
- y_offset = clip_height - text_height;
-
- /* Scroll */
-
- gnome_canvas_item_set (mv->text[day_index],
- "y_offset", y_offset,
- NULL);
-
- check_arrow_visibility (mv, day_index);
-}
-
-/* Event handler for the scroll arrows in the month view */
-static gint
-arrow_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- MonthView *mv;
-
- mv = MONTH_VIEW (data);
-
- switch (event->type) {
- case GDK_ENTER_NOTIFY:
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_PRELIGHT_DAY_BG),
- NULL);
- return TRUE;
-
- case GDK_LEAVE_NOTIFY:
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_DAY_FG),
- NULL);
- return TRUE;
-
- case GDK_BUTTON_PRESS:
- if (event->button.button != 1)
- break;
-
- do_arrow_click (mv, item);
- return TRUE;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Creates a new arrow out of the specified points and connects the proper signals to it */
-static GnomeCanvasItem *
-new_arrow (MonthView *mv, GnomeCanvasGroup *group, GnomeCanvasPoints *points)
-{
- GnomeCanvasItem *item;
- char *color_spec;
-
- color_spec = color_spec_from_prop (COLOR_PROP_DAY_FG);
-
- item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (group),
- gnome_canvas_polygon_get_type (),
- "points", points,
- "fill_color", color_spec,
- "outline_color", color_spec,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (item), "event",
- (GtkSignalFunc) arrow_event,
- mv);
-
- return item;
-}
-
-static void
-month_view_init (MonthView *mv)
-{
- int i;
- GnomeCanvasItem *day_group;
- GnomeCanvasPoints *points;
-
- /* Title */
-
- mv->title = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (mv)),
- gnome_canvas_text_get_type (),
- "anchor", GTK_ANCHOR_N,
- "fontset", HEADING_FONTSET,
- "fill_color", "black",
- NULL);
-
- /* Month item */
-
- mv->mitem = gnome_month_item_new (gnome_canvas_root (GNOME_CANVAS (mv)));
- gnome_canvas_item_set (mv->mitem,
- "x", 0.0,
- "anchor", GTK_ANCHOR_NW,
- "day_anchor", GTK_ANCHOR_NE,
- "start_on_monday", week_starts_on_monday,
- "heading_padding", 2.0,
- "heading_fontset", BIG_DAY_HEADING_FONTSET,
- "day_fontset", BIG_NORMAL_DAY_FONTSET,
- NULL);
-
- /* Arrows and text items. The arrows start hidden by default; they will be shown as
- * appropriate by the item adjustment code. Also, connect to the event signal of the
- * day groups so that we can pop up the quick view when appropriate.
- */
-
- points = gnome_canvas_points_new (3);
-
- for (i = 0; i < 42; i++) {
- day_group = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem),
- i + GNOME_MONTH_ITEM_DAY_GROUP);
- gtk_signal_connect (GTK_OBJECT (day_group), "event",
- (GtkSignalFunc) day_event,
- mv);
-
- /* Up arrow */
-
- points->coords[0] = 3;
- points->coords[1] = 10;
- points->coords[2] = 11;
- points->coords[3] = 10;
- points->coords[4] = 7;
- points->coords[5] = 3;
-
- mv->up[i] = new_arrow (mv, GNOME_CANVAS_GROUP (day_group), points);
-
- /* Down arrow */
-
- points->coords[0] = 13;
- points->coords[1] = 3;
- points->coords[2] = 17;
- points->coords[3] = 10;
- points->coords[4] = 21;
- points->coords[5] = 3;
-
- mv->down[i] = new_arrow (mv, GNOME_CANVAS_GROUP (day_group), points);
-
- /* Text item */
-
- mv->text[i] = gnome_canvas_item_new (GNOME_CANVAS_GROUP (day_group),
- gnome_canvas_text_get_type (),
- "fontset", EVENT_FONTSET,
- "anchor", GTK_ANCHOR_NW,
- "fill_color", color_spec_from_prop (COLOR_PROP_DAY_FG),
- "clip", TRUE,
- NULL);
- }
- gnome_canvas_points_free (points);
-
- mv->old_current_index = -1;
-}
-
-GtkWidget *
-month_view_new (GnomeCalendar *calendar, time_t month)
-{
- MonthView *mv;
-
- g_return_val_if_fail (calendar != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CALENDAR (calendar), NULL);
-
- mv = gtk_type_new (month_view_get_type ());
- mv->calendar = calendar;
-
- month_view_colors_changed (mv);
- month_view_set (mv, month);
- return GTK_WIDGET (mv);
-}
-
-static void
-month_view_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_MONTH_VIEW (widget));
- g_return_if_fail (requisition != NULL);
-
- if (GTK_WIDGET_CLASS (parent_class)->size_request)
- (* GTK_WIDGET_CLASS (parent_class)->size_request) (widget, requisition);
-
- requisition->width = 200;
- requisition->height = 150;
-}
-
-/* Adjusts the text items for events in the month view to the appropriate size. It also makes the
- * corresponding arrows visible or invisible, as appropriate.
- */
-static void
-adjust_children (MonthView *mv)
-{
- int i;
- GnomeCanvasItem *item;
- double x1, y1, x2, y2;
- GtkArg arg;
-
- for (i = 0; i < 42; i++) {
- /* Get dimensions of the day group */
-
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem), i + GNOME_MONTH_ITEM_DAY_GROUP);
- gnome_canvas_item_get_bounds (item, &x1, &y1, &x2, &y2);
-
- /* Normalize and add paddings */
-
- x2 -= x1 + EVENT_PADDING;
- x1 = EVENT_PADDING;
- y2 -= y1 + EVENT_PADDING;
- y1 = EVENT_PADDING;
-
- /* Add height of day label to y1 */
-
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem), i + GNOME_MONTH_ITEM_DAY_LABEL);
-
- arg.name = "text_height";
- gtk_object_getv (GTK_OBJECT (item), 1, &arg);
- y1 += GTK_VALUE_DOUBLE (arg);
-
- /* Set the position and clip size */
-
- gnome_canvas_item_set (mv->text[i],
- "x", x1,
- "y", y1,
- "clip_width", x2 - x1,
- "clip_height", y2 - y1,
- "x_offset", 0.0,
- "y_offset", 0.0,
- NULL);
-
- /* See what visibility state the arrows should be set to */
-
- check_arrow_visibility (mv, i);
- }
-}
-
-static void
-month_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- MonthView *mv;
- GdkFont *font;
- GtkArg arg;
- int y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_MONTH_VIEW (widget));
- g_return_if_fail (allocation != NULL);
-
- mv = MONTH_VIEW (widget);
-
- if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
- (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (mv), 0, 0, allocation->width, allocation->height);
-
- /* Adjust items to new size */
-
- arg.name = "font_gdk";
- gtk_object_getv (GTK_OBJECT (mv->title), 1, &arg);
- font = GTK_VALUE_BOXED (arg);
-
- gnome_canvas_item_set (mv->title,
- "x", (double) allocation->width / 2.0,
- "y", (double) SPACING,
- NULL);
-
- y = font->ascent + font->descent + 2 * SPACING;
- gnome_canvas_item_set (mv->mitem,
- "y", (double) y,
- "width", (double) (allocation->width - 1),
- "height", (double) (allocation->height - y - 1),
- NULL);
-
- /* Adjust children */
-
- adjust_children (mv);
-}
-
-/* This defines the environment for the calendar iterator function that is used to populate the
- * month view with events.
- */
-struct iter_info {
- MonthView *mv; /* The month view we are creating children for */
- int first_day_index; /* Index of the first day of the month within the month item */
- time_t month_begin, month_end; /* Beginning and end of month */
- GString **strings; /* Array of strings to populate */
-};
-
-/* This is the calendar iterator function used to populate the string array with event information.
- * For each event, it iterates through all the days that the event touches and appends the proper
- * information to the string array in the iter_info structure.
- */
-static int
-add_event (iCalObject *ico, time_t start, time_t end, void *data)
-{
- struct iter_info *ii;
- struct tm tm;
- time_t t;
- time_t day_begin_time, day_end_time;
-
- ii = data;
-
- /* Get the first day of the event */
-
- t = MAX (start, ii->month_begin);
- day_begin_time = time_day_begin (t);
- day_end_time = time_day_end (day_begin_time);
-
- /* Loop until the event ends or the month ends. For each day touched, append the proper
- * information to the corresponding string.
- */
-
- do {
- tm = *localtime (&day_begin_time);
- g_string_sprintfa (ii->strings[ii->first_day_index + tm.tm_mday - 1], "%s\n", ico->summary);
-
- /* Next day */
-
- day_begin_time = time_add_day (day_begin_time, 1);
- day_end_time = time_day_end (day_begin_time);
- } while ((end > day_begin_time) && (day_begin_time < ii->month_end));
-
- return TRUE; /* this means we are not finished yet with event generation */
-}
-
-void
-month_view_update (MonthView *mv, iCalObject *object, int flags)
-{
- struct iter_info ii;
- GString *strings[42];
- int i;
- time_t t;
-
- g_return_if_fail (mv != NULL);
- g_return_if_fail (IS_MONTH_VIEW (mv));
-
- ii.mv = mv;
-
- /* Create an array of empty GStrings */
-
- ii.strings = strings;
-
- for (i = 0; i < 42; i++)
- strings[i] = g_string_new (NULL);
-
- ii.first_day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (mv->mitem), 1);
- g_assert (ii.first_day_index != -1);
-
- /* Populate the array of strings with events */
-
- t = time_from_day (mv->year, mv->month, 1);
- ii.month_begin = time_month_begin (t);
- ii.month_end = time_month_end (t);
-
- calendar_iterate (mv->calendar->cal, ii.month_begin, ii.month_end, add_event, &ii);
-
- for (i = 0; i < 42; i++) {
- /* Delete the last character if it is a newline */
-
- if (strings[i]->str && strings[i]->len && (strings[i]->str[strings[i]->len - 1] == '\n'))
- g_string_truncate (strings[i], strings[i]->len - 1);
-
- gnome_canvas_item_set (mv->text[i],
- "text", strings[i]->str,
- NULL);
- g_string_free (strings[i], TRUE);
- }
-
- /* Adjust children for scrolling */
-
- adjust_children (mv);
-}
-
-/* Unmarks the old day that was marked as current and marks the current day if appropriate */
-static void
-mark_current_day (MonthView *mv)
-{
- time_t t;
- struct tm tm;
- GnomeCanvasItem *item;
-
- /* Unmark the old day */
-
- if (mv->old_current_index != -1) {
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem),
- GNOME_MONTH_ITEM_DAY_LABEL + mv->old_current_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_DAY_FG),
- "fontset", BIG_NORMAL_DAY_FONTSET,
- NULL);
-
- mv->old_current_index = -1;
- }
-
- /* Mark the new day */
-
- t = time (NULL);
- tm = *localtime (&t);
-
- if (((tm.tm_year + 1900) == mv->year) && (tm.tm_mon == mv->month)) {
- mv->old_current_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (mv->mitem), tm.tm_mday);
- g_assert (mv->old_current_index != -1);
-
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem),
- GNOME_MONTH_ITEM_DAY_LABEL + mv->old_current_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_CURRENT_DAY_FG),
- "fontset", BIG_CURRENT_DAY_FONTSET,
- NULL);
- }
-}
-
-void
-month_view_set (MonthView *mv, time_t month)
-{
- struct tm tm;
- char buf[100];
-
- g_return_if_fail (mv != NULL);
- g_return_if_fail (IS_MONTH_VIEW (mv));
-
- /* Title */
-
- tm = *localtime (&month);
-
- mv->year = tm.tm_year + 1900;
- mv->month = tm.tm_mon;
-
- strftime (buf, 100, _("%B %Y"), &tm);
-
- gnome_canvas_item_set (mv->title,
- "text", buf,
- NULL);
-
- /* Month item */
-
- gnome_canvas_item_set (mv->mitem,
- "year", mv->year,
- "month", mv->month,
- NULL);
-
- /* Update events */
-
- month_view_update (mv, NULL, 0);
- mark_current_day (mv);
-}
-
-void
-month_view_time_format_changed (MonthView *mv)
-{
- g_return_if_fail (mv != NULL);
- g_return_if_fail (IS_MONTH_VIEW (mv));
-
- gnome_canvas_item_set (mv->mitem,
- "start_on_monday", week_starts_on_monday,
- NULL);
-
- month_view_set (mv, time_month_begin (time_from_day (mv->year, mv->month, 1)));
-}
-
-void
-month_view_colors_changed (MonthView *mv)
-{
- g_return_if_fail (mv != NULL);
- g_return_if_fail (IS_MONTH_VIEW (mv));
-
- colorify_month_item (GNOME_MONTH_ITEM (mv->mitem), default_color_func, NULL);
- mark_current_day (mv);
-
- /* FIXME: set children to the marked color */
-}
diff --git a/calendar/gui/month-view.h b/calendar/gui/month-view.h
deleted file mode 100644
index 6e49c2f931..0000000000
--- a/calendar/gui/month-view.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Month view display for gncal
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef MONTH_VIEW_H
-#define MONTH_VIEW_H
-
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-#include "gnome-month-item.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define TYPE_MONTH_VIEW (month_view_get_type ())
-#define MONTH_VIEW(obj) (GTK_CHECK_CAST ((obj), TYPE_MONTH_VIEW, MonthView))
-#define MONTH_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_MONTH_VIEW, MonthViewClass))
-#define IS_MONTH_VIEW(obj) (GTK_CHECK_TYPE ((obj), TYPE_MONTH_VIEW))
-#define IS_MONTH_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_MONTH_VIEW))
-
-
-typedef struct _MonthView MonthView;
-typedef struct _MonthViewClass MonthViewClass;
-
-struct _MonthView {
- GnomeCanvas canvas;
-
- GnomeCalendar *calendar; /* The calendar we are associated to */
-
- int year; /* The year of the month we are displaying */
- int month; /* The month we are displaying */
- int old_current_index; /* The index of the day marked as current, or -1 if none */
-
- GnomeCanvasItem *up[42]; /* Arrows to go up in the days */
- GnomeCanvasItem *down[42]; /* Arrows to go down in the days */
- GnomeCanvasItem *text[42]; /* Text items for the events */
-
- GnomeCanvasItem *title; /* The title heading with the month/year */
- GnomeCanvasItem *mitem; /* The canvas month item used by this month view */
-};
-
-struct _MonthViewClass {
- GnomeCanvasClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType month_view_get_type (void);
-
-/* Creates a new month view widget associated to the specified calendar */
-GtkWidget *month_view_new (GnomeCalendar *calendar, time_t month);
-
-/* Notifies the month view that a calendar object has changed */
-void month_view_update (MonthView *mv, iCalObject *ico, int flags);
-
-/* Notifies the month view about a change of date */
-void month_view_set (MonthView *mv, time_t month);
-
-/* Notifies the month view that the time format has changed */
-void month_view_time_format_changed (MonthView *mv);
-
-/* Notifies the month view that the colors have changed */
-void month_view_colors_changed (MonthView *mv);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/popup-menu.c b/calendar/gui/popup-menu.c
deleted file mode 100644
index 3686183146..0000000000
--- a/calendar/gui/popup-menu.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Popup menu utilities for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#include <config.h>
-#include <gnome.h>
-#include "popup-menu.h"
-
-
-void
-popup_menu (struct menu_item *items, int nitems, GdkEventButton *event)
-{
- GtkWidget *menu;
- GtkWidget *item;
- int i;
-
- menu = gtk_menu_new (); /* FIXME: this baby is never freed */
-
- for (i = 0; i < nitems; i++) {
- if (items[i].text) {
- item = gtk_menu_item_new_with_label (_(items[i].text));
- gtk_signal_connect (GTK_OBJECT (item), "activate",
- items[i].callback,
- items[i].data);
- gtk_widget_set_sensitive (item, items[i].sensitive);
- } else
- item = gtk_menu_item_new ();
-
- gtk_widget_show (item);
- gtk_menu_append (GTK_MENU (menu), item);
- }
-
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button, event->time);
-}
diff --git a/calendar/gui/popup-menu.h b/calendar/gui/popup-menu.h
deleted file mode 100644
index a4590dbb98..0000000000
--- a/calendar/gui/popup-menu.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Popup menu utilities for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef POPUP_MENU_H
-#define POPUP_MENU_H
-
-#include <gdk/gdktypes.h>
-#include <gtk/gtksignal.h>
-
-
-struct menu_item {
- char *text;
- GtkSignalFunc callback;
- gpointer data;
- int sensitive;
-};
-
-void popup_menu (struct menu_item *items, int nitems, GdkEventButton *event);
-
-
-#endif
diff --git a/calendar/gui/prop.c b/calendar/gui/prop.c
deleted file mode 100644
index 6f2fec605b..0000000000
--- a/calendar/gui/prop.c
+++ /dev/null
@@ -1,927 +0,0 @@
-/* Calendar properties dialog box
- *
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors: Miguel de Icaza <miguel@kernel.org>
- * Federico Mena <federico@nuclecu.unam.mx>
- */
-#include <config.h>
-#ifdef HAVE_LANGINGO_H
-#include <langinfo.h>
-#else
-#include <locale.h>
-#endif
-#include <gnome.h>
-#include "gnome-cal.h"
-#include "gnome-month-item.h"
-#include "main.h"
-#include "mark.h"
-
-/* These specify the page numbers in the preferences notebook */
-enum {
- PROP_TIME_DISPLAY,
- PROP_COLORS,
- PROP_TODO,
- PROP_ALARMS
-};
-
-static GtkWidget *prop_win; /* The preferences dialog */
-
-/* Widgets for the time display page */
-
-static GtkWidget *time_format_12; /* Radio button for 12-hour format */
-static GtkWidget *time_format_24; /* Radio button for 24-hour format */
-static GtkWidget *start_on_sunday; /* Check button for weeks starting on Sunday */
-static GtkWidget *start_on_monday; /* Check button for weeks starting on Monday */
-static GtkWidget *start_omenu; /* Option menu for start of day */
-static GtkWidget *end_omenu; /* Option menu for end of day */
-static GtkWidget *start_items[24]; /* Menu items for start of day menu */
-static GtkWidget *end_items[24]; /* Menu items for end of day menu */
-
-/* Widgets for the colors page */
-
-static GtkWidget *color_pickers[COLOR_PROP_LAST];
-static GnomeCanvasItem *month_item;
-
-/* Widgets for the todo page */
-static GtkWidget *due_date_show_button;
-
-static GtkWidget *todo_item_time_remaining_show_button;
-
-static GtkWidget *todo_item_highlight_overdue;
-static GtkWidget *todo_item_highlight_not_due_yet;
-static GtkWidget *todo_item_highlight_due_today;
-
-static GtkWidget *priority_show_button;
-
-/* Widgets for the alarm page */
-static GtkWidget *enable_display_beep;
-static GtkWidget *to_cb;
-static GtkWidget *to_spin;
-static GtkWidget *snooze_cb;
-static GtkWidget *snooze_spin;
-
-/* prototypes */
-static void prop_apply_alarms (void);
-static void create_alarm_page (void);
-static void to_cb_changed (GtkWidget* object, gpointer data);
-static void snooze_cb_changed (GtkWidget* object, gpointer data);
-
-GtkWidget* make_spin_button (int val, int low, int high);
-void ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm,
- enum AlarmType type, int y, gboolean sens,
- GtkSignalFunc dirty_func);
-void ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type);
-
-/* Callback used when the property box is closed -- just sets the prop_win variable to null. */
-static int
-prop_cancel (void)
-{
- prop_win = NULL;
- return FALSE;
-}
-
-/* Returns the index of the active item in a menu */
-static int
-get_active_index (GtkWidget *menu)
-{
- GtkWidget *active;
-
- active = gtk_menu_get_active (GTK_MENU (menu));
- return GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (active)));
-}
-
-/* Applies the settings in the time display page */
-static void
-prop_apply_time_display (void)
-{
- /* Day begin/end */
-
- day_begin = get_active_index (gtk_option_menu_get_menu (GTK_OPTION_MENU (start_omenu)));
- day_end = get_active_index (gtk_option_menu_get_menu (GTK_OPTION_MENU (end_omenu)));
- gnome_config_set_int ("/calendar/Calendar/Day start", day_begin);
- gnome_config_set_int ("/calendar/Calendar/Day end", day_end);
-
- /* Time format */
-
- am_pm_flag = GTK_TOGGLE_BUTTON (time_format_12)->active;
- gnome_config_set_bool ("/calendar/Calendar/AM PM flag", am_pm_flag);
-
- /* Week start */
-
- week_starts_on_monday = GTK_TOGGLE_BUTTON (start_on_monday)->active;
- gnome_config_set_bool ("/calendar/Calendar/Week starts on Monday", week_starts_on_monday);
-
- gnome_config_sync ();
- time_format_changed ();
-}
-
-/* Applies the settings in the colors page */
-static void
-prop_apply_colors (void)
-{
- int i;
- char *cspec;
- gushort r, g, b;
-
- for (i = 0; i < COLOR_PROP_LAST; i++) {
- gnome_color_picker_get_i16 (GNOME_COLOR_PICKER (color_pickers[i]), &r, &g, &b, NULL);
- color_props[i].r = r;
- color_props[i].g = g;
- color_props[i].b = b;
-
- cspec = build_color_spec (color_props[i].r, color_props[i].g, color_props[i].b);
- gnome_config_set_string (color_props[i].key, cspec);
- }
-
- gnome_config_sync ();
- colors_changed ();
-}
-/* Applies the settings in the todo page (FIX THIS IF ITS NOT WRITTEN) */
-static void
-prop_apply_todo(void)
-{
- todo_show_due_date = GTK_TOGGLE_BUTTON (due_date_show_button)->active;
-
- todo_item_dstatus_highlight_overdue = GTK_TOGGLE_BUTTON(todo_item_highlight_overdue)->active;
- todo_item_dstatus_highlight_not_due_yet = GTK_TOGGLE_BUTTON(todo_item_highlight_not_due_yet)->active;
- todo_item_dstatus_highlight_due_today = GTK_TOGGLE_BUTTON(todo_item_highlight_due_today)->active;
-
- todo_show_priority = GTK_TOGGLE_BUTTON (priority_show_button)->active;
-
- todo_show_time_remaining = GTK_TOGGLE_BUTTON (todo_item_time_remaining_show_button)->active;
-
- /* storing the values */
-
- gnome_config_set_bool("/calendar/Todo/show_time_remain", todo_show_time_remaining);
- gnome_config_set_bool("/calendar/Todo/highlight_overdue", todo_item_dstatus_highlight_overdue);
-
- gnome_config_set_bool("/calendar/Todo/highlight_due_today", todo_item_dstatus_highlight_due_today);
-
- gnome_config_set_bool("/calendar/Todo/highlight_not_due_yet", todo_item_dstatus_highlight_not_due_yet);
- gnome_config_set_bool("/calendar/Todo/show_due_date", todo_show_due_date);
- gnome_config_set_bool("/calendar/Todo/show_priority", todo_show_priority);
- /* need to sync our config changes. */
- gnome_config_sync ();
-
- /* apply the current changes */
- todo_properties_changed();
-}
-
-
-/* Callback used when the Apply button is clicked. */
-static void
-prop_apply (GtkWidget *w, int page)
-{
- switch (page) {
- case PROP_TIME_DISPLAY:
- prop_apply_time_display ();
- break;
-
- case PROP_COLORS:
- prop_apply_colors ();
- break;
-
- case PROP_TODO:
- prop_apply_todo ();
- break;
-
- case PROP_ALARMS:
- prop_apply_alarms ();
- break;
-
- case -1:
- break;
-
- default:
- g_warning ("We have a loose penguin!");
- g_assert_not_reached ();
- }
-}
-
-/* Notifies the property box that the data has changed */
-static void
-prop_changed (void)
-{
- gnome_property_box_changed (GNOME_PROPERTY_BOX (prop_win));
-}
-
-/* Builds and returns a two-element radio button group surrounded by a frame. The radio buttons are
- * stored in the specified variables, and the first radio button's state is set according to the
- * specified flag value. The buttons are connected to the prop_changed() function to update the property
- * box's dirty state.
- */
-static GtkWidget *
-build_two_radio_group (char *title,
- char *radio_1_title, GtkWidget **radio_1_widget,
- char *radio_2_title, GtkWidget **radio_2_widget,
- int radio_1_value)
-{
- GtkWidget *frame;
- GtkWidget *vbox;
-
- frame = gtk_frame_new (title);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- *radio_1_widget = gtk_radio_button_new_with_label (NULL, radio_1_title);
- gtk_box_pack_start (GTK_BOX (vbox), *radio_1_widget, FALSE, FALSE, 0);
-
- *radio_2_widget = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (*radio_1_widget),
- radio_2_title);
- gtk_box_pack_start (GTK_BOX (vbox), *radio_2_widget, FALSE, FALSE, 0);
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (*radio_1_widget), radio_1_value);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (*radio_2_widget), !radio_1_value);
-
- gtk_signal_connect (GTK_OBJECT (*radio_1_widget), "toggled",
- (GtkSignalFunc) prop_changed,
- NULL);
-
- return frame;
-}
-
-/* Callback invoked when a menu item from the start/end time option menus is selected. It adjusts
- * the other menu to the proper time, if needed.
- */
-static void
-hour_activated (GtkWidget *widget, gpointer data)
-{
- int start, end;
-
- if (data == start_omenu) {
- /* Adjust the end menu */
-
- start = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (widget)));
- end = get_active_index (gtk_option_menu_get_menu (GTK_OPTION_MENU (end_omenu)));
-
- if (end < start)
- gtk_option_menu_set_history (GTK_OPTION_MENU (end_omenu), start);
- } else if (data == end_omenu) {
- /* Adjust the start menu */
-
- end = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (widget)));
- start = get_active_index (gtk_option_menu_get_menu (GTK_OPTION_MENU (start_omenu)));
-
- if (start > end)
- gtk_option_menu_set_history (GTK_OPTION_MENU (start_omenu), end);
- } else
- g_assert_not_reached ();
-
- gnome_property_box_changed (GNOME_PROPERTY_BOX (prop_win));
-}
-
-/* Builds an option menu of 24 hours */
-static GtkWidget *
-build_hours_menu (GtkWidget **items, int active)
-{
- GtkWidget *omenu;
- GtkWidget *menu;
- int i;
- char buf[100];
- struct tm tm;
- int am_pm_flag;
-
- omenu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
- am_pm_flag = GTK_TOGGLE_BUTTON (time_format_12)->active;
-
- memset (&tm, 0, sizeof (tm));
-
- for (i = 0; i < 24; i++) {
- tm.tm_hour = i;
- if (am_pm_flag)
- strftime (buf, 100, "%I:%M %p", &tm);
- else
- strftime (buf, 100, "%H:%M", &tm);
-
- items[i] = gtk_menu_item_new_with_label (buf);
- gtk_object_set_user_data (GTK_OBJECT (items[i]), GINT_TO_POINTER (i));
- gtk_signal_connect (GTK_OBJECT (items[i]), "activate",
- (GtkSignalFunc) hour_activated,
- omenu);
-
- gtk_menu_append (GTK_MENU (menu), items[i]);
- gtk_widget_show (items[i]);
- }
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), active);
- return omenu;
-}
-
-/* Creates the time display page in the preferences dialog */
-static void
-create_time_display_page (void)
-{
- GtkWidget *table;
- GtkWidget *vbox;
- GtkWidget *frame;
- GtkWidget *hbox2;
- GtkWidget *hbox3;
- GtkWidget *w;
-
- table = gtk_table_new (2, 2, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (table), GNOME_PAD_SMALL);
- gtk_table_set_row_spacings (GTK_TABLE (table), GNOME_PAD_SMALL);
- gtk_table_set_col_spacings (GTK_TABLE (table), GNOME_PAD_SMALL);
- gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop_win), table,
- gtk_label_new (_("Time display")));
-
- /* Time format */
-
- w = build_two_radio_group (_("Time format"),
- _("12-hour (AM/PM)"), &time_format_12,
- _("24-hour"), &time_format_24,
- am_pm_flag);
- gtk_table_attach (GTK_TABLE (table), w,
- 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
-
- /* Weeks start on */
-
- w = build_two_radio_group (_("Weeks start on"),
- _("Sunday"), &start_on_sunday,
- _("Monday"), &start_on_monday,
- !week_starts_on_monday);
- gtk_table_attach (GTK_TABLE (table), w,
- 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
-
- /* Day range */
-
- frame = gtk_frame_new (_("Day range"));
- gtk_table_attach (GTK_TABLE (table), frame,
- 1, 2, 0, 2,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
-
- vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- w = gtk_label_new (_("Please select the start and end hours you want\n"
- "to be displayed in the day view and week view.\n"
- "Times outside this range will not be displayed\n"
- "by default."));
- gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_LEFT);
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.0);
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
-
- hbox2 = gtk_hbox_new (FALSE, GNOME_PAD);
- gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
-
- /* Day start */
-
- hbox3 = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
- gtk_box_pack_start (GTK_BOX (hbox2), hbox3, FALSE, FALSE, 0);
-
- w = gtk_label_new (_("Day start:"));
- gtk_box_pack_start (GTK_BOX (hbox3), w, FALSE, FALSE, 0);
-
- start_omenu = build_hours_menu (start_items, day_begin);
- gtk_box_pack_start (GTK_BOX (hbox3), start_omenu, FALSE, FALSE, 0);
-
- /* Day end */
-
- hbox3 = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
- gtk_box_pack_start (GTK_BOX (hbox2), hbox3, FALSE, FALSE, 0);
-
- w = gtk_label_new (_("Day end:"));
- gtk_box_pack_start (GTK_BOX (hbox3), w, FALSE, FALSE, 0);
-
- end_omenu = build_hours_menu (end_items, day_end);
- gtk_box_pack_start (GTK_BOX (hbox3), end_omenu, FALSE, FALSE, 0);
-}
-
-/* Called when the canvas for the month item is size allocated. We use this to change the canvas'
- * scrolling region and the month item's size.
- */
-static void
-canvas_size_allocate (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
-{
- gnome_canvas_item_set (month_item,
- "width", (double) (allocation->width - 1),
- "height", (double) (allocation->height - 1),
- NULL);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (widget),
- 0, 0,
- allocation->width, allocation->height);
-}
-
-/* Returns a color spec based on the color pickers */
-static char *
-color_spec_from_picker (int num)
-{
- gushort r, g, b;
-
- gnome_color_picker_get_i16 (GNOME_COLOR_PICKER (color_pickers[num]), &r, &g, &b, NULL);
-
- return build_color_spec (r, g, b);
-}
-
-/* Callback used to query color information for the properties box */
-static char *
-fetch_color_spec (ColorProp propnum, gpointer data)
-{
- return color_spec_from_picker (propnum);
-}
-
-/* Marks fake event days in the month item sample */
-static void
-fake_mark_days (void)
-{
- static int day_nums[] = { 1, 4, 8, 16, 17, 18, 20, 25, 28 }; /* some random days */
- int first_day_index;
- int i;
-
- first_day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (month_item), 1);
-
- for (i = 0; i < (sizeof (day_nums) / sizeof (day_nums[0])); i++)
- mark_month_item_index (GNOME_MONTH_ITEM (month_item), first_day_index + day_nums[i] - 1,
- fetch_color_spec, NULL);
-}
-
-/* Switches the month item to the current date and highlights the current day's number */
-static void
-set_current_day (void)
-{
- struct tm tm;
- time_t t;
- GnomeCanvasItem *item;
- int day_index;
-
- /* Set the date */
-
- t = time (NULL);
- tm = *localtime (&t);
-
- gnome_canvas_item_set (month_item,
- "year", tm.tm_year + 1900,
- "month", tm.tm_mon,
- NULL);
-
- /* Highlight current day */
-
- day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (month_item), tm.tm_mday);
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (month_item), GNOME_MONTH_ITEM_DAY_LABEL + day_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_picker (COLOR_PROP_CURRENT_DAY_FG),
- "fontset", CURRENT_DAY_FONTSET,
- NULL);
-}
-
-/* This is the version of a color spec query function that is appropriate for the preferences dialog */
-static char *
-prop_color_func (ColorProp propnum, gpointer data)
-{
- return color_spec_from_picker (propnum);
-}
-
-/* Sets the colors of the month item to the current prerences */
-static void
-reconfigure_month (void)
-{
- colorify_month_item (GNOME_MONTH_ITEM (month_item), prop_color_func, NULL);
- fake_mark_days ();
- set_current_day ();
-
- /* Reset prelighting information */
-
- month_item_prepare_prelight (GNOME_MONTH_ITEM (month_item), fetch_color_spec, NULL);
-}
-
-/* Callback used when a color is changed */
-static void
-color_set (void)
-{
- reconfigure_month ();
- prop_changed ();
-}
-
-/* Creates the colors page in the preferences dialog */
-static void
-create_colors_page (void)
-{
- GtkWidget *frame;
- GtkWidget *hbox;
- GtkWidget *table;
- GtkWidget *w;
- int i;
-
- frame = gtk_frame_new (_("Colors for display"));
- gtk_container_set_border_width (GTK_CONTAINER (frame), GNOME_PAD_SMALL);
- gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop_win), frame,
- gtk_label_new (_("Colors")));
-
- hbox = gtk_hbox_new (FALSE, GNOME_PAD);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (frame), hbox);
-
- table = gtk_table_new (COLOR_PROP_LAST, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), GNOME_PAD_SMALL);
- gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
-
- /* Create the color pickers */
-
- for (i = 0; i < COLOR_PROP_LAST; i++) {
- /* Label */
-
- w = gtk_label_new (_(color_props[i].label));
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (table), w,
- 0, 1, i, i + 1,
- GTK_FILL, 0,
- 0, 0);
-
- /* Color picker */
-
- color_pickers[i] = gnome_color_picker_new ();
- gnome_color_picker_set_title (GNOME_COLOR_PICKER (color_pickers[i]), _(color_props[i].label));
- gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (color_pickers[i]),
- color_props[i].r, color_props[i].g, color_props[i].b, 0);
- gtk_table_attach (GTK_TABLE (table), color_pickers[i],
- 1, 2, i, i + 1,
- 0, 0,
- 0, 0);
- gtk_signal_connect (GTK_OBJECT (color_pickers[i]), "color_set",
- (GtkSignalFunc) color_set,
- NULL);
- }
-
- /* Create the sample calendar */
-
- w = gnome_canvas_new ();
- gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
-
- month_item = gnome_month_item_new (gnome_canvas_root (GNOME_CANVAS (w)));
- gnome_canvas_item_set (month_item,
- "start_on_monday", week_starts_on_monday,
- NULL);
- reconfigure_month ();
-
- gtk_signal_connect (GTK_OBJECT (w), "size_allocate",
- canvas_size_allocate,
- NULL);
-
-}
-
-
-static void
-set_todo_page_options(void)
-{
-
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
-}
-
-static void
-todo_option_set (void)
-{
- prop_changed ();
- set_todo_page_options ();
-}
-
-/* Creates the colors page in the preferences dialog */
-static GtkWidget *
-build_list_options_frame(void)
-{
- GtkWidget *frame;
- GtkWidget *vbox;
- frame = gtk_frame_new (_("Show on TODO List:"));
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- due_date_show_button = gtk_check_button_new_with_label (_("Due Date"));
- priority_show_button = gtk_check_button_new_with_label (_("Priority"));
- todo_item_time_remaining_show_button = gtk_check_button_new_with_label (_("Time Until Due"));
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(due_date_show_button), todo_show_due_date);
- gtk_signal_connect (GTK_OBJECT(due_date_show_button),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
- gtk_box_pack_start (GTK_BOX (vbox), due_date_show_button, FALSE, FALSE, 0);
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_time_remaining_show_button), todo_show_time_remaining);
- gtk_signal_connect (GTK_OBJECT(todo_item_time_remaining_show_button),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
- gtk_box_pack_start (GTK_BOX (vbox), todo_item_time_remaining_show_button, FALSE, FALSE, 0);
-
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(priority_show_button), todo_show_priority);
- gtk_signal_connect (GTK_OBJECT(priority_show_button),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
- gtk_box_pack_start (GTK_BOX (vbox), priority_show_button, FALSE, FALSE, 0);
- return frame;
-}
-static GtkWidget *
-build_style_list_options_frame(void)
-{
- GtkWidget *frame;
- GtkWidget *vbox;
-
- frame = gtk_frame_new (_("To Do List style options:"));
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- todo_item_highlight_overdue = gtk_check_button_new_with_label (_("Highlight overdue items"));
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_overdue),
- todo_item_dstatus_highlight_overdue);
- todo_item_highlight_not_due_yet = gtk_check_button_new_with_label (_("Highlight not yet due items"));
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_not_due_yet),
- todo_item_dstatus_highlight_overdue);
- todo_item_highlight_due_today = gtk_check_button_new_with_label (_("Highlight items due today"));
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_due_today),
- todo_item_dstatus_highlight_overdue);
-
- gtk_signal_connect (GTK_OBJECT(todo_item_highlight_overdue),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
- gtk_signal_connect (GTK_OBJECT(todo_item_highlight_not_due_yet),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
- gtk_signal_connect (GTK_OBJECT(todo_item_highlight_due_today),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
-
- gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_overdue, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_due_today, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_not_due_yet, FALSE, FALSE, 0);
- return frame;
-}
-static void
-create_todo_page (void)
-{
- GtkWidget *frame;
- GtkWidget *main_box;
- GtkWidget *hbox;
-
-
- frame = gtk_frame_new (_("To Do List Properties"));
- gtk_container_set_border_width (GTK_CONTAINER (frame), GNOME_PAD_SMALL);
- gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop_win), frame,
- gtk_label_new (_("To Do List")));
-
- /* first vbox*/
- main_box = gtk_vbox_new(FALSE, GNOME_PAD);
- gtk_container_set_border_width (GTK_CONTAINER (main_box), GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (frame), main_box);
-
-
- /* first hbox*/
- hbox = gtk_hbox_new (FALSE, GNOME_PAD);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (main_box), hbox);
-
- gtk_box_pack_start (GTK_BOX(hbox), build_list_options_frame(), FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(hbox), build_style_list_options_frame(), FALSE, FALSE, 0);
-
- set_todo_page_options();
-}
-
-/* Creates and displays the preferences dialog for the whole application */
-void
-properties (GtkWidget *toplevel)
-{
- static GnomeHelpMenuEntry help_entry = { NULL, "properties" };
-
- help_entry.name = gnome_app_id;
-
- if (prop_win)
- return;
-
- prop_win = gnome_property_box_new ();
- gtk_window_set_title (GTK_WINDOW (prop_win), _("Preferences"));
- gnome_dialog_set_parent (GNOME_DIALOG (prop_win), GTK_WINDOW (toplevel));
-
- create_time_display_page ();
- create_colors_page ();
- create_todo_page ();
- create_alarm_page ();
-
- gtk_signal_connect (GTK_OBJECT (prop_win), "destroy",
- (GtkSignalFunc) prop_cancel, NULL);
-
- gtk_signal_connect (GTK_OBJECT (prop_win), "delete_event",
- (GtkSignalFunc) prop_cancel, NULL);
-
- gtk_signal_connect (GTK_OBJECT (prop_win), "apply",
- (GtkSignalFunc) prop_apply, NULL);
-
- gtk_signal_connect (GTK_OBJECT (prop_win), "help",
- GTK_SIGNAL_FUNC (gnome_help_pbox_display),
- &help_entry);
-
- gtk_widget_show_all (prop_win);
-}
-
-char *
-build_color_spec (int r, int g, int b)
-{
- static char spec[100];
-
- sprintf (spec, "#%04x%04x%04x", r, g, b);
- return spec;
-}
-
-void
-parse_color_spec (char *spec, int *r, int *g, int *b)
-{
- g_return_if_fail (spec != NULL);
- g_return_if_fail (r != NULL);
- g_return_if_fail (r != NULL);
- g_return_if_fail (r != NULL);
-
- if (sscanf (spec, "#%04x%04x%04x", r, g, b) != 3) {
- g_warning ("Invalid color specification %s, returning black", spec);
-
- *r = *g = *b = 0;
- }
-}
-
-char *
-color_spec_from_prop (ColorProp propnum)
-{
- return build_color_spec (color_props[propnum].r, color_props[propnum].g, color_props[propnum].b);
-}
-
-static void
-create_alarm_page (void)
-{
- GtkWidget *main_box;
- GtkWidget *default_frame;
- GtkWidget *default_table;
- GtkWidget *misc_frame;
- GtkWidget *misc_box;
- GtkWidget *box, *l;
-
- main_box = gtk_vbox_new (FALSE, GNOME_PAD);
- gtk_container_set_border_width (GTK_CONTAINER (main_box), GNOME_PAD_SMALL);
- gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop_win),
- main_box, gtk_label_new (_("Alarms")));
-
- /* build miscellaneous box */
- misc_frame = gtk_frame_new (_("Alarm Properties"));
- gtk_container_set_border_width (GTK_CONTAINER (misc_frame),
- GNOME_PAD_SMALL);
- misc_box = gtk_vbox_new (FALSE, GNOME_PAD);
-
- gtk_container_set_border_width (GTK_CONTAINER (misc_frame), GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (misc_frame), misc_box);
-
- gtk_box_pack_start (GTK_BOX (main_box), misc_frame, FALSE, FALSE, 0);
-
- enable_display_beep = gtk_check_button_new_with_label (_("Beep on display alarms"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enable_display_beep),
- beep_on_display);
- gtk_box_pack_start (GTK_BOX (misc_box), enable_display_beep, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (enable_display_beep), "toggled",
- (GtkSignalFunc) prop_changed,
- NULL);
-
- /* audio timeout widgets */
- box = gtk_hbox_new (FALSE, GNOME_PAD);
- to_cb = gtk_check_button_new_with_label (_("Audio alarms timeout after"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (to_cb),
- enable_aalarm_timeout);
- gtk_signal_connect (GTK_OBJECT (to_cb), "toggled",
- (GtkSignalFunc) to_cb_changed, NULL);
- gtk_box_pack_start (GTK_BOX (box), to_cb, FALSE, FALSE, 0);
- to_spin = make_spin_button (audio_alarm_timeout, 1, MAX_AALARM_TIMEOUT);
- gtk_widget_set_sensitive (to_spin, enable_aalarm_timeout);
- gtk_signal_connect (GTK_OBJECT (to_spin), "changed",
- (GtkSignalFunc) prop_changed, NULL);
- gtk_box_pack_start (GTK_BOX (box), to_spin, FALSE, FALSE, 0);
- l = gtk_label_new (_(" seconds"));
- gtk_box_pack_start (GTK_BOX (box), l, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (misc_box), box, FALSE, FALSE, 0);
-
- /* snooze widgets */
- box = gtk_hbox_new (FALSE, GNOME_PAD);
- snooze_cb = gtk_check_button_new_with_label (_("Enable snoozing for "));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (snooze_cb),
- enable_snooze);
- gtk_signal_connect (GTK_OBJECT (snooze_cb), "toggled",
- (GtkSignalFunc) snooze_cb_changed, NULL);
- gtk_box_pack_start (GTK_BOX (box), snooze_cb, FALSE, FALSE, 0);
- snooze_spin = make_spin_button (snooze_secs, 1, MAX_SNOOZE_SECS);
- gtk_widget_set_sensitive (snooze_spin, enable_snooze);
- gtk_signal_connect (GTK_OBJECT (snooze_spin), "changed",
- (GtkSignalFunc) prop_changed, NULL);
- gtk_box_pack_start (GTK_BOX (box), snooze_spin, FALSE, FALSE, 0);
- l = gtk_label_new (_(" seconds"));
- gtk_box_pack_start (GTK_BOX (box), l, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (misc_box), box, FALSE, FALSE, 0);
-
- /* populate default frame/box */
- default_frame = gtk_frame_new (_("Defaults"));
- gtk_container_set_border_width (GTK_CONTAINER (default_frame), GNOME_PAD_SMALL);
- gtk_box_pack_start (GTK_BOX (main_box), default_frame, FALSE, FALSE, 0);
- default_table = gtk_table_new (1, 1, 0);
- gtk_container_set_border_width (GTK_CONTAINER (default_table), 4);
- gtk_table_set_row_spacings (GTK_TABLE (default_table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (default_table), 4);
- gtk_container_add (GTK_CONTAINER (default_frame), default_table);
-
- ee_create_ae (GTK_TABLE (default_table), _("Display"),
- &alarm_defaults [ALARM_DISPLAY], ALARM_DISPLAY, 1,
- FALSE, prop_changed);
- ee_create_ae (GTK_TABLE (default_table), _("Audio"),
- &alarm_defaults [ALARM_AUDIO], ALARM_AUDIO, 2,
- FALSE, prop_changed);
- ee_create_ae (GTK_TABLE (default_table), _("Program"),
- &alarm_defaults [ALARM_PROGRAM], ALARM_PROGRAM, 3,
- FALSE, prop_changed);
- ee_create_ae (GTK_TABLE (default_table), _("Mail"),
- &alarm_defaults [ALARM_MAIL], ALARM_MAIL, 4,
- FALSE, prop_changed);
-}
-
-static void
-prop_store_alarm_default_values (CalendarAlarm* alarm)
-{
- ee_store_alarm (alarm, alarm->type);
-
- switch (alarm->type) {
- case ALARM_DISPLAY:
- gnome_config_push_prefix ("/calendar/alarms/def_disp_");
- break;
- case ALARM_AUDIO:
- gnome_config_push_prefix ("/calendar/alarms/def_audio_");
- break;
- case ALARM_PROGRAM:
- gnome_config_push_prefix ("/calendar/alarms/def_prog_");
- break;
- case ALARM_MAIL:
- gnome_config_push_prefix ("/calendar/alarms/def_mail_");
- break;
- }
-
- gnome_config_set_int ("enabled", alarm->enabled);
- gnome_config_set_int ("count", alarm->count);
- gnome_config_set_int ("units", alarm->units);
- if (alarm->data)
- gnome_config_set_string ("data", alarm->data);
-
- gnome_config_pop_prefix ();
- gnome_config_sync ();
-}
-
-static void
-prop_apply_alarms ()
-{
- int i;
- for (i=0; i < 4; i++)
- prop_store_alarm_default_values (&alarm_defaults [i]);
-
- beep_on_display = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (enable_display_beep));
- gnome_config_set_bool ("/calendar/alarms/beep_on_display", beep_on_display);
- enable_aalarm_timeout = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (to_cb));
- gnome_config_set_bool ("/calendar/alarms/enable_audio_timeout", enable_aalarm_timeout);
- audio_alarm_timeout = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (to_spin));
- gnome_config_set_int ("/calendar/alarms/audio_alarm_timeout", audio_alarm_timeout);
- enable_snooze = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (snooze_cb));
- gnome_config_set_bool ("/calendar/alarms/enable_snooze", enable_snooze);
- snooze_secs = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (snooze_spin));
- gnome_config_set_int ("/calendar/alarms/snooze_secs", snooze_secs);
-
- gnome_config_sync();
-}
-
-static void
-to_cb_changed (GtkWidget *object, gpointer data)
-{
- gboolean active =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (to_cb));
- gtk_widget_set_sensitive (to_spin, active);
- prop_changed ();
-}
-
-static void
-snooze_cb_changed (GtkWidget *object, gpointer data)
-{
- gboolean active =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (snooze_cb));
- gtk_widget_set_sensitive (snooze_spin, active);
- prop_changed ();
-}
-
-
diff --git a/calendar/gui/quick-view.c b/calendar/gui/quick-view.c
deleted file mode 100644
index c23ed612c0..0000000000
--- a/calendar/gui/quick-view.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* Quick view widget for Gnomecal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx
- */
-
-#include <config.h>
-#include "quick-view.h"
-#include "main.h"
-
-
-#define QUICK_VIEW_FONTSET "-adobe-helvetica-medium-r-normal--10-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-11-*-*-*-p-*-koi8-r,-*-*-medium-r-normal--10-*-*-*-*-*-ksc5601.1987-0,*"
-
-
-static void quick_view_class_init (QuickViewClass *class);
-static void quick_view_init (QuickView *qv);
-
-static gint quick_view_button_release (GtkWidget *widget, GdkEventButton *event);
-static gint quick_view_map_event (GtkWidget *widget, GdkEventAny *event);
-
-
-static GtkWindowClass *parent_class;
-
-
-GtkType
-quick_view_get_type (void)
-{
- static GtkType quick_view_type = 0;
-
- if (!quick_view_type) {
- GtkTypeInfo quick_view_info = {
- "QuickView",
- sizeof (QuickView),
- sizeof (QuickViewClass),
- (GtkClassInitFunc) quick_view_class_init,
- (GtkObjectInitFunc) quick_view_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- quick_view_type = gtk_type_unique (gtk_window_get_type (), &quick_view_info);
- }
-
- return quick_view_type;
-}
-
-static void
-quick_view_class_init (QuickViewClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = gtk_type_class (gtk_window_get_type ());
-
- widget_class->button_release_event = quick_view_button_release;
- widget_class->map_event = quick_view_map_event;
-}
-
-static void
-quick_view_init (QuickView *qv)
-{
- GTK_WINDOW (qv)->type = GTK_WINDOW_POPUP;
- gtk_window_set_position (GTK_WINDOW (qv), GTK_WIN_POS_MOUSE);
-}
-
-static gint
-quick_view_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- QuickView *qv;
-
- qv = QUICK_VIEW (widget);
-
- if (event->button != qv->button)
- return FALSE;
-
- gdk_pointer_ungrab (event->time);
- gtk_grab_remove (GTK_WIDGET (qv));
- gtk_widget_hide (GTK_WIDGET (qv));
-
- gtk_main_quit (); /* End modality of the quick view */
- return TRUE;
-}
-
-static gint
-quick_view_map_event (GtkWidget *widget, GdkEventAny *event)
-{
- GdkCursor *cursor;
-
- cursor = gdk_cursor_new (GDK_ARROW);
- gdk_pointer_grab (widget->window,
- TRUE,
- GDK_BUTTON_RELEASE_MASK,
- NULL,
- cursor,
- GDK_CURRENT_TIME);
- gdk_cursor_destroy (cursor);
-
- return FALSE;
-}
-
-/* Creates the items corresponding to a single calendar object. Takes in the y position of the
- * items to create and returns the y position of the next item to create. Also takes in the current
- * maximum width for items and returns the new maximum width.
- */
-void
-create_items_for_event (QuickView *qv, CalendarObject *co, double *y, double *max_width)
-{
- GnomeCanvas *canvas;
- GnomeCanvasItem *item;
- char start[100], end[100];
- struct tm start_tm, end_tm;
- char *str;
- GtkArg args[2];
-
- /* FIXME: make this nice */
-
- canvas = GNOME_CANVAS (qv->canvas);
-
- start_tm = *localtime (&co->ev_start);
- end_tm = *localtime (&co->ev_end);
-
- if (am_pm_flag) {
- strftime (start, sizeof (start), "%I:%M%p", &start_tm);
- strftime (end, sizeof (end), "%I:%M%p", &end_tm);
- } else {
- strftime (start, sizeof (start), "%H:%M", &start_tm);
- strftime (end, sizeof (end), "%H:%M", &end_tm);
- }
-
- str = g_strconcat (start, " - ", end, " ", co->ico->summary, NULL);
-
- item = gnome_canvas_item_new (gnome_canvas_root (canvas),
- gnome_canvas_text_get_type (),
- "x", 0.0,
- "y", *y,
- "anchor", GTK_ANCHOR_NW,
- "text", str,
- "fontset", QUICK_VIEW_FONTSET,
- NULL);
-
- g_free (str);
-
- /* Measure the text and return the proper size values */
-
- args[0].name = "text_width";
- args[1].name = "text_height";
- gtk_object_getv (GTK_OBJECT (item), 2, args);
-
- if (GTK_VALUE_DOUBLE (args[0]) > *max_width)
- *max_width = GTK_VALUE_DOUBLE (args[0]);
-
- *y += GTK_VALUE_DOUBLE (args[1]);
-}
-
-/* Creates the canvas items corresponding to the events in the list */
-static void
-setup_event_list (QuickView *qv, GList *event_list)
-{
- CalendarObject *co;
- GnomeCanvasItem *item;
- GtkArg args[2];
- double y, max_width;
-
- /* If there are no events, then just put a simple label */
-
- if (!event_list) {
- item = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (qv->canvas)),
- gnome_canvas_text_get_type (),
- "x", 0.0,
- "y", 0.0,
- "anchor", GTK_ANCHOR_NW,
- "text", _("No appointments for this day"),
- "fontset", QUICK_VIEW_FONTSET,
- NULL);
-
- /* Measure the text and set the proper sizes */
-
- args[0].name = "text_width";
- args[1].name = "text_height";
- gtk_object_getv (GTK_OBJECT (item), 2, args);
-
- y = GTK_VALUE_DOUBLE (args[1]);
- max_width = GTK_VALUE_DOUBLE (args[0]);
- } else {
- /* Create the items for all the events in the list */
-
- y = 0.0;
- max_width = 0.0;
-
- for (; event_list; event_list = event_list->next) {
- co = event_list->data;
- create_items_for_event (qv, co, &y, &max_width);
- }
- }
-
- /* Set the scrolling region to fit all the items */
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (qv->canvas),
- 0.0, 0.0,
- max_width, y);
-
- gtk_widget_set_usize (qv->canvas, max_width, y);
-}
-
-GtkWidget *
-quick_view_new (GnomeCalendar *calendar, char *title, GList *event_list)
-{
- QuickView *qv;
- GtkWidget *vbox;
- GtkWidget *w;
-
- g_return_val_if_fail (calendar != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CALENDAR (calendar), NULL);
-
- qv = gtk_type_new (quick_view_get_type ());
- qv->calendar = calendar;
-
- /* Create base widgets for the popup window */
-
- w = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (w), GTK_SHADOW_ETCHED_OUT);
- gtk_container_add (GTK_CONTAINER (qv), w);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (w), vbox);
-
- w = gtk_label_new (title);
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
-
- w = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
-
- w = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
- gtk_container_set_border_width (GTK_CONTAINER (w), GNOME_PAD_SMALL);
- gtk_box_pack_start (GTK_BOX (vbox), w, TRUE, TRUE, 0);
-
- gtk_widget_push_visual (gdk_imlib_get_visual ());
- gtk_widget_push_colormap (gdk_imlib_get_colormap ());
-
- qv->canvas = gnome_canvas_new ();
-
- gtk_widget_pop_colormap ();
- gtk_widget_pop_visual ();
-
- gtk_container_add (GTK_CONTAINER (w), qv->canvas);
-
- /* Set up the event list */
-
- setup_event_list (qv, event_list);
-
- return GTK_WIDGET (qv);
-}
-
-void
-quick_view_do_popup (QuickView *qv, GdkEventButton *event)
-{
- g_return_if_fail (qv != NULL);
- g_return_if_fail (IS_QUICK_VIEW (qv));
- g_return_if_fail (event != NULL);
-
- /* Pop up the window */
-
- gtk_widget_show_all (GTK_WIDGET (qv));
- gtk_grab_add (GTK_WIDGET (qv));
-
- qv->button = event->button;
-
- gtk_main (); /* Begin modality */
-
- /* The button release event handler will call gtk_main_quit() */
-}
diff --git a/calendar/gui/quick-view.h b/calendar/gui/quick-view.h
deleted file mode 100644
index c6b2cf8814..0000000000
--- a/calendar/gui/quick-view.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Quick view widget for Gnomecal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx
- */
-
-#ifndef QUICK_VIEW_H
-#define QUICK_VIEW_H
-
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define TYPE_QUICK_VIEW (quick_view_get_type ())
-#define QUICK_VIEW(obj) (GTK_CHECK_CAST ((obj), TYPE_QUICK_VIEW, QuickView))
-#define QUICK_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_QUICK_VIEW, QuickViewClass))
-#define IS_QUICK_VIEW(obj) (GTK_CHECK_TYPE ((obj), TYPE_QUICK_VIEW))
-#define IS_QUICK_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_QUICK_VIEW))
-
-
-typedef struct _QuickView QuickView;
-typedef struct _QuickViewClass QuickViewClass;
-
-struct _QuickView {
- GtkWindow window;
-
- GnomeCalendar *calendar; /* The calendar we are associated to */
-
- GtkWidget *canvas; /* The canvas that displays the contents of the quick view */
-
- int button; /* The button that was pressed to pop up the quick view */
-};
-
-struct _QuickViewClass {
- GtkWindowClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType quick_view_get_type (void);
-
-/* Creates a new quick view with the specified title and the specified event list. It is associated
- * to the specified calendar. The event list must be a list of CalendarObject structures.
- */
-GtkWidget *quick_view_new (GnomeCalendar *calendar, char *title, GList *event_list);
-
-/* Pops up the quick view widget modally and loops until the uses closes it by releasing the mouse
- * button. You can destroy the quick view when this function returns.
- */
-void quick_view_do_popup (QuickView *qv, GdkEventButton *event);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/recur.xpm b/calendar/gui/recur.xpm
deleted file mode 100644
index 49836b62e7..0000000000
--- a/calendar/gui/recur.xpm
+++ /dev/null
@@ -1,83 +0,0 @@
-/* XPM */
-static char * recur_xpm[] = {
-"16 16 64 1",
-" c None",
-". c #350000",
-"+ c #2A0000",
-"@ c #1B0000",
-"# c #280000",
-"$ c #430000",
-"% c #090000",
-"& c #160000",
-"* c #250000",
-"= c #460000",
-"- c #550000",
-"; c #610000",
-"> c #0D0000",
-", c #1F0000",
-"' c #4B0000",
-") c #5E0000",
-"! c #6B0000",
-"~ c #750000",
-"{ c #790000",
-"] c #810000",
-"^ c #FFFF83",
-"/ c #FFFF89",
-"( c #FFFF93",
-"_ c #8B0000",
-": c #900000",
-"< c #930000",
-"[ c #FFFF62",
-"} c #A10000",
-"| c #FFFF41",
-"1 c #FFFF3B",
-"2 c #FFFF31",
-"3 c #B70000",
-"4 c #B20000",
-"5 c #AE0000",
-"6 c #FFFF22",
-"7 c #FFFF16",
-"8 c #FFFF06",
-"9 c #C90000",
-"0 c #C10000",
-"a c #BB0000",
-"b c #FFF600",
-"c c #FFE100",
-"d c #FFC500",
-"e c #E40000",
-"f c #D70000",
-"g c #CD0000",
-"h c #FFDB00",
-"i c #FFA900",
-"j c #FF8500",
-"k c #FF5900",
-"l c #FF2800",
-"m c #FC0000",
-"n c #ED0000",
-"o c #E10000",
-"p c #FFAF00",
-"q c #FF9400",
-"r c #FF7400",
-"s c #FF5000",
-"t c #FF0100",
-"u c #F30000",
-"v c #E80000",
-"w c #FF6900",
-"x c #FF4900",
-"y c #FF0800",
-" ",
-" . ",
-" +. ",
-" @#.$ ",
-" %&*.=-; ",
-" >,.')!~ ",
-" &. !{] ",
-" ^/( . _:< ",
-" [[[ }}} ",
-" |12 345 ",
-" 678 90a ",
-" bcd efg ",
-" hdijklmnof ",
-" pqrsltuv ",
-" wxly ",
-" "};
diff --git a/calendar/gui/test.vcf b/calendar/gui/test.vcf
deleted file mode 100644
index bfe93b3c14..0000000000
--- a/calendar/gui/test.vcf
+++ /dev/null
@@ -1,133 +0,0 @@
-BEGIN:VCALENDAR
-PRODID:-//GNOME//NONSGML GnomeCalendar//EN
-TZ:MST
-VERSION:0.13
-BEGIN:VEVENT
-UID:KOrganizer - 846930886
-SEQUENCE:1
-DTSTART:19980601T150000
-DTEND:19980601T150000
-DCREATED:19980402T023558
-LAST-MODIFIED:19980402T023558
-SUMMARY:Cada dos dias de 06/01 al 07/01
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:D2 19980701T140000
-END:VEVENT
-
-BEGIN:VEVENT
-UID:KOrganizer - 846930886
-SEQUENCE:1
-DTSTART:19980501T140000
-DTEND:19980501T140000
-DCREATED:19980402T023558
-LAST-MODIFIED:19980402T023558
-SUMMARY:5 dias.
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:D1 #5
-END:VEVENT
-
-BEGIN:VEVENT
-UID:KOrganizer - 846930886
-SEQUENCE:1
-DTSTART:19980501T140000
-DTEND:19980501T150000
-DCREATED:19980402T023558
-LAST-MODIFIED:19980429T004635
-SUMMARY:Diariamente de 05/01 al 06/01
-STATUS:NEEDS ACTION
-CLASS:PRIVATE
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:D1 19980601T000000
-END:VEVENT
-
-BEGIN:VEVENT
-UID:KOrganizer - 1804289383
-SEQUENCE:1
-DTSTART:19980415T010000
-DTEND:19980415T013000
-DCREATED:19980402T023552
-LAST-MODIFIED:19980330T225948
-SUMMARY:Diario durante 5 dias
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:D1 #5
-END:VEVENT
-
-BEGIN:VEVENT
-UID:KOrganizer - 1804289383
-SEQUENCE:1
-DTSTART:19980415T010000
-DTEND:19980415T013000
-DCREATED:19980402T023552
-LAST-MODIFIED:19980330T225948
-SUMMARY:Diario durante 5 dias
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:D1 #5
-END:VEVENT
-
-BEGIN:VTODO
-UID:KOrganizer - 846930886
-SEQUENCE:1
-DTSTART:19980415T140000
-DUE:19691231T180000
-DCREATED:19980402T023558
-LAST-MODIFIED:19980402T023558
-SUMMARY:Normal
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-END:VTODO
-
-BEGIN:VTODO
-UID:KOrganizer - 1804289383
-SEQUENCE:1
-DTSTART:19980415T120000
-DUE:19691231T180000
-DCREATED:19980402T023552
-LAST-MODIFIED:19980330T225948
-SUMMARY:Semanal -- 4 semanas
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:W1 WE #4
-END:VTODO
-
-BEGIN:VTODO
-UID:KOrganizer - 1804289383
-SEQUENCE:1
-DTSTART:19980415T003000
-DUE:19691231T180000
-DCREATED:19980402T023552
-LAST-MODIFIED:19980330T225948
-SUMMARY:Semana: Mi, Ju, Vi, Dom (10 veces)
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:W1 SU WE TH FR #10
-END:VTODO
-
-END:VCALENDAR
-
diff --git a/calendar/gui/todo-conduit-control-applet.c b/calendar/gui/todo-conduit-control-applet.c
deleted file mode 100644
index 54a26715ef..0000000000
--- a/calendar/gui/todo-conduit-control-applet.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* Control applet ("capplet") for the gnome-pilot todo conduit, */
-/* based on */
-/* gpilotd control applet ('capplet') for use with the GNOME control center */
-/* $Id$ */
-
-#include <pwd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <gnome.h>
-
-#include <config.h>
-#include <capplet-widget.h>
-
-#include <gpilotd/gpilotd-conduit-mgmt.h>
-#include <gpilotd/gpilotd-app.h>
-#include <gpilotd/gpilotd-app-dummy-callbacks.h>
-
-#include "todo-conduit.h"
-
-/* tell changes callbacks to ignore changes or not */
-static gboolean ignore_changes=FALSE;
-
-/* capplet widget */
-static GtkWidget *capplet=NULL;
-
-/* host/device/pilot configuration windows */
-GtkWidget *cfgOptionsWindow=NULL;
-GtkWidget *cfgStateWindow=NULL;
-GtkWidget *dialogWindow=NULL;
-
-gboolean activated,org_activation_state;
-GnomePilotConduitMgmt *conduit;
-
-static void doTrySettings(GtkWidget *widget, ConduitCfg *conduitCfg);
-static void doRevertSettings(GtkWidget *widget, ConduitCfg *conduitCfg);
-static void doSaveSettings(GtkWidget *widget, ConduitCfg *conduitCfg);
-
-static void readStateCfg(GtkWidget *w);
-static void setStateCfg(GtkWidget *w);
-
-gint pilotId;
-CORBA_Environment ev;
-
-static void
-doTrySettings(GtkWidget *widget, ConduitCfg *conduitCfg)
-{
- readStateCfg(cfgStateWindow);
- if(activated)
- gpilotd_conduit_mgmt_enable(conduit,pilotId,GnomePilotConduitSyncTypeSynchronize);
- else
- gpilotd_conduit_mgmt_disable(conduit,pilotId);
-}
-
-static void
-doSaveSettings(GtkWidget *widget, ConduitCfg *conduitCfg)
-{
- doTrySettings(widget, conduitCfg);
- save_configuration(NULL);
-}
-
-
-static void
-doRevertSettings(GtkWidget *widget, ConduitCfg *conduitCfg)
-{
- activated = org_activation_state;
- setStateCfg(cfgStateWindow);
-}
-
-static void
-insert_dir_callback (GtkEditable *editable, const gchar *text,
- gint len, gint *position, void *data)
-{
- gint i;
- gchar *curname;
-
- curname = gtk_entry_get_text(GTK_ENTRY(editable));
- if (*curname == '\0' && len > 0) {
- if (isspace(text[0])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert_text");
- return;
- }
- } else {
- for (i=0; i<len; i++) {
- if (isspace(text[i])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable),
- "insert_text");
- return;
- }
- }
- }
-}
-static void
-insert_dir_callback2(GtkEditable *editable, const gchar *text,
- gint length, gint *position,
- void *data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static void
-clist_changed(GtkWidget *widget, gpointer data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-void about_cb (GtkWidget *widget, gpointer data) {
- GtkWidget *about;
- const gchar *authors[] = {_("Eskil Heyn Olsen <deity@eskil.dk>"),NULL};
-
- about = gnome_about_new(_("Gpilotd todo conduit"), VERSION,
- _("(C) 1998 the Free Software Foundation"),
- authors,
- _("Configuration utility for the todo conduit.\n"),
- _("gnome-unknown.xpm"));
- gtk_widget_show (about);
-
- return;
-}
-
-static void toggled_cb(GtkWidget *widget, gpointer data) {
- gtk_widget_set_sensitive(cfgOptionsWindow,GTK_TOGGLE_BUTTON(widget)->active);
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static GtkWidget
-*createStateCfgWindow(void)
-{
- GtkWidget *vbox, *table;
- GtkWidget *entry, *label;
- GtkWidget *button;
-
- vbox = gtk_vbox_new(FALSE, GNOME_PAD);
-
- table = gtk_table_new(2, 2, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE(table), 4);
- gtk_table_set_col_spacings(GTK_TABLE(table), 10);
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD);
-
- label = gtk_label_new(_("Enabled"));
- gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1,2);
-
- button = gtk_check_button_new();
- gtk_object_set_data(GTK_OBJECT(vbox), "conduit_on_off", button);
- gtk_signal_connect(GTK_OBJECT(button), "toggled",
- GTK_SIGNAL_FUNC(toggled_cb),
- NULL);
- gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 1,2);
-
- return vbox;
-}
-
-static void
-setStateCfg(GtkWidget *cfg)
-{
- GtkWidget *button;
- gchar num[40];
-
- button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
-
- g_assert(button!=NULL);
-
- ignore_changes = TRUE;
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),activated);
- gtk_widget_set_sensitive(cfgOptionsWindow,GTK_TOGGLE_BUTTON(button)->active);
- ignore_changes = FALSE;
-}
-
-
-static void
-readStateCfg(GtkWidget *cfg)
-{
- GtkWidget *button;
-
- button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
-
- g_assert(button!=NULL);
-
- activated = GTK_TOGGLE_BUTTON(button)->active;
-}
-
-static void
-pilot_capplet_setup(void)
-{
- GtkWidget *frame, *table;
-
- capplet = capplet_widget_new();
-
- table = gtk_table_new(1, 2, FALSE);
- gtk_container_border_width(GTK_CONTAINER(table), GNOME_PAD);
- gtk_container_add(GTK_CONTAINER(capplet), table);
-
- frame = gtk_frame_new(_("Conduit state"));
- gtk_container_border_width(GTK_CONTAINER(frame), GNOME_PAD_SMALL);
- gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1);
- cfgStateWindow = createStateCfgWindow();
- gtk_container_add(GTK_CONTAINER(frame), cfgStateWindow);
-
- gtk_signal_connect(GTK_OBJECT(capplet), "try",
- GTK_SIGNAL_FUNC(doTrySettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "revert",
- GTK_SIGNAL_FUNC(doRevertSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "ok",
- GTK_SIGNAL_FUNC(doSaveSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "help",
- GTK_SIGNAL_FUNC(about_cb), NULL);
-
-
- setStateCfg(cfgStateWindow);
-
- gtk_widget_show_all(capplet);
-}
-
-void run_error_dialog(gchar *mesg,...) {
- char tmp[80];
- va_list ap;
-
- va_start(ap,mesg);
- vsnprintf(tmp,79,mesg,ap);
- dialogWindow = gnome_message_box_new(mesg,GNOME_MESSAGE_BOX_ERROR,GNOME_STOCK_BUTTON_OK,NULL);
- gnome_dialog_run_and_close(GNOME_DIALOG(dialogWindow));
- va_end(ap);
-}
-
-gint get_pilot_id_from_gpilotd() {
- gint *pilots;
- int i;
-
- i=0;
- gpilotd_get_pilot_ids(&pilots);
- if(pilots) {
- while(pilots[i]!=-1) { g_message("pilot %d = \"%d\"",i,pilots[i]); i++; }
- if(i==0) {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- } else {
- if(i==1)
- return pilots[0];
- else {
- g_message("too many pilots...");
- return pilots[0];
- }
- }
- } else {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- }
-}
-
-int
-main( int argc, char *argv[] )
-{
- /* we're a capplet */
- gnome_capplet_init ("todo conduit control applet", NULL, argc, argv,
- NULL,
- 0, NULL);
-
- /* put all code to set things up in here */
- conduit = gpilotd_conduit_mgmt_new("todo_conduit");
-
- /* get pilot name from gpilotd */
- /* 1. initialize the gpilotd connection */
- if (gpilotd_init(&argc,argv)!=0) {
- run_error_dialog(_("Cannot initialze the GnomePilot Daemon"));
- g_error(_("Cannot initialze the GnomePilot Daemon"));
- return -1;
- }
-
- /* 2 connect to gpilotd */
- if (gpilotd_connect()!=0) {
- run_error_dialog(_("Cannot connect to the GnomePilot Daemon"));
- g_error(_("Cannot connect to the GnomePilot Daemon"));
- return -1;
- }
-
- pilotId = get_pilot_id_from_gpilotd();
- if(!pilotId) return -1;
- org_activation_state = activated = gpilotd_conduit_mgmt_is_enabled(conduit,pilotId);
-
- pilot_capplet_setup();
-
-
- /* done setting up, now run main loop */
- capplet_gtk_main();
- return 0;
-}
diff --git a/calendar/gui/todo-conduit-control-applet.desktop b/calendar/gui/todo-conduit-control-applet.desktop
deleted file mode 100644
index 87788bde08..0000000000
--- a/calendar/gui/todo-conduit-control-applet.desktop
+++ /dev/null
@@ -1,6 +0,0 @@
-[Desktop Entry]
-Name=Todo conduit
-Comment=Configure the todo conduit
-Exec=todo-conduit-control-applet --cap-id=1
-Terminal=0
-Type=Application
diff --git a/calendar/gui/todo-conduit.c b/calendar/gui/todo-conduit.c
deleted file mode 100644
index 3a543816af..0000000000
--- a/calendar/gui/todo-conduit.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* $Id$ */
-
-#include <glib.h>
-#include <gnome.h>
-
-#include <pi-source.h>
-#include <pi-socket.h>
-#include <pi-file.h>
-#include <pi-dlp.h>
-#include <pi-version.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <utime.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <signal.h>
-#include <errno.h>
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-standard-abs.h>
-
-#include "todo-conduit.h"
-
-static gint
-load_records(GnomePilotConduit *c)
-{
- return 0;
-}
-
-static gint
-pre_sync(GnomePilotConduit *c, GnomePilotDBInfo *dbi) {
- int l;
- unsigned char *buf;
-
- gtk_object_set_data(GTK_OBJECT(c),"dbinfo",dbi);
-
- load_records(c);
-
- buf = (unsigned char*)g_malloc(0xffff);
- if((l=dlp_ReadAppBlock(dbi->pilot_socket,dbi->db_handle,0,(unsigned char *)buf,0xffff))<0) {
- return -1;
- }
- unpack_ToDoAppInfo(&(GET_DATA(c)->ai),buf,l);
- g_free(buf);
-
- return 0;
-}
-
-static gint
-post_sync(GnomePilotConduit *c) {
- return 0;
-}
-
-static gint
-match_record (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("in match_record\n");
- return 0;
-}
-static gint
-free_match (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- gpointer data)
-{
- g_print ("entering free_match\n");
- *local = NULL;
-
- return 0;
-}
-static gint
-archive_local (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gpointer data)
-{
- g_print ("entering archive_local\n");
- return 1;
-
-}
-static gint
-archive_remote (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering archive_remote\n");
- return 1;
-}
-static gint
-store_remote (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering store_remote\n");
- g_print ("Rec:%s:\nLength:%d\n", remote->record, remote->length);
- return 1;
-}
-static gint
-clear_status_archive_local (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gpointer data)
-{
- g_print ("entering clear_status_archive_local\n");
- return 1;
-}
-static gint
-iterate (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- gpointer data)
-{
- g_print ("entering iterate\n");
- return 1;
-}
-static gint
-iterate_specific (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- gint flag,
- gint archived,
- gpointer data)
-{
- g_print ("entering iterate_specific\n");
- return 1;
-}
-static gint
-purge (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- gpointer data)
-{
- g_print ("entering purge\n");
- return 1;
-}
-static gint
-set_status (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gint status,
- gpointer data)
-{
- g_print ("entering set_status\n");
- return 1;
-}
-static gint
-set_archived (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gint archived,
- gpointer data)
-{
- g_print ("entering set_archived\n");
- return 1;
-}
-static gint
-set_pilot_id (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- guint32 ID,
- gpointer data)
-{
- g_print ("entering set_pilot_id\n");
- return 1;
-}
-static gint
-compare (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering compare\n");
- return 1;
-}
-static gint
-compare_backup (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering compare_backup\n");
- return 1;
-}
-static gint
-free_transmit (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering free_transmit\n");
- return 1;
-}
-static gint
-delete_all (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- gpointer data)
-{
- g_print ("entering delete_all\n");
- return 1;
-}
-static PilotRecord *
-transmit (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gpointer data)
-{
- g_print ("entering transmit\n");
- return NULL;
-}
-
-static GnomePilotConduit *
-conduit_get_gpilot_conduit (guint32 pilotId)
-{
- GtkObject *retval;
- ConduitCfg *cfg;
- ConduitData *cdata;
-
- g_print ("creating our new conduit\n");
- retval = gnome_pilot_conduit_standard_abs_new ("TodoDB", 0x0);
- g_assert (retval != NULL);
- gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"todo");
-
- cfg = g_new0(ConduitCfg,1);
- g_assert(cfg != NULL);
- gtk_object_set_data(retval,"conduit_cfg",cfg);
-
- cdata = g_new0(ConduitData,1);
- g_assert(cdata != NULL);
- gtk_object_set_data(retval,"conduit_data",cdata);
-
- gtk_signal_connect (retval, "match_record", (GtkSignalFunc) match_record, NULL);
- gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, NULL);
- gtk_signal_connect (retval, "archive_local", (GtkSignalFunc) archive_local, NULL);
- gtk_signal_connect (retval, "archive_remote", (GtkSignalFunc) archive_remote, NULL);
- gtk_signal_connect (retval, "store_remote", (GtkSignalFunc) store_remote, NULL);
- gtk_signal_connect (retval, "clear_status_archive_local", (GtkSignalFunc) clear_status_archive_local, NULL);
- gtk_signal_connect (retval, "iterate", (GtkSignalFunc) iterate, NULL);
- gtk_signal_connect (retval, "iterate_specific", (GtkSignalFunc) iterate_specific, NULL);
- gtk_signal_connect (retval, "purge", (GtkSignalFunc) purge, NULL);
- gtk_signal_connect (retval, "set_status", (GtkSignalFunc) set_status, NULL);
- gtk_signal_connect (retval, "set_archived", (GtkSignalFunc) set_archived, NULL);
- gtk_signal_connect (retval, "set_pilot_id", (GtkSignalFunc) set_pilot_id, NULL);
- gtk_signal_connect (retval, "compare", (GtkSignalFunc) compare, NULL);
- gtk_signal_connect (retval, "compare_backup", (GtkSignalFunc) compare_backup, NULL);
- gtk_signal_connect (retval, "free_transmit", (GtkSignalFunc) free_transmit, NULL);
- gtk_signal_connect (retval, "delete_all", (GtkSignalFunc) delete_all, NULL);
- gtk_signal_connect (retval, "transmit", (GtkSignalFunc) transmit, NULL);
- gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, NULL);
- gtk_signal_connect (retval, "post_sync", (GtkSignalFunc) post_sync, NULL);
-
- load_configuration(&cfg,pilotId);
-
- return GNOME_PILOT_CONDUIT (retval);
-}
-static void
-conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit)
-{
- ConduitCfg *cc;
- cc = GET_CONFIG(conduit);
- destroy_configuration(&cc);
- gtk_object_destroy (GTK_OBJECT (conduit));
-}
-
-
diff --git a/calendar/gui/todo-conduit.h b/calendar/gui/todo-conduit.h
deleted file mode 100644
index c224b2b1f3..0000000000
--- a/calendar/gui/todo-conduit.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $Id$ */
-
-#ifndef __TODO_CONDUIT_H__
-#define __TODO_CONDUIT_H__
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <pi-todo.h>
-#include <gnome.h>
-
-typedef struct _ConduitCfg ConduitCfg;
-
-struct _ConduitCfg {
- gboolean open_secret;
- guint32 pilotId;
-};
-
-#define GET_CONFIG(c) ((ConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"conduit_cfg"))
-
-typedef struct _ConduitData ConduitData;
-
-struct _ConduitData {
- struct ToDoAppInfo ai;
-};
-
-#define GET_DATA(c) ((ConduitData*)gtk_object_get_data(GTK_OBJECT(c),"conduit_data"))
-
-static void load_configuration(ConduitCfg **c,guint32 pilotId) {
- gchar prefix[256];
- g_snprintf(prefix,255,"/gnome-pilot.d/todod-conduit/Pilot_%u/",pilotId);
-
- *c = g_new0(ConduitCfg,1);
- gnome_config_push_prefix(prefix);
- (*c)->open_secret = gnome_config_get_bool("open secret=FALSE");
- gnome_config_pop_prefix();
-
- (*c)->pilotId = pilotId;
-}
-
-static void save_configuration(ConduitCfg *c) {
- gchar prefix[256];
-
- g_snprintf(prefix,255,"/gnome-pilot.d/todo-conduit/Pilot_%u/",c->pilotId);
-
- gnome_config_push_prefix(prefix);
- gnome_config_set_bool("open secret",c->open_secret);
- gnome_config_pop_prefix();
-
- gnome_config_sync();
- gnome_config_drop_all();
-}
-
-static void destroy_configuration(ConduitCfg **c) {
- g_free(*c);
- *c = NULL;
-}
-
-#endif __TODO_CONDUIT_H__
diff --git a/calendar/gui/topic.dat b/calendar/gui/topic.dat
deleted file mode 100644
index edc7813b26..0000000000
--- a/calendar/gui/topic.dat
+++ /dev/null
@@ -1,2 +0,0 @@
-gnome-cal.html Manual
-gnome-cal.html#cmdline Command line options \ No newline at end of file
diff --git a/calendar/gui/view-utils.c b/calendar/gui/view-utils.c
deleted file mode 100644
index 8cb7893377..0000000000
--- a/calendar/gui/view-utils.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* Miscellaneous utility functions for the calendar view widgets
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <quartic@gimp.org>
- * Miguel de Icaza <miguel@kernel.org>
- */
-
-#include <string.h>
-#include "view-utils.h"
-#include <libgnomeui/gnome-icon-text.h>
-
-int am_pm_flag = 0;
-
-static char *
-nicetime (struct tm *tm)
-{
- static char buf [20];
- char *p = buf;
-
- if (am_pm_flag){
- if (tm->tm_min)
- strftime (buf, sizeof (buf), "%l:%M%p", tm);
- else
- strftime (buf, sizeof (buf), "%l%p", tm);
- } else {
- if (tm->tm_min)
- strftime (buf, sizeof (buf), "%H:%M", tm);
- else
- strftime (buf, sizeof (buf), "%H", tm);
- }
- while (*p == ' ')
- p++;
- return p;
-}
-
-typedef struct {
- GnomeIconTextInfo *layout;
- int lines;
- int assigned_lines;
-} line_info_t;
-
-void
-view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, GList *events, time_t start, time_t end)
-{
- GdkFont *font = widget->style->font;
- int font_height;
- int y, max_y, items, i, need_more, nlines, base, extra;
- GList *list;
- line_info_t *lines;
-
- if (events == NULL)
- return;
-
- items = g_list_length (events);
- lines = g_new0 (line_info_t, items);
-
- font_height = font->ascent + font->descent;
- max_y = area->y + area->height - font_height * ((flags & VIEW_UTILS_DRAW_SPLIT) ? 2 : 1);
-
- /*
- * Layout all the lines, measure the space needs
- */
- for (i = 0, list = events; list; list = list->next, i++){
- CalendarObject *co = list->data;
- struct tm tm_start, tm_end;
- iCalObject *ico = co->ico;
- char buf [60];
- char *full_text;
-
- tm_start = *localtime (&co->ev_start);
- tm_end = *localtime (&co->ev_end);
-
- strcpy (buf, nicetime (&tm_start));
-
- if (flags & VIEW_UTILS_DRAW_END){
- strcat (buf, "-");
- strcat (buf, nicetime (&tm_end));
- }
-
- full_text = g_strconcat (buf, ": ", ico->summary, NULL);
- lines [i].layout = gnome_icon_layout_text (
- font, full_text, "\n -,.;:=#", area->width, TRUE);
- lines [i].lines = g_list_length (lines [i].layout->rows);
-
- g_free (full_text);
- }
-
- /*
- * Compute how many lines we will give to each row
- */
- nlines = 1 + max_y / font_height;
- base = nlines / items;
- extra = nlines % items;
- need_more = 0;
-
- for (i = 0; i < items; i++){
- if (lines [i].lines <= base){
- extra += base - lines [i].lines;
- lines [i].assigned_lines = lines [i].lines;
- } else {
- need_more++;
- lines [i].assigned_lines = base;
- }
- }
-
- /*
- * use any extra space
- */
- while (need_more && extra > 0){
- need_more = 0;
-
- for (i = 0; i < items; i++){
- if (lines [i].lines > lines [i].assigned_lines){
- lines [i].assigned_lines++;
- extra--;
- }
-
- if (extra == 0)
- break;
-
- if (lines [i].lines > lines [i].assigned_lines)
- need_more = 1;
- }
- }
-
- /*
- * Draw the information
- */
- gdk_gc_set_clip_rectangle (gc, area);
- y = area->y;
- for (i = 0; i < items; i++){
- int line;
-
- list = lines [i].layout->rows;
-
- for (line = 0; line < lines [i].assigned_lines; line++){
- GnomeIconTextInfoRow *row = list->data;
-
- list = list->next;
-
- if (row)
- gdk_draw_string (
- window, font, gc,
- area->x, y + font->ascent,
- row->text);
- y += font_height;
- }
- }
-
- gdk_gc_set_clip_rectangle (gc, NULL);
-
- /*
- * Free resources.
- */
-
- for (i = 0; i < items; i++)
- gnome_icon_text_info_free (lines [i].layout);
- g_free (lines);
-}
-
-void
-view_utils_draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, GtkShadowType shadow)
-{
- int x, y;
- int xthick, ythick;
- GdkGC *light_gc, *dark_gc;
-
- gdk_draw_rectangle (window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- rect->x, rect->y,
- rect->width, rect->height);
-
- light_gc = widget->style->light_gc[GTK_STATE_NORMAL];
- dark_gc = widget->style->dark_gc[GTK_STATE_NORMAL];
-
- xthick = widget->style->klass->xthickness;
- ythick = widget->style->klass->ythickness;
-
- gdk_gc_set_clip_rectangle (light_gc, rect);
- gdk_gc_set_clip_rectangle (dark_gc, rect);
-
- for (y = rect->y + ythick; y < (rect->y + rect->height - ythick); y += 3)
- for (x = rect->x + xthick; x < (rect->x + rect->width - xthick); x += 6) {
- gdk_draw_point (window, light_gc, x, y);
- gdk_draw_point (window, dark_gc, x + 1, y + 1);
-
- gdk_draw_point (window, light_gc, x + 3, y + 1);
- gdk_draw_point (window, dark_gc, x + 4, y + 2);
- }
-
- gdk_gc_set_clip_rectangle (light_gc, NULL);
- gdk_gc_set_clip_rectangle (dark_gc, NULL);
-
- gtk_draw_shadow (widget->style, window,
- GTK_STATE_NORMAL, shadow,
- rect->x, rect->y,
- rect->width, rect->height);
-}
diff --git a/calendar/gui/view-utils.h b/calendar/gui/view-utils.h
deleted file mode 100644
index a1876b6032..0000000000
--- a/calendar/gui/view-utils.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Miscellaneous utility functions for the calendar view widgets
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef VIEW_UTILS_H
-#define VIEW_UTILS_H
-
-
-#include <gtk/gtk.h>
-#include "calendar.h"
-
-
-enum {
- VIEW_UTILS_DRAW_END = 1 << 0,
- VIEW_UTILS_DRAW_SPLIT = 1 << 1
-};
-
-
-void view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, GList *events, time_t start, time_t end);
-
-void view_utils_draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, GtkShadowType shadow);
-
-
-#endif
diff --git a/calendar/gui/week-view.c b/calendar/gui/week-view.c
deleted file mode 100644
index 89e489a92d..0000000000
--- a/calendar/gui/week-view.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Week view display for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include "year-view.h"
-
-
-static void week_view_class_init (WeekViewClass *class);
-static void week_view_init (WeekView *wv);
-
-
-GtkType
-week_view_get_type (void)
-{
- static GtkType week_view_type = 0;
-
- if (!week_view_type) {
- GtkTypeInfo week_view_info = {
- "WeekView",
- sizeof (WeekView),
- sizeof (WeekViewClass),
- (GtkClassInitFunc) week_view_class_init,
- (GtkObjectInitFunc) week_view_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- week_view_type = gtk_type_unique (gnome_canvas_get_type (), &week_view_info);
- }
-
- return week_view_type;
-}
-
-static void
-week_view_class_init (WeekViewClass *class)
-{
- /* FIXME */
-}
-
-static void
-week_view_init (WeekView *wv)
-{
- GnomeCanvasGroup *root;
-
- root = gnome_canvas_root (GNOME_CANVAS (wv));
-
- /* Title */
-
- wv->title = gnome_canvas_item_new (root,
- gnome_canvas_text_get_type (),
- "anchor", GTK_ANCHOR_N,
- "font", HEADING_FONT,
- "fill_color", "black",
- NULL);
-}
-
-GtkWidget *
-week_view_new (GnomeCalendar *calendar, time_t week)
-{
- WeekView *wv;
-
- g_return_val_if_fail (calendar != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CALENDAR (calendar), NULL);
-
- wv = gtk_type_new (week_view_get_type ());
- wv->calendar = calendar;
-
- week_view_colors_changed (wv);
- week_view_set (wv, week);
- return GTK_WIDGET (wv);
-}
-
-void
-week_view_update (WeekView *wv, iCalObject *ico, int flags)
-{
- /* FIXME */
-}
-
-void
-week_view_set (WeekView *wv, time_t week)
-{
- /* FIXME */
-}
-
-void
-week_view_time_format_changed (WeekView *wv)
-{
- /* FIXME */
-}
-
-void
-week_view_colors_changed (WeekView *wv)
-{
- /* FIXME */
-}
diff --git a/calendar/gui/week-view.h b/calendar/gui/week-view.h
deleted file mode 100644
index 1bf6a4ed02..0000000000
--- a/calendar/gui/week-view.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Week view display for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef WEEK_VIEW_H
-#define WEEK_VIEW_H
-
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define TYPE_WEEK_VIEW (week_view_get_type ())
-#define WEEK_VIEW(obj) (GTK_CHECK_CAST ((obj), TYPE_WEEK_VIEW, WeekView))
-#define WEEK_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_WEEK_VIEW, WeekViewClass))
-#define IS_WEEK_VIEW(obj) (GTK_CHECK_TYPE ((obj), TYPE_WEEK_VIEW))
-#define IS_WEEK_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_WEEK_VIEW))
-
-
-typedef struct _WeekView WeekView;
-typedef struct _WeekViewClass WeekViewClass;
-
-struct _WeekView {
- GnomeCanvas canvas;
-
- GnomeCalendar *calendar; /* The calendar we are associated to */
-
- time_t week; /* Start of the week we are viewing */
-
- GnomeCanvasItem *title; /* The title of the week view */
-};
-
-struct _WeekViewClass {
- GnomeCanvasClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType week_view_get_type (void);
-
-/* Creates a new week view associated to the specified calendar */
-GtkWidget *week_view_new (GnomeCalendar *calendar, time_t week);
-
-/* Notifies the week view that a calendar object has changed */
-void week_view_update (WeekView *wv, iCalObject *ico, int flags);
-
-/* Notifies the week view about a change of date */
-void week_view_set (WeekView *wv, time_t week);
-
-/* Notifies the week view that the time format has changed */
-void week_view_time_format_changed (WeekView *wv);
-
-/* Notifies the week view that the colors have changed */
-void week_view_colors_changed (WeekView *wv);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/gui/year-view.c b/calendar/gui/year-view.c
deleted file mode 100644
index 5744b4a88f..0000000000
--- a/calendar/gui/year-view.c
+++ /dev/null
@@ -1,741 +0,0 @@
-/* Year view display for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Arturo Espinosa <arturo@nuclecu.unam.mx>
- * Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include <gtk/gtkmain.h>
-#include <gnome.h>
-#include "eventedit.h"
-#include "year-view.h"
-#include "main.h"
-#include "mark.h"
-#include "quick-view.h"
-#include "timeutil.h"
-
-
-#define HEAD_SPACING 4 /* Spacing between year heading and months */
-#define TITLE_SPACING 1 /* Spacing between title and calendar */
-#define SPACING 4 /* Spacing between months */
-
-
-static void year_view_class_init (YearViewClass *class);
-static void year_view_init (YearView *yv);
-static void year_view_destroy (GtkObject *object);
-static void year_view_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void year_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-
-static GnomeCanvas *parent_class;
-
-
-GtkType
-year_view_get_type (void)
-{
- static GtkType year_view_type = 0;
-
- if (!year_view_type) {
- GtkTypeInfo year_view_info = {
- "YearView",
- sizeof (YearView),
- sizeof (YearViewClass),
- (GtkClassInitFunc) year_view_class_init,
- (GtkObjectInitFunc) year_view_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- year_view_type = gtk_type_unique (gnome_canvas_get_type (), &year_view_info);
- }
-
- return year_view_type;
-}
-
-static void
-year_view_class_init (YearViewClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = gtk_type_class (gnome_canvas_get_type ());
-
- object_class->destroy = year_view_destroy;
-
- widget_class->size_request = year_view_size_request;
- widget_class->size_allocate = year_view_size_allocate;
-}
-
-/* Resizes the year view's child items. This is done in the idle loop for
- * performance (we avoid resizing on every size allocation).
- */
-static gint
-idle_handler (gpointer data)
-{
- YearView *yv;
- GtkArg arg;
- double head_height;
- double title_height;
- double width, height;
- double month_width;
- double month_height;
- double month_yofs;
- double xofs, yofs;
- double x, y;
- int i;
-
- yv = data;
-
- /* Compute the size we can use */
-
- width = MAX (GTK_WIDGET (yv)->allocation.width, yv->min_width);
- height = MAX (GTK_WIDGET (yv)->allocation.height, yv->min_height);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (yv), 0, 0, width, height);
-
- width--;
- height--;
-
- /* Get the heights of the heading and the titles */
-
- arg.name = "text_height";
- gtk_object_getv (GTK_OBJECT (yv->heading), 1, &arg);
- head_height = GTK_VALUE_DOUBLE (arg) + 2 * HEAD_SPACING;
-
- arg.name = "text_height";
- gtk_object_getv (GTK_OBJECT (yv->titles[0]), 1, &arg);
- title_height = GTK_VALUE_DOUBLE (arg);
-
- /* Offsets */
-
- xofs = (width + SPACING) / 3.0;
- yofs = (height - head_height + SPACING) / 4.0;
-
- /* Month item vertical offset */
-
- month_yofs = title_height + TITLE_SPACING;
-
- /* Month item dimensions */
-
- month_width = (width - 2 * SPACING) / 3.0;
- month_height = (yofs - SPACING) - month_yofs;
-
- /* Adjust the year heading */
-
- gnome_canvas_item_set (yv->heading,
- "x", width / 2.0,
- "y", (double) HEAD_SPACING,
- NULL);
-
- /* Adjust titles and months */
-
- for (i = 0; i < 12; i++) {
- x = (i % 3) * xofs;
- y = head_height + (i / 3) * yofs;
-
- gnome_canvas_item_set (yv->titles[i],
- "x", x + month_width / 2.0,
- "y", y,
- NULL);
-
- gnome_canvas_item_set (yv->mitems[i],
- "x", x,
- "y", y + month_yofs,
- "width", month_width,
- "height", month_height,
- NULL);
- }
-
- /* Done */
-
- yv->need_resize = FALSE;
- return FALSE;
-}
-
-/* Marks the year view as needing a resize, which will be performed during the idle loop */
-static void
-need_resize (YearView *yv)
-{
- if (yv->need_resize)
- return;
-
- yv->need_resize = TRUE;
- yv->idle_id = gtk_idle_add (idle_handler, yv);
-}
-
-/* Callback used to destroy the year view's popup menu when the year view itself is destroyed */
-static void
-destroy_menu (GtkWidget *widget, gpointer data)
-{
- gtk_widget_destroy (GTK_WIDGET (data));
-}
-
-/* Create a new appointment in the highlighted day from the year view's popup menu */
-static void
-new_appointment (GtkWidget *widget, gpointer data)
-{
- YearView *yv;
- time_t *t;
-
- yv = YEAR_VIEW (data);
- t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
-
- event_editor_new_whole_day (yv->calendar, *t);
-}
-
-/* Convenience functions to jump to a view and set the time */
-static void
-do_jump (GtkWidget *widget, gpointer data, char *view_name)
-{
- YearView *yv;
- time_t *t;
-
- yv = YEAR_VIEW (data);
-
- /* Get the time data from the menu item */
-
- t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
-
- /* Set the view and time */
-
- gnome_calendar_set_view (yv->calendar, view_name);
- gnome_calendar_goto (yv->calendar, *t);
-}
-
-/* The following three callbacks set the view in the calendar and change the time */
-
-static void
-jump_to_day (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "dayview");
-}
-
-static void
-jump_to_week (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "weekview");
-}
-
-static void
-jump_to_month (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "monthview");
-}
-
-/* Information for the year view's popup menu */
-static GnomeUIInfo yv_popup_menu[] = {
- GNOMEUIINFO_ITEM_STOCK (N_("_New appointment in this day..."), NULL, new_appointment, GNOME_STOCK_MENU_NEW),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _day"), NULL, jump_to_day, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _week"), NULL, jump_to_week, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _month"), NULL, jump_to_month, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_END
-};
-
-/* Returns the popup menu cooresponding to the specified year view. If the menu has not been
- * created yet, it creates it and attaches it to the year view.
- */
-static GtkWidget *
-get_popup_menu (YearView *yv)
-{
- GtkWidget *menu;
-
- menu = gtk_object_get_data (GTK_OBJECT (yv), "popup_menu");
-
- if (!menu) {
- menu = gnome_popup_menu_new (yv_popup_menu);
- gtk_object_set_data (GTK_OBJECT (yv), "popup_menu", menu);
- gtk_signal_connect (GTK_OBJECT (yv), "destroy",
- (GtkSignalFunc) destroy_menu,
- menu);
- }
-
- return menu;
-}
-
-/* Executes the year view's popup menu. It may disable/enable some menu items based on the
- * specified flags. A pointer to a time_t value containing the specified time data is set in the
- * "time_data" object data key of the menu items.
- */
-static void
-do_popup_menu (YearView *yv, GdkEventButton *event, int allow_new, int allow_day, int allow_week, int allow_month,
- int year, int month, int day)
-{
- GtkWidget *menu;
- static time_t t;
-
- menu = get_popup_menu (yv);
-
- /* Enable/disable items as appropriate */
-
- gtk_widget_set_sensitive (yv_popup_menu[0].widget, allow_new);
- gtk_widget_set_sensitive (yv_popup_menu[2].widget, allow_day);
- gtk_widget_set_sensitive (yv_popup_menu[3].widget, allow_week);
- gtk_widget_set_sensitive (yv_popup_menu[4].widget, allow_month);
-
- /* Set the day item relevant to the context */
-
- t = time_from_day (year, month, day);
-
- gtk_object_set_data (GTK_OBJECT (yv_popup_menu[0].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (yv_popup_menu[2].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (yv_popup_menu[3].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (yv_popup_menu[4].widget), "time_data", &t);
-
- gnome_popup_menu_do_popup (menu, NULL, NULL, event, yv);
-}
-
-/* Creates the quick view when the user clicks on a day */
-static void
-do_quick_view_popup (YearView *yv, GdkEventButton *event, int year, int month, int day)
-{
- time_t day_start, day_end;
- GList *list;
- GtkWidget *qv;
- char date_str[256];
-
- day_start = time_from_day (year, month, day);
- day_end = time_day_end (day_start);
-
- list = calendar_get_events_in_range (yv->calendar->cal, day_start, day_end);
-
- strftime (date_str, sizeof (date_str), _("%a %b %d %Y"), localtime (&day_start));
- qv = quick_view_new (yv->calendar, date_str, list);
-
- quick_view_do_popup (QUICK_VIEW (qv), event);
-
- gtk_widget_destroy (qv);
- calendar_destroy_event_list (list);
-}
-
-/* Event handler for days in the year's month items */
-static gint
-day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- YearView *yv;
- GnomeMonthItem *mitem;
- int child_num, day;
-
- mitem = GNOME_MONTH_ITEM (data);
- child_num = gnome_month_item_child2num (mitem, item);
- day = gnome_month_item_num2day (mitem, child_num);
-
- yv = YEAR_VIEW (item->canvas);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if (day == 0)
- break;
-
- if (event->button.button == 1) {
- do_quick_view_popup (yv, (GdkEventButton *) event, mitem->year, mitem->month, day);
- return TRUE;
- } else if (event->button.button == 3) {
- do_popup_menu (yv, (GdkEventButton *) event, TRUE, TRUE, TRUE, TRUE,
- mitem->year, mitem->month, day);
-
- /* We have to stop the signal emission because mark.c will grab it too and
- * set the return value to FALSE. Blargh.
- */
- gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event");
- return TRUE;
- }
-
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Event handler for whole month items */
-static gint
-month_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- YearView *yv;
- GnomeMonthItem *mitem;
-
- mitem = GNOME_MONTH_ITEM (item);
-
- yv = YEAR_VIEW (item->canvas);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if (event->button.button != 3)
- break;
-
- do_popup_menu (yv, (GdkEventButton *) event, FALSE, FALSE, FALSE, TRUE,
- mitem->year, mitem->month, 1);
-
- /* We have to stop the signal emission because mark.c will grab it too and
- * set the return value to FALSE. Blargh.
- */
- gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event");
- return TRUE;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Sets up the month item with the specified index -- connects signals for handling events, etc. */
-static void
-setup_month_item (YearView *yv, int n)
-{
- GnomeCanvasItem *mitem;
- GnomeCanvasItem *item;
- int i;
-
- mitem = yv->mitems[n];
-
- /* Connect the day signals */
-
- for (i = 0; i < 42; i++) {
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mitem), GNOME_MONTH_ITEM_DAY_GROUP + i);
- gtk_signal_connect (GTK_OBJECT (item), "event",
- (GtkSignalFunc) day_event,
- mitem);
- }
-
- /* Connect the month signals */
-
- gtk_signal_connect (GTK_OBJECT (mitem), "event",
- (GtkSignalFunc) month_event,
- NULL);
-
- /* Prepare for prelighting */
-
- month_item_prepare_prelight (GNOME_MONTH_ITEM (mitem), default_color_func, NULL);
-}
-
-/* Computes the minimum size for the year view and stores it in its internal fields */
-static void
-compute_min_size (YearView *yv)
-{
- GtkArg args[2];
- double m_width;
- double m_height;
- double max_width;
- double w;
- int i;
-
- /* Compute the minimum size of the year heading */
-
- args[0].name = "text_width";
- args[1].name = "text_height";
- gtk_object_getv (GTK_OBJECT (yv->heading), 2, args);
-
- m_width = GTK_VALUE_DOUBLE (args[0]);
- m_height = 2 * HEAD_SPACING + GTK_VALUE_DOUBLE (args[1]);
-
- /* Add height of month titles and their spacings */
-
- args[0].name = "text_height";
- gtk_object_getv (GTK_OBJECT (yv->titles[0]), 1, &args[0]);
-
- m_height += 4 * (GTK_VALUE_DOUBLE (args[0]) + TITLE_SPACING);
-
- /* Add width of month titles */
-
- max_width = 0.0;
-
- for (i = 0; i < 12; i++) {
- args[0].name = "text_width";
- gtk_object_getv (GTK_OBJECT (yv->titles[i]), 1, &args[0]);
-
- w = GTK_VALUE_DOUBLE (args[0]);
- if (max_width < w)
- max_width = w;
- }
-
- max_width = 3 * max_width + 2 * SPACING;
-
- if (m_width < max_width)
- m_width = max_width;
-
- /* Add width of month items */
-
- args[0].name = "width";
- args[1].name = "height";
- gtk_object_getv (GTK_OBJECT (yv->mitems[0]), 2, args);
-
- max_width = 3 * GTK_VALUE_DOUBLE (args[0]) + 2 * SPACING;
-
- if (m_width < max_width)
- m_width = max_width;
-
- /* Add height of month items */
-
- m_height += 4 * GTK_VALUE_DOUBLE (args[1]) + 3 * SPACING;
-
- /* Finally, set the minimum width and height in the year view */
-
- yv->min_width = (int) (m_width + 0.5);
- yv->min_height = (int) (m_height + 0.5);
-}
-
-static void
-year_view_init (YearView *yv)
-{
- int i;
- char buf[100];
- struct tm tm;
-
- memset (&tm, 0, sizeof (tm));
-
- /* Heading */
-
- yv->heading = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (yv)),
- gnome_canvas_text_get_type (),
- "anchor", GTK_ANCHOR_N,
- "fontset", HEADING_FONTSET,
- "fill_color", "black",
- NULL);
-
- /* Months */
-
- for (i = 0; i < 12; i++) {
- /* Title */
-
- strftime (buf, 100, "%B", &tm);
- tm.tm_mon++;
-
- yv->titles[i] = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (yv)),
- gnome_canvas_text_get_type (),
- "text", buf,
- "anchor", GTK_ANCHOR_N,
- "fontset", TITLE_FONTSET,
- "fill_color", "black",
- NULL);
-
- /* Month item */
-
- yv->mitems[i] = gnome_month_item_new (gnome_canvas_root (GNOME_CANVAS (yv)));
- gnome_canvas_item_set (yv->mitems[i],
- "anchor", GTK_ANCHOR_NW,
- "start_on_monday", week_starts_on_monday,
- "heading_fontset", DAY_HEADING_FONTSET,
- "day_fontset", NORMAL_DAY_FONTSET,
- NULL);
- setup_month_item (yv, i);
- }
-
- /* We will need to resize the items when we paint for the first time */
-
- yv->old_marked_day = -1;
- yv->idle_id = -1;
- need_resize (yv);
-}
-
-static void
-year_view_destroy (GtkObject *object)
-{
- YearView *yv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_YEAR_VIEW (object));
-
- yv = YEAR_VIEW (object);
-
- if (yv->need_resize) {
- yv->need_resize = FALSE;
- gtk_idle_remove (yv->idle_id);
- }
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-GtkWidget *
-year_view_new (GnomeCalendar *calendar, time_t year)
-{
- YearView *yv;
-
- g_return_val_if_fail (calendar != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CALENDAR (calendar), NULL);
-
- yv = gtk_type_new (year_view_get_type ());
- yv->calendar = calendar;
-
- year_view_colors_changed (yv);
- year_view_set (yv, year);
- compute_min_size (yv);
-
- return GTK_WIDGET (yv);
-}
-
-static void
-year_view_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- YearView *yv;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_YEAR_VIEW (widget));
- g_return_if_fail (requisition != NULL);
-
- yv = YEAR_VIEW (widget);
-
- requisition->width = yv->min_width;
- requisition->height = yv->min_height;
-}
-
-static void
-year_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- YearView *yv;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_YEAR_VIEW (widget));
- g_return_if_fail (allocation != NULL);
-
- yv = YEAR_VIEW (widget);
-
- if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
- (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
-
- need_resize (yv);
-}
-
-void
-year_view_update (YearView *yv, iCalObject *object, int flags)
-{
- g_return_if_fail (yv != NULL);
- g_return_if_fail (IS_YEAR_VIEW (yv));
-
- /* If only the summary changed, we don't care */
-
- if (object && ((flags & CHANGE_SUMMARY) == flags))
- return;
-
- year_view_set (yv, time_year_begin (time_from_day (yv->year, 0, 1)));
-}
-
-/* Unmarks the old day that was marked as current and marks the current day if appropriate */
-static void
-mark_current_day (YearView *yv)
-{
- time_t t;
- struct tm tm;
- int month_index, day_index;
- GnomeCanvasItem *item;
-
- /* Unmark the old day */
-
- if (yv->old_marked_day != -1) {
- month_index = yv->old_marked_day / 42;
- day_index = yv->old_marked_day % 42;
-
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (yv->mitems[month_index]),
- GNOME_MONTH_ITEM_DAY_LABEL + day_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_DAY_FG),
- "fontset", NORMAL_DAY_FONTSET,
- NULL);
-
- yv->old_marked_day = -1;
- }
-
- /* Mark the new day */
-
- t = time (NULL);
- tm = *localtime (&t);
-
- if ((tm.tm_year + 1900) == yv->year) {
- month_index = tm.tm_mon;
- day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (yv->mitems[month_index]), tm.tm_mday);
- g_assert (day_index != -1);
-
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (yv->mitems[month_index]),
- GNOME_MONTH_ITEM_DAY_LABEL + day_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_CURRENT_DAY_FG),
- "fontset", CURRENT_DAY_FONTSET,
- NULL);
-
- yv->old_marked_day = month_index * 42 + day_index;
- }
-}
-
-void
-year_view_set (YearView *yv, time_t year)
-{
- struct tm tm;
- char buf[100];
- int i;
-
- g_return_if_fail (yv != NULL);
- g_return_if_fail (IS_YEAR_VIEW (yv));
-
- tm = *localtime (&year);
- yv->year = tm.tm_year + 1900;
-
- /* Heading */
-
- sprintf (buf, "%d", yv->year);
- gnome_canvas_item_set (yv->heading,
- "text", buf,
- NULL);
-
- /* Months */
-
- for (i = 0; i < 12; i++)
- gnome_canvas_item_set (yv->mitems[i],
- "year", yv->year,
- "month", i,
- NULL);
-
- /* Unmark and re-mark all the months */
-
- for (i = 0; i < 12; i++) {
- unmark_month_item (GNOME_MONTH_ITEM (yv->mitems[i]));
- mark_month_item (GNOME_MONTH_ITEM (yv->mitems[i]), yv->calendar->cal);
- }
-
- mark_current_day (yv);
-}
-
-void
-year_view_time_format_changed (YearView *yv)
-{
- int i;
-
- g_return_if_fail (yv != NULL);
- g_return_if_fail (IS_YEAR_VIEW (yv));
-
- for (i = 0; i < 12; i++)
- gnome_canvas_item_set (yv->mitems[i],
- "start_on_monday", week_starts_on_monday,
- NULL);
-
- year_view_set (yv, time_year_begin (time_from_day (yv->year, 0, 1)));
-}
-
-void
-year_view_colors_changed (YearView *yv)
-{
- int i;
-
- g_return_if_fail (yv != NULL);
- g_return_if_fail (IS_YEAR_VIEW (yv));
-
- for (i = 0; i < 12; i++) {
- colorify_month_item (GNOME_MONTH_ITEM (yv->mitems[i]), default_color_func, NULL);
- mark_month_item (GNOME_MONTH_ITEM (yv->mitems[i]), yv->calendar->cal);
- }
-
- mark_current_day (yv);
-}
diff --git a/calendar/gui/year-view.h b/calendar/gui/year-view.h
deleted file mode 100644
index 77e63366d5..0000000000
--- a/calendar/gui/year-view.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Year view display for Gnomecal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Arturo Espinosa <arturo@nuclecu.unam.mx>
- * Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef YEAR_VIEW_H
-#define YEAR_VIEW_H
-
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-#include "gnome-month-item.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define TYPE_YEAR_VIEW (year_view_get_type ())
-#define YEAR_VIEW(obj) (GTK_CHECK_CAST ((obj), TYPE_YEAR_VIEW, YearView))
-#define YEAR_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_YEAR_VIEW, YearViewClass))
-#define IS_YEAR_VIEW(obj) (GTK_CHECK_TYPE ((obj), TYPE_YEAR_VIEW))
-#define IS_YEAR_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_YEAR_VIEW))
-
-
-typedef struct _YearView YearView;
-typedef struct _YearViewClass YearViewClass;
-
-struct _YearView {
- GnomeCanvas canvas;
-
- GnomeCalendar *calendar; /* The calendar we are associated to */
-
- int year; /* The year we are displaying */
-
- GnomeCanvasItem *heading; /* Big heading with year */
- GnomeCanvasItem *titles[12]; /* Titles for months */
- GnomeCanvasItem *mitems[12]; /* Month items */
-
- int old_marked_day; /* The day that is marked as the current day */
-
- int min_width; /* Minimum dimensions of year view, used for size_request*/
- int min_height;
-
- guint idle_id; /* ID of idle handler for resize */
-
- int need_resize : 1; /* Specifies whether we need to resize the canvas items or not */
-};
-
-struct _YearViewClass {
- GnomeCanvasClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType year_view_get_type (void);
-
-/* Creates a new year view widget associated to the specified calendar */
-GtkWidget *year_view_new (GnomeCalendar *calendar, time_t year);
-
-/* Notifies the year view that a calendar object has changed */
-void year_view_update (YearView *yv, iCalObject *ico, int flags);
-
-/* Notifies the year view about a change of date */
-void year_view_set (YearView *yv, time_t year);
-
-/* Notifies the year view that the time format has changed */
-void year_view_time_format_changed (YearView *yv);
-
-/* Notifies the year view that colors have changed */
-void year_view_colors_changed (YearView *yv);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/html-month.c b/calendar/html-month.c
deleted file mode 100644
index 9d4af13c33..0000000000
--- a/calendar/html-month.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Creates an HTML rendering for this month
- * Copyright (C) 1999 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@kernel.org)
- */
-#include <config.h>
-#include <gnome.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <ctype.h>
-#include "calendar.h"
-#include "alarm.h"
-#include "eventedit.h"
-#include "gnome-cal.h"
-#include "main.h"
-#include "timeutil.h"
-
-static void
-make_html_header (GnomeCalendar *gcal, GString *s)
-{
- g_string_sprintf (s,
- "<html>\n"
- " <head>\n"
- " <title>%s</title>\n"
- " </head>\n"
- " <body>\n",
- gcal->cal->title);
-}
-
-static void
-make_html_footer (GString *s)
-{
- g_string_sprintf (s, "</html>");
-}
-
-static void
-make_days_headers (GString *s)
-{
- g_string_append (s,
- "<p><table border=1>\n"
- "<tr>\n"
- " <td></td>\n"
- " <td>MONDAY</td>\n"
- " <td>TUESDAY</td>\n"
- " <td>WEDNESDAY</td>\n"
- " <td>THURSDAY</td>\n"
- " <td>FRIDAY</td>\n"
- "</tr>\n");
-}
-
-static void
-make_days (GnomeCalendar *gcal, GString *s)
-{
- struct tm tm, month;
- time_t month_start;
- int day;
- time_t now = time (NULL);
-
- make_days_headers (s);
- tm = *localtime (&now);
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_mday = 1;
- month_start = mktime (&tm);
- month = *localtime (&month_start);
-
- for (day = 0; day < month.tm_mday; day++){
-
- }
-#if 0
- day = 0;
- for (y = 0; y < 5; y++){
- for (x = 0; x < 7; x++){
- if (month.tm_mday < day
- }
- }
-#endif
-}
-
-void
-make_month_html (GnomeCalendar *gcal, char *output)
-{
- FILE *f;
- GString *s;
-
- g_return_if_fail (gcal != NULL);
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- f = fopen (output, "w");
- if (!f){
- g_warning ("Add nice error message here");
- return;
- }
-
- s = g_string_new ("");
-
- make_html_header (gcal, s);
- make_days (gcal, s);
- make_html_footer (s);
-
- fwrite (s->str, strlen (s->str), 1, f);
-
- g_string_free (s, TRUE);
- fclose (f);
-}
diff --git a/calendar/icalendar-types b/calendar/icalendar-types
deleted file mode 100644
index e11f4c1789..0000000000
--- a/calendar/icalendar-types
+++ /dev/null
@@ -1,39 +0,0 @@
-evento todo journal fbrequest fbreply busytime timezone
- attach attach attach
- attendee attendee attendee attendee attendee attendee
- categories categories categories
- class class class
- comment comment comment comment comment comment comment
- completed
- contact contact contact
- created created created created
- description description description
- dtstamp dtstamp
- dtend/duration due->dtend dtend [duration] dtend dtend
- dtstart dtstart dtstart dtstart dtstart dtstart dtstart
- exdate exdate exdate
- exrule exrule exrule
- geo geo
- last-mod last-mod last-mod last-mod last-mod
- location location
- organizer organizer organizer
- percent
- priority priority
- rstatus rstatus rstatus rstatus
- related related related
- resources resources
- rdate rdate rdate [rdate/rrule]
- rrule rrule rrule
- dtstamp dtstamp dtstamp dtstamp
- seq seq seq seq seq
- status status
- summary summary summary
- transp
- uid uid uid uid uid
- url url url url url
- recurid recurid recurid
- freebusy freebusy
- tzname
- tzoffset-to
- tzoffset-from
-
diff --git a/calendar/layout.c b/calendar/layout.c
deleted file mode 100644
index 1367ae3f8f..0000000000
--- a/calendar/layout.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* Event layout engine for Gnomecal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Miguel de Icaza <miguel@nuclecu.unam.mx>
- * Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include "layout.h"
-
-
-/* This structure is used to pass around layout information among the internal layout functions */
-struct layout_info {
- GList *events; /* List of events from client */
- int num_events; /* The number of events (length of the list) */
- LayoutQueryTimeFunc func; /* Function to convert a list item to a start/end time pair */
- int num_rows; /* Size of the time partition */
- time_t *partition; /* The time partition containing start and end time values */
- int *array; /* Working array of free and allocated time slots */
- int *allocations; /* Returned array of slot allocations */
- int *slots; /* Returned array of slots used */
- int num_slots; /* Number of slots used */
-};
-
-
-/* This defines the maximum number of events to overlap per row. More than that number of events
- * will not be displayed. This is not ideal, so sue me.
- */
-#define MAX_EVENTS_PER_ROW 32
-
-
-/* Compares two time_t values, used for qsort() */
-static int
-compare_time_t (const void *a, const void *b)
-{
- time_t ta, tb;
-
- ta = *((time_t *) a);
- tb = *((time_t *) b);
-
- if (ta < tb)
- return -1;
- else if (ta > tb)
- return 1;
- else
- return 0;
-}
-
-/* Builds a partition of the time range occupied by the events in the list. It returns an array
- * with the times that define the partition and the number of items in the partition.
- */
-static void
-build_partition (struct layout_info *li)
-{
- time_t *rows, *p, *q;
- GList *list;
- int i, unique_vals;
-
- /* This is the maximum number of rows we would need */
-
- li->num_rows = li->num_events * 2;
-
- /* Fill the rows with the times */
-
- rows = g_new (time_t, li->num_rows);
-
- for (list = li->events, p = rows; list; list = list->next) {
- (* li->func) (list, &p[0], &p[1]);
- p += 2;
- }
-
- /* Do a sort | uniq on the array */
-
- qsort (rows, li->num_rows, sizeof (time_t), compare_time_t);
-
- p = rows;
- q = rows + 1;
- unique_vals = 1;
-
- for (i = 1; i < li->num_rows; i++, q++)
- if (*q != *p) {
- unique_vals++;
- p++;
- *p = *q;
- }
-
- /* Return the number of unique values in the partition and the partition array itself */
-
- li->num_rows = unique_vals;
- li->partition = rows;
-}
-
-/* Returns the index of the element in the partition that corresponds to the specified time */
-int
-find_index (struct layout_info *li, time_t t)
-{
- int i;
-
- for (i = 0; ; i++)
- if (li->partition[i] == t)
- return i;
-
- g_assert_not_reached ();
-}
-
-#define xy(li, x, y) li->array[(y * MAX_EVENTS_PER_ROW) + (x)]
-
-/* Checks that all the cells in the slot array at the specified slot column are free to use by an
- * event that has the specified range.
- */
-static int
-range_is_empty (struct layout_info *li, int slot, time_t start, time_t end)
-{
- int i;
-
- for (i = find_index (li, start); li->partition[i] < end; i++)
- if (xy (li, slot, i) != -1)
- return FALSE;
-
- return TRUE;
-}
-
-/* Allocates a time in the slot array for the specified event's index */
-static void
-range_allocate (struct layout_info *li, int slot, time_t start, time_t end, int ev_num)
-{
- int i;
-
- for (i = find_index (li, start); li->partition[i] < end; i++)
- xy (li, slot, i) = ev_num;
-}
-
-/* Performs the initial allocation of slots for events. Each event gets one column; they will be
- * expanded in a later stage. Returns the number of columns used.
- */
-static void
-initial_allocate (struct layout_info *li)
-{
- GList *events;
- int i;
- int slot;
- int num_slots;
- time_t start, end;
-
- num_slots = 0;
-
- for (i = 0, events = li->events; events; events = events->next, i++) {
- (* li->func) (events, &start, &end);
-
- /* Start with no allocation, no columns */
-
- li->allocations[i] = -1;
- li->slots[i] = 0;
-
- /* Find a free column for the event */
-
- for (slot = 0; slot < MAX_EVENTS_PER_ROW; slot++)
- if (range_is_empty (li, slot, start, end)) {
- range_allocate (li, slot, start, end, i);
-
- li->allocations[i] = slot;
- li->slots[i] = 1;
-
- if ((slot + 1) > num_slots)
- num_slots = slot + 1;
-
- break;
- }
- }
-
- li->num_slots = num_slots;
-}
-
-/* Returns the maximum number of columns that an event can expanded by in the slot array */
-static int
-columns_to_expand (struct layout_info *li, int ev_num, time_t start, time_t end)
-{
- int cols;
- int slot;
- int i_start;
- int i;
-
- cols = 0;
-
- i_start = find_index (li, start);
-
- for (slot = li->allocations[ev_num] + 1; slot < li->num_slots; slot++) {
- for (i = i_start; li->partition[i] < end; i++)
- if (xy (li, slot, i) != -1)
- return cols;
-
- cols++;
- }
-
- return cols;
-}
-
-/* Expands an event by the specified number of columns */
-static void
-do_expansion (struct layout_info *li, int ev_num, time_t start, time_t end, int num_cols)
-{
- int i, j;
- int slot;
-
- for (i = find_index (li, start); li->partition[i] < end; i++) {
- slot = li->allocations[ev_num] + 1;
-
- for (j = 0; j < num_cols; j++)
- xy (li, slot + j, i) = ev_num;
- }
-}
-
-/* Expands the events in the slot array to occupy as many columns as possible. This is the second
- * pass of the layout algorithm.
- */
-static void
-expand_events (struct layout_info *li)
-{
- GList *events;
- time_t start, end;
- int i;
- int cols;
-
- for (i = 0, events = li->events; events; events = events->next, i++) {
- (* li->func) (events, &start, &end);
-
- cols = columns_to_expand (li, i, start, end);
-
- if (cols == 0)
- continue; /* We can't expand this event */
-
- do_expansion (li, i, start, end, cols);
-
- li->slots[i] += cols;
- }
-}
-
-void
-layout_events (GList *events, LayoutQueryTimeFunc func, int *num_slots, int **allocations, int **slots)
-{
- struct layout_info li;
- int i;
-
- g_return_if_fail (num_slots != NULL);
- g_return_if_fail (allocations != NULL);
- g_return_if_fail (slots != NULL);
-
- if (!events) {
- *num_slots = 0;
- *allocations = NULL;
- *slots = NULL;
-
- return;
- }
-
- li.events = events;
- li.num_events = g_list_length (events);
- li.func = func;
-
- /* Build the partition of the time range, and then build the array of slots */
-
- build_partition (&li);
-
- li.array = g_new (int, li.num_rows * MAX_EVENTS_PER_ROW);
- for (i = 0; i < (li.num_rows * MAX_EVENTS_PER_ROW); i++)
- li.array[i] = -1; /* This is our 'empty' value */
-
- /* Build the arrays for allocations and columns used */
-
- li.allocations = g_new (int, li.num_events);
- li.slots = g_new (int, li.num_events);
-
- /* Perform initial allocation and then expand the events to as many slots as they can occupy */
-
- initial_allocate (&li);
- expand_events (&li);
-
- /* Clean up and return values */
-
- g_free (li.array);
-
- *num_slots = li.num_slots;
- *allocations = li.allocations;
- *slots = li.slots;
-}
diff --git a/calendar/layout.h b/calendar/layout.h
deleted file mode 100644
index 734b720b8b..0000000000
--- a/calendar/layout.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Event layout engine for Gnomecal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Miguel de Icaza <miguel@nuclecu.unam.mx>
- * Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef LAYOUT_H
-#define LAYOUT_H
-
-#include <glib.h>
-#include <time.h>
-
-
-/* Functions of this type must translate the list item into two time_t values for the start and end
- * of an event.
- */
-typedef void (* LayoutQueryTimeFunc) (GList *event, time_t *start, time_t *end);
-
-
-/* This is the main layout function for overlapping events. You pass in a list of (presumably)
- * events and a function that should take a list element and return the start and end times for the
- * event corresponding to that list element.
- *
- * It returns the number of slots ("columns") that you need to take into account when actually
- * painting the events, the array of the first slot index that each event occupies, and the array of
- * number of slots that each event occupies. You have to free both arrays.
- *
- * You will get somewhat better-looking results if the list of events is sorted by using the start
- * time as the primary sort key and the end time as the secondary sort key -- so that "longer"
- * events go first in the list.
- */
-void layout_events (GList *events, LayoutQueryTimeFunc func, int *num_slots, int **allocations, int **slots);
-
-
-#endif
diff --git a/calendar/main.c b/calendar/main.c
deleted file mode 100644
index 98157d101d..0000000000
--- a/calendar/main.c
+++ /dev/null
@@ -1,1059 +0,0 @@
-/*
- * Main file for the GNOME Calendar program
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@kernel.org)
- * Federico Mena (federico@nuclecu.unam.mx)
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <libgnorba/gnorba.h>
-#include <pwd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include "calendar.h"
-#include "alarm.h"
-#include "eventedit.h"
-#include "gnome-cal.h"
-#include "main.h"
-#include "timeutil.h"
-#include "corba-cal-factory.h"
-
-#define COOKIE_USER_HOME_DIR ((char *) -1)
-
-
-/* The username, used to set the `owner' field of the event */
-char *user_name;
-
-/* The full user name from the Gecos field */
-char *full_name;
-
-/* The user's default calendar file */
-char *user_calendar_file;
-
-/* a gnome-config string prefix that can be used to access the calendar config info */
-char *calendar_settings;
-
-/* Day begin, day end parameters */
-int day_begin, day_end;
-
-/* Whether weeks starts on Sunday or Monday */
-int week_starts_on_monday;
-
-/* If true, do not show our top level window */
-int startup_hidden = 0;
-
-/* If true, enable debug output for alarms */
-int debug_alarms = 0;
-
-/* The array of color properties -- keep in sync with the enumeration defined in main.h. The color
- * values specified here are the defaults for the program.
- */
-struct color_prop color_props[] = {
- { 0x3e72, 0x35ec, 0x8ba2, N_("Outline:"), "/calendar/Colors/outline" },
- { 0xffff, 0xffff, 0xffff, N_("Headings:"), "/calendar/Colors/headings" },
- { 0xf26c, 0xecec, 0xbbe7, N_("Empty days:"), "/calendar/Colors/empty_bg" },
- { 0xfc1e, 0xf87f, 0x5f80, N_("Appointments:"), "/calendar/Colors/mark_bg" },
- { 0xd364, 0xc6b7, 0x7969, N_("Highlighted day:"), "/calendar/Colors/prelight_bg" },
- { 0x01f0, 0x01f0, 0x01f0, N_("Day numbers:"), "/calendar/Colors/day_fg" },
- { 0x0000, 0x0000, 0xffff, N_("Current day's number:"), "/calendar/Colors/current_fg" },
- { 0xbbbb, 0xbbbb, 0x0000, N_("To-Do item that is not yet due:"), "/calendar/Colors/todo_not_yet" },
- { 0xdddd, 0xbbbb, 0x0000, N_("To-Do item that is due today:"), "/calendar/Colors/todo_today" },
- { 0xbbbb, 0xdddd, 0x0000, N_("To-Do item that is overdue:"), "/calendar/Colors/todo_overdue" }
-};
-
-/* Number of active calendars */
-int active_calendars = 0;
-
-/* A list of all of the calendars started */
-GList *all_calendars = NULL;
-
-/* For dumping part of a calendar */
-static time_t from_t, to_t;
-
-/* File to load instead of the user default's file */
-static char *load_file;
-
-/* If set, show events for the specified date and quit */
-static int show_events;
-
-/* If set, show todo items quit */
-static int show_todo;
-
-/* If set, beep on display alarms */
-gboolean beep_on_display = 0;
-
-/* If true, timeout the beeper on audio alarms */
-
-gboolean enable_aalarm_timeout = 0;
-guint audio_alarm_timeout = 0;
-const guint MAX_AALARM_TIMEOUT = 3600;
-const guint MAX_SNOOZE_SECS = 3600;
-gboolean enable_snooze = 0;
-guint snooze_secs = 60;
-
-/* Default values for alarms */
-CalendarAlarm alarm_defaults[4] = {
- { ALARM_MAIL, 0, 15, ALARM_MINUTES },
- { ALARM_PROGRAM, 0, 15, ALARM_MINUTES },
- { ALARM_DISPLAY, 0, 15, ALARM_MINUTES },
- { ALARM_AUDIO, 0, 15, ALARM_MINUTES }
-};
-
-static void
-init_username (void)
-{
- user_name = g_strdup(g_get_user_name());
- full_name = g_strdup(g_get_real_name());
-}
-
-static int
-range_check_hour (int hour)
-{
- if (hour < 0)
- hour = 0;
- else if (hour >= 24)
- hour = 23;
-
- return hour;
-}
-
-static void
-init_default_alarms (void)
-{
- int i;
- gboolean def;
-
- alarm_defaults [ALARM_DISPLAY].type = ALARM_DISPLAY;
- alarm_defaults [ALARM_AUDIO].type = ALARM_AUDIO;
- alarm_defaults [ALARM_PROGRAM].type = ALARM_PROGRAM;
- alarm_defaults [ALARM_MAIL].type = ALARM_MAIL;
-
- for (i = 0; i < 4; i++) {
- switch (alarm_defaults [i].type) {
- case ALARM_DISPLAY:
- gnome_config_push_prefix ("/calendar/alarms/def_disp_");
- break;
- case ALARM_AUDIO:
- gnome_config_push_prefix ("/calendar/alarms/def_audio_");
- break;
- case ALARM_PROGRAM:
- gnome_config_push_prefix ("/calendar/alarms/def_prog_");
- break;
- case ALARM_MAIL:
- gnome_config_push_prefix ("/calendar/alarms/def_mail_");
- break;
- }
-
- alarm_defaults[i].enabled = gnome_config_get_int ("enabled=0");
- if (alarm_defaults[i].type != ALARM_MAIL) {
- alarm_defaults[i].count = gnome_config_get_int ("count=15");
- alarm_defaults[i].units = gnome_config_get_int ("units=0");
- } else {
- alarm_defaults[i].count = gnome_config_get_int ("count=1");
- alarm_defaults[i].count = gnome_config_get_int ("count=2");
- }
-
- alarm_defaults[i].data = gnome_config_get_string_with_default ("data=",
- &def);
- if (def)
- alarm_defaults[i].data = NULL;
-
- gnome_config_pop_prefix ();
- }
-}
-
-
-/*
- * Initializes the calendar internal variables, loads defaults
- */
-static void
-init_calendar (void)
-{
- int i;
- char *cspec, *color;
- char *str;
-
- init_username ();
- user_calendar_file = g_concat_dir_and_file (gnome_util_user_home (), ".gnome/user-cal.vcf");
-
- gnome_config_push_prefix (calendar_settings);
-
- /* Read calendar settings */
-
- day_begin = range_check_hour (gnome_config_get_int ("/calendar/Calendar/Day start=8"));
- day_end = range_check_hour (gnome_config_get_int ("/calendar/Calendar/Day end=17"));
- am_pm_flag = gnome_config_get_bool ("/calendar/Calendar/AM PM flag=0");
- week_starts_on_monday = gnome_config_get_bool ("/calendar/Calendar/Week starts on Monday=0");
-
- if (day_end < day_begin){
- day_begin = 8;
- day_end = 17;
- }
-
- /* Read color settings */
-
- for (i = 0; i < COLOR_PROP_LAST; i++) {
- cspec = build_color_spec (color_props[i].r, color_props[i].g, color_props[i].b);
- str = g_strconcat (color_props[i].key, "=", cspec, NULL);
-
- color = gnome_config_get_string (str);
- parse_color_spec (color, &color_props[i].r, &color_props[i].g, &color_props[i].b);
-
- g_free (str);
- g_free (color);
- }
-
- /* read todolist settings */
-
- todo_show_time_remaining = gnome_config_get_bool("/calendar/Todo/show_time_remain");
- todo_show_due_date = gnome_config_get_bool("/calendar/Todo/show_due_date");
-
- todo_item_dstatus_highlight_overdue = gnome_config_get_bool("/calendar/Todo/highlight_overdue");
-
- todo_item_dstatus_highlight_due_today = gnome_config_get_bool("/calendar/Todo/highlight_due_today");
-
- todo_item_dstatus_highlight_not_due_yet = gnome_config_get_bool("/calendar/Todo/highlight_not_due_yet");
-
- todo_current_sort_column = gnome_config_get_int("/calendar/Todo/sort_column");
-
- todo_current_sort_type = gnome_config_get_int("/calendar/Todo/sort_type");
-
- todo_show_priority = gnome_config_get_bool("/calendar/Todo/show_priority");
-
- /* read alarm settings */
- beep_on_display = gnome_config_get_bool ("/calendar/alarms/beep_on_display=FALSE");
- enable_aalarm_timeout = gnome_config_get_bool ("/calendar/alarms/enable_audio_timeout=FALSE");
- audio_alarm_timeout = gnome_config_get_int ("/calendar/alarms/audio_alarm_timeout=60");
- if (audio_alarm_timeout < 1)
- audio_alarm_timeout = 1;
- if (audio_alarm_timeout > MAX_AALARM_TIMEOUT)
- audio_alarm_timeout = MAX_AALARM_TIMEOUT;
- enable_snooze = gnome_config_get_bool ("/calendar/alarms/enable_snooze=FALSE");
- snooze_secs = gnome_config_get_int ("/calendar/alarms/snooze_secs=300");
- if (snooze_secs < 1)
- snooze_secs = 1;
- if (snooze_secs > MAX_SNOOZE_SECS)
- snooze_secs = MAX_SNOOZE_SECS;
-
- init_default_alarms ();
-
-
- /* Done */
-
- gnome_config_pop_prefix ();
-}
-
-
-
-static void save_calendar_cmd (GtkWidget *widget, void *data);
-
-static void
-about_calendar_cmd (GtkWidget *widget, void *data)
-{
- GtkWidget *about;
- const gchar *authors[] = {
- "Miguel de Icaza (miguel@kernel.org)",
- "Federico Mena (federico@gimp.org)",
- "Arturo Espinosa (arturo@nuclecu.unam.mx)",
- "Russell Steinthal (rms39@columbia.edu)",
- NULL
- };
-
- about = gnome_about_new (_("Gnome Calendar"), VERSION,
- "(C) 1998 the Free Software Foundation",
- authors,
- _("The GNOME personal calendar and schedule manager."),
- NULL);
- gtk_window_set_modal (GTK_WINDOW (about), TRUE);
- gnome_dialog_set_close (GNOME_DIALOG (about), TRUE);
- gtk_widget_show (about);
-}
-
-static void
-display_objedit (GtkWidget *widget, GnomeCalendar *gcal)
-{
- GtkWidget *ee;
- iCalObject *ico;
-
- /* Default to the day the user is looking at */
- ico = ical_new ("", user_name, "");
- ico->new = 1;
- ico->dtstart = time_add_minutes (gcal->current_display, day_begin * 60);
- ico->dtend = time_add_minutes (ico->dtstart, day_begin * 60 + 30 );
-
- ee = event_editor_new (gcal, ico);
- gtk_widget_show (ee);
-}
-
-static void
-display_objedit_today (GtkWidget *widget, GnomeCalendar *gcal)
-{
- GtkWidget *ee;
-
- ee = event_editor_new (gcal, NULL);
- gtk_widget_show (ee);
-}
-
-GnomeCalendar *
-gnome_calendar_locate (const char *pathname)
-{
- GList *l;
-
- if (pathname == NULL || pathname [0] == 0)
- pathname = user_calendar_file;
-
- for (l = all_calendars; l; l = l->next){
- GnomeCalendar *gcal = l->data;
-
- if (strcmp (gcal->cal->filename, pathname) == 0){
- return gcal;
- }
- }
- return NULL;
-}
-
-static void
-close_cmd (GtkWidget *widget, GnomeCalendar *gcal)
-{
- all_calendars = g_list_remove (all_calendars, gcal);
-
- if (gcal->cal->modified){
- if (!gcal->cal->filename)
- save_calendar_cmd (widget, gcal);
- else
- calendar_save (gcal->cal, gcal->cal->filename);
- }
-
- gtk_widget_destroy (GTK_WIDGET (gcal));
- active_calendars--;
-
- if (active_calendars == 0){
- unregister_calendar_services ();
- gtk_main_quit ();
- }
-}
-
-void
-time_format_changed (void)
-{
- GList *l;
-
- for (l = all_calendars; l; l = l->next)
- gnome_calendar_time_format_changed (GNOME_CALENDAR (l->data));
-}
-
-void
-colors_changed (void)
-{
- GList *l;
-
- for (l = all_calendars; l; l = l->next)
- gnome_calendar_colors_changed (GNOME_CALENDAR (l->data));
-}
-
-void
-todo_properties_changed(void)
-{
- GList *l;
-
- for (l = all_calendars; l; l = l->next)
- gnome_calendar_todo_properties_changed (GNOME_CALENDAR (l->data));
-}
-
-
-
-static void
-quit_cmd (void)
-{
- while (all_calendars){
- GnomeCalendar *cal = GNOME_CALENDAR (all_calendars->data);
-
- close_cmd (GTK_WIDGET (cal), cal);
- }
-}
-
-/* Sets a clock cursor for the specified calendar window */
-static void
-set_clock_cursor (GnomeCalendar *gcal)
-{
- GdkCursor *cursor;
-
- cursor = gdk_cursor_new (GDK_WATCH);
- gdk_window_set_cursor (GTK_WIDGET (gcal)->window, cursor);
- gdk_cursor_destroy (cursor);
- gdk_flush ();
-}
-
-/* Resets the normal cursor for the specified calendar window */
-static void
-set_normal_cursor (GnomeCalendar *gcal)
-{
- gdk_window_set_cursor (GTK_WIDGET (gcal)->window, NULL);
- gdk_flush ();
-}
-
-static void
-previous_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- set_clock_cursor (gcal);
- gnome_calendar_previous (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-next_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- set_clock_cursor (gcal);
- gnome_calendar_next (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-today_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- set_clock_cursor (gcal);
- gnome_calendar_goto_today (gcal);
- set_normal_cursor (gcal);
-}
-
-static void
-goto_clicked (GtkWidget *widget, GnomeCalendar *gcal)
-{
- goto_dialog (gcal);
-}
-
-static void
-new_calendar_cmd (GtkWidget *widget, void *data)
-{
- new_calendar (full_name, NULL, NULL, NULL, FALSE);
-}
-
-static void
-open_ok (GtkWidget *widget, GtkFileSelection *fs)
-{
- GtkWidget *error_dialog;
- int ret;
- if(!g_file_exists (gtk_file_selection_get_filename (fs))) {
- error_dialog = gnome_message_box_new (
- _("File not found"),
- GNOME_MESSAGE_BOX_ERROR,
- GNOME_STOCK_BUTTON_OK,
- NULL);
-
- gnome_dialog_set_parent (GNOME_DIALOG (error_dialog), GTK_WINDOW (fs));
- ret = gnome_dialog_run (GNOME_DIALOG (error_dialog));
- } else {
- /* FIXME: find out who owns this calendar and use that name */
- new_calendar ("Somebody", gtk_file_selection_get_filename (fs), NULL, NULL, FALSE);
- gtk_widget_destroy (GTK_WIDGET (fs));
- }
-}
-
-static void
-open_calendar_cmd (GtkWidget *widget, void *data)
-{
- GtkFileSelection *fs;
-
- fs = GTK_FILE_SELECTION (gtk_file_selection_new (_("Open calendar")));
-
- gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
- (GtkSignalFunc) open_ok,
- fs);
- gtk_signal_connect_object (GTK_OBJECT (fs->cancel_button), "clicked",
- (GtkSignalFunc) gtk_widget_destroy,
- GTK_OBJECT (fs));
-
- gtk_widget_show (GTK_WIDGET (fs));
- gtk_grab_add (GTK_WIDGET (fs)); /* Yes, it is modal, so sue me */
-}
-
-static void
-save_ok (GtkWidget *widget, GtkFileSelection *fs)
-{
- GnomeCalendar *gcal;
- gchar *fname;
-
- gcal = GNOME_CALENDAR (gtk_object_get_user_data (GTK_OBJECT (fs)));
- gtk_window_set_wmclass (GTK_WINDOW (gcal), "gnomecal", "gnomecal");
-
- fname = g_strdup (gtk_file_selection_get_filename (fs));
- calendar_save (gcal->cal, fname);
- g_free(fname);
- gtk_main_quit ();
-}
-
-static gint
-close_save (GtkWidget *w)
-{
- gtk_main_quit ();
- return TRUE;
-}
-
-static void
-save_as_calendar_cmd (GtkWidget *widget, void *data)
-{
- GtkFileSelection *fs;
-
- fs = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save calendar")));
- gtk_object_set_user_data (GTK_OBJECT (fs), data);
-
- gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
- (GtkSignalFunc) save_ok,
- fs);
- gtk_signal_connect_object (GTK_OBJECT (fs->cancel_button), "clicked",
- (GtkSignalFunc) close_save,
- GTK_OBJECT (fs));
- gtk_signal_connect_object (GTK_OBJECT (fs), "delete_event",
- GTK_SIGNAL_FUNC (close_save),
- GTK_OBJECT (fs));
- gtk_widget_show (GTK_WIDGET (fs));
- gtk_grab_add (GTK_WIDGET (fs)); /* Yes, it is modal, so sue me even more */
- gtk_main ();
- gtk_widget_destroy (GTK_WIDGET (fs));
-}
-
-static void
-properties_cmd (GtkWidget *widget, GtkWidget *gcal)
-{
- properties (gcal);
-}
-
-static void
-save_calendar_cmd (GtkWidget *widget, void *data)
-{
- GnomeCalendar *gcal = data;
-
- if (gcal->cal->filename){
- struct stat s;
-
- if (stat (gcal->cal->filename, &s) == -1){
- if (errno == ENOENT)
- calendar_save (gcal->cal, gcal->cal->filename);
-
- return;
- }
-
- if (s.st_mtime != gcal->cal->file_time){
- GtkWidget *box;
- char *str;
- int b;
-
- str = g_strdup_printf (
- _("File %s has changed since it was loaded\nContinue?"),
- gcal->cal->filename);
- box = gnome_message_box_new (str, GNOME_MESSAGE_BOX_INFO,
- GNOME_STOCK_BUTTON_YES,
- GNOME_STOCK_BUTTON_NO,
- NULL);
- g_free (str);
- gnome_dialog_set_default (GNOME_DIALOG (box), 1);
- b = gnome_dialog_run (GNOME_DIALOG (box));
-
- if (b != 0)
- return;
- }
-
- calendar_save (gcal->cal, gcal->cal->filename);
- } else
- save_as_calendar_cmd (widget, data);
-}
-
-/*
- * Saves @gcal if it is the default calendar
- */
-void
-save_default_calendar (GnomeCalendar *gcal)
-{
- if (!gcal->cal->filename)
- return;
-
- save_calendar_cmd (NULL, gcal);
-}
-
-#if 0
-static void
-make_html_cmd (GtkWidget *widget, GtkWidget *gcal)
-{
- make_month_html (gcal, "output.html");
-}
-#endif
-
-static GnomeUIInfo gnome_cal_file_menu [] = {
- GNOMEUIINFO_MENU_NEW_ITEM(N_("_New calendar"),
- N_("Create a new calendar"),
- new_calendar_cmd, NULL),
-
- GNOMEUIINFO_MENU_OPEN_ITEM(open_calendar_cmd, NULL),
-
- GNOMEUIINFO_MENU_SAVE_ITEM(save_calendar_cmd, NULL),
-
- GNOMEUIINFO_MENU_SAVE_AS_ITEM(save_as_calendar_cmd, NULL),
-
- GNOMEUIINFO_SEPARATOR,
-
-#if 0
- GNOMEUIINFO_ITEM(N_("Create HTML for this month"),
- N_("Creates an HTML version of this month's appointments"),
- make_html_cmd, NULL);
-#endif
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_MENU_CLOSE_ITEM(close_cmd, NULL),
-
- GNOMEUIINFO_MENU_EXIT_ITEM(quit_cmd, NULL),
-
- GNOMEUIINFO_END
-};
-
-static GnomeUIInfo gnome_cal_edit_menu [] = {
- { GNOME_APP_UI_ITEM, N_("_New appointment..."),
- N_("Create a new appointment"), display_objedit, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_NEW, 0, 0, NULL },
- { GNOME_APP_UI_ITEM, N_("New appointment for _today..."),
- N_("Create a new appointment for today"),
- display_objedit_today, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_NEW, 0, 0, NULL },
- GNOMEUIINFO_END
-};
-
-static GnomeUIInfo gnome_cal_help_menu [] = {
- GNOMEUIINFO_HELP ("gnomecal"),
-
- GNOMEUIINFO_MENU_ABOUT_ITEM(about_calendar_cmd, NULL),
-
- GNOMEUIINFO_END
-};
-
-static GnomeUIInfo gnome_cal_settings_menu [] = {
- GNOMEUIINFO_MENU_PREFERENCES_ITEM(properties_cmd, NULL),
-
- GNOMEUIINFO_END
-};
-
-static GnomeUIInfo gnome_cal_menu [] = {
- GNOMEUIINFO_MENU_FILE_TREE(gnome_cal_file_menu),
- GNOMEUIINFO_MENU_EDIT_TREE(gnome_cal_edit_menu),
- GNOMEUIINFO_MENU_SETTINGS_TREE(gnome_cal_settings_menu),
- GNOMEUIINFO_MENU_HELP_TREE(gnome_cal_help_menu),
- GNOMEUIINFO_END
-};
-
-static GnomeUIInfo gnome_toolbar [] = {
- GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new appointment"), display_objedit, GNOME_STOCK_PIXMAP_NEW),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Prev"), N_("Go back in time"), previous_clicked, GNOME_STOCK_PIXMAP_BACK),
- GNOMEUIINFO_ITEM_STOCK (N_("Today"), N_("Go to present time"), today_clicked, GNOME_STOCK_PIXMAP_HOME),
- GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Go forward in time"), next_clicked, GNOME_STOCK_PIXMAP_FORWARD),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Go to"), N_("Go to a specific date"), goto_clicked, GNOME_STOCK_PIXMAP_JUMP_TO),
-
- GNOMEUIINFO_END
-};
-
-static void
-setup_menu (GtkWidget *gcal)
-{
- gnome_app_create_menus_with_data (GNOME_APP (gcal), gnome_cal_menu, gcal);
- gnome_app_create_toolbar_with_data (GNOME_APP (gcal), gnome_toolbar, gcal);
- gnome_app_install_menu_hints(GNOME_APP(gcal), gnome_cal_menu);
-}
-
-static void
-setup_appbar (GtkWidget *gcal)
-{
- GtkWidget *appbar;
-
- appbar = gnome_appbar_new (FALSE, TRUE, GNOME_PREFERENCES_USER);
- gnome_app_set_statusbar (GNOME_APP (gcal), GTK_WIDGET (appbar));
-}
-
-static gint
-calendar_close_event (GtkWidget *widget, GdkEvent *event, GnomeCalendar *gcal)
-{
- close_cmd (widget, gcal);
- return TRUE;
-}
-
-GnomeCalendar *
-new_calendar (char *full_name, char *calendar_file, char *geometry, char *page, gboolean hidden)
-{
- GtkWidget *toplevel;
- char title[128];
- int xpos, ypos, width, height;
-
- /* i18n: This "%s%s" indicates possession. Languages where the order is
- * the inverse should translate it to "%2$s%1$s".
- */
- g_snprintf(title, 128, _("%s%s"), full_name, _("'s calendar"));
-
- toplevel = gnome_calendar_new (title);
-
- if (gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height)){
- if (xpos != -1)
- gtk_widget_set_uposition (toplevel, xpos, ypos);
-#if 0
- if (width != -1)
- gtk_widget_set_usize (toplevel, width, 600);
-#endif
- }
-#if 0
- gtk_widget_set_usize (toplevel, width, 600);
-#endif
-
- setup_appbar (toplevel);
- setup_menu (toplevel);
-
-
- if (page)
- gnome_calendar_set_view (GNOME_CALENDAR (toplevel), page);
-
- if (calendar_file && g_file_exists (calendar_file))
- gnome_calendar_load (GNOME_CALENDAR (toplevel), calendar_file);
- else
- GNOME_CALENDAR (toplevel)->cal->filename = g_strdup (calendar_file);
-
- gtk_signal_connect (GTK_OBJECT (toplevel), "delete_event",
- GTK_SIGNAL_FUNC(calendar_close_event), toplevel);
-
- active_calendars++;
- all_calendars = g_list_prepend (all_calendars, toplevel);
-
- if (hidden){
- GnomeWinState state;
-
- /* Realize the toplevel window to prevent a segfault */
- gtk_widget_realize (toplevel);
- state = gnome_win_hints_get_state (toplevel);
-
- state |= WIN_STATE_MINIMIZED;
- gnome_win_hints_set_state (toplevel, state);
- }
-
- gtk_widget_show (toplevel);
-
- return GNOME_CALENDAR (toplevel);
-}
-
-static void
-process_dates (void)
-{
- if (!from_t)
- from_t = time_day_begin (time (NULL));
-
- if (!to_t || to_t < from_t)
- to_t = time_add_day (from_t, 1);
-}
-
-enum {
- GEOMETRY_KEY = -1,
- USERFILE_KEY = -2,
- VIEW_KEY = -3,
- HIDDEN_KEY = -4,
- TODO_KEY = -5,
- DEBUG_KEY = -6
-};
-
-/* Lists used to startup various GnomeCalendars */
-static GList *start_calendars;
-static GList *start_geometries;
-static GList *start_views;
-
-static int
-same_day (struct tm *a, struct tm *b)
-{
- return (a->tm_mday == b->tm_mday &&
- a->tm_mon == b->tm_mon &&
- a->tm_year == b->tm_year);
-}
-
-static void
-dump_events (void)
-{
- Calendar *cal;
- GList *l;
- char *s;
- time_t now = time (NULL);
- struct tm today = *localtime (&now);
-
- process_dates ();
- init_calendar ();
-
- cal = calendar_new (full_name);
- s = calendar_load (cal, load_file ? load_file : user_calendar_file);
- if (s){
- printf ("error: %s\n", s);
- exit (1);
- }
- l = calendar_get_events_in_range (cal, from_t, to_t);
- for (; l; l = l->next){
- char start [80], end [80];
- CalendarObject *co = l->data;
- struct tm ts, te;
- char *format;
-
- ts = *localtime (&co->ev_start);
- te = *localtime (&co->ev_end);
-
- if (same_day (&today, &ts))
- format = N_("%H:%M");
- else
- format = N_("%A %b %d, %H:%M");
- strftime (start, sizeof (start), _(format), &ts);
-
- if (!same_day (&ts, &te))
- format = N_("%A %b %d, %H:%M");
- strftime (end, sizeof (start), _(format), &te);
-
- printf ("%s -- %s\n", start, end);
- printf (" %s\n", co->ico->summary);
- }
- calendar_destroy_event_list (l);
- calendar_destroy (cal);
- exit (0);
-}
-
-static void
-dump_todo (void)
-{
- Calendar *cal;
- GList *l;
- char *s;
-
- process_dates ();
- init_calendar ();
-
- cal = calendar_new (full_name);
- s = calendar_load (cal, load_file ? load_file : user_calendar_file);
- if (s){
- printf ("error: %s\n", s);
- exit (1);
- }
- for (l = cal->todo; l; l = l->next){
- iCalObject *object = l->data;
-
- if (object->type != ICAL_TODO)
- continue;
-
- printf ("[%s]: %s\n", object->organizer, object->summary);
- }
- calendar_destroy (cal);
- exit (0);
-}
-
-extern time_t get_date ();
-
-static void
-parse_an_arg (poptContext ctx,
- enum poptCallbackReason reason,
- const struct poptOption *opt,
- char *arg, void *data)
-{
- switch (opt->val){
- case 'f':
- from_t = get_date (arg, NULL);
- break;
-
- case 't':
- to_t = get_date (arg, NULL);
- break;
-
- case GEOMETRY_KEY:
- start_geometries = g_list_append (start_geometries, arg);
- break;
-
- case USERFILE_KEY:
- /* This is a special key that tells the program to load
- * the user's calendar file. This allows session management
- * to work even if the User's home directory changes location
- * (ie, on a networked setup).
- */
- arg = COOKIE_USER_HOME_DIR;
- /* fall through */
- break;
-
- case VIEW_KEY:
- start_views = g_list_append (start_views, arg);
- break;
-
- case 'F':
- start_calendars = g_list_append (start_calendars, arg);
- break;
-
- case TODO_KEY:
- show_todo = 1;
- break;
-
- case 'e':
- show_events = 1;
- break;
-
- case HIDDEN_KEY:
- startup_hidden = 1;
- break;
-
- case DEBUG_KEY:
- if (!g_strcasecmp (arg, "alarms"))
- debug_alarms = 1;
- break;
-
- default:
- }
-}
-
-static const struct poptOption options [] = {
- { NULL, '\0', POPT_ARG_CALLBACK, parse_an_arg, 0, NULL, NULL },
- { "events", 'e', POPT_ARG_NONE, NULL, 'e', N_("Show events and quit"),
- NULL },
- { "todo", 0, POPT_ARG_NONE, NULL, TODO_KEY, N_("Show TO-DO items and quit"),
- NULL },
- { "from", 'f', POPT_ARG_STRING, NULL, 'f', N_("Specifies start date [for --events]"), N_("DATE") },
- { "file", 'F', POPT_ARG_STRING, NULL, 'F', N_("File to load calendar from"), N_("FILE") },
- { "userfile", '\0', POPT_ARG_NONE, NULL, USERFILE_KEY, N_("Load the user calendar"), NULL },
- { "geometry", '\0', POPT_ARG_STRING, NULL, GEOMETRY_KEY, N_("Geometry for starting up"), N_("GEOMETRY") },
- { "view", '\0', POPT_ARG_STRING, NULL, VIEW_KEY, N_("The startup view mode (dayview, weekview, monthview, yearview)"), N_("VIEW") },
- { "to", 't', POPT_ARG_STRING, NULL, 't', N_("Specifies ending date [for --events]"), N_("DATE") },
- { "hidden", 0, POPT_ARG_NONE, NULL, HIDDEN_KEY, N_("If used, starts in iconic mode"), NULL },
- { "debug", 'd', POPT_ARG_STRING, NULL, DEBUG_KEY, N_("Enable debugging output of TYPE (alarms)"), N_("TYPE") },
- { NULL, '\0', 0, NULL, 0}
-};
-
-static void
-session_die (void)
-{
- quit_cmd ();
-}
-
-/*
- * Save the session callback
- */
-static int
-session_save_state (GnomeClient *client, gint phase, GnomeRestartStyle save_style, gint shutdown,
- GnomeInteractStyle interact_style, gint fast, gpointer client_data)
-{
- char *sess_id;
- char **argv = (char **) g_malloc (sizeof (char *) * ((active_calendars * 6) + 3));
- GList *l, *free_list = 0;
- int i;
-
- sess_id = gnome_client_get_id (client);
-
- argv [0] = client_data;
- for (i = 1, l = all_calendars; l; l = l->next){
- GnomeCalendar *gcal = GNOME_CALENDAR (l->data);
- char *geometry;
-
- geometry = gnome_geometry_string (GTK_WIDGET (gcal)->window);
-
- if (strcmp (gcal->cal->filename, user_calendar_file) == 0)
- argv [i++] = "--userfile";
- else {
- argv [i++] = "--file";
- argv [i++] = gcal->cal->filename;
- }
- argv [i++] = "--geometry";
- argv [i++] = geometry;
- argv [i++] = "--view";
- argv [i++] = gnome_calendar_get_current_view_name (gcal);
- free_list = g_list_append (free_list, geometry);
- calendar_save (gcal->cal, gcal->cal->filename);
- }
- argv [i] = NULL;
- gnome_client_set_clone_command (client, i, argv);
- gnome_client_set_restart_command (client, i, argv);
-
- for (l = free_list; l; l = l->next)
- g_free (l->data);
- g_list_free (free_list);
-
- return 1;
-}
-
-int
-main(int argc, char *argv[])
-{
- GnomeClient *client;
- CORBA_Environment ev;
-
- bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);
-
- CORBA_exception_init (&ev);
-
- gnome_CORBA_init_with_popt_table (
- "calendar", VERSION, &argc, argv,
- options, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev);
-
- orb = gnome_CORBA_ORB ();
- poa = (PortableServer_POA)CORBA_ORB_resolve_initial_references (orb, "RootPOA", &ev);
- if (ev._major == CORBA_NO_EXCEPTION){
- init_corba_server ();
- }
-
- if (show_events)
- dump_events ();
- if (show_todo)
- dump_todo ();
-
- client = gnome_master_client ();
- if (client){
- gtk_signal_connect (GTK_OBJECT (client), "save_yourself",
- GTK_SIGNAL_FUNC (session_save_state), argv [0]);
- gtk_signal_connect (GTK_OBJECT (client), "die",
- GTK_SIGNAL_FUNC (session_die), NULL);
- }
-
- process_dates ();
- alarm_init ();
- init_calendar ();
-
- /*
- * Load all of the calendars specifies in the command line with
- * the geometry specificied -if any-
- */
- if (start_calendars){
- GList *p, *g, *v;
- char *title;
-
- p = start_calendars;
- g = start_geometries;
- v = start_views;
- while (p){
- char *file = p->data;
- char *geometry = g ? g->data : NULL;
- char *page_name = v ? v->data : NULL;
-
- if (file == COOKIE_USER_HOME_DIR)
- file = user_calendar_file;
-
- if (strcmp (file, user_calendar_file) == 0)
- title = full_name;
- else
- title = file;
- new_calendar (title, file, geometry, page_name, startup_hidden);
-
- p = p->next;
- if (g)
- g = g->next;
- if (v)
- v = v->next;
- }
- g_list_free (p);
- } else {
- char *geometry = start_geometries ? start_geometries->data : NULL;
- char *page_name = start_views ? start_views->data : NULL;
-
- new_calendar (full_name, user_calendar_file, geometry, page_name, startup_hidden);
- }
- gtk_main ();
- return 0;
-}
diff --git a/calendar/main.h b/calendar/main.h
deleted file mode 100644
index 2785e1d2d1..0000000000
--- a/calendar/main.h
+++ /dev/null
@@ -1,101 +0,0 @@
-#ifndef MAIN_H
-#define MAIN_H
-
-/* Calendar preferences */
-
-extern int day_begin, day_end;
-extern char *user_name;
-extern int am_pm_flag;
-extern int week_starts_on_monday;
-
-
-/* This enum and the following array define the color preferences */
-
-typedef enum {
- COLOR_PROP_OUTLINE_COLOR, /* Color of calendar outline */
- COLOR_PROP_HEADING_COLOR, /* Color for headings */
- COLOR_PROP_EMPTY_DAY_BG, /* Background color for empty days */
- COLOR_PROP_MARK_DAY_BG, /* Background color for days with appointments */
- COLOR_PROP_PRELIGHT_DAY_BG, /* Background color for prelighted day */
- COLOR_PROP_DAY_FG, /* Color for day numbers */
- COLOR_PROP_CURRENT_DAY_FG, /* Color for current day's number */
- COLOR_PROP_TODO_NOT_DUE_YET, /* Color for Todo items not yet due */
- COLOR_PROP_TODO_DUE_TODAY, /* Color for Todo items due today */
- COLOR_PROP_TODO_OVERDUE, /* Color for Todo items that are overdue */
- COLOR_PROP_LAST /* Number of color properties */
-} ColorProp;
-
-struct color_prop {
- int r; /* Values are in [0, 65535] */
- int g;
- int b;
- char *label; /* Label for properties dialog */
- char *key; /* Key for gnome_config */
-};
-
-extern struct color_prop color_props[];
-
-
-/* todo preferences */
-extern int todo_show_due_date;
-
-extern int todo_item_dstatus_highlight_overdue;
-extern int todo_item_dstatus_highlight_due_today;
-extern int todo_item_dstatus_highlight_not_due_yet;
-
-extern int todo_show_time_remaining;
-extern int todo_show_priority;
-extern char *todo_overdue_font_text;
-extern gboolean todo_style_changed;
-extern gint todo_current_sort_column;
-extern gint todo_current_sort_type;
-
-/* alarm stuff */
-extern CalendarAlarm alarm_defaults[4];
-extern gboolean beep_on_display;
-extern gboolean enable_aalarm_timeout;
-extern guint audio_alarm_timeout;
-extern const guint MAX_AALARM_TIMEOUT;
-extern gboolean enable_snooze;
-extern guint snooze_secs;
-extern const guint MAX_SNOOZE_SECS;
-
-/* Creates and runs the preferences dialog box */
-void properties (GtkWidget *toplevel);
-
-/* Asks for all the time-related displays to be updated when the user changes the time format
- * preferences.
- */
-void time_format_changed (void);
-
-/* Asks for all the month items' colors to be reset */
-void colors_changed (void);
-
-/* Asks for all todo lists to reflect the accurate properties */
-void todo_properties_changed(void);
-
-/* Creates and runs the Go-to date dialog */
-void goto_dialog (GnomeCalendar *gcal);
-
-/* Returns a pointer to a statically-allocated string with a representation of the specified color.
- * Values must be in [0, 65535].
- */
-char *build_color_spec (int r, int g, int b);
-
-/* Parses a color specification of the form "#%04x%04x%04x" and returns the color components. */
-void parse_color_spec (char *spec, int *r, int *g, int *b);
-
-/* Calls build_color_spec() for the color in the specified property number */
-char *color_spec_from_prop (ColorProp propnum);
-
-void save_default_calendar (GnomeCalendar *gcal);
-
-GnomeCalendar *new_calendar (char *full_name, char *calendar_file,
- char *geometry, char *page, gboolean hidden);
-
-#endif
-
-
-
-
-
diff --git a/calendar/mark.c b/calendar/mark.c
deleted file mode 100644
index 2de8e2b880..0000000000
--- a/calendar/mark.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Functions to mark calendars
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include "gnome-cal.h"
-#include "main.h"
-#include "mark.h"
-#include "timeutil.h"
-
-
-/* Frees the specified data when an object is destroyed */
-static void
-free_data (GtkObject *object, gpointer data)
-{
- g_free (data);
-}
-
-/* If the array of "marked" attributes for the days in a a month item has not been created yet, this
- * function creates the array and clears it. Otherwise, it just returns the existing array.
- */
-static char *
-get_attributes (GnomeMonthItem *mitem)
-{
- char *attrs;
-
- attrs = gtk_object_get_data (GTK_OBJECT (mitem), "day_mark_attributes");
-
- if (!attrs) {
- attrs = g_new0 (char, 42);
- gtk_object_set_data (GTK_OBJECT (mitem), "day_mark_attributes", attrs);
- gtk_signal_connect (GTK_OBJECT (mitem), "destroy",
- (GtkSignalFunc) free_data,
- attrs);
- }
-
- return attrs;
-}
-
-void
-colorify_month_item (GnomeMonthItem *mitem, GetColorFunc func, gpointer func_data)
-{
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
- g_return_if_fail (func != NULL);
-
- unmark_month_item (mitem);
-
- /* We have to do this in several calls to gnome_canvas_item_set(), as color_spec_from_prop()
- * returns a pointer to a static string -- and we need several values.
- */
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem),
- "heading_color", (* func) (COLOR_PROP_HEADING_COLOR, func_data),
- NULL);
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem),
- "outline_color", (* func) (COLOR_PROP_OUTLINE_COLOR, func_data),
- NULL);
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem),
- "day_box_color", (* func) (COLOR_PROP_EMPTY_DAY_BG, func_data),
- NULL);
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mitem),
- "day_color", (* func) (COLOR_PROP_DAY_FG, func_data),
- NULL);
-}
-
-/* In the month item, marks all the days that are touched by the specified time span. Assumes that
- * the time span is completely contained within the month. The array of day attributes is modified
- * accordingly.
- */
-static void
-mark_event_in_month (GnomeMonthItem *mitem, time_t start, time_t end)
-{
- struct tm tm;
- int day_index;
-
- tm = *localtime (&start);
-
- for (; start <= end; start += 60 * 60 * 24) {
- mktime (&tm); /* normalize the time */
-
- /* Figure out the day index that corresponds to this time */
-
- day_index = gnome_month_item_day2index (mitem, tm.tm_mday);
- g_assert (day_index >= 0);
-
- /* Mark the day box */
-
- mark_month_item_index (mitem, day_index, default_color_func, NULL);
-
- /* Next day */
-
- tm.tm_mday++;
- }
-}
-
-void
-mark_month_item (GnomeMonthItem *mitem, Calendar *cal)
-{
- time_t month_begin, month_end;
- GList *list, *l;
- CalendarObject *co;
-
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
- g_return_if_fail (cal != NULL);
-
- month_begin = time_month_begin (time_from_day (mitem->year, mitem->month, 1));
- month_end = time_month_end (month_begin);
-
- list = calendar_get_events_in_range (cal, month_begin, month_end);
-
- for (l = list; l; l = l->next) {
- co = l->data;
-
- /* We clip the event's start and end times to the month's limits */
-
- mark_event_in_month (mitem, MAX (co->ev_start, month_begin), MIN (co->ev_end, month_end));
- }
-
- calendar_destroy_event_list (list);
-}
-
-void
-mark_month_item_index (GnomeMonthItem *mitem, int index, GetColorFunc func, gpointer func_data)
-{
- char *attrs;
- GnomeCanvasItem *item;
-
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
- g_return_if_fail ((index >= 0) && (index < 42));
- g_return_if_fail (func != NULL);
-
- attrs = get_attributes (mitem);
-
- attrs[index] = TRUE;
-
- item = gnome_month_item_num2child (mitem, GNOME_MONTH_ITEM_DAY_BOX + index);
- gnome_canvas_item_set (item,
- "fill_color", (* func) (COLOR_PROP_MARK_DAY_BG, func_data),
- NULL);
-}
-
-void
-unmark_month_item (GnomeMonthItem *mitem)
-{
- int i;
- char *attrs;
- GnomeCanvasItem *item;
-
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
-
- attrs = get_attributes (mitem);
-
- /* Find marked days and unmark them by turning off their marked attribute flag and changing
- * the color.
- */
-
- for (i = 0; i < 42; i++)
- if (attrs[i]) {
- attrs[i] = FALSE;
-
- item = gnome_month_item_num2child (mitem, GNOME_MONTH_ITEM_DAY_BOX + i);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_EMPTY_DAY_BG),
- NULL);
- }
-}
-
-/* Handles EnterNotify and LeaveNotify events from the month item's day groups, and performs
- * appropriate prelighting.
- */
-static gint
-day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- GnomeMonthItem *mitem;
- GnomeCanvasItem *box;
- int child_num, day;
- GetColorFunc func;
- gpointer func_data;
- char *color;
- char *attrs;
-
- /* We only accept enters and leaves */
-
- if (!((event->type == GDK_ENTER_NOTIFY) || (event->type == GDK_LEAVE_NOTIFY)))
- return FALSE;
-
- /* Get index information */
-
- mitem = GNOME_MONTH_ITEM (data);
- child_num = gnome_month_item_child2num (mitem, item);
- day = gnome_month_item_num2day (mitem, child_num);
-
- if (day == 0)
- return FALSE; /* it was a day outside the month's range */
-
- child_num -= GNOME_MONTH_ITEM_DAY_GROUP;
- box = gnome_month_item_num2child (mitem, GNOME_MONTH_ITEM_DAY_BOX + child_num);
-
- /* Get colors */
-
- func = gtk_object_get_data (GTK_OBJECT (mitem), "prelight_color_func");
- func_data = gtk_object_get_data (GTK_OBJECT (mitem), "prelight_color_data");
-
- /* Now actually set the proper color in the item */
-
- switch (event->type) {
- case GDK_ENTER_NOTIFY:
- color = (* func) (COLOR_PROP_PRELIGHT_DAY_BG, func_data);
- gnome_canvas_item_set (box,
- "fill_color", color,
- NULL);
- break;
-
- case GDK_LEAVE_NOTIFY:
- attrs = get_attributes (mitem);
- color = (* func) (attrs[child_num] ? COLOR_PROP_MARK_DAY_BG : COLOR_PROP_EMPTY_DAY_BG,
- func_data);
- gnome_canvas_item_set (box,
- "fill_color", color,
- NULL);
- break;
-
- default:
- g_assert_not_reached ();
- }
-
- return TRUE;
-}
-
-void
-month_item_prepare_prelight (GnomeMonthItem *mitem, GetColorFunc func, gpointer func_data)
-{
- GnomeCanvasItem *day_group;
- int i;
-
- g_return_if_fail (mitem != NULL);
- g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
- g_return_if_fail (func != NULL);
-
- /* Store the function in the object data */
-
- gtk_object_set_data (GTK_OBJECT (mitem), "prelight_color_func", func);
- gtk_object_set_data (GTK_OBJECT (mitem), "prelight_color_data", func_data);
-
- /* Connect the appropriate signals to perform prelighting */
-
- for (i = 0; i < 42; i++) {
- day_group = gnome_month_item_num2child (GNOME_MONTH_ITEM (mitem), GNOME_MONTH_ITEM_DAY_GROUP + i);
- gtk_signal_connect (GTK_OBJECT (day_group), "event",
- (GtkSignalFunc) day_event,
- mitem);
- }
-}
-
-char *
-default_color_func (ColorProp propnum, gpointer data)
-{
- return color_spec_from_prop (propnum);
-}
diff --git a/calendar/mark.h b/calendar/mark.h
deleted file mode 100644
index cf8f7c1496..0000000000
--- a/calendar/mark.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Functions to mark calendars
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef MARK_H
-#define MARK_H
-
-#include "calendar.h"
-#include "gnome-month-item.h"
-
-
-/* These are the fonts used for the montly calendars */
-
-#define HEADING_FONTSET "-adobe-helvetica-medium-r-*-*-14-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-17-*-*-*-p-*-koi8-r,-*-*-medium-r-*-*-14-*-*-*-*-*-ksc5601.1987-0,*"
-#define TITLE_FONTSET "-adobe-helvetica-bold-r-normal--12-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-14-*-*-*-p-*-koi8-r,-*-*-bold-r-normal--12-*-*-*-*-*-ksc5601.1987-0,*"
-#define DAY_HEADING_FONTSET "-adobe-helvetica-medium-r-normal--10-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-11-*-*-*-p-*-koi8-r,-*-*-medium-r-normal--10-*-*-*-*-*-ksc5601.1987-0,*"
-#define NORMAL_DAY_FONTSET "-adobe-helvetica-medium-r-normal--10-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-11-*-*-*-p-*-koi8-r,-*-*-medium-r-normal--10-*-*-*-*-*-ksc5601.1987-0,*"
-#define CURRENT_DAY_FONTSET "-adobe-helvetica-bold-r-normal--12-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-14-*-*-*-p-*-koi8-r,-*-*-bold-r-normal--12-*-*-*-*-*-ksc5601.1987-0,*"
-#define BIG_DAY_HEADING_FONTSET "-adobe-helvetica-bold-r-normal--14-*-*-*-p-*-*-*,-cronyx-helvetica-bold-r-normal-*-17-*-*-*-p-*-koi8-r,-*-*-bold-r-normal--14-*-*-*-*-*-ksc5601.1987-0,*"
-#define BIG_NORMAL_DAY_FONTSET "-adobe-helvetica-medium-r-normal--14-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-17-*-*-*-p-*-koi8-r,-*-*-medium-r-normal--14-*-*-*-*-*-ksc5601.1987-0,*"
-#define BIG_CURRENT_DAY_FONTSET "-adobe-helvetica-bold-r-normal--14-*-*-*-p-*-*-*,-cronyx-helvetica-bold-r-normal-*-17-*-*-*-p-*-koi8-r,-*-*-bold-r-normal--14-*-*-*-*-*-ksc5601.1987-0,*"
-#define EVENT_FONTSET "-adobe-helvetica-medium-r-*-*-10-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-11-*-*-*-p-*-koi8-r,-*-*-medium-r-normal--10-*-*-*-*-*-ksc5601.1987-0,*"
-
-
-/* Functions of this type are used by the marking functions to fetch color specifications. Such
- * a function must return a color spec based on the property passed to it.
- */
-typedef char * (* GetColorFunc) (ColorProp propnum, gpointer data);
-
-
-/* Sets the user-configured colors and font for a month item. It also tags the days as unmarked. */
-void colorify_month_item (GnomeMonthItem *month, GetColorFunc func, gpointer func_data);
-
-/* Takes a monthly calendar item and marks the days that have events scheduled for them in the
- * specified calendar. It also highlights the current day.
- */
-void mark_month_item (GnomeMonthItem *mitem, Calendar *cal);
-
-/* Marks a day specified by index, not by day number */
-void mark_month_item_index (GnomeMonthItem *mitem, int index, GetColorFunc func, gpointer func_data);
-
-/* Unmarks all the days in the specified month item */
-void unmark_month_item (GnomeMonthItem *mitem);
-
-/* Prepares a monthly calendar item to prelight when the mouse goes over the days. */
-
-void month_item_prepare_prelight (GnomeMonthItem *mitem, GetColorFunc func, gpointer func_data);
-
-/* This is the default prelight function you can use for most puposes. You can use NULL as the
- * func_data.
- */
-char *default_color_func (ColorProp prop_num, gpointer data);
-
-
-#endif
diff --git a/calendar/month-view.c b/calendar/month-view.c
deleted file mode 100644
index 5df7b7a23d..0000000000
--- a/calendar/month-view.c
+++ /dev/null
@@ -1,798 +0,0 @@
-/* Month view display for gncal
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <libgnomeui/gnome-canvas-text.h>
-#include "eventedit.h"
-#include "layout.h"
-#include "month-view.h"
-#include "main.h"
-#include "mark.h"
-#include "quick-view.h"
-#include "timeutil.h"
-
-
-/* Spacing between title and calendar */
-#define SPACING 4
-
-/* Padding between day borders and event text */
-#define EVENT_PADDING 3
-
-
-static void month_view_class_init (MonthViewClass *class);
-static void month_view_init (MonthView *mv);
-static void month_view_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void month_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-
-static GnomeCanvasClass *parent_class;
-
-
-GtkType
-month_view_get_type (void)
-{
- static GtkType month_view_type = 0;
-
- if (!month_view_type) {
- GtkTypeInfo month_view_info = {
- "MonthView",
- sizeof (MonthView),
- sizeof (MonthViewClass),
- (GtkClassInitFunc) month_view_class_init,
- (GtkObjectInitFunc) month_view_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- month_view_type = gtk_type_unique (gnome_canvas_get_type (), &month_view_info);
- }
-
- return month_view_type;
-}
-
-static void
-month_view_class_init (MonthViewClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = gtk_type_class (gnome_canvas_get_type ());
-
- widget_class->size_request = month_view_size_request;
- widget_class->size_allocate = month_view_size_allocate;
-}
-
-/* Creates the quick view when a day is clicked in the month view */
-static void
-do_quick_view_popup (MonthView *mv, GdkEventButton *event, int day)
-{
- time_t day_begin_time, day_end_time;
- GList *list;
- GtkWidget *qv;
- char date_str[256];
-
- day_begin_time = time_from_day (mv->year, mv->month, day);
- day_end_time = time_day_end (day_begin_time);
-
- list = calendar_get_events_in_range (mv->calendar->cal, day_begin_time, day_end_time);
-
- strftime (date_str, sizeof (date_str), _("%a %b %d %Y"), localtime (&day_begin_time));
- qv = quick_view_new (mv->calendar, date_str, list);
-
- quick_view_do_popup (QUICK_VIEW (qv), event);
-
- gtk_widget_destroy (qv);
- calendar_destroy_event_list (list);
-}
-
-/* Callback used to destroy the popup menu when the month view is destroyed */
-static void
-destroy_menu (GtkWidget *widget, gpointer data)
-{
- gtk_widget_destroy (GTK_WIDGET (data));
-}
-
-/* Creates a new appointment in the current day */
-static void
-new_appointment (GtkWidget *widget, gpointer data)
-{
- MonthView *mv;
- time_t *t;
-
- mv = MONTH_VIEW (data);
- t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
-
- event_editor_new_whole_day (mv->calendar, *t);
-}
-
-/* Convenience functions to jump to a view and set the time */
-static void
-do_jump (GtkWidget *widget, gpointer data, char *view_name)
-{
- MonthView *mv;
- time_t *t;
-
- mv = MONTH_VIEW (data);
-
- /* Get the time data from the menu item */
-
- t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
-
- /* Set the view and time */
-
- gnome_calendar_set_view (mv->calendar, view_name);
- gnome_calendar_goto (mv->calendar, *t);
-}
-
-/* The following three callbacks set the view in the calendar and change the time */
-
-static void
-jump_to_day (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "dayview");
-}
-
-static void
-jump_to_week (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "weekview");
-}
-
-static void
-jump_to_year (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "yearview");
-}
-
-static GnomeUIInfo mv_popup_menu[] = {
- GNOMEUIINFO_ITEM_STOCK (N_("_New appointment in this day..."), NULL, new_appointment, GNOME_STOCK_MENU_NEW),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _day"), NULL, jump_to_day, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _week"), NULL, jump_to_week, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _year"), NULL, jump_to_year, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_END
-};
-
-/* Creates the popup menu for the month view if it does not yet exist, and attaches it to the month
- * view object so that it can be destroyed when appropriate.
- */
-static GtkWidget *
-get_popup_menu (MonthView *mv)
-{
- GtkWidget *menu;
-
- menu = gtk_object_get_data (GTK_OBJECT (mv), "popup_menu");
-
- if (!menu) {
- menu = gnome_popup_menu_new (mv_popup_menu);
- gtk_object_set_data (GTK_OBJECT (mv), "popup_menu", menu);
- gtk_signal_connect (GTK_OBJECT (mv), "destroy",
- (GtkSignalFunc) destroy_menu,
- menu);
- }
-
- return menu;
-}
-
-/* Pops up the menu for the month view. */
-static void
-do_popup_menu (MonthView *mv, GdkEventButton *event, int day)
-{
- GtkWidget *menu;
- static time_t t;
-
- menu = get_popup_menu (mv);
-
- /* Enable or disable items as appropriate */
-
- gtk_widget_set_sensitive (mv_popup_menu[0].widget, day != 0);
- gtk_widget_set_sensitive (mv_popup_menu[2].widget, day != 0);
- gtk_widget_set_sensitive (mv_popup_menu[3].widget, day != 0);
-
- if (day == 0)
- day = 1;
-
- /* Store the time for the menu item callbacks to use */
-
- t = time_from_day (mv->year, mv->month, day);
-
- gtk_object_set_data (GTK_OBJECT (mv_popup_menu[0].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (mv_popup_menu[2].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (mv_popup_menu[3].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (mv_popup_menu[4].widget), "time_data", &t);
-
- gnome_popup_menu_do_popup (menu, NULL, NULL, event, mv);
-}
-
-/* Event handler for day groups. When mouse button 1 is pressed, it will pop up a quick view with
- * the events in that day. When mouse button 3 is pressed, it will pop up a menu.
- */
-static gint
-day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- MonthView *mv;
- int child_num;
- int day;
-
- mv = MONTH_VIEW (data);
-
- child_num = gnome_month_item_child2num (GNOME_MONTH_ITEM (mv->mitem), item);
- day = gnome_month_item_num2day (GNOME_MONTH_ITEM (mv->mitem), child_num);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if ((event->button.button == 1) && (day != 0)) {
- do_quick_view_popup (mv, (GdkEventButton *) event, day);
- return TRUE;
- } else if (event->button.button == 3) {
- do_popup_menu (mv, (GdkEventButton *) event, day);
- return TRUE;
- }
-
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Returns the index of the specified arrow in the array of arrows */
-static int
-get_arrow_index (MonthView *mv, GnomeCanvasItem *arrow)
-{
- int i;
-
- for (i = 0; i < 42; i++)
- if (mv->up[i] == arrow)
- return i;
- else if (mv->down[i] == arrow)
- return i + 42;
-
- g_warning ("Eeeek, arrow %p not found in month view %p", arrow, mv);
- return -1;
-}
-
-/* Checks whether arrows need to be displayed at the specified day index or not */
-static void
-check_arrow_visibility (MonthView *mv, int day_index)
-{
- GtkArg args[3];
- double text_height;
- double clip_height;
- double y_offset;
-
- args[0].name = "text_height";
- args[1].name = "clip_height";
- args[2].name = "y_offset";
- gtk_object_getv (GTK_OBJECT (mv->text[day_index]), 3, args);
-
- text_height = GTK_VALUE_DOUBLE (args[0]);
- clip_height = GTK_VALUE_DOUBLE (args[1]);
- y_offset = GTK_VALUE_DOUBLE (args[2]);
-
- /* Check up arrow */
-
- if (y_offset < 0.0)
- gnome_canvas_item_show (mv->up[day_index]);
- else
- gnome_canvas_item_hide (mv->up[day_index]);
-
- if (y_offset > (clip_height - text_height))
- gnome_canvas_item_show (mv->down[day_index]);
- else
- gnome_canvas_item_hide (mv->down[day_index]);
-}
-
-/* Finds which arrow was clicked and scrolls the corresponding text item in the month view */
-static void
-do_arrow_click (MonthView *mv, GnomeCanvasItem *arrow)
-{
- int arrow_index;
- int day_index;
- int up;
- GtkArg args[4];
- double text_height, clip_height;
- double y_offset;
- GdkFont *font;
-
- arrow_index = get_arrow_index (mv, arrow);
- up = (arrow_index < 42);
- day_index = up ? arrow_index : (arrow_index - 42);
-
- /* See how much we can scroll */
-
- args[0].name = "text_height";
- args[1].name = "clip_height";
- args[2].name = "y_offset";
- args[3].name = "font_gdk";
- gtk_object_getv (GTK_OBJECT (mv->text[day_index]), 4, args);
-
- text_height = GTK_VALUE_DOUBLE (args[0]);
- clip_height = GTK_VALUE_DOUBLE (args[1]);
- y_offset = GTK_VALUE_DOUBLE (args[2]);
- font = GTK_VALUE_BOXED (args[3]);
-
- if (up)
- y_offset += font->ascent + font->descent;
- else
- y_offset -= font->ascent + font->descent;
-
- if (y_offset > 0.0)
- y_offset = 0.0;
- else if (y_offset < (clip_height - text_height))
- y_offset = clip_height - text_height;
-
- /* Scroll */
-
- gnome_canvas_item_set (mv->text[day_index],
- "y_offset", y_offset,
- NULL);
-
- check_arrow_visibility (mv, day_index);
-}
-
-/* Event handler for the scroll arrows in the month view */
-static gint
-arrow_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- MonthView *mv;
-
- mv = MONTH_VIEW (data);
-
- switch (event->type) {
- case GDK_ENTER_NOTIFY:
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_PRELIGHT_DAY_BG),
- NULL);
- return TRUE;
-
- case GDK_LEAVE_NOTIFY:
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_DAY_FG),
- NULL);
- return TRUE;
-
- case GDK_BUTTON_PRESS:
- if (event->button.button != 1)
- break;
-
- do_arrow_click (mv, item);
- return TRUE;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Creates a new arrow out of the specified points and connects the proper signals to it */
-static GnomeCanvasItem *
-new_arrow (MonthView *mv, GnomeCanvasGroup *group, GnomeCanvasPoints *points)
-{
- GnomeCanvasItem *item;
- char *color_spec;
-
- color_spec = color_spec_from_prop (COLOR_PROP_DAY_FG);
-
- item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (group),
- gnome_canvas_polygon_get_type (),
- "points", points,
- "fill_color", color_spec,
- "outline_color", color_spec,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (item), "event",
- (GtkSignalFunc) arrow_event,
- mv);
-
- return item;
-}
-
-static void
-month_view_init (MonthView *mv)
-{
- int i;
- GnomeCanvasItem *day_group;
- GnomeCanvasPoints *points;
-
- /* Title */
-
- mv->title = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (mv)),
- gnome_canvas_text_get_type (),
- "anchor", GTK_ANCHOR_N,
- "fontset", HEADING_FONTSET,
- "fill_color", "black",
- NULL);
-
- /* Month item */
-
- mv->mitem = gnome_month_item_new (gnome_canvas_root (GNOME_CANVAS (mv)));
- gnome_canvas_item_set (mv->mitem,
- "x", 0.0,
- "anchor", GTK_ANCHOR_NW,
- "day_anchor", GTK_ANCHOR_NE,
- "start_on_monday", week_starts_on_monday,
- "heading_padding", 2.0,
- "heading_fontset", BIG_DAY_HEADING_FONTSET,
- "day_fontset", BIG_NORMAL_DAY_FONTSET,
- NULL);
-
- /* Arrows and text items. The arrows start hidden by default; they will be shown as
- * appropriate by the item adjustment code. Also, connect to the event signal of the
- * day groups so that we can pop up the quick view when appropriate.
- */
-
- points = gnome_canvas_points_new (3);
-
- for (i = 0; i < 42; i++) {
- day_group = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem),
- i + GNOME_MONTH_ITEM_DAY_GROUP);
- gtk_signal_connect (GTK_OBJECT (day_group), "event",
- (GtkSignalFunc) day_event,
- mv);
-
- /* Up arrow */
-
- points->coords[0] = 3;
- points->coords[1] = 10;
- points->coords[2] = 11;
- points->coords[3] = 10;
- points->coords[4] = 7;
- points->coords[5] = 3;
-
- mv->up[i] = new_arrow (mv, GNOME_CANVAS_GROUP (day_group), points);
-
- /* Down arrow */
-
- points->coords[0] = 13;
- points->coords[1] = 3;
- points->coords[2] = 17;
- points->coords[3] = 10;
- points->coords[4] = 21;
- points->coords[5] = 3;
-
- mv->down[i] = new_arrow (mv, GNOME_CANVAS_GROUP (day_group), points);
-
- /* Text item */
-
- mv->text[i] = gnome_canvas_item_new (GNOME_CANVAS_GROUP (day_group),
- gnome_canvas_text_get_type (),
- "fontset", EVENT_FONTSET,
- "anchor", GTK_ANCHOR_NW,
- "fill_color", color_spec_from_prop (COLOR_PROP_DAY_FG),
- "clip", TRUE,
- NULL);
- }
- gnome_canvas_points_free (points);
-
- mv->old_current_index = -1;
-}
-
-GtkWidget *
-month_view_new (GnomeCalendar *calendar, time_t month)
-{
- MonthView *mv;
-
- g_return_val_if_fail (calendar != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CALENDAR (calendar), NULL);
-
- mv = gtk_type_new (month_view_get_type ());
- mv->calendar = calendar;
-
- month_view_colors_changed (mv);
- month_view_set (mv, month);
- return GTK_WIDGET (mv);
-}
-
-static void
-month_view_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_MONTH_VIEW (widget));
- g_return_if_fail (requisition != NULL);
-
- if (GTK_WIDGET_CLASS (parent_class)->size_request)
- (* GTK_WIDGET_CLASS (parent_class)->size_request) (widget, requisition);
-
- requisition->width = 200;
- requisition->height = 150;
-}
-
-/* Adjusts the text items for events in the month view to the appropriate size. It also makes the
- * corresponding arrows visible or invisible, as appropriate.
- */
-static void
-adjust_children (MonthView *mv)
-{
- int i;
- GnomeCanvasItem *item;
- double x1, y1, x2, y2;
- GtkArg arg;
-
- for (i = 0; i < 42; i++) {
- /* Get dimensions of the day group */
-
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem), i + GNOME_MONTH_ITEM_DAY_GROUP);
- gnome_canvas_item_get_bounds (item, &x1, &y1, &x2, &y2);
-
- /* Normalize and add paddings */
-
- x2 -= x1 + EVENT_PADDING;
- x1 = EVENT_PADDING;
- y2 -= y1 + EVENT_PADDING;
- y1 = EVENT_PADDING;
-
- /* Add height of day label to y1 */
-
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem), i + GNOME_MONTH_ITEM_DAY_LABEL);
-
- arg.name = "text_height";
- gtk_object_getv (GTK_OBJECT (item), 1, &arg);
- y1 += GTK_VALUE_DOUBLE (arg);
-
- /* Set the position and clip size */
-
- gnome_canvas_item_set (mv->text[i],
- "x", x1,
- "y", y1,
- "clip_width", x2 - x1,
- "clip_height", y2 - y1,
- "x_offset", 0.0,
- "y_offset", 0.0,
- NULL);
-
- /* See what visibility state the arrows should be set to */
-
- check_arrow_visibility (mv, i);
- }
-}
-
-static void
-month_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- MonthView *mv;
- GdkFont *font;
- GtkArg arg;
- int y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_MONTH_VIEW (widget));
- g_return_if_fail (allocation != NULL);
-
- mv = MONTH_VIEW (widget);
-
- if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
- (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (mv), 0, 0, allocation->width, allocation->height);
-
- /* Adjust items to new size */
-
- arg.name = "font_gdk";
- gtk_object_getv (GTK_OBJECT (mv->title), 1, &arg);
- font = GTK_VALUE_BOXED (arg);
-
- gnome_canvas_item_set (mv->title,
- "x", (double) allocation->width / 2.0,
- "y", (double) SPACING,
- NULL);
-
- y = font->ascent + font->descent + 2 * SPACING;
- gnome_canvas_item_set (mv->mitem,
- "y", (double) y,
- "width", (double) (allocation->width - 1),
- "height", (double) (allocation->height - y - 1),
- NULL);
-
- /* Adjust children */
-
- adjust_children (mv);
-}
-
-/* This defines the environment for the calendar iterator function that is used to populate the
- * month view with events.
- */
-struct iter_info {
- MonthView *mv; /* The month view we are creating children for */
- int first_day_index; /* Index of the first day of the month within the month item */
- time_t month_begin, month_end; /* Beginning and end of month */
- GString **strings; /* Array of strings to populate */
-};
-
-/* This is the calendar iterator function used to populate the string array with event information.
- * For each event, it iterates through all the days that the event touches and appends the proper
- * information to the string array in the iter_info structure.
- */
-static int
-add_event (iCalObject *ico, time_t start, time_t end, void *data)
-{
- struct iter_info *ii;
- struct tm tm;
- time_t t;
- time_t day_begin_time, day_end_time;
-
- ii = data;
-
- /* Get the first day of the event */
-
- t = MAX (start, ii->month_begin);
- day_begin_time = time_day_begin (t);
- day_end_time = time_day_end (day_begin_time);
-
- /* Loop until the event ends or the month ends. For each day touched, append the proper
- * information to the corresponding string.
- */
-
- do {
- tm = *localtime (&day_begin_time);
- g_string_sprintfa (ii->strings[ii->first_day_index + tm.tm_mday - 1], "%s\n", ico->summary);
-
- /* Next day */
-
- day_begin_time = time_add_day (day_begin_time, 1);
- day_end_time = time_day_end (day_begin_time);
- } while ((end > day_begin_time) && (day_begin_time < ii->month_end));
-
- return TRUE; /* this means we are not finished yet with event generation */
-}
-
-void
-month_view_update (MonthView *mv, iCalObject *object, int flags)
-{
- struct iter_info ii;
- GString *strings[42];
- int i;
- time_t t;
-
- g_return_if_fail (mv != NULL);
- g_return_if_fail (IS_MONTH_VIEW (mv));
-
- ii.mv = mv;
-
- /* Create an array of empty GStrings */
-
- ii.strings = strings;
-
- for (i = 0; i < 42; i++)
- strings[i] = g_string_new (NULL);
-
- ii.first_day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (mv->mitem), 1);
- g_assert (ii.first_day_index != -1);
-
- /* Populate the array of strings with events */
-
- t = time_from_day (mv->year, mv->month, 1);
- ii.month_begin = time_month_begin (t);
- ii.month_end = time_month_end (t);
-
- calendar_iterate (mv->calendar->cal, ii.month_begin, ii.month_end, add_event, &ii);
-
- for (i = 0; i < 42; i++) {
- /* Delete the last character if it is a newline */
-
- if (strings[i]->str && strings[i]->len && (strings[i]->str[strings[i]->len - 1] == '\n'))
- g_string_truncate (strings[i], strings[i]->len - 1);
-
- gnome_canvas_item_set (mv->text[i],
- "text", strings[i]->str,
- NULL);
- g_string_free (strings[i], TRUE);
- }
-
- /* Adjust children for scrolling */
-
- adjust_children (mv);
-}
-
-/* Unmarks the old day that was marked as current and marks the current day if appropriate */
-static void
-mark_current_day (MonthView *mv)
-{
- time_t t;
- struct tm tm;
- GnomeCanvasItem *item;
-
- /* Unmark the old day */
-
- if (mv->old_current_index != -1) {
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem),
- GNOME_MONTH_ITEM_DAY_LABEL + mv->old_current_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_DAY_FG),
- "fontset", BIG_NORMAL_DAY_FONTSET,
- NULL);
-
- mv->old_current_index = -1;
- }
-
- /* Mark the new day */
-
- t = time (NULL);
- tm = *localtime (&t);
-
- if (((tm.tm_year + 1900) == mv->year) && (tm.tm_mon == mv->month)) {
- mv->old_current_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (mv->mitem), tm.tm_mday);
- g_assert (mv->old_current_index != -1);
-
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mv->mitem),
- GNOME_MONTH_ITEM_DAY_LABEL + mv->old_current_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_CURRENT_DAY_FG),
- "fontset", BIG_CURRENT_DAY_FONTSET,
- NULL);
- }
-}
-
-void
-month_view_set (MonthView *mv, time_t month)
-{
- struct tm tm;
- char buf[100];
-
- g_return_if_fail (mv != NULL);
- g_return_if_fail (IS_MONTH_VIEW (mv));
-
- /* Title */
-
- tm = *localtime (&month);
-
- mv->year = tm.tm_year + 1900;
- mv->month = tm.tm_mon;
-
- strftime (buf, 100, _("%B %Y"), &tm);
-
- gnome_canvas_item_set (mv->title,
- "text", buf,
- NULL);
-
- /* Month item */
-
- gnome_canvas_item_set (mv->mitem,
- "year", mv->year,
- "month", mv->month,
- NULL);
-
- /* Update events */
-
- month_view_update (mv, NULL, 0);
- mark_current_day (mv);
-}
-
-void
-month_view_time_format_changed (MonthView *mv)
-{
- g_return_if_fail (mv != NULL);
- g_return_if_fail (IS_MONTH_VIEW (mv));
-
- gnome_canvas_item_set (mv->mitem,
- "start_on_monday", week_starts_on_monday,
- NULL);
-
- month_view_set (mv, time_month_begin (time_from_day (mv->year, mv->month, 1)));
-}
-
-void
-month_view_colors_changed (MonthView *mv)
-{
- g_return_if_fail (mv != NULL);
- g_return_if_fail (IS_MONTH_VIEW (mv));
-
- colorify_month_item (GNOME_MONTH_ITEM (mv->mitem), default_color_func, NULL);
- mark_current_day (mv);
-
- /* FIXME: set children to the marked color */
-}
diff --git a/calendar/month-view.h b/calendar/month-view.h
deleted file mode 100644
index 6e49c2f931..0000000000
--- a/calendar/month-view.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Month view display for gncal
- *
- * Copyright (C) 1998 Red Hat Software, Inc.
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef MONTH_VIEW_H
-#define MONTH_VIEW_H
-
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-#include "gnome-month-item.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define TYPE_MONTH_VIEW (month_view_get_type ())
-#define MONTH_VIEW(obj) (GTK_CHECK_CAST ((obj), TYPE_MONTH_VIEW, MonthView))
-#define MONTH_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_MONTH_VIEW, MonthViewClass))
-#define IS_MONTH_VIEW(obj) (GTK_CHECK_TYPE ((obj), TYPE_MONTH_VIEW))
-#define IS_MONTH_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_MONTH_VIEW))
-
-
-typedef struct _MonthView MonthView;
-typedef struct _MonthViewClass MonthViewClass;
-
-struct _MonthView {
- GnomeCanvas canvas;
-
- GnomeCalendar *calendar; /* The calendar we are associated to */
-
- int year; /* The year of the month we are displaying */
- int month; /* The month we are displaying */
- int old_current_index; /* The index of the day marked as current, or -1 if none */
-
- GnomeCanvasItem *up[42]; /* Arrows to go up in the days */
- GnomeCanvasItem *down[42]; /* Arrows to go down in the days */
- GnomeCanvasItem *text[42]; /* Text items for the events */
-
- GnomeCanvasItem *title; /* The title heading with the month/year */
- GnomeCanvasItem *mitem; /* The canvas month item used by this month view */
-};
-
-struct _MonthViewClass {
- GnomeCanvasClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType month_view_get_type (void);
-
-/* Creates a new month view widget associated to the specified calendar */
-GtkWidget *month_view_new (GnomeCalendar *calendar, time_t month);
-
-/* Notifies the month view that a calendar object has changed */
-void month_view_update (MonthView *mv, iCalObject *ico, int flags);
-
-/* Notifies the month view about a change of date */
-void month_view_set (MonthView *mv, time_t month);
-
-/* Notifies the month view that the time format has changed */
-void month_view_time_format_changed (MonthView *mv);
-
-/* Notifies the month view that the colors have changed */
-void month_view_colors_changed (MonthView *mv);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c
deleted file mode 100644
index f3004ddb13..0000000000
--- a/calendar/pcs/calobj.c
+++ /dev/null
@@ -1,1490 +0,0 @@
-/*
- * Calendar objects implementations.
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (quartic@gimp.org)
- */
-#include <config.h>
-#include <string.h>
-#include <glib.h>
-#include <ctype.h>
-#include <unistd.h>
-#include "calobj.h"
-#include "timeutil.h"
-#include "../libversit/vcc.h"
-
-extern CalendarAlarm alarm_defaults[4];
-
-static char *
-ical_gen_uid (void)
-{
- static char *hostname;
- time_t t = time (NULL);
- static int serial;
-
- if (!hostname){
- char buffer [128];
-
- if ((gethostname (buffer, sizeof (buffer)-1) == 0) &&
- (buffer [0] != 0))
- hostname = g_strdup (buffer);
- else
- hostname = g_strdup ("localhost");
- }
-
- return g_strdup_printf (
- "%s-%d-%d-%d-%d@%s",
- isodate_from_time_t (t),
- getpid (),
- getgid (),
- getppid (),
- serial++,
- hostname);
-}
-
-iCalObject *
-ical_object_new (void)
-{
- iCalObject *ico;
-
- ico = g_new0 (iCalObject, 1);
-
- ico->seq = -1;
- ico->dtstamp = time (NULL);
- ico->uid = ical_gen_uid ();
-
- ico->pilot_id = 0;
- ico->pilot_status = ICAL_PILOT_SYNC_MOD;
-
- return ico;
-}
-
-static void
-default_alarm (iCalObject *ical, CalendarAlarm *alarm, char *def_mail, enum AlarmType type)
-{
- alarm->type = type;
- alarm->enabled = alarm_defaults[type].enabled;
- alarm->count = alarm_defaults[type].count;
- alarm->units = alarm_defaults[type].units;
- if (alarm_defaults[type].data)
- alarm->data = g_strdup (alarm_defaults[type].data);
- else
- alarm->data = g_strdup ("");
-}
-
-iCalObject *
-ical_new (char *comment, char *organizer, char *summary)
-{
- iCalObject *ico;
-
- ico = ical_object_new ();
-
- ico->comment = g_strdup (comment);
- ico->organizer = g_strdup (organizer);
- ico->summary = g_strdup (summary);
- ico->class = g_strdup ("PUBLIC");
- ico->status = g_strdup ("NEEDS ACTION");
-
- default_alarm (ico, &ico->dalarm, organizer, ALARM_DISPLAY);
- default_alarm (ico, &ico->palarm, organizer, ALARM_PROGRAM);
- default_alarm (ico, &ico->malarm, organizer, ALARM_MAIL);
- default_alarm (ico, &ico->aalarm, organizer, ALARM_AUDIO);
-
- return ico;
-}
-
-static void
-my_free (gpointer data, gpointer user_dat_ignored)
-{
- g_free (data);
-}
-
-static void
-list_free (GList *list)
-{
- g_list_foreach (list, my_free, 0);
- g_list_free (list);
-}
-
-#define free_if_defined(x) if (x){ g_free (x); x = 0; }
-#define lfree_if_defined(x) if (x){ list_free (x); x = 0; }
-void
-ical_object_destroy (iCalObject *ico)
-{
- /* Regular strings */
- free_if_defined (ico->comment);
- free_if_defined (ico->organizer);
- free_if_defined (ico->summary);
- free_if_defined (ico->uid);
- free_if_defined (ico->status);
- free_if_defined (ico->class);
- free_if_defined (ico->url);
- free_if_defined (ico->recur);
-
- /* Lists */
- lfree_if_defined (ico->exdate);
- lfree_if_defined (ico->categories);
- lfree_if_defined (ico->resources);
- lfree_if_defined (ico->related);
- lfree_if_defined (ico->attach);
-
- /* Alarms */
- g_free (ico->dalarm.data);
- g_free (ico->palarm.data);
- g_free (ico->malarm.data);
- g_free (ico->aalarm.data);
-
- g_free (ico);
-}
-
-static GList *
-set_list (char *str)
-{
- GList *list = 0;
- char *s;
-
- for (s = strtok (str, ";"); s; s = strtok (NULL, ";"))
- list = g_list_prepend (list, g_strdup (s));
-
- return list;
-}
-
-static GList *
-set_date_list (char *str)
-{
- GList *list = 0;
- char *s;
-
- for (s = strtok (str, ";,"); s; s = strtok (NULL, ";,")){
- time_t *t = g_new (time_t, 1);
-
- while (*s && isspace (*s))
- s++;
- *t = time_from_isodate (s);
- list = g_list_prepend (list, t);
- }
- return list;
-}
-
-void
-ical_object_add_exdate (iCalObject *o, time_t t)
-{
- time_t *pt = g_new (time_t, 1);
-
- *pt = t;
- o->exdate = g_list_prepend (o->exdate, pt);
-}
-
-static void
-ignore_space(char **str)
-{
- while (**str && isspace (**str))
- (*str)++;
-}
-
-static void
-skip_numbers (char **str)
-{
- while (**str){
- ignore_space (str);
- if (!isdigit (**str))
- return;
- while (**str && isdigit (**str))
- (*str)++;
- }
-}
-
-static void
-weekdaylist (iCalObject *o, char **str)
-{
- int i;
- struct {
- char first_letter, second_letter;
- int index;
- } days [] = {
- { 'S', 'U', 0 },
- { 'M', 'O', 1 },
- { 'T', 'U', 2 },
- { 'W', 'E', 3 },
- { 'T', 'H', 4 },
- { 'F', 'R', 5 },
- { 'S', 'A', 6 }
- };
-
- ignore_space (str);
- do {
- for (i = 0; i < 7; i++){
- if (**str == days [i].first_letter && *(*str+1) == days [i].second_letter){
- o->recur->weekday |= 1 << i;
- *str += 2;
- if (**str == ' ')
- (*str)++;
- }
- }
- } while (isalpha (**str));
-
- if (o->recur->weekday == 0){
- struct tm tm = *localtime (&o->dtstart);
-
- o->recur->weekday = 1 << tm.tm_wday;
- }
-}
-
-static void
-weekdaynum (iCalObject *o, char **str)
-{
- int i;
- struct {
- char first_letter, second_letter;
- int index;
- } days [] = {
- { 'S', 'U', 0 },
- { 'M', 'O', 1 },
- { 'T', 'U', 2 },
- { 'W', 'E', 3 },
- { 'T', 'H', 4 },
- { 'F', 'R', 5 },
- { 'S', 'A', 6 }
- };
-
- ignore_space (str);
- do {
- for (i = 0; i < 7; i++){
- if (**str == days [i].first_letter && *(*str+1) == days [i].second_letter){
- o->recur->weekday = i;
- *str += 2;
- if (**str == ' ')
- (*str)++;
- }
- }
- } while (isalpha (**str));
-}
-
-static void
-ocurrencelist (iCalObject *o, char **str)
-{
- char *p;
-
- ignore_space (str);
- p = *str;
- if (!isdigit (*p))
- return;
-
- if (!(*p >= '1' && *p <= '5'))
- return;
-
- if (!(*(p+1) == '+' || *(p+1) == '-'))
- return;
-
- o->recur->u.month_pos = (*p-'0') * (*(p+1) == '+' ? 1 : -1);
- *str += 2;
-}
-
-static void
-daynumber (iCalObject *o, char **str)
-{
- int val = 0;
- char *p = *str;
-
- ignore_space (str);
- if (strcmp (p, "LD")){
- o->recur->u.month_day = DAY_LASTDAY;
- *str += 2;
- return;
- }
-
- if (!(isdigit (*p)))
- return;
-
- while (**str && isdigit (**str)){
- val = val * 10 + (**str - '0');
- (*str)++;
- }
-
- if (**str == '+')
- (*str)++;
-
- if (**str == '-')
- val *= -1;
- o->recur->u.month_day = val;
-}
-
-static void
-daynumberlist (iCalObject *o, char **str)
-{
- int first = 0;
- int val = 0;
-
- ignore_space (str);
-
- while (**str){
- if (!isdigit (**str))
- return;
- while (**str && isdigit (**str)){
- val = 10 * val + (**str - '0');
- (*str)++;
- }
- if (!first){
- /*
- * Some broken applications set this to zero
- */
- if (val == 0){
- struct tm day = *localtime (&o->dtstart);
-
- val = day.tm_mday;
- }
- o->recur->u.month_day = val;
- first = 1;
- val = 0;
- }
- }
-}
-
-static void
-load_recur_weekly (iCalObject *o, char **str)
-{
- weekdaylist (o, str);
-}
-
-static void
-load_recur_monthly_pos (iCalObject *o, char **str)
-{
- ocurrencelist (o, str);
- weekdaynum (o, str);
-}
-
-static void
-load_recur_monthly_day (iCalObject *o, char **str)
-{
- daynumberlist (o, str);
-}
-
-static void
-load_recur_yearly_month (iCalObject *o, char **str)
-{
- /* Skip as we do not support multiple months and we do expect
- * the dtstart to agree with the value on this field
- */
- skip_numbers (str);
-}
-
-static void
-load_recur_yearly_day (iCalObject *o, char **str)
-{
- /* Skip as we do not support multiple days and we do expect
- * the dtstart to agree with the value on this field
- *
- * FIXME: we should support every-n-years
- */
- skip_numbers (str);
-}
-
-static void
-duration (iCalObject *o, char **str)
-{
- unsigned int duration = 0;
-
- ignore_space (str);
- if (**str != '#')
- return;
- (*str)++;
- while (**str && isdigit (**str)){
- duration = duration * 10 + (**str - '0');
- (*str)++;
- }
- o->recur->duration = duration;
-}
-
-static void
-enddate (iCalObject *o, char **str)
-{
- ignore_space (str);
- if (isdigit (**str)){
- o->recur->_enddate = time_from_isodate (*str);
- *str += 16;
- }
-}
-
-static int
-load_recurrence (iCalObject *o, char *str)
-{
- enum RecurType type;
- int interval = 0;
-
- type = -1;
- switch (*str++){
- case 'D':
- type = RECUR_DAILY;
- break;
-
- case 'W':
- type = RECUR_WEEKLY;
- break;
-
- case 'M':
- if (*str == 'P')
- type = RECUR_MONTHLY_BY_POS;
- else if (*str == 'D')
- type = RECUR_MONTHLY_BY_DAY;
- str++;
- break;
-
- case 'Y':
- if (*str == 'M')
- type = RECUR_YEARLY_BY_MONTH;
- else if (*str == 'D')
- type = RECUR_YEARLY_BY_DAY;
- str++;
- break;
- }
- if (type == -1)
- return 0;
-
- o->recur = g_new0 (Recurrence, 1);
- o->recur->type = type;
- ignore_space (&str);
-
- /* Get the interval */
- for (;*str && isdigit (*str);str++)
- interval = interval * 10 + (*str-'0');
-
- if (interval == 0)
- interval = 1;
-
- o->recur->interval = interval;
-
- /* this is the default per the spec */
- o->recur->duration = 2;
-
- ignore_space (&str);
-
- switch (type){
- case RECUR_DAILY:
- break;
- case RECUR_WEEKLY:
- load_recur_weekly (o, &str);
- break;
- case RECUR_MONTHLY_BY_POS:
- load_recur_monthly_pos (o, &str);
- break;
- case RECUR_MONTHLY_BY_DAY:
- load_recur_monthly_day (o, &str);
- break;
- case RECUR_YEARLY_BY_MONTH:
- load_recur_yearly_month (o, &str);
- break;
- case RECUR_YEARLY_BY_DAY:
- load_recur_yearly_day (o, &str);
- break;
- default:
- g_warning ("Unimplemented recurrence type %d", (int) type);
- break;
- }
- duration (o, &str);
- enddate (o, &str);
-
- /* Compute the enddate */
- if (o->recur->_enddate == 0){
- if (o->recur->duration != 0){
- ical_object_compute_end (o);
- } else
- o->recur->enddate = 0;
- } else {
- o->recur->enddate = o->recur->_enddate;
- }
- return 1;
-}
-
-#define is_a_prop_of(obj,prop) isAPropertyOf (obj,prop)
-#define str_val(obj) the_str = fakeCString (vObjectUStringZValue (obj))
-#define has(obj,prop) (vo = isAPropertyOf (obj, prop))
-
-/*
- * FIXME: This is loosing precission. Enhanec the thresholds
- */
-#define HOURS(n) (n*(60*60))
-
-static void
-setup_alarm_at (iCalObject *ico, CalendarAlarm *alarm, char *iso_time, VObject *vo)
-{
- time_t alarm_time = time_from_isodate (iso_time);
- time_t base = ico->dtstart;
- int d = difftime (base, alarm_time);
- VObject *a;
- char *the_str;
-
- alarm->enabled = 1;
- if (d > HOURS (2)){
- if (d > HOURS (48)){
- alarm->count = d / HOURS (24);
- alarm->units = ALARM_DAYS;
- } else {
- alarm->count = d / (60*60);
- alarm->units = ALARM_HOURS;
- }
- } else {
- alarm->count = d / 60;
- alarm->units = ALARM_MINUTES;
- }
-
- if ((a = is_a_prop_of (vo, VCSnoozeTimeProp))){
- alarm->snooze_secs = isodiff_to_secs (str_val (a));
- free (the_str);
- }
-
- if ((a = is_a_prop_of (vo, VCRepeatCountProp))){
- alarm->snooze_repeat = atoi (str_val (a));
- free (the_str);
- }
-}
-
-/*
- * Duplicates an iCalObject. Implementation is a grand hack
- */
-iCalObject *
-ical_object_duplicate (iCalObject *o)
-{
- VObject *vo;
- iCalObject *new;
-
- vo = ical_object_to_vobject (o);
- switch (o->type){
- case ICAL_EVENT:
- new = ical_object_create_from_vobject (vo, VCEventProp);
- break;
- case ICAL_TODO:
- new = ical_object_create_from_vobject (vo, VCTodoProp);
- break;
- default:
- new = NULL;
- }
-
- cleanVObject (vo);
- return new;
-}
-
-/* FIXME: we need to load the recurrence properties */
-iCalObject *
-ical_object_create_from_vobject (VObject *o, const char *object_name)
-{
- time_t now = time (NULL);
- iCalObject *ical;
- VObject *vo, *a;
- VObjectIterator i;
- char *the_str;
-
- ical = g_new0 (iCalObject, 1);
-
- if (strcmp (object_name, VCEventProp) == 0)
- ical->type = ICAL_EVENT;
- else if (strcmp (object_name, VCTodoProp) == 0)
- ical->type = ICAL_TODO;
- else {
- g_free (ical);
- return 0;
- }
-
- /* uid */
- if (has (o, VCUniqueStringProp)){
- ical->uid = g_strdup (str_val (vo));
- free (the_str);
- } else {
- ical->uid = ical_gen_uid ();
- }
-
- /* seq */
- if (has (o, VCSequenceProp)){
- ical->seq = atoi (str_val (vo));
- free (the_str);
- } else
- ical->seq = 0;
-
- /* dtstart */
- if (has (o, VCDTstartProp)){
- ical->dtstart = time_from_isodate (str_val (vo));
- free (the_str);
- } else
- ical->dtstart = 0;
-
- /* dtend */
- ical->dtend = 0; /* default value */
- if (ical->type == ICAL_EVENT){
- if (has (o, VCDTendProp)){
- ical->dtend = time_from_isodate (str_val (vo));
- free (the_str);
- }
- } else if (ical->type == ICAL_TODO){
- if (has (o, VCDueProp)){
- ical->dtend = time_from_isodate (str_val (vo));
- free (the_str);
- }
- }
-
- /* dcreated */
- if (has (o, VCDCreatedProp)){
- ical->created = time_from_isodate (str_val (vo));
- free (the_str);
- }
-
- /* completed */
- if (has (o, VCCompletedProp)){
- ical->completed = time_from_isodate (str_val (vo));
- free (the_str);
- }
-
- /* last_mod */
- if (has (o, VCLastModifiedProp)){
- ical->last_mod = time_from_isodate (str_val (vo));
- free (the_str);
- } else
- ical->last_mod = now;
-
- /* exdate */
- if (has (o, VCExpDateProp)){
- ical->exdate = set_date_list (str_val (vo));
- free (the_str);
- }
-
- /* description/comment */
- if (has (o, VCDescriptionProp)){
- ical->comment = g_strdup (str_val (vo));
- free (the_str);
- }
-
- /* summary */
- if (has (o, VCSummaryProp)){
- ical->summary = g_strdup (str_val (vo));
- free (the_str);
- } else
- ical->summary = g_strdup ("");
-
- /* status */
- if (has (o, VCStatusProp)){
- ical->status = g_strdup (str_val (vo));
- free (the_str);
- } else
- ical->status = g_strdup ("NEEDS ACTION");
-
- if (has (o, VCClassProp)){
- ical->class = g_strdup (str_val (vo));
- free (the_str);
- } else
- ical->class = "PUBLIC";
-
- /* categories */
- if (has (o, VCCategoriesProp)){
- ical->categories = set_list (str_val (vo));
- free (the_str);
- }
-
- /* resources */
- if (has (o, VCResourcesProp)){
- ical->resources = set_list (str_val (vo));
- free (the_str);
- }
-
- /* priority */
- if (has (o, VCPriorityProp)){
- ical->priority = atoi (str_val (vo));
- free (the_str);
- }
-
- /* tranparency */
- if (has (o, VCTranspProp)){
- ical->transp = atoi (str_val (vo)) ? ICAL_TRANSPARENT : ICAL_OPAQUE;
- free (the_str);
- }
-
- /* Organizer */
- if (has (o, VCOrgNameProp)){
- ical->organizer = g_strdup (str_val (vo));
- free (the_str);
- }
-
- /* related */
- if (has (o, VCRelatedToProp)){
- ical->related = set_list (str_val (vo));
- free (the_str);
- }
-
- /* attach */
- initPropIterator (&i, o);
- while (moreIteration (&i)){
- vo = nextVObject (&i);
- if (strcmp (vObjectName (vo), VCAttachProp) == 0){
- ical->attach = g_list_prepend (ical->attach, g_strdup (str_val (vo)));
- free (the_str);
- }
- }
-
- /* url */
- if (has (o, VCURLProp)){
- ical->url = g_strdup (str_val (vo));
- free (the_str);
- }
-
- /* dalarm */
- ical->dalarm.type = ALARM_DISPLAY;
- ical->dalarm.enabled = 0;
- if (has (o, VCDAlarmProp)){
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->dalarm, str_val (a), vo);
- free (the_str);
- }
- }
-
- /* aalarm */
- ical->aalarm.type = ALARM_AUDIO;
- ical->aalarm.enabled = 0;
- if (has (o, VCAAlarmProp)){
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->aalarm, str_val (a), vo);
- free (the_str);
- }
- }
-
- /* palarm */
- ical->palarm.type = ALARM_PROGRAM;
- ical->palarm.enabled = 0;
- if (has (o, VCPAlarmProp)){
- ical->palarm.type = ALARM_PROGRAM;
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->palarm, str_val (a), vo);
- free (the_str);
-
- if ((a = is_a_prop_of (vo, VCProcedureNameProp))){
- ical->palarm.data = g_strdup (str_val (a));
- free (the_str);
- } else
- ical->palarm.data = g_strdup ("");
- }
- }
-
- /* malarm */
- ical->malarm.type = ALARM_MAIL;
- ical->malarm.enabled = 0;
- if (has (o, VCMAlarmProp)){
- ical->malarm.type = ALARM_MAIL;
- if ((a = is_a_prop_of (vo, VCRunTimeProp))){
- setup_alarm_at (ical, &ical->malarm, str_val (a), vo);
- free (the_str);
-
- if ((a = is_a_prop_of (vo, VCEmailAddressProp))){
- ical->malarm.data = g_strdup (str_val (a));
- free (the_str);
- } else
- ical->malarm.data = g_strdup ("");
- }
- }
-
- /* rrule */
- if (has (o, VCRRuleProp)){
- if (!load_recurrence (ical, str_val (vo))) {
- ical_object_destroy (ical);
- return NULL;
- }
- free (the_str);
- }
-
- /*
- * Pilot
- */
- if (has (o, XPilotIdProp)){
- ical->pilot_id = atoi (str_val (vo));
- free (the_str);
- } else
- ical->pilot_id = 0;
-
- if (has (o, XPilotStatusProp)){
- ical->pilot_status = atoi (str_val (vo));
- free (the_str);
- } else
- ical->pilot_status = ICAL_PILOT_SYNC_MOD;
-
- return ical;
-}
-
-static char *
-to_str (int num)
-{
- static char buf [40];
-
- sprintf (buf, "%d", num);
- return buf;
-}
-
-/*
- * stores a GList in the property.
- */
-static void
-store_list (VObject *o, char *prop, GList *values)
-{
- GList *l;
- int len;
- char *result, *p;
-
- for (len = 0, l = values; l; l = l->next)
- len += strlen (l->data) + 1;
-
- result = g_malloc (len);
-
- for (p = result, l = values; l; l = l->next) {
- int len = strlen (l->data);
-
- strcpy (p, l->data);
-
- if (l->next) {
- p [len] = ';';
- p += len+1;
- } else
- p += len;
- }
-
- *p = 0;
-
- addPropValue (o, prop, result);
- g_free (result);
-}
-
-static void
-store_date_list (VObject *o, char *prop, GList *values)
-{
- GList *l;
- int size, len;
- char *s, *p;
-
- size = g_list_length (values);
- s = p = g_malloc ((size * 17 + 1) * sizeof (char));
-
- for (l = values; l; l = l->next){
- strcpy (s, isodate_from_time_t (*(time_t *)l->data));
- len = strlen (s);
- s [len] = ',';
- s += len + 1;
- }
- s--;
- *s = 0;
- addPropValue (o, prop, p);
- g_free (p);
-}
-
-static char *recur_type_name [] = { "D", "W", "MP", "MD", "YM", "YD" };
-static char *recur_day_list [] = { "SU", "MO", "TU","WE", "TH", "FR", "SA" };
-static char *alarm_names [] = { VCMAlarmProp, VCPAlarmProp, VCDAlarmProp, VCAAlarmProp };
-
-static VObject *
-save_alarm (VObject *o, CalendarAlarm *alarm, iCalObject *ical)
-{
- VObject *alarm_object;
- struct tm tm;
- time_t alarm_time;
-
- if (!alarm->enabled)
- return NULL;
- tm = *localtime (&ical->dtstart);
- switch (alarm->units){
- case ALARM_MINUTES:
- tm.tm_min -= alarm->count;
- break;
-
- case ALARM_HOURS:
- tm.tm_hour -= alarm->count;
- break;
-
- case ALARM_DAYS:
- tm.tm_mday -= alarm->count;
- break;
- }
-
- alarm_time = mktime (&tm);
- alarm_object = addProp (o, alarm_names [alarm->type]);
- addPropValue (alarm_object, VCRunTimeProp, isodate_from_time_t (alarm_time));
-
- if (alarm->snooze_secs)
- addPropValue (alarm_object, VCSnoozeTimeProp, isodiff_from_secs (alarm->snooze_secs));
- else
- addPropValue (alarm_object, VCSnoozeTimeProp, "");
-
- if (alarm->snooze_repeat){
- char buf [20];
-
- sprintf (buf, "%d", alarm->snooze_repeat);
- addPropValue (alarm_object, VCRepeatCountProp, buf);
- } else
- addPropValue (alarm_object, VCRepeatCountProp, "");
- return alarm_object;
-}
-
-VObject *
-ical_object_to_vobject (iCalObject *ical)
-{
- VObject *o, *alarm, *s;
- GList *l;
-
- if (ical->type == ICAL_EVENT)
- o = newVObject (VCEventProp);
- else
- o = newVObject (VCTodoProp);
-
- /* uid */
- if (ical->uid)
- addPropValue (o, VCUniqueStringProp, ical->uid);
-
- /* seq */
- addPropValue (o, VCSequenceProp, to_str (ical->seq));
-
- /* dtstart */
- addPropValue (o, VCDTstartProp, isodate_from_time_t (ical->dtstart));
-
- /* dtend */
- if (ical->type == ICAL_EVENT){
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend));
- } else if (ical->type == ICAL_TODO){
- addPropValue (o, VCDueProp, isodate_from_time_t (ical->dtend));
- }
-
- /* dcreated */
- addPropValue (o, VCDCreatedProp, isodate_from_time_t (ical->created));
-
- /* completed */
- if (ical->completed)
- addPropValue (o, VCDTendProp, isodate_from_time_t (ical->completed));
-
- /* last_mod */
- addPropValue (o, VCLastModifiedProp, isodate_from_time_t (ical->last_mod));
-
- /* exdate */
- if (ical->exdate)
- store_date_list (o, VCExpDateProp, ical->exdate);
-
- /* description/comment */
- if (ical->comment && strlen (ical->comment)){
- s = addPropValue (o, VCDescriptionProp, ical->comment);
- if (strchr (ical->comment, '\n'))
- addProp (s, VCQuotedPrintableProp);
- }
-
- /* summary */
- if (strlen (ical->summary)){
- s = addPropValue (o, VCSummaryProp, ical->summary);
- if (strchr (ical->summary, '\n'))
- addProp (s, VCQuotedPrintableProp);
- } else {
- addPropValue (o, VCSummaryProp, _("Appointment"));
- }
-
- /* status */
- addPropValue (o, VCStatusProp, ical->status);
-
- /* class */
- addPropValue (o, VCClassProp, ical->class);
-
- /* categories */
- if (ical->categories)
- store_list (o, VCCategoriesProp, ical->categories);
-
- /* resources */
- if (ical->resources)
- store_list (o, VCCategoriesProp, ical->resources);
-
- /* priority */
- addPropValue (o, VCPriorityProp, to_str (ical->priority));
-
- /* transparency */
- addPropValue (o, VCTranspProp, to_str (ical->transp));
-
- /* Owenr/organizer */
- if (ical->organizer)
- addPropValue (o, VCOrgNameProp, ical->organizer);
-
- /* related */
- if (ical->related)
- store_list (o, VCRelatedToProp, ical->related);
-
- /* attach */
- for (l = ical->attach; l; l = l->next)
- addPropValue (o, VCAttachProp, l->data);
-
- /* url */
- if (ical->url)
- addPropValue (o, VCURLProp, ical->url);
-
- if (ical->recur){
- char result [256];
- char buffer [80];
- int i;
-
- sprintf (result, "%s%d ", recur_type_name [ical->recur->type], ical->recur->interval);
- switch (ical->recur->type){
- case RECUR_DAILY:
- break;
-
- case RECUR_WEEKLY:
- for (i = 0; i < 7; i++){
- if (ical->recur->weekday & (1 << i)){
- sprintf (buffer, "%s ", recur_day_list [i]);
- strcat (result, buffer);
- }
- }
- break;
-
- case RECUR_MONTHLY_BY_POS: {
- int nega = ical->recur->u.month_pos < 0;
-
- sprintf (buffer, "%d%s ", nega ? -ical->recur->u.month_pos : ical->recur->u.month_pos,
- nega ? "-" : "+");
- strcat (result, buffer);
- /* the gui is set up for a single day, not a set here in this case */
- sprintf (buffer, "%s ", recur_day_list [ical->recur->weekday]);
- strcat (result, buffer);
- }
- break;
-
- case RECUR_MONTHLY_BY_DAY:
- sprintf (buffer, "%d ", ical->recur->u.month_pos);
- strcat (result, buffer);
- break;
-
- case RECUR_YEARLY_BY_MONTH:
- break;
-
- case RECUR_YEARLY_BY_DAY:
- break;
- }
- if (ical->recur->_enddate == 0)
- sprintf (buffer, "#%d ",ical->recur->duration);
- else
- sprintf (buffer, "%s ", isodate_from_time_t (ical->recur->_enddate));
- strcat (result, buffer);
- addPropValue (o, VCRRuleProp, result);
- }
-
- save_alarm (o, &ical->aalarm, ical);
- save_alarm (o, &ical->dalarm, ical);
-
- if ((alarm = save_alarm (o, &ical->palarm, ical)))
- addPropValue (alarm, VCProcedureNameProp, ical->palarm.data);
- if ((alarm = save_alarm (o, &ical->malarm, ical)))
- addPropValue (alarm, VCEmailAddressProp, ical->malarm.data);
-
- /* Pilot */
- {
- char buffer [20];
-
- sprintf (buffer, "%d", ical->pilot_id);
- addPropValue (o, XPilotIdProp, buffer);
- sprintf (buffer, "%d", ical->pilot_status);
- addPropValue (o, XPilotStatusProp, buffer);
- }
-
- return o;
-}
-
-void
-ical_foreach (GList *events, calendarfn fn, void *closure)
-{
- for (; events; events = events->next){
- iCalObject *ical = events->data;
-
- (*fn) (ical, ical->dtstart, ical->dtend, closure);
- }
-}
-
-static int
-is_date_in_list (GList *list, struct tm *date)
-{
- struct tm tm;
-
- for (; list; list = list->next){
- time_t *timep = list->data;
-
- tm = *localtime (timep);
- if (date->tm_mday == tm.tm_mday &&
- date->tm_mon == tm.tm_mon &&
- date->tm_year == tm.tm_year){
- return 1;
- }
- }
- return 0;
-}
-
-static int
-generate (iCalObject *ico, time_t reference, calendarfn cb, void *closure)
-{
- struct tm dt_start, dt_end, ref;
- time_t s_t, e_t;
-
- dt_start = *localtime (&ico->dtstart);
- dt_end = *localtime (&ico->dtend);
- ref = *localtime (&reference);
-
- dt_start.tm_mday = ref.tm_mday;
- dt_start.tm_mon = ref.tm_mon;
- dt_start.tm_year = ref.tm_year;
-
- dt_end.tm_mday = ref.tm_mday;
- dt_end.tm_mon = ref.tm_mon;
- dt_end.tm_year = ref.tm_year;
-
-
- if (ref.tm_isdst > dt_start.tm_isdst){
- dt_start.tm_hour--;
- dt_end.tm_hour--;
- } else if (ref.tm_isdst < dt_start.tm_isdst){
- dt_start.tm_hour++;
- dt_end.tm_hour++;
- }
-
- s_t = mktime (&dt_start);
-
- if (ico->exdate && is_date_in_list (ico->exdate, &dt_start))
- return 1;
-
- e_t = mktime (&dt_end);
-
- if ((s_t == -1) || (e_t == -1)) {
- g_warning ("Produced invalid dates!\n");
- return 0;
- }
-
- return (*cb) (ico, s_t, e_t, closure);
-}
-
-int
-ical_object_get_first_weekday (int weekday_mask)
-{
- int i;
-
- for (i = 0; i < 7; i++)
- if (weekday_mask & (1 << i))
- return i;
-
- return -1;
-}
-
-#define time_in_range(t, a, b) ((t >= a) && (b ? (t < b) : 1))
-#define recur_in_range(t, r) (r->enddate ? (t < r->enddate) : 1)
-
-/*
- * Generate every possible event. Invokes the callback routine for
- * every occurrence of the event in the [START, END] time interval.
- *
- * If END is zero, the event is generated forever.
- * The callback routine is expected to return 0 when no further event
- * generation is requested.
- */
-void
-ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure)
-{
- time_t current;
- int first_week_day;
-
- /* If there is no recurrence, just check ranges */
-
- if (!ico->recur) {
- if ((end && (ico->dtstart < end) && (ico->dtend > start))
- || ((end == 0) && (ico->dtend > start))) {
- time_t ev_s, ev_e;
-
- /* Clip range */
-
- ev_s = MAX (ico->dtstart, start);
- ev_e = MIN (ico->dtend, end);
-
- (* cb) (ico, ev_s, ev_e, closure);
- }
- return;
- }
-
- /* The event has a recurrence rule -- check that we will generate at least one instance */
-
- if (end != 0) {
- if (ico->dtstart > end)
- return;
-
- if (!IS_INFINITE (ico->recur) && (ico->recur->enddate < start))
- return;
- }
-
- /* Generate the instances */
-
- current = ico->dtstart;
-
- switch (ico->recur->type) {
- case RECUR_DAILY:
- do {
- if (time_in_range (current, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, current, cb, closure))
- return;
-
- /* Advance */
-
- current = time_add_day (current, ico->recur->interval);
-
- if (current == -1) {
- g_warning ("RECUR_DAILY: time_add_day() returned invalid time");
- return;
- }
- } while ((current < end) || (end == 0));
-
- break;
-
- case RECUR_WEEKLY:
- do {
- struct tm tm;
-
- tm = *localtime (&current);
-
- if (time_in_range (current, start, end) && recur_in_range (current, ico->recur)) {
- /* Weekdays to recur on are specified as a bitmask */
- if (ico->recur->weekday & (1 << tm.tm_wday)) {
- if (!generate (ico, current, cb, closure))
- return;
- }
- }
-
- /* Advance by day for scanning the week or by interval at week end */
-
- if (tm.tm_wday == 6)
- current = time_add_day (current, (ico->recur->interval - 1) * 7 + 1);
- else
- current = time_add_day (current, 1);
-
- if (current == -1) {
- g_warning ("RECUR_WEEKLY: time_add_day() returned invalid time\n");
- return;
- }
- } while (current < end || (end == 0));
-
- break;
-
- case RECUR_MONTHLY_BY_POS:
- /* FIXME: We only deal with positives now */
- if (ico->recur->u.month_pos < 0) {
- g_warning ("RECUR_MONTHLY_BY_POS does not support negative positions yet");
- return;
- }
-
- if (ico->recur->u.month_pos == 0)
- return;
-
- first_week_day = /* ical_object_get_first_weekday (ico->recur->weekday); */
- ico->recur->weekday; /* the i/f only lets you choose a single day of the week! */
-
- /* This should not happen, but take it into account */
- if (first_week_day == -1) {
- g_warning ("ical_object_get_first_weekday() returned -1");
- return;
- }
-
- do {
- struct tm tm;
- time_t t;
- int week_day_start;
-
- tm = *localtime (&current);
- tm.tm_mday = 1;
- t = mktime (&tm);
- tm = *localtime (&t);
- week_day_start = tm.tm_wday;
-
- tm.tm_mday = (7 * (ico->recur->u.month_pos - ((week_day_start <= first_week_day ) ? 1 : 0))
- - (week_day_start - first_week_day) + 1);
- if( tm.tm_mday > 31 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
-
- switch( tm.tm_mon )
- {
- case 3:
- case 5:
- case 8:
- case 10:
- if( tm.tm_mday > 30 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
- break;
- case 1:
- if( ((tm.tm_year+1900)%4) == 0
- && ((tm.tm_year+1900)%400) != 100
- && ((tm.tm_year+1900)%400) != 200
- && ((tm.tm_year+1900)%400) != 300 )
- {
-
- if( tm.tm_mday > 29 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
- }
- else
- {
- if( tm.tm_mday > 28 )
- {
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
- continue;
- }
- }
- break;
- }
-
- t = mktime (&tm);
-
- if (time_in_range (t, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, t, cb, closure))
- return;
-
- /* Advance by the appropriate number of months */
-
- current = mktime (&tm);
-
- tm.tm_mday = 1;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
-
- if (current == -1) {
- g_warning ("RECUR_MONTHLY_BY_DAY: mktime error\n");
- return;
- }
- } while ((current < end) || (end == 0));
-
- break;
-
- case RECUR_MONTHLY_BY_DAY:
- do {
- struct tm tm;
- time_t t;
- int p;
-
- tm = *localtime (&current);
-
- p = tm.tm_mday;
- tm.tm_mday = ico->recur->u.month_day;
- t = mktime (&tm);
- if (time_in_range (t, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, t, cb, closure))
- return;
-
- /* Advance by the appropriate number of months */
-
- tm.tm_mday = p;
- tm.tm_mon += ico->recur->interval;
- current = mktime (&tm);
-
- if (current == -1) {
- g_warning ("RECUR_MONTHLY_BY_DAY: mktime error\n");
- return;
- }
- } while (current < end || (end == 0));
-
- break;
-
- case RECUR_YEARLY_BY_MONTH:
- case RECUR_YEARLY_BY_DAY:
- do {
- if (time_in_range (current, start, end) && recur_in_range (current, ico->recur))
- if (!generate (ico, current, cb, closure))
- return;
-
- /* Advance */
-
- current = time_add_year (current, ico->recur->interval);
- } while (current < end || (end == 0));
-
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-static int
-duration_callback (iCalObject *ico, time_t start, time_t end, void *closure)
-{
- int *count = closure;
- struct tm tm;
-
- tm = *localtime (&start);
-
- (*count)++;
- if (ico->recur->duration == *count) {
- ico->recur->enddate = time_day_end (end);
- return 0;
- }
- return 1;
-}
-
-/* Computes ico->recur->enddate from ico->recur->duration */
-void
-ical_object_compute_end (iCalObject *ico)
-{
- int count = 0;
-
- g_return_if_fail (ico->recur != NULL);
-
- ico->recur->_enddate = 0;
- ico->recur->enddate = 0;
- ical_object_generate_events (ico, ico->dtstart, 0, duration_callback, &count);
-}
-
-int
-alarm_compute_offset (CalendarAlarm *a)
-{
- if (!a->enabled)
- return -1;
- switch (a->units){
- case ALARM_MINUTES:
- a->offset = a->count * 60;
- break;
- case ALARM_HOURS:
- a->offset = a->count * 3600;
- break;
- case ALARM_DAYS:
- a->offset = a->count * 24 * 3600;
- }
- return a->offset;
-}
-
-iCalObject *
-ical_object_new_from_string (const char *vcal_string)
-{
- iCalObject *ical = NULL;
- VObject *cal, *event;
- VObjectIterator i;
- const char *object_name;
-
- cal = Parse_MIME (vcal_string, strlen (vcal_string));
-
- initPropIterator (&i, cal);
-
- while (moreIteration (&i)){
- event = nextVObject (&i);
-
- object_name = vObjectName (event);
-
- if (strcmp (object_name, VCEventProp) == 0){
- ical = ical_object_create_from_vobject (event, object_name);
- break;
- }
- }
-
- cleanVObject (cal);
- cleanStrTbl ();
-
- return ical;
-}
-
diff --git a/calendar/pcs/calobj.h b/calendar/pcs/calobj.h
deleted file mode 100644
index fbc92a41c5..0000000000
--- a/calendar/pcs/calobj.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Internal representation of a Calendar object. This is modeled after the
- * iCalendar/vCalendar specificiation
- *
- * Authors: Miguel de Icaza (miguel@gnu.org)
- * Federico Mena (quartic@gimp.org).
- */
-#ifndef CALOBJ_H
-#define CALOBJ_H
-
-#include <libgnome/libgnome.h>
-#include "../libversit/vcc.h"
-
-BEGIN_GNOME_DECLS
-
-enum AlarmType {
- ALARM_MAIL,
- ALARM_PROGRAM,
- ALARM_DISPLAY,
- ALARM_AUDIO
-};
-
-enum AlarmUnit {
- ALARM_MINUTES,
- ALARM_HOURS,
- ALARM_DAYS
-};
-
-typedef struct {
- enum AlarmType type;
- int enabled;
- int count;
- enum AlarmUnit units;
- char *data;
-
- /* Does not get saved, internally used */
- time_t offset;
- time_t trigger;
-
- int snooze_secs;
- int snooze_repeat;
-
- /* Widgets */
- void *w_count; /* A GtkEntry */
- void *w_enabled; /* A GtkChecButton */
- void *w_timesel; /* A GtkMenu */
- void *w_entry; /* A GnomeEntryFile/GtkEntry for PROGRAM/MAIL */
- void *w_label;
-} CalendarAlarm;
-
-/* Calendar object type */
-typedef enum {
- ICAL_EVENT,
- ICAL_TODO,
- ICAL_JOURNAL,
- ICAL_FBREQUEST,
- ICAL_FBREPLY,
- ICAL_BUSYTIME,
- ICAL_TIMEZONE
-} iCalType;
-
-/* For keys that might contain binary or text/binary */
-typedef struct {
- char *data;
- int len;
-} iCalValue;
-
-typedef enum {
- ICAL_PILOT_SYNC_NONE = 0,
- ICAL_PILOT_SYNC_MOD = 1,
- ICAL_PILOT_SYNC_DEL = 3
-} iCalPilotState;
-
-typedef struct {
- int valid; /* true if the Geography was specified */
- double latitude;
- double longitude;
-} iCalGeo;
-
-typedef enum {
- ICAL_OPAQUE,
- ICAL_TRANSPARENT
-} iCalTransp;
-
-typedef char NotYet;
-
-enum RecurType {
- RECUR_DAILY,
- RECUR_WEEKLY,
- RECUR_MONTHLY_BY_POS,
- RECUR_MONTHLY_BY_DAY,
- RECUR_YEARLY_BY_MONTH,
- RECUR_YEARLY_BY_DAY,
-};
-
-#define DAY_LASTDAY 10000
-
-typedef struct {
- enum RecurType type;
-
- int interval;
-
- /* Used for recur computation */
- time_t enddate; /* If the value is zero, it is an infinite event
- * otherwise, it is either the _enddate value (if
- * this is what got specified) or it is our computed
- * ending date (computed from the duration item).
- */
-
- int weekday;
-
- union {
- int month_pos;
- int month_day;
- } u;
-
- int duration;
- time_t _enddate; /* As found on the vCalendar file */
- int __count;
-} Recurrence;
-
-#define IS_INFINITE(r) (r->duration == 0)
-
-/* Flags to indicate what has changed in an object */
-typedef enum {
- CHANGE_NEW = 1 << 0, /* new object */
- CHANGE_SUMMARY = 1 << 1, /* summary */
- CHANGE_DATES = 1 << 2, /* dtstart / dtend */
- CHANGE_ALL = CHANGE_SUMMARY | CHANGE_DATES
-} CalObjectChange;
-
-/*
- * This describes an iCalendar object, note that we never store durations, instead we
- * always compute the end time computed from the start + duration.
- */
-typedef struct {
- iCalType type;
-
- GList *attach; /* type: one or more URIs or binary data */
- GList *attendee; /* type: CAL-ADDRESS */
- GList *categories; /* type: one or more TEXT */
- char *class;
-
- char *comment; /* we collapse one or more TEXTs into one */
- time_t completed;
- time_t created;
- GList *contact; /* type: one or more TEXT */
- time_t dtstamp;
- time_t dtstart;
- time_t dtend;
- GList *exdate; /* type: one or more time_t's */
- GList *exrule; /* type: one or more RECUR */
- iCalGeo geo;
- time_t last_mod;
- char *location;
- char *organizer;
- int percent;
- int priority;
- char *rstatus; /* request status for freebusy */
- GList *related; /* type: one or more TEXT */
- GList *resources; /* type: one or more TEXT */
- GList *rdate; /* type: one or more recurrence date */
- GList *rrule; /* type: one or more recurrence rules */
- int seq;
- char *status;
- char *summary;
- iCalTransp transp;
- char *uid;
- char *url;
- time_t recurid;
-
- CalendarAlarm dalarm;
- CalendarAlarm aalarm;
- CalendarAlarm palarm;
- CalendarAlarm malarm;
-
- Recurrence *recur;
-
- int new;
- void *user_data; /* Generic data pointer */
-
- /* Pilot */
- iCalPilotState pilot_status; /* Status information */
- guint32 pilot_id; /* Pilot ID */
-} iCalObject;
-
-/* The callback for the recurrence generator */
-typedef int (*calendarfn) (iCalObject *, time_t, time_t, void *);
-
-iCalObject *ical_new (char *comment, char *organizer, char *summary);
-iCalObject *ical_object_new (void);
-iCalObject *ical_object_new_from_string (const char *vcalendar_string);
-void ical_object_destroy (iCalObject *ico);
-iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);
-VObject *ical_object_to_vobject (iCalObject *ical);
-iCalObject *ical_object_duplicate (iCalObject *o);
-void ical_foreach (GList *events, calendarfn fn, void *closure);
-void ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure);
-void ical_object_add_exdate (iCalObject *o, time_t t);
-
-/* Computes the enddate field of the recurrence based on the duration */
-void ical_object_compute_end (iCalObject *ico);
-
-/* Returns the first toggled day in a weekday mask -- we do this because we do not support multiple
- * days on a monthly-by-pos recurrence. If no days are toggled, it returns -1.
- */
-int ical_object_get_first_weekday (int weekday_mask);
-
-/* Returns the number of seconds configured to trigger the alarm in advance to an event */
-int alarm_compute_offset (CalendarAlarm *a);
-
-END_GNOME_DECLS
-
-#endif
-
diff --git a/calendar/popup-menu.c b/calendar/popup-menu.c
deleted file mode 100644
index 3686183146..0000000000
--- a/calendar/popup-menu.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Popup menu utilities for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#include <config.h>
-#include <gnome.h>
-#include "popup-menu.h"
-
-
-void
-popup_menu (struct menu_item *items, int nitems, GdkEventButton *event)
-{
- GtkWidget *menu;
- GtkWidget *item;
- int i;
-
- menu = gtk_menu_new (); /* FIXME: this baby is never freed */
-
- for (i = 0; i < nitems; i++) {
- if (items[i].text) {
- item = gtk_menu_item_new_with_label (_(items[i].text));
- gtk_signal_connect (GTK_OBJECT (item), "activate",
- items[i].callback,
- items[i].data);
- gtk_widget_set_sensitive (item, items[i].sensitive);
- } else
- item = gtk_menu_item_new ();
-
- gtk_widget_show (item);
- gtk_menu_append (GTK_MENU (menu), item);
- }
-
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button, event->time);
-}
diff --git a/calendar/popup-menu.h b/calendar/popup-menu.h
deleted file mode 100644
index a4590dbb98..0000000000
--- a/calendar/popup-menu.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Popup menu utilities for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef POPUP_MENU_H
-#define POPUP_MENU_H
-
-#include <gdk/gdktypes.h>
-#include <gtk/gtksignal.h>
-
-
-struct menu_item {
- char *text;
- GtkSignalFunc callback;
- gpointer data;
- int sensitive;
-};
-
-void popup_menu (struct menu_item *items, int nitems, GdkEventButton *event);
-
-
-#endif
diff --git a/calendar/prop.c b/calendar/prop.c
deleted file mode 100644
index 6f2fec605b..0000000000
--- a/calendar/prop.c
+++ /dev/null
@@ -1,927 +0,0 @@
-/* Calendar properties dialog box
- *
- * Copyright (C) 1998 the Free Software Foundation
- *
- * Authors: Miguel de Icaza <miguel@kernel.org>
- * Federico Mena <federico@nuclecu.unam.mx>
- */
-#include <config.h>
-#ifdef HAVE_LANGINGO_H
-#include <langinfo.h>
-#else
-#include <locale.h>
-#endif
-#include <gnome.h>
-#include "gnome-cal.h"
-#include "gnome-month-item.h"
-#include "main.h"
-#include "mark.h"
-
-/* These specify the page numbers in the preferences notebook */
-enum {
- PROP_TIME_DISPLAY,
- PROP_COLORS,
- PROP_TODO,
- PROP_ALARMS
-};
-
-static GtkWidget *prop_win; /* The preferences dialog */
-
-/* Widgets for the time display page */
-
-static GtkWidget *time_format_12; /* Radio button for 12-hour format */
-static GtkWidget *time_format_24; /* Radio button for 24-hour format */
-static GtkWidget *start_on_sunday; /* Check button for weeks starting on Sunday */
-static GtkWidget *start_on_monday; /* Check button for weeks starting on Monday */
-static GtkWidget *start_omenu; /* Option menu for start of day */
-static GtkWidget *end_omenu; /* Option menu for end of day */
-static GtkWidget *start_items[24]; /* Menu items for start of day menu */
-static GtkWidget *end_items[24]; /* Menu items for end of day menu */
-
-/* Widgets for the colors page */
-
-static GtkWidget *color_pickers[COLOR_PROP_LAST];
-static GnomeCanvasItem *month_item;
-
-/* Widgets for the todo page */
-static GtkWidget *due_date_show_button;
-
-static GtkWidget *todo_item_time_remaining_show_button;
-
-static GtkWidget *todo_item_highlight_overdue;
-static GtkWidget *todo_item_highlight_not_due_yet;
-static GtkWidget *todo_item_highlight_due_today;
-
-static GtkWidget *priority_show_button;
-
-/* Widgets for the alarm page */
-static GtkWidget *enable_display_beep;
-static GtkWidget *to_cb;
-static GtkWidget *to_spin;
-static GtkWidget *snooze_cb;
-static GtkWidget *snooze_spin;
-
-/* prototypes */
-static void prop_apply_alarms (void);
-static void create_alarm_page (void);
-static void to_cb_changed (GtkWidget* object, gpointer data);
-static void snooze_cb_changed (GtkWidget* object, gpointer data);
-
-GtkWidget* make_spin_button (int val, int low, int high);
-void ee_create_ae (GtkTable *table, char *str, CalendarAlarm *alarm,
- enum AlarmType type, int y, gboolean sens,
- GtkSignalFunc dirty_func);
-void ee_store_alarm (CalendarAlarm *alarm, enum AlarmType type);
-
-/* Callback used when the property box is closed -- just sets the prop_win variable to null. */
-static int
-prop_cancel (void)
-{
- prop_win = NULL;
- return FALSE;
-}
-
-/* Returns the index of the active item in a menu */
-static int
-get_active_index (GtkWidget *menu)
-{
- GtkWidget *active;
-
- active = gtk_menu_get_active (GTK_MENU (menu));
- return GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (active)));
-}
-
-/* Applies the settings in the time display page */
-static void
-prop_apply_time_display (void)
-{
- /* Day begin/end */
-
- day_begin = get_active_index (gtk_option_menu_get_menu (GTK_OPTION_MENU (start_omenu)));
- day_end = get_active_index (gtk_option_menu_get_menu (GTK_OPTION_MENU (end_omenu)));
- gnome_config_set_int ("/calendar/Calendar/Day start", day_begin);
- gnome_config_set_int ("/calendar/Calendar/Day end", day_end);
-
- /* Time format */
-
- am_pm_flag = GTK_TOGGLE_BUTTON (time_format_12)->active;
- gnome_config_set_bool ("/calendar/Calendar/AM PM flag", am_pm_flag);
-
- /* Week start */
-
- week_starts_on_monday = GTK_TOGGLE_BUTTON (start_on_monday)->active;
- gnome_config_set_bool ("/calendar/Calendar/Week starts on Monday", week_starts_on_monday);
-
- gnome_config_sync ();
- time_format_changed ();
-}
-
-/* Applies the settings in the colors page */
-static void
-prop_apply_colors (void)
-{
- int i;
- char *cspec;
- gushort r, g, b;
-
- for (i = 0; i < COLOR_PROP_LAST; i++) {
- gnome_color_picker_get_i16 (GNOME_COLOR_PICKER (color_pickers[i]), &r, &g, &b, NULL);
- color_props[i].r = r;
- color_props[i].g = g;
- color_props[i].b = b;
-
- cspec = build_color_spec (color_props[i].r, color_props[i].g, color_props[i].b);
- gnome_config_set_string (color_props[i].key, cspec);
- }
-
- gnome_config_sync ();
- colors_changed ();
-}
-/* Applies the settings in the todo page (FIX THIS IF ITS NOT WRITTEN) */
-static void
-prop_apply_todo(void)
-{
- todo_show_due_date = GTK_TOGGLE_BUTTON (due_date_show_button)->active;
-
- todo_item_dstatus_highlight_overdue = GTK_TOGGLE_BUTTON(todo_item_highlight_overdue)->active;
- todo_item_dstatus_highlight_not_due_yet = GTK_TOGGLE_BUTTON(todo_item_highlight_not_due_yet)->active;
- todo_item_dstatus_highlight_due_today = GTK_TOGGLE_BUTTON(todo_item_highlight_due_today)->active;
-
- todo_show_priority = GTK_TOGGLE_BUTTON (priority_show_button)->active;
-
- todo_show_time_remaining = GTK_TOGGLE_BUTTON (todo_item_time_remaining_show_button)->active;
-
- /* storing the values */
-
- gnome_config_set_bool("/calendar/Todo/show_time_remain", todo_show_time_remaining);
- gnome_config_set_bool("/calendar/Todo/highlight_overdue", todo_item_dstatus_highlight_overdue);
-
- gnome_config_set_bool("/calendar/Todo/highlight_due_today", todo_item_dstatus_highlight_due_today);
-
- gnome_config_set_bool("/calendar/Todo/highlight_not_due_yet", todo_item_dstatus_highlight_not_due_yet);
- gnome_config_set_bool("/calendar/Todo/show_due_date", todo_show_due_date);
- gnome_config_set_bool("/calendar/Todo/show_priority", todo_show_priority);
- /* need to sync our config changes. */
- gnome_config_sync ();
-
- /* apply the current changes */
- todo_properties_changed();
-}
-
-
-/* Callback used when the Apply button is clicked. */
-static void
-prop_apply (GtkWidget *w, int page)
-{
- switch (page) {
- case PROP_TIME_DISPLAY:
- prop_apply_time_display ();
- break;
-
- case PROP_COLORS:
- prop_apply_colors ();
- break;
-
- case PROP_TODO:
- prop_apply_todo ();
- break;
-
- case PROP_ALARMS:
- prop_apply_alarms ();
- break;
-
- case -1:
- break;
-
- default:
- g_warning ("We have a loose penguin!");
- g_assert_not_reached ();
- }
-}
-
-/* Notifies the property box that the data has changed */
-static void
-prop_changed (void)
-{
- gnome_property_box_changed (GNOME_PROPERTY_BOX (prop_win));
-}
-
-/* Builds and returns a two-element radio button group surrounded by a frame. The radio buttons are
- * stored in the specified variables, and the first radio button's state is set according to the
- * specified flag value. The buttons are connected to the prop_changed() function to update the property
- * box's dirty state.
- */
-static GtkWidget *
-build_two_radio_group (char *title,
- char *radio_1_title, GtkWidget **radio_1_widget,
- char *radio_2_title, GtkWidget **radio_2_widget,
- int radio_1_value)
-{
- GtkWidget *frame;
- GtkWidget *vbox;
-
- frame = gtk_frame_new (title);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- *radio_1_widget = gtk_radio_button_new_with_label (NULL, radio_1_title);
- gtk_box_pack_start (GTK_BOX (vbox), *radio_1_widget, FALSE, FALSE, 0);
-
- *radio_2_widget = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (*radio_1_widget),
- radio_2_title);
- gtk_box_pack_start (GTK_BOX (vbox), *radio_2_widget, FALSE, FALSE, 0);
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (*radio_1_widget), radio_1_value);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (*radio_2_widget), !radio_1_value);
-
- gtk_signal_connect (GTK_OBJECT (*radio_1_widget), "toggled",
- (GtkSignalFunc) prop_changed,
- NULL);
-
- return frame;
-}
-
-/* Callback invoked when a menu item from the start/end time option menus is selected. It adjusts
- * the other menu to the proper time, if needed.
- */
-static void
-hour_activated (GtkWidget *widget, gpointer data)
-{
- int start, end;
-
- if (data == start_omenu) {
- /* Adjust the end menu */
-
- start = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (widget)));
- end = get_active_index (gtk_option_menu_get_menu (GTK_OPTION_MENU (end_omenu)));
-
- if (end < start)
- gtk_option_menu_set_history (GTK_OPTION_MENU (end_omenu), start);
- } else if (data == end_omenu) {
- /* Adjust the start menu */
-
- end = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (widget)));
- start = get_active_index (gtk_option_menu_get_menu (GTK_OPTION_MENU (start_omenu)));
-
- if (start > end)
- gtk_option_menu_set_history (GTK_OPTION_MENU (start_omenu), end);
- } else
- g_assert_not_reached ();
-
- gnome_property_box_changed (GNOME_PROPERTY_BOX (prop_win));
-}
-
-/* Builds an option menu of 24 hours */
-static GtkWidget *
-build_hours_menu (GtkWidget **items, int active)
-{
- GtkWidget *omenu;
- GtkWidget *menu;
- int i;
- char buf[100];
- struct tm tm;
- int am_pm_flag;
-
- omenu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
- am_pm_flag = GTK_TOGGLE_BUTTON (time_format_12)->active;
-
- memset (&tm, 0, sizeof (tm));
-
- for (i = 0; i < 24; i++) {
- tm.tm_hour = i;
- if (am_pm_flag)
- strftime (buf, 100, "%I:%M %p", &tm);
- else
- strftime (buf, 100, "%H:%M", &tm);
-
- items[i] = gtk_menu_item_new_with_label (buf);
- gtk_object_set_user_data (GTK_OBJECT (items[i]), GINT_TO_POINTER (i));
- gtk_signal_connect (GTK_OBJECT (items[i]), "activate",
- (GtkSignalFunc) hour_activated,
- omenu);
-
- gtk_menu_append (GTK_MENU (menu), items[i]);
- gtk_widget_show (items[i]);
- }
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), active);
- return omenu;
-}
-
-/* Creates the time display page in the preferences dialog */
-static void
-create_time_display_page (void)
-{
- GtkWidget *table;
- GtkWidget *vbox;
- GtkWidget *frame;
- GtkWidget *hbox2;
- GtkWidget *hbox3;
- GtkWidget *w;
-
- table = gtk_table_new (2, 2, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (table), GNOME_PAD_SMALL);
- gtk_table_set_row_spacings (GTK_TABLE (table), GNOME_PAD_SMALL);
- gtk_table_set_col_spacings (GTK_TABLE (table), GNOME_PAD_SMALL);
- gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop_win), table,
- gtk_label_new (_("Time display")));
-
- /* Time format */
-
- w = build_two_radio_group (_("Time format"),
- _("12-hour (AM/PM)"), &time_format_12,
- _("24-hour"), &time_format_24,
- am_pm_flag);
- gtk_table_attach (GTK_TABLE (table), w,
- 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
-
- /* Weeks start on */
-
- w = build_two_radio_group (_("Weeks start on"),
- _("Sunday"), &start_on_sunday,
- _("Monday"), &start_on_monday,
- !week_starts_on_monday);
- gtk_table_attach (GTK_TABLE (table), w,
- 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
-
- /* Day range */
-
- frame = gtk_frame_new (_("Day range"));
- gtk_table_attach (GTK_TABLE (table), frame,
- 1, 2, 0, 2,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
-
- vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- w = gtk_label_new (_("Please select the start and end hours you want\n"
- "to be displayed in the day view and week view.\n"
- "Times outside this range will not be displayed\n"
- "by default."));
- gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_LEFT);
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.0);
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
-
- hbox2 = gtk_hbox_new (FALSE, GNOME_PAD);
- gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
-
- /* Day start */
-
- hbox3 = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
- gtk_box_pack_start (GTK_BOX (hbox2), hbox3, FALSE, FALSE, 0);
-
- w = gtk_label_new (_("Day start:"));
- gtk_box_pack_start (GTK_BOX (hbox3), w, FALSE, FALSE, 0);
-
- start_omenu = build_hours_menu (start_items, day_begin);
- gtk_box_pack_start (GTK_BOX (hbox3), start_omenu, FALSE, FALSE, 0);
-
- /* Day end */
-
- hbox3 = gtk_hbox_new (FALSE, GNOME_PAD_SMALL);
- gtk_box_pack_start (GTK_BOX (hbox2), hbox3, FALSE, FALSE, 0);
-
- w = gtk_label_new (_("Day end:"));
- gtk_box_pack_start (GTK_BOX (hbox3), w, FALSE, FALSE, 0);
-
- end_omenu = build_hours_menu (end_items, day_end);
- gtk_box_pack_start (GTK_BOX (hbox3), end_omenu, FALSE, FALSE, 0);
-}
-
-/* Called when the canvas for the month item is size allocated. We use this to change the canvas'
- * scrolling region and the month item's size.
- */
-static void
-canvas_size_allocate (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
-{
- gnome_canvas_item_set (month_item,
- "width", (double) (allocation->width - 1),
- "height", (double) (allocation->height - 1),
- NULL);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (widget),
- 0, 0,
- allocation->width, allocation->height);
-}
-
-/* Returns a color spec based on the color pickers */
-static char *
-color_spec_from_picker (int num)
-{
- gushort r, g, b;
-
- gnome_color_picker_get_i16 (GNOME_COLOR_PICKER (color_pickers[num]), &r, &g, &b, NULL);
-
- return build_color_spec (r, g, b);
-}
-
-/* Callback used to query color information for the properties box */
-static char *
-fetch_color_spec (ColorProp propnum, gpointer data)
-{
- return color_spec_from_picker (propnum);
-}
-
-/* Marks fake event days in the month item sample */
-static void
-fake_mark_days (void)
-{
- static int day_nums[] = { 1, 4, 8, 16, 17, 18, 20, 25, 28 }; /* some random days */
- int first_day_index;
- int i;
-
- first_day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (month_item), 1);
-
- for (i = 0; i < (sizeof (day_nums) / sizeof (day_nums[0])); i++)
- mark_month_item_index (GNOME_MONTH_ITEM (month_item), first_day_index + day_nums[i] - 1,
- fetch_color_spec, NULL);
-}
-
-/* Switches the month item to the current date and highlights the current day's number */
-static void
-set_current_day (void)
-{
- struct tm tm;
- time_t t;
- GnomeCanvasItem *item;
- int day_index;
-
- /* Set the date */
-
- t = time (NULL);
- tm = *localtime (&t);
-
- gnome_canvas_item_set (month_item,
- "year", tm.tm_year + 1900,
- "month", tm.tm_mon,
- NULL);
-
- /* Highlight current day */
-
- day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (month_item), tm.tm_mday);
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (month_item), GNOME_MONTH_ITEM_DAY_LABEL + day_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_picker (COLOR_PROP_CURRENT_DAY_FG),
- "fontset", CURRENT_DAY_FONTSET,
- NULL);
-}
-
-/* This is the version of a color spec query function that is appropriate for the preferences dialog */
-static char *
-prop_color_func (ColorProp propnum, gpointer data)
-{
- return color_spec_from_picker (propnum);
-}
-
-/* Sets the colors of the month item to the current prerences */
-static void
-reconfigure_month (void)
-{
- colorify_month_item (GNOME_MONTH_ITEM (month_item), prop_color_func, NULL);
- fake_mark_days ();
- set_current_day ();
-
- /* Reset prelighting information */
-
- month_item_prepare_prelight (GNOME_MONTH_ITEM (month_item), fetch_color_spec, NULL);
-}
-
-/* Callback used when a color is changed */
-static void
-color_set (void)
-{
- reconfigure_month ();
- prop_changed ();
-}
-
-/* Creates the colors page in the preferences dialog */
-static void
-create_colors_page (void)
-{
- GtkWidget *frame;
- GtkWidget *hbox;
- GtkWidget *table;
- GtkWidget *w;
- int i;
-
- frame = gtk_frame_new (_("Colors for display"));
- gtk_container_set_border_width (GTK_CONTAINER (frame), GNOME_PAD_SMALL);
- gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop_win), frame,
- gtk_label_new (_("Colors")));
-
- hbox = gtk_hbox_new (FALSE, GNOME_PAD);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (frame), hbox);
-
- table = gtk_table_new (COLOR_PROP_LAST, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), GNOME_PAD_SMALL);
- gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
-
- /* Create the color pickers */
-
- for (i = 0; i < COLOR_PROP_LAST; i++) {
- /* Label */
-
- w = gtk_label_new (_(color_props[i].label));
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (table), w,
- 0, 1, i, i + 1,
- GTK_FILL, 0,
- 0, 0);
-
- /* Color picker */
-
- color_pickers[i] = gnome_color_picker_new ();
- gnome_color_picker_set_title (GNOME_COLOR_PICKER (color_pickers[i]), _(color_props[i].label));
- gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (color_pickers[i]),
- color_props[i].r, color_props[i].g, color_props[i].b, 0);
- gtk_table_attach (GTK_TABLE (table), color_pickers[i],
- 1, 2, i, i + 1,
- 0, 0,
- 0, 0);
- gtk_signal_connect (GTK_OBJECT (color_pickers[i]), "color_set",
- (GtkSignalFunc) color_set,
- NULL);
- }
-
- /* Create the sample calendar */
-
- w = gnome_canvas_new ();
- gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
-
- month_item = gnome_month_item_new (gnome_canvas_root (GNOME_CANVAS (w)));
- gnome_canvas_item_set (month_item,
- "start_on_monday", week_starts_on_monday,
- NULL);
- reconfigure_month ();
-
- gtk_signal_connect (GTK_OBJECT (w), "size_allocate",
- canvas_size_allocate,
- NULL);
-
-}
-
-
-static void
-set_todo_page_options(void)
-{
-
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
-}
-
-static void
-todo_option_set (void)
-{
- prop_changed ();
- set_todo_page_options ();
-}
-
-/* Creates the colors page in the preferences dialog */
-static GtkWidget *
-build_list_options_frame(void)
-{
- GtkWidget *frame;
- GtkWidget *vbox;
- frame = gtk_frame_new (_("Show on TODO List:"));
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- due_date_show_button = gtk_check_button_new_with_label (_("Due Date"));
- priority_show_button = gtk_check_button_new_with_label (_("Priority"));
- todo_item_time_remaining_show_button = gtk_check_button_new_with_label (_("Time Until Due"));
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(due_date_show_button), todo_show_due_date);
- gtk_signal_connect (GTK_OBJECT(due_date_show_button),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
- gtk_box_pack_start (GTK_BOX (vbox), due_date_show_button, FALSE, FALSE, 0);
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_time_remaining_show_button), todo_show_time_remaining);
- gtk_signal_connect (GTK_OBJECT(todo_item_time_remaining_show_button),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
- gtk_box_pack_start (GTK_BOX (vbox), todo_item_time_remaining_show_button, FALSE, FALSE, 0);
-
-
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(priority_show_button), todo_show_priority);
- gtk_signal_connect (GTK_OBJECT(priority_show_button),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
- gtk_box_pack_start (GTK_BOX (vbox), priority_show_button, FALSE, FALSE, 0);
- return frame;
-}
-static GtkWidget *
-build_style_list_options_frame(void)
-{
- GtkWidget *frame;
- GtkWidget *vbox;
-
- frame = gtk_frame_new (_("To Do List style options:"));
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- todo_item_highlight_overdue = gtk_check_button_new_with_label (_("Highlight overdue items"));
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_overdue),
- todo_item_dstatus_highlight_overdue);
- todo_item_highlight_not_due_yet = gtk_check_button_new_with_label (_("Highlight not yet due items"));
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_not_due_yet),
- todo_item_dstatus_highlight_overdue);
- todo_item_highlight_due_today = gtk_check_button_new_with_label (_("Highlight items due today"));
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(todo_item_highlight_due_today),
- todo_item_dstatus_highlight_overdue);
-
- gtk_signal_connect (GTK_OBJECT(todo_item_highlight_overdue),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
- gtk_signal_connect (GTK_OBJECT(todo_item_highlight_not_due_yet),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
- gtk_signal_connect (GTK_OBJECT(todo_item_highlight_due_today),
- "clicked",
- (GtkSignalFunc) todo_option_set,
- NULL);
-
- gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_overdue, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_due_today, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), todo_item_highlight_not_due_yet, FALSE, FALSE, 0);
- return frame;
-}
-static void
-create_todo_page (void)
-{
- GtkWidget *frame;
- GtkWidget *main_box;
- GtkWidget *hbox;
-
-
- frame = gtk_frame_new (_("To Do List Properties"));
- gtk_container_set_border_width (GTK_CONTAINER (frame), GNOME_PAD_SMALL);
- gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop_win), frame,
- gtk_label_new (_("To Do List")));
-
- /* first vbox*/
- main_box = gtk_vbox_new(FALSE, GNOME_PAD);
- gtk_container_set_border_width (GTK_CONTAINER (main_box), GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (frame), main_box);
-
-
- /* first hbox*/
- hbox = gtk_hbox_new (FALSE, GNOME_PAD);
- gtk_container_set_border_width (GTK_CONTAINER (hbox), GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (main_box), hbox);
-
- gtk_box_pack_start (GTK_BOX(hbox), build_list_options_frame(), FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(hbox), build_style_list_options_frame(), FALSE, FALSE, 0);
-
- set_todo_page_options();
-}
-
-/* Creates and displays the preferences dialog for the whole application */
-void
-properties (GtkWidget *toplevel)
-{
- static GnomeHelpMenuEntry help_entry = { NULL, "properties" };
-
- help_entry.name = gnome_app_id;
-
- if (prop_win)
- return;
-
- prop_win = gnome_property_box_new ();
- gtk_window_set_title (GTK_WINDOW (prop_win), _("Preferences"));
- gnome_dialog_set_parent (GNOME_DIALOG (prop_win), GTK_WINDOW (toplevel));
-
- create_time_display_page ();
- create_colors_page ();
- create_todo_page ();
- create_alarm_page ();
-
- gtk_signal_connect (GTK_OBJECT (prop_win), "destroy",
- (GtkSignalFunc) prop_cancel, NULL);
-
- gtk_signal_connect (GTK_OBJECT (prop_win), "delete_event",
- (GtkSignalFunc) prop_cancel, NULL);
-
- gtk_signal_connect (GTK_OBJECT (prop_win), "apply",
- (GtkSignalFunc) prop_apply, NULL);
-
- gtk_signal_connect (GTK_OBJECT (prop_win), "help",
- GTK_SIGNAL_FUNC (gnome_help_pbox_display),
- &help_entry);
-
- gtk_widget_show_all (prop_win);
-}
-
-char *
-build_color_spec (int r, int g, int b)
-{
- static char spec[100];
-
- sprintf (spec, "#%04x%04x%04x", r, g, b);
- return spec;
-}
-
-void
-parse_color_spec (char *spec, int *r, int *g, int *b)
-{
- g_return_if_fail (spec != NULL);
- g_return_if_fail (r != NULL);
- g_return_if_fail (r != NULL);
- g_return_if_fail (r != NULL);
-
- if (sscanf (spec, "#%04x%04x%04x", r, g, b) != 3) {
- g_warning ("Invalid color specification %s, returning black", spec);
-
- *r = *g = *b = 0;
- }
-}
-
-char *
-color_spec_from_prop (ColorProp propnum)
-{
- return build_color_spec (color_props[propnum].r, color_props[propnum].g, color_props[propnum].b);
-}
-
-static void
-create_alarm_page (void)
-{
- GtkWidget *main_box;
- GtkWidget *default_frame;
- GtkWidget *default_table;
- GtkWidget *misc_frame;
- GtkWidget *misc_box;
- GtkWidget *box, *l;
-
- main_box = gtk_vbox_new (FALSE, GNOME_PAD);
- gtk_container_set_border_width (GTK_CONTAINER (main_box), GNOME_PAD_SMALL);
- gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop_win),
- main_box, gtk_label_new (_("Alarms")));
-
- /* build miscellaneous box */
- misc_frame = gtk_frame_new (_("Alarm Properties"));
- gtk_container_set_border_width (GTK_CONTAINER (misc_frame),
- GNOME_PAD_SMALL);
- misc_box = gtk_vbox_new (FALSE, GNOME_PAD);
-
- gtk_container_set_border_width (GTK_CONTAINER (misc_frame), GNOME_PAD_SMALL);
- gtk_container_add (GTK_CONTAINER (misc_frame), misc_box);
-
- gtk_box_pack_start (GTK_BOX (main_box), misc_frame, FALSE, FALSE, 0);
-
- enable_display_beep = gtk_check_button_new_with_label (_("Beep on display alarms"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enable_display_beep),
- beep_on_display);
- gtk_box_pack_start (GTK_BOX (misc_box), enable_display_beep, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (enable_display_beep), "toggled",
- (GtkSignalFunc) prop_changed,
- NULL);
-
- /* audio timeout widgets */
- box = gtk_hbox_new (FALSE, GNOME_PAD);
- to_cb = gtk_check_button_new_with_label (_("Audio alarms timeout after"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (to_cb),
- enable_aalarm_timeout);
- gtk_signal_connect (GTK_OBJECT (to_cb), "toggled",
- (GtkSignalFunc) to_cb_changed, NULL);
- gtk_box_pack_start (GTK_BOX (box), to_cb, FALSE, FALSE, 0);
- to_spin = make_spin_button (audio_alarm_timeout, 1, MAX_AALARM_TIMEOUT);
- gtk_widget_set_sensitive (to_spin, enable_aalarm_timeout);
- gtk_signal_connect (GTK_OBJECT (to_spin), "changed",
- (GtkSignalFunc) prop_changed, NULL);
- gtk_box_pack_start (GTK_BOX (box), to_spin, FALSE, FALSE, 0);
- l = gtk_label_new (_(" seconds"));
- gtk_box_pack_start (GTK_BOX (box), l, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (misc_box), box, FALSE, FALSE, 0);
-
- /* snooze widgets */
- box = gtk_hbox_new (FALSE, GNOME_PAD);
- snooze_cb = gtk_check_button_new_with_label (_("Enable snoozing for "));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (snooze_cb),
- enable_snooze);
- gtk_signal_connect (GTK_OBJECT (snooze_cb), "toggled",
- (GtkSignalFunc) snooze_cb_changed, NULL);
- gtk_box_pack_start (GTK_BOX (box), snooze_cb, FALSE, FALSE, 0);
- snooze_spin = make_spin_button (snooze_secs, 1, MAX_SNOOZE_SECS);
- gtk_widget_set_sensitive (snooze_spin, enable_snooze);
- gtk_signal_connect (GTK_OBJECT (snooze_spin), "changed",
- (GtkSignalFunc) prop_changed, NULL);
- gtk_box_pack_start (GTK_BOX (box), snooze_spin, FALSE, FALSE, 0);
- l = gtk_label_new (_(" seconds"));
- gtk_box_pack_start (GTK_BOX (box), l, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (misc_box), box, FALSE, FALSE, 0);
-
- /* populate default frame/box */
- default_frame = gtk_frame_new (_("Defaults"));
- gtk_container_set_border_width (GTK_CONTAINER (default_frame), GNOME_PAD_SMALL);
- gtk_box_pack_start (GTK_BOX (main_box), default_frame, FALSE, FALSE, 0);
- default_table = gtk_table_new (1, 1, 0);
- gtk_container_set_border_width (GTK_CONTAINER (default_table), 4);
- gtk_table_set_row_spacings (GTK_TABLE (default_table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (default_table), 4);
- gtk_container_add (GTK_CONTAINER (default_frame), default_table);
-
- ee_create_ae (GTK_TABLE (default_table), _("Display"),
- &alarm_defaults [ALARM_DISPLAY], ALARM_DISPLAY, 1,
- FALSE, prop_changed);
- ee_create_ae (GTK_TABLE (default_table), _("Audio"),
- &alarm_defaults [ALARM_AUDIO], ALARM_AUDIO, 2,
- FALSE, prop_changed);
- ee_create_ae (GTK_TABLE (default_table), _("Program"),
- &alarm_defaults [ALARM_PROGRAM], ALARM_PROGRAM, 3,
- FALSE, prop_changed);
- ee_create_ae (GTK_TABLE (default_table), _("Mail"),
- &alarm_defaults [ALARM_MAIL], ALARM_MAIL, 4,
- FALSE, prop_changed);
-}
-
-static void
-prop_store_alarm_default_values (CalendarAlarm* alarm)
-{
- ee_store_alarm (alarm, alarm->type);
-
- switch (alarm->type) {
- case ALARM_DISPLAY:
- gnome_config_push_prefix ("/calendar/alarms/def_disp_");
- break;
- case ALARM_AUDIO:
- gnome_config_push_prefix ("/calendar/alarms/def_audio_");
- break;
- case ALARM_PROGRAM:
- gnome_config_push_prefix ("/calendar/alarms/def_prog_");
- break;
- case ALARM_MAIL:
- gnome_config_push_prefix ("/calendar/alarms/def_mail_");
- break;
- }
-
- gnome_config_set_int ("enabled", alarm->enabled);
- gnome_config_set_int ("count", alarm->count);
- gnome_config_set_int ("units", alarm->units);
- if (alarm->data)
- gnome_config_set_string ("data", alarm->data);
-
- gnome_config_pop_prefix ();
- gnome_config_sync ();
-}
-
-static void
-prop_apply_alarms ()
-{
- int i;
- for (i=0; i < 4; i++)
- prop_store_alarm_default_values (&alarm_defaults [i]);
-
- beep_on_display = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (enable_display_beep));
- gnome_config_set_bool ("/calendar/alarms/beep_on_display", beep_on_display);
- enable_aalarm_timeout = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (to_cb));
- gnome_config_set_bool ("/calendar/alarms/enable_audio_timeout", enable_aalarm_timeout);
- audio_alarm_timeout = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (to_spin));
- gnome_config_set_int ("/calendar/alarms/audio_alarm_timeout", audio_alarm_timeout);
- enable_snooze = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (snooze_cb));
- gnome_config_set_bool ("/calendar/alarms/enable_snooze", enable_snooze);
- snooze_secs = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (snooze_spin));
- gnome_config_set_int ("/calendar/alarms/snooze_secs", snooze_secs);
-
- gnome_config_sync();
-}
-
-static void
-to_cb_changed (GtkWidget *object, gpointer data)
-{
- gboolean active =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (to_cb));
- gtk_widget_set_sensitive (to_spin, active);
- prop_changed ();
-}
-
-static void
-snooze_cb_changed (GtkWidget *object, gpointer data)
-{
- gboolean active =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (snooze_cb));
- gtk_widget_set_sensitive (snooze_spin, active);
- prop_changed ();
-}
-
-
diff --git a/calendar/quick-view.c b/calendar/quick-view.c
deleted file mode 100644
index c23ed612c0..0000000000
--- a/calendar/quick-view.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* Quick view widget for Gnomecal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx
- */
-
-#include <config.h>
-#include "quick-view.h"
-#include "main.h"
-
-
-#define QUICK_VIEW_FONTSET "-adobe-helvetica-medium-r-normal--10-*-*-*-p-*-*-*,-cronyx-helvetica-medium-r-normal-*-11-*-*-*-p-*-koi8-r,-*-*-medium-r-normal--10-*-*-*-*-*-ksc5601.1987-0,*"
-
-
-static void quick_view_class_init (QuickViewClass *class);
-static void quick_view_init (QuickView *qv);
-
-static gint quick_view_button_release (GtkWidget *widget, GdkEventButton *event);
-static gint quick_view_map_event (GtkWidget *widget, GdkEventAny *event);
-
-
-static GtkWindowClass *parent_class;
-
-
-GtkType
-quick_view_get_type (void)
-{
- static GtkType quick_view_type = 0;
-
- if (!quick_view_type) {
- GtkTypeInfo quick_view_info = {
- "QuickView",
- sizeof (QuickView),
- sizeof (QuickViewClass),
- (GtkClassInitFunc) quick_view_class_init,
- (GtkObjectInitFunc) quick_view_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- quick_view_type = gtk_type_unique (gtk_window_get_type (), &quick_view_info);
- }
-
- return quick_view_type;
-}
-
-static void
-quick_view_class_init (QuickViewClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = gtk_type_class (gtk_window_get_type ());
-
- widget_class->button_release_event = quick_view_button_release;
- widget_class->map_event = quick_view_map_event;
-}
-
-static void
-quick_view_init (QuickView *qv)
-{
- GTK_WINDOW (qv)->type = GTK_WINDOW_POPUP;
- gtk_window_set_position (GTK_WINDOW (qv), GTK_WIN_POS_MOUSE);
-}
-
-static gint
-quick_view_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- QuickView *qv;
-
- qv = QUICK_VIEW (widget);
-
- if (event->button != qv->button)
- return FALSE;
-
- gdk_pointer_ungrab (event->time);
- gtk_grab_remove (GTK_WIDGET (qv));
- gtk_widget_hide (GTK_WIDGET (qv));
-
- gtk_main_quit (); /* End modality of the quick view */
- return TRUE;
-}
-
-static gint
-quick_view_map_event (GtkWidget *widget, GdkEventAny *event)
-{
- GdkCursor *cursor;
-
- cursor = gdk_cursor_new (GDK_ARROW);
- gdk_pointer_grab (widget->window,
- TRUE,
- GDK_BUTTON_RELEASE_MASK,
- NULL,
- cursor,
- GDK_CURRENT_TIME);
- gdk_cursor_destroy (cursor);
-
- return FALSE;
-}
-
-/* Creates the items corresponding to a single calendar object. Takes in the y position of the
- * items to create and returns the y position of the next item to create. Also takes in the current
- * maximum width for items and returns the new maximum width.
- */
-void
-create_items_for_event (QuickView *qv, CalendarObject *co, double *y, double *max_width)
-{
- GnomeCanvas *canvas;
- GnomeCanvasItem *item;
- char start[100], end[100];
- struct tm start_tm, end_tm;
- char *str;
- GtkArg args[2];
-
- /* FIXME: make this nice */
-
- canvas = GNOME_CANVAS (qv->canvas);
-
- start_tm = *localtime (&co->ev_start);
- end_tm = *localtime (&co->ev_end);
-
- if (am_pm_flag) {
- strftime (start, sizeof (start), "%I:%M%p", &start_tm);
- strftime (end, sizeof (end), "%I:%M%p", &end_tm);
- } else {
- strftime (start, sizeof (start), "%H:%M", &start_tm);
- strftime (end, sizeof (end), "%H:%M", &end_tm);
- }
-
- str = g_strconcat (start, " - ", end, " ", co->ico->summary, NULL);
-
- item = gnome_canvas_item_new (gnome_canvas_root (canvas),
- gnome_canvas_text_get_type (),
- "x", 0.0,
- "y", *y,
- "anchor", GTK_ANCHOR_NW,
- "text", str,
- "fontset", QUICK_VIEW_FONTSET,
- NULL);
-
- g_free (str);
-
- /* Measure the text and return the proper size values */
-
- args[0].name = "text_width";
- args[1].name = "text_height";
- gtk_object_getv (GTK_OBJECT (item), 2, args);
-
- if (GTK_VALUE_DOUBLE (args[0]) > *max_width)
- *max_width = GTK_VALUE_DOUBLE (args[0]);
-
- *y += GTK_VALUE_DOUBLE (args[1]);
-}
-
-/* Creates the canvas items corresponding to the events in the list */
-static void
-setup_event_list (QuickView *qv, GList *event_list)
-{
- CalendarObject *co;
- GnomeCanvasItem *item;
- GtkArg args[2];
- double y, max_width;
-
- /* If there are no events, then just put a simple label */
-
- if (!event_list) {
- item = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (qv->canvas)),
- gnome_canvas_text_get_type (),
- "x", 0.0,
- "y", 0.0,
- "anchor", GTK_ANCHOR_NW,
- "text", _("No appointments for this day"),
- "fontset", QUICK_VIEW_FONTSET,
- NULL);
-
- /* Measure the text and set the proper sizes */
-
- args[0].name = "text_width";
- args[1].name = "text_height";
- gtk_object_getv (GTK_OBJECT (item), 2, args);
-
- y = GTK_VALUE_DOUBLE (args[1]);
- max_width = GTK_VALUE_DOUBLE (args[0]);
- } else {
- /* Create the items for all the events in the list */
-
- y = 0.0;
- max_width = 0.0;
-
- for (; event_list; event_list = event_list->next) {
- co = event_list->data;
- create_items_for_event (qv, co, &y, &max_width);
- }
- }
-
- /* Set the scrolling region to fit all the items */
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (qv->canvas),
- 0.0, 0.0,
- max_width, y);
-
- gtk_widget_set_usize (qv->canvas, max_width, y);
-}
-
-GtkWidget *
-quick_view_new (GnomeCalendar *calendar, char *title, GList *event_list)
-{
- QuickView *qv;
- GtkWidget *vbox;
- GtkWidget *w;
-
- g_return_val_if_fail (calendar != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CALENDAR (calendar), NULL);
-
- qv = gtk_type_new (quick_view_get_type ());
- qv->calendar = calendar;
-
- /* Create base widgets for the popup window */
-
- w = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (w), GTK_SHADOW_ETCHED_OUT);
- gtk_container_add (GTK_CONTAINER (qv), w);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (w), vbox);
-
- w = gtk_label_new (title);
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
-
- w = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
-
- w = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
- gtk_container_set_border_width (GTK_CONTAINER (w), GNOME_PAD_SMALL);
- gtk_box_pack_start (GTK_BOX (vbox), w, TRUE, TRUE, 0);
-
- gtk_widget_push_visual (gdk_imlib_get_visual ());
- gtk_widget_push_colormap (gdk_imlib_get_colormap ());
-
- qv->canvas = gnome_canvas_new ();
-
- gtk_widget_pop_colormap ();
- gtk_widget_pop_visual ();
-
- gtk_container_add (GTK_CONTAINER (w), qv->canvas);
-
- /* Set up the event list */
-
- setup_event_list (qv, event_list);
-
- return GTK_WIDGET (qv);
-}
-
-void
-quick_view_do_popup (QuickView *qv, GdkEventButton *event)
-{
- g_return_if_fail (qv != NULL);
- g_return_if_fail (IS_QUICK_VIEW (qv));
- g_return_if_fail (event != NULL);
-
- /* Pop up the window */
-
- gtk_widget_show_all (GTK_WIDGET (qv));
- gtk_grab_add (GTK_WIDGET (qv));
-
- qv->button = event->button;
-
- gtk_main (); /* Begin modality */
-
- /* The button release event handler will call gtk_main_quit() */
-}
diff --git a/calendar/quick-view.h b/calendar/quick-view.h
deleted file mode 100644
index c6b2cf8814..0000000000
--- a/calendar/quick-view.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Quick view widget for Gnomecal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx
- */
-
-#ifndef QUICK_VIEW_H
-#define QUICK_VIEW_H
-
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define TYPE_QUICK_VIEW (quick_view_get_type ())
-#define QUICK_VIEW(obj) (GTK_CHECK_CAST ((obj), TYPE_QUICK_VIEW, QuickView))
-#define QUICK_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_QUICK_VIEW, QuickViewClass))
-#define IS_QUICK_VIEW(obj) (GTK_CHECK_TYPE ((obj), TYPE_QUICK_VIEW))
-#define IS_QUICK_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_QUICK_VIEW))
-
-
-typedef struct _QuickView QuickView;
-typedef struct _QuickViewClass QuickViewClass;
-
-struct _QuickView {
- GtkWindow window;
-
- GnomeCalendar *calendar; /* The calendar we are associated to */
-
- GtkWidget *canvas; /* The canvas that displays the contents of the quick view */
-
- int button; /* The button that was pressed to pop up the quick view */
-};
-
-struct _QuickViewClass {
- GtkWindowClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType quick_view_get_type (void);
-
-/* Creates a new quick view with the specified title and the specified event list. It is associated
- * to the specified calendar. The event list must be a list of CalendarObject structures.
- */
-GtkWidget *quick_view_new (GnomeCalendar *calendar, char *title, GList *event_list);
-
-/* Pops up the quick view widget modally and loops until the uses closes it by releasing the mouse
- * button. You can destroy the quick view when this function returns.
- */
-void quick_view_do_popup (QuickView *qv, GdkEventButton *event);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/recur.xpm b/calendar/recur.xpm
deleted file mode 100644
index 49836b62e7..0000000000
--- a/calendar/recur.xpm
+++ /dev/null
@@ -1,83 +0,0 @@
-/* XPM */
-static char * recur_xpm[] = {
-"16 16 64 1",
-" c None",
-". c #350000",
-"+ c #2A0000",
-"@ c #1B0000",
-"# c #280000",
-"$ c #430000",
-"% c #090000",
-"& c #160000",
-"* c #250000",
-"= c #460000",
-"- c #550000",
-"; c #610000",
-"> c #0D0000",
-", c #1F0000",
-"' c #4B0000",
-") c #5E0000",
-"! c #6B0000",
-"~ c #750000",
-"{ c #790000",
-"] c #810000",
-"^ c #FFFF83",
-"/ c #FFFF89",
-"( c #FFFF93",
-"_ c #8B0000",
-": c #900000",
-"< c #930000",
-"[ c #FFFF62",
-"} c #A10000",
-"| c #FFFF41",
-"1 c #FFFF3B",
-"2 c #FFFF31",
-"3 c #B70000",
-"4 c #B20000",
-"5 c #AE0000",
-"6 c #FFFF22",
-"7 c #FFFF16",
-"8 c #FFFF06",
-"9 c #C90000",
-"0 c #C10000",
-"a c #BB0000",
-"b c #FFF600",
-"c c #FFE100",
-"d c #FFC500",
-"e c #E40000",
-"f c #D70000",
-"g c #CD0000",
-"h c #FFDB00",
-"i c #FFA900",
-"j c #FF8500",
-"k c #FF5900",
-"l c #FF2800",
-"m c #FC0000",
-"n c #ED0000",
-"o c #E10000",
-"p c #FFAF00",
-"q c #FF9400",
-"r c #FF7400",
-"s c #FF5000",
-"t c #FF0100",
-"u c #F30000",
-"v c #E80000",
-"w c #FF6900",
-"x c #FF4900",
-"y c #FF0800",
-" ",
-" . ",
-" +. ",
-" @#.$ ",
-" %&*.=-; ",
-" >,.')!~ ",
-" &. !{] ",
-" ^/( . _:< ",
-" [[[ }}} ",
-" |12 345 ",
-" 678 90a ",
-" bcd efg ",
-" hdijklmnof ",
-" pqrsltuv ",
-" wxly ",
-" "};
diff --git a/calendar/test.vcf b/calendar/test.vcf
deleted file mode 100644
index bfe93b3c14..0000000000
--- a/calendar/test.vcf
+++ /dev/null
@@ -1,133 +0,0 @@
-BEGIN:VCALENDAR
-PRODID:-//GNOME//NONSGML GnomeCalendar//EN
-TZ:MST
-VERSION:0.13
-BEGIN:VEVENT
-UID:KOrganizer - 846930886
-SEQUENCE:1
-DTSTART:19980601T150000
-DTEND:19980601T150000
-DCREATED:19980402T023558
-LAST-MODIFIED:19980402T023558
-SUMMARY:Cada dos dias de 06/01 al 07/01
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:D2 19980701T140000
-END:VEVENT
-
-BEGIN:VEVENT
-UID:KOrganizer - 846930886
-SEQUENCE:1
-DTSTART:19980501T140000
-DTEND:19980501T140000
-DCREATED:19980402T023558
-LAST-MODIFIED:19980402T023558
-SUMMARY:5 dias.
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:D1 #5
-END:VEVENT
-
-BEGIN:VEVENT
-UID:KOrganizer - 846930886
-SEQUENCE:1
-DTSTART:19980501T140000
-DTEND:19980501T150000
-DCREATED:19980402T023558
-LAST-MODIFIED:19980429T004635
-SUMMARY:Diariamente de 05/01 al 06/01
-STATUS:NEEDS ACTION
-CLASS:PRIVATE
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:D1 19980601T000000
-END:VEVENT
-
-BEGIN:VEVENT
-UID:KOrganizer - 1804289383
-SEQUENCE:1
-DTSTART:19980415T010000
-DTEND:19980415T013000
-DCREATED:19980402T023552
-LAST-MODIFIED:19980330T225948
-SUMMARY:Diario durante 5 dias
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:D1 #5
-END:VEVENT
-
-BEGIN:VEVENT
-UID:KOrganizer - 1804289383
-SEQUENCE:1
-DTSTART:19980415T010000
-DTEND:19980415T013000
-DCREATED:19980402T023552
-LAST-MODIFIED:19980330T225948
-SUMMARY:Diario durante 5 dias
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:D1 #5
-END:VEVENT
-
-BEGIN:VTODO
-UID:KOrganizer - 846930886
-SEQUENCE:1
-DTSTART:19980415T140000
-DUE:19691231T180000
-DCREATED:19980402T023558
-LAST-MODIFIED:19980402T023558
-SUMMARY:Normal
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-END:VTODO
-
-BEGIN:VTODO
-UID:KOrganizer - 1804289383
-SEQUENCE:1
-DTSTART:19980415T120000
-DUE:19691231T180000
-DCREATED:19980402T023552
-LAST-MODIFIED:19980330T225948
-SUMMARY:Semanal -- 4 semanas
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:W1 WE #4
-END:VTODO
-
-BEGIN:VTODO
-UID:KOrganizer - 1804289383
-SEQUENCE:1
-DTSTART:19980415T003000
-DUE:19691231T180000
-DCREATED:19980402T023552
-LAST-MODIFIED:19980330T225948
-SUMMARY:Semana: Mi, Ju, Vi, Dom (10 veces)
-STATUS:NEEDS ACTION
-CLASS:PUBLIC
-PRIORITY:0
-TRANSP:0
-RELATED-TO:0
-RRULE:W1 SU WE TH FR #10
-END:VTODO
-
-END:VCALENDAR
-
diff --git a/calendar/timeutil.c b/calendar/timeutil.c
deleted file mode 100644
index 7ddc0e04d4..0000000000
--- a/calendar/timeutil.c
+++ /dev/null
@@ -1,501 +0,0 @@
-/* Miscellaneous time-related utilities
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <federico@nuclecu.unam.mx>
- * Miguel de Icaza <miguel@nuclecu.unam.mx>
- */
-
-#include <libgnome/libgnome.h>
-#include <string.h>
-#include "timeutil.h"
-
-#define digit_at(x,y) (x [y] - '0')
-
-time_t
-time_from_isodate (char *str)
-{
- struct tm my_tm;
- time_t t;
-
- if (strlen (str) < 14)
- return -1;
-
- my_tm.tm_year = (digit_at (str, 0) * 1000 + digit_at (str, 1) * 100 +
- digit_at (str, 2) * 10 + digit_at (str, 3)) - 1900;
-
- my_tm.tm_mon = digit_at (str, 4) * 10 + digit_at (str, 5) - 1;
- my_tm.tm_mday = digit_at (str, 6) * 10 + digit_at (str, 7);
- my_tm.tm_hour = digit_at (str, 9) * 10 + digit_at (str, 10);
- my_tm.tm_min = digit_at (str, 11) * 10 + digit_at (str, 12);
- my_tm.tm_sec = digit_at (str, 13) * 10 + digit_at (str, 14);
- my_tm.tm_isdst = -1;
-
- t = mktime (&my_tm);
-
- if (str [15] == 'Z')
-#if defined(HAVE_TM_GMTOFF)
- t -= my_tm.tm_gmtoff
-#elsif defined(HAVE_TIMEZONE)
- t -= timezone
-#endif
- ;
-
- return t;
-}
-
-void
-print_time_t (time_t t)
-{
- struct tm *tm = localtime (&t);
-
- printf ("TIEMPO: %d/%d/%d %d:%d:%d\n",
- tm->tm_mon+1, tm->tm_mday, tm->tm_year,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
-}
-
-int
-get_time_t_hour (time_t t)
-{
- struct tm *tm;
-
- tm = localtime (&t);
- return tm->tm_hour;
-}
-
-char *
-isodate_from_time_t (time_t t)
-{
- struct tm *tm;
- static char isotime [40];
-
- tm = localtime (&t);
- strftime (isotime, sizeof (isotime)-1, "%Y%m%dT%H%M%S", tm);
- return isotime;
-}
-
-time_t
-time_from_start_duration (time_t start, char *duration)
-{
- printf ("Not yet implemented\n");
- return 0;
-}
-
-char *
-format_simple_hour (int hour, int use_am_pm)
-{
- static char buf[256];
-
- /* I don't know whether this is the best way to internationalize it.
- * Does any language use different conventions? - Federico
- */
-
- if (use_am_pm)
- g_snprintf (buf, sizeof(buf), "%d%s",
- (hour == 0) ? 12 : (hour > 12) ? (hour - 12) : hour,
- (hour < 12) ? _("am") : _("pm"));
- else
- g_snprintf (buf, sizeof(buf), "%02d%s", hour, _("h"));
-
- return buf;
-
-}
-
-time_t
-time_add_minutes (time_t time, int minutes)
-{
- struct tm *tm = localtime (&time);
- time_t new_time;
-
- tm->tm_min += minutes;
- if ((new_time = mktime (tm)) == -1){
- g_warning ("mktime could not handling adding a day with\n");
- print_time_t (time);
- return time;
- }
- return new_time;
-}
-
-time_t
-time_add_day (time_t time, int days)
-{
- struct tm *tm = localtime (&time);
- time_t new_time;
- int dst_flag = tm->tm_isdst;
-
- tm->tm_mday += days;
-
- if ((new_time = mktime (tm)) == -1){
- g_warning ("mktime could not handling adding a day with\n");
- print_time_t (time);
- return time;
- }
-
- if (dst_flag > tm->tm_isdst){
- tm->tm_hour++;
- new_time += 3600;
- } else if (dst_flag < tm->tm_isdst){
- tm->tm_hour--;
- new_time -= 3600;
- }
-
- return new_time;
-}
-
-time_t
-time_add_week (time_t time, int weeks)
-{
- return time_add_day (time, weeks * 7);
-}
-
-time_t
-time_add_month (time_t time, int months)
-{
- struct tm *tm = localtime (&time);
- time_t new_time;
- int mday;
-
- mday = tm->tm_mday;
-
- tm->tm_mon += months;
- tm->tm_isdst = -1;
- if ((new_time = mktime (tm)) == -1){
- g_warning ("mktime could not handling adding a month with\n");
- print_time_t (time);
- return time;
- }
- tm = localtime (&new_time);
- if (tm->tm_mday < mday){
- tm->tm_mon--;
- tm->tm_mday = time_days_in_month (tm->tm_year+1900, tm->tm_mon);
- return new_time = mktime (tm);
- }
- else
- return new_time;
-}
-
-time_t
-time_add_year (time_t time, int years)
-{
- struct tm *tm = localtime (&time);
- time_t new_time;
-
- tm->tm_year += years;
- if ((new_time = mktime (tm)) == -1){
- g_warning ("mktime could not handling adding a year with\n");
- print_time_t (time);
- return time;
- }
- return new_time;
-}
-
-time_t
-time_day_hour (time_t t, int hour)
-{
- struct tm tm;
-
- tm = *localtime (&t);
- tm.tm_hour = hour;
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- return mktime (&tm);
-}
-
-/* Number of days in a month, for normal and leap years */
-static const int days_in_month[2][12] = {
- { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
- { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
-};
-
-/* Returns whether the specified year is a leap year */
-static int
-is_leap_year (int year)
-{
- if (year <= 1752)
- return !(year % 4);
- else
- return (!(year % 4) && (year % 100)) || !(year % 400);
-}
-
-int
-time_days_in_month (int year, int month)
-{
- g_return_val_if_fail (year >= 1900, 0);
- g_return_val_if_fail ((month >= 0) && (month < 12), 0);
-
- return days_in_month [is_leap_year (year)][month];
-}
-
-time_t
-time_from_day (int year, int month, int day)
-{
- struct tm tm;
-
- memset (&tm, 0, sizeof (tm));
- tm.tm_year = year - 1900;
- tm.tm_mon = month;
- tm.tm_mday = day;
-
- return mktime (&tm);
-}
-
-time_t
-time_year_begin (time_t t)
-{
- struct tm tm;
-
- tm = *localtime (&t);
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_mon = 0;
- tm.tm_mday = 1;
- tm.tm_isdst = -1;
-
- return mktime (&tm);
-}
-
-time_t
-time_year_end (time_t t)
-{
- struct tm tm;
-
- tm = *localtime (&t);
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_mon = 0;
- tm.tm_mday = 1;
- tm.tm_year++;
- tm.tm_isdst = -1;
-
- return mktime (&tm);
-}
-
-time_t
-time_month_begin (time_t t)
-{
- struct tm tm;
-
- tm = *localtime (&t);
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_mday = 1;
- tm.tm_isdst = -1;
-
- return mktime (&tm);
-}
-
-time_t
-time_month_end (time_t t)
-{
- struct tm tm;
-
- tm = *localtime (&t);
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_mday = 1;
- tm.tm_mon++;
- tm.tm_isdst = -1;
-
- return mktime (&tm);
-}
-
-time_t
-time_week_begin (time_t t)
-{
- struct tm tm;
-
- /* FIXME: make it take week_starts_on_monday into account */
-
- tm = *localtime (&t);
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_mday -= tm.tm_wday;
-
- return mktime (&tm);
-}
-
-time_t
-time_week_end (time_t t)
-{
- struct tm tm;
-
- /* FIXME: make it take week_starts_on_monday into account */
-
- tm = *localtime (&t);
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
- tm.tm_mday += 7 - tm.tm_wday;
-
- return mktime (&tm);
-}
-
-time_t
-time_day_begin (time_t t)
-{
- struct tm tm;
- time_t temp = t - 43200;
- int dstflag, dstflag2;
-
- tm = *localtime(&temp); /* one day */
- dstflag = tm.tm_isdst;
-
- tm = *localtime (&t);
- dstflag2 = tm.tm_isdst;
-
- if (dstflag < dstflag2)
- tm.tm_hour = 1;
- else
- tm.tm_hour = 0;
-
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- temp = mktime(&tm);
- if (dstflag > dstflag2){
- temp += 3600;
- }
-
- return temp;
-}
-
-time_t
-time_day_end (time_t t)
-{
- struct tm tm;
- time_t temp;
- int dstflag, dstflag2;
-
- t += 10800;
- temp = t - 86400;
-
- tm = *localtime(&temp); /* one day */
- dstflag = tm.tm_isdst;
-
- tm = *localtime (&t);
- dstflag2 = tm.tm_isdst;
-
- if (dstflag < dstflag2)
- tm.tm_hour = 23;
- else {
- tm.tm_mday++;
- tm.tm_hour = 0;
- }
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- temp = mktime(&tm);
- if(dstflag > dstflag2) {
- }
- return temp;
-}
-
-static char *
-pcat (char *dest, int num, char key)
-{
- int c;
-
- c = sprintf (dest, "%d%c", num, key);
- return dest + c;
-}
-
-/* Converts secs into the ISO difftime representation */
-char *
-isodiff_from_secs (int secs)
-{
- static char buffer [60], *p;
- int years, months, weeks, days, hours, minutes;
-
- years = months = weeks = days = hours = minutes = 0;
-
- years = secs / (365 * 86400);
- secs %= (365 * 86400);
- months = secs / (30 * 86400);
- secs %= (30 * 86400);
- weeks = secs / (7 * 86400);
- secs %= (7 * 86400);
- days = secs / 86400;
- secs %= 86400;
- hours = secs / 3600;
- secs %= 3600;
- minutes = secs / 60;
- secs %= 60;
-
- strcpy (buffer, "P");
- p = buffer + 1;
- if (years)
- p = pcat (p, years, 'Y');
- if (months)
- p = pcat (p, months, 'M');
- if (weeks)
- p = pcat (p, weeks, 'W');
- if (days)
- p = pcat (p, days, 'D');
- if (hours || minutes || secs){
- *p++ = 'T';
- if (hours)
- p = pcat (p, hours, 'H');
- if (minutes)
- p = pcat (p, minutes, 'M');
- if (secs)
- p = pcat (p, secs, 'S');
- }
-
- return buffer;
-}
-
-int
-isodiff_to_secs (char *str)
-{
- int value, time;
- int years, months, weeks, days, hours, minutes, seconds;
-
- value = years = months = weeks = days = hours = minutes = time = seconds = 0;
- if (*str != 'P')
- return 0;
-
- str++;
- while (*str){
- switch (*str){
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- value = value * 10 + (*str - '0');
- break;
- case 'Y':
- years = value; value = 0;
- break;
- case 'M':
- if (time)
- minutes = value;
- else
- months = value;
- value = 0;
- break;
- case 'W':
- weeks = value; value = 0;
- break;
- case 'D':
- days = value; value = 0;
- break;
- case 'T':
- value = 0; time = 1;
- break;
- case 'H':
- hours = value; value = 0;
- break;
- case 'S':
- seconds = value; value = 0;
- break;
- }
- str++;
- }
- return seconds + (minutes * 60) + (hours * 3600) +
- (days * 86400) + (weeks * 7 * 86400) +
- (months * 30 * 86400) + (years * 365 * 86400);
-}
diff --git a/calendar/timeutil.h b/calendar/timeutil.h
deleted file mode 100644
index 407213d7f8..0000000000
--- a/calendar/timeutil.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Miscellaneous time-related utilities
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <federico@nuclecu.unam.mx>
- * Miguel de Icaza <miguel@nuclecu.unam.mx>
- */
-
-#ifndef TIMEUTIL_H
-#define TIMEUTIL_H
-
-
-#include <time.h>
-
-
-time_t time_from_isodate (char *str);
-time_t time_from_start_duration (time_t start, char *duration);
-char *isodate_from_time_t (time_t t);
-int get_time_t_hour (time_t t);
-int isodiff_to_secs (char *str);
-char *isodiff_from_secs (int secs);
-
-time_t time_add_minutes (time_t time, int minutes);
-time_t time_add_day (time_t time, int days);
-time_t time_add_week (time_t time, int weeks);
-time_t time_add_month (time_t time, int months);
-time_t time_add_year (time_t time, int years);
-
-
-/* Returns pointer to a statically-allocated buffer with a string of the form
- * 3am, 4am, 12pm, 08h, 17h, etc.
- * The string is internationalized, hopefully correctly.
- */
-char *format_simple_hour (int hour, int use_am_pm);
-
-/* Returns the number of days in the specified month. Years are full years (starting from year 1).
- * Months are in [0, 11].
- */
-int time_days_in_month (int year, int month);
-
-/* Converts the specified date to a time_t at the start of the specified day. Years are full years
- * (starting from year 1). Months are in [0, 11]. Days are 1-based.
- */
-time_t time_from_day (int year, int month, int day);
-
-time_t time_day_hour (time_t t, int hour);
-
-/* For the functions below, time ranges are considered to contain the start time, but not the end
- * time.
- */
-
-/* These two functions take a time value and return the beginning or end of the corresponding year,
- * respectively.
- */
-time_t time_year_begin (time_t t);
-time_t time_year_end (time_t t);
-
-/* These two functions take a time value and return the beginning or end of the corresponding month,
- * respectively.
- */
-time_t time_month_begin (time_t t);
-time_t time_month_end (time_t t);
-
-/* These functions take a time value and return the beginning or end of the corresponding week,
- * respectively. This takes into account the global week_starts_on_monday flag.
- */
-time_t time_week_begin (time_t t);
-time_t time_week_end (time_t t);
-
-/* These two functions take a time value and return the beginning or end of the corresponding day,
- * respectively.
- */
-time_t time_day_begin (time_t t);
-time_t time_day_end (time_t t);
-
-
-time_t parse_date (char *str);
-void print_time_t (time_t t);
-
-
-#endif
diff --git a/calendar/todo-conduit-control-applet.c b/calendar/todo-conduit-control-applet.c
deleted file mode 100644
index 54a26715ef..0000000000
--- a/calendar/todo-conduit-control-applet.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* Control applet ("capplet") for the gnome-pilot todo conduit, */
-/* based on */
-/* gpilotd control applet ('capplet') for use with the GNOME control center */
-/* $Id$ */
-
-#include <pwd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <gnome.h>
-
-#include <config.h>
-#include <capplet-widget.h>
-
-#include <gpilotd/gpilotd-conduit-mgmt.h>
-#include <gpilotd/gpilotd-app.h>
-#include <gpilotd/gpilotd-app-dummy-callbacks.h>
-
-#include "todo-conduit.h"
-
-/* tell changes callbacks to ignore changes or not */
-static gboolean ignore_changes=FALSE;
-
-/* capplet widget */
-static GtkWidget *capplet=NULL;
-
-/* host/device/pilot configuration windows */
-GtkWidget *cfgOptionsWindow=NULL;
-GtkWidget *cfgStateWindow=NULL;
-GtkWidget *dialogWindow=NULL;
-
-gboolean activated,org_activation_state;
-GnomePilotConduitMgmt *conduit;
-
-static void doTrySettings(GtkWidget *widget, ConduitCfg *conduitCfg);
-static void doRevertSettings(GtkWidget *widget, ConduitCfg *conduitCfg);
-static void doSaveSettings(GtkWidget *widget, ConduitCfg *conduitCfg);
-
-static void readStateCfg(GtkWidget *w);
-static void setStateCfg(GtkWidget *w);
-
-gint pilotId;
-CORBA_Environment ev;
-
-static void
-doTrySettings(GtkWidget *widget, ConduitCfg *conduitCfg)
-{
- readStateCfg(cfgStateWindow);
- if(activated)
- gpilotd_conduit_mgmt_enable(conduit,pilotId,GnomePilotConduitSyncTypeSynchronize);
- else
- gpilotd_conduit_mgmt_disable(conduit,pilotId);
-}
-
-static void
-doSaveSettings(GtkWidget *widget, ConduitCfg *conduitCfg)
-{
- doTrySettings(widget, conduitCfg);
- save_configuration(NULL);
-}
-
-
-static void
-doRevertSettings(GtkWidget *widget, ConduitCfg *conduitCfg)
-{
- activated = org_activation_state;
- setStateCfg(cfgStateWindow);
-}
-
-static void
-insert_dir_callback (GtkEditable *editable, const gchar *text,
- gint len, gint *position, void *data)
-{
- gint i;
- gchar *curname;
-
- curname = gtk_entry_get_text(GTK_ENTRY(editable));
- if (*curname == '\0' && len > 0) {
- if (isspace(text[0])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert_text");
- return;
- }
- } else {
- for (i=0; i<len; i++) {
- if (isspace(text[i])) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(editable),
- "insert_text");
- return;
- }
- }
- }
-}
-static void
-insert_dir_callback2(GtkEditable *editable, const gchar *text,
- gint length, gint *position,
- void *data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static void
-clist_changed(GtkWidget *widget, gpointer data)
-{
- if (!ignore_changes)
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-void about_cb (GtkWidget *widget, gpointer data) {
- GtkWidget *about;
- const gchar *authors[] = {_("Eskil Heyn Olsen <deity@eskil.dk>"),NULL};
-
- about = gnome_about_new(_("Gpilotd todo conduit"), VERSION,
- _("(C) 1998 the Free Software Foundation"),
- authors,
- _("Configuration utility for the todo conduit.\n"),
- _("gnome-unknown.xpm"));
- gtk_widget_show (about);
-
- return;
-}
-
-static void toggled_cb(GtkWidget *widget, gpointer data) {
- gtk_widget_set_sensitive(cfgOptionsWindow,GTK_TOGGLE_BUTTON(widget)->active);
- capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE);
-}
-
-static GtkWidget
-*createStateCfgWindow(void)
-{
- GtkWidget *vbox, *table;
- GtkWidget *entry, *label;
- GtkWidget *button;
-
- vbox = gtk_vbox_new(FALSE, GNOME_PAD);
-
- table = gtk_table_new(2, 2, FALSE);
- gtk_table_set_row_spacings(GTK_TABLE(table), 4);
- gtk_table_set_col_spacings(GTK_TABLE(table), 10);
- gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD);
-
- label = gtk_label_new(_("Enabled"));
- gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1,2);
-
- button = gtk_check_button_new();
- gtk_object_set_data(GTK_OBJECT(vbox), "conduit_on_off", button);
- gtk_signal_connect(GTK_OBJECT(button), "toggled",
- GTK_SIGNAL_FUNC(toggled_cb),
- NULL);
- gtk_table_attach_defaults(GTK_TABLE(table), button, 1, 2, 1,2);
-
- return vbox;
-}
-
-static void
-setStateCfg(GtkWidget *cfg)
-{
- GtkWidget *button;
- gchar num[40];
-
- button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
-
- g_assert(button!=NULL);
-
- ignore_changes = TRUE;
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),activated);
- gtk_widget_set_sensitive(cfgOptionsWindow,GTK_TOGGLE_BUTTON(button)->active);
- ignore_changes = FALSE;
-}
-
-
-static void
-readStateCfg(GtkWidget *cfg)
-{
- GtkWidget *button;
-
- button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off");
-
- g_assert(button!=NULL);
-
- activated = GTK_TOGGLE_BUTTON(button)->active;
-}
-
-static void
-pilot_capplet_setup(void)
-{
- GtkWidget *frame, *table;
-
- capplet = capplet_widget_new();
-
- table = gtk_table_new(1, 2, FALSE);
- gtk_container_border_width(GTK_CONTAINER(table), GNOME_PAD);
- gtk_container_add(GTK_CONTAINER(capplet), table);
-
- frame = gtk_frame_new(_("Conduit state"));
- gtk_container_border_width(GTK_CONTAINER(frame), GNOME_PAD_SMALL);
- gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1);
- cfgStateWindow = createStateCfgWindow();
- gtk_container_add(GTK_CONTAINER(frame), cfgStateWindow);
-
- gtk_signal_connect(GTK_OBJECT(capplet), "try",
- GTK_SIGNAL_FUNC(doTrySettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "revert",
- GTK_SIGNAL_FUNC(doRevertSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "ok",
- GTK_SIGNAL_FUNC(doSaveSettings), NULL);
- gtk_signal_connect(GTK_OBJECT(capplet), "help",
- GTK_SIGNAL_FUNC(about_cb), NULL);
-
-
- setStateCfg(cfgStateWindow);
-
- gtk_widget_show_all(capplet);
-}
-
-void run_error_dialog(gchar *mesg,...) {
- char tmp[80];
- va_list ap;
-
- va_start(ap,mesg);
- vsnprintf(tmp,79,mesg,ap);
- dialogWindow = gnome_message_box_new(mesg,GNOME_MESSAGE_BOX_ERROR,GNOME_STOCK_BUTTON_OK,NULL);
- gnome_dialog_run_and_close(GNOME_DIALOG(dialogWindow));
- va_end(ap);
-}
-
-gint get_pilot_id_from_gpilotd() {
- gint *pilots;
- int i;
-
- i=0;
- gpilotd_get_pilot_ids(&pilots);
- if(pilots) {
- while(pilots[i]!=-1) { g_message("pilot %d = \"%d\"",i,pilots[i]); i++; }
- if(i==0) {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- } else {
- if(i==1)
- return pilots[0];
- else {
- g_message("too many pilots...");
- return pilots[0];
- }
- }
- } else {
- run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first."));
- return -1;
- }
-}
-
-int
-main( int argc, char *argv[] )
-{
- /* we're a capplet */
- gnome_capplet_init ("todo conduit control applet", NULL, argc, argv,
- NULL,
- 0, NULL);
-
- /* put all code to set things up in here */
- conduit = gpilotd_conduit_mgmt_new("todo_conduit");
-
- /* get pilot name from gpilotd */
- /* 1. initialize the gpilotd connection */
- if (gpilotd_init(&argc,argv)!=0) {
- run_error_dialog(_("Cannot initialze the GnomePilot Daemon"));
- g_error(_("Cannot initialze the GnomePilot Daemon"));
- return -1;
- }
-
- /* 2 connect to gpilotd */
- if (gpilotd_connect()!=0) {
- run_error_dialog(_("Cannot connect to the GnomePilot Daemon"));
- g_error(_("Cannot connect to the GnomePilot Daemon"));
- return -1;
- }
-
- pilotId = get_pilot_id_from_gpilotd();
- if(!pilotId) return -1;
- org_activation_state = activated = gpilotd_conduit_mgmt_is_enabled(conduit,pilotId);
-
- pilot_capplet_setup();
-
-
- /* done setting up, now run main loop */
- capplet_gtk_main();
- return 0;
-}
diff --git a/calendar/todo-conduit-control-applet.desktop b/calendar/todo-conduit-control-applet.desktop
deleted file mode 100644
index 87788bde08..0000000000
--- a/calendar/todo-conduit-control-applet.desktop
+++ /dev/null
@@ -1,6 +0,0 @@
-[Desktop Entry]
-Name=Todo conduit
-Comment=Configure the todo conduit
-Exec=todo-conduit-control-applet --cap-id=1
-Terminal=0
-Type=Application
diff --git a/calendar/todo-conduit.c b/calendar/todo-conduit.c
deleted file mode 100644
index 3a543816af..0000000000
--- a/calendar/todo-conduit.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* $Id$ */
-
-#include <glib.h>
-#include <gnome.h>
-
-#include <pi-source.h>
-#include <pi-socket.h>
-#include <pi-file.h>
-#include <pi-dlp.h>
-#include <pi-version.h>
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <utime.h>
-#include <unistd.h>
-#include <pwd.h>
-#include <signal.h>
-#include <errno.h>
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-standard-abs.h>
-
-#include "todo-conduit.h"
-
-static gint
-load_records(GnomePilotConduit *c)
-{
- return 0;
-}
-
-static gint
-pre_sync(GnomePilotConduit *c, GnomePilotDBInfo *dbi) {
- int l;
- unsigned char *buf;
-
- gtk_object_set_data(GTK_OBJECT(c),"dbinfo",dbi);
-
- load_records(c);
-
- buf = (unsigned char*)g_malloc(0xffff);
- if((l=dlp_ReadAppBlock(dbi->pilot_socket,dbi->db_handle,0,(unsigned char *)buf,0xffff))<0) {
- return -1;
- }
- unpack_ToDoAppInfo(&(GET_DATA(c)->ai),buf,l);
- g_free(buf);
-
- return 0;
-}
-
-static gint
-post_sync(GnomePilotConduit *c) {
- return 0;
-}
-
-static gint
-match_record (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("in match_record\n");
- return 0;
-}
-static gint
-free_match (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- gpointer data)
-{
- g_print ("entering free_match\n");
- *local = NULL;
-
- return 0;
-}
-static gint
-archive_local (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gpointer data)
-{
- g_print ("entering archive_local\n");
- return 1;
-
-}
-static gint
-archive_remote (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering archive_remote\n");
- return 1;
-}
-static gint
-store_remote (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering store_remote\n");
- g_print ("Rec:%s:\nLength:%d\n", remote->record, remote->length);
- return 1;
-}
-static gint
-clear_status_archive_local (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gpointer data)
-{
- g_print ("entering clear_status_archive_local\n");
- return 1;
-}
-static gint
-iterate (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- gpointer data)
-{
- g_print ("entering iterate\n");
- return 1;
-}
-static gint
-iterate_specific (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord **local,
- gint flag,
- gint archived,
- gpointer data)
-{
- g_print ("entering iterate_specific\n");
- return 1;
-}
-static gint
-purge (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- gpointer data)
-{
- g_print ("entering purge\n");
- return 1;
-}
-static gint
-set_status (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gint status,
- gpointer data)
-{
- g_print ("entering set_status\n");
- return 1;
-}
-static gint
-set_archived (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gint archived,
- gpointer data)
-{
- g_print ("entering set_archived\n");
- return 1;
-}
-static gint
-set_pilot_id (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- guint32 ID,
- gpointer data)
-{
- g_print ("entering set_pilot_id\n");
- return 1;
-}
-static gint
-compare (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering compare\n");
- return 1;
-}
-static gint
-compare_backup (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering compare_backup\n");
- return 1;
-}
-static gint
-free_transmit (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- PilotRecord *remote,
- gpointer data)
-{
- g_print ("entering free_transmit\n");
- return 1;
-}
-static gint
-delete_all (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- gpointer data)
-{
- g_print ("entering delete_all\n");
- return 1;
-}
-static PilotRecord *
-transmit (GnomePilotConduitStandardAbs *pilot_conduit_standard_abs,
- LocalRecord *local,
- gpointer data)
-{
- g_print ("entering transmit\n");
- return NULL;
-}
-
-static GnomePilotConduit *
-conduit_get_gpilot_conduit (guint32 pilotId)
-{
- GtkObject *retval;
- ConduitCfg *cfg;
- ConduitData *cdata;
-
- g_print ("creating our new conduit\n");
- retval = gnome_pilot_conduit_standard_abs_new ("TodoDB", 0x0);
- g_assert (retval != NULL);
- gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"todo");
-
- cfg = g_new0(ConduitCfg,1);
- g_assert(cfg != NULL);
- gtk_object_set_data(retval,"conduit_cfg",cfg);
-
- cdata = g_new0(ConduitData,1);
- g_assert(cdata != NULL);
- gtk_object_set_data(retval,"conduit_data",cdata);
-
- gtk_signal_connect (retval, "match_record", (GtkSignalFunc) match_record, NULL);
- gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, NULL);
- gtk_signal_connect (retval, "archive_local", (GtkSignalFunc) archive_local, NULL);
- gtk_signal_connect (retval, "archive_remote", (GtkSignalFunc) archive_remote, NULL);
- gtk_signal_connect (retval, "store_remote", (GtkSignalFunc) store_remote, NULL);
- gtk_signal_connect (retval, "clear_status_archive_local", (GtkSignalFunc) clear_status_archive_local, NULL);
- gtk_signal_connect (retval, "iterate", (GtkSignalFunc) iterate, NULL);
- gtk_signal_connect (retval, "iterate_specific", (GtkSignalFunc) iterate_specific, NULL);
- gtk_signal_connect (retval, "purge", (GtkSignalFunc) purge, NULL);
- gtk_signal_connect (retval, "set_status", (GtkSignalFunc) set_status, NULL);
- gtk_signal_connect (retval, "set_archived", (GtkSignalFunc) set_archived, NULL);
- gtk_signal_connect (retval, "set_pilot_id", (GtkSignalFunc) set_pilot_id, NULL);
- gtk_signal_connect (retval, "compare", (GtkSignalFunc) compare, NULL);
- gtk_signal_connect (retval, "compare_backup", (GtkSignalFunc) compare_backup, NULL);
- gtk_signal_connect (retval, "free_transmit", (GtkSignalFunc) free_transmit, NULL);
- gtk_signal_connect (retval, "delete_all", (GtkSignalFunc) delete_all, NULL);
- gtk_signal_connect (retval, "transmit", (GtkSignalFunc) transmit, NULL);
- gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, NULL);
- gtk_signal_connect (retval, "post_sync", (GtkSignalFunc) post_sync, NULL);
-
- load_configuration(&cfg,pilotId);
-
- return GNOME_PILOT_CONDUIT (retval);
-}
-static void
-conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit)
-{
- ConduitCfg *cc;
- cc = GET_CONFIG(conduit);
- destroy_configuration(&cc);
- gtk_object_destroy (GTK_OBJECT (conduit));
-}
-
-
diff --git a/calendar/todo-conduit.h b/calendar/todo-conduit.h
deleted file mode 100644
index c224b2b1f3..0000000000
--- a/calendar/todo-conduit.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $Id$ */
-
-#ifndef __TODO_CONDUIT_H__
-#define __TODO_CONDUIT_H__
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <pi-todo.h>
-#include <gnome.h>
-
-typedef struct _ConduitCfg ConduitCfg;
-
-struct _ConduitCfg {
- gboolean open_secret;
- guint32 pilotId;
-};
-
-#define GET_CONFIG(c) ((ConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"conduit_cfg"))
-
-typedef struct _ConduitData ConduitData;
-
-struct _ConduitData {
- struct ToDoAppInfo ai;
-};
-
-#define GET_DATA(c) ((ConduitData*)gtk_object_get_data(GTK_OBJECT(c),"conduit_data"))
-
-static void load_configuration(ConduitCfg **c,guint32 pilotId) {
- gchar prefix[256];
- g_snprintf(prefix,255,"/gnome-pilot.d/todod-conduit/Pilot_%u/",pilotId);
-
- *c = g_new0(ConduitCfg,1);
- gnome_config_push_prefix(prefix);
- (*c)->open_secret = gnome_config_get_bool("open secret=FALSE");
- gnome_config_pop_prefix();
-
- (*c)->pilotId = pilotId;
-}
-
-static void save_configuration(ConduitCfg *c) {
- gchar prefix[256];
-
- g_snprintf(prefix,255,"/gnome-pilot.d/todo-conduit/Pilot_%u/",c->pilotId);
-
- gnome_config_push_prefix(prefix);
- gnome_config_set_bool("open secret",c->open_secret);
- gnome_config_pop_prefix();
-
- gnome_config_sync();
- gnome_config_drop_all();
-}
-
-static void destroy_configuration(ConduitCfg **c) {
- g_free(*c);
- *c = NULL;
-}
-
-#endif __TODO_CONDUIT_H__
diff --git a/calendar/topic.dat b/calendar/topic.dat
deleted file mode 100644
index edc7813b26..0000000000
--- a/calendar/topic.dat
+++ /dev/null
@@ -1,2 +0,0 @@
-gnome-cal.html Manual
-gnome-cal.html#cmdline Command line options \ No newline at end of file
diff --git a/calendar/view-utils.c b/calendar/view-utils.c
deleted file mode 100644
index 8cb7893377..0000000000
--- a/calendar/view-utils.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* Miscellaneous utility functions for the calendar view widgets
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Federico Mena <quartic@gimp.org>
- * Miguel de Icaza <miguel@kernel.org>
- */
-
-#include <string.h>
-#include "view-utils.h"
-#include <libgnomeui/gnome-icon-text.h>
-
-int am_pm_flag = 0;
-
-static char *
-nicetime (struct tm *tm)
-{
- static char buf [20];
- char *p = buf;
-
- if (am_pm_flag){
- if (tm->tm_min)
- strftime (buf, sizeof (buf), "%l:%M%p", tm);
- else
- strftime (buf, sizeof (buf), "%l%p", tm);
- } else {
- if (tm->tm_min)
- strftime (buf, sizeof (buf), "%H:%M", tm);
- else
- strftime (buf, sizeof (buf), "%H", tm);
- }
- while (*p == ' ')
- p++;
- return p;
-}
-
-typedef struct {
- GnomeIconTextInfo *layout;
- int lines;
- int assigned_lines;
-} line_info_t;
-
-void
-view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, GList *events, time_t start, time_t end)
-{
- GdkFont *font = widget->style->font;
- int font_height;
- int y, max_y, items, i, need_more, nlines, base, extra;
- GList *list;
- line_info_t *lines;
-
- if (events == NULL)
- return;
-
- items = g_list_length (events);
- lines = g_new0 (line_info_t, items);
-
- font_height = font->ascent + font->descent;
- max_y = area->y + area->height - font_height * ((flags & VIEW_UTILS_DRAW_SPLIT) ? 2 : 1);
-
- /*
- * Layout all the lines, measure the space needs
- */
- for (i = 0, list = events; list; list = list->next, i++){
- CalendarObject *co = list->data;
- struct tm tm_start, tm_end;
- iCalObject *ico = co->ico;
- char buf [60];
- char *full_text;
-
- tm_start = *localtime (&co->ev_start);
- tm_end = *localtime (&co->ev_end);
-
- strcpy (buf, nicetime (&tm_start));
-
- if (flags & VIEW_UTILS_DRAW_END){
- strcat (buf, "-");
- strcat (buf, nicetime (&tm_end));
- }
-
- full_text = g_strconcat (buf, ": ", ico->summary, NULL);
- lines [i].layout = gnome_icon_layout_text (
- font, full_text, "\n -,.;:=#", area->width, TRUE);
- lines [i].lines = g_list_length (lines [i].layout->rows);
-
- g_free (full_text);
- }
-
- /*
- * Compute how many lines we will give to each row
- */
- nlines = 1 + max_y / font_height;
- base = nlines / items;
- extra = nlines % items;
- need_more = 0;
-
- for (i = 0; i < items; i++){
- if (lines [i].lines <= base){
- extra += base - lines [i].lines;
- lines [i].assigned_lines = lines [i].lines;
- } else {
- need_more++;
- lines [i].assigned_lines = base;
- }
- }
-
- /*
- * use any extra space
- */
- while (need_more && extra > 0){
- need_more = 0;
-
- for (i = 0; i < items; i++){
- if (lines [i].lines > lines [i].assigned_lines){
- lines [i].assigned_lines++;
- extra--;
- }
-
- if (extra == 0)
- break;
-
- if (lines [i].lines > lines [i].assigned_lines)
- need_more = 1;
- }
- }
-
- /*
- * Draw the information
- */
- gdk_gc_set_clip_rectangle (gc, area);
- y = area->y;
- for (i = 0; i < items; i++){
- int line;
-
- list = lines [i].layout->rows;
-
- for (line = 0; line < lines [i].assigned_lines; line++){
- GnomeIconTextInfoRow *row = list->data;
-
- list = list->next;
-
- if (row)
- gdk_draw_string (
- window, font, gc,
- area->x, y + font->ascent,
- row->text);
- y += font_height;
- }
- }
-
- gdk_gc_set_clip_rectangle (gc, NULL);
-
- /*
- * Free resources.
- */
-
- for (i = 0; i < items; i++)
- gnome_icon_text_info_free (lines [i].layout);
- g_free (lines);
-}
-
-void
-view_utils_draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, GtkShadowType shadow)
-{
- int x, y;
- int xthick, ythick;
- GdkGC *light_gc, *dark_gc;
-
- gdk_draw_rectangle (window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- rect->x, rect->y,
- rect->width, rect->height);
-
- light_gc = widget->style->light_gc[GTK_STATE_NORMAL];
- dark_gc = widget->style->dark_gc[GTK_STATE_NORMAL];
-
- xthick = widget->style->klass->xthickness;
- ythick = widget->style->klass->ythickness;
-
- gdk_gc_set_clip_rectangle (light_gc, rect);
- gdk_gc_set_clip_rectangle (dark_gc, rect);
-
- for (y = rect->y + ythick; y < (rect->y + rect->height - ythick); y += 3)
- for (x = rect->x + xthick; x < (rect->x + rect->width - xthick); x += 6) {
- gdk_draw_point (window, light_gc, x, y);
- gdk_draw_point (window, dark_gc, x + 1, y + 1);
-
- gdk_draw_point (window, light_gc, x + 3, y + 1);
- gdk_draw_point (window, dark_gc, x + 4, y + 2);
- }
-
- gdk_gc_set_clip_rectangle (light_gc, NULL);
- gdk_gc_set_clip_rectangle (dark_gc, NULL);
-
- gtk_draw_shadow (widget->style, window,
- GTK_STATE_NORMAL, shadow,
- rect->x, rect->y,
- rect->width, rect->height);
-}
diff --git a/calendar/view-utils.h b/calendar/view-utils.h
deleted file mode 100644
index a1876b6032..0000000000
--- a/calendar/view-utils.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Miscellaneous utility functions for the calendar view widgets
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <quartic@gimp.org>
- */
-
-#ifndef VIEW_UTILS_H
-#define VIEW_UTILS_H
-
-
-#include <gtk/gtk.h>
-#include "calendar.h"
-
-
-enum {
- VIEW_UTILS_DRAW_END = 1 << 0,
- VIEW_UTILS_DRAW_SPLIT = 1 << 1
-};
-
-
-void view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
- int flags, GList *events, time_t start, time_t end);
-
-void view_utils_draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, GtkShadowType shadow);
-
-
-#endif
diff --git a/calendar/week-view.c b/calendar/week-view.c
deleted file mode 100644
index 89e489a92d..0000000000
--- a/calendar/week-view.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Week view display for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include "year-view.h"
-
-
-static void week_view_class_init (WeekViewClass *class);
-static void week_view_init (WeekView *wv);
-
-
-GtkType
-week_view_get_type (void)
-{
- static GtkType week_view_type = 0;
-
- if (!week_view_type) {
- GtkTypeInfo week_view_info = {
- "WeekView",
- sizeof (WeekView),
- sizeof (WeekViewClass),
- (GtkClassInitFunc) week_view_class_init,
- (GtkObjectInitFunc) week_view_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- week_view_type = gtk_type_unique (gnome_canvas_get_type (), &week_view_info);
- }
-
- return week_view_type;
-}
-
-static void
-week_view_class_init (WeekViewClass *class)
-{
- /* FIXME */
-}
-
-static void
-week_view_init (WeekView *wv)
-{
- GnomeCanvasGroup *root;
-
- root = gnome_canvas_root (GNOME_CANVAS (wv));
-
- /* Title */
-
- wv->title = gnome_canvas_item_new (root,
- gnome_canvas_text_get_type (),
- "anchor", GTK_ANCHOR_N,
- "font", HEADING_FONT,
- "fill_color", "black",
- NULL);
-}
-
-GtkWidget *
-week_view_new (GnomeCalendar *calendar, time_t week)
-{
- WeekView *wv;
-
- g_return_val_if_fail (calendar != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CALENDAR (calendar), NULL);
-
- wv = gtk_type_new (week_view_get_type ());
- wv->calendar = calendar;
-
- week_view_colors_changed (wv);
- week_view_set (wv, week);
- return GTK_WIDGET (wv);
-}
-
-void
-week_view_update (WeekView *wv, iCalObject *ico, int flags)
-{
- /* FIXME */
-}
-
-void
-week_view_set (WeekView *wv, time_t week)
-{
- /* FIXME */
-}
-
-void
-week_view_time_format_changed (WeekView *wv)
-{
- /* FIXME */
-}
-
-void
-week_view_colors_changed (WeekView *wv)
-{
- /* FIXME */
-}
diff --git a/calendar/week-view.h b/calendar/week-view.h
deleted file mode 100644
index 1bf6a4ed02..0000000000
--- a/calendar/week-view.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Week view display for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef WEEK_VIEW_H
-#define WEEK_VIEW_H
-
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-
-BEGIN_GNOME_DECLS
-
-
-#define TYPE_WEEK_VIEW (week_view_get_type ())
-#define WEEK_VIEW(obj) (GTK_CHECK_CAST ((obj), TYPE_WEEK_VIEW, WeekView))
-#define WEEK_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_WEEK_VIEW, WeekViewClass))
-#define IS_WEEK_VIEW(obj) (GTK_CHECK_TYPE ((obj), TYPE_WEEK_VIEW))
-#define IS_WEEK_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_WEEK_VIEW))
-
-
-typedef struct _WeekView WeekView;
-typedef struct _WeekViewClass WeekViewClass;
-
-struct _WeekView {
- GnomeCanvas canvas;
-
- GnomeCalendar *calendar; /* The calendar we are associated to */
-
- time_t week; /* Start of the week we are viewing */
-
- GnomeCanvasItem *title; /* The title of the week view */
-};
-
-struct _WeekViewClass {
- GnomeCanvasClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType week_view_get_type (void);
-
-/* Creates a new week view associated to the specified calendar */
-GtkWidget *week_view_new (GnomeCalendar *calendar, time_t week);
-
-/* Notifies the week view that a calendar object has changed */
-void week_view_update (WeekView *wv, iCalObject *ico, int flags);
-
-/* Notifies the week view about a change of date */
-void week_view_set (WeekView *wv, time_t week);
-
-/* Notifies the week view that the time format has changed */
-void week_view_time_format_changed (WeekView *wv);
-
-/* Notifies the week view that the colors have changed */
-void week_view_colors_changed (WeekView *wv);
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/calendar/year-view.c b/calendar/year-view.c
deleted file mode 100644
index 5744b4a88f..0000000000
--- a/calendar/year-view.c
+++ /dev/null
@@ -1,741 +0,0 @@
-/* Year view display for gncal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Arturo Espinosa <arturo@nuclecu.unam.mx>
- * Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#include <config.h>
-#include <gtk/gtkmain.h>
-#include <gnome.h>
-#include "eventedit.h"
-#include "year-view.h"
-#include "main.h"
-#include "mark.h"
-#include "quick-view.h"
-#include "timeutil.h"
-
-
-#define HEAD_SPACING 4 /* Spacing between year heading and months */
-#define TITLE_SPACING 1 /* Spacing between title and calendar */
-#define SPACING 4 /* Spacing between months */
-
-
-static void year_view_class_init (YearViewClass *class);
-static void year_view_init (YearView *yv);
-static void year_view_destroy (GtkObject *object);
-static void year_view_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void year_view_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-
-static GnomeCanvas *parent_class;
-
-
-GtkType
-year_view_get_type (void)
-{
- static GtkType year_view_type = 0;
-
- if (!year_view_type) {
- GtkTypeInfo year_view_info = {
- "YearView",
- sizeof (YearView),
- sizeof (YearViewClass),
- (GtkClassInitFunc) year_view_class_init,
- (GtkObjectInitFunc) year_view_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- year_view_type = gtk_type_unique (gnome_canvas_get_type (), &year_view_info);
- }
-
- return year_view_type;
-}
-
-static void
-year_view_class_init (YearViewClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = gtk_type_class (gnome_canvas_get_type ());
-
- object_class->destroy = year_view_destroy;
-
- widget_class->size_request = year_view_size_request;
- widget_class->size_allocate = year_view_size_allocate;
-}
-
-/* Resizes the year view's child items. This is done in the idle loop for
- * performance (we avoid resizing on every size allocation).
- */
-static gint
-idle_handler (gpointer data)
-{
- YearView *yv;
- GtkArg arg;
- double head_height;
- double title_height;
- double width, height;
- double month_width;
- double month_height;
- double month_yofs;
- double xofs, yofs;
- double x, y;
- int i;
-
- yv = data;
-
- /* Compute the size we can use */
-
- width = MAX (GTK_WIDGET (yv)->allocation.width, yv->min_width);
- height = MAX (GTK_WIDGET (yv)->allocation.height, yv->min_height);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (yv), 0, 0, width, height);
-
- width--;
- height--;
-
- /* Get the heights of the heading and the titles */
-
- arg.name = "text_height";
- gtk_object_getv (GTK_OBJECT (yv->heading), 1, &arg);
- head_height = GTK_VALUE_DOUBLE (arg) + 2 * HEAD_SPACING;
-
- arg.name = "text_height";
- gtk_object_getv (GTK_OBJECT (yv->titles[0]), 1, &arg);
- title_height = GTK_VALUE_DOUBLE (arg);
-
- /* Offsets */
-
- xofs = (width + SPACING) / 3.0;
- yofs = (height - head_height + SPACING) / 4.0;
-
- /* Month item vertical offset */
-
- month_yofs = title_height + TITLE_SPACING;
-
- /* Month item dimensions */
-
- month_width = (width - 2 * SPACING) / 3.0;
- month_height = (yofs - SPACING) - month_yofs;
-
- /* Adjust the year heading */
-
- gnome_canvas_item_set (yv->heading,
- "x", width / 2.0,
- "y", (double) HEAD_SPACING,
- NULL);
-
- /* Adjust titles and months */
-
- for (i = 0; i < 12; i++) {
- x = (i % 3) * xofs;
- y = head_height + (i / 3) * yofs;
-
- gnome_canvas_item_set (yv->titles[i],
- "x", x + month_width / 2.0,
- "y", y,
- NULL);
-
- gnome_canvas_item_set (yv->mitems[i],
- "x", x,
- "y", y + month_yofs,
- "width", month_width,
- "height", month_height,
- NULL);
- }
-
- /* Done */
-
- yv->need_resize = FALSE;
- return FALSE;
-}
-
-/* Marks the year view as needing a resize, which will be performed during the idle loop */
-static void
-need_resize (YearView *yv)
-{
- if (yv->need_resize)
- return;
-
- yv->need_resize = TRUE;
- yv->idle_id = gtk_idle_add (idle_handler, yv);
-}
-
-/* Callback used to destroy the year view's popup menu when the year view itself is destroyed */
-static void
-destroy_menu (GtkWidget *widget, gpointer data)
-{
- gtk_widget_destroy (GTK_WIDGET (data));
-}
-
-/* Create a new appointment in the highlighted day from the year view's popup menu */
-static void
-new_appointment (GtkWidget *widget, gpointer data)
-{
- YearView *yv;
- time_t *t;
-
- yv = YEAR_VIEW (data);
- t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
-
- event_editor_new_whole_day (yv->calendar, *t);
-}
-
-/* Convenience functions to jump to a view and set the time */
-static void
-do_jump (GtkWidget *widget, gpointer data, char *view_name)
-{
- YearView *yv;
- time_t *t;
-
- yv = YEAR_VIEW (data);
-
- /* Get the time data from the menu item */
-
- t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
-
- /* Set the view and time */
-
- gnome_calendar_set_view (yv->calendar, view_name);
- gnome_calendar_goto (yv->calendar, *t);
-}
-
-/* The following three callbacks set the view in the calendar and change the time */
-
-static void
-jump_to_day (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "dayview");
-}
-
-static void
-jump_to_week (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "weekview");
-}
-
-static void
-jump_to_month (GtkWidget *widget, gpointer data)
-{
- do_jump (widget, data, "monthview");
-}
-
-/* Information for the year view's popup menu */
-static GnomeUIInfo yv_popup_menu[] = {
- GNOMEUIINFO_ITEM_STOCK (N_("_New appointment in this day..."), NULL, new_appointment, GNOME_STOCK_MENU_NEW),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _day"), NULL, jump_to_day, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _week"), NULL, jump_to_week, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_ITEM_STOCK (N_("Jump to this _month"), NULL, jump_to_month, GNOME_STOCK_MENU_JUMP_TO),
- GNOMEUIINFO_END
-};
-
-/* Returns the popup menu cooresponding to the specified year view. If the menu has not been
- * created yet, it creates it and attaches it to the year view.
- */
-static GtkWidget *
-get_popup_menu (YearView *yv)
-{
- GtkWidget *menu;
-
- menu = gtk_object_get_data (GTK_OBJECT (yv), "popup_menu");
-
- if (!menu) {
- menu = gnome_popup_menu_new (yv_popup_menu);
- gtk_object_set_data (GTK_OBJECT (yv), "popup_menu", menu);
- gtk_signal_connect (GTK_OBJECT (yv), "destroy",
- (GtkSignalFunc) destroy_menu,
- menu);
- }
-
- return menu;
-}
-
-/* Executes the year view's popup menu. It may disable/enable some menu items based on the
- * specified flags. A pointer to a time_t value containing the specified time data is set in the
- * "time_data" object data key of the menu items.
- */
-static void
-do_popup_menu (YearView *yv, GdkEventButton *event, int allow_new, int allow_day, int allow_week, int allow_month,
- int year, int month, int day)
-{
- GtkWidget *menu;
- static time_t t;
-
- menu = get_popup_menu (yv);
-
- /* Enable/disable items as appropriate */
-
- gtk_widget_set_sensitive (yv_popup_menu[0].widget, allow_new);
- gtk_widget_set_sensitive (yv_popup_menu[2].widget, allow_day);
- gtk_widget_set_sensitive (yv_popup_menu[3].widget, allow_week);
- gtk_widget_set_sensitive (yv_popup_menu[4].widget, allow_month);
-
- /* Set the day item relevant to the context */
-
- t = time_from_day (year, month, day);
-
- gtk_object_set_data (GTK_OBJECT (yv_popup_menu[0].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (yv_popup_menu[2].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (yv_popup_menu[3].widget), "time_data", &t);
- gtk_object_set_data (GTK_OBJECT (yv_popup_menu[4].widget), "time_data", &t);
-
- gnome_popup_menu_do_popup (menu, NULL, NULL, event, yv);
-}
-
-/* Creates the quick view when the user clicks on a day */
-static void
-do_quick_view_popup (YearView *yv, GdkEventButton *event, int year, int month, int day)
-{
- time_t day_start, day_end;
- GList *list;
- GtkWidget *qv;
- char date_str[256];
-
- day_start = time_from_day (year, month, day);
- day_end = time_day_end (day_start);
-
- list = calendar_get_events_in_range (yv->calendar->cal, day_start, day_end);
-
- strftime (date_str, sizeof (date_str), _("%a %b %d %Y"), localtime (&day_start));
- qv = quick_view_new (yv->calendar, date_str, list);
-
- quick_view_do_popup (QUICK_VIEW (qv), event);
-
- gtk_widget_destroy (qv);
- calendar_destroy_event_list (list);
-}
-
-/* Event handler for days in the year's month items */
-static gint
-day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- YearView *yv;
- GnomeMonthItem *mitem;
- int child_num, day;
-
- mitem = GNOME_MONTH_ITEM (data);
- child_num = gnome_month_item_child2num (mitem, item);
- day = gnome_month_item_num2day (mitem, child_num);
-
- yv = YEAR_VIEW (item->canvas);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if (day == 0)
- break;
-
- if (event->button.button == 1) {
- do_quick_view_popup (yv, (GdkEventButton *) event, mitem->year, mitem->month, day);
- return TRUE;
- } else if (event->button.button == 3) {
- do_popup_menu (yv, (GdkEventButton *) event, TRUE, TRUE, TRUE, TRUE,
- mitem->year, mitem->month, day);
-
- /* We have to stop the signal emission because mark.c will grab it too and
- * set the return value to FALSE. Blargh.
- */
- gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event");
- return TRUE;
- }
-
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Event handler for whole month items */
-static gint
-month_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- YearView *yv;
- GnomeMonthItem *mitem;
-
- mitem = GNOME_MONTH_ITEM (item);
-
- yv = YEAR_VIEW (item->canvas);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if (event->button.button != 3)
- break;
-
- do_popup_menu (yv, (GdkEventButton *) event, FALSE, FALSE, FALSE, TRUE,
- mitem->year, mitem->month, 1);
-
- /* We have to stop the signal emission because mark.c will grab it too and
- * set the return value to FALSE. Blargh.
- */
- gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event");
- return TRUE;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Sets up the month item with the specified index -- connects signals for handling events, etc. */
-static void
-setup_month_item (YearView *yv, int n)
-{
- GnomeCanvasItem *mitem;
- GnomeCanvasItem *item;
- int i;
-
- mitem = yv->mitems[n];
-
- /* Connect the day signals */
-
- for (i = 0; i < 42; i++) {
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mitem), GNOME_MONTH_ITEM_DAY_GROUP + i);
- gtk_signal_connect (GTK_OBJECT (item), "event",
- (GtkSignalFunc) day_event,
- mitem);
- }
-
- /* Connect the month signals */
-
- gtk_signal_connect (GTK_OBJECT (mitem), "event",
- (GtkSignalFunc) month_event,
- NULL);
-
- /* Prepare for prelighting */
-
- month_item_prepare_prelight (GNOME_MONTH_ITEM (mitem), default_color_func, NULL);
-}
-
-/* Computes the minimum size for the year view and stores it in its internal fields */
-static void
-compute_min_size (YearView *yv)
-{
- GtkArg args[2];
- double m_width;
- double m_height;
- double max_width;
- double w;
- int i;
-
- /* Compute the minimum size of the year heading */
-
- args[0].name = "text_width";
- args[1].name = "text_height";
- gtk_object_getv (GTK_OBJECT (yv->heading), 2, args);
-
- m_width = GTK_VALUE_DOUBLE (args[0]);
- m_height = 2 * HEAD_SPACING + GTK_VALUE_DOUBLE (args[1]);
-
- /* Add height of month titles and their spacings */
-
- args[0].name = "text_height";
- gtk_object_getv (GTK_OBJECT (yv->titles[0]), 1, &args[0]);
-
- m_height += 4 * (GTK_VALUE_DOUBLE (args[0]) + TITLE_SPACING);
-
- /* Add width of month titles */
-
- max_width = 0.0;
-
- for (i = 0; i < 12; i++) {
- args[0].name = "text_width";
- gtk_object_getv (GTK_OBJECT (yv->titles[i]), 1, &args[0]);
-
- w = GTK_VALUE_DOUBLE (args[0]);
- if (max_width < w)
- max_width = w;
- }
-
- max_width = 3 * max_width + 2 * SPACING;
-
- if (m_width < max_width)
- m_width = max_width;
-
- /* Add width of month items */
-
- args[0].name = "width";
- args[1].name = "height";
- gtk_object_getv (GTK_OBJECT (yv->mitems[0]), 2, args);
-
- max_width = 3 * GTK_VALUE_DOUBLE (args[0]) + 2 * SPACING;
-
- if (m_width < max_width)
- m_width = max_width;
-
- /* Add height of month items */
-
- m_height += 4 * GTK_VALUE_DOUBLE (args[1]) + 3 * SPACING;
-
- /* Finally, set the minimum width and height in the year view */
-
- yv->min_width = (int) (m_width + 0.5);
- yv->min_height = (int) (m_height + 0.5);
-}
-
-static void
-year_view_init (YearView *yv)
-{
- int i;
- char buf[100];
- struct tm tm;
-
- memset (&tm, 0, sizeof (tm));
-
- /* Heading */
-
- yv->heading = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (yv)),
- gnome_canvas_text_get_type (),
- "anchor", GTK_ANCHOR_N,
- "fontset", HEADING_FONTSET,
- "fill_color", "black",
- NULL);
-
- /* Months */
-
- for (i = 0; i < 12; i++) {
- /* Title */
-
- strftime (buf, 100, "%B", &tm);
- tm.tm_mon++;
-
- yv->titles[i] = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (yv)),
- gnome_canvas_text_get_type (),
- "text", buf,
- "anchor", GTK_ANCHOR_N,
- "fontset", TITLE_FONTSET,
- "fill_color", "black",
- NULL);
-
- /* Month item */
-
- yv->mitems[i] = gnome_month_item_new (gnome_canvas_root (GNOME_CANVAS (yv)));
- gnome_canvas_item_set (yv->mitems[i],
- "anchor", GTK_ANCHOR_NW,
- "start_on_monday", week_starts_on_monday,
- "heading_fontset", DAY_HEADING_FONTSET,
- "day_fontset", NORMAL_DAY_FONTSET,
- NULL);
- setup_month_item (yv, i);
- }
-
- /* We will need to resize the items when we paint for the first time */
-
- yv->old_marked_day = -1;
- yv->idle_id = -1;
- need_resize (yv);
-}
-
-static void
-year_view_destroy (GtkObject *object)
-{
- YearView *yv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_YEAR_VIEW (object));
-
- yv = YEAR_VIEW (object);
-
- if (yv->need_resize) {
- yv->need_resize = FALSE;
- gtk_idle_remove (yv->idle_id);
- }
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-GtkWidget *
-year_view_new (GnomeCalendar *calendar, time_t year)
-{
- YearView *yv;
-
- g_return_val_if_fail (calendar != NULL, NULL);
- g_return_val_if_fail (GNOME_IS_CALENDAR (calendar), NULL);
-
- yv = gtk_type_new (year_view_get_type ());
- yv->calendar = calendar;
-
- year_view_colors_changed (yv);
- year_view_set (yv, year);
- compute_min_size (yv);
-
- return GTK_WIDGET (yv);
-}
-
-static void
-year_view_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- YearView *yv;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_YEAR_VIEW (widget));
- g_return_if_fail (requisition != NULL);
-
- yv = YEAR_VIEW (widget);
-
- requisition->width = yv->min_width;
- requisition->height = yv->min_height;
-}
-
-static void
-year_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- YearView *yv;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_YEAR_VIEW (widget));
- g_return_if_fail (allocation != NULL);
-
- yv = YEAR_VIEW (widget);
-
- if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
- (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
-
- need_resize (yv);
-}
-
-void
-year_view_update (YearView *yv, iCalObject *object, int flags)
-{
- g_return_if_fail (yv != NULL);
- g_return_if_fail (IS_YEAR_VIEW (yv));
-
- /* If only the summary changed, we don't care */
-
- if (object && ((flags & CHANGE_SUMMARY) == flags))
- return;
-
- year_view_set (yv, time_year_begin (time_from_day (yv->year, 0, 1)));
-}
-
-/* Unmarks the old day that was marked as current and marks the current day if appropriate */
-static void
-mark_current_day (YearView *yv)
-{
- time_t t;
- struct tm tm;
- int month_index, day_index;
- GnomeCanvasItem *item;
-
- /* Unmark the old day */
-
- if (yv->old_marked_day != -1) {
- month_index = yv->old_marked_day / 42;
- day_index = yv->old_marked_day % 42;
-
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (yv->mitems[month_index]),
- GNOME_MONTH_ITEM_DAY_LABEL + day_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_DAY_FG),
- "fontset", NORMAL_DAY_FONTSET,
- NULL);
-
- yv->old_marked_day = -1;
- }
-
- /* Mark the new day */
-
- t = time (NULL);
- tm = *localtime (&t);
-
- if ((tm.tm_year + 1900) == yv->year) {
- month_index = tm.tm_mon;
- day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (yv->mitems[month_index]), tm.tm_mday);
- g_assert (day_index != -1);
-
- item = gnome_month_item_num2child (GNOME_MONTH_ITEM (yv->mitems[month_index]),
- GNOME_MONTH_ITEM_DAY_LABEL + day_index);
- gnome_canvas_item_set (item,
- "fill_color", color_spec_from_prop (COLOR_PROP_CURRENT_DAY_FG),
- "fontset", CURRENT_DAY_FONTSET,
- NULL);
-
- yv->old_marked_day = month_index * 42 + day_index;
- }
-}
-
-void
-year_view_set (YearView *yv, time_t year)
-{
- struct tm tm;
- char buf[100];
- int i;
-
- g_return_if_fail (yv != NULL);
- g_return_if_fail (IS_YEAR_VIEW (yv));
-
- tm = *localtime (&year);
- yv->year = tm.tm_year + 1900;
-
- /* Heading */
-
- sprintf (buf, "%d", yv->year);
- gnome_canvas_item_set (yv->heading,
- "text", buf,
- NULL);
-
- /* Months */
-
- for (i = 0; i < 12; i++)
- gnome_canvas_item_set (yv->mitems[i],
- "year", yv->year,
- "month", i,
- NULL);
-
- /* Unmark and re-mark all the months */
-
- for (i = 0; i < 12; i++) {
- unmark_month_item (GNOME_MONTH_ITEM (yv->mitems[i]));
- mark_month_item (GNOME_MONTH_ITEM (yv->mitems[i]), yv->calendar->cal);
- }
-
- mark_current_day (yv);
-}
-
-void
-year_view_time_format_changed (YearView *yv)
-{
- int i;
-
- g_return_if_fail (yv != NULL);
- g_return_if_fail (IS_YEAR_VIEW (yv));
-
- for (i = 0; i < 12; i++)
- gnome_canvas_item_set (yv->mitems[i],
- "start_on_monday", week_starts_on_monday,
- NULL);
-
- year_view_set (yv, time_year_begin (time_from_day (yv->year, 0, 1)));
-}
-
-void
-year_view_colors_changed (YearView *yv)
-{
- int i;
-
- g_return_if_fail (yv != NULL);
- g_return_if_fail (IS_YEAR_VIEW (yv));
-
- for (i = 0; i < 12; i++) {
- colorify_month_item (GNOME_MONTH_ITEM (yv->mitems[i]), default_color_func, NULL);
- mark_month_item (GNOME_MONTH_ITEM (yv->mitems[i]), yv->calendar->cal);
- }
-
- mark_current_day (yv);
-}
diff --git a/calendar/year-view.h b/calendar/year-view.h
deleted file mode 100644
index 77e63366d5..0000000000
--- a/calendar/year-view.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Year view display for Gnomecal
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Authors: Arturo Espinosa <arturo@nuclecu.unam.mx>
- * Federico Mena <federico@nuclecu.unam.mx>
- */
-
-#ifndef YEAR_VIEW_H
-#define YEAR_VIEW_H
-
-#include <libgnome/gnome-defs.h>
-#include "gnome-cal.h"
-#include "gnome-month-item.h"
-
-
-BEGIN_GNOME_DECLS
-
-
-#define TYPE_YEAR_VIEW (year_view_get_type ())
-#define YEAR_VIEW(obj) (GTK_CHECK_CAST ((obj), TYPE_YEAR_VIEW, YearView))
-#define YEAR_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_YEAR_VIEW, YearViewClass))
-#define IS_YEAR_VIEW(obj) (GTK_CHECK_TYPE ((obj), TYPE_YEAR_VIEW))
-#define IS_YEAR_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_YEAR_VIEW))
-
-
-typedef struct _YearView YearView;
-typedef struct _YearViewClass YearViewClass;
-
-struct _YearView {
- GnomeCanvas canvas;
-
- GnomeCalendar *calendar; /* The calendar we are associated to */
-
- int year; /* The year we are displaying */
-
- GnomeCanvasItem *heading; /* Big heading with year */
- GnomeCanvasItem *titles[12]; /* Titles for months */
- GnomeCanvasItem *mitems[12]; /* Month items */
-
- int old_marked_day; /* The day that is marked as the current day */
-
- int min_width; /* Minimum dimensions of year view, used for size_request*/
- int min_height;
-
- guint idle_id; /* ID of idle handler for resize */
-
- int need_resize : 1; /* Specifies whether we need to resize the canvas items or not */
-};
-
-struct _YearViewClass {
- GnomeCanvasClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType year_view_get_type (void);
-
-/* Creates a new year view widget associated to the specified calendar */
-GtkWidget *year_view_new (GnomeCalendar *calendar, time_t year);
-
-/* Notifies the year view that a calendar object has changed */
-void year_view_update (YearView *yv, iCalObject *ico, int flags);
-
-/* Notifies the year view about a change of date */
-void year_view_set (YearView *yv, time_t year);
-
-/* Notifies the year view that the time format has changed */
-void year_view_time_format_changed (YearView *yv);
-
-/* Notifies the year view that colors have changed */
-void year_view_colors_changed (YearView *yv);
-
-
-END_GNOME_DECLS
-
-#endif
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 2fae06080d..0000000000
--- a/camel/Makefile.am
+++ /dev/null
@@ -1,119 +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-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 091cc82251..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.Guiheneuf@aful.org>
- */
-
-/* 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 839423ccad..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.Guiheneuf@aful.org>
- *
- * 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 c6ac8e7891..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.Guiheneuf@aful.org>
- *
- * 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 83701306a3..0000000000
--- a/camel/camel-exception-list.def
+++ /dev/null
@@ -1,15 +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,
-
-
diff --git a/camel/camel-exception.c b/camel/camel-exception.c
deleted file mode 100644
index 961034cd78..0000000000
--- a/camel/camel-exception.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-execpetion.c : exception utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org>
- *
- * 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_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 384f23a6f8..0000000000
--- a/camel/camel-exception.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camel-execpetion.h : exception utils */
-
-/*
- *
- * Author :
- * Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org>
- *
- * 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;
-
-CamelException *camel_exception_new ();
-void camel_exception_free (CamelException *exception);
-
-
-void camel_exception_clear (CamelException *exception);
-void camel_exception_set (CamelException *ex,
- ExceptionId id,
- const char *desc);
-
-
-void camel_exception_xfer (CamelException *ex_dst,
- CamelException *ex_src);
-
-
-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 623bf616af..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.Guiheneuf@aful.org>
- *
- * 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 67a800fa4c..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.Guiheneuf@aful.org>
- *
- * 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 26723e5b86..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.Guiheneuf@aful.org>
- *
- * 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 56009e047e..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.Guiheneuf@aful.org>
- *
- * 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 a4265dae60..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.Guiheneuf@aful.org>
- *
- * 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 9b00ab02f6..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.Guiheneuf@aful.org>
- *
- * 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 2c1ed686a6..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.Guiheneuf@aful.org>
- *
- * 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 7fd2d71cb5..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.Guiheneuf@aful.org>
- *
- * 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 eccf75ea07..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.Guiheneuf@aful.org>
- *
- * 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 a25611f7d7..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.Guiheneuf@aful.org>
- *
- * 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 ff247986bd..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.Guiheneuf@aful.org>
- *
- * 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 7cecad2738..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.Guiheneuf@aful.org>
- *
- * 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 07f937f837..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.Guiheneuf@aful.org>
- *
- * 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 035b16aaf6..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.Guiheneuf@aful.org>
- *
- * 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 a8287d04cc..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.Guiheneuf@aful.org>
- *
- * 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 6669b22de7..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.Guiheneuf@aful.org>
- *
- * 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 7f21c2fd6b..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.Guiheneuf@aful.org>
- *
- * 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 9e492101c1..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.Guiheneuf@aful.org>
- *
- * 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 0da6b0e78d..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.Guiheneuf@aful.org>
- *
- * 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 b72cb941c9..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.Guiheneuf@aful.org>
- *
- * 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 1c61a67e36..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.Guiheneuf@aful.org>
- *
- * 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 1fd31be4e8..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.Guiheneuf@aful.org>
- *
- * 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 8ad666d950..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.Guiheneuf@aful.org>
- *
- * 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 a1593a7563..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.Guiheneuf@aful.org>
- *
- * 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 227aba5f3c..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.Guiheneuf@aful.org>
- *
- * 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 82b9995148..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.Guiheneuf@aful.org>
- *
- * 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 4433327e82..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.Guiheneuf@aful.org>
- *
- * 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 d934b55a83..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.Guiheneuf@aful.org>
- *
- * 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 e7e28ca3e0..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.Guiheneuf@aful.org>
- *
- * 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 410396a2cf..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.Guiheneuf@aful.org>
- *
- * 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 1081528d4c..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.Guiheneuf@aful.org>
- *
- * 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 2e42148c38..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.Guiheneuf@aful.org>
- *
- * 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 6acc11a7cb..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.Guiheneuf@aful.org>
- *
- * 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 cc14acf59d..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.Guiheneuf@aful.org>
- *
- * 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 0181c41aeb..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.Guiheneuf@aful.org>
- *
- * 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 ed1bf9e382..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.Guiheneuf@aful.org>
- *
- * 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 dadff72a64..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.Guiheneuf@aful.org>
- *
- * 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 48f909dc2d..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.Guiheneuf@aful.org>
- *
- * 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 5d859b0893..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.Guiheneuf@aful.org>
- *
- * 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 a4282b1310..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.Guiheneuf@aful.org>
- *
- * 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 e49ddd7777..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.Guiheneuf@aful.org>
- *
- * 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 852b8f1909..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.Guiheneuf@aful.org>
- *
- * 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 9280bdc216..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.Guiheneuf@aful.org>
- *
- * 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 3621b1e790..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.Guiheneuf@aful.org>
- *
- * 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 98a30caf20..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.Guiheneuf@aful.org>
- *
- * 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 cf15a245bf..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.Guiheneuf@aful.org>
- *
- * 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 a6b3aa7416..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.Guiheneuf@aful.org>
- *
- * 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 6cb6abbdd4..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.Guiheneuf@aful.org>
- *
- * 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 93b295b8ce..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.Guiheneuf@aful.org>
- *
- * 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 614f1e85c4..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.Guiheneuf@aful.org>
- *
- * 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 014ef9d4b6..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.Guiheneuf@aful.org>
- *
- * 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 d05a61b0cc..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.Guiheneuf@aful.org>
- *
- * 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 cadd789518..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.Guiheneuf@aful.org>
- *
- * 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 e04ff7ccfb..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.Guiheneuf@aful.org>
- *
- * 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 610969d934..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.Guiheneuf@aful.org>
- *
- * 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 cd957639a8..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.Guiheneuf@aful.org>
- *
- * 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 d8c143fd46..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.Guiheneuf@aful.org>
- *
- * 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 95235503ea..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.Guiheneuf@aful.org>
- *
- * 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 36d5eaba3d..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.Guiheneuf@aful.org>
- *
- * 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 83f1dbb2f3..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.Guiheneuf@aful.org>
- *
- * 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 21600be8bf..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.Guiheneuf@aful.org>
- *
- * 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 fee6bf5204..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.Guiheneuf@aful.org>
- *
- * 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/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 1d6d91f846..0000000000
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ /dev/null
@@ -1,509 +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.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/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 "gstring-util.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);
-#if 0
-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 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;
-#if 0
- camel_folder_class->delete_messages = _delete_messages;
- camel_folder_class->list_subfolders = _list_subfolders;
- 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;
-
-
- 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;
-
- /* 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 */
- if (!camel_folder_exists (folder, ex)) 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;
- }
-
- /** Ber : tu dois supprimer le fichier maintenant */
- return TRUE;
-}
diff --git a/camel/providers/mbox/camel-mbox-folder.h b/camel/providers/mbox/camel-mbox-folder.h
deleted file mode 100644
index 7de357e9f1..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.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_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-store.c b/camel/providers/mbox/camel-mbox-store.c
deleted file mode 100644
index 743d16879a..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.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-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 c55766c7cd..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.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_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 a8b9ed585f..0000000000
--- a/camel/string-utils.c
+++ /dev/null
@@ -1,256 +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.Guiheneuf@aful.org>
- *
- * 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);
-
-}
-
-
-
-
-
-
diff --git a/camel/string-utils.h b/camel/string-utils.h
deleted file mode 100644
index f67d3434d4..0000000000
--- a/camel/string-utils.h
+++ /dev/null
@@ -1,70 +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.Guiheneuf@aful.org>
- *
- * 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);
-
-#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 97cddce72d..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.Guiheneuf@aful.org>
- *
- * 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 4a333e1c60..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.Guiheneuf@aful.org>
- *
- * 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 6983084e12..0000000000
--- a/composer/Makefile.am
+++ /dev/null
@@ -1,45 +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)/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 8129a1a790..0000000000
--- a/configure.in
+++ /dev/null
@@ -1,113 +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
-
-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 ******************************
-dnl AM_PATH_BONOBO(0.1.0, [
-dnl AC_DEFINE(HAVE_BONOBO)
-dnl have_bonobo=true
-dnl ],[
-dnl have_bonobo=false
-dnl ])
-dnl AM_CONDITIONAL(BONOBO, $have_bonobo)
-
-
-
-
-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 ` `glib-config --libs gthread`"
-EXTRA_GNOME_CFLAGS="`gnome-config --cflags gnomeui libglade ` `glib-config --cflags gthread`"
-AC_SUBST(EXTRA_GNOME_LIBS)
-AC_SUBST(EXTRA_GNOME_CFLAGS)
-
-
-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
-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
-])
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/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-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/libversit/.cvsignore b/libversit/.cvsignore
deleted file mode 100644
index e995588475..0000000000
--- a/libversit/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.deps
-Makefile
-Makefile.in
diff --git a/libversit/Makefile.am b/libversit/Makefile.am
deleted file mode 100644
index ce54e0bc25..0000000000
--- a/libversit/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-
-noinst_LTLIBRARIES = libversit.la
-
-libversit_la_SOURCES = \
- vcc.y \
- vcc.h \
- vobject.c \
- vobject.h \
- port.h \
- vcaltmp.c \
- vcaltmp.h
-
-EXTRA_DIST = README.TXT vcaltest.c vctest.c
diff --git a/libversit/README.TXT b/libversit/README.TXT
deleted file mode 100644
index c8ce8b0979..0000000000
--- a/libversit/README.TXT
+++ /dev/null
@@ -1,951 +0,0 @@
-NOTE: If you used the earlier APIs released by Versit
-then you will want to look at the document "migrate.doc"
-included with this package. It contains a discussion of
-the differences between the old API and this one.
-
-----------------------------------------------------------------
-
-The vCard/vCalendar C interface is implemented in the set
-of files as follows:
-
-vcc.y, yacc source, and vcc.c, the yacc output you will use
-implements the core parser
-
-vobject.c implements an API that insulates the caller from
-the parser and changes in the vCard/vCalendar BNF
-
-port.h defines compilation environment dependent stuff
-
-vcc.h and vobject.h are header files for their .c counterparts
-
-vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions
-which you may find useful.
-
-test.c is a standalone test driver that exercises some of
-the features of the APIs provided. Invoke test.exe on a
-VCARD/VCALENDAR input text file and you will see the pretty
-print output of the internal representation (this pretty print
-output should give you a good idea of how the internal
-representation looks like -- there is one such output in the
-following too). Also, a file with the .out suffix is generated
-to show that the internal representation can be written back
-in the original text format.
-
------------------------------------------------------------------
-
-
- VObject for VCard/VCalendar
-
-Table of Contents
-=================
-1. VObject
-2. Internal Representations of VCard/VCalendar
-3. Iterating Through VObject's Properties or Values
-4. Pretty Printing a VObject Tree
-5. Building A VObject Representation of A VCard/VCalendar
-6. Converting A VObject Representation Into Its Textual Representation
-7. Miscellaneous Notes On VObject APIs usages
-8. Brief descriptions of each APIs
-9. Additional Programming Notes.
-
-This document is mainly about the VObject and its APIs. The main
-use of a VObject is to represent a VCard or a VCalendar inside
-a program. However, its use is not limited to aforemention as it
-can represent an arbitrary information that makes up of a tree or
-forest of properties/values.
-
-1. VObject
- =======
-A VObject can have a name (id) and a list of associated properties and
-a value. Each property is itself a VObject.
-
-2. Internal Representations of VCard/VCalendar
- ===========================================
-A list of VCard or a VCalendar is represented by a list of VObjects.
-The name (id) of the VObjects in the list is either VCCardProp or
-VCCalProp. Each of these VObjects can have a list of properties.
-Since a property is represented as a VObject, each of these properties
-can have a name, a list of properties, and a value.
-
-For example, the input file "vobject.vcf":
-
-BEGIN:VCARD
-N:Alden;Roland
-FN:Roland H. Alden
-ORG:AT&T;Versit Project Office
-TITLE:Consultant
-EMAIL;WORK;PREF;INTERNET:sf!rincon!ralden@alden.attmail.com
-EMAIL;INTERNET:ralden@sfgate.com
-EMAIL;MCIMail:242-2200
-LABEL;DOM;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A=
-Suite 2208=0A=
-One Pine Street=0A=
-San Francisco, CA 94111
-LABEL;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A=
-Suite 2208=0A=
-One Pine Street=0A=
-San Francisco, CA 94111=0A=
-U.S.A.
-TEL;WORK;PREF;MSG:+1 415 296 9106
-TEL;WORK;FAX:+1 415 296 9016
-TEL;MSG;CELL:+1 415 608 5981
-ADR:;Suite 2208;One Pine Street;San Francisco;CA;94111;U.S.A.
-SOUND:ROW-LAND H ALL-DIN
-LOGO;GIF;BASE64:
- R0lGODdhpgBOAMQAAP///+/v797e3s7Ozr29va2trZycnIyMjHt7e2NjY1JSUkJC
- QjExMSEhIRAQEO///87v9973/73n95zW71K13jGl1nvG50Kt3iGc1gCMzq3e94zO
- 7xCU1nO952O15wAAACwAAAAApgBOAAAF/yAgjmRpnmiqrmzrvnAsz3Rt33iu73zv
- /8CgcEj8QTaeywWTyWCUno2kSK0KI5tLc8vtNi+WiHVMlj0mFK96nalsxOW4fPSw
- cNj4tQc+7xcjGh4WExJTJYUTFkp3eU0eEH6RkpOUlTARhRoWm5ydFpCWoS0QEqAu
- ARKaHRcVjV0borEoFl0cSre4Sq67FA+yvwAeTU8XHZ7HmxS6u2wVfMCVpAE3pJoW
- ylrMptDcOqSF4OHg3eQ5pInInb7lcc86mNbLzBXsZbRfUOn6ucyNHvVWJHCpQFDf
- MWwEEzLqx2YCQCqF3OnItClJNmYcJD7cSAKTuI/gtnEcOQKkyVIk6/+ds5CkFcMM
- 61LiENikwi1jBnNyuvUSjwWZOS5uIZarqNFcNl32XMMB6I06GgoJ+bZp1ZKeDl8E
- +MC1K1cBIhZ4HUu2LAsCZdOWRQDt20lxIlccSHsgrNq7Xc/ixcsWmNu34WKyYJCW
- gQjCe9XqTZy2L4pv04gg2sSKSc8OLgTcBSuWsdkVaD2TdXyiQxebFyjo1Gnx6tJm
- LuaqrdtZtNfFtruSNmF5IKujwIsmJbjwtRqNJhrcNVw79wcRAgogmE4ArIjQzj/s
- JvHAGCFDQR4UqigPK4sBe62XwO51OwADiMcqUG+iOdcFAL+hW20BfAoEexlwAnu6
- mZDAXQ1EVh//WfhxJB5gIbHgwFgOTOiVAgOuVQKAfKFg3weGwSBYFZMp4hpDGKyA
- 3lgJKECWgiMQyBVpW+0V4oJjNfhCNkR1IgWEb21QlRK9GdfFCgeOZYBsXgm4noYj
- GEBhAQHYh0J8XenoQnFGdrkUciJY6FUAK15ogozakcBhliKsyZWHDMZQ0wWC/Aim
- DB6h01KRr/lXQgFxAqDcWDACgCZpUnrVQJtjwTnWjS6MWAYqqfDnSaEkJOlVXQBo
- 2pWTMUJ53WgAuPncCR9q6VQMAYjZlXWJmknCoSUM2p4BC+SaKwG88hoZlvfFMM4f
- hQh5TXkv+RklWYtC91mopJIAKFkJlDAW/wF25ShnLbeo5gmQ+1FGkJdrKCuCi2OR
- BuwHBcwqKgABrMtVAgpem61XkLbAJ7n8uiIpvGVhO4KpH1QLbbpqLheZvQCkGoNL
- thSzSTg2UGVBBzbtaxwKsYrmgLvRAlCmWgwMAADD66rKAgR3XlGspcdkZYK8ibU7
- asgEl+XAyB8I7PCqMWiWncGGimpfAgO4ypXSPpOVLwsRCDJxRD2AoyeRRv5kApO5
- fXwzwvfOKLKtaTWtbQxccmGLTZy8xYlVSvXbhbk0M2YzrYfJJ0K8m+V9NgxpyC04
- UycI/aiuiH9Y8NftDUwWp1Wm5UABnAUKwwRsPFGBt4Oc9PZvGvNLwf8JOZt8Arpe
- eY23yDovwIDiBX74NAsPVLDJj3Hh4JEExsKcjrlKf9DsCVx3ZfLqAKBuG1s/A90C
- z2KjYHjjyPOdG1spz6BBUr+BcUxUb1nDCTa/VZD2Uv+YkLPAKJC9dNEh7628WgqI
- ybzlaA+ufxMa6bxC6ciLUQLcx5UGIAAsAkDA6wQkOxrcY39yo4cQMNWCAPTKV1R4
- wPkgaBxzOc8FtMiF1NoGoXBRJjgoPApmPsjCFlbMdzCM4TFy50IXxI2DPcHAv2rY
- gghsEIeu8CAPW6ABIPYEFkOsAeaMyIz0JfGJUExBBGRIRX0IMYovWCIT1eBELNpA
- i1vcgta8iANPCIQOghzQABl30J0tXqBla4wjFLFQxZzAUY42CIAd5OYBCuKxB2c4
- I0b28EcrQKADgmSKB9RYyDhA4BqCxIBqrtjIMTwoFeCjYSU3KZMQAAA7
-
-BEGIN:VCALENDAR
-DCREATED:19960523T100522
-PRODID:-//Alden Roland/Hand Crafted In North Carolina//NONSGML Made By Hand//EN
-VERSION:0.3
-BEGIN:VEVENT
-START:19960523T120000
-END:19960523T130000
-SUBTYPE:PHONE CALL
-SUMMARY:VERSIT PDI PR Teleconference/Interview
-DESCRIPTION:VERSIT PDI PR Teleconference/Interview With Tom Streeter and Alden Roland
-END:VEVENT
-BEGIN:VEVENT
-START:19960523T113000
-END:19960523T115500
-SUBTYPE:LUNCH
-SUMMARY:Eat in the cafeteria today
-END:VEVENT
-END:VCALENDAR
-
-END:VCARD
-
-
-will conceptually be be represented as
- vcard
- VCNameProp
- VCFamilyNameProp=Alden
- VCGivenNameProp=Roland
- VCFullNameProp=Roland H.Alden
- ....
-
-note that
- EMAIL;WORK;PREF;INTERNET:sf!rincon!ralden@alden.attmail.com
-will be represented as:
- VCEmailAddress=sf!rincon!ralden@alden.attmail.com
- VCWork
- VCPreferred
- VCInternet
-where the lower level properties are properties of the property
-VCEmailAddress.
-
-Groupings are flattened out in the VObject representation such
-that:
- a.b:blah
- a.c:blahblah
-are represented as:
- b=blah
- VCGrouping=a
- c=blahblah
- VCGrouping=a
-i.e. one can read the above as:
- the property "b" has value "blah" and property "VCGrouping"
- with the value "a".
- the property "c" has value "blahblah" and property "VCGrouping"
- with the value "a".
-likewise, multi-level groupings are flatten similarly. e.g.
- a.b.c:blah
- a.b.e:blahblah
--->
- c=blah
- VCGrouping=b
- VCGrouping=a
- e=blahblah
- VCGrouping=b
- VCGrouping=a
-which read:
- the property "c" has value "blah" and property "VCGrouping"
- with the value "b" which has property "VCGrouping"
- with value "a".
- the property "e" has value "blahblah" and property "VCGrouping"
- with the value "b" which has property "VCGrouping"
- with value "a".
-
-3. Iterating Through VObject's Properties or Values
- ================================================
-The following is a skeletal form of iterating through
-all properties of a vobject, o:
-
- // assume the object of interest, o, is of type VObject
- VObjectIterator i;
- initPropIterator(&i,o);
- while (moreIteration(&i)) {
- VObject *each = nextVObject(&i);
- // ... do something with "each" property
- }
-
-Use the API vObjectName() to access a VObject's name.
-Use the API vObjectValueType() to determine if a VObject has
- a value. For VCard/VCalendar application, you
- should not need this function as practically
- all values are either of type VCVT_USTRINGZ or
- VCVT_RAW (i.e set by setVObjectUStringZValue and
- setVObjectAnyValue APIs respectively), and the
- value returned by calls to vObjectUStringZValue
- and vObjectAnyValue are 0 if a VObject has no
- value. (There is a minor exception where VObject with
- VCDataSizeProp has value that is set by
- setVObjectLongValue).
-Use the APIs vObject???Value() to access a VObject's value.
- where ??? is the expected type.
-Use the APIs setvObject???Value() to set or modify a VObject's value.
- where ??? is the expected type.
-Use the API isAPropertyOf() to query if a name match the name of
- a property of a VObject. Since isAPropertyOf() return
- the matching property, we can use that to retrieve
- a property and subsequently the value of the property.
-
-4. Pretty Printing a VObject Tree
- ==============================
-VObject tree can be pretty printed with the printVObject() function.
-The output of pretty printing a VObject representation of the input
-test file "vobject.vcf" is shown below. Note that the indentation
-indicates the tree hirerarchy where the immediate children nodes
-of a parent node is all at the same indentation level and the
-immediate children nodes are the immediate properties of the
-associated parent nodes. In the following, {N,FN,ORG,TITLE,...}
-are immediate properties of VCARD. {F and G} are properties of N
-with value {"Alden" and "Roland"} respectively; FN has no property
-but has the value "Roland H. Alden"; EMAIL has value and
-the properties WORK, PREF, and INTERNET.
-
-
-VCARD
- N
- F="Alden"
- G="Roland"
- FN="Roland H. Alden"
- ORG
- ORGNAME="AT&T"
- OUN="Versit Project Office"
- TITLE="Consultant"
- EMAIL="sf!rincon!ralden@alden.attmail.com"
- WORK
- PREF
- INTERNET
- EMAIL="ralden@sfgate.com"
- INTERNET
- EMAIL="242-2200"
- MCIMail
- LABEL="Roland H. Alden
- Suite 2208
- One Pine Street
- San Francisco, CA 94111"
- DOM
- POSTAL
- PARCEL
- HOME
- WORK
- QP
- LABEL="Roland H. Alden
- Suite 2208
- One Pine Street
- San Francisco, CA 94111
- U.S.A."
- POSTAL
- PARCEL
- HOME
- WORK
- QP
- TEL="+1 415 296 9106"
- WORK
- PREF
- MSG
- TEL="+1 415 296 9016"
- WORK
- FAX
- TEL="+1 415 608 5981"
- MSG
- CELL
- ADR
- EXT ADD="Suite 2208"
- STREET="One Pine Street"
- L="San Francisco"
- R="CA"
- PC="94111"
- C="U.S.A."
- SOUND="ROW-LAND H ALL-DIN"
- LOGO=[raw data]
- GIF
- BASE64
- DataSize=1482
-VCALENDAR
- DCREATED="19960523T100522"
- PRODID="-//Alden Roland/Hand Crafted In North Carolina//NONSGML Made By Hand//EN"
- VERSION="0.3"
- VEVENT
- START="19960523T120000"
- END="19960523T130000"
- SUBTYPE="PHONE CALL"
- SUMMARY="VERSIT PDI PR Teleconference/Interview"
- DESCRIPTION="VERSIT PDI PR Teleconference/Interview With Tom Streeter and Alden Roland"
- VEVENT
- START="19960523T113000"
- END="19960523T115500"
- SUBTYPE="LUNCH"
- SUMMARY="Eat in the cafeteria today"
-
-5. Building A VObject Representation of A VCard/VCalendar
- ======================================================
-The parser in vcc.y converts an input file with one or more
-VCard/VCalendar that is in their textual representation
-into their corresponding VObject representation.
-
-VObject representation of a VCard/VCalendar can also be built
-directly with calls to the VObject building APIs. e.g.
-
- VObject *prop;
- VObject *vcard = newVObject(VCCardProp);
- prop = addProp(vcard,VCNameProp);
- addPropValue(prop,VCFamilyNameProp,"Alden");
- addPropValue(prop,VCGivenNameProp,"Roland");
- addPropValue(vcard,VCFullNameProp,"Roland H. Alden");
- ....
-
-6. Converting A VObject Representation Into Its Textual Representation
- ===================================================================
-The VObject representation can be converted back to its textual
-representation via the call to writeVObject() or writeMemVObject()
-API. e.g.
- a. to write to a file:
- // assume vcard is of type VObject
- FILE *fp = fopen("alden.vcf","w");
- writeVObject(fp,vcard);
- a. to write to memory, and let the API allocate the required memory.
- char* clipboard = writeVObject(0,0,vcard);
- ... do something to clipboard
- free(clipboard);
- b. to write to a user allocated buffer:
- char clipboard[16384];
- int len = 16384;
- char *buf = writeVObject(clipboard,&len,vcard);
- ... buf will be equal to clipboard if the write
- is successful otherwise 0.
-
-In the case of writing to memory, the memory buffer can be either
-allocated by the API or the user. If the user allocate the
-memory for the buffer, then the length of the buffer needs to be
-communicated to the API via a variable. The variable passed as
-the length argument will be overwritten with the actual size
-of the text output. A 0 return value from writeMemVObject()
-indicates an error which could be caused by overflowing the
-size of the buffer or lack of heap memory.
-
-7. Miscellaneous Notes On VObject APIs usages
- ==========================================
-a. vcc.h -- contains basic interfaces to the parser:
- VObject* Parse_MIME(const char *input, unsigned long len);
- VObject* Parse_MIME_FromFile(FILE *file);
- -- both of this return a null-terminated list of
- VObject that is either a VCARD or VCALENDAR.
- To iterate through this list, do
- VObject *t, *v;
- v = Parse_Mime_FromFile(fp);
- while (v) {
- // ... do something to v.
- t = v;
- v = nextVObjectInList(v);
- cleanVObject(t);
- }
- note that call to cleanVObject will release
- resource used to represent the VObject.
-
-b. vobject.h -- contains basic interfaces to the VObject APIs.
- see the header for more details.
- The structure of VObject is purposely (hiddened) not exposed
- to the user. Every access has to be done via
- the APIs. This way, if we need to change the
- structure or implementation, the client need not
- recompile as long as the interfaces remain the
- same.
-
-c. values of a property is determined by the property definition
- itself. The vobject APIs does not attempt to enforce
- any of such definition. It is the consumer responsibility
- to know what value is expected from a property. e.g
- most properties have unicode string value, so to access
- the value of these type of properties, you will use
- the vObjectUStringZValue() to read the value and
- setVObjectUStringZValue() to set or modify the value.
- Refer to the VCard and VCalendar specifications for
- the definition of each property.
-
-d. properties name (id) are case incensitive.
-
-8. Brief descriptions of each APIs
- ===============================
- * the predefined properties' names (id) are listed under vobject.h
- each is of the form VC*Prop. e.g.
- #define VC7bitProp "7BIT"
- #define VCAAlarmProp "AALARM"
- ....
-
- * consumer of a VObject can only define pointers to VObject.
-
- * a variable of type VObjectIterator, say "i", can be used to iterate
- through a VObject's properties, say "o". The APIs related to
- VObjectIterator are:
- void initPropIterator(VObjectIterator *i, VObject *o);
- -- e.g. usage
- initPropIterator(&i,o);
- int moreIteration(VObjectIterator *i);
- -- e.g. usage
- while (moreIteration(&i)) { ... }
- VObject* nextVObject(VObjectIterator *i);
- -- e.g. usage
- while (moreIteration(&i)) {
- VObject *each = nextVObject(&i);
- }
-
- * VObject can be chained together to form a list. e.g. of such
- use is in the parser where the return value of the parser is
- a link list of VObject. A link list of VObject can be
- built by:
- void addList(VObject **o, VObject *p);
- and iterated by
- VObject* nextVObjectInList(VObject *o);
- -- next VObjectInList return 0 if the list
- is exhausted.
-
- * the following APIs are mainly used to construct a VObject tree:
- VObject* newVObject(const char *id);
- -- used extensively internally by VObject APIs but when
- used externally, its use is mainly limited to the
- construction of top level object (e.g. an object
- with VCCardProp or VCCalendarProp id).
-
- void deleteVObject(VObject *p);
- -- to deallocate single VObject, for most user, use
- cleanVObject(VObject *o) instead for freeing all
- resources associated with the VObject.
-
- char* dupStr(const char *s, unsigned int size);
- -- duplicate a string s. If size is 0, the string is
- assume to be a null-terminated.
-
- void deleteStr(const char *p);
- -- used to deallocate a string allocated by dupStr();
-
- void setVObjectName(VObject *o, const char* id);
- -- set the id of VObject o. This function is not
- normally used by the user. The setting of id
- is normally done as part of other APIs (e.g.
- addProp()).
-
- void setVObjectStringZValue(VObject *o, const char *s);
- -- set a string value of a VObject.
-
- void setVObjectUStringZValue(VObject *o, const wchar_t *s);
- -- set a Unicode string value of a VObject.
-
- void setVObjectIntegerValue(VObject *o, unsigned int i);
- -- set an integer value of a VObject.
-
- void setVObjectLongValue(VObject *o, unsigned long l);
- -- set an long integer value of a VObject.
-
- void setVObjectAnyValue(VObject *o, void *t);
- -- set any value of a VObject. The value type is
- unspecified.
-
- VObject* setValueWithSize(VObject *prop, void *val, unsigned int size);
- -- set a raw data (stream of bytes) value of a VObject
- whose size is size. The internal VObject representation
- is
- this object = val
- VCDataSizeProp=size
- i.e. the value val will be attached to the VObject prop
- and a property of VCDataSize whose value is size
- is also added to the object.
-
- void setVObjectVObjectValue(VObject *o, VObject *p);
- -- set a VObject as the value of another VObject.
-
- const char* vObjectName(VObject *o);
- -- retrieve the VObject's Name (i.e. id).
-
- const char* vObjectStringZValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- null-terminated string.
-
- const wchar_t* vObjectUStringZValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- null-terminated unicode string.
-
- unsigned int vObjectIntegerValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- integer.
-
- unsigned long vObjectLongValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- long integer.
-
- void* vObjectAnyValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- any value.
-
- VObject* vObjectVObjectValue(VObject *o);
- -- retrieve the VObject's value interpreted as
- a VObject.
-
- VObject* addVObjectProp(VObject *o, VObject *p);
- -- add a VObject p as a property of VObject o.
- (not normally used externally for building a
- VObject).
-
- VObject* addProp(VObject *o, const char *id);
- -- add a property whose name is id to VObject o.
-
- VObject* addPropValue(VObject *o, const char *id, const char *v);
- -- add a property whose name is id and whose value
- is a null-terminated string to VObject o.
-
- VObject* addPropSizedValue(VObject *o, const char *id,
- const char *v, unsigned int size);
- -- add a property whose name is id and whose value
- is a stream of bytes of size size, to VObject o.
-
- VObject* addGroup(VObject *o, const char *g);
- -- add a group g to VObject o.
- e.g. if g is a.b.c, you will have
- o
- c
- VCGroupingProp=b
- VCGroupingProp=a
- and the object c is returned.
-
- VObject* isAPropertyOf(VObject *o, const char *id);
- -- query if a property by the name id is in o and
- return the VObject that represent that property.
-
- void printVObject(VObject *o);
- -- pretty print VObject o to stdout (for debugging use).
-
- void writeVObject(FILE *fp, VObject *o);
- -- convert VObject o to its textual representation and
- write it to file.
-
- char* writeMemVObject(char *s, int *len, VObject *o);
- -- convert VObject o to its textual representation and
- write it to memory. If s is 0, then memory required
- to hold the textual representation will be allocated
- by this API. If a variable len is passed, len will
- be overwriten with the byte size of the textual
- representation. If s is non-zero, then s has to
- be a user allocated buffer whose size has be passed
- in len as a variable. Memory allocated by the API
- has to be freed with call to free. The return value
- of this API is either the user supplied buffer,
- the memory allocated by the API, or 0 (in case of
- failure).
-
- void cleanStrTbl();
- -- this function has to be called when all
- VObject has been destroyed.
-
- void cleanVObject(VObject *o);
- -- release all resources used by VObject o.
-
- wchar_t* fakeUnicode(const char *ps, int *bytes);
- -- convert char* to wchar_t*.
-
- extern int uStrLen(const wchar_t *u);
- -- length of unicode u.
-
- char *fakeCString(const wchar_t *u);
- -- convert wchar_t to CString (blindly assumes that
- this could be done).
-
-9. Additional Programming Notes
- ============================
-In the following notes, please refers to the listing
-of Example.vcf and its VObject Representation
-(shown at the end of this section).
-
-* Handling the Return Value of the VCard/VCalendar Parser
- The example input text file contains two root VObjects
- (a VCalendar and a VCard). The output of the VCard/VCalendar
- parser is a null-terminated list of VObjects. For this
- particular input file, the list will have two VObjects.
- The following shows a template for iterating through the
- output of the Parser:
-
- VObject *t, *v;
- v = Parse_Mime_fromFileName("example.vcf");
- while (v) {
- // currently, v will either be a VCard or a VCalendar
- // do whatever your application need to do to
- // v here ...
- t = v;
- v = nextVObjectInList(v);
- cleanVObject(t);
- }
-
-* Iterating Through a VCard/VCalendar VObject
- From the VObject APIs point of view, a VCard VObject
- is the same as a VCalendar VObject. However, the application
- needs to know what are in a VCard or a VCalendar.
- For example, A VCalendar VObject can have VCDCreatedProp,
- a VCGEOLocationProp, etc, and one or more VCEventProp and
- or VCTodoProp. The VCEventProp and VCTodoProp can have
- many properties of their own, which in turn could have
- more properties (e.g. VCDAlarmProp can be a VCEventProp
- VObject's property, and VCRunTimeProp can be a
- VCDAlarmProp VObject's property. Because a VObject tree
- can be arbitrarily complex, in general, to process all
- properties and values of a VObject tree, a recursive walk
- is desirable. An example recursive VObject tree walk
- can be found in the vobject.c source lines for printVObject*
- and writeVObject* APIs. Depending on what the application need
- to do with a VCard or a VCalendar, a recursive walk
- of the VObject tree may or may not be desirable. An example
- template of a non-recursive walk is shown below:
-
- void processVCardVCalendar(char *inputFile)
- {
- VObject *t, *v;
- v = Parse_Mime_fromFileName(inputFile);
- while (v) {
- char *n = vObjectName(v);
- if (strcmp(n,VCCardProp) == 0) {
- do_VCard(v);
- }
- else if (strcmp(n,VCCalendarProp) == 0) {
- do_VCalendar(v);
- }
- else {
- // don't know how to handle anything else!
- }
- t = v;
- v = nextVObjectInList(v);
- cleanVObject(t);
- }
- }
-
- void do_VCard(VObject *vcard)
- {
- VObjectIterator t;
- initPropIterator(&t,vcard);
- while (moreIteration(&t)) {
- VObject *eachProp = nextVObject(&t);
- // The primarly purpose of this example is to
- // show how to iterate through a VCard VObject,
- // it is not meant to be efficient at all.
- char *n = vObjectName(eachProp);
- if (strcmp(n,VCNameProp)==0) {
- do_name(eachProp);
- }
- else if (strcmp(n,VCEmailProp)==0) {
- do_email(eachProp);
- }
- else if (strcmp(n,VCLabelProp)==0) {
- do_label(eachProp);
- }
- else if ....
- }
- }
-
- void do_VCalendar(VObject *vcal)
- {
- VObjectIterator t;
- initPropIterator(&t,vcard);
- while (moreIteration(&t)) {
- VObject *eachProp = nextVObject(&t);
- // The primarly purpose of this example is to
- // show how to iterate through a VCalendar VObject,
- // it is not meant to be efficient at all.
- char *n = vObjectName(eachProp);
- if (strcmp(n,VCDCreatedProp)==0) {
- do_DCreated(eachProp);
- }
- else if (strcmp(n,VCVersionProp)==0) {
- do_Version(eachProp);
- }
- else if (strcmp(n,VCTodoProp)==0) {
- do_Todo(eachProp);
- }
- else if (strcmp(n,VCEventProp)==0) {
- do_Event(eachProp);
- }
- else if ....
- }
- }
-
- void do_Todo(VObject *vtodo) { ... }
-
- void do_Event(VObject *vevent) { ... }
-
- ...
-
-* Property's Values and Properties
- The VObject APIs do not attempt to check for the
- correctness of the values of a property. Nor do they
- will prevent the user from attaching a non-VCard/VCalendar
- standard property to a VCard/VCalendar property. Take
- the example of line [11] of the example, "O.K" is not
- a valid value of VCStatusProp. It is up to the application
- to accept or reject the value of a property.
-
-* Output of printVObject
- PrintVObject pretty prints a VObject tree in human
- readable form. See the listing at the end of the file
- for an example output of printVObject on the example
- input file "Example.vcf".
-
- Note that binary data are not shown in the output of
- printVObject. Instead, a note is made ([raw data]) to
- indicate that there exists such a binary data.
-
-* Note on Binary Data
- When the value of a property is a binary data, it is only
- useful to know the size of the binary data.
-
- In the case of the VCard/VCalendar parser, it chooses
- to represent the size information as a separate property
- called VCDataSizeProp whose value is the size of the binary
- data. The APIs sequence to construct the VObject subtree
- of line [44] of Example.vcf is
-
- // VObject *vcard;
- VObject *p1 = addProp(vcard,VCLogoProp);
- (void) addProp(p1,VCGIFProp);
- (void) addProp(p1,VCBASE64Prop);
- VObject *p2 = addProp(p1,VCDataSizeProp);
- (void) setVObjectLongValue(p2,1482);
- setVObjectAnyValue(vcard,...pointer to binary data);
-
- Note the presence of VCBase64Prop will cause the
- writeVObject API to output the binary data as BASE64 text.
- For VCard/VCalendar application, having the VCBase64Prop
- property is pratically always neccessary for property with
- binary data as its value.
-
-* Note on Quoted-Printable String
- String value with embedded newline are written out as
- quoted-prinatable string. It is therefore important
- to mark a property with a string value that has
- one or more embedded newlines, with the VCQutedPrintableProp
- property. e.g.
-
- // VObject *root;
- char *msg="To be\nor\nnot to be";
- VObject *p = addPropValue(root,VCDescriptionProp,msg);
- // the following is how you mark a property with
- // a property. In this case, the marker is
- // VCQuotedPrintableProp
- addProp(p,VCQuotedPrintableProp);
-
-* Note on Unicode
- Although, the current parser takes ASCII text file only,
- string values are all stored as Unicode in the VObject tree.
- For now, when using the VObject APIs to construct a
- VObject tree, one should always convert ASCII string value
- to a Unicode string value:
-
- // VObject *root;
- VObject *p = addProp(root,VCSomeProp);
- setVObjectUStringZValue(p,fakeUnicode(someASCIIStringZvalue));
-
- An API is provided to simplify the above process:
-
- addPropValue(root,VCSomeProp,someASCIIStringZValue);
-
- Note that someASCIISTringZValue is automatically converted to
- Unicode by addPropValue API, where as, the former code
- sequence do an explicit call to fakeUnicode.
-
- To read back the value, one should use the vObjectUStringZValue
- API not vObjectStringZValue API. The value returned by the
- vObjectUStringZValue API is a Unicode string. If the application
- do not know how to handle Unicode string, it can use the
- fakeCString API to convert it back to ASCII string (as long
- as the conversion is meaningful).
-
- Note that fakeCString return a heap allocated memory. It is
- important to call deleteStr on fakeCString return value if
- it is not longer required (or there will be memory leak).
-
- NOTE: Unfortunately, at the point when this document is written,
- there is still no consensus on how Unicode is to be handled
- in the textual representation of VCard/VCalendar. So, there
- is no version of writeVObject and the parser to output and
- input Unicode textual representation of VCard/VCalendar.
-
-
-Example.vcf
------------
-line
-number Input Text (example.vcf)
------- ----------
-1 BEGIN:VCALENDAR
-2 DCREATED:19961102T100522
-3 GEO:0,0
-4 VERSION:1.0
-5 BEGIN:VEVENT
-6 DTSTART:19961103T000000
-7 DTEND:20000101T000000
-8 DESCRIPTION;QUOTED-PRINTABLE:To be =0A=
-9 or =0A=
-10 not to be
-11 STATUS:O.K.
-12 X-ACTION:No action required
-13 DALARM:19961103T114500;5;3;Enjoy
-14 MALARM:19970101T120000;;;johny@nowhere.com;Call Mom.
-15 END:VEVENT
-16
-17 BEGIN:VTODO
-18 DUE:19960614T0173000
-19 DESCRIPTION:Relex.
-20 END:VTODO
-21
-22 END:VCALENDAR
-23
-24 BEGIN:VCARD
-25 N:Alden;Roland
-26 FN:Roland H. Alden
-27 ORG:AT&T;Versit Project Office
-28 TITLE:Consultant
-29 EMAIL;WORK;PREF;INTERNET:ralden@ralden.com
-30 LABEL;DOM;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A=
-31 Suite 2208=0A=
-32 One Pine Street=0A=
-33 San Francisco, CA 94111
-34 LABEL;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A=
-35 Suite 2208=0A=
-36 One Pine Street=0A=
-37 San Francisco, CA 94111=0A=
-38 U.S.A.
-39 TEL;WORK;PREF;MSG:+1 415 296 9106
-40 TEL;WORK;FAX:+1 415 296 9016
-41 TEL;MSG;CELL:+1 415 608 5981
-42 ADR:;Suite 2208;One Pine Street;San Francisco;CA;94111;U.S.A.
-43 SOUND:ROW-LAND H ALL-DIN
-44 LOGO;GIF;BASE64:
-45 R0lGODdhpgBOAMQAAP///+/v797e3s7Ozr29va2trZycnIyMjHt7e2NjY1JSUkJC
- ... 30 lines of BASE64 data not shown here.
-76 END:VCARD
-
-
-VObject Representation of Example.vcf:
--------------------------------------
-line
-in
-text
-file VObject Tree as Printed by printVObject API
----- -------------------------------------------
-1 VCALENDAR
-2 DCREATED="19961102T100522"
-3 GEO="0,0"
-4 VERSION="1.0"
-5 VEVENT
-6 DTSTART="19961103T000000"
-7 DTEND="20000101T000000"
-8 DESCRIPTION="To be
-9 or
-10 not to be"
-8 QUOTED-PRINTABLE
-11 STATUS="O.K."
-12 X-ACTION="No action required"
-13 DALARM
-13 RUNTIME="19961103T114500"
-13 SNOOZETIME="5"
-13 REPEATCOUNT="3"
-13 DISPLAYSTRING="Enjoy"
-14 MALARM
-14 RUNTIME="19970101T120000"
-14 EMAIL="johny@nowhere.com"
-14 NOTE="Call Mom"
-17 VTODO
-18 DUE="19960614T0173000"
-19 DESCRIPTION="Relex."
-24 VCARD
-25 N
-25 F="Alden"
-25 G="Roland"
-26 FN="Roland H. Alden"
-27 ORG
-27 ORGNAME="AT&T"
-27 OUN="Versit Project Office"
-28 TITLE="Consultant"
-29 EMAIL="ralden@alden.com"
-29 WORK
-29 PREF
-29 INTERNET
-30 LABEL="Roland H. Alden
-31 Suite 2208
-32 One Pine Street
-33 San Francisco, CA 94111"
-30 DOM
-30 POSTAL
-30 PARCEL
-30 HOME
-30 WORK
-30 QUOTED-PRINTABLE
-34 LABEL="Roland H. Alden
-35 Suite 2208
-36 One Pine Street
-37 San Francisco, CA 94111
-38 U.S.A."
-34 POSTAL
-34 PARCEL
-34 HOME
-34 WORK
-34 QUOTED-PRINTABLE
-39 TEL="+1 415 296 9106"
-39 WORK
-39 PREF
-39 MSG
-40 TEL="+1 415 296 9016"
-40 WORK
-40 FAX
-41 TEL="+1 415 608 5981"
-41 MSG
-41 CELL
-42 ADR
-42 EXT ADD="Suite 2208"
-42 STREET="One Pine Street"
-42 L="San Francisco"
-42 R="CA"
-42 PC="94111"
-42 C="U.S.A."
-43 SOUND="ROW-LAND H ALL-DIN"
-44 LOGO=[raw data]
-44 GIF
-44 BASE64
-44 DATASIZE=1482
-
diff --git a/libversit/port.h b/libversit/port.h
deleted file mode 100644
index 1768beebd8..0000000000
--- a/libversit/port.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-#ifndef __PORT_H__
-#define __PORT_H__ 1
-
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-extern "C" {
-#endif
-
-/* some of these #defines are commented out because */
-/* Visual C++ sets them on the compiler command line instead */
-
-/* #define _DEBUG */
-/* #define WIN32 */
-/* #define WIN16 */
-/* #define _WINDOWS */
-/* #define __MWERKS__ */
-/* #define INCLUDEMFC */
-
-#define vCardClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCard"
-#define vCalendarClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCalendar"
-
-/* The above strings vCardClipboardFormat and vCalendarClipboardFormat
-are globally unique IDs which can be used to generate clipboard format
-ID's as per the requirements of a specific platform. For example, in
-Windows they are used as the parameter in a call to RegisterClipboardFormat.
-For example:
-
- CLIPFORMAT foo = RegisterClipboardFormat(vCardClipboardFormat);
-
-*/
-
-#define vCardMimeType "text/x-vCard"
-#define vCalendarMimeType "text/x-vCalendar"
-
-#define DLLEXPORT(t) t
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#define stricmp strcasecmp
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-}
-#endif
-
-#endif /* __PORT_H__ */
diff --git a/libversit/vcaltest.c b/libversit/vcaltest.c
deleted file mode 100644
index 5528aab1d1..0000000000
--- a/libversit/vcaltest.c
+++ /dev/null
@@ -1,118 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include "vcaltmp.h"
-
-#if 0
-This testcase would generate a file call "frankcal.vcf" with
-the following content:
-
-BEGIN:VCALENDAR
-DCREATED:19960523T100522
-GEO:37.24,-17.87
-PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN
-VERSION:0.3
-BEGIN:VEVENT
-DTSTART:19960523T120000
-DTEND:19960523T130000
-DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A=
-With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A=
-activities with European Press representatives.
-SUMMARY:VERSIT PDI PR Teleconference/Interview
-SUBTYPE:PHONE CALL
-STATUS:CONFIRMED
-TRANSP:19960523T100522-4000F100582713-009251
-UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2
-DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!;
-MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!;
-PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2;
-X-LDC-OR2-OLE:c:\temp\agenda.doc
-END:VEVENT
-
-BEGIN:VTODO
-DUE:19960614T0173000
-DESCRIPTION:Review VCalendar helper API.
-END:VTODO
-
-END:VCALENDAR
-
-#endif
-
-FILE *cfp;
-
-void testVcalAPIs() {
- FILE *fp;
- VObject *vcal, *vevent;
-#if _CONSOLE
- cfp = stdout;
-#else
- cfp = fopen("vcaltest.out","w");
-#endif
- if (cfp == 0) return;
- vcal = vcsCreateVCal(
- "19960523T100522",
- "37.24,-17.87",
- "-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN",
- 0,
- "0.3"
- );
-
- vevent = vcsAddEvent(
- vcal,
- "19960523T120000",
- "19960523T130000",
- "VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.",
- "VERSIT PDI PR Teleconference/Interview",
- "PHONE CALL",
- 0,
- "CONFIRMED",
- "19960523T100522-4000F100582713-009251",
- "http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2",
- 0
- );
-
- vcsAddDAlarm(vevent, "19960523T114500", "5", "3",
- "Your Telecon Starts At Noon!!!");
- vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com",
- "Remember 05/23 Noon Telecon!!!");
- vcsAddPAlarm(vevent, "19960523T115500", 0 ,0,
- "c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2");
-
- addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc");
-
- vcsAddTodo(
- vcal,
- 0,
- "19960614T0173000",
- 0,
- "Review VCalendar helper API.",
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- );
-
- /* now do something to the resulting VObject */
- /* pretty print on stdout for fun */
- printVObject(cfp,vcal);
- /* open the output text file */
-
-#define OUTFILE "frankcal.vcf"
-
- fp = fopen(OUTFILE, "w");
- if (fp) {
- /* write it in text form */
- writeVObject(fp,vcal);
- fclose(fp);
- }
- else {
- fprintf(cfp,"open output file '%s' failed\n", OUTFILE);
- }
- if (cfp != stdout) fclose(cfp);
- }
-
-void main() {
- testVcalAPIs();
- }
-
diff --git a/libversit/vcaltmp.c b/libversit/vcaltmp.c
deleted file mode 100644
index ccb21a649a..0000000000
--- a/libversit/vcaltmp.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
-This module provides some helper APIs for creating
-a VCalendar object.
-
-Note on APIs:
- 1. The APIs does not attempt to verify if the arguments
- passed are correct.
- 2. Where the argument to an API is not applicable, pass
- the value 0.
- 3. See the test program at the bottom of this file as an
- example of usage.
- 4. This code calls APIs in vobject.c.
-
-*/
-
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-
-#include <stdio.h>
-#include <string.h>
-#include "vcaltmp.h"
-
-
-DLLEXPORT(VObject*) vcsCreateVCal(
- char *date_created,
- char *location,
- char *product_id,
- char *time_zone,
- char *version
- )
- {
- VObject *vcal = newVObject(VCCalProp);
-#define Z(p,v) if (v) addPropValue(vcal,p,v);
- Z(VCDCreatedProp, date_created);
- Z(VCLocationProp, location)
- Z(VCProdIdProp, product_id)
- Z(VCTimeZoneProp, time_zone)
- Z(VCVersionProp, version)
-#undef Z
- return vcal;
- }
-
-
-DLLEXPORT(VObject*) vcsAddEvent(
- VObject *vcal,
- char *start_date_time,
- char *end_date_time,
- char *description,
- char *summary,
- char *categories,
- char *classification,
- char *status,
- char *transparency,
- char *uid,
- char *url
- )
- {
- VObject *vevent = addProp(vcal,VCEventProp);
-#define Z(p,v) if (v) addPropValue(vevent,p,v);
- Z(VCDTstartProp,start_date_time);
- Z(VCDTendProp,end_date_time);
- if (description) {
- VObject *p = addPropValue(vevent,VCDescriptionProp,description);
- if (strchr(description,'\n'))
- addProp(p,VCQuotedPrintableProp);
- }
- Z(VCSummaryProp,summary);
- Z(VCCategoriesProp,categories);
- Z(VCClassProp,classification);
- Z(VCStatusProp,status);
- Z(VCTranspProp,transparency);
- Z(VCUniqueStringProp,uid);
- Z(VCURLProp,url);
-#undef Z
- return vevent;
- }
-
-
-DLLEXPORT(VObject*) vcsAddTodo(
- VObject *vcal,
- char *start_date_time,
- char *due_date_time,
- char *date_time_complete,
- char *description,
- char *summary,
- char *priority,
- char *classification,
- char *status,
- char *uid,
- char *url
- )
- {
- VObject *vtodo = addProp(vcal,VCTodoProp);
-#define Z(p,v) if (v) addPropValue(vtodo,p,v);
- Z(VCDTstartProp,start_date_time);
- Z(VCDueProp,due_date_time);
- Z(VCCompletedProp,date_time_complete);
- if (description) {
- VObject *p = addPropValue(vtodo,VCDescriptionProp,description);
- if (strchr(description,'\n'))
- addProp(p,VCQuotedPrintableProp);
- }
- Z(VCSummaryProp,summary);
- Z(VCPriorityProp,priority);
- Z(VCClassProp,classification);
- Z(VCStatusProp,status);
- Z(VCUniqueStringProp,uid);
- Z(VCURLProp,url);
-#undef Z
- return vtodo;
- }
-
-
-DLLEXPORT(VObject*) vcsAddAAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *audio_content
- )
- {
- VObject *aalarm= addProp(vevent,VCAAlarmProp);
-#define Z(p,v) if (v) addPropValue(aalarm,p,v);
- Z(VCRunTimeProp,run_time);
- Z(VCSnoozeTimeProp,snooze_time);
- Z(VCRepeatCountProp,repeat_count);
- Z(VCAudioContentProp,audio_content);
-#undef Z
- return aalarm;
- }
-
-
-DLLEXPORT(VObject*) vcsAddMAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *email_address,
- char *note
- )
- {
- VObject *malarm= addProp(vevent,VCMAlarmProp);
-#define Z(p,v) if (v) addPropValue(malarm,p,v);
- Z(VCRunTimeProp,run_time);
- Z(VCSnoozeTimeProp,snooze_time);
- Z(VCRepeatCountProp,repeat_count);
- Z(VCEmailAddressProp,email_address);
- Z(VCNoteProp,note);
-#undef Z
- return malarm;
- }
-
-
-DLLEXPORT(VObject*) vcsAddDAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *display_string
- )
- {
- VObject *dalarm= addProp(vevent,VCDAlarmProp);
-#define Z(p,v) if (v) addPropValue(dalarm,p,v);
- Z(VCRunTimeProp,run_time);
- Z(VCSnoozeTimeProp,snooze_time);
- Z(VCRepeatCountProp,repeat_count);
- Z(VCDisplayStringProp,display_string);
-#undef Z
- return dalarm;
- }
-
-
-DLLEXPORT(VObject*) vcsAddPAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *procedure_name
- )
- {
- VObject *palarm= addProp(vevent,VCPAlarmProp);
-#define Z(p,v) if (v) addPropValue(palarm,p,v);
- Z(VCRunTimeProp,run_time);
- Z(VCSnoozeTimeProp,snooze_time);
- Z(VCRepeatCountProp,repeat_count);
- Z(VCProcedureNameProp,procedure_name);
-#undef Z
- return palarm;
- }
-
-
-#ifdef _TEST
-
-#if 0
-This testcase would generate a file call "frankcal.vcf" with
-the following content:
-
-BEGIN:VCALENDAR
-DCREATED:19960523T100522
-GEO:37.24,-17.87
-PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN
-VERSION:0.3
-BEGIN:VEVENT
-DTSTART:19960523T120000
-DTEND:19960523T130000
-DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A=
-With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A=
-activities with European Press representatives.
-SUMMARY:VERSIT PDI PR Teleconference/Interview
-CATEGORIES:PHONE CALL
-STATUS:CONFIRMED
-TRANSP:19960523T100522-4000F100582713-009251
-UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2
-DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!;
-MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!;
-PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2;
-X-LDC-OR2-OLE:c:\temp\agenda.doc
-END:VEVENT
-
-BEGIN:VTODO
-DUE:19960614T0173000
-DESCRIPTION:Review VCalendar helper API.
-END:VTODO
-
-END:VCALENDAR
-
-#endif
-
-void testVcalAPIs() {
- FILE *fp;
- VObject *vcal = vcsCreateVCal(
- "19960523T100522",
- "37.24,-17.87",
- "-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN",
- 0,
- "0.3"
- );
-
- VObject *vevent = vcsAddEvent(
- vcal,
- "19960523T120000",
- "19960523T130000",
- "VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.",
- "VERSIT PDI PR Teleconference/Interview",
- "PHONE CALL",
- 0,
- "CONFIRMED",
- "19960523T100522-4000F100582713-009251",
- "http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2",
- 0
- );
-
- vcsAddDAlarm(vevent, "19960523T114500", "5", "3",
- "Your Telecon Starts At Noon!!!");
- vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com",
- "Remember 05/23 Noon Telecon!!!");
- vcsAddPAlarm(vevent, "19960523T115500", 0 ,0,
- "c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2");
-
- addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc");
-
- vcsAddTodo(
- vcal,
- 0,
- "19960614T0173000",
- 0,
- "Review VCalendar helper API.",
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- );
-
- /* now do something to the resulting VObject */
- /* pretty print on stdout for fun */
- printVObject(vcal);
- /* open the output text file */
-
-#define OUTFILE "frankcal.vcf"
-
- fp = fopen(OUTFILE, "w");
- if (fp) {
- /* write it in text form */
- writeVObject(fp,vcal);
- fclose(fp);
- }
- else {
- printf("open output file '%s' failed\n", OUTFILE);
- }
- }
-
-void main() {
- testVcalAPIs();
- }
-
-#endif
-
-
-/* end of source file vcaltmp.c */
diff --git a/libversit/vcaltmp.h b/libversit/vcaltmp.h
deleted file mode 100644
index 4c4afde963..0000000000
--- a/libversit/vcaltmp.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-#include "vcc.h"
-
-#ifndef __VCALTMP_H__
-#define __VCALTMP_H__
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-extern "C" {
-#endif
-
-extern DLLEXPORT(VObject*) vcsCreateVCal(
- char *date_created,
- char *location,
- char *product_id,
- char *time_zone,
- char *version
- );
-
-extern DLLEXPORT(VObject*) vcsAddEvent(
- VObject *vcal,
- char *start_date_time,
- char *end_date_time,
- char *description,
- char *summary,
- char *categories,
- char *classification,
- char *status,
- char *transparency,
- char *uid,
- char *url
- );
-
-
-extern DLLEXPORT(VObject*) vcsAddTodo(
- VObject *vcal,
- char *start_date_time,
- char *due_date_time,
- char *date_time_complete,
- char *description,
- char *summary,
- char *priority,
- char *classification,
- char *status,
- char *uid,
- char *url
- );
-
-
-extern DLLEXPORT(VObject*) vcsAddAAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *audio_content
- );
-
-
-extern DLLEXPORT(VObject*) vcsAddMAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *email_address,
- char *note
- );
-
-
-extern DLLEXPORT(VObject*) vcsAddDAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *display_string
- );
-
-
-extern DLLEXPORT(VObject*) vcsAddPAlarm(
- VObject *vevent,
- char *run_time,
- char *snooze_time,
- char *repeat_count,
- char *procedure_name
- );
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-}
-#endif
-
-#endif /* __VCALTMP_H__ */
-
-
diff --git a/libversit/vcc.c b/libversit/vcc.c
deleted file mode 100644
index 1230dda67e..0000000000
--- a/libversit/vcc.c
+++ /dev/null
@@ -1,2142 +0,0 @@
-
-/* A Bison parser, made from vcc.y
- by GNU Bison version 1.27
- */
-
-#define YYBISON 1 /* Identify Bison output. */
-
-#define EQ 257
-#define COLON 258
-#define DOT 259
-#define SEMICOLON 260
-#define SPACE 261
-#define HTAB 262
-#define LINESEP 263
-#define NEWLINE 264
-#define BEGIN_VCARD 265
-#define END_VCARD 266
-#define BEGIN_VCAL 267
-#define END_VCAL 268
-#define BEGIN_VEVENT 269
-#define END_VEVENT 270
-#define BEGIN_VTODO 271
-#define END_VTODO 272
-#define ID 273
-#define STRING 274
-
-#line 1 "vcc.y"
-
-
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-/*
- * src: vcc.c
- * doc: Parser for vCard and vCalendar. Note that this code is
- * generated by a yacc parser generator. Generally it should not
- * be edited by hand. The real source is vcc.y. The #line directives
- * can be commented out here to make it easier to trace through
- * in a debugger. However, if a bug is found it should
- * be fixed in vcc.y and this file regenerated.
- */
-
-
-/* debugging utilities */
-#if __DEBUG
-#define DBG_(x) printf x
-#else
-#define DBG_(x)
-#endif
-
-/**** External Functions ****/
-
-/* assign local name to parser variables and functions so that
- we can use more than one yacc based parser.
-*/
-
-#define yyparse mime_parse
-#define yylex mime_lex
-#define yyerror mime_error
-#define yychar mime_char
-/* #define p_yyval p_mime_val */
-#undef yyval
-#define yyval mime_yyval
-/* #define p_yylval p_mime_lval */
-#undef yylval
-#define yylval mime_yylval
-#define yydebug mime_debug
-#define yynerrs mime_nerrs
-#define yyerrflag mime_errflag
-#define yyss mime_ss
-#define yyssp mime_ssp
-#define yyvs mime_vs
-#define yyvsp mime_vsp
-#define yylhs mime_lhs
-#define yylen mime_len
-#define yydefred mime_defred
-#define yydgoto mime_dgoto
-#define yysindex mime_sindex
-#define yyrindex mime_rindex
-#define yygindex mime_gindex
-#define yytable mime_table
-#define yycheck mime_check
-#define yyname mime_name
-#define yyrule mime_rule
-#define YYPREFIX "mime_"
-
-
-#ifndef _NO_LINE_FOLDING
-#define _SUPPORT_LINE_FOLDING 1
-#endif
-
-/* undef below if compile with MFC */
-/* #define INCLUDEMFC 1 */
-
-#if defined(WIN32) || defined(_WIN32)
-#ifdef INCLUDEMFC
-#include <afx.h>
-#endif
-#endif
-
-#include <string.h>
-#ifndef __MWERKS__
-#include <malloc.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "vcc.h"
-
-/**** Types, Constants ****/
-
-#define YYDEBUG 1 /* 1 to compile in some debugging code */
-#define MAXTOKEN 256 /* maximum token (line) length */
-#define YYSTACKSIZE 50 /* ~unref ? */
-#define MAXLEVEL 10 /* max # of nested objects parseable */
- /* (includes outermost) */
-
-
-/**** Global Variables ****/
-int mime_lineNum, mime_numErrors; /* yyerror() can use these */
-static VObject* vObjList;
-static VObject *curProp;
-static VObject *curObj;
-static VObject* ObjStack[MAXLEVEL];
-static int ObjStackTop;
-
-
-/* A helpful utility for the rest of the app. */
-#if __CPLUSPLUS__
-extern "C" {
-#endif
-
- extern void Parse_Debug(const char *s);
- extern void yyerror(char *s);
-
-#if __CPLUSPLUS__
- };
-#endif
-
-int yyparse();
-
-enum LexMode {
- L_NORMAL,
- L_VCARD,
- L_VCAL,
- L_VEVENT,
- L_VTODO,
- L_VALUES,
- L_BASE64,
- L_QUOTED_PRINTABLE
- };
-
-/**** Private Forward Declarations ****/
-static int pushVObject(const char *prop);
-static VObject* popVObject();
-static char* lexDataFromBase64();
-static void lexPopMode(int top);
-static int lexWithinMode(enum LexMode mode);
-static void lexPushMode(enum LexMode mode);
-static void enterProps(const char *s);
-static void enterAttr(const char *s1, const char *s2);
-static void enterValues(const char *value);
-static void mime_error_(char *s);
-
-
-#line 179 "vcc.y"
-typedef union {
- char *str;
- VObject *vobj;
- } YYSTYPE;
-#include <stdio.h>
-
-#ifndef __cplusplus
-#ifndef __STDC__
-#define const
-#endif
-#endif
-
-
-
-#define YYFINAL 62
-#define YYFLAG -32768
-#define YYNTBASE 21
-
-#define YYTRANSLATE(x) ((unsigned)(x) <= 274 ? yytranslate[x] : 51)
-
-static const char yytranslate[] = { 0,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20
-};
-
-#if YYDEBUG != 0
-static const short yyprhs[] = { 0,
- 0, 2, 3, 7, 9, 11, 13, 14, 19, 20,
- 24, 27, 29, 30, 36, 38, 39, 43, 45, 48,
- 50, 53, 55, 59, 61, 62, 67, 69, 71, 72,
- 73, 78, 79, 83, 86, 88, 90, 92, 94, 95,
- 100, 101, 105, 106, 111, 112
-};
-
-static const short yyrhs[] = { 22,
- 0, 0, 24, 23, 22, 0, 24, 0, 25, 0,
- 40, 0, 0, 11, 26, 28, 12, 0, 0, 11,
- 27, 12, 0, 29, 28, 0, 29, 0, 0, 31,
- 4, 30, 37, 9, 0, 1, 0, 0, 36, 32,
- 33, 0, 36, 0, 34, 33, 0, 34, 0, 6,
- 35, 0, 36, 0, 36, 3, 36, 0, 19, 0,
- 0, 39, 6, 38, 37, 0, 39, 0, 20, 0,
- 0, 0, 13, 41, 43, 14, 0, 0, 13, 42,
- 14, 0, 44, 43, 0, 44, 0, 45, 0, 48,
- 0, 28, 0, 0, 15, 46, 28, 16, 0, 0,
- 15, 47, 16, 0, 0, 17, 49, 28, 18, 0,
- 0, 17, 50, 18, 0
-};
-
-#endif
-
-#if YYDEBUG != 0
-static const short yyrline[] = { 0,
- 207, 210, 213, 213, 217, 218, 221, 227, 232, 238,
- 244, 245, 248, 252, 258, 261, 266, 266, 272, 273,
- 276, 279, 283, 290, 293, 294, 294, 298, 299, 302,
- 306, 308, 311, 314, 315, 318, 320, 321, 324, 331,
- 336, 342, 348, 355, 360, 366
-};
-#endif
-
-
-#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
-
-static const char * const yytname[] = { "$","error","$undefined.","EQ","COLON",
-"DOT","SEMICOLON","SPACE","HTAB","LINESEP","NEWLINE","BEGIN_VCARD","END_VCARD",
-"BEGIN_VCAL","END_VCAL","BEGIN_VEVENT","END_VEVENT","BEGIN_VTODO","END_VTODO",
-"ID","STRING","mime","vobjects","@1","vobject","vcard","@2","@3","items","item",
-"@4","prop","@5","attr_params","attr_param","attr","name","values","@6","value",
-"vcal","@7","@8","calitems","calitem","eventitem","@9","@10","todoitem","@11",
-"@12", NULL
-};
-#endif
-
-static const short yyr1[] = { 0,
- 21, 23, 22, 22, 24, 24, 26, 25, 27, 25,
- 28, 28, 30, 29, 29, 32, 31, 31, 33, 33,
- 34, 35, 35, 36, 38, 37, 37, 39, 39, 41,
- 40, 42, 40, 43, 43, 44, 44, 44, 46, 45,
- 47, 45, 49, 48, 50, 48
-};
-
-static const short yyr2[] = { 0,
- 1, 0, 3, 1, 1, 1, 0, 4, 0, 3,
- 2, 1, 0, 5, 1, 0, 3, 1, 2, 1,
- 2, 1, 3, 1, 0, 4, 1, 1, 0, 0,
- 4, 0, 3, 2, 1, 1, 1, 1, 0, 4,
- 0, 3, 0, 4, 0, 3
-};
-
-static const short yydefact[] = { 0,
- 7, 30, 1, 2, 5, 6, 0, 0, 0, 0,
- 0, 15, 24, 0, 0, 0, 16, 10, 39, 43,
- 38, 0, 0, 36, 37, 33, 3, 8, 11, 13,
- 0, 0, 0, 0, 0, 31, 34, 29, 0, 17,
- 20, 0, 42, 0, 46, 28, 0, 27, 21, 22,
- 19, 40, 44, 14, 25, 0, 29, 23, 26, 0,
- 0, 0
-};
-
-static const short yydefgoto[] = { 60,
- 3, 11, 4, 5, 7, 8, 21, 15, 38, 16,
- 31, 40, 41, 49, 17, 47, 57, 48, 6, 9,
- 10, 22, 23, 24, 32, 33, 25, 34, 35
-};
-
-static const short yypact[] = { -9,
- -6, -5,-32768, 7,-32768,-32768, 2, -1, 19, 15,
- -9,-32768,-32768, 1, 0, 26, 27,-32768, 16, 17,
--32768, 23, 9,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
- 33, 2, 24, 2, 25,-32768,-32768, 13, 22,-32768,
- 33, 28,-32768, 29,-32768,-32768, 36, 40,-32768, 39,
--32768,-32768,-32768,-32768,-32768, 22, 13,-32768,-32768, 48,
- 49,-32768
-};
-
-static const short yypgoto[] = {-32768,
- 41,-32768,-32768,-32768,-32768,-32768, -7,-32768,-32768,-32768,
--32768, 10,-32768,-32768, -34, -4,-32768,-32768,-32768,-32768,
--32768, 31,-32768,-32768,-32768,-32768,-32768,-32768,-32768
-};
-
-
-#define YYLAST 54
-
-
-static const short yytable[] = { 14,
- 12, 1, 12, 2, 50, -9, -4, 29, -32, 12,
- 18, -12, 28, -12, -12, -12, -12, -12, 13, 12,
- 13, 58, -35, 19, 42, 20, 44, 13, 26, 30,
- -18, -41, 46, 19, -45, 20, 36, 13, 39, 43,
- 13, 56, 45, 52, 54, 55, 53, 61, 62, 0,
- 51, 27, 59, 37
-};
-
-static const short yycheck[] = { 7,
- 1, 11, 1, 13, 39, 12, 0, 15, 14, 1,
- 12, 12, 12, 14, 15, 16, 17, 18, 19, 1,
- 19, 56, 14, 15, 32, 17, 34, 19, 14, 4,
- 4, 16, 20, 15, 18, 17, 14, 19, 6, 16,
- 19, 3, 18, 16, 9, 6, 18, 0, 0, -1,
- 41, 11, 57, 23
-};
-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/lib/bison.simple"
-/* This file comes from bison-1.27. */
-
-/* Skeleton output parser for bison,
- Copyright (C) 1984, 1989, 1990 Free Software Foundation, 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, 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. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-/* This is the parser code that is written into each bison parser
- when the %semantic_parser declaration is not specified in the grammar.
- It was written by Richard Stallman by simplifying the hairy parser
- used when %semantic_parser is specified. */
-
-#ifndef YYSTACK_USE_ALLOCA
-#ifdef alloca
-#define YYSTACK_USE_ALLOCA
-#else /* alloca not defined */
-#ifdef __GNUC__
-#define YYSTACK_USE_ALLOCA
-#define alloca __builtin_alloca
-#else /* not GNU C. */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
-#define YYSTACK_USE_ALLOCA
-#include <alloca.h>
-#else /* not sparc */
-/* We think this test detects Watcom and Microsoft C. */
-/* This used to test MSDOS, but that is a bad idea
- since that symbol is in the user namespace. */
-#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
-#if 0 /* No need for malloc.h, which pollutes the namespace;
- instead, just don't use alloca. */
-#include <malloc.h>
-#endif
-#else /* not MSDOS, or __TURBOC__ */
-#if defined(_AIX)
-/* I don't know what this was needed for, but it pollutes the namespace.
- So I turned it off. rms, 2 May 1997. */
-/* #include <malloc.h> */
- #pragma alloca
-#define YYSTACK_USE_ALLOCA
-#else /* not MSDOS, or __TURBOC__, or _AIX */
-#if 0
-#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
- and on HPUX 10. Eventually we can turn this on. */
-#define YYSTACK_USE_ALLOCA
-#define alloca __builtin_alloca
-#endif /* __hpux */
-#endif
-#endif /* not _AIX */
-#endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc */
-#endif /* not GNU C */
-#endif /* alloca not defined */
-#endif /* YYSTACK_USE_ALLOCA not defined */
-
-#ifdef YYSTACK_USE_ALLOCA
-#define YYSTACK_ALLOC alloca
-#else
-#define YYSTACK_ALLOC malloc
-#endif
-
-/* Note: there must be only one dollar sign in this file.
- It is replaced by the list of actions, each action
- as one case of the switch. */
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY -2
-#define YYEOF 0
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrlab1
-/* Like YYERROR except do call yyerror.
- This remains here temporarily to ease the
- transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-#define YYFAIL goto yyerrlab
-#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(token, value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { yychar = (token), yylval = (value); \
- yychar1 = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { yyerror ("syntax error: cannot back up"); YYERROR; } \
-while (0)
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-#ifndef YYPURE
-#define YYLEX yylex()
-#endif
-
-#ifdef YYPURE
-#ifdef YYLSP_NEEDED
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
-#else
-#define YYLEX yylex(&yylval, &yylloc)
-#endif
-#else /* not YYLSP_NEEDED */
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, YYLEX_PARAM)
-#else
-#define YYLEX yylex(&yylval)
-#endif
-#endif /* not YYLSP_NEEDED */
-#endif
-
-/* If nonreentrant, generate the variables here */
-
-#ifndef YYPURE
-
-int yychar; /* the lookahead symbol */
-YYSTYPE yylval; /* the semantic value of the */
- /* lookahead symbol */
-
-#ifdef YYLSP_NEEDED
-YYLTYPE yylloc; /* location data for the lookahead */
- /* symbol */
-#endif
-
-int yynerrs; /* number of parse errors so far */
-#endif /* not YYPURE */
-
-#if YYDEBUG != 0
-int yydebug; /* nonzero means print parse trace */
-/* Since this is uninitialized, it does not stop multiple parsers
- from coexisting. */
-#endif
-
-/* YYINITDEPTH indicates the initial size of the parser's stacks */
-
-#ifndef YYINITDEPTH
-#define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH is the maximum size the stacks can grow to
- (effective only if the built-in stack extension method is used). */
-
-#if YYMAXDEPTH == 0
-#undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-#define YYMAXDEPTH 10000
-#endif
-
-/* Define __yy_memcpy. Note that the size argument
- should be passed with type unsigned int, because that is what the non-GCC
- definitions require. With GCC, __builtin_memcpy takes an arg
- of type size_t, but it can handle unsigned int. */
-
-#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
-#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
-#else /* not GNU C or C++ */
-#ifndef __cplusplus
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (to, from, count)
- char *to;
- char *from;
- unsigned int count;
-{
- register char *f = from;
- register char *t = to;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#else /* __cplusplus */
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (char *to, char *from, unsigned int count)
-{
- register char *t = to;
- register char *f = from;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#endif
-#endif
-
-#line 216 "/usr/lib/bison.simple"
-
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
- into yyparse. The argument should have type void *.
- It should actually point to an object.
- Grammar actions can access the variable by casting it
- to the proper pointer type. */
-
-#ifdef YYPARSE_PARAM
-#ifdef __cplusplus
-#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL
-#else /* not __cplusplus */
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-#endif /* not __cplusplus */
-#else /* not YYPARSE_PARAM */
-#define YYPARSE_PARAM_ARG
-#define YYPARSE_PARAM_DECL
-#endif /* not YYPARSE_PARAM */
-
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-#ifdef YYPARSE_PARAM
-int yyparse (void *);
-#else
-int yyparse (void);
-#endif
-#endif
-
-int
-yyparse(YYPARSE_PARAM_ARG)
- YYPARSE_PARAM_DECL
-{
- register int yystate;
- register int yyn;
- register short *yyssp;
- register YYSTYPE *yyvsp;
- int yyerrstatus; /* number of tokens to shift before error messages enabled */
- int yychar1 = 0; /* lookahead token as an internal (translated) token number */
-
- short yyssa[YYINITDEPTH]; /* the state stack */
- YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
-
- short *yyss = yyssa; /* refer to the stacks thru separate pointers */
- YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
-
-#ifdef YYLSP_NEEDED
- YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
- YYLTYPE *yyls = yylsa;
- YYLTYPE *yylsp;
-
-#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
-#else
-#define YYPOPSTACK (yyvsp--, yyssp--)
-#endif
-
- int yystacksize = YYINITDEPTH;
- int yyfree_stacks = 0;
-
-#ifdef YYPURE
- int yychar;
- YYSTYPE yylval;
- int yynerrs;
-#ifdef YYLSP_NEEDED
- YYLTYPE yylloc;
-#endif
-#endif
-
- YYSTYPE yyval; /* the variable used to return */
- /* semantic values from the action */
- /* routines */
-
- int yylen;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Starting parse\n");
-#endif
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss - 1;
- yyvsp = yyvs;
-#ifdef YYLSP_NEEDED
- yylsp = yyls;
-#endif
-
-/* Push a new state, which is found in yystate . */
-/* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks. */
-yynewstate:
-
- *++yyssp = yystate;
-
- if (yyssp >= yyss + yystacksize - 1)
- {
- /* Give user a chance to reallocate the stack */
- /* Use copies of these so that the &'s don't force the real ones into memory. */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-#ifdef YYLSP_NEEDED
- YYLTYPE *yyls1 = yyls;
-#endif
-
- /* Get the current used size of the three stacks, in elements. */
- int size = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- /* Each stack pointer address is followed by the size of
- the data in use in that stack, in bytes. */
-#ifdef YYLSP_NEEDED
- /* This used to be a conditional around just the two extra args,
- but that might be undefined if yyoverflow is a macro. */
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yyls1, size * sizeof (*yylsp),
- &yystacksize);
-#else
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yystacksize);
-#endif
-
- yyss = yyss1; yyvs = yyvs1;
-#ifdef YYLSP_NEEDED
- yyls = yyls1;
-#endif
-#else /* no yyoverflow */
- /* Extend the stack our own way. */
- if (yystacksize >= YYMAXDEPTH)
- {
- yyerror("parser stack overflow");
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-#ifdef YYLSP_NEEDED
- free (yyls);
-#endif
- }
- return 2;
- }
- yystacksize *= 2;
- if (yystacksize > YYMAXDEPTH)
- yystacksize = YYMAXDEPTH;
-#ifndef YYSTACK_USE_ALLOCA
- yyfree_stacks = 1;
-#endif
- yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
- __yy_memcpy ((char *)yyss, (char *)yyss1,
- size * (unsigned int) sizeof (*yyssp));
- yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
- __yy_memcpy ((char *)yyvs, (char *)yyvs1,
- size * (unsigned int) sizeof (*yyvsp));
-#ifdef YYLSP_NEEDED
- yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
- __yy_memcpy ((char *)yyls, (char *)yyls1,
- size * (unsigned int) sizeof (*yylsp));
-#endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + size - 1;
- yyvsp = yyvs + size - 1;
-#ifdef YYLSP_NEEDED
- yylsp = yyls + size - 1;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Stack size increased to %d\n", yystacksize);
-#endif
-
- if (yyssp >= yyss + yystacksize - 1)
- YYABORT;
- }
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Entering state %d\n", yystate);
-#endif
-
- goto yybackup;
- yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to lookahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* yychar is either YYEMPTY or YYEOF
- or a valid token in external form. */
-
- if (yychar == YYEMPTY)
- {
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Reading a token: ");
-#endif
- yychar = YYLEX;
- }
-
- /* Convert token to internal form (in yychar1) for indexing tables with */
-
- if (yychar <= 0) /* This means end of input. */
- {
- yychar1 = 0;
- yychar = YYEOF; /* Don't call YYLEX any more */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Now at end of input.\n");
-#endif
- }
- else
- {
- yychar1 = YYTRANSLATE(yychar);
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
- /* Give the individual parser a way to print the precise meaning
- of a token, for further debugging info. */
-#ifdef YYPRINT
- YYPRINT (stderr, yychar, yylval);
-#endif
- fprintf (stderr, ")\n");
- }
-#endif
- }
-
- yyn += yychar1;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
- goto yydefault;
-
- yyn = yytable[yyn];
-
- /* yyn is what to do for this token type in this state.
- Negative => reduce, -yyn is rule number.
- Positive => shift, yyn is new state.
- New state is final state => don't bother to shift,
- just return success.
- 0, or most negative number => error. */
-
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrlab;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
-#endif
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- /* count tokens shifted since error; after three, turn off error status. */
- if (yyerrstatus) yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-/* Do the default action for the current state. */
-yydefault:
-
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
-
-/* Do a reduction. yyn is the number of a rule to reduce with. */
-yyreduce:
- yylen = yyr2[yyn];
- if (yylen > 0)
- yyval = yyvsp[1-yylen]; /* implement default value of the action */
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- int i;
-
- fprintf (stderr, "Reducing via rule %d (line %d), ",
- yyn, yyrline[yyn]);
-
- /* Print the symbols being reduced, and their result. */
- for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
- fprintf (stderr, "%s ", yytname[yyrhs[i]]);
- fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
- }
-#endif
-
-
- switch (yyn) {
-
-case 2:
-#line 211 "vcc.y"
-{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; ;
- break;}
-case 4:
-#line 214 "vcc.y"
-{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; ;
- break;}
-case 7:
-#line 223 "vcc.y"
-{
- lexPushMode(L_VCARD);
- if (!pushVObject(VCCardProp)) YYERROR;
- ;
- break;}
-case 8:
-#line 228 "vcc.y"
-{
- lexPopMode(0);
- yyval.vobj = popVObject();
- ;
- break;}
-case 9:
-#line 233 "vcc.y"
-{
- lexPushMode(L_VCARD);
- if (!pushVObject(VCCardProp)) YYERROR;
- ;
- break;}
-case 10:
-#line 238 "vcc.y"
-{
- lexPopMode(0);
- yyval.vobj = popVObject();
- ;
- break;}
-case 13:
-#line 249 "vcc.y"
-{
- lexPushMode(L_VALUES);
- ;
- break;}
-case 14:
-#line 253 "vcc.y"
-{
- if (lexWithinMode(L_BASE64) || lexWithinMode(L_QUOTED_PRINTABLE))
- lexPopMode(0);
- lexPopMode(0);
- ;
- break;}
-case 16:
-#line 262 "vcc.y"
-{
- enterProps(yyvsp[0].str);
- ;
- break;}
-case 18:
-#line 267 "vcc.y"
-{
- enterProps(yyvsp[0].str);
- ;
- break;}
-case 22:
-#line 280 "vcc.y"
-{
- enterAttr(yyvsp[0].str,0);
- ;
- break;}
-case 23:
-#line 284 "vcc.y"
-{
- enterAttr(yyvsp[-2].str,yyvsp[0].str);
-
- ;
- break;}
-case 25:
-#line 293 "vcc.y"
-{ enterValues(yyvsp[-1].str); ;
- break;}
-case 27:
-#line 295 "vcc.y"
-{ enterValues(yyvsp[0].str); ;
- break;}
-case 29:
-#line 299 "vcc.y"
-{ yyval.str = 0; ;
- break;}
-case 30:
-#line 304 "vcc.y"
-{ if (!pushVObject(VCCalProp)) YYERROR; ;
- break;}
-case 31:
-#line 307 "vcc.y"
-{ yyval.vobj = popVObject(); ;
- break;}
-case 32:
-#line 309 "vcc.y"
-{ if (!pushVObject(VCCalProp)) YYERROR; ;
- break;}
-case 33:
-#line 311 "vcc.y"
-{ yyval.vobj = popVObject(); ;
- break;}
-case 39:
-#line 326 "vcc.y"
-{
- lexPushMode(L_VEVENT);
- if (!pushVObject(VCEventProp)) YYERROR;
- ;
- break;}
-case 40:
-#line 332 "vcc.y"
-{
- lexPopMode(0);
- popVObject();
- ;
- break;}
-case 41:
-#line 337 "vcc.y"
-{
- lexPushMode(L_VEVENT);
- if (!pushVObject(VCEventProp)) YYERROR;
- ;
- break;}
-case 42:
-#line 342 "vcc.y"
-{
- lexPopMode(0);
- popVObject();
- ;
- break;}
-case 43:
-#line 350 "vcc.y"
-{
- lexPushMode(L_VTODO);
- if (!pushVObject(VCTodoProp)) YYERROR;
- ;
- break;}
-case 44:
-#line 356 "vcc.y"
-{
- lexPopMode(0);
- popVObject();
- ;
- break;}
-case 45:
-#line 361 "vcc.y"
-{
- lexPushMode(L_VTODO);
- if (!pushVObject(VCTodoProp)) YYERROR;
- ;
- break;}
-case 46:
-#line 366 "vcc.y"
-{
- lexPopMode(0);
- popVObject();
- ;
- break;}
-}
- /* the action file gets copied in in place of this dollarsign */
-#line 542 "/usr/lib/bison.simple"
-
- yyvsp -= yylen;
- yyssp -= yylen;
-#ifdef YYLSP_NEEDED
- yylsp -= yylen;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
- *++yyvsp = yyval;
-
-#ifdef YYLSP_NEEDED
- yylsp++;
- if (yylen == 0)
- {
- yylsp->first_line = yylloc.first_line;
- yylsp->first_column = yylloc.first_column;
- yylsp->last_line = (yylsp-1)->last_line;
- yylsp->last_column = (yylsp-1)->last_column;
- yylsp->text = 0;
- }
- else
- {
- yylsp->last_line = (yylsp+yylen-1)->last_line;
- yylsp->last_column = (yylsp+yylen-1)->last_column;
- }
-#endif
-
- /* Now "shift" the result of the reduction.
- Determine what state that goes to,
- based on the state we popped back to
- and the rule number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTBASE];
-
- goto yynewstate;
-
-yyerrlab: /* here on detecting error */
-
- if (! yyerrstatus)
- /* If not already recovering from an error, report this error. */
- {
- ++yynerrs;
-
-#ifdef YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (yyn > YYFLAG && yyn < YYLAST)
- {
- int size = 0;
- char *msg;
- int x, count;
-
- count = 0;
- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- size += strlen(yytname[x]) + 15, count++;
- msg = (char *) malloc(size + 15);
- if (msg != 0)
- {
- strcpy(msg, "parse error");
-
- if (count < 5)
- {
- count = 0;
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- {
- strcat(msg, count == 0 ? ", expecting `" : " or `");
- strcat(msg, yytname[x]);
- strcat(msg, "'");
- count++;
- }
- }
- yyerror(msg);
- free(msg);
- }
- else
- yyerror ("parse error; also virtual memory exceeded");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror("parse error");
- }
-
- goto yyerrlab1;
-yyerrlab1: /* here on error raised explicitly by an action */
-
- if (yyerrstatus == 3)
- {
- /* if just tried and failed to reuse lookahead token after an error, discard it. */
-
- /* return failure if at end of input */
- if (yychar == YYEOF)
- YYABORT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
-#endif
-
- yychar = YYEMPTY;
- }
-
- /* Else will try to reuse lookahead token
- after shifting the error token. */
-
- yyerrstatus = 3; /* Each real token shifted decrements this */
-
- goto yyerrhandle;
-
-yyerrdefault: /* current state does not do anything special for the error token. */
-
-#if 0
- /* This is wrong; only states that explicitly want error tokens
- should shift them. */
- yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
- if (yyn) goto yydefault;
-#endif
-
-yyerrpop: /* pop the current state because it cannot handle the error token */
-
- if (yyssp == yyss) YYABORT;
- yyvsp--;
- yystate = *--yyssp;
-#ifdef YYLSP_NEEDED
- yylsp--;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "Error: state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
-yyerrhandle:
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yyerrdefault;
-
- yyn += YYTERROR;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
- goto yyerrdefault;
-
- yyn = yytable[yyn];
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrpop;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrpop;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting error token, ");
-#endif
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- yystate = yyn;
- goto yynewstate;
-
- yyacceptlab:
- /* YYACCEPT comes here. */
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-#ifdef YYLSP_NEEDED
- free (yyls);
-#endif
- }
- return 0;
-
- yyabortlab:
- /* YYABORT comes here. */
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-#ifdef YYLSP_NEEDED
- free (yyls);
-#endif
- }
- return 1;
-}
-#line 372 "vcc.y"
-
-/*/////////////////////////////////////////////////////////////////////////*/
-static int pushVObject(const char *prop)
- {
- VObject *newObj;
- if (ObjStackTop == MAXLEVEL)
- return FALSE;
-
- ObjStack[++ObjStackTop] = curObj;
-
- if (curObj) {
- newObj = addProp(curObj,prop);
- curObj = newObj;
- }
- else
- curObj = newVObject(prop);
-
- return TRUE;
- }
-
-
-/*/////////////////////////////////////////////////////////////////////////*/
-/* This pops the recently built vCard off the stack and returns it. */
-static VObject* popVObject()
- {
- VObject *oldObj;
- if (ObjStackTop < 0) {
- yyerror("pop on empty Object Stack\n");
- return 0;
- }
- oldObj = curObj;
- curObj = ObjStack[ObjStackTop--];
-
- return oldObj;
- }
-
-
-static void enterValues(const char *value)
- {
- if (fieldedProp && *fieldedProp) {
- if (value) {
- addPropValue(curProp,*fieldedProp,value);
- }
- /* else this field is empty, advance to next field */
- fieldedProp++;
- }
- else {
- if (value) {
- setVObjectUStringZValue_(curProp,fakeUnicode(value,0));
- }
- }
- deleteStr(value);
- }
-
-static void enterProps(const char *s)
- {
- curProp = addGroup(curObj,s);
- deleteStr(s);
- }
-
-static void enterAttr(const char *s1, const char *s2)
- {
- const char *p1, *p2;
- p1 = lookupProp_(s1);
- if (s2) {
- VObject *a;
- p2 = lookupProp_(s2);
- a = addProp(curProp,p1);
- setVObjectStringZValue(a,p2);
- }
- else
- addProp(curProp,p1);
- if (stricmp(p1,VCBase64Prop) == 0 || (s2 && stricmp(p2,VCBase64Prop)==0))
- lexPushMode(L_BASE64);
- else if (stricmp(p1,VCQuotedPrintableProp) == 0
- || (s2 && stricmp(p2,VCQuotedPrintableProp)==0))
- lexPushMode(L_QUOTED_PRINTABLE);
- deleteStr(s1); deleteStr(s2);
- }
-
-
-#define MAX_LEX_LOOKAHEAD_0 32
-#define MAX_LEX_LOOKAHEAD 64
-#define MAX_LEX_MODE_STACK_SIZE 10
-#define LEXMODE() (lexBuf.lexModeStack[lexBuf.lexModeStackTop])
-
-struct LexBuf {
- /* input */
-#ifdef INCLUDEMFC
- CFile *inputFile;
-#else
- FILE *inputFile;
-#endif
- char *inputString;
- unsigned long curPos;
- unsigned long inputLen;
- /* lookahead buffer */
- /* -- lookahead buffer is short instead of char so that EOF
- / can be represented correctly.
- */
- unsigned long len;
- short buf[MAX_LEX_LOOKAHEAD];
- unsigned long getPtr;
- /* context stack */
- unsigned long lexModeStackTop;
- enum LexMode lexModeStack[MAX_LEX_MODE_STACK_SIZE];
- /* token buffer */
- unsigned long maxToken;
- char *strs;
- unsigned long strsLen;
- } lexBuf;
-
-static void lexPushMode(enum LexMode mode)
- {
- if (lexBuf.lexModeStackTop == (MAX_LEX_MODE_STACK_SIZE-1))
- yyerror("lexical context stack overflow");
- else {
- lexBuf.lexModeStack[++lexBuf.lexModeStackTop] = mode;
- }
- }
-
-static void lexPopMode(int top)
- {
- /* special case of pop for ease of error recovery -- this
- version will never underflow */
- if (top)
- lexBuf.lexModeStackTop = 0;
- else
- if (lexBuf.lexModeStackTop > 0) lexBuf.lexModeStackTop--;
- }
-
-static int lexWithinMode(enum LexMode mode) {
- unsigned long i;
- for (i=0;i<lexBuf.lexModeStackTop;i++)
- if (mode == lexBuf.lexModeStack[i]) return 1;
- return 0;
- }
-
-static char lexGetc_()
- {
- /* get next char from input, no buffering. */
- if (lexBuf.curPos == lexBuf.inputLen)
- return EOF;
- else if (lexBuf.inputString)
- return *(lexBuf.inputString + lexBuf.curPos++);
- else {
-#ifdef INCLUDEMFC
- char result;
- return lexBuf.inputFile->Read(&result, 1) == 1 ? result : EOF;
-#else
- return fgetc(lexBuf.inputFile);
-#endif
- }
- }
-
-static int lexGeta()
- {
- ++lexBuf.len;
- return (lexBuf.buf[lexBuf.getPtr] = lexGetc_());
- }
-
-static int lexGeta_(int i)
- {
- ++lexBuf.len;
- return (lexBuf.buf[(lexBuf.getPtr+i)%MAX_LEX_LOOKAHEAD] = lexGetc_());
- }
-
-static void lexSkipLookahead() {
- if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) {
- /* don't skip EOF. */
- lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD;
- lexBuf.len--;
- }
- }
-
-static int lexLookahead() {
- int c = (lexBuf.len)?
- lexBuf.buf[lexBuf.getPtr]:
- lexGeta();
- /* do the \r\n -> \n or \r -> \n translation here */
- if (c == '\r') {
- int a = (lexBuf.len>1)?
- lexBuf.buf[(lexBuf.getPtr+1)%MAX_LEX_LOOKAHEAD]:
- lexGeta_(1);
- if (a == '\n') {
- lexSkipLookahead();
- }
- lexBuf.buf[lexBuf.getPtr] = c = '\n';
- }
- else if (c == '\n') {
- int a = (lexBuf.len>1)?
- lexBuf.buf[lexBuf.getPtr+1]:
- lexGeta_(1);
- if (a == '\r') {
- lexSkipLookahead();
- }
- lexBuf.buf[lexBuf.getPtr] = '\n';
- }
- return c;
- }
-
-static int lexGetc() {
- int c = lexLookahead();
- if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) {
- /* EOF will remain in lookahead buffer */
- lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD;
- lexBuf.len--;
- }
- return c;
- }
-
-static void lexSkipLookaheadWord() {
- if (lexBuf.strsLen <= lexBuf.len) {
- lexBuf.len -= lexBuf.strsLen;
- lexBuf.getPtr = (lexBuf.getPtr + lexBuf.strsLen) % MAX_LEX_LOOKAHEAD;
- }
- }
-
-static void lexClearToken()
- {
- lexBuf.strsLen = 0;
- }
-
-static void lexAppendc(int c)
- {
- lexBuf.strs[lexBuf.strsLen] = c;
- /* append up to zero termination */
- if (c == 0) return;
- lexBuf.strsLen++;
- if (lexBuf.strsLen > lexBuf.maxToken) {
- /* double the token string size */
- lexBuf.maxToken <<= 1;
- lexBuf.strs = (char*) realloc(lexBuf.strs,(size_t)lexBuf.maxToken);
- }
- }
-
-static char* lexStr() {
- return dupStr(lexBuf.strs,(size_t)lexBuf.strsLen+1);
- }
-
-static void lexSkipWhite() {
- int c = lexLookahead();
- while (c == ' ' || c == '\t') {
- lexSkipLookahead();
- c = lexLookahead();
- }
- }
-
-static char* lexGetWord() {
- int c;
- lexSkipWhite();
- lexClearToken();
- c = lexLookahead();
- while (c != EOF && !strchr("\t\n ;:=",c)) {
- lexAppendc(c);
- lexSkipLookahead();
- c = lexLookahead();
- }
- lexAppendc(0);
- return lexStr();
- }
-
-static void lexPushLookahead(char *s, int len) {
- int putptr;
- if (len == 0) len = strlen(s);
- putptr = (int)lexBuf.getPtr - len;
- /* this function assumes that length of word to push back
- / is not greater than MAX_LEX_LOOKAHEAD.
- */
- if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD;
- lexBuf.getPtr = putptr;
- while (*s) {
- lexBuf.buf[putptr] = *s++;
- putptr = (putptr + 1) % MAX_LEX_LOOKAHEAD;
- }
- lexBuf.len += len;
- }
-
-static void lexPushLookaheadc(int c) {
- int putptr;
- /* can't putback EOF, because it never leaves lookahead buffer */
- if (c == EOF) return;
- putptr = (int)lexBuf.getPtr - 1;
- if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD;
- lexBuf.getPtr = putptr;
- lexBuf.buf[putptr] = c;
- lexBuf.len += 1;
- }
-
-static char* lexLookaheadWord() {
- /* this function can lookahead word with max size of MAX_LEX_LOOKAHEAD_0
- / and thing bigger than that will stop the lookahead and return 0;
- / leading white spaces are not recoverable.
- */
- int c;
- int len = 0;
- int curgetptr = 0;
- lexSkipWhite();
- lexClearToken();
- curgetptr = (int)lexBuf.getPtr; /* remember! */
- while (len < (MAX_LEX_LOOKAHEAD_0)) {
- c = lexGetc();
- len++;
- if (c == EOF || strchr("\t\n ;:=", c)) {
- lexAppendc(0);
- /* restore lookahead buf. */
- lexBuf.len += len;
- lexBuf.getPtr = curgetptr;
- return lexStr();
- }
- else
- lexAppendc(c);
- }
- lexBuf.len += len; /* char that has been moved to lookahead buffer */
- lexBuf.getPtr = curgetptr;
- return 0;
- }
-
-#ifdef _SUPPORT_LINE_FOLDING
-static void handleMoreRFC822LineBreak(int c) {
- /* suport RFC 822 line break in cases like
- * ADR: foo;
- * morefoo;
- * more foo;
- */
- if (c == ';') {
- int a;
- lexSkipLookahead();
- /* skip white spaces */
- a = lexLookahead();
- while (a == ' ' || a == '\t') {
- lexSkipLookahead();
- a = lexLookahead();
- }
- if (a == '\n') {
- lexSkipLookahead();
- a = lexLookahead();
- if (a == ' ' || a == '\t') {
- /* continuation, throw away all the \n and spaces read so
- * far
- */
- lexSkipWhite();
- lexPushLookaheadc(';');
- }
- else {
- lexPushLookaheadc('\n');
- lexPushLookaheadc(';');
- }
- }
- else {
- lexPushLookaheadc(';');
- }
- }
- }
-
-static char* lexGet1Value() {
- int size = 0;
- int c;
- lexSkipWhite();
- c = lexLookahead();
- lexClearToken();
- while (c != EOF && c != ';') {
- if (c == '\n') {
- int a;
- lexSkipLookahead();
- a = lexLookahead();
- if (a == ' ' || a == '\t') {
- lexAppendc(' ');
- lexSkipLookahead();
- }
- else {
- lexPushLookaheadc('\n');
- break;
- }
- }
- else {
- lexAppendc(c);
- lexSkipLookahead();
- }
- c = lexLookahead();
- }
- lexAppendc(0);
- handleMoreRFC822LineBreak(c);
- return c==EOF?0:lexStr();
- }
-#endif
-
-static char* lexGetStrUntil(char *termset) {
- int size = 0;
- int c = lexLookahead();
- lexClearToken();
- while (c != EOF && !strchr(termset,c)) {
- lexAppendc(c);
- lexSkipLookahead();
- c = lexLookahead();
- }
- lexAppendc(0);
- return c==EOF?0:lexStr();
- }
-
-static int match_begin_name(int end) {
- char *n = lexLookaheadWord();
- int token = ID;
- if (n) {
- if (!stricmp(n,"vcard")) token = end?END_VCARD:BEGIN_VCARD;
- else if (!stricmp(n,"vcalendar")) token = end?END_VCAL:BEGIN_VCAL;
- else if (!stricmp(n,"vevent")) token = end?END_VEVENT:BEGIN_VEVENT;
- else if (!stricmp(n,"vtodo")) token = end?END_VTODO:BEGIN_VTODO;
- deleteStr(n);
- return token;
- }
- return 0;
- }
-
-
-#ifdef INCLUDEMFC
-void initLex(const char *inputstring, unsigned long inputlen, CFile *inputfile)
-#else
-void initLex(const char *inputstring, unsigned long inputlen, FILE *inputfile)
-#endif
- {
- /* initialize lex mode stack */
- lexBuf.lexModeStack[lexBuf.lexModeStackTop=0] = L_NORMAL;
-
- /* iniatialize lex buffer. */
- lexBuf.inputString = (char*) inputstring;
- lexBuf.inputLen = inputlen;
- lexBuf.curPos = 0;
- lexBuf.inputFile = inputfile;
-
- lexBuf.len = 0;
- lexBuf.getPtr = 0;
-
- lexBuf.maxToken = MAXTOKEN;
- lexBuf.strs = (char*)malloc(MAXTOKEN);
- lexBuf.strsLen = 0;
-
- }
-
-static void finiLex() {
- free(lexBuf.strs);
- }
-
-
-/*/////////////////////////////////////////////////////////////////////////*/
-/* This parses and converts the base64 format for binary encoding into
- * a decoded buffer (allocated with new). See RFC 1521.
- */
-static char * lexGetDataFromBase64()
- {
- unsigned long bytesLen = 0, bytesMax = 0;
- int quadIx = 0, pad = 0;
- unsigned long trip = 0;
- unsigned char b;
- int c;
- unsigned char *bytes = NULL;
- unsigned char *oldBytes = NULL;
-
- DBG_(("db: lexGetDataFromBase64\n"));
- while (1) {
- c = lexGetc();
- if (c == '\n') {
- ++mime_lineNum;
- if (lexLookahead() == '\n') {
- /* a '\n' character by itself means end of data */
- break;
- }
- else continue; /* ignore '\n' */
- }
- else {
- if ((c >= 'A') && (c <= 'Z'))
- b = (unsigned char)(c - 'A');
- else if ((c >= 'a') && (c <= 'z'))
- b = (unsigned char)(c - 'a') + 26;
- else if ((c >= '0') && (c <= '9'))
- b = (unsigned char)(c - '0') + 52;
- else if (c == '+')
- b = 62;
- else if (c == '/')
- b = 63;
- else if (c == '=') {
- b = 0;
- pad++;
- } else if ((c == ' ') || (c == '\t')) {
- continue;
- } else { /* error condition */
- if (bytes) free(bytes);
- else if (oldBytes) free(oldBytes);
- /* error recovery: skip until 2 adjacent newlines. */
- DBG_(("db: invalid character 0x%x '%c'\n", c,c));
- if (c != EOF) {
- c = lexGetc();
- while (c != EOF) {
- if (c == '\n' && lexLookahead() == '\n') {
- ++mime_lineNum;
- break;
- }
- c = lexGetc();
- }
- }
- return NULL;
- }
- trip = (trip << 6) | b;
- if (++quadIx == 4) {
- unsigned char outBytes[3];
- int numOut;
- int i;
- for (i = 0; i < 3; i++) {
- outBytes[2-i] = (unsigned char)(trip & 0xFF);
- trip >>= 8;
- }
- numOut = 3 - pad;
- if (bytesLen + numOut > bytesMax) {
- if (!bytes) {
- bytesMax = 1024;
- bytes = (unsigned char*)malloc((size_t)bytesMax);
- }
- else {
- bytesMax <<= 2;
- oldBytes = bytes;
- bytes = (unsigned char*)realloc(bytes,(size_t)bytesMax);
- }
- if (bytes == 0) {
- mime_error("out of memory while processing BASE64 data\n");
- }
- }
- if (bytes) {
- memcpy(bytes + bytesLen, outBytes, numOut);
- bytesLen += numOut;
- }
- trip = 0;
- quadIx = 0;
- }
- }
- } /* while */
- DBG_(("db: bytesLen = %d\n", bytesLen));
- /* kludge: all this won't be necessary if we have tree form
- representation */
- if (bytes) {
- setValueWithSize(curProp,bytes,(unsigned int)bytesLen);
- free(bytes);
- }
- else if (oldBytes) {
- setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen);
- free(oldBytes);
- }
- return 0;
- }
-
-static int match_begin_end_name(int end) {
- int token;
- lexSkipWhite();
- if (lexLookahead() != ':') return ID;
- lexSkipLookahead();
- lexSkipWhite();
- token = match_begin_name(end);
- if (token == ID) {
- lexPushLookaheadc(':');
- DBG_(("db: ID '%s'\n", yylval.str));
- return ID;
- }
- else if (token != 0) {
- lexSkipLookaheadWord();
- deleteStr(yylval.str);
- DBG_(("db: begin/end %d\n", token));
- return token;
- }
- return 0;
- }
-
-static char* lexGetQuotedPrintable()
- {
- char cur;
- unsigned long len = 0;
-
- lexClearToken();
- do {
- cur = lexGetc();
- switch (cur) {
- case '=': {
- int c = 0;
- int next[2];
- int i;
- for (i = 0; i < 2; i++) {
- next[i] = lexGetc();
- if (next[i] >= '0' && next[i] <= '9')
- c = c * 16 + next[i] - '0';
- else if (next[i] >= 'A' && next[i] <= 'F')
- c = c * 16 + next[i] - 'A' + 10;
- else
- break;
- }
- if (i == 0) {
- /* single '=' follow by LINESEP is continuation sign? */
- if (next[0] == '\n') {
- ++mime_lineNum;
- }
- else {
- lexPushLookaheadc('=');
- goto EndString;
- }
- }
- else if (i == 1) {
- lexPushLookaheadc(next[1]);
- lexPushLookaheadc(next[0]);
- lexAppendc('=');
- } else {
- lexAppendc(c);
- }
- break;
- } /* '=' */
- case '\n': {
- lexPushLookaheadc('\n');
- goto EndString;
- }
- case (char)EOF:
- break;
- default:
- lexAppendc(cur);
- break;
- } /* switch */
- } while (cur != (char)EOF);
-
-EndString:
- lexAppendc(0);
- return lexStr();
- } /* LexQuotedPrintable */
-
-static int yylex() {
- int token = 0;
-
- int lexmode = LEXMODE();
- if (lexmode == L_VALUES) {
- int c = lexGetc();
- if (c == ';') {
- DBG_(("db: SEMICOLON\n"));
- lexPushLookaheadc(c);
-#ifdef _SUPPORT_LINE_FOLDING
- handleMoreRFC822LineBreak(c);
-#endif
- lexSkipLookahead();
- return SEMICOLON;
- }
- else if (strchr("\n",c)) {
- ++mime_lineNum;
- /* consume all line separator(s) adjacent to each other */
- c = lexLookahead();
- while (strchr("\n",c)) {
- lexSkipLookahead();
- c = lexLookahead();
- ++mime_lineNum;
- }
- DBG_(("db: LINESEP\n"));
- return LINESEP;
- }
- else {
- char *p = 0;
- lexPushLookaheadc(c);
- if (lexWithinMode(L_BASE64)) {
- /* get each char and convert to bin on the fly... */
- p = lexGetDataFromBase64();
- yylval.str = p;
- return STRING;
- }
- else if (lexWithinMode(L_QUOTED_PRINTABLE)) {
- p = lexGetQuotedPrintable();
- }
- else {
-#ifdef _SUPPORT_LINE_FOLDING
- p = lexGet1Value();
-#else
- p = lexGetStrUntil(";\n");
-#endif
- }
- if (p) {
- DBG_(("db: STRING: '%s'\n", p));
- yylval.str = p;
- return STRING;
- }
- else return 0;
- }
- }
- else {
- /* normal mode */
- while (1) {
- int c = lexGetc();
- switch(c) {
- case ':': {
- /* consume all line separator(s) adjacent to each other */
- /* ignoring linesep immediately after colon. */
-/* c = lexLookahead();
- while (strchr("\n",c)) {
- lexSkipLookahead();
- c = lexLookahead();
- ++mime_lineNum;
- }*/
- DBG_(("db: COLON\n"));
- return COLON;
- }
- case ';':
- DBG_(("db: SEMICOLON\n"));
- return SEMICOLON;
- case '=':
- DBG_(("db: EQ\n"));
- return EQ;
- /* ignore whitespace in this mode */
- case '\t':
- case ' ': continue;
- case '\n': {
- ++mime_lineNum;
- continue;
- }
- case EOF: return 0;
- break;
- default: {
- lexPushLookaheadc(c);
- if (isalpha(c)) {
- char *t = lexGetWord();
- yylval.str = t;
- if (!stricmp(t, "begin")) {
- return match_begin_end_name(0);
- }
- else if (!stricmp(t,"end")) {
- return match_begin_end_name(1);
- }
- else {
- DBG_(("db: ID '%s'\n", t));
- return ID;
- }
- }
- else {
- /* unknow token */
- return 0;
- }
- break;
- }
- }
- }
- }
- return 0;
- }
-
-
-/***************************************************************************/
-/*** Public Functions ****/
-/***************************************************************************/
-
-static VObject* Parse_MIMEHelper()
- {
- ObjStackTop = -1;
- mime_numErrors = 0;
- mime_lineNum = 1;
- vObjList = 0;
- curObj = 0;
-
- if (yyparse() != 0)
- return 0;
-
- finiLex();
- return vObjList;
- }
-
-/*/////////////////////////////////////////////////////////////////////////*/
-DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len)
- {
- initLex(input, len, 0);
- return Parse_MIMEHelper();
- }
-
-
-#if INCLUDEMFC
-
-DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file)
- {
- unsigned long startPos;
- VObject *result;
-
- initLex(0,-1,file);
- startPos = file->GetPosition();
- if (!(result = Parse_MIMEHelper()))
- file->Seek(startPos, CFile::begin);
- return result;
- }
-
-#else
-
-VObject* Parse_MIME_FromFile(FILE *file)
- {
- VObject *result;
- long startPos;
-
- initLex(0,(unsigned long)-1,file);
- startPos = ftell(file);
- if (!(result = Parse_MIMEHelper())) {
- fseek(file,startPos,SEEK_SET);
- }
- return result;
- }
-
-DLLEXPORT(VObject*) Parse_MIME_FromFileName(char *fname)
- {
- FILE *fp = fopen(fname,"r");
- if (fp) {
- VObject* o = Parse_MIME_FromFile(fp);
- fclose(fp);
- return o;
- }
- else {
- char msg[256];
- snprintf(msg, sizeof(msg), "can't open file '%s' for reading\n", fname);
- mime_error_(msg);
- return 0;
- }
- }
-
-#endif
-
-/*/////////////////////////////////////////////////////////////////////////*/
-static void YYDebug(const char *s)
-{
-/* Parse_Debug(s); */
-}
-
-
-static MimeErrorHandler mimeErrorHandler;
-
-DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler me)
- {
- mimeErrorHandler = me;
- }
-
-static void mime_error(char *s)
- {
- char msg[256];
- if (mimeErrorHandler) {
- sprintf(msg,"%s at line %d", s, mime_lineNum);
- mimeErrorHandler(msg);
- }
- }
-
-static void mime_error_(char *s)
- {
- if (mimeErrorHandler) {
- mimeErrorHandler(s);
- }
- }
-
diff --git a/libversit/vcc.h b/libversit/vcc.h
deleted file mode 100644
index 0e52034710..0000000000
--- a/libversit/vcc.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-#ifndef __VCC_H__
-#define __VCC_H__ 1
-
-#include "vobject.h"
-
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-extern "C" {
-#endif
-
-typedef void (*MimeErrorHandler)(char *);
-
-extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler);
-
-extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len);
-extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname);
-
-
-/* NOTE regarding Parse_MIME_FromFile
-The function above, Parse_MIME_FromFile, comes in two flavors,
-neither of which is exported from the DLL. Each version takes
-a CFile or FILE* as a parameter, neither of which can be
-passed across a DLL interface (at least that is my experience).
-If you are linking this code into your build directly then
-you may find them a more convenient API that the other flavors
-that take a file name. If you use them with the DLL LIB you
-will get a link error.
-*/
-
-
-#if INCLUDEMFC
-extern VObject* Parse_MIME_FromFile(CFile *file);
-#else
-extern VObject* Parse_MIME_FromFile(FILE *file);
-#endif
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-}
-#endif
-
-#endif /* __VCC_H__ */
-
diff --git a/libversit/vcc.y b/libversit/vcc.y
deleted file mode 100644
index 9b4acda386..0000000000
--- a/libversit/vcc.y
+++ /dev/null
@@ -1,1218 +0,0 @@
-%{
-
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-/*
- * src: vcc.c
- * doc: Parser for vCard and vCalendar. Note that this code is
- * generated by a yacc parser generator. Generally it should not
- * be edited by hand. The real source is vcc.y. The #line directives
- * can be commented out here to make it easier to trace through
- * in a debugger. However, if a bug is found it should
- * be fixed in vcc.y and this file regenerated.
- */
-
-
-/* debugging utilities */
-#if __DEBUG
-#define DBG_(x) printf x
-#else
-#define DBG_(x)
-#endif
-
-/**** External Functions ****/
-
-/* assign local name to parser variables and functions so that
- we can use more than one yacc based parser.
-*/
-
-#define yyparse mime_parse
-#define yylex mime_lex
-#define yyerror mime_error
-#define yychar mime_char
-/* #define p_yyval p_mime_val */
-#undef yyval
-#define yyval mime_yyval
-/* #define p_yylval p_mime_lval */
-#undef yylval
-#define yylval mime_yylval
-#define yydebug mime_debug
-#define yynerrs mime_nerrs
-#define yyerrflag mime_errflag
-#define yyss mime_ss
-#define yyssp mime_ssp
-#define yyvs mime_vs
-#define yyvsp mime_vsp
-#define yylhs mime_lhs
-#define yylen mime_len
-#define yydefred mime_defred
-#define yydgoto mime_dgoto
-#define yysindex mime_sindex
-#define yyrindex mime_rindex
-#define yygindex mime_gindex
-#define yytable mime_table
-#define yycheck mime_check
-#define yyname mime_name
-#define yyrule mime_rule
-#define YYPREFIX "mime_"
-
-
-#ifndef _NO_LINE_FOLDING
-#define _SUPPORT_LINE_FOLDING 1
-#endif
-
-/* undef below if compile with MFC */
-/* #define INCLUDEMFC 1 */
-
-#if defined(WIN32) || defined(_WIN32)
-#ifdef INCLUDEMFC
-#include <afx.h>
-#endif
-#endif
-
-#include <string.h>
-#ifndef __MWERKS__
-#include <malloc.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "vcc.h"
-
-/**** Types, Constants ****/
-
-#define YYDEBUG 1 /* 1 to compile in some debugging code */
-#define MAXTOKEN 256 /* maximum token (line) length */
-#define YYSTACKSIZE 50 /* ~unref ? */
-#define MAXLEVEL 10 /* max # of nested objects parseable */
- /* (includes outermost) */
-
-
-/**** Global Variables ****/
-int mime_lineNum, mime_numErrors; /* yyerror() can use these */
-static VObject* vObjList;
-static VObject *curProp;
-static VObject *curObj;
-static VObject* ObjStack[MAXLEVEL];
-static int ObjStackTop;
-
-
-/* A helpful utility for the rest of the app. */
-#if __CPLUSPLUS__
-extern "C" {
-#endif
-
- extern void Parse_Debug(const char *s);
- extern void yyerror(char *s);
-
-#if __CPLUSPLUS__
- };
-#endif
-
-int yyparse();
-
-enum LexMode {
- L_NORMAL,
- L_VCARD,
- L_VCAL,
- L_VEVENT,
- L_VTODO,
- L_VALUES,
- L_BASE64,
- L_QUOTED_PRINTABLE
- };
-
-/**** Private Forward Declarations ****/
-static int pushVObject(const char *prop);
-static VObject* popVObject();
-static char* lexDataFromBase64();
-static void lexPopMode(int top);
-static int lexWithinMode(enum LexMode mode);
-static void lexPushMode(enum LexMode mode);
-static void enterProps(const char *s);
-static void enterAttr(const char *s1, const char *s2);
-static void enterValues(const char *value);
-static void mime_error_(char *s);
-
-%}
-
-/***************************************************************************/
-/*** The grammar ****/
-/***************************************************************************/
-
-%union {
- char *str;
- VObject *vobj;
- }
-
-%token
- EQ COLON DOT SEMICOLON SPACE HTAB LINESEP NEWLINE
- BEGIN_VCARD END_VCARD BEGIN_VCAL END_VCAL
- BEGIN_VEVENT END_VEVENT BEGIN_VTODO END_VTODO
- ID
-
-/*
- * NEWLINE is the token that would occur outside a vCard,
- * while LINESEP is the token that would occur inside a vCard.
- */
-
-%token <str>
- STRING ID
-
-%type <str> name value
-
-%type <vobj> vcard vcal vobject
-
-%start mime
-
-%%
-
-
-mime: vobjects
- ;
-
-vobjects: vobject
- { addList(&vObjList, $1); curObj = 0; }
- vobjects
- | vobject
- { addList(&vObjList, $1); curObj = 0; }
- ;
-
-vobject: vcard
- | vcal
- ;
-
-vcard:
- BEGIN_VCARD
- {
- lexPushMode(L_VCARD);
- if (!pushVObject(VCCardProp)) YYERROR;
- }
- items END_VCARD
- {
- lexPopMode(0);
- $$ = popVObject();
- }
- | BEGIN_VCARD
- {
- lexPushMode(L_VCARD);
- if (!pushVObject(VCCardProp)) YYERROR;
- }
- END_VCARD
- {
- lexPopMode(0);
- $$ = popVObject();
- }
- ;
-
-items: item items
- | item
- ;
-
-item: prop COLON
- {
- lexPushMode(L_VALUES);
- }
- values LINESEP
- {
- if (lexWithinMode(L_BASE64) || lexWithinMode(L_QUOTED_PRINTABLE))
- lexPopMode(0);
- lexPopMode(0);
- }
- | error
- ;
-
-prop: name
- {
- enterProps($1);
- }
- attr_params
- | name
- {
- enterProps($1);
- }
- ;
-
-attr_params: attr_param attr_params
- | attr_param
- ;
-
-attr_param: SEMICOLON attr
- ;
-
-attr: name
- {
- enterAttr($1,0);
- }
- | name EQ name
- {
- enterAttr($1,$3);
-
- }
- ;
-
-name: ID
- ;
-
-values: value SEMICOLON { enterValues($1); } values
- | value
- { enterValues($1); }
- ;
-
-value: STRING
- | { $$ = 0; }
- ;
-
-vcal:
- BEGIN_VCAL
- { if (!pushVObject(VCCalProp)) YYERROR; }
- calitems
- END_VCAL
- { $$ = popVObject(); }
- | BEGIN_VCAL
- { if (!pushVObject(VCCalProp)) YYERROR; }
- END_VCAL
- { $$ = popVObject(); }
- ;
-
-calitems: calitem calitems
- | calitem
- ;
-
-calitem:
- eventitem
- | todoitem
- | items
- ;
-
-eventitem:
- BEGIN_VEVENT
- {
- lexPushMode(L_VEVENT);
- if (!pushVObject(VCEventProp)) YYERROR;
- }
- items
- END_VEVENT
- {
- lexPopMode(0);
- popVObject();
- }
- | BEGIN_VEVENT
- {
- lexPushMode(L_VEVENT);
- if (!pushVObject(VCEventProp)) YYERROR;
- }
- END_VEVENT
- {
- lexPopMode(0);
- popVObject();
- }
- ;
-
-todoitem:
- BEGIN_VTODO
- {
- lexPushMode(L_VTODO);
- if (!pushVObject(VCTodoProp)) YYERROR;
- }
- items
- END_VTODO
- {
- lexPopMode(0);
- popVObject();
- }
- | BEGIN_VTODO
- {
- lexPushMode(L_VTODO);
- if (!pushVObject(VCTodoProp)) YYERROR;
- }
- END_VTODO
- {
- lexPopMode(0);
- popVObject();
- }
- ;
-
-%%
-/*/////////////////////////////////////////////////////////////////////////*/
-static int pushVObject(const char *prop)
- {
- VObject *newObj;
- if (ObjStackTop == MAXLEVEL)
- return FALSE;
-
- ObjStack[++ObjStackTop] = curObj;
-
- if (curObj) {
- newObj = addProp(curObj,prop);
- curObj = newObj;
- }
- else
- curObj = newVObject(prop);
-
- return TRUE;
- }
-
-
-/*/////////////////////////////////////////////////////////////////////////*/
-/* This pops the recently built vCard off the stack and returns it. */
-static VObject* popVObject()
- {
- VObject *oldObj;
- if (ObjStackTop < 0) {
- yyerror("pop on empty Object Stack\n");
- return 0;
- }
- oldObj = curObj;
- curObj = ObjStack[ObjStackTop--];
-
- return oldObj;
- }
-
-
-static void enterValues(const char *value)
- {
- if (fieldedProp && *fieldedProp) {
- if (value) {
- addPropValue(curProp,*fieldedProp,value);
- }
- /* else this field is empty, advance to next field */
- fieldedProp++;
- }
- else {
- if (value) {
- setVObjectUStringZValue_(curProp,fakeUnicode(value,0));
- }
- }
- deleteStr(value);
- }
-
-static void enterProps(const char *s)
- {
- curProp = addGroup(curObj,s);
- deleteStr(s);
- }
-
-static void enterAttr(const char *s1, const char *s2)
- {
- const char *p1, *p2;
- p1 = lookupProp_(s1);
- if (s2) {
- VObject *a;
- p2 = lookupProp_(s2);
- a = addProp(curProp,p1);
- setVObjectStringZValue(a,p2);
- }
- else
- addProp(curProp,p1);
- if (stricmp(p1,VCBase64Prop) == 0 || (s2 && stricmp(p2,VCBase64Prop)==0))
- lexPushMode(L_BASE64);
- else if (stricmp(p1,VCQuotedPrintableProp) == 0
- || (s2 && stricmp(p2,VCQuotedPrintableProp)==0))
- lexPushMode(L_QUOTED_PRINTABLE);
- deleteStr(s1); deleteStr(s2);
- }
-
-
-#define MAX_LEX_LOOKAHEAD_0 32
-#define MAX_LEX_LOOKAHEAD 64
-#define MAX_LEX_MODE_STACK_SIZE 10
-#define LEXMODE() (lexBuf.lexModeStack[lexBuf.lexModeStackTop])
-
-struct LexBuf {
- /* input */
-#ifdef INCLUDEMFC
- CFile *inputFile;
-#else
- FILE *inputFile;
-#endif
- char *inputString;
- unsigned long curPos;
- unsigned long inputLen;
- /* lookahead buffer */
- /* -- lookahead buffer is short instead of char so that EOF
- / can be represented correctly.
- */
- unsigned long len;
- short buf[MAX_LEX_LOOKAHEAD];
- unsigned long getPtr;
- /* context stack */
- unsigned long lexModeStackTop;
- enum LexMode lexModeStack[MAX_LEX_MODE_STACK_SIZE];
- /* token buffer */
- unsigned long maxToken;
- char *strs;
- unsigned long strsLen;
- } lexBuf;
-
-static void lexPushMode(enum LexMode mode)
- {
- if (lexBuf.lexModeStackTop == (MAX_LEX_MODE_STACK_SIZE-1))
- yyerror("lexical context stack overflow");
- else {
- lexBuf.lexModeStack[++lexBuf.lexModeStackTop] = mode;
- }
- }
-
-static void lexPopMode(int top)
- {
- /* special case of pop for ease of error recovery -- this
- version will never underflow */
- if (top)
- lexBuf.lexModeStackTop = 0;
- else
- if (lexBuf.lexModeStackTop > 0) lexBuf.lexModeStackTop--;
- }
-
-static int lexWithinMode(enum LexMode mode) {
- unsigned long i;
- for (i=0;i<lexBuf.lexModeStackTop;i++)
- if (mode == lexBuf.lexModeStack[i]) return 1;
- return 0;
- }
-
-static char lexGetc_()
- {
- /* get next char from input, no buffering. */
- if (lexBuf.curPos == lexBuf.inputLen)
- return EOF;
- else if (lexBuf.inputString)
- return *(lexBuf.inputString + lexBuf.curPos++);
- else {
-#ifdef INCLUDEMFC
- char result;
- return lexBuf.inputFile->Read(&result, 1) == 1 ? result : EOF;
-#else
- return fgetc(lexBuf.inputFile);
-#endif
- }
- }
-
-static int lexGeta()
- {
- ++lexBuf.len;
- return (lexBuf.buf[lexBuf.getPtr] = lexGetc_());
- }
-
-static int lexGeta_(int i)
- {
- ++lexBuf.len;
- return (lexBuf.buf[(lexBuf.getPtr+i)%MAX_LEX_LOOKAHEAD] = lexGetc_());
- }
-
-static void lexSkipLookahead() {
- if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) {
- /* don't skip EOF. */
- lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD;
- lexBuf.len--;
- }
- }
-
-static int lexLookahead() {
- int c = (lexBuf.len)?
- lexBuf.buf[lexBuf.getPtr]:
- lexGeta();
- /* do the \r\n -> \n or \r -> \n translation here */
- if (c == '\r') {
- int a = (lexBuf.len>1)?
- lexBuf.buf[(lexBuf.getPtr+1)%MAX_LEX_LOOKAHEAD]:
- lexGeta_(1);
- if (a == '\n') {
- lexSkipLookahead();
- }
- lexBuf.buf[lexBuf.getPtr] = c = '\n';
- }
- else if (c == '\n') {
- int a = (lexBuf.len>1)?
- lexBuf.buf[lexBuf.getPtr+1]:
- lexGeta_(1);
- if (a == '\r') {
- lexSkipLookahead();
- }
- lexBuf.buf[lexBuf.getPtr] = '\n';
- }
- return c;
- }
-
-static int lexGetc() {
- int c = lexLookahead();
- if (lexBuf.len > 0 && lexBuf.buf[lexBuf.getPtr]!=EOF) {
- /* EOF will remain in lookahead buffer */
- lexBuf.getPtr = (lexBuf.getPtr + 1) % MAX_LEX_LOOKAHEAD;
- lexBuf.len--;
- }
- return c;
- }
-
-static void lexSkipLookaheadWord() {
- if (lexBuf.strsLen <= lexBuf.len) {
- lexBuf.len -= lexBuf.strsLen;
- lexBuf.getPtr = (lexBuf.getPtr + lexBuf.strsLen) % MAX_LEX_LOOKAHEAD;
- }
- }
-
-static void lexClearToken()
- {
- lexBuf.strsLen = 0;
- }
-
-static void lexAppendc(int c)
- {
- lexBuf.strs[lexBuf.strsLen] = c;
- /* append up to zero termination */
- if (c == 0) return;
- lexBuf.strsLen++;
- if (lexBuf.strsLen > lexBuf.maxToken) {
- /* double the token string size */
- lexBuf.maxToken <<= 1;
- lexBuf.strs = (char*) realloc(lexBuf.strs,(size_t)lexBuf.maxToken);
- }
- }
-
-static char* lexStr() {
- return dupStr(lexBuf.strs,(size_t)lexBuf.strsLen+1);
- }
-
-static void lexSkipWhite() {
- int c = lexLookahead();
- while (c == ' ' || c == '\t') {
- lexSkipLookahead();
- c = lexLookahead();
- }
- }
-
-static char* lexGetWord() {
- int c;
- lexSkipWhite();
- lexClearToken();
- c = lexLookahead();
- while (c != EOF && !strchr("\t\n ;:=",c)) {
- lexAppendc(c);
- lexSkipLookahead();
- c = lexLookahead();
- }
- lexAppendc(0);
- return lexStr();
- }
-
-static void lexPushLookahead(char *s, int len) {
- int putptr;
- if (len == 0) len = strlen(s);
- putptr = (int)lexBuf.getPtr - len;
- /* this function assumes that length of word to push back
- / is not greater than MAX_LEX_LOOKAHEAD.
- */
- if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD;
- lexBuf.getPtr = putptr;
- while (*s) {
- lexBuf.buf[putptr] = *s++;
- putptr = (putptr + 1) % MAX_LEX_LOOKAHEAD;
- }
- lexBuf.len += len;
- }
-
-static void lexPushLookaheadc(int c) {
- int putptr;
- /* can't putback EOF, because it never leaves lookahead buffer */
- if (c == EOF) return;
- putptr = (int)lexBuf.getPtr - 1;
- if (putptr < 0) putptr += MAX_LEX_LOOKAHEAD;
- lexBuf.getPtr = putptr;
- lexBuf.buf[putptr] = c;
- lexBuf.len += 1;
- }
-
-static char* lexLookaheadWord() {
- /* this function can lookahead word with max size of MAX_LEX_LOOKAHEAD_0
- / and thing bigger than that will stop the lookahead and return 0;
- / leading white spaces are not recoverable.
- */
- int c;
- int len = 0;
- int curgetptr = 0;
- lexSkipWhite();
- lexClearToken();
- curgetptr = (int)lexBuf.getPtr; /* remember! */
- while (len < (MAX_LEX_LOOKAHEAD_0)) {
- c = lexGetc();
- len++;
- if (c == EOF || strchr("\t\n ;:=", c)) {
- lexAppendc(0);
- /* restore lookahead buf. */
- lexBuf.len += len;
- lexBuf.getPtr = curgetptr;
- return lexStr();
- }
- else
- lexAppendc(c);
- }
- lexBuf.len += len; /* char that has been moved to lookahead buffer */
- lexBuf.getPtr = curgetptr;
- return 0;
- }
-
-#ifdef _SUPPORT_LINE_FOLDING
-static void handleMoreRFC822LineBreak(int c) {
- /* suport RFC 822 line break in cases like
- * ADR: foo;
- * morefoo;
- * more foo;
- */
- if (c == ';') {
- int a;
- lexSkipLookahead();
- /* skip white spaces */
- a = lexLookahead();
- while (a == ' ' || a == '\t') {
- lexSkipLookahead();
- a = lexLookahead();
- }
- if (a == '\n') {
- lexSkipLookahead();
- a = lexLookahead();
- if (a == ' ' || a == '\t') {
- /* continuation, throw away all the \n and spaces read so
- * far
- */
- lexSkipWhite();
- lexPushLookaheadc(';');
- }
- else {
- lexPushLookaheadc('\n');
- lexPushLookaheadc(';');
- }
- }
- else {
- lexPushLookaheadc(';');
- }
- }
- }
-
-static char* lexGet1Value() {
- int size = 0;
- int c;
- lexSkipWhite();
- c = lexLookahead();
- lexClearToken();
- while (c != EOF && c != ';') {
- if (c == '\n') {
- int a;
- lexSkipLookahead();
- a = lexLookahead();
- if (a == ' ' || a == '\t') {
- lexAppendc(' ');
- lexSkipLookahead();
- }
- else {
- lexPushLookaheadc('\n');
- break;
- }
- }
- else {
- lexAppendc(c);
- lexSkipLookahead();
- }
- c = lexLookahead();
- }
- lexAppendc(0);
- handleMoreRFC822LineBreak(c);
- return c==EOF?0:lexStr();
- }
-#endif
-
-static char* lexGetStrUntil(char *termset) {
- int size = 0;
- int c = lexLookahead();
- lexClearToken();
- while (c != EOF && !strchr(termset,c)) {
- lexAppendc(c);
- lexSkipLookahead();
- c = lexLookahead();
- }
- lexAppendc(0);
- return c==EOF?0:lexStr();
- }
-
-static int match_begin_name(int end) {
- char *n = lexLookaheadWord();
- int token = ID;
- if (n) {
- if (!stricmp(n,"vcard")) token = end?END_VCARD:BEGIN_VCARD;
- else if (!stricmp(n,"vcalendar")) token = end?END_VCAL:BEGIN_VCAL;
- else if (!stricmp(n,"vevent")) token = end?END_VEVENT:BEGIN_VEVENT;
- else if (!stricmp(n,"vtodo")) token = end?END_VTODO:BEGIN_VTODO;
- deleteStr(n);
- return token;
- }
- return 0;
- }
-
-
-#ifdef INCLUDEMFC
-void initLex(const char *inputstring, unsigned long inputlen, CFile *inputfile)
-#else
-void initLex(const char *inputstring, unsigned long inputlen, FILE *inputfile)
-#endif
- {
- /* initialize lex mode stack */
- lexBuf.lexModeStack[lexBuf.lexModeStackTop=0] = L_NORMAL;
-
- /* iniatialize lex buffer. */
- lexBuf.inputString = (char*) inputstring;
- lexBuf.inputLen = inputlen;
- lexBuf.curPos = 0;
- lexBuf.inputFile = inputfile;
-
- lexBuf.len = 0;
- lexBuf.getPtr = 0;
-
- lexBuf.maxToken = MAXTOKEN;
- lexBuf.strs = (char*)malloc(MAXTOKEN);
- lexBuf.strsLen = 0;
-
- }
-
-static void finiLex() {
- free(lexBuf.strs);
- }
-
-
-/*/////////////////////////////////////////////////////////////////////////*/
-/* This parses and converts the base64 format for binary encoding into
- * a decoded buffer (allocated with new). See RFC 1521.
- */
-static char * lexGetDataFromBase64()
- {
- unsigned long bytesLen = 0, bytesMax = 0;
- int quadIx = 0, pad = 0;
- unsigned long trip = 0;
- unsigned char b;
- int c;
- unsigned char *bytes = NULL;
- unsigned char *oldBytes = NULL;
-
- DBG_(("db: lexGetDataFromBase64\n"));
- while (1) {
- c = lexGetc();
- if (c == '\n') {
- ++mime_lineNum;
- if (lexLookahead() == '\n') {
- /* a '\n' character by itself means end of data */
- break;
- }
- else continue; /* ignore '\n' */
- }
- else {
- if ((c >= 'A') && (c <= 'Z'))
- b = (unsigned char)(c - 'A');
- else if ((c >= 'a') && (c <= 'z'))
- b = (unsigned char)(c - 'a') + 26;
- else if ((c >= '0') && (c <= '9'))
- b = (unsigned char)(c - '0') + 52;
- else if (c == '+')
- b = 62;
- else if (c == '/')
- b = 63;
- else if (c == '=') {
- b = 0;
- pad++;
- } else if ((c == ' ') || (c == '\t')) {
- continue;
- } else { /* error condition */
- if (bytes) free(bytes);
- else if (oldBytes) free(oldBytes);
- /* error recovery: skip until 2 adjacent newlines. */
- DBG_(("db: invalid character 0x%x '%c'\n", c,c));
- if (c != EOF) {
- c = lexGetc();
- while (c != EOF) {
- if (c == '\n' && lexLookahead() == '\n') {
- ++mime_lineNum;
- break;
- }
- c = lexGetc();
- }
- }
- return NULL;
- }
- trip = (trip << 6) | b;
- if (++quadIx == 4) {
- unsigned char outBytes[3];
- int numOut;
- int i;
- for (i = 0; i < 3; i++) {
- outBytes[2-i] = (unsigned char)(trip & 0xFF);
- trip >>= 8;
- }
- numOut = 3 - pad;
- if (bytesLen + numOut > bytesMax) {
- if (!bytes) {
- bytesMax = 1024;
- bytes = (unsigned char*)malloc((size_t)bytesMax);
- }
- else {
- bytesMax <<= 2;
- oldBytes = bytes;
- bytes = (unsigned char*)realloc(bytes,(size_t)bytesMax);
- }
- if (bytes == 0) {
- mime_error("out of memory while processing BASE64 data\n");
- }
- }
- if (bytes) {
- memcpy(bytes + bytesLen, outBytes, numOut);
- bytesLen += numOut;
- }
- trip = 0;
- quadIx = 0;
- }
- }
- } /* while */
- DBG_(("db: bytesLen = %d\n", bytesLen));
- /* kludge: all this won't be necessary if we have tree form
- representation */
- if (bytes) {
- setValueWithSize(curProp,bytes,(unsigned int)bytesLen);
- free(bytes);
- }
- else if (oldBytes) {
- setValueWithSize(curProp,oldBytes,(unsigned int)bytesLen);
- free(oldBytes);
- }
- return 0;
- }
-
-static int match_begin_end_name(int end) {
- int token;
- lexSkipWhite();
- if (lexLookahead() != ':') return ID;
- lexSkipLookahead();
- lexSkipWhite();
- token = match_begin_name(end);
- if (token == ID) {
- lexPushLookaheadc(':');
- DBG_(("db: ID '%s'\n", yylval.str));
- return ID;
- }
- else if (token != 0) {
- lexSkipLookaheadWord();
- deleteStr(yylval.str);
- DBG_(("db: begin/end %d\n", token));
- return token;
- }
- return 0;
- }
-
-static char* lexGetQuotedPrintable()
- {
- char cur;
- unsigned long len = 0;
-
- lexClearToken();
- do {
- cur = lexGetc();
- switch (cur) {
- case '=': {
- int c = 0;
- int next[2];
- int i;
- for (i = 0; i < 2; i++) {
- next[i] = lexGetc();
- if (next[i] >= '0' && next[i] <= '9')
- c = c * 16 + next[i] - '0';
- else if (next[i] >= 'A' && next[i] <= 'F')
- c = c * 16 + next[i] - 'A' + 10;
- else
- break;
- }
- if (i == 0) {
- /* single '=' follow by LINESEP is continuation sign? */
- if (next[0] == '\n') {
- ++mime_lineNum;
- }
- else {
- lexPushLookaheadc('=');
- goto EndString;
- }
- }
- else if (i == 1) {
- lexPushLookaheadc(next[1]);
- lexPushLookaheadc(next[0]);
- lexAppendc('=');
- } else {
- lexAppendc(c);
- }
- break;
- } /* '=' */
- case '\n': {
- lexPushLookaheadc('\n');
- goto EndString;
- }
- case (char)EOF:
- break;
- default:
- lexAppendc(cur);
- break;
- } /* switch */
- } while (cur != (char)EOF);
-
-EndString:
- lexAppendc(0);
- return lexStr();
- } /* LexQuotedPrintable */
-
-static int yylex() {
- int token = 0;
-
- int lexmode = LEXMODE();
- if (lexmode == L_VALUES) {
- int c = lexGetc();
- if (c == ';') {
- DBG_(("db: SEMICOLON\n"));
- lexPushLookaheadc(c);
-#ifdef _SUPPORT_LINE_FOLDING
- handleMoreRFC822LineBreak(c);
-#endif
- lexSkipLookahead();
- return SEMICOLON;
- }
- else if (strchr("\n",c)) {
- ++mime_lineNum;
- /* consume all line separator(s) adjacent to each other */
- c = lexLookahead();
- while (strchr("\n",c)) {
- lexSkipLookahead();
- c = lexLookahead();
- ++mime_lineNum;
- }
- DBG_(("db: LINESEP\n"));
- return LINESEP;
- }
- else {
- char *p = 0;
- lexPushLookaheadc(c);
- if (lexWithinMode(L_BASE64)) {
- /* get each char and convert to bin on the fly... */
- p = lexGetDataFromBase64();
- yylval.str = p;
- return STRING;
- }
- else if (lexWithinMode(L_QUOTED_PRINTABLE)) {
- p = lexGetQuotedPrintable();
- }
- else {
-#ifdef _SUPPORT_LINE_FOLDING
- p = lexGet1Value();
-#else
- p = lexGetStrUntil(";\n");
-#endif
- }
- if (p) {
- DBG_(("db: STRING: '%s'\n", p));
- yylval.str = p;
- return STRING;
- }
- else return 0;
- }
- }
- else {
- /* normal mode */
- while (1) {
- int c = lexGetc();
- switch(c) {
- case ':': {
- /* consume all line separator(s) adjacent to each other */
- /* ignoring linesep immediately after colon. */
-/* c = lexLookahead();
- while (strchr("\n",c)) {
- lexSkipLookahead();
- c = lexLookahead();
- ++mime_lineNum;
- }*/
- DBG_(("db: COLON\n"));
- return COLON;
- }
- case ';':
- DBG_(("db: SEMICOLON\n"));
- return SEMICOLON;
- case '=':
- DBG_(("db: EQ\n"));
- return EQ;
- /* ignore whitespace in this mode */
- case '\t':
- case ' ': continue;
- case '\n': {
- ++mime_lineNum;
- continue;
- }
- case EOF: return 0;
- break;
- default: {
- lexPushLookaheadc(c);
- if (isalpha(c)) {
- char *t = lexGetWord();
- yylval.str = t;
- if (!stricmp(t, "begin")) {
- return match_begin_end_name(0);
- }
- else if (!stricmp(t,"end")) {
- return match_begin_end_name(1);
- }
- else {
- DBG_(("db: ID '%s'\n", t));
- return ID;
- }
- }
- else {
- /* unknow token */
- return 0;
- }
- break;
- }
- }
- }
- }
- return 0;
- }
-
-
-/***************************************************************************/
-/*** Public Functions ****/
-/***************************************************************************/
-
-static VObject* Parse_MIMEHelper()
- {
- ObjStackTop = -1;
- mime_numErrors = 0;
- mime_lineNum = 1;
- vObjList = 0;
- curObj = 0;
-
- if (yyparse() != 0)
- return 0;
-
- finiLex();
- return vObjList;
- }
-
-/*/////////////////////////////////////////////////////////////////////////*/
-DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len)
- {
- initLex(input, len, 0);
- return Parse_MIMEHelper();
- }
-
-
-#if INCLUDEMFC
-
-DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file)
- {
- unsigned long startPos;
- VObject *result;
-
- initLex(0,-1,file);
- startPos = file->GetPosition();
- if (!(result = Parse_MIMEHelper()))
- file->Seek(startPos, CFile::begin);
- return result;
- }
-
-#else
-
-VObject* Parse_MIME_FromFile(FILE *file)
- {
- VObject *result;
- long startPos;
-
- initLex(0,(unsigned long)-1,file);
- startPos = ftell(file);
- if (!(result = Parse_MIMEHelper())) {
- fseek(file,startPos,SEEK_SET);
- }
- return result;
- }
-
-DLLEXPORT(VObject*) Parse_MIME_FromFileName(char *fname)
- {
- FILE *fp = fopen(fname,"r");
- if (fp) {
- VObject* o = Parse_MIME_FromFile(fp);
- fclose(fp);
- return o;
- }
- else {
- char msg[256];
- snprintf(msg, sizeof(msg), "can't open file '%s' for reading\n", fname);
- mime_error_(msg);
- return 0;
- }
- }
-
-#endif
-
-/*/////////////////////////////////////////////////////////////////////////*/
-static void YYDebug(const char *s)
-{
-/* Parse_Debug(s); */
-}
-
-
-static MimeErrorHandler mimeErrorHandler;
-
-DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler me)
- {
- mimeErrorHandler = me;
- }
-
-static void mime_error(char *s)
- {
- char msg[256];
- if (mimeErrorHandler) {
- sprintf(msg,"%s at line %d", s, mime_lineNum);
- mimeErrorHandler(msg);
- }
- }
-
-static void mime_error_(char *s)
- {
- if (mimeErrorHandler) {
- mimeErrorHandler(s);
- }
- }
-
diff --git a/libversit/vctest.c b/libversit/vctest.c
deleted file mode 100644
index 7975d1e200..0000000000
--- a/libversit/vctest.c
+++ /dev/null
@@ -1,95 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include "vcc.h"
-
-FILE *cfp;
-
-void myMimeErrorHandler(char *s)
-{
- printf("%s\n", s);
-}
-
-void main(int argc, char **argv)
-{
- int testmem = 0;
-
- char * foo[2] = {"foo","alden.vcf"};
-
-argc = 2;
-argv = foo;
-
-#ifdef _CONSOLE
- cfp = stdout;
- registerMimeErrorHandler(myMimeErrorHandler);
-#else
- cfp = fopen("vctest.out", "w");
- if (!cfp) return;
-#endif
- ++argv;
- while (--argc) {
- FILE *fp;
- if (strcmp(*argv,"-testmem") == 0) {
- testmem = 1;
- argv++;
- continue;
- }
- fprintf(cfp,"processing %s\n",*argv);
- fp = fopen(*argv,"r");
- if (!fp) {
- fprintf(cfp,"error opening file\n");
- }
- else {
- VObject *v, *t;
- FILE *ofp;
- char buf[256];
- char *p;
- strcpy(buf,*argv);
- p = strchr(buf,'.');
- if (p) *p = 0;
- strcat(buf,".out");
- fprintf(cfp,"reading text input from '%s'...\n", *argv);
- /*v = Parse_MIME_FromFile(fp); */
- v = Parse_MIME_FromFileName(*argv);
- writeVObjectToFile(buf,v);
- cleanVObject(v);
-
- /*
- fprintf(cfp,"pretty print internal format of '%s'...\n", *argv);
- ofp = fopen(buf,"w");
- while (v) {
- printVObject(cfp,v);
- if (testmem) {
- char *s, *p;
- fprintf(cfp,"test writing to mem...\n");
- p = s = writeMemVObject(0,0,v);
- if (s) {
- while (*s) {
- fputc(*s,ofp);
- s++;
- }
- free(p);
- }
- }
- else {
- writeVObject(ofp,v);
- }
- t = v;
- v = nextVObjectInList(v);
- cleanVObject(t);
- }
-
- fclose(ofp);
- fclose(fp);
- */
- }
-
- cleanStrTbl();
- argv++;
-
- }
-
- if (cfp != stdout) fclose(cfp);
-
-}
-
diff --git a/libversit/vobject.c b/libversit/vobject.c
deleted file mode 100644
index cd223dcce8..0000000000
--- a/libversit/vobject.c
+++ /dev/null
@@ -1,1428 +0,0 @@
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-/*
- * src: vobject.c
- * doc: vobject and APIs to construct vobject, APIs pretty print
- * vobject, and convert a vobject into its textual representation.
- */
-
-#ifndef MWERKS
-#include <malloc.h>
-#endif
-
-#include "vobject.h"
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-
-
-#define NAME_OF(o) o->id
-#define VALUE_TYPE(o) o->valType
-#define STRINGZ_VALUE_OF(o) o->val.strs
-#define USTRINGZ_VALUE_OF(o) o->val.ustrs
-#define INTEGER_VALUE_OF(o) o->val.i
-#define LONG_VALUE_OF(o) o->val.l
-#define ANY_VALUE_OF(o) o->val.any
-#define VOBJECT_VALUE_OF(o) o->val.vobj
-
-typedef union ValueItem {
- const char *strs;
- const wchar_t *ustrs;
- unsigned int i;
- unsigned long l;
- void *any;
- VObject *vobj;
- } ValueItem;
-
-struct VObject {
- VObject *next;
- const char *id;
- VObject *prop;
- unsigned short valType;
- ValueItem val;
- };
-
-typedef struct StrItem StrItem;
-
-struct StrItem {
- StrItem *next;
- const char *s;
- unsigned int refCnt;
- };
-
-const char** fieldedProp;
-
-
-
-/*----------------------------------------------------------------------
- The following functions involve with memory allocation:
- newVObject
- deleteVObject
- dupStr
- deleteStr
- newStrItem
- deleteStrItem
- ----------------------------------------------------------------------*/
-
-DLLEXPORT(VObject*) newVObject_(const char *id)
-{
- VObject *p = (VObject*)malloc(sizeof(VObject));
- p->next = 0;
- p->id = id;
- p->prop = 0;
- VALUE_TYPE(p) = 0;
- ANY_VALUE_OF(p) = 0;
- return p;
-}
-
-DLLEXPORT(VObject*) newVObject(const char *id)
-{
- return newVObject_(lookupStr(id));
-}
-
-DLLEXPORT(void) deleteVObject(VObject *p)
-{
- unUseStr(p->id);
- free(p);
-}
-
-DLLEXPORT(char*) dupStr(const char *s, unsigned int size)
-{
- char *t;
- if (size == 0) {
- size = strlen(s);
- }
- t = (char*)malloc(size+1);
- if (t) {
- memcpy(t,s,size);
- t[size] = 0;
- return t;
- }
- else {
- return (char*)0;
- }
-}
-
-DLLEXPORT(void) deleteStr(const char *p)
-{
- if (p) free((void*)p);
-}
-
-
-static StrItem* newStrItem(const char *s, StrItem *next)
-{
- StrItem *p = (StrItem*)malloc(sizeof(StrItem));
- p->next = next;
- p->s = s;
- p->refCnt = 1;
- return p;
-}
-
-static void deleteStrItem(StrItem *p)
-{
- free((void*)p);
-}
-
-
-/*----------------------------------------------------------------------
- The following function provide accesses to VObject's value.
- ----------------------------------------------------------------------*/
-
-DLLEXPORT(const char*) vObjectName(VObject *o)
-{
- return NAME_OF(o);
-}
-
-DLLEXPORT(void) setVObjectName(VObject *o, const char* id)
-{
- NAME_OF(o) = id;
-}
-
-DLLEXPORT(const char*) vObjectStringZValue(VObject *o)
-{
- return STRINGZ_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s)
-{
- STRINGZ_VALUE_OF(o) = dupStr(s,0);
- VALUE_TYPE(o) = VCVT_STRINGZ;
-}
-
-DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s)
-{
- STRINGZ_VALUE_OF(o) = s;
- VALUE_TYPE(o) = VCVT_STRINGZ;
-}
-
-DLLEXPORT(const wchar_t*) vObjectUStringZValue(VObject *o)
-{
- return USTRINGZ_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectUStringZValue(VObject *o, const wchar_t *s)
-{
- USTRINGZ_VALUE_OF(o) = (wchar_t*) dupStr((char*)s,(uStrLen(s)+1)*2);
- VALUE_TYPE(o) = VCVT_USTRINGZ;
-}
-
-DLLEXPORT(void) setVObjectUStringZValue_(VObject *o, const wchar_t *s)
-{
- USTRINGZ_VALUE_OF(o) = s;
- VALUE_TYPE(o) = VCVT_USTRINGZ;
-}
-
-DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o)
-{
- return INTEGER_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i)
-{
- INTEGER_VALUE_OF(o) = i;
- VALUE_TYPE(o) = VCVT_UINT;
-}
-
-DLLEXPORT(unsigned long) vObjectLongValue(VObject *o)
-{
- return LONG_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l)
-{
- LONG_VALUE_OF(o) = l;
- VALUE_TYPE(o) = VCVT_ULONG;
-}
-
-DLLEXPORT(void*) vObjectAnyValue(VObject *o)
-{
- return ANY_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t)
-{
- ANY_VALUE_OF(o) = t;
- VALUE_TYPE(o) = VCVT_RAW;
-}
-
-DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o)
-{
- return VOBJECT_VALUE_OF(o);
-}
-
-DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p)
-{
- VOBJECT_VALUE_OF(o) = p;
- VALUE_TYPE(o) = VCVT_VOBJECT;
-}
-
-DLLEXPORT(int) vObjectValueType(VObject *o)
-{
- return VALUE_TYPE(o);
-}
-
-
-/*----------------------------------------------------------------------
- The following functions can be used to build VObject.
- ----------------------------------------------------------------------*/
-
-DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p)
-{
- /* circular link list pointed to tail */
- /*
- o {next,id,prop,val}
- V
- pn {next,id,prop,val}
- V
- ...
- p1 {next,id,prop,val}
- V
- pn
- -->
- o {next,id,prop,val}
- V
- pn {next,id,prop,val}
- V
- p {next,id,prop,val}
- ...
- p1 {next,id,prop,val}
- V
- pn
- */
-
- VObject *tail = o->prop;
- if (tail) {
- p->next = tail->next;
- o->prop = tail->next = p;
- }
- else {
- o->prop = p->next = p;
- }
- return p;
-}
-
-DLLEXPORT(VObject*) addProp(VObject *o, const char *id)
-{
- return addVObjectProp(o,newVObject(id));
-}
-
-DLLEXPORT(VObject*) addProp_(VObject *o, const char *id)
-{
- return addVObjectProp(o,newVObject_(id));
-}
-
-DLLEXPORT(void) addList(VObject **o, VObject *p)
-{
- p->next = 0;
- if (*o == 0) {
- *o = p;
- }
- else {
- VObject *t = *o;
- while (t->next) {
- t = t->next;
- }
- t->next = p;
- }
-}
-
-DLLEXPORT(VObject*) nextVObjectInList(VObject *o)
-{
- return o->next;
-}
-
-DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size)
-{
- VObject *sizeProp;
- setVObjectAnyValue(prop, val);
- sizeProp = addProp(prop,VCDataSizeProp);
- setVObjectLongValue(sizeProp, size);
- return prop;
-}
-
-DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size)
-{
- void *p = dupStr((const char *)val,size);
- return setValueWithSize_(prop,p,p?size:0);
-}
-
-DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o)
-{
- i->start = o->prop;
- i->next = 0;
-}
-
-DLLEXPORT(void) initVObjectIterator(VObjectIterator *i, VObject *o)
-{
- i->start = o->next;
- i->next = 0;
-}
-
-DLLEXPORT(int) moreIteration(VObjectIterator *i)
-{
- return (i->start && (i->next==0 || i->next!=i->start));
-}
-
-DLLEXPORT(VObject*) nextVObject(VObjectIterator *i)
-{
- if (i->start && i->next != i->start) {
- if (i->next == 0) {
- i->next = i->start->next;
- return i->next;
- }
- else {
- i->next = i->next->next;
- return i->next;
- }
- }
- else return (VObject*)0;
-}
-
-DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id)
-{
- VObjectIterator i;
- initPropIterator(&i,o);
- while (moreIteration(&i)) {
- VObject *each = nextVObject(&i);
- if (!stricmp(id,each->id))
- return each;
- }
- return (VObject*)0;
-}
-
-DLLEXPORT(VObject*) addGroup(VObject *o, const char *g)
-{
- /*
- a.b.c
- -->
- prop(c)
- prop(VCGrouping=b)
- prop(VCGrouping=a)
- */
- char *dot = strrchr(g,'.');
- if (dot) {
- VObject *p, *t;
- char *gs, *n = dot+1;
- gs = dupStr(g,0); /* so we can write to it. */
- /* used to be
- * t = p = addProp_(o,lookupProp_(n));
- */
- t = p = addProp_(o,lookupProp(n));
- dot = strrchr(gs,'.');
- *dot = 0;
- do {
- dot = strrchr(gs,'.');
- if (dot) {
- n = dot+1;
- *dot=0;
- }
- else
- n = gs;
- /* property(VCGroupingProp=n);
- * and the value may have VCGrouping property
- */
- t = addProp(t,VCGroupingProp);
- setVObjectStringZValue(t,lookupProp_(n));
- } while (n != gs);
- deleteStr(gs);
- return p;
- }
- else
- return addProp_(o,lookupProp(g));
-}
-
-DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v)
-{
- VObject *prop;
- prop = addProp(o,p);
- setVObjectUStringZValue_(prop, fakeUnicode(v,0));
- return prop;
-}
-
-DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v,
- unsigned int size)
-{
- VObject *prop;
- prop = addProp(o,p);
- setValueWithSize_(prop, (void*)v, size);
- return prop;
-}
-
-DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v,
- unsigned int size)
-{
- return addPropSizedValue_(o,p,dupStr(v,size),size);
-}
-
-
-
-/*----------------------------------------------------------------------
- The following pretty print a VObject
- ----------------------------------------------------------------------*/
-
-static void printVObject_(FILE *fp, VObject *o, int level);
-
-static void indent(FILE *fp, int level)
-{
- int i;
- for (i=0;i<level*4;i++) {
- fputc(' ', fp);
- }
-}
-
-static void printValue(FILE *fp, VObject *o, int level)
-{
- switch (VALUE_TYPE(o)) {
- case VCVT_USTRINGZ: {
- char c;
- char *t,*s;
- s = t = fakeCString(USTRINGZ_VALUE_OF(o));
- fputc('"',fp);
- while (c=*t,c) {
- fputc(c,fp);
- if (c == '\n') indent(fp,level+2);
- t++;
- }
- fputc('"',fp);
- deleteStr(s);
- break;
- }
- case VCVT_STRINGZ: {
- char c;
- const char *s = STRINGZ_VALUE_OF(o);
- fputc('"',fp);
- while (c=*s,c) {
- fputc(c,fp);
- if (c == '\n') indent(fp,level+2);
- s++;
- }
- fputc('"',fp);
- break;
- }
- case VCVT_UINT:
- fprintf(fp,"%d", INTEGER_VALUE_OF(o)); break;
- case VCVT_ULONG:
- fprintf(fp,"%ld", LONG_VALUE_OF(o)); break;
- case VCVT_RAW:
- fprintf(fp,"[raw data]"); break;
- case VCVT_VOBJECT:
- fprintf(fp,"[vobject]\n");
- printVObject_(fp,VOBJECT_VALUE_OF(o),level+1);
- break;
- case 0:
- fprintf(fp,"[none]"); break;
- default:
- fprintf(fp,"[unknown]"); break;
- }
-}
-
-static void printNameValue(FILE *fp,VObject *o, int level)
-{
- indent(fp,level);
- if (NAME_OF(o)) {
- fprintf(fp,"%s", NAME_OF(o));
- }
- if (VALUE_TYPE(o)) {
- fputc('=',fp);
- printValue(fp,o, level);
- }
- fprintf(fp,"\n");
-}
-
-static void printVObject_(FILE *fp, VObject *o, int level)
- {
- VObjectIterator t;
- if (o == 0) {
- fprintf(fp,"[NULL]\n");
- return;
- }
- printNameValue(fp,o,level);
- initPropIterator(&t,o);
- while (moreIteration(&t)) {
- VObject *eachProp = nextVObject(&t);
- printVObject_(fp,eachProp,level+1);
- }
- }
-
-void printVObject(FILE *fp,VObject *o)
-{
- printVObject_(fp,o,0);
-}
-
-DLLEXPORT(void) printVObjectToFile(char *fname,VObject *o)
-{
- FILE *fp = fopen(fname,"w");
- if (fp) {
- printVObject(fp,o);
- fclose(fp);
- }
-}
-
-DLLEXPORT(void) printVObjectsToFile(char *fname,VObject *list)
-{
- FILE *fp = fopen(fname,"w");
- if (fp) {
- while (list) {
- printVObject(fp,list);
- list = nextVObjectInList(list);
- }
- fclose(fp);
- }
-}
-
-DLLEXPORT(void) cleanVObject(VObject *o)
-{
- if (o == 0) return;
- if (o->prop) {
- /* destroy time: cannot use the iterator here.
- Have to break the cycle in the circular link
- list and turns it into regular NULL-terminated
- list -- since at some point of destruction,
- the reference entry for the iterator to work
- will not longer be valid.
- */
- VObject *p;
- p = o->prop->next;
- o->prop->next = 0;
- do {
- VObject *t = p->next;
- cleanVObject(p);
- p = t;
- } while (p);
- }
- switch (VALUE_TYPE(o)) {
- case VCVT_USTRINGZ:
- case VCVT_STRINGZ:
- case VCVT_RAW:
- /* assume they are all allocated by malloc. */
- free((char*)STRINGZ_VALUE_OF(o));
- break;
- case VCVT_VOBJECT:
- cleanVObject(VOBJECT_VALUE_OF(o));
- break;
- }
- deleteVObject(o);
-}
-
-DLLEXPORT(void) cleanVObjects(VObject *list)
-{
- while (list) {
- VObject *t = list;
- list = nextVObjectInList(list);
- cleanVObject(t);
- }
-}
-
-/*----------------------------------------------------------------------
- The following is a String Table Facilities.
- ----------------------------------------------------------------------*/
-
-#define STRTBLSIZE 255
-
-static StrItem *strTbl[STRTBLSIZE];
-
-static unsigned int hashStr(const char *s)
-{
- unsigned int h = 0;
- int i;
- for (i=0;s[i];i++) {
- h += s[i]*i;
- }
- return h % STRTBLSIZE;
-}
-
-DLLEXPORT(const char*) lookupStr(const char *s)
-{
- StrItem *t;
- unsigned int h = hashStr(s);
- if ((t = strTbl[h]) != 0) {
- do {
- if (stricmp(t->s,s) == 0) {
- t->refCnt++;
- return t->s;
- }
- t = t->next;
- } while (t);
- }
- s = dupStr(s,0);
- strTbl[h] = newStrItem(s,strTbl[h]);
- return s;
-}
-
-DLLEXPORT(void) unUseStr(const char *s)
-{
- StrItem *t, *p;
- unsigned int h = hashStr(s);
- if ((t = strTbl[h]) != 0) {
- p = t;
- do {
- if (stricmp(t->s,s) == 0) {
- t->refCnt--;
- if (t->refCnt == 0) {
- if (p == strTbl[h]) {
- strTbl[h] = t->next;
- }
- else {
- p->next = t->next;
- }
- deleteStr(t->s);
- deleteStrItem(t);
- return;
- }
- }
- p = t;
- t = t->next;
- } while (t);
- }
-}
-
-DLLEXPORT(void) cleanStrTbl()
-{
- int i;
- for (i=0; i<STRTBLSIZE;i++) {
- StrItem *t = strTbl[i];
- while (t) {
- StrItem *p;
- deleteStr(t->s);
- p = t;
- t = t->next;
- deleteStrItem(p);
- } while (t);
- strTbl[i] = 0;
- }
-}
-
-
-struct PreDefProp {
- const char *name;
- const char *alias;
- const char** fields;
- unsigned int flags;
- };
-
-/* flags in PreDefProp */
-#define PD_BEGIN 0x1
-#define PD_INTERNAL 0x2
-
-static const char *adrFields[] = {
- VCPostalBoxProp,
- VCExtAddressProp,
- VCStreetAddressProp,
- VCCityProp,
- VCRegionProp,
- VCPostalCodeProp,
- VCCountryNameProp,
- 0
-};
-
-static const char *nameFields[] = {
- VCFamilyNameProp,
- VCGivenNameProp,
- VCAdditionalNamesProp,
- VCNamePrefixesProp,
- VCNameSuffixesProp,
- NULL
- };
-
-static const char *orgFields[] = {
- VCOrgNameProp,
- VCOrgUnitProp,
- VCOrgUnit2Prop,
- VCOrgUnit3Prop,
- VCOrgUnit4Prop,
- NULL
- };
-
-static const char *AAlarmFields[] = {
- VCRunTimeProp,
- VCSnoozeTimeProp,
- VCRepeatCountProp,
- VCAudioContentProp,
- 0
- };
-
-/* ExDate -- has unamed fields */
-/* RDate -- has unamed fields */
-
-static const char *DAlarmFields[] = {
- VCRunTimeProp,
- VCSnoozeTimeProp,
- VCRepeatCountProp,
- VCDisplayStringProp,
- 0
- };
-
-static const char *MAlarmFields[] = {
- VCRunTimeProp,
- VCSnoozeTimeProp,
- VCRepeatCountProp,
- VCEmailAddressProp,
- VCNoteProp,
- 0
- };
-
-static const char *PAlarmFields[] = {
- VCRunTimeProp,
- VCSnoozeTimeProp,
- VCRepeatCountProp,
- VCProcedureNameProp,
- 0
- };
-
-static struct PreDefProp propNames[] = {
- { VC7bitProp, 0, 0, 0 },
- { VC8bitProp, 0, 0, 0 },
- { VCAAlarmProp, 0, AAlarmFields, 0 },
- { VCAdditionalNamesProp, 0, 0, 0 },
- { VCAdrProp, 0, adrFields, 0 },
- { VCAgentProp, 0, 0, 0 },
- { VCAIFFProp, 0, 0, 0 },
- { VCAOLProp, 0, 0, 0 },
- { VCAppleLinkProp, 0, 0, 0 },
- { VCAttachProp, 0, 0, 0 },
- { VCAttendeeProp, 0, 0, 0 },
- { VCATTMailProp, 0, 0, 0 },
- { VCAudioContentProp, 0, 0, 0 },
- { VCAVIProp, 0, 0, 0 },
- { VCBase64Prop, 0, 0, 0 },
- { VCBBSProp, 0, 0, 0 },
- { VCBirthDateProp, 0, 0, 0 },
- { VCBMPProp, 0, 0, 0 },
- { VCBodyProp, 0, 0, 0 },
- { VCBusinessRoleProp, 0, 0, 0 },
- { VCCalProp, 0, 0, PD_BEGIN },
- { VCCaptionProp, 0, 0, 0 },
- { VCCardProp, 0, 0, PD_BEGIN },
- { VCCarProp, 0, 0, 0 },
- { VCCategoriesProp, 0, 0, 0 },
- { VCCellularProp, 0, 0, 0 },
- { VCCGMProp, 0, 0, 0 },
- { VCCharSetProp, 0, 0, 0 },
- { VCCIDProp, VCContentIDProp, 0, 0 },
- { VCCISProp, 0, 0, 0 },
- { VCCityProp, 0, 0, 0 },
- { VCClassProp, 0, 0, 0 },
- { VCCommentProp, 0, 0, 0 },
- { VCCompletedProp, 0, 0, 0 },
- { VCContentIDProp, 0, 0, 0 },
- { VCCountryNameProp, 0, 0, 0 },
- { VCDAlarmProp, 0, DAlarmFields, 0 },
- { VCDataSizeProp, 0, 0, PD_INTERNAL },
- { VCDayLightProp, 0, 0, 0 },
- { VCDCreatedProp, 0, 0, 0 },
- { VCDeliveryLabelProp, 0, 0, 0 },
- { VCDescriptionProp, 0, 0, 0 },
- { VCDIBProp, 0, 0, 0 },
- { VCDisplayStringProp, 0, 0, 0 },
- { VCDomesticProp, 0, 0, 0 },
- { VCDTendProp, 0, 0, 0 },
- { VCDTstartProp, 0, 0, 0 },
- { VCDueProp, 0, 0, 0 },
- { VCEmailAddressProp, 0, 0, 0 },
- { VCEncodingProp, 0, 0, 0 },
- { VCEndProp, 0, 0, 0 },
- { VCEventProp, 0, 0, PD_BEGIN },
- { VCEWorldProp, 0, 0, 0 },
- { VCExNumProp, 0, 0, 0 },
- { VCExpDateProp, 0, 0, 0 },
- { VCExpectProp, 0, 0, 0 },
- { VCExtAddressProp, 0, 0, 0 },
- { VCFamilyNameProp, 0, 0, 0 },
- { VCFaxProp, 0, 0, 0 },
- { VCFullNameProp, 0, 0, 0 },
- { VCGeoLocationProp, 0, 0, 0 },
- { VCGeoProp, 0, 0, 0 },
- { VCGIFProp, 0, 0, 0 },
- { VCGivenNameProp, 0, 0, 0 },
- { VCGroupingProp, 0, 0, 0 },
- { VCHomeProp, 0, 0, 0 },
- { VCIBMMailProp, 0, 0, 0 },
- { VCInlineProp, 0, 0, 0 },
- { VCInternationalProp, 0, 0, 0 },
- { VCInternetProp, 0, 0, 0 },
- { VCISDNProp, 0, 0, 0 },
- { VCJPEGProp, 0, 0, 0 },
- { VCLanguageProp, 0, 0, 0 },
- { VCLastModifiedProp, 0, 0, 0 },
- { VCLastRevisedProp, 0, 0, 0 },
- { VCLocationProp, 0, 0, 0 },
- { VCLogoProp, 0, 0, 0 },
- { VCMailerProp, 0, 0, 0 },
- { VCMAlarmProp, 0, MAlarmFields, 0 },
- { VCMCIMailProp, 0, 0, 0 },
- { VCMessageProp, 0, 0, 0 },
- { VCMETProp, 0, 0, 0 },
- { VCModemProp, 0, 0, 0 },
- { VCMPEG2Prop, 0, 0, 0 },
- { VCMPEGProp, 0, 0, 0 },
- { VCMSNProp, 0, 0, 0 },
- { VCNamePrefixesProp, 0, 0, 0 },
- { VCNameProp, 0, nameFields, 0 },
- { VCNameSuffixesProp, 0, 0, 0 },
- { VCNoteProp, 0, 0, 0 },
- { VCOrgNameProp, 0, 0, 0 },
- { VCOrgProp, 0, orgFields, 0 },
- { VCOrgUnit2Prop, 0, 0, 0 },
- { VCOrgUnit3Prop, 0, 0, 0 },
- { VCOrgUnit4Prop, 0, 0, 0 },
- { VCOrgUnitProp, 0, 0, 0 },
- { VCPagerProp, 0, 0, 0 },
- { VCPAlarmProp, 0, PAlarmFields, 0 },
- { VCParcelProp, 0, 0, 0 },
- { VCPartProp, 0, 0, 0 },
- { VCPCMProp, 0, 0, 0 },
- { VCPDFProp, 0, 0, 0 },
- { VCPGPProp, 0, 0, 0 },
- { VCPhotoProp, 0, 0, 0 },
- { VCPICTProp, 0, 0, 0 },
- { VCPMBProp, 0, 0, 0 },
- { VCPostalBoxProp, 0, 0, 0 },
- { VCPostalCodeProp, 0, 0, 0 },
- { VCPostalProp, 0, 0, 0 },
- { VCPowerShareProp, 0, 0, 0 },
- { VCPreferredProp, 0, 0, 0 },
- { VCPriorityProp, 0, 0, 0 },
- { VCProcedureNameProp, 0, 0, 0 },
- { VCProdIdProp, 0, 0, 0 },
- { VCProdigyProp, 0, 0, 0 },
- { VCPronunciationProp, 0, 0, 0 },
- { VCPSProp, 0, 0, 0 },
- { VCPublicKeyProp, 0, 0, 0 },
- { VCQPProp, VCQuotedPrintableProp, 0, 0 },
- { VCQuickTimeProp, 0, 0, 0 },
- { VCQuotedPrintableProp, 0, 0, 0 },
- { VCRDateProp, 0, 0, 0 },
- { VCRegionProp, 0, 0, 0 },
- { VCRelatedToProp, 0, 0, 0 },
- { VCRepeatCountProp, 0, 0, 0 },
- { VCResourcesProp, 0, 0, 0 },
- { VCRNumProp, 0, 0, 0 },
- { VCRoleProp, 0, 0, 0 },
- { VCRRuleProp, 0, 0, 0 },
- { VCRSVPProp, 0, 0, 0 },
- { VCRunTimeProp, 0, 0, 0 },
- { VCSequenceProp, 0, 0, 0 },
- { VCSnoozeTimeProp, 0, 0, 0 },
- { VCStartProp, 0, 0, 0 },
- { VCStatusProp, 0, 0, 0 },
- { VCStreetAddressProp, 0, 0, 0 },
- { VCSubTypeProp, 0, 0, 0 },
- { VCSummaryProp, 0, 0, 0 },
- { VCTelephoneProp, 0, 0, 0 },
- { VCTIFFProp, 0, 0, 0 },
- { VCTimeZoneProp, 0, 0, 0 },
- { VCTitleProp, 0, 0, 0 },
- { VCTLXProp, 0, 0, 0 },
- { VCTodoProp, 0, 0, PD_BEGIN },
- { VCTranspProp, 0, 0, 0 },
- { VCUniqueStringProp, 0, 0, 0 },
- { VCURLProp, 0, 0, 0 },
- { VCURLValueProp, 0, 0, 0 },
- { VCValueProp, 0, 0, 0 },
- { VCVersionProp, 0, 0, 0 },
- { VCVideoProp, 0, 0, 0 },
- { VCVoiceProp, 0, 0, 0 },
- { VCWAVEProp, 0, 0, 0 },
- { VCWMFProp, 0, 0, 0 },
- { VCWorkProp, 0, 0, 0 },
- { VCX400Prop, 0, 0, 0 },
- { VCX509Prop, 0, 0, 0 },
- { VCXRuleProp, 0, 0, 0 },
- { 0,0,0,0 }
- };
-
-
-static struct PreDefProp* lookupPropInfo(const char* str)
-{
- /* brute force for now, could use a hash table here. */
- int i;
-
- for (i = 0; propNames[i].name; i++)
- if (stricmp(str, propNames[i].name) == 0) {
- return &propNames[i];
- }
-
- return 0;
-}
-
-
-DLLEXPORT(const char*) lookupProp_(const char* str)
-{
- int i;
-
- for (i = 0; propNames[i].name; i++)
- if (stricmp(str, propNames[i].name) == 0) {
- const char* s;
- s = propNames[i].alias?propNames[i].alias:propNames[i].name;
- return lookupStr(s);
- }
- return lookupStr(str);
-}
-
-
-DLLEXPORT(const char*) lookupProp(const char* str)
-{
- int i;
-
- for (i = 0; propNames[i].name; i++)
- if (stricmp(str, propNames[i].name) == 0) {
- const char *s;
- fieldedProp = propNames[i].fields;
- s = propNames[i].alias?propNames[i].alias:propNames[i].name;
- return lookupStr(s);
- }
- fieldedProp = 0;
- return lookupStr(str);
-}
-
-
-/*----------------------------------------------------------------------
- APIs to Output text form.
- ----------------------------------------------------------------------*/
-#define OFILE_REALLOC_SIZE 256
-typedef struct OFile {
- FILE *fp;
- char *s;
- int len;
- int limit;
- int alloc:1;
- int fail:1;
- } OFile;
-
-#if 0
-static void appendsOFile(OFile *fp, const char *s)
-{
- int slen;
- if (fp->fail) return;
- slen = strlen(s);
- if (fp->fp) {
- fwrite(s,1,slen,fp->fp);
- }
- else {
-stuff:
- if (fp->len + slen < fp->limit) {
- memcpy(fp->s+fp->len,s,slen);
- fp->len += slen;
- return;
- }
- else if (fp->alloc) {
- fp->limit = fp->limit + OFILE_REALLOC_SIZE;
- if (OFILE_REALLOC_SIZE <= slen) fp->limit += slen;
- fp->s = (char *) realloc(fp->s,fp->limit);
- if (fp->s) goto stuff;
- }
- if (fp->alloc)
- free(fp->s);
- fp->s = 0;
- fp->fail = 1;
- }
-}
-
-static void appendcOFile(OFile *fp, char c)
-{
- if (fp->fail) return;
- if (fp->fp) {
- fputc(c,fp->fp);
- }
- else {
-stuff:
- if (fp->len+1 < fp->limit) {
- fp->s[fp->len] = c;
- fp->len++;
- return;
- }
- else if (fp->alloc) {
- fp->limit = fp->limit + OFILE_REALLOC_SIZE;
- fp->s = (char *) realloc(fp->s,fp->limit);
- if (fp->s) goto stuff;
- }
- if (fp->alloc)
- free(fp->s);
- fp->s = 0;
- fp->fail = 1;
- }
-}
-#else
-static void appendcOFile_(OFile *fp, char c)
-{
- if (fp->fail) return;
- if (fp->fp) {
- fputc(c,fp->fp);
- }
- else {
-stuff:
- if (fp->len+1 < fp->limit) {
- fp->s[fp->len] = c;
- fp->len++;
- return;
- }
- else if (fp->alloc) {
- fp->limit = fp->limit + OFILE_REALLOC_SIZE;
- fp->s = realloc(fp->s,fp->limit);
- if (fp->s) goto stuff;
- }
- if (fp->alloc)
- free(fp->s);
- fp->s = 0;
- fp->fail = 1;
- }
-}
-
-static void appendcOFile(OFile *fp, char c)
-{
- if (c == '\n') {
- /* write out as <CR><LF> */
- appendcOFile_(fp,0xd);
- appendcOFile_(fp,0xa);
- }
- else
- appendcOFile_(fp,c);
-}
-
-static void appendsOFile(OFile *fp, const char *s)
-{
- int i, slen;
- slen = strlen(s);
- for (i=0; i<slen; i++) {
- appendcOFile(fp,s[i]);
- }
-}
-
-#endif
-
-static void initOFile(OFile *fp, FILE *ofp)
-{
- fp->fp = ofp;
- fp->s = 0;
- fp->len = 0;
- fp->limit = 0;
- fp->alloc = 0;
- fp->fail = 0;
-}
-
-static void initMemOFile(OFile *fp, char *s, int len)
-{
- fp->fp = 0;
- fp->s = s;
- fp->len = 0;
- fp->limit = s?len:0;
- fp->alloc = s?0:1;
- fp->fail = 0;
-}
-
-
-static int writeBase64(OFile *fp, unsigned char *s, long len)
-{
- long cur = 0;
- int i, numQuads = 0;
- unsigned long trip;
- unsigned char b;
- char quad[5];
-#define MAXQUADS 16
-
- quad[4] = 0;
-
- while (cur < len) {
- /* collect the triplet of bytes into 'trip' */
- trip = 0;
- for (i = 0; i < 3; i++) {
- b = (cur < len) ? *(s + cur) : 0;
- cur++;
- trip = trip << 8 | b;
- }
- /* fill in 'quad' with the appropriate four characters */
- for (i = 3; i >= 0; i--) {
- b = (unsigned char)(trip & 0x3F);
- trip = trip >> 6;
- if ((3 - i) < (cur - len))
- quad[i] = '='; /* pad char */
- else if (b < 26) quad[i] = (char)b + 'A';
- else if (b < 52) quad[i] = (char)(b - 26) + 'a';
- else if (b < 62) quad[i] = (char)(b - 52) + '0';
- else if (b == 62) quad[i] = '+';
- else quad[i] = '/';
- }
- /* now output 'quad' with appropriate whitespace and line ending */
- appendsOFile(fp, (numQuads == 0 ? " " : ""));
- appendsOFile(fp, quad);
- appendsOFile(fp, ((cur >= len)?"\n" :(numQuads==MAXQUADS-1?"\n" : "")));
- numQuads = (numQuads + 1) % MAXQUADS;
- }
- appendcOFile(fp,'\n');
-
- return 1;
-}
-
-static void writeQPString(OFile *fp, const char *s)
-{
- const char *p = s;
- while (*p) {
- if (*p == '\n') {
- if (p[1]) appendsOFile(fp,"=0A=");
- }
- appendcOFile(fp,*p);
- p++;
- }
-}
-
-
-
-static void writeVObject_(OFile *fp, VObject *o);
-
-static void writeValue(OFile *fp, VObject *o, unsigned long size)
-{
- if (o == 0) return;
- switch (VALUE_TYPE(o)) {
- case VCVT_USTRINGZ: {
- char *s = fakeCString(USTRINGZ_VALUE_OF(o));
- writeQPString(fp, s);
- deleteStr(s);
- break;
- }
- case VCVT_STRINGZ: {
- writeQPString(fp, STRINGZ_VALUE_OF(o));
- break;
- }
- case VCVT_UINT: {
- char buf[16];
- sprintf(buf,"%u", INTEGER_VALUE_OF(o));
- appendsOFile(fp,buf);
- break;
- }
- case VCVT_ULONG: {
- char buf[16];
- sprintf(buf,"%lu", LONG_VALUE_OF(o));
- appendsOFile(fp,buf);
- break;
- }
- case VCVT_RAW: {
- appendcOFile(fp,'\n');
- writeBase64(fp,(unsigned char*)(ANY_VALUE_OF(o)),size);
- break;
- }
- case VCVT_VOBJECT:
- appendcOFile(fp,'\n');
- writeVObject_(fp,VOBJECT_VALUE_OF(o));
- break;
- }
-}
-
-static void writeAttrValue(OFile *fp, VObject *o)
-{
- if (NAME_OF(o)) {
- struct PreDefProp *pi;
- pi = lookupPropInfo(NAME_OF(o));
- if (pi && ((pi->flags & PD_INTERNAL) != 0)) return;
- appendcOFile(fp,';');
- appendsOFile(fp,NAME_OF(o));
- }
- else
- appendcOFile(fp,';');
- if (VALUE_TYPE(o)) {
- appendcOFile(fp,'=');
- writeValue(fp,o,0);
- }
-}
-
-static void writeGroup(OFile *fp, VObject *o)
-{
- char buf1[256];
- char buf2[256];
- strcpy(buf1,NAME_OF(o));
- while ((o=isAPropertyOf(o,VCGroupingProp)) != 0) {
- strcpy(buf2,STRINGZ_VALUE_OF(o));
- strcat(buf2,".");
- strcat(buf2,buf1);
- strcpy(buf1,buf2);
- }
- appendsOFile(fp,buf1);
-}
-
-static int inList(const char **list, const char *s)
-{
- if (list == 0) return 0;
- while (*list) {
- if (stricmp(*list,s) == 0) return 1;
- list++;
- }
- return 0;
-}
-
-static void writeProp(OFile *fp, VObject *o)
-{
- if (NAME_OF(o)) {
- struct PreDefProp *pi;
- VObjectIterator t;
- const char **fields_ = 0;
- pi = lookupPropInfo(NAME_OF(o));
- if (pi && ((pi->flags & PD_BEGIN) != 0)) {
- writeVObject_(fp,o);
- return;
- }
- if (isAPropertyOf(o,VCGroupingProp))
- writeGroup(fp,o);
- else
- appendsOFile(fp,NAME_OF(o));
- if (pi) fields_ = pi->fields;
- initPropIterator(&t,o);
- while (moreIteration(&t)) {
- const char *s;
- VObject *eachProp = nextVObject(&t);
- s = NAME_OF(eachProp);
- if (stricmp(VCGroupingProp,s) && !inList(fields_,s))
- writeAttrValue(fp,eachProp);
- }
- if (fields_) {
- int i = 0, n = 0;
- const char** fields = fields_;
- /* output prop as fields */
- appendcOFile(fp,':');
- while (*fields) {
- VObject *t = isAPropertyOf(o,*fields);
- i++;
- if (t) n = i;
- fields++;
- }
- fields = fields_;
- for (i=0;i<n;i++) {
- writeValue(fp,isAPropertyOf(o,*fields),0);
- fields++;
- if (i<(n-1)) appendcOFile(fp,';');
- }
- }
- }
-
- if (VALUE_TYPE(o)) {
- unsigned long size = 0;
- VObject *p = isAPropertyOf(o,VCDataSizeProp);
- if (p) size = LONG_VALUE_OF(p);
- appendcOFile(fp,':');
- writeValue(fp,o,size);
- }
-
- appendcOFile(fp,'\n');
-}
-
-static void writeVObject_(OFile *fp, VObject *o)
-{
- if (NAME_OF(o)) {
- struct PreDefProp *pi;
- pi = lookupPropInfo(NAME_OF(o));
-
- if (pi && ((pi->flags & PD_BEGIN) != 0)) {
- VObjectIterator t;
- const char *begin = NAME_OF(o);
- appendsOFile(fp,"BEGIN:");
- appendsOFile(fp,begin);
- appendcOFile(fp,'\n');
- initPropIterator(&t,o);
- while (moreIteration(&t)) {
- VObject *eachProp = nextVObject(&t);
- writeProp(fp, eachProp);
- }
- appendsOFile(fp,"END:");
- appendsOFile(fp,begin);
- appendsOFile(fp,"\n\n");
- }
- }
-}
-
-void writeVObject(FILE *fp, VObject *o)
-{
- OFile ofp;
- initOFile(&ofp,fp);
- writeVObject_(&ofp,o);
-}
-
-DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o)
-{
- FILE *fp = fopen(fname,"w");
- if (fp) {
- writeVObject(fp,o);
- fclose(fp);
- }
-}
-
-DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list)
-{
- FILE *fp = fopen(fname,"w");
- if (fp) {
- while (list) {
- writeVObject(fp,list);
- list = nextVObjectInList(list);
- }
- fclose(fp);
- }
-}
-
-DLLEXPORT(char*) writeMemVObject(char *s, int *len, VObject *o)
-{
- OFile ofp;
- initMemOFile(&ofp,s,len?*len:0);
- writeVObject_(&ofp,o);
- if (len) *len = ofp.len;
- appendcOFile(&ofp,0);
- return ofp.s;
-}
-
-DLLEXPORT(char*) writeMemVObjects(char *s, int *len, VObject *list)
-{
- OFile ofp;
- initMemOFile(&ofp,s,len?*len:0);
- while (list) {
- writeVObject_(&ofp,list);
- list = nextVObjectInList(list);
- }
- if (len) *len = ofp.len;
- appendcOFile(&ofp,0);
- return ofp.s;
-}
-
-/*----------------------------------------------------------------------
- APIs to do fake Unicode stuff.
- ----------------------------------------------------------------------*/
-DLLEXPORT(wchar_t*) fakeUnicode(const char *ps, int *bytes)
-{
- wchar_t *r, *pw;
- int len = strlen(ps)+1;
-
- pw = r = (wchar_t*)malloc(sizeof(wchar_t)*len);
- if (bytes)
- *bytes = len * sizeof(wchar_t);
-
- while (*ps) {
- if (*ps == '\n')
- *pw = (wchar_t)0x2028;
- else if (*ps == '\r')
- *pw = (wchar_t)0x2029;
- else
- *pw = (wchar_t)(unsigned char)*ps;
- ps++; pw++;
- }
- *pw = (wchar_t)0;
-
- return r;
-}
-
-DLLEXPORT(int) uStrLen(const wchar_t *u)
-{
- int i = 0;
- while (*u != (wchar_t)0) { u++; i++; }
- return i;
-}
-
-DLLEXPORT(char*) fakeCString(const wchar_t *u)
-{
- char *s, *t;
- int len = uStrLen(u) + 1;
- t = s = (char*)malloc(len);
- while (*u) {
- if (*u == (wchar_t)0x2028)
- *t = '\n';
- else if (*u == (wchar_t)0x2029)
- *t = '\r';
- else
- *t = (char)*u;
- u++; t++;
- }
- *t = 0;
- return s;
-}
-
-/* end of source file vobject.c */
diff --git a/libversit/vobject.h b/libversit/vobject.h
deleted file mode 100644
index bc31dc8297..0000000000
--- a/libversit/vobject.h
+++ /dev/null
@@ -1,366 +0,0 @@
-/***************************************************************************
-(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-
-For purposes of this license notice, the term Licensors shall mean,
-collectively, Apple Computer, Inc., AT&T Corp., International
-Business Machines Corporation and Siemens Rolm Communications Inc.
-The term Licensor shall mean any of the Licensors.
-
-Subject to acceptance of the following conditions, permission is hereby
-granted by Licensors without the need for written agreement and without
-license or royalty fees, to use, copy, modify and distribute this
-software for any purpose.
-
-The above copyright notice and the following four paragraphs must be
-reproduced in all copies of this software and any software including
-this software.
-
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
-ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
-MODIFICATIONS.
-
-IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
-INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
-OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
-INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The software is provided with RESTRICTED RIGHTS. Use, duplication, or
-disclosure by the government are subject to restrictions set forth in
-DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
-
-***************************************************************************/
-
-/*
-
-The vCard/vCalendar C interface is implemented in the set
-of files as follows:
-
-vcc.y, yacc source, and vcc.c, the yacc output you will use
-implements the core parser
-
-vobject.c implements an API that insulates the caller from
-the parser and changes in the vCard/vCalendar BNF
-
-port.h defines compilation environment dependent stuff
-
-vcc.h and vobject.h are header files for their .c counterparts
-
-vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions
-which you may find useful.
-
-test.c is a standalone test driver that exercises some of
-the features of the APIs provided. Invoke test.exe on a
-VCARD/VCALENDAR input text file and you will see the pretty
-print output of the internal representation (this pretty print
-output should give you a good idea of how the internal
-representation looks like -- there is one such output in the
-following too). Also, a file with the .out suffix is generated
-to show that the internal representation can be written back
-in the original text format.
-
-For more information on this API see the readme.txt file
-which accompanied this distribution.
-
- Also visit:
-
- http://www.versit.com
- http://www.ralden.com
-
-*/
-
-
-#ifndef __VOBJECT_H__
-#define __VOBJECT_H__ 1
-
-
-#include "port.h"
-#include <stdlib.h>
-#include <stdio.h>
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-extern "C" {
-#endif
-
-
-#define VC7bitProp "7BIT"
-#define VC8bitProp "8BIT"
-#define VCAAlarmProp "AALARM"
-#define VCAdditionalNamesProp "ADDN"
-#define VCAdrProp "ADR"
-#define VCAgentProp "AGENT"
-#define VCAIFFProp "AIFF"
-#define VCAOLProp "AOL"
-#define VCAppleLinkProp "APPLELINK"
-#define VCAttachProp "ATTACH"
-#define VCAttendeeProp "ATTENDEE"
-#define VCATTMailProp "ATTMAIL"
-#define VCAudioContentProp "AUDIOCONTENT"
-#define VCAVIProp "AVI"
-#define VCBase64Prop "BASE64"
-#define VCBBSProp "BBS"
-#define VCBirthDateProp "BDAY"
-#define VCBMPProp "BMP"
-#define VCBodyProp "BODY"
-#define VCBusinessRoleProp "ROLE"
-#define VCCalProp "VCALENDAR"
-#define VCCaptionProp "CAP"
-#define VCCardProp "VCARD"
-#define VCCarProp "CAR"
-#define VCCategoriesProp "CATEGORIES"
-#define VCCellularProp "CELL"
-#define VCCGMProp "CGM"
-#define VCCharSetProp "CS"
-#define VCCIDProp "CID"
-#define VCCISProp "CIS"
-#define VCCityProp "L"
-#define VCClassProp "CLASS"
-#define VCCommentProp "NOTE"
-#define VCCompletedProp "COMPLETED"
-#define VCContentIDProp "CONTENT-ID"
-#define VCCountryNameProp "C"
-#define VCDAlarmProp "DALARM"
-#define VCDataSizeProp "DATASIZE"
-#define VCDayLightProp "DAYLIGHT"
-#define VCDCreatedProp "DCREATED"
-#define VCDeliveryLabelProp "LABEL"
-#define VCDescriptionProp "DESCRIPTION"
-#define VCDIBProp "DIB"
-#define VCDisplayStringProp "DISPLAYSTRING"
-#define VCDomesticProp "DOM"
-#define VCDTendProp "DTEND"
-#define VCDTstartProp "DTSTART"
-#define VCDueProp "DUE"
-#define VCEmailAddressProp "EMAIL"
-#define VCEncodingProp "ENCODING"
-#define VCEndProp "END"
-#define VCEventProp "VEVENT"
-#define VCEWorldProp "EWORLD"
-#define VCExNumProp "EXNUM"
-#define VCExpDateProp "EXDATE"
-#define VCExpectProp "EXPECT"
-#define VCExtAddressProp "EXT ADD"
-#define VCFamilyNameProp "F"
-#define VCFaxProp "FAX"
-#define VCFullNameProp "FN"
-#define VCGeoProp "GEO"
-#define VCGeoLocationProp "GEO"
-#define VCGIFProp "GIF"
-#define VCGivenNameProp "G"
-#define VCGroupingProp "Grouping"
-#define VCHomeProp "HOME"
-#define VCIBMMailProp "IBMMail"
-#define VCInlineProp "INLINE"
-#define VCInternationalProp "INTL"
-#define VCInternetProp "INTERNET"
-#define VCISDNProp "ISDN"
-#define VCJPEGProp "JPEG"
-#define VCLanguageProp "LANG"
-#define VCLastModifiedProp "LAST-MODIFIED"
-#define VCLastRevisedProp "REV"
-#define VCLocationProp "LOCATION"
-#define VCLogoProp "LOGO"
-#define VCMailerProp "MAILER"
-#define VCMAlarmProp "MALARM"
-#define VCMCIMailProp "MCIMAIL"
-#define VCMessageProp "MSG"
-#define VCMETProp "MET"
-#define VCModemProp "MODEM"
-#define VCMPEG2Prop "MPEG2"
-#define VCMPEGProp "MPEG"
-#define VCMSNProp "MSN"
-#define VCNamePrefixesProp "NPRE"
-#define VCNameProp "N"
-#define VCNameSuffixesProp "NSUF"
-#define VCNoteProp "NOTE"
-#define VCOrgNameProp "ORGNAME"
-#define VCOrgProp "ORG"
-#define VCOrgUnit2Prop "OUN2"
-#define VCOrgUnit3Prop "OUN3"
-#define VCOrgUnit4Prop "OUN4"
-#define VCOrgUnitProp "OUN"
-#define VCPagerProp "PAGER"
-#define VCPAlarmProp "PALARM"
-#define VCParcelProp "PARCEL"
-#define VCPartProp "PART"
-#define VCPCMProp "PCM"
-#define VCPDFProp "PDF"
-#define VCPGPProp "PGP"
-#define VCPhotoProp "PHOTO"
-#define VCPICTProp "PICT"
-#define VCPMBProp "PMB"
-#define VCPostalBoxProp "BOX"
-#define VCPostalCodeProp "PC"
-#define VCPostalProp "POSTAL"
-#define VCPowerShareProp "POWERSHARE"
-#define VCPreferredProp "PREF"
-#define VCPriorityProp "PRIORITY"
-#define VCProcedureNameProp "PROCEDURENAME"
-#define VCProdIdProp "PRODID"
-#define VCProdigyProp "PRODIGY"
-#define VCPronunciationProp "SOUND"
-#define VCPSProp "PS"
-#define VCPublicKeyProp "KEY"
-#define VCQPProp "QP"
-#define VCQuickTimeProp "QTIME"
-#define VCQuotedPrintableProp "QUOTED-PRINTABLE"
-#define VCRDateProp "RDATE"
-#define VCRegionProp "R"
-#define VCRelatedToProp "RELATED-TO"
-#define VCRepeatCountProp "REPEATCOUNT"
-#define VCResourcesProp "RESOURCES"
-#define VCRNumProp "RNUM"
-#define VCRoleProp "ROLE"
-#define VCRRuleProp "RRULE"
-#define VCRSVPProp "RSVP"
-#define VCRunTimeProp "RUNTIME"
-#define VCSequenceProp "SEQUENCE"
-#define VCSnoozeTimeProp "SNOOZETIME"
-#define VCStartProp "START"
-#define VCStatusProp "STATUS"
-#define VCStreetAddressProp "STREET"
-#define VCSubTypeProp "SUBTYPE"
-#define VCSummaryProp "SUMMARY"
-#define VCTelephoneProp "TEL"
-#define VCTIFFProp "TIFF"
-#define VCTimeZoneProp "TZ"
-#define VCTitleProp "TITLE"
-#define VCTLXProp "TLX"
-#define VCTodoProp "VTODO"
-#define VCTranspProp "TRANSP"
-#define VCUniqueStringProp "UID"
-#define VCURLProp "URL"
-#define VCURLValueProp "URLVAL"
-#define VCValueProp "VALUE"
-#define VCVersionProp "VERSION"
-#define VCVideoProp "VIDEO"
-#define VCVoiceProp "VOICE"
-#define VCWAVEProp "WAVE"
-#define VCWMFProp "WMF"
-#define VCWorkProp "WORK"
-#define VCX400Prop "X400"
-#define VCX509Prop "X509"
-#define VCXRuleProp "XRULE"
-
-/* Extensions */
-
-#define XPilotIdProp "X-PILOTID"
-#define XPilotStatusProp "X-PILOTSTAT"
-
-typedef struct VObject VObject;
-
-typedef struct VObjectIterator {
- VObject* start;
- VObject* next;
- } VObjectIterator;
-
-extern DLLEXPORT(VObject*) newVObject(const char *id);
-extern DLLEXPORT(void) deleteVObject(VObject *p);
-extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size);
-extern DLLEXPORT(void) deleteStr(const char *p);
-extern DLLEXPORT(void) unUseStr(const char *s);
-
-extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id);
-extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s);
-extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s);
-extern DLLEXPORT(void) setVObjectUStringZValue(VObject *o, const wchar_t *s);
-extern DLLEXPORT(void) setVObjectUStringZValue_(VObject *o, const wchar_t *s);
-extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i);
-extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l);
-extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t);
-extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size);
-extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size);
-
-extern DLLEXPORT(const char*) vObjectName(VObject *o);
-extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o);
-extern DLLEXPORT(const wchar_t*) vObjectUStringZValue(VObject *o);
-extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o);
-extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o);
-extern DLLEXPORT(void*) vObjectAnyValue(VObject *o);
-extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o);
-extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p);
-
-extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p);
-extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id);
-extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id);
-extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v);
-extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size);
-extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size);
-extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g);
-extern DLLEXPORT(void) addList(VObject **o, VObject *p);
-
-extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id);
-
-extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o);
-extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o);
-extern DLLEXPORT(int) moreIteration(VObjectIterator *i);
-extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i);
-
-extern DLLEXPORT(char*) writeMemVObject(char *s, int *len, VObject *o);
-extern DLLEXPORT(char*) writeMemVObjects(char *s, int *len, VObject *list);
-
-extern DLLEXPORT(const char*) lookupStr(const char *s);
-extern DLLEXPORT(void) cleanStrTbl();
-
-extern DLLEXPORT(void) cleanVObject(VObject *o);
-extern DLLEXPORT(void) cleanVObjects(VObject *list);
-
-extern DLLEXPORT(const char*) lookupProp(const char* str);
-extern DLLEXPORT(const char*) lookupProp_(const char* str);
-
-extern DLLEXPORT(wchar_t*) fakeUnicode(const char *ps, int *bytes);
-extern DLLEXPORT(int) uStrLen(const wchar_t *u);
-extern DLLEXPORT(char*) fakeCString(const wchar_t *u);
-
-extern DLLEXPORT(void) printVObjectToFile(char *fname,VObject *o);
-extern DLLEXPORT(void) printVObjectsToFile(char *fname,VObject *list);
-extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o);
-extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list);
-
-extern DLLEXPORT(int) vObjectValueType(VObject *o);
-
-/* return type of vObjectValueType: */
-#define VCVT_NOVALUE 0
- /* if the VObject has no value associated with it. */
-#define VCVT_STRINGZ 1
- /* if the VObject has value set by setVObjectStringZValue. */
-#define VCVT_USTRINGZ 2
- /* if the VObject has value set by setVObjectUStringZValue. */
-#define VCVT_UINT 3
- /* if the VObject has value set by setVObjectIntegerValue. */
-#define VCVT_ULONG 4
- /* if the VObject has value set by setVObjectLongValue. */
-#define VCVT_RAW 5
- /* if the VObject has value set by setVObjectAnyValue. */
-#define VCVT_VOBJECT 6
- /* if the VObject has value set by setVObjectVObjectValue. */
-
-extern const char** fieldedProp;
-
-/* NOTE regarding printVObject and writeVObject
-
-The functions below are not exported from the DLL because they
-take a FILE* as a parameter, which cannot be passed across a DLL
-interface (at least that is my experience). Instead you can use
-their companion functions which take file names or pointers
-to memory. However, if you are linking this code into
-your build directly then you may find them a more convenient API
-and you can go ahead and use them. If you try to use them with
-the DLL LIB you will get a link error.
-*/
-extern void printVObject(FILE *fp,VObject *o);
-extern void writeVObject(FILE *fp, VObject *o);
-
-
-#if defined(__CPLUSPLUS__) || defined(__cplusplus)
-}
-#endif
-
-#endif /* __VOBJECT_H__ */
-
-
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/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 10cdebc6d6..0000000000
--- a/tests/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-test1
-test2
-test3
-test4
-test5
-test6
-test7
-Makefile.in
-Makefile
-.deps
-.libs
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index 85ee40b3a1..0000000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,26 +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)
-# $(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 \
- 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/ChangeLog b/widgets/ChangeLog
deleted file mode 100644
index 7e75163aae..0000000000
--- a/widgets/ChangeLog
+++ /dev/null
@@ -1,544 +0,0 @@
-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/Makefile.am b/widgets/Makefile.am
deleted file mode 100644
index 73bd54ee2c..0000000000
--- a/widgets/Makefile.am
+++ /dev/null
@@ -1,65 +0,0 @@
-
-SUBDIRS =
- meeting-time-sel
-
-INCLUDES = \
- -I$(top_srcdir)/camel \
- -I$(top_builddir)/camel \
- $(GNOME_INCLUDEDIR)
-
-noinst_LIBRARIES = \
- libevolutionwidgets.a
-
-libevolutionwidgets_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-cursors.c \
- e-cursors.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) \
- libevolutionwidgets.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/ROADMAP.e-table b/widgets/ROADMAP.e-table
deleted file mode 100644
index 4edacced86..0000000000
--- a/widgets/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/TODO b/widgets/TODO
deleted file mode 100644
index 29dbd454e5..0000000000
--- a/widgets/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/add-col.xpm b/widgets/add-col.xpm
deleted file mode 100644
index 9c5f314c8e..0000000000
--- a/widgets/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/check-empty.xpm b/widgets/check-empty.xpm
deleted file mode 100644
index 2dd873e137..0000000000
--- a/widgets/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/check-filled.xpm b/widgets/check-filled.xpm
deleted file mode 100644
index 689d7a7967..0000000000
--- a/widgets/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-cell-checkbox.c b/widgets/e-cell-checkbox.c
deleted file mode 100644
index 6e4b597abf..0000000000
--- a/widgets/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.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-cell-checkbox.h b/widgets/e-cell-checkbox.h
deleted file mode 100644
index 969e4a5edc..0000000000
--- a/widgets/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-cell-string.c b/widgets/e-cell-string.c
deleted file mode 100644
index 992b1bd10e..0000000000
--- a/widgets/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-cell-text.c b/widgets/e-cell-text.c
deleted file mode 100644
index 79fe432326..0000000000
--- a/widgets/e-cell-text.c
+++ /dev/null
@@ -1,484 +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.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;
- ETableItem *eti;
-
- /*
- * 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->eti, 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.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->eti);
-}
-
-/*
- * 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::realize method
- */
-static ECellView *
-ect_realize (ECell *ecell, ETableModel *table_model, void *view)
-{
- ECellText *ect = E_CELL_TEXT (ecell);
- ECellTextView *text_view = g_new0 (ECellTextView, 1);
- ETableItem *eti = E_TABLE_ITEM (view);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas;
-
- text_view->cell_view.ecell = ecell;
- text_view->cell_view.table_model = table_model;
-
- text_view->gc = gdk_gc_new (GTK_WIDGET (canvas)->window);
- 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->eti = eti;
- text_view->canvas = canvas;
-
- return (ECellView *)text_view;
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-ect_unrealize (ECellView *ecv)
-{
- ECellTextView *text_view = (ECellTextView *) ecv;
-
- gdk_gc_unref (text_view->gc);
- text_view->gc = NULL;
-
- gdk_font_unref (text_view->font);
- text_view->font = NULL;
-
- g_free (text_view);
-}
-
-/*
- * 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->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);
-
- 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->eti, 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->eti, 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->eti);
-}
-
-/*
- * 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->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->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-cell-text.h b/widgets/e-cell-text.h
deleted file mode 100644
index de9629b97b..0000000000
--- a/widgets/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-cell-toggle.c b/widgets/e-cell-toggle.c
deleted file mode 100644
index dbe5fe5cbd..0000000000
--- a/widgets/e-cell-toggle.c
+++ /dev/null
@@ -1,284 +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.h"
-#include "e-table-item.h"
-
-#define PARENT_TYPE e_cell_get_type()
-
-typedef struct {
- ECellView cell_view;
- GdkGC *gc;
- GnomeCanvas *canvas;
- ETableItem *eti;
-} 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->eti, view_col, view_row, view_col, view_row);
-}
-
-/*
- * ECell::realize method
- */
-static ECellView *
-etog_realize (ECell *ecell, ETableModel *table_model, void *view)
-{
- ECellToggleView *toggle_view = g_new0 (ECellToggleView, 1);
- ETableItem *eti = E_TABLE_ITEM (view);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas;
-
- toggle_view->cell_view.ecell = ecell;
- toggle_view->cell_view.table_model = table_model;
- toggle_view->eti = eti;
- toggle_view->canvas = canvas;
- toggle_view->gc = gdk_gc_new (GTK_WIDGET (canvas)->window);
-
- return (ECellView *) toggle_view;
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-etog_unrealize (ECellView *ecv)
-{
- ECellToggleView *toggle_view = (ECellToggleView *) ecv;
-
- gdk_gc_unref (toggle_view->gc);
- toggle_view->gc = NULL;
-
- g_free (toggle_view);
-}
-
-/*
- * 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->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.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->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->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-cell-toggle.h b/widgets/e-cell-toggle.h
deleted file mode 100644
index d5773b454a..0000000000
--- a/widgets/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-cell.c b/widgets/e-cell.c
deleted file mode 100644
index 4495bbb1a7..0000000000
--- a/widgets/e-cell.c
+++ /dev/null
@@ -1,152 +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.h"
-
-#define PARENT_TYPE gtk_object_get_type()
-
-static ECellView *
-ec_realize (ECell *e_cell, ETableModel *table_model, void *view)
-{
- return NULL;
-}
-
-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->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_realize (ECell *ecell, ETableModel *table_model, void *view)
-{
- return E_CELL_CLASS (GTK_OBJECT (ecell)->klass)->realize (
- ecell, table_model, 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-cell.h b/widgets/e-cell.h
deleted file mode 100644
index 23173a586c..0000000000
--- a/widgets/e-cell.h
+++ /dev/null
@@ -1,63 +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 *table_model;
-
- 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 *(*realize) (ECell *ecell, ETableModel *table_model, void *view);
- void (*unrealize) (ECellView *e_cell_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);
-void e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row);
-ECellView *e_cell_realize (ECell *ecell, ETableModel *table_model, void *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-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-col-dnd.h b/widgets/e-table-col-dnd.h
deleted file mode 100644
index c1c26175c7..0000000000
--- a/widgets/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-col.c b/widgets/e-table-col.c
deleted file mode 100644
index 86392a9419..0000000000
--- a/widgets/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.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-col.h b/widgets/e-table-col.h
deleted file mode 100644
index 54f03ae237..0000000000
--- a/widgets/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-column-item.c b/widgets/e-table-column-item.c
deleted file mode 100644
index 0616327a93..0000000000
--- a/widgets/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-column-item.h b/widgets/e-table-column-item.h
deleted file mode 100644
index fd38681a73..0000000000
--- a/widgets/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-column-model.h b/widgets/e-table-column-model.h
deleted file mode 100644
index 043dd783ca..0000000000
--- a/widgets/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-column.c b/widgets/e-table-column.c
deleted file mode 100644
index d17a285321..0000000000
--- a/widgets/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-group.c b/widgets/e-table-group.c
deleted file mode 100644
index 76c317369e..0000000000
--- a/widgets/e-table-group.c
+++ /dev/null
@@ -1,139 +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 <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-util.h"
-
-#define TITLE_HEIGHT 16
-#define GROUP_INDENT 10
-
-#define PARENT_TYPE gnome_canvas_group_get_type ()
-
-static GnomeCanvasGroupClass *etg_parent_class;
-
-static void
-etg_destroy (GtkObject *object)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
-
- gtk_object_unref (GTK_OBJECT (etg->ecol));
-
- GTK_OBJECT_CLASS (etg_parent_class)->destroy (object);
-}
-
-static int
-etg_width (ETableGroup *etg)
-{
- return e_table_header_total_width (etg->header) + GROUP_INDENT;
-}
-
-static int
-etg_height (ETableGroup *etg)
-{
- GnomeCanvasItem *child = etg->child;
-
- return TITLE_HEIGHT + (child->y2 - child->y1);
-}
-
-static void
-etg_header_changed (ETableHeader *header, ETableGroup *etg)
-{
- gnome_canvas_item_set (
- etg->rect,
- "x2", (double) etg_width (etg),
- NULL);
-}
-
-void
-e_table_group_construct (GnomeCanvasGroup *parent, ETableGroup *etg,
- ETableHeader *header, int col,
- GnomeCanvasItem *child, int open)
-{
- gnome_canvas_item_constructv (GNOME_CANVAS_ITEM (etg), parent, 0, NULL);
-
- gtk_object_ref (GTK_OBJECT (header));
-
- etg->header = header;
- etg->col = col;
- etg->ecol = e_table_header_get_column (header, col);
- etg->open = open;
-
- gtk_signal_connect (
- GTK_OBJECT (header), "dimension_change",
- GTK_SIGNAL_FUNC (etg_header_changed), etg);
-
- etg->child = child;
-
- 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 (etg),
- "y2", (double) etg_height (etg),
- NULL);
-
-
- /*
- * 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);
-}
-
-GnomeCanvasItem *
-e_table_group_new (GnomeCanvasGroup *parent, ETableHeader *header, int col, GnomeCanvasItem *child, int open)
-{
- ETableGroup *etg;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (header != NULL, NULL);
- g_return_val_if_fail (child != NULL, NULL);
-
- etg = gtk_type_new (e_table_group_get_type ());
-
- e_table_group_construct (parent, etg, header, col, child, open);
-
- return GNOME_CANVAS_ITEM (etg);
-}
-
-static void
-etg_realize (GnomeCanvasItem *item)
-{
- ETableGroup *etg = E_TABLE_GROUP (item);
-
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->realize (item);
-}
-
-static void
-etg_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- object_class->destroy = etg_destroy;
-
- item_class->realize = etg_realize;
-
- etg_parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-E_MAKE_TYPE (e_table_group, "ETableGroup", ETableGroup, etg_class_init, NULL, PARENT_TYPE);
-
-
-
diff --git a/widgets/e-table-group.h b/widgets/e-table-group.h
deleted file mode 100644
index 18f4b710b1..0000000000
--- a/widgets/e-table-group.h
+++ /dev/null
@@ -1,35 +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;
-
- ETableHeader *header;
- ETableCol *ecol;
- int col;
- int open;
- GnomeCanvasItem *rect, *child;
-} ETableGroup;
-
-typedef struct {
- GnomeCanvasGroupClass parent_class;
-} ETableGroupClass;
-
-GnomeCanvasItem *e_table_group_new (GnomeCanvasGroup *parent, ETableHeader *header,
- int col, GnomeCanvasItem *child, int open);
-void e_table_group_construct (GnomeCanvasGroup *parent, ETableGroup *etg,
- ETableHeader *header, int col,
- GnomeCanvasItem *child, int open);
-GtkType e_table_group_get_type (void);
-
-#endif /* _E_TABLE_TREE_H_ */
diff --git a/widgets/e-table-header-item.c b/widgets/e-table-header-item.c
deleted file mode 100644
index 7cea9ae7a0..0000000000
--- a/widgets/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-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-col-dnd.h"
-#include "e-cursors.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-header-item.h b/widgets/e-table-header-item.h
deleted file mode 100644
index 5522d24fae..0000000000
--- a/widgets/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-header.c b/widgets/e-table-header.c
deleted file mode 100644
index 7c54bd936e..0000000000
--- a/widgets/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-header.h b/widgets/e-table-header.h
deleted file mode 100644
index 96e65fdc2f..0000000000
--- a/widgets/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-item.c b/widgets/e-table-item.c
deleted file mode 100644
index 23b72d5557..0000000000
--- a/widgets/e-table-item.c
+++ /dev/null
@@ -1,1188 +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,
- 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;
-
- /*
- * 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_realize (col->ecell, eti->table_model, eti);
- }
-}
-
-/*
- * During unrealization: we invoke every e-cell (one per column in the current
- * setup) to dispose all resources allocated
- */
-static void
-eti_unrealize_cell_views (ETableItem *eti)
-{
- int i;
-
- for (i = 0; i < eti->n_cells; i++){
- e_cell_unrealize (eti->cell_views [i]);
- eti->cell_views [i] = NULL;
- }
- g_free (eti->cell_views);
- eti->cell_views = NULL;
- eti->n_cells = 0;
-
-}
-
-/*
- * GnomeCanvasItem::update method
- */
-static void
-eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
- double i2c [6];
- ArtPoint c1, c2, i1, i2;
-
- if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags);
-
- 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;
-
- printf ("BBOX: %g %g %g %g\n", 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);
- 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;
-
- 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;
-}
-
-/*
- * 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->height = eti_get_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);
-
- 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_realize_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);
-
- /*
- *
- */
- eti_realize_cell_views (eti);
-
- eti->height = eti_get_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 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){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col - 1, eti->focused_row);
- }
- return TRUE;
-
- case GDK_Right:
- if (!eti->mode_spreadsheet && eti_editing (eti))
- break;
-
- if ((eti->focused_col + 1) < eti->cols){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col + 1, eti->focused_row);
- }
- return TRUE;
-
- case GDK_Up:
- if (eti->focused_row > 0){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col, eti->focused_row - 1);
- }
- return TRUE;
-
- case GDK_Down:
- if ((eti->focused_row + 1) < eti->rows){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col, eti->focused_row + 1);
- }
- return TRUE;
- 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;
-
- 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);
-
- 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
- */
- gtk_widget_grab_focus (GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas));
-}
-
-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-item.h b/widgets/e-table-item.h
deleted file mode 100644
index e9125431b1..0000000000
--- a/widgets/e-table-item.h
+++ /dev/null
@@ -1,104 +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;
-
- 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);
-} 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-model.c b/widgets/e-table-model.c
deleted file mode 100644
index 9e397710ef..0000000000
--- a/widgets/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-model.h b/widgets/e-table-model.h
deleted file mode 100644
index fb37731a8a..0000000000
--- a/widgets/e-table-model.h
+++ /dev/null
@@ -1,60 +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-render.c b/widgets/e-table-render.c
deleted file mode 100644
index 49d742132b..0000000000
--- a/widgets/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-render.h b/widgets/e-table-render.h
deleted file mode 100644
index ebc65968f0..0000000000
--- a/widgets/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-simple.c b/widgets/e-table-simple.c
deleted file mode 100644
index 943a3291e9..0000000000
--- a/widgets/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-simple.h b/widgets/e-table-simple.h
deleted file mode 100644
index d890245386..0000000000
--- a/widgets/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-sorted.c b/widgets/e-table-sorted.c
deleted file mode 100644
index 6bc55ad9dc..0000000000
--- a/widgets/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.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-sorted.h b/widgets/e-table-sorted.h
deleted file mode 100644
index 2ec52df2e7..0000000000
--- a/widgets/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-subset.c b/widgets/e-table-subset.c
deleted file mode 100644
index 88f5c18c85..0000000000
--- a/widgets/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.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-subset.h b/widgets/e-table-subset.h
deleted file mode 100644
index 314f28aea6..0000000000
--- a/widgets/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-tree.h b/widgets/e-table-tree.h
deleted file mode 100644
index e7e125a6af..0000000000
--- a/widgets/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.c b/widgets/e-table.c
deleted file mode 100644
index b5f77f622b..0000000000
--- a/widgets/e-table.c
+++ /dev/null
@@ -1,508 +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-table.h"
-#include "e-util.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;
-
-typedef struct {
- ETableModel *table;
- GnomeCanvasItem *table_item;
- GnomeCanvasItem *lead;
-} Leaf;
-
-typedef struct {
-
-} Node;
-
-
-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);
-
-}
-
-static Leaf *
-e_table_create_leaf (ETable *e_table, ETableModel *etm, int col, int height)
-{
- Leaf *leaf;
-
- leaf = g_new (Leaf, 1);
- leaf->table = etm;
-
- leaf->table_item = gnome_canvas_item_new (
- gnome_canvas_root (e_table->table_canvas),
- e_table_item_get_type (),
- "ETableHeader", e_table->header,
- "ETableModel", etm,
- "x", (double) 0,
- "y", (double) 0,
- "drawgrid", e_table->draw_grid,
- "drawfocus", e_table->draw_focus,
- "spreadsheet", e_table->spreadsheet,
- NULL);
-
- leaf->lead = e_table_group_new (
- gnome_canvas_root (e_table->table_canvas),
- e_table->header, col, leaf->table_item, TRUE);
-
- gnome_canvas_item_set (
- leaf->lead,
- "y", (double) height,
- NULL);
-
- return leaf;
-}
-
-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;
-
- printf ("Creating subset of %d elements\n", sub_size);
- 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;
-}
-
-static int
-leaf_height (Leaf *leaf)
-{
- return leaf->lead->y2 - leaf->lead->y1;
-}
-
-static Leaf *
-e_table_create_nodes (ETable *e_table, ETableModel *model, ETableHeader *header,
- GnomeCanvasGroup *root, int height, int *groups_list)
-{
- GArray *groups;
- ETableModel **tables;
- int key_col, i;
- GCompareFunc comp;
- Leaf *leaf;
- GnomeCanvasItem *group;
-
- if (groups_list)
- key_col = *groups_list;
- else
- key_col = -1;
-
- if (key_col == -1){
- printf ("Leaf->with %d rows\n", e_table_model_row_count (model));
- leaf = e_table_create_leaf (e_table, model, key_col, height);
-
- return leaf;
- }
-
- /*
- * Create groups
- */
- comp = e_table_header_get_column (header, key_col)->compare;
- groups = e_table_create_groups (model, key_col, comp);
- tables = e_table_make_subtables (e_table->model, groups);
- e_table_destroy_groups (groups);
-
- leaf = g_new0 (Leaf, 1);
-
- leaf->table = NULL;
- leaf->table_item = NULL;
- group = gnome_canvas_item_new (
- root,
- gnome_canvas_group_get_type (),
- NULL);
-
- height = 0;
- for (i = 0; tables [i] != NULL; i++){
- printf ("Creating->%d with %d rows\n", i, e_table_model_row_count (tables [i]));
-
- leaf = e_table_create_nodes (
- e_table, tables [i], header, GNOME_CANVAS_GROUP (group), height,
- &groups_list [1]);
-
- height += leaf_height (leaf);
- }
-
- leaf->lead = e_table_group_new (
- root,
- e_table->header, key_col, group, TRUE);
-
- return leaf;
-}
-
-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;
- Leaf *leaf;
- int *groups;
-
- 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);
-
- e_table->gen_header_width = e_table_header_total_width (e_table->header);
-
- leaf = e_table_create_nodes (
- e_table, e_table->model,
- e_table->header, GNOME_CANVAS_GROUP (e_table->root), 0, groups);
-
- {
- static int warn_shown;
-
- if (!warn_shown){
- g_warning ("Precompute the width, and update on model changes");
- warn_shown = 1;
- }
- }
-
- 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);
-}
-
-GtkType e_table_canvas_get_type (void);
-
-E_MAKE_TYPE (e_table_canvas, "ETableCanvas", ETableCanvas, e_table_canvas_class_init,
- NULL, 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.h b/widgets/e-table.h
deleted file mode 100644
index eb089781b9..0000000000
--- a/widgets/e-table.h
+++ /dev/null
@@ -1,53 +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;
-
- /*
- * Used during table generation
- */
- int gen_header_width;
-} 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/.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 7e75163aae..0000000000
--- a/widgets/e-table/ChangeLog
+++ /dev/null
@@ -1,544 +0,0 @@
-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/Makefile.am b/widgets/e-table/Makefile.am
deleted file mode 100644
index 73bd54ee2c..0000000000
--- a/widgets/e-table/Makefile.am
+++ /dev/null
@@ -1,65 +0,0 @@
-
-SUBDIRS =
- meeting-time-sel
-
-INCLUDES = \
- -I$(top_srcdir)/camel \
- -I$(top_builddir)/camel \
- $(GNOME_INCLUDEDIR)
-
-noinst_LIBRARIES = \
- libevolutionwidgets.a
-
-libevolutionwidgets_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-cursors.c \
- e-cursors.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) \
- libevolutionwidgets.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 6e4b597abf..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.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 79fe432326..0000000000
--- a/widgets/e-table/e-cell-text.c
+++ /dev/null
@@ -1,484 +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.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;
- ETableItem *eti;
-
- /*
- * 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->eti, 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.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->eti);
-}
-
-/*
- * 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::realize method
- */
-static ECellView *
-ect_realize (ECell *ecell, ETableModel *table_model, void *view)
-{
- ECellText *ect = E_CELL_TEXT (ecell);
- ECellTextView *text_view = g_new0 (ECellTextView, 1);
- ETableItem *eti = E_TABLE_ITEM (view);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas;
-
- text_view->cell_view.ecell = ecell;
- text_view->cell_view.table_model = table_model;
-
- text_view->gc = gdk_gc_new (GTK_WIDGET (canvas)->window);
- 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->eti = eti;
- text_view->canvas = canvas;
-
- return (ECellView *)text_view;
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-ect_unrealize (ECellView *ecv)
-{
- ECellTextView *text_view = (ECellTextView *) ecv;
-
- gdk_gc_unref (text_view->gc);
- text_view->gc = NULL;
-
- gdk_font_unref (text_view->font);
- text_view->font = NULL;
-
- g_free (text_view);
-}
-
-/*
- * 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->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);
-
- 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->eti, 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->eti, 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->eti);
-}
-
-/*
- * 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->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->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 dbe5fe5cbd..0000000000
--- a/widgets/e-table/e-cell-toggle.c
+++ /dev/null
@@ -1,284 +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.h"
-#include "e-table-item.h"
-
-#define PARENT_TYPE e_cell_get_type()
-
-typedef struct {
- ECellView cell_view;
- GdkGC *gc;
- GnomeCanvas *canvas;
- ETableItem *eti;
-} 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->eti, view_col, view_row, view_col, view_row);
-}
-
-/*
- * ECell::realize method
- */
-static ECellView *
-etog_realize (ECell *ecell, ETableModel *table_model, void *view)
-{
- ECellToggleView *toggle_view = g_new0 (ECellToggleView, 1);
- ETableItem *eti = E_TABLE_ITEM (view);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas;
-
- toggle_view->cell_view.ecell = ecell;
- toggle_view->cell_view.table_model = table_model;
- toggle_view->eti = eti;
- toggle_view->canvas = canvas;
- toggle_view->gc = gdk_gc_new (GTK_WIDGET (canvas)->window);
-
- return (ECellView *) toggle_view;
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-etog_unrealize (ECellView *ecv)
-{
- ECellToggleView *toggle_view = (ECellToggleView *) ecv;
-
- gdk_gc_unref (toggle_view->gc);
- toggle_view->gc = NULL;
-
- g_free (toggle_view);
-}
-
-/*
- * 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->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.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->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->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 4495bbb1a7..0000000000
--- a/widgets/e-table/e-cell.c
+++ /dev/null
@@ -1,152 +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.h"
-
-#define PARENT_TYPE gtk_object_get_type()
-
-static ECellView *
-ec_realize (ECell *e_cell, ETableModel *table_model, void *view)
-{
- return NULL;
-}
-
-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->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_realize (ECell *ecell, ETableModel *table_model, void *view)
-{
- return E_CELL_CLASS (GTK_OBJECT (ecell)->klass)->realize (
- ecell, table_model, 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 23173a586c..0000000000
--- a/widgets/e-table/e-cell.h
+++ /dev/null
@@ -1,63 +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 *table_model;
-
- 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 *(*realize) (ECell *ecell, ETableModel *table_model, void *view);
- void (*unrealize) (ECellView *e_cell_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);
-void e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row);
-ECellView *e_cell_realize (ECell *ecell, ETableModel *table_model, void *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 86392a9419..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.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 76c317369e..0000000000
--- a/widgets/e-table/e-table-group.c
+++ /dev/null
@@ -1,139 +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 <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-util.h"
-
-#define TITLE_HEIGHT 16
-#define GROUP_INDENT 10
-
-#define PARENT_TYPE gnome_canvas_group_get_type ()
-
-static GnomeCanvasGroupClass *etg_parent_class;
-
-static void
-etg_destroy (GtkObject *object)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
-
- gtk_object_unref (GTK_OBJECT (etg->ecol));
-
- GTK_OBJECT_CLASS (etg_parent_class)->destroy (object);
-}
-
-static int
-etg_width (ETableGroup *etg)
-{
- return e_table_header_total_width (etg->header) + GROUP_INDENT;
-}
-
-static int
-etg_height (ETableGroup *etg)
-{
- GnomeCanvasItem *child = etg->child;
-
- return TITLE_HEIGHT + (child->y2 - child->y1);
-}
-
-static void
-etg_header_changed (ETableHeader *header, ETableGroup *etg)
-{
- gnome_canvas_item_set (
- etg->rect,
- "x2", (double) etg_width (etg),
- NULL);
-}
-
-void
-e_table_group_construct (GnomeCanvasGroup *parent, ETableGroup *etg,
- ETableHeader *header, int col,
- GnomeCanvasItem *child, int open)
-{
- gnome_canvas_item_constructv (GNOME_CANVAS_ITEM (etg), parent, 0, NULL);
-
- gtk_object_ref (GTK_OBJECT (header));
-
- etg->header = header;
- etg->col = col;
- etg->ecol = e_table_header_get_column (header, col);
- etg->open = open;
-
- gtk_signal_connect (
- GTK_OBJECT (header), "dimension_change",
- GTK_SIGNAL_FUNC (etg_header_changed), etg);
-
- etg->child = child;
-
- 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 (etg),
- "y2", (double) etg_height (etg),
- NULL);
-
-
- /*
- * 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);
-}
-
-GnomeCanvasItem *
-e_table_group_new (GnomeCanvasGroup *parent, ETableHeader *header, int col, GnomeCanvasItem *child, int open)
-{
- ETableGroup *etg;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (header != NULL, NULL);
- g_return_val_if_fail (child != NULL, NULL);
-
- etg = gtk_type_new (e_table_group_get_type ());
-
- e_table_group_construct (parent, etg, header, col, child, open);
-
- return GNOME_CANVAS_ITEM (etg);
-}
-
-static void
-etg_realize (GnomeCanvasItem *item)
-{
- ETableGroup *etg = E_TABLE_GROUP (item);
-
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->realize (item);
-}
-
-static void
-etg_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- object_class->destroy = etg_destroy;
-
- item_class->realize = etg_realize;
-
- etg_parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-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 18f4b710b1..0000000000
--- a/widgets/e-table/e-table-group.h
+++ /dev/null
@@ -1,35 +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;
-
- ETableHeader *header;
- ETableCol *ecol;
- int col;
- int open;
- GnomeCanvasItem *rect, *child;
-} ETableGroup;
-
-typedef struct {
- GnomeCanvasGroupClass parent_class;
-} ETableGroupClass;
-
-GnomeCanvasItem *e_table_group_new (GnomeCanvasGroup *parent, ETableHeader *header,
- int col, GnomeCanvasItem *child, int open);
-void e_table_group_construct (GnomeCanvasGroup *parent, ETableGroup *etg,
- ETableHeader *header, int col,
- GnomeCanvasItem *child, int open);
-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 7cea9ae7a0..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-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-col-dnd.h"
-#include "e-cursors.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 23b72d5557..0000000000
--- a/widgets/e-table/e-table-item.c
+++ /dev/null
@@ -1,1188 +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,
- 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;
-
- /*
- * 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_realize (col->ecell, eti->table_model, eti);
- }
-}
-
-/*
- * During unrealization: we invoke every e-cell (one per column in the current
- * setup) to dispose all resources allocated
- */
-static void
-eti_unrealize_cell_views (ETableItem *eti)
-{
- int i;
-
- for (i = 0; i < eti->n_cells; i++){
- e_cell_unrealize (eti->cell_views [i]);
- eti->cell_views [i] = NULL;
- }
- g_free (eti->cell_views);
- eti->cell_views = NULL;
- eti->n_cells = 0;
-
-}
-
-/*
- * GnomeCanvasItem::update method
- */
-static void
-eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
- double i2c [6];
- ArtPoint c1, c2, i1, i2;
-
- if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags);
-
- 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;
-
- printf ("BBOX: %g %g %g %g\n", 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);
- 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;
-
- 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;
-}
-
-/*
- * 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->height = eti_get_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);
-
- 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_realize_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);
-
- /*
- *
- */
- eti_realize_cell_views (eti);
-
- eti->height = eti_get_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 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){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col - 1, eti->focused_row);
- }
- return TRUE;
-
- case GDK_Right:
- if (!eti->mode_spreadsheet && eti_editing (eti))
- break;
-
- if ((eti->focused_col + 1) < eti->cols){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col + 1, eti->focused_row);
- }
- return TRUE;
-
- case GDK_Up:
- if (eti->focused_row > 0){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col, eti->focused_row - 1);
- }
- return TRUE;
-
- case GDK_Down:
- if ((eti->focused_row + 1) < eti->rows){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col, eti->focused_row + 1);
- }
- return TRUE;
- 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;
-
- 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);
-
- 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
- */
- gtk_widget_grab_focus (GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas));
-}
-
-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 e9125431b1..0000000000
--- a/widgets/e-table/e-table-item.h
+++ /dev/null
@@ -1,104 +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;
-
- 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);
-} 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 fb37731a8a..0000000000
--- a/widgets/e-table/e-table-model.h
+++ /dev/null
@@ -1,60 +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 6bc55ad9dc..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.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 88f5c18c85..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.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 b5f77f622b..0000000000
--- a/widgets/e-table/e-table.c
+++ /dev/null
@@ -1,508 +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-table.h"
-#include "e-util.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;
-
-typedef struct {
- ETableModel *table;
- GnomeCanvasItem *table_item;
- GnomeCanvasItem *lead;
-} Leaf;
-
-typedef struct {
-
-} Node;
-
-
-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);
-
-}
-
-static Leaf *
-e_table_create_leaf (ETable *e_table, ETableModel *etm, int col, int height)
-{
- Leaf *leaf;
-
- leaf = g_new (Leaf, 1);
- leaf->table = etm;
-
- leaf->table_item = gnome_canvas_item_new (
- gnome_canvas_root (e_table->table_canvas),
- e_table_item_get_type (),
- "ETableHeader", e_table->header,
- "ETableModel", etm,
- "x", (double) 0,
- "y", (double) 0,
- "drawgrid", e_table->draw_grid,
- "drawfocus", e_table->draw_focus,
- "spreadsheet", e_table->spreadsheet,
- NULL);
-
- leaf->lead = e_table_group_new (
- gnome_canvas_root (e_table->table_canvas),
- e_table->header, col, leaf->table_item, TRUE);
-
- gnome_canvas_item_set (
- leaf->lead,
- "y", (double) height,
- NULL);
-
- return leaf;
-}
-
-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;
-
- printf ("Creating subset of %d elements\n", sub_size);
- 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;
-}
-
-static int
-leaf_height (Leaf *leaf)
-{
- return leaf->lead->y2 - leaf->lead->y1;
-}
-
-static Leaf *
-e_table_create_nodes (ETable *e_table, ETableModel *model, ETableHeader *header,
- GnomeCanvasGroup *root, int height, int *groups_list)
-{
- GArray *groups;
- ETableModel **tables;
- int key_col, i;
- GCompareFunc comp;
- Leaf *leaf;
- GnomeCanvasItem *group;
-
- if (groups_list)
- key_col = *groups_list;
- else
- key_col = -1;
-
- if (key_col == -1){
- printf ("Leaf->with %d rows\n", e_table_model_row_count (model));
- leaf = e_table_create_leaf (e_table, model, key_col, height);
-
- return leaf;
- }
-
- /*
- * Create groups
- */
- comp = e_table_header_get_column (header, key_col)->compare;
- groups = e_table_create_groups (model, key_col, comp);
- tables = e_table_make_subtables (e_table->model, groups);
- e_table_destroy_groups (groups);
-
- leaf = g_new0 (Leaf, 1);
-
- leaf->table = NULL;
- leaf->table_item = NULL;
- group = gnome_canvas_item_new (
- root,
- gnome_canvas_group_get_type (),
- NULL);
-
- height = 0;
- for (i = 0; tables [i] != NULL; i++){
- printf ("Creating->%d with %d rows\n", i, e_table_model_row_count (tables [i]));
-
- leaf = e_table_create_nodes (
- e_table, tables [i], header, GNOME_CANVAS_GROUP (group), height,
- &groups_list [1]);
-
- height += leaf_height (leaf);
- }
-
- leaf->lead = e_table_group_new (
- root,
- e_table->header, key_col, group, TRUE);
-
- return leaf;
-}
-
-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;
- Leaf *leaf;
- int *groups;
-
- 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);
-
- e_table->gen_header_width = e_table_header_total_width (e_table->header);
-
- leaf = e_table_create_nodes (
- e_table, e_table->model,
- e_table->header, GNOME_CANVAS_GROUP (e_table->root), 0, groups);
-
- {
- static int warn_shown;
-
- if (!warn_shown){
- g_warning ("Precompute the width, and update on model changes");
- warn_shown = 1;
- }
- }
-
- 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);
-}
-
-GtkType e_table_canvas_get_type (void);
-
-E_MAKE_TYPE (e_table_canvas, "ETableCanvas", ETableCanvas, e_table_canvas_class_init,
- NULL, 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 eb089781b9..0000000000
--- a/widgets/e-table/e-table.h
+++ /dev/null
@@ -1,53 +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;
-
- /*
- * Used during table generation
- */
- int gen_header_width;
-} 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 73cb22f4b1..0000000000
--- a/widgets/e-table/table-test.c
+++ /dev/null
@@ -1,45 +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-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 ();
-
-#if 0
- table_browser_test ();
- multi_cols_test ();
- check_test ();
-#endif
- 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 b24a7aff64..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-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 6342a1739f..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-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-cursors.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 63fd7ce271..0000000000
--- a/widgets/e-table/test-table.c
+++ /dev/null
@@ -1,300 +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-cursors.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_show (e_table);
- gtk_widget_show (window);
-}
-
-void
-e_table_test (void)
-{
- load_data ();
- do_e_table_demo ("0,1,2,3,4", NULL);
- do_e_table_demo ("0,1,2,3,4", "3");
- do_e_table_demo ("0,1,2,3,4", "3,4");
-}
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/e-util.h b/widgets/e-util.h
deleted file mode 100644
index ad4d754770..0000000000
--- a/widgets/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/widgets/image1.png b/widgets/image1.png
deleted file mode 100644
index 8326ac241f..0000000000
--- a/widgets/image1.png
+++ /dev/null
Binary files differ
diff --git a/widgets/image2.png b/widgets/image2.png
deleted file mode 100644
index e6a4c75dbe..0000000000
--- a/widgets/image2.png
+++ /dev/null
Binary files differ
diff --git a/widgets/image3.png b/widgets/image3.png
deleted file mode 100644
index 50e16e8620..0000000000
--- a/widgets/image3.png
+++ /dev/null
Binary files differ
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/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/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/remove-col.xpm b/widgets/remove-col.xpm
deleted file mode 100644
index ff1024f0c9..0000000000
--- a/widgets/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/sample.table b/widgets/sample.table
deleted file mode 100644
index 45c8ff0691..0000000000
--- a/widgets/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-test.c b/widgets/table-test.c
deleted file mode 100644
index 73cb22f4b1..0000000000
--- a/widgets/table-test.c
+++ /dev/null
@@ -1,45 +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-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 ();
-
-#if 0
- table_browser_test ();
- multi_cols_test ();
- check_test ();
-#endif
- e_table_test ();
-
- gtk_main ();
-
- e_cursors_shutdown ();
- return 0;
-}
diff --git a/widgets/table-test.h b/widgets/table-test.h
deleted file mode 100644
index ad8cfcc083..0000000000
--- a/widgets/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/.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 6e4b597abf..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.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 79fe432326..0000000000
--- a/widgets/table/e-cell-text.c
+++ /dev/null
@@ -1,484 +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.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;
- ETableItem *eti;
-
- /*
- * 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->eti, 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.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->eti);
-}
-
-/*
- * 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::realize method
- */
-static ECellView *
-ect_realize (ECell *ecell, ETableModel *table_model, void *view)
-{
- ECellText *ect = E_CELL_TEXT (ecell);
- ECellTextView *text_view = g_new0 (ECellTextView, 1);
- ETableItem *eti = E_TABLE_ITEM (view);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas;
-
- text_view->cell_view.ecell = ecell;
- text_view->cell_view.table_model = table_model;
-
- text_view->gc = gdk_gc_new (GTK_WIDGET (canvas)->window);
- 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->eti = eti;
- text_view->canvas = canvas;
-
- return (ECellView *)text_view;
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-ect_unrealize (ECellView *ecv)
-{
- ECellTextView *text_view = (ECellTextView *) ecv;
-
- gdk_gc_unref (text_view->gc);
- text_view->gc = NULL;
-
- gdk_font_unref (text_view->font);
- text_view->font = NULL;
-
- g_free (text_view);
-}
-
-/*
- * 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->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);
-
- 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->eti, 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->eti, 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->eti);
-}
-
-/*
- * 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->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->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 dbe5fe5cbd..0000000000
--- a/widgets/table/e-cell-toggle.c
+++ /dev/null
@@ -1,284 +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.h"
-#include "e-table-item.h"
-
-#define PARENT_TYPE e_cell_get_type()
-
-typedef struct {
- ECellView cell_view;
- GdkGC *gc;
- GnomeCanvas *canvas;
- ETableItem *eti;
-} 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->eti, view_col, view_row, view_col, view_row);
-}
-
-/*
- * ECell::realize method
- */
-static ECellView *
-etog_realize (ECell *ecell, ETableModel *table_model, void *view)
-{
- ECellToggleView *toggle_view = g_new0 (ECellToggleView, 1);
- ETableItem *eti = E_TABLE_ITEM (view);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas;
-
- toggle_view->cell_view.ecell = ecell;
- toggle_view->cell_view.table_model = table_model;
- toggle_view->eti = eti;
- toggle_view->canvas = canvas;
- toggle_view->gc = gdk_gc_new (GTK_WIDGET (canvas)->window);
-
- return (ECellView *) toggle_view;
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-etog_unrealize (ECellView *ecv)
-{
- ECellToggleView *toggle_view = (ECellToggleView *) ecv;
-
- gdk_gc_unref (toggle_view->gc);
- toggle_view->gc = NULL;
-
- g_free (toggle_view);
-}
-
-/*
- * 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->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.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->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->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 4495bbb1a7..0000000000
--- a/widgets/table/e-cell.c
+++ /dev/null
@@ -1,152 +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.h"
-
-#define PARENT_TYPE gtk_object_get_type()
-
-static ECellView *
-ec_realize (ECell *e_cell, ETableModel *table_model, void *view)
-{
- return NULL;
-}
-
-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->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_realize (ECell *ecell, ETableModel *table_model, void *view)
-{
- return E_CELL_CLASS (GTK_OBJECT (ecell)->klass)->realize (
- ecell, table_model, 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 23173a586c..0000000000
--- a/widgets/table/e-cell.h
+++ /dev/null
@@ -1,63 +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 *table_model;
-
- 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 *(*realize) (ECell *ecell, ETableModel *table_model, void *view);
- void (*unrealize) (ECellView *e_cell_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);
-void e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row);
-ECellView *e_cell_realize (ECell *ecell, ETableModel *table_model, void *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 86392a9419..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.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 76c317369e..0000000000
--- a/widgets/table/e-table-group.c
+++ /dev/null
@@ -1,139 +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 <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-util.h"
-
-#define TITLE_HEIGHT 16
-#define GROUP_INDENT 10
-
-#define PARENT_TYPE gnome_canvas_group_get_type ()
-
-static GnomeCanvasGroupClass *etg_parent_class;
-
-static void
-etg_destroy (GtkObject *object)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
-
- gtk_object_unref (GTK_OBJECT (etg->ecol));
-
- GTK_OBJECT_CLASS (etg_parent_class)->destroy (object);
-}
-
-static int
-etg_width (ETableGroup *etg)
-{
- return e_table_header_total_width (etg->header) + GROUP_INDENT;
-}
-
-static int
-etg_height (ETableGroup *etg)
-{
- GnomeCanvasItem *child = etg->child;
-
- return TITLE_HEIGHT + (child->y2 - child->y1);
-}
-
-static void
-etg_header_changed (ETableHeader *header, ETableGroup *etg)
-{
- gnome_canvas_item_set (
- etg->rect,
- "x2", (double) etg_width (etg),
- NULL);
-}
-
-void
-e_table_group_construct (GnomeCanvasGroup *parent, ETableGroup *etg,
- ETableHeader *header, int col,
- GnomeCanvasItem *child, int open)
-{
- gnome_canvas_item_constructv (GNOME_CANVAS_ITEM (etg), parent, 0, NULL);
-
- gtk_object_ref (GTK_OBJECT (header));
-
- etg->header = header;
- etg->col = col;
- etg->ecol = e_table_header_get_column (header, col);
- etg->open = open;
-
- gtk_signal_connect (
- GTK_OBJECT (header), "dimension_change",
- GTK_SIGNAL_FUNC (etg_header_changed), etg);
-
- etg->child = child;
-
- 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 (etg),
- "y2", (double) etg_height (etg),
- NULL);
-
-
- /*
- * 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);
-}
-
-GnomeCanvasItem *
-e_table_group_new (GnomeCanvasGroup *parent, ETableHeader *header, int col, GnomeCanvasItem *child, int open)
-{
- ETableGroup *etg;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (header != NULL, NULL);
- g_return_val_if_fail (child != NULL, NULL);
-
- etg = gtk_type_new (e_table_group_get_type ());
-
- e_table_group_construct (parent, etg, header, col, child, open);
-
- return GNOME_CANVAS_ITEM (etg);
-}
-
-static void
-etg_realize (GnomeCanvasItem *item)
-{
- ETableGroup *etg = E_TABLE_GROUP (item);
-
- GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->realize (item);
-}
-
-static void
-etg_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- object_class->destroy = etg_destroy;
-
- item_class->realize = etg_realize;
-
- etg_parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-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 18f4b710b1..0000000000
--- a/widgets/table/e-table-group.h
+++ /dev/null
@@ -1,35 +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;
-
- ETableHeader *header;
- ETableCol *ecol;
- int col;
- int open;
- GnomeCanvasItem *rect, *child;
-} ETableGroup;
-
-typedef struct {
- GnomeCanvasGroupClass parent_class;
-} ETableGroupClass;
-
-GnomeCanvasItem *e_table_group_new (GnomeCanvasGroup *parent, ETableHeader *header,
- int col, GnomeCanvasItem *child, int open);
-void e_table_group_construct (GnomeCanvasGroup *parent, ETableGroup *etg,
- ETableHeader *header, int col,
- GnomeCanvasItem *child, int open);
-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 7cea9ae7a0..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-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-col-dnd.h"
-#include "e-cursors.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 23b72d5557..0000000000
--- a/widgets/table/e-table-item.c
+++ /dev/null
@@ -1,1188 +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,
- 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;
-
- /*
- * 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_realize (col->ecell, eti->table_model, eti);
- }
-}
-
-/*
- * During unrealization: we invoke every e-cell (one per column in the current
- * setup) to dispose all resources allocated
- */
-static void
-eti_unrealize_cell_views (ETableItem *eti)
-{
- int i;
-
- for (i = 0; i < eti->n_cells; i++){
- e_cell_unrealize (eti->cell_views [i]);
- eti->cell_views [i] = NULL;
- }
- g_free (eti->cell_views);
- eti->cell_views = NULL;
- eti->n_cells = 0;
-
-}
-
-/*
- * GnomeCanvasItem::update method
- */
-static void
-eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
- double i2c [6];
- ArtPoint c1, c2, i1, i2;
-
- if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags);
-
- 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;
-
- printf ("BBOX: %g %g %g %g\n", 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);
- 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;
-
- 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;
-}
-
-/*
- * 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->height = eti_get_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);
-
- 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_realize_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);
-
- /*
- *
- */
- eti_realize_cell_views (eti);
-
- eti->height = eti_get_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 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){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col - 1, eti->focused_row);
- }
- return TRUE;
-
- case GDK_Right:
- if (!eti->mode_spreadsheet && eti_editing (eti))
- break;
-
- if ((eti->focused_col + 1) < eti->cols){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col + 1, eti->focused_row);
- }
- return TRUE;
-
- case GDK_Up:
- if (eti->focused_row > 0){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col, eti->focused_row - 1);
- }
- return TRUE;
-
- case GDK_Down:
- if ((eti->focused_row + 1) < eti->rows){
- e_table_item_leave_edit (eti);
- e_table_item_focus (eti, eti->focused_col, eti->focused_row + 1);
- }
- return TRUE;
- 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;
-
- 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);
-
- 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
- */
- gtk_widget_grab_focus (GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas));
-}
-
-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 e9125431b1..0000000000
--- a/widgets/table/e-table-item.h
+++ /dev/null
@@ -1,104 +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;
-
- 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);
-} 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 fb37731a8a..0000000000
--- a/widgets/table/e-table-model.h
+++ /dev/null
@@ -1,60 +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 6bc55ad9dc..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.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 88f5c18c85..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.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 b5f77f622b..0000000000
--- a/widgets/table/e-table.c
+++ /dev/null
@@ -1,508 +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-table.h"
-#include "e-util.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;
-
-typedef struct {
- ETableModel *table;
- GnomeCanvasItem *table_item;
- GnomeCanvasItem *lead;
-} Leaf;
-
-typedef struct {
-
-} Node;
-
-
-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);
-
-}
-
-static Leaf *
-e_table_create_leaf (ETable *e_table, ETableModel *etm, int col, int height)
-{
- Leaf *leaf;
-
- leaf = g_new (Leaf, 1);
- leaf->table = etm;
-
- leaf->table_item = gnome_canvas_item_new (
- gnome_canvas_root (e_table->table_canvas),
- e_table_item_get_type (),
- "ETableHeader", e_table->header,
- "ETableModel", etm,
- "x", (double) 0,
- "y", (double) 0,
- "drawgrid", e_table->draw_grid,
- "drawfocus", e_table->draw_focus,
- "spreadsheet", e_table->spreadsheet,
- NULL);
-
- leaf->lead = e_table_group_new (
- gnome_canvas_root (e_table->table_canvas),
- e_table->header, col, leaf->table_item, TRUE);
-
- gnome_canvas_item_set (
- leaf->lead,
- "y", (double) height,
- NULL);
-
- return leaf;
-}
-
-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;
-
- printf ("Creating subset of %d elements\n", sub_size);
- 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;
-}
-
-static int
-leaf_height (Leaf *leaf)
-{
- return leaf->lead->y2 - leaf->lead->y1;
-}
-
-static Leaf *
-e_table_create_nodes (ETable *e_table, ETableModel *model, ETableHeader *header,
- GnomeCanvasGroup *root, int height, int *groups_list)
-{
- GArray *groups;
- ETableModel **tables;
- int key_col, i;
- GCompareFunc comp;
- Leaf *leaf;
- GnomeCanvasItem *group;
-
- if (groups_list)
- key_col = *groups_list;
- else
- key_col = -1;
-
- if (key_col == -1){
- printf ("Leaf->with %d rows\n", e_table_model_row_count (model));
- leaf = e_table_create_leaf (e_table, model, key_col, height);
-
- return leaf;
- }
-
- /*
- * Create groups
- */
- comp = e_table_header_get_column (header, key_col)->compare;
- groups = e_table_create_groups (model, key_col, comp);
- tables = e_table_make_subtables (e_table->model, groups);
- e_table_destroy_groups (groups);
-
- leaf = g_new0 (Leaf, 1);
-
- leaf->table = NULL;
- leaf->table_item = NULL;
- group = gnome_canvas_item_new (
- root,
- gnome_canvas_group_get_type (),
- NULL);
-
- height = 0;
- for (i = 0; tables [i] != NULL; i++){
- printf ("Creating->%d with %d rows\n", i, e_table_model_row_count (tables [i]));
-
- leaf = e_table_create_nodes (
- e_table, tables [i], header, GNOME_CANVAS_GROUP (group), height,
- &groups_list [1]);
-
- height += leaf_height (leaf);
- }
-
- leaf->lead = e_table_group_new (
- root,
- e_table->header, key_col, group, TRUE);
-
- return leaf;
-}
-
-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;
- Leaf *leaf;
- int *groups;
-
- 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);
-
- e_table->gen_header_width = e_table_header_total_width (e_table->header);
-
- leaf = e_table_create_nodes (
- e_table, e_table->model,
- e_table->header, GNOME_CANVAS_GROUP (e_table->root), 0, groups);
-
- {
- static int warn_shown;
-
- if (!warn_shown){
- g_warning ("Precompute the width, and update on model changes");
- warn_shown = 1;
- }
- }
-
- 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);
-}
-
-GtkType e_table_canvas_get_type (void);
-
-E_MAKE_TYPE (e_table_canvas, "ETableCanvas", ETableCanvas, e_table_canvas_class_init,
- NULL, 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 eb089781b9..0000000000
--- a/widgets/table/e-table.h
+++ /dev/null
@@ -1,53 +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;
-
- /*
- * Used during table generation
- */
- int gen_header_width;
-} 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 73cb22f4b1..0000000000
--- a/widgets/table/table-test.c
+++ /dev/null
@@ -1,45 +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-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 ();
-
-#if 0
- table_browser_test ();
- multi_cols_test ();
- check_test ();
-#endif
- 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 b24a7aff64..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-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 6342a1739f..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-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-cursors.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 63fd7ce271..0000000000
--- a/widgets/table/test-table.c
+++ /dev/null
@@ -1,300 +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-cursors.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_show (e_table);
- gtk_widget_show (window);
-}
-
-void
-e_table_test (void)
-{
- load_data ();
- do_e_table_demo ("0,1,2,3,4", NULL);
- do_e_table_demo ("0,1,2,3,4", "3");
- do_e_table_demo ("0,1,2,3,4", "3,4");
-}
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 ()
-{
-
-}
-
diff --git a/widgets/test-check.c b/widgets/test-check.c
deleted file mode 100644
index b24a7aff64..0000000000
--- a/widgets/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-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/test-cols.c b/widgets/test-cols.c
deleted file mode 100644
index 6342a1739f..0000000000
--- a/widgets/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-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-cursors.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/test-table.c b/widgets/test-table.c
deleted file mode 100644
index 63fd7ce271..0000000000
--- a/widgets/test-table.c
+++ /dev/null
@@ -1,300 +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-cursors.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_show (e_table);
- gtk_widget_show (window);
-}
-
-void
-e_table_test (void)
-{
- load_data ();
- do_e_table_demo ("0,1,2,3,4", NULL);
- do_e_table_demo ("0,1,2,3,4", "3");
- do_e_table_demo ("0,1,2,3,4", "3,4");
-}
diff --git a/widgets/test.c b/widgets/test.c
deleted file mode 100644
index 0eece34467..0000000000
--- a/widgets/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 ()
-{
-
-}
-